Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions CollectionTreePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ class CollectionTreePlugin extends Omeka_Plugin_AbstractPlugin
'public_items_search',
'admin_collections_show',
'public_collections_show',
'admin_head',
'public_head'
);

/**
Expand All @@ -52,7 +54,9 @@ class CollectionTreePlugin extends Omeka_Plugin_AbstractPlugin
'collection_tree_alpha_order' => 0,
'collection_tree_show_subcollections' => 0,
'collection_tree_hide_orphans' => 0,
'collection_tree_browse_only_root' => 0,
'collection_tree_treeview_style' => 0,
'collection_tree_treeview_expanded' => 0,
'collection_tree_browse_only_root' => 0,
'collection_tree_search_descendant' => 0,
);

Expand Down Expand Up @@ -364,7 +368,28 @@ protected function _appendToCollectionsShow($collection)
);
}
}


/**
* Sets css and js in case treeview style is chosen
*/
public function hookPublicHead($args)
{
if (get_option('collection_tree_treeview_style')) {
queue_css_file('file-explore');
queue_js_file('file-explore');
}
}

/**
* Sets css and js in case treeview style is chosen
*/
public function hookAdminHead($args)
{
if (get_option('collection_tree_treeview_style')) {
queue_css_file('file-explore');
queue_js_file('file-explore');
}
}
/**
* Add the collection tree page to the admin navigation.
*/
Expand Down
33 changes: 33 additions & 0 deletions views/admin/plugins/collection-tree-config-form.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,40 @@
</div>
</div>

<div class="field">
<div class="two columns alpha">
<?php echo $this->formLabel('collection_tree_treeview_style', __('Treeview style')); ?>
</div>
<div class="inputs five columns omega">
<p class="explanation"><?php
echo __('If checked, collection trees are displayed in treeview style.');
?></p>
<?php echo $this->formCheckbox(
'collection_tree_treeview_style',
null,
array('checked' => (bool) get_option('collection_tree_treeview_style'))
); ?>
</div>
</div>

<div class="field">
<div class="two columns alpha">
<?php echo $this->formLabel('collection_tree_treeview_expanded', __('Treeview expanded')); ?>
</div>
<div class="inputs five columns omega">
<p class="explanation"><?php
echo __('If checked, treeview is initially fully expanded in Public and Admin Collection pages.');
?></p>
<?php echo $this->formCheckbox(
'collection_tree_treeview_expanded',
null,
array('checked' => (bool) get_option('collection_tree_treeview_expanded'))
); ?>
</div>
</div>

<h2><?php echo __("Browsing & Searching"); ?></h2>

<div class="field">
<div class="two columns alpha">
<?php echo $this->formLabel('collection_tree_browse_only_root', __('Browse root-level collections only')); ?>
Expand Down
2 changes: 1 addition & 1 deletion views/shared/collections/collection-tree-list.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h2><?php echo __('Collection Tree'); ?></h2>
<div id="collection-tree">
<div id="collection-tree"<?php echo (get_option('collection_tree_treeview_expanded') ? ' class="treeExpanded"' : ''); ?>>
<?php echo $this->collectionTreeList($collection_tree); ?>
</div>
54 changes: 54 additions & 0 deletions views/shared/css/file-explore.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#collection-tree ul {
list-style-type: none;
font-size: 1em;
line-height: 1.8em;
margin-top: 0;
margin-left: 10px;
padding-left: 18px;
border-left: 1px dotted #aaa;
}

#collection-tree li {
position: relative;
}

#collection-tree li a{
text-decoration: none;
}

#collection-tree li:before{
position: absolute;
display: block;
content: " ";
width: 10px;
height: 1px;
border-bottom: 1px dotted #aaa;
top: .6em;
left: -14px;
}

.collection-tree-icon {
display: block;
font-family: FontAwesome;
font-size: 1.2em;
}

.handle:before {
margin-right: .2em;
content: '\f0f6';
float: left;
}

.collapsed:before {
margin-right: .2em;
color: #FFD04E;
content: "\f07b";
cursor: pointer;
}

.expanded:before {
margin-right: .2em;
color: #FFD04E;
content: "\f07c";
cursor: pointer;
}
3 changes: 2 additions & 1 deletion views/shared/index/index.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?php echo head(array('title' => __('Collection Tree'))); ?>
<?php if ($this->full_collection_tree): ?>
<p><?php echo __('Here\'s a view of the Collections\' tree. Click on any Collection\'s name to open it, and on any folder to expand/contract the tree.'); ?></p>
<?php echo $this->full_collection_tree; ?>
<?php else: ?>
<p><?php echo __('There are no collections.'); ?></p>
<?php endif; ?>
<?php echo foot(); ?>
<?php echo foot(); ?>
20 changes: 20 additions & 0 deletions views/shared/javascripts/file-explore.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
jQuery(document).ready(function () {
var treeExpanded = (jQuery("#collection-tree").hasClass("treeExpanded"));

init();

function init() {
if (!treeExpanded) {
jQuery("#collection-tree ul:not(:first)").hide();
}

jQuery("#collection-tree li").prepend("<span class='collection-tree-icon handle'></span>");

jQuery("#collection-tree li:has(ul)")
.children(":first-child").addClass("collapsed")
.click(function(){
jQuery(this).toggleClass("collapsed expanded")
.siblings("ul").toggle();
});
}
});