From cc7cfb8ab19a596f6ec159caa7188c645e0bf174 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Tue, 8 Jun 2021 10:51:56 +0200 Subject: [PATCH 001/161] Update files, add config_form --- FacetsPlugin.php | 318 ++++++++++++++++++++++++++++------------------- config_form.php | 153 +++++++++++++++++++++++ plugin.ini | 6 +- 3 files changed, 349 insertions(+), 128 deletions(-) create mode 100644 config_form.php diff --git a/FacetsPlugin.php b/FacetsPlugin.php index 9deef16..30161fe 100644 --- a/FacetsPlugin.php +++ b/FacetsPlugin.php @@ -1,125 +1,193 @@ -addHelperPath(dirname(__FILE__) . '/views/helpers', 'Facets_View_Helper_'); - } - - public function hookPublicHead($args) - { - queue_css_file('facets'); - } - - public function hookDefineRoutes($args) - { - if (is_admin_theme()) { - return; - } - - //Itemtypes browse - $router = $args['router']; - $router->addRoute( - 'facets', - new Zend_Controller_Router_Route( - "facets", - array( - 'module' => 'facets', - 'controller' => 'facets', - 'action' => 'browse' - ) - ) - ); - - } - - /** - * Deal with search terms (advanced search). - * - * Allows to get refinements when a base Dublin Core is used. - * - * @internal This hook is used twice, first to prepare select for the - * current page, second to get the total count. - * - * @internal This should be used, because the filter is not enough for - * requests with a refinable element that should contains something. - * - * @internal MySql 5.5 has a limit: group by is done before order by, and it - * is complex to skirt. - * - * @see DublinCoreExtendedPlugin::filterItemsBrowseParams() - * - * @param Omeka_Db_Select $select - * @param array $params - */ - public function hookItemsBrowseSql($args) - { - $db = $this->_db; - $select = $args['select']; - $params = $args['params']; - - } - - public function hookPublicItemsBrowse($args) - { - $view = $args['view']; - $items = $args['items']; - - // $params = $args['params']; - $itemsArray = array(); - $allItems = get_db()->getTable('Item')->findAll(); - // $allItems = $this->_helper->db->findBy($params); - foreach($allItems as $item){ - $itemsArray[] = $item->id; - } - - // echo get_view()->partial('facets/browse.php',array( - // 'itemsArray' => $itemsArray, - // 'items' => $items - // )); - - echo get_view()->partial('facets/browse.php',array( - 'itemsArray' => $itemsArray - )); - } -} + array() + ); + set_option('facets_elements', json_encode($defaults)); + set_option('facets_item_types', 1); + set_option('facets_collections', 1); + set_option('facets_tags', 0); + } + + /** + * Uninstalls the plugin. + */ + public function hookUninstall() + { + delete_option('facets_public_hook'); + delete_option('facets_description'); + delete_option('facets_hide_single_entries'); + delete_option('facets_sort_order'); + delete_option('facets_elements'); + delete_option('facets_item_types'); + delete_option('facets_collections'); + delete_option('facets_tags'); + } + + /** + * Initialize this plugin. + */ + public function hookInitialize() + { + get_view()->addHelperPath(dirname(__FILE__) . '/views/helpers', 'Facets_View_Helper_'); + + $settings = json_decode(get_option('facets_elements'), true); + $this->_settings = $settings; + } + + /** + * Shows plugin configuration page. + */ + public function hookConfigForm($args) + { + $settings = $this->_settings; + + $table = get_db()->getTable('Element'); + $select = $table->getSelect() + ->where('element_sets.name = \'Dublin Core\'') + ->order('elements.element_set_id') + ->order('ISNULL(elements.order)') + ->order('elements.order'); + $elements = $table->fetchObjects($select); + + include('config_form.php'); + } + + /** + * Handle the config form. + */ + public function hookConfig($args) + { + $post = $args['post']; + + set_option('facets_public_hook', $post['facets_public_hook']); + set_option('facets_description', $post['facets_description']); + set_option('facets_hide_single_entries', $post['facets_hide_single_entries']); + set_option('facets_sort_order', $post['facets_sort_order']); + + $settings = array( + 'item_elements' => isset($post['item_elements']) ? $post['item_elements'] : array() + ); + set_option('facets_elements', json_encode($settings)); + + set_option('facets_item_types', $post['facets_item_types']); + set_option('facets_collections', $post['facets_collections']); + set_option('facets_tags', $post['facets_tags']); + } + + public function hookPublicHead($args) + { + queue_css_file('facets'); + } + + public function hookDefineRoutes($args) + { + if (is_admin_theme()) { + return; + } + + //Itemtypes browse + $router = $args['router']; + $router->addRoute( + 'facets', + new Zend_Controller_Router_Route ( + "facets", + array( + 'module' => 'facets', + 'controller' => 'facets', + 'action' => 'browse' + ) + ) + ); + } + + public function hookPublicItemsBrowse($args) + { + if (get_option('facets_public_hook') == 'public_items_browse') { + self::showFacets($args); + } + } + + public function hookPublicItemsFacets($args) + { + if (get_option('facets_public_hook') == 'public_items_facets') { + self::showFacets($args); + } + } + + public function showFacets($args) + { + $request = Zend_Controller_Front::getInstance()->getRequest(); + $controller = $request->getControllerName(); + $action = $request->getActionName(); + + // checks whether it's one of the facet cases + if (!($controller == 'search' && $action == 'index') && !($controller == 'items' && $action == 'browse')) return; + + $itemsArray = array(); + $params = array('advanced' => $_GET['advanced'], 'collection' => $_GET['collection'], 'type' => $_GET['type'], 'tags' => $_GET['tags']); + $items = get_records('item', $params, null); + + if (count($items) > 0) { + if ($controller == 'items') { + foreach ($items as $item) { + $itemsArray[] = $item->id; + } + echo get_view()->partial('facets/browse.php', array( + 'itemsArray' => $itemsArray + )); + } elseif ($controller == 'search') { + // this would be for the site-wide simple search; + // main problem is that, differently from advanced search, + // it uses its own "search_texts" table, so results from that + // would have to be crossjoined with the "advanced" ones used + // by the facets; + // besides, advanced search works only for Items, so one might + // want to check whether the site-wide search has been performed + // just on Items. + if ($recordTypes = $_GET['record_types']) { + if (count($recordTypes) == 1 && in_array('Item', $recordTypes)) { + // site-wide search was performend just on Items + } + } + } + } + } +} \ No newline at end of file diff --git a/config_form.php b/config_form.php new file mode 100644 index 0000000..3e96e19 --- /dev/null +++ b/config_form.php @@ -0,0 +1,153 @@ + + + +

+ +
+
+ formLabel('facets_public_hook', __('Public hook')); ?> +
+
+

+ public_items_browse, already coded into every page (so no change is needed), normally showing up at the end of the page; or the plugin\'s own public_items_facets, that has to be coded into relevant theme pages but can be used wherever deemed right.'); ?> +

+ formRadio('facets_public_hook', + get_option('facets_public_hook'), + null, + array( + 'public_items_browse' => __('public_items_browse'), + 'public_items_facets' => __('public_items_facets'), + )); + ?> +
+
+ +

+ +
+
+ formLabel('facets_description', __('Description')); ?> +
+
+

+ +

+ formText('facets_description', get_option('facets_description')); ?> +
+
+ +
+
+ formLabel('facets_hide_single_entries', __('Hide single entries')); ?> +
+
+

+ +

+ formCheckbox('facets_hide_single_entries', get_option('facets_hide_single_entries'), null, array('1', '0')); ?> +
+
+ +
+
+ formLabel('facets_sort_order', __('Sort order')); ?> +
+
+

+ +

+ formRadio('facets_sort_order', + get_option('facets_sort_order'), + null, + array( + 'alpha' => __('Alphabetical'), + 'count_alpha' => __('Count first, then alphabetical'), + )); + ?> +
+
+ +

+ +
+
+ formLabel('facets_elements-table', __('Dublin Core')); ?> +
+
+

+ +

+ + + + + + + + + + + + + + + +
name); ?> + formCheckbox( + "item_elements[{$element->set_name}][{$element->name}]", + '1', + array( + 'disableHidden' => true, + 'checked' => isset($settings['item_elements'][$element->set_name][$element->name]) + ) + ); ?> +
+
+
+ +
+
+ formLabel('facets_item_types', __('Item Types')); ?> +
+
+

+ +

+ formCheckbox('facets_item_types', get_option('facets_item_types'), null, array('1', '0')); ?> +
+
+ +
+
+ formLabel('facets_collections', __('Collections')); ?> +
+
+

+ +

+ formCheckbox('facets_collections', get_option('facets_collections'), null, array('1', '0')); ?> +
+
+ +
+
+ formLabel('facets_tags', __('Tags')); ?> +
+
+

+ +

+ formCheckbox('facets_tags', get_option('facets_tags'), null, array('1', '0')); ?> +
+
\ No newline at end of file diff --git a/plugin.ini b/plugin.ini index 8a6412b..56f30a7 100644 --- a/plugin.ini +++ b/plugin.ini @@ -1,10 +1,10 @@ [info] name = "Facets" -author = "Jean-Baptiste HEREN" -description="Filter search using facets" +author = "Jean-Baptiste HEREN, Daniele BINAGHI" +description="Filter browse/advanced search using facets" license="GPLv3" link="" support_link="" -version="1.0" +version="2.0" omeka_minimum_version="2.6.1" omeka_target_version="2.6.1" From ca3159525ca2f8b86b4b1439aaef2b3b9e5918e1 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Tue, 8 Jun 2021 10:52:37 +0200 Subject: [PATCH 002/161] Update file --- helpers/FacetsFunctions.php | 721 ++++++++++++++++++++---------------- 1 file changed, 411 insertions(+), 310 deletions(-) diff --git a/helpers/FacetsFunctions.php b/helpers/FacetsFunctions.php index dddc256..c4c8228 100644 --- a/helpers/FacetsFunctions.php +++ b/helpers/FacetsFunctions.php @@ -1,310 +1,411 @@ -getTable('Tag'); - // Build the select query. - $select = $table->getSelectForFindBy(); - /** - * If there is a Collection, we'll join to the Item table where the - * collection_id is equal to the ID of our Collection. - */ - if (count($itemsArray) > 0) { - $table->filterByTagType($select, 'Item'); - $select->where('items.id IN ('. implode(', ', $itemsArray) . ')'); - } - // Fetch some tags with our select. - $tags = $table->fetchObjects($select); - return $tags; - } - - /** - * Return Item Types associated with Array of Items Ids. - * - * @param itemsArray - * @return array ItemType. - */ - function get_item_types_for_items_array($itemsArray = array()) { - - // Get the database. - $db = get_db(); - // Get the Tag table. - $table = $db->getTable('ItemType'); - // Build the select query. - $select = $table->getSelect(); - /** - * If there is a Collection, we'll join to the Item table where the - * collection_id is equal to the ID of our Collection. - */ - if (count($itemsArray) > 0) { - $select->joinInner(array('items' => $db->Items), - 'item_types.id = items.item_type_id', array()); - $select->where('items.id IN ('. implode(', ', $itemsArray) . ')'); - } - // Fetch some tags with our select. - $item_types = $table->fetchObjects($select); - return $item_types; - } - - /** - * Return Item Types associated with Array of Items Ids. - * - * @return array ItemType. - */ - function get_item_types() { - - // Get the database. - $db = get_db(); - // Get the Tag table. - $table = $db->getTable('ItemType'); - // Build the select query. - $select = $table->getSelect(); - - // Fetch some tags with our select. - $item_types = $table->fetchObjects($select); - return $item_types; - } - - /** - * Return Collections associated with Array of Items Ids. - * - * @param itemsArray - * @return array Collections. - */ - function get_collections_for_items_array($itemsArray = array()) { - - // Get the database. - $db = get_db(); - // Get the Tag table. - $table = $db->getTable('Collection'); - // Build the select query. - $select = $table->getSelect(); - /** - * If there is a Collection, we'll join to the Item table where the - * collection_id is equal to the ID of our Collection. - */ - if (count($itemsArray) > 0) { - $select->joinInner(array('items' => $db->Items), - 'collections.id = items.collection_id', array()); - // $table->filterByTagType($select, 'Item'); - $select->where('items.id IN ('. implode(', ', $itemsArray) . ')'); - } - // Fetch some tags with our select. - $collections = $table->fetchObjects($select); - return $collections; - } - - /** - * Return Tags associated with Array of Items Ids. - * - * @param itemsArray - * @return array Tags. - */ - function get_dc_for_items_array($itemsArray = array(), $dcElementName = null) { - - // Get the database. - $db = get_db(); - // Get the Tag table. - $table = $db->getTable('ElementText'); - // Build the select query. - $select = $table->getSelect(); - $select->joinInner(array('elements' => $db->Elements), - 'element_texts.element_id = elements.id', array()); - $select->joinInner(array('element_sets' => $db->ElementSet), - 'element_sets.id = elements.element_set_id', array()); - $select->joinInner(array('items' => $db->Item), - 'items.id = element_texts.record_id', array()); - $select->where('element_sets.name = '. $db->quote('Dublin Core')); - $select->where('elements.name = '. $db->quote($dcElementName)); - $select->where('items.id IN ('. implode(', ', $itemsArray) . ')'); - - //debug($select->query(); - - /** - * If there is a Collection, we'll join to the Item table where the - * collection_id is equal to the ID of our Collection. - */ - // Fetch some tags with our select. - if(!empty($itemsArray)){ - $elements = $table->fetchObjects($select); - } - return $elements; - } - - /** - * Return HTML Select associated with Array of facets values. - * - * @param itemsArray - * @return array Tags. - */ - function get_dc_facet_select($itemsArray = array(), $dcElementName = null) { - - if(is_null($dcElementName)) { - $dcElementName = "Title"; - } - if(empty($itemsArray)){ - return ""; - } - // Get the database. - $db = get_db(); - // Get the Tag table. - $table = $db->getTable('ElementText'); - // Build the select query. - $select = $table->getSelect(); - $select->joinInner(array('elements' => $db->Elements), - 'element_texts.element_id = elements.id', array()); - $select->joinInner(array('element_sets' => $db->ElementSet), - 'element_sets.id = elements.element_set_id', array()); - $select->joinInner(array('items' => $db->Item), - 'items.id = element_texts.record_id', array()); - $select->where('element_sets.name = '. $db->quote('Dublin Core')); - $select->where('elements.name = '. $db->quote($dcElementName)); - $select->where('items.id IN ('. implode(', ', $itemsArray) . ')'); - - // Fetch values - if(!empty($itemsArray)){ - $elements = $table->fetchObjects($select); - // print_r($elements); - } - // build table - if(!empty($elements)){ - $facet = array(); - foreach ($elements as $element) { - $facet[] = $element->text; - } - $element_id = $element->element_id; - // make it unique - // $facet = array_unique($facet); - $facet = array_count_values($facet); - arsort($facet); - // print_r($facet); - - // get current parameters to check if one is selected - // Get the current facets. - if (!empty($_GET['advanced'])) { - $search = $_GET['advanced']; - foreach($search as $Searchindex => $SearchArray){ - if(isset($SearchArray['element_id']) && $SearchArray['element_id'] == $element_id){ - $term = $SearchArray['terms']; - break; - } - } - } - - if(isset($term)){ - $html = "
"; - $html .= ""; - } - - foreach($facet as $name => $count){ - $url = getElementFieldUrl($element_id, $name); - $html .= ""; - } - // foreach($facet as $name){ - // $html .= ""; - // } - $html .= "
"; - } else { - $html = false; - } - - return $html; - } - - /** - * Add an Element Field to Search to the current URL. - * - * @param string $field The Element id. - * @param string $value The Element value. - * @return string The new URL. - */ - function getElementFieldUrl($field_id, $value = null) - { - // Get the current facets. - if (!empty($_GET['advanced'])) { - $search = $_GET['advanced']; - // unset current element filter if already set - foreach($search as $Searchindex => $SearchArray){ - if(isset($SearchArray['element_id']) && $SearchArray['element_id'] == $field_id){ - unset($search[$Searchindex]); - } - } - } else { - $search = array(); - } - if(!is_null($value)){ - $search[] = array('element_id'=>$field_id,'type'=>'is exactly','terms'=>$value); - } - $params['advanced'] = $search; - if(isset($_GET['origin'])) $params['origin'] = $_GET['origin']; - if(isset($_GET['origin-title'])) $params['origin-title'] = $_GET['origin-title']; - if(isset($_GET['type'])) $params['type'] = $_GET['type']; - if(isset($_GET['collection'])) $params['collection'] = $_GET['collection']; - if(isset($_GET['tag_id'])) $params['tag_id'] = $_GET['tag_id']; - if(isset($_GET['tag'])) $params['tag'] = $_GET['tag']; - if(isset($_GET['tags'])) $params['tags'] = $_GET['tags']; - if(isset($_GET['search'])) $params['search'] = $_GET['search']; - - // Rebuild the route. - // return $_SERVER['HTTP_HOST'] . "?" . http_build_query($params); - return 'browse?' . http_build_query($params); - } - - /** - * Add an Element Field to Search to the current URL. - * - * @param string $filter The filter field name (tags|tag_id|type|collection). - * @param string $value The Element value. - * @return string The new URL. - */ - function getFieldUrl($filter, $value = null) - { - // Get the current facets. - if (!empty($_GET['advanced'])) { - $search = $_GET['advanced']; - } else { - $search = array(); - } - // set previous parameters - $params['advanced'] = $search; - if(isset($_GET['origin'])) $params['origin'] = $_GET['origin']; - if(isset($_GET['origin-title'])) $params['origin-title'] = $_GET['origin-title']; - if(isset($_GET['type'])) $params['type'] = $_GET['type']; - if(isset($_GET['collection'])) $params['collection'] = $_GET['collection']; - if(isset($_GET['tag_id'])) $params['tag_id'] = $_GET['tag_id']; - if(isset($_GET['tag'])) $params['tag'] = $_GET['tag']; - if(isset($_GET['tags'])) $params['tags'] = $_GET['tags']; - if(isset($_GET['search'])) $params['search'] = $_GET['search']; - - // set(unset) current - if(!is_null($value)){ - $params[$filter] = $value; - } else { - unset($params[$filter]); - } - - // Rebuild the route. - // return $_SERVER['HTTP_HOST'] . "?" . http_build_query($params); - return 'browse?' . http_build_query($params); - } -// } -?> +getTable('Tag'); + // Build the select query. + $select = $table->getSelectForFindBy(); + $table->filterByTagType($select, 'Item'); + $select->where('items.id IN ('. implode(', ', $itemsArray) . ')'); + $select->order('tags.name'); + + if ($tags = $table->fetchObjects($select)) { + // Build array + $facetTags = array(); + foreach ($tags as $tag) { + $facetTags[$tag->id] = $tag->name; + } + + // Stores data for selected tag, if any + $selectedTagName = $_GET['tags']; + + // Remove single entries if required + if ($hideSingleEntries && count($facetTags) > FACETS_MINIMUM_AMOUNT) { + $facetTags = array_filter($facetTags, "isNotSingleEntry"); + } + + $addOptions = false; + // get current parameters to check if one is selected + if ($selectedTagName != '') { + $html = "
"; + $html .= ""; + $addOptions = true; + } + + if ($addOptions) { + foreach ($facetTags as $tag_id => $tag_name) { + $html .= ""; + } + } + $html .= "
"; + } else { + $html = false; + } + + return $html; + } + + /** + * Return HTML Select associated with Array of facets collection values. + * + * @param itemsArray + * @param hideSingleEntries + * @param sortOrder + * @return html. + */ + function get_collections_facet_select($itemsArray = array(), $hideSingleEntries = false, $sortOrder = 'count_alpha') { + // Return, if no Item is available + if (empty($itemsArray)) return ""; + + // Get the database. + $db = get_db(); + // Get the table. + $table = $db->getTable('Collection'); + // Build the select query. + $select = $table->getSelect() + ->columns('COUNT(collections.id) AS count') + ->joinInner(array('items' => $db->Items), + 'collections.id = items.collection_id', array()) + ->where('items.id IN ('. implode(', ', $itemsArray) . ')') + ->group('collections.id'); + + if ($collections = $table->fetchObjects($select)) { + // Build array + $facetCollections = array(); + foreach ($collections as $collection) { + $facetCollections[$collection->id]['id'] = $collection->id; + $facetCollections[$collection->id]['name'] = $collection->getDisplayTitle(); + $facetCollections[$collection->id]['count'] = $collection->count; + } + + // Stores data for selected collection, if any + if ($collection_id = $_GET['collection']) { + $selectedCollection = $facetCollections[$collection_id]; + } + + // Remove single entries if required + if ($hideSingleEntries && count($facetCollections) > FACETS_MINIMUM_AMOUNT) { + $facetCollections = array_filter($facetCollections, "isNotSingleEntry"); + } + + // Sort array + if ($sortOrder == 'count_alpha') { + array_multisort(array_column($facetCollections, 'count'), SORT_DESC, array_column($facetCollections, 'name'), SORT_ASC, $facetCollections); + } else { + array_multisort(array_column($facetCollections, 'name'), SORT_ASC, $facetCollections); + } + + $addOptions = false; + // get current parameters to check if one is selected + if (isset($selectedCollection)) { + $html = "
"; + $html .= ""; + $addOptions = true; + } + + if ($addOptions) { + foreach ($facetCollections as $collection) { + $html .= ""; + } + } + $html .= "
"; + } else { + $html = false; + } + + return $html; + } + + /** + * Return HTML Select associated with Array of facets item type values. + * + * @param itemsArray + * @param hideSingleEntries + * @param sortOrder + * @return html. + */ + function get_item_types_facet_select($itemsArray = array(), $hideSingleEntries = false, $sortOrder = 'count_alpha') { + // Return, if no Item is available + if (empty($itemsArray)) return ""; + + // Get the database. + $db = get_db(); + // Get the table. + $table = $db->getTable('ItemType'); + // Build the select query. + $select = $table->getSelect() + ->columns('COUNT(item_types.id) AS count') + ->joinInner(array('items' => $db->Items), + 'item_types.id = items.item_type_id', array()) + ->where('items.id IN ('. implode(', ', $itemsArray) . ')') + ->group('item_types.id'); + + if ($itemTypes = $table->fetchObjects($select)) { + // Build array + $facetItemTypes = array(); + foreach ($itemTypes as $itemType) { + $facetItemTypes[$itemType->id]['id'] = $itemType->id; + $facetItemTypes[$itemType->id]['name'] = $itemType->name; + $facetItemTypes[$itemType->id]['count'] = $itemType->count; + } + + // Stores data for selected item type, if any + if ($itemType_id = $_GET['type']) { + $selectedItemType = $facetItemTypes[$itemType_id]; + } + + // Remove single entries if required + if ($hideSingleEntries && count($facetItemTypes) > FACETS_MINIMUM_AMOUNT) { + $facetItemTypes = array_filter($facetItemTypes, "isNotSingleEntry"); + } + + // Sort array + if ($sortOrder == 'count_alpha') { + array_multisort(array_column($facetItemTypes, 'count'), SORT_DESC, array_column($facetItemTypes, 'name'), SORT_ASC, $facetItemTypes); + } else { + array_multisort(array_column($facetItemTypes, 'name'), SORT_ASC, $facetItemTypes); + } + + $addOptions = false; + // get current parameters to check if one is selected + if (isset($selectedItemType)) { + $html = "
"; + $html .= ""; + $addOptions = true; + } + + if ($addOptions) { + foreach ($facetItemTypes as $itemType) { + $html .= ""; + } + } + $html .= "
"; + } else { + $html = false; + } + + return $html; + } + + /** + * Return HTML Select associated with Array of facets values. + * + * @param itemsArray + * @param dcElementName + * @param isDate + * @param hideSingleEntries + * @param sortOrder + * @return html. + */ + function get_dc_facet_select($itemsArray = array(), $dcElementName = 'Title', $isDate = false, $hideSingleEntries = false, $sortOrder = 'count_alpha') { + if (empty($itemsArray)) return ""; + + // Get the database. + $db = get_db(); + // Get the table. + $table = $db->getTable('ElementText'); + // Create the orderby rules + if ($isDate) { + $groupBy = 'year'; + if ($sortOrder == 'count_alpha') { + $orderBy = array('count DESC', 'year DESC'); + } else { + $orderBy = array('year DESC'); + } + } else { + $groupBy = 'text'; + if ($sortOrder == 'count_alpha') { + $orderBy = array('count DESC', 'text ASC'); + } else { + $orderBy = array('text ASC'); + } + } + // Build the select query. + $select = $table->getSelect() + ->columns(array('SUBSTR(element_texts.text, 1, 4) AS year', 'COUNT(text) AS count')) + ->joinInner(array('elements' => $db->Elements), + 'element_texts.element_id = elements.id', array()) + ->joinInner(array('element_sets' => $db->ElementSet), + 'element_sets.id = elements.element_set_id', array()) + ->joinInner(array('items' => $db->Item), + 'items.id = element_texts.record_id', array()) + ->where('element_sets.name = '. $db->quote('Dublin Core')) + ->where('elements.name = '. $db->quote($dcElementName)) + ->where('items.id IN ('. implode(', ', $itemsArray) . ')') + ->group($groupBy) + ->order($orderBy); + + // Build table + if ($elements = $table->fetchObjects($select)) { + $facet = array(); + foreach ($elements as $element) { + if ($isDate) { + $facet[$element->year] = $facet[$element->year] + $element->count; + } else { + $facet[$element->text] = $element->count; + } + } + $element_id = $element->element_id; + + // remove single entries if required + if ($hideSingleEntries && count($facet) > FACETS_MINIMUM_AMOUNT) { + $facet = array_filter($facet, "isNotSingleEntry"); + } + + // get current parameters to check if one is selected + // Get the current facets. + if (!empty($_GET['advanced'])) { + $search = $_GET['advanced']; + foreach ($search as $Searchindex => $SearchArray){ + if (isset($SearchArray['element_id']) && $SearchArray['element_id'] == $element_id) { + $term = $SearchArray['terms']; + break; + } + } + } + + $addOptions = false; + if (isset($term)){ + $html = "
"; + $html .= ""; + $addOptions = true; + } + + if ($addOptions) { + foreach ($facet as $name => $count) { + $url = getElementFieldUrl($element_id, $name, $isDate); + $html .= ""; + } + } + $html .= "
"; + } else { + $html = false; + } + + return $html; + } + + /** + * Add an Element Field to Search to the current URL. + * + * @param string $field The Element id. + * @param string $value The Element value. + * @return string The new URL. + */ + function getElementFieldUrl($field_id, $value = null, $isDate = false) + { + // Get the current facets. + if (!empty($_GET['advanced'])) { + $search = $_GET['advanced']; + // unset current element filter if already set + foreach ($search as $Searchindex => $SearchArray){ + if (isset($SearchArray['element_id']) && $SearchArray['element_id'] == $field_id){ + unset ($search[$Searchindex]); + } + } + } else { + $search = array(); + } + if (!is_null($value)) { + if ($isDate) { + $search[] = array('element_id'=>$field_id, 'type'=>'starts with', 'terms'=>$value); + } else { + $search[] = array('element_id'=>$field_id, 'type'=>'is exactly', 'terms'=>$value); + } + } + $params['advanced'] = $search; + if (isset($_GET['origin'])) $params['origin'] = $_GET['origin']; + if (isset($_GET['origin-title'])) $params['origin-title'] = $_GET['origin-title']; + if (isset($_GET['type'])) $params['type'] = $_GET['type']; + if (isset($_GET['collection'])) $params['collection'] = $_GET['collection']; + if (isset($_GET['tag_id'])) $params['tag_id'] = $_GET['tag_id']; + if (isset($_GET['tag'])) $params['tag'] = $_GET['tag']; + if (isset($_GET['tags'])) $params['tags'] = $_GET['tags']; + if (isset($_GET['search'])) $params['search'] = $_GET['search']; + + // Rebuild the route. + // return $_SERVER['HTTP_HOST'] . "?" . http_build_query($params); + return 'browse?' . http_build_query($params); + } + + /** + * Add an Element Field to Search to the current URL. + * + * @param string $filter The filter field name (tags|tag_id|type|collection). + * @param string $value The Element value. + * @return string The new URL. + */ + function getFieldUrl($filter, $value = null) + { + // Get the current facets. + if (!empty($_GET['advanced'])) { + $search = $_GET['advanced']; + } else { + $search = array(); + } + // set previous parameters + $params['advanced'] = $search; + if (isset($_GET['origin'])) $params['origin'] = $_GET['origin']; + if (isset($_GET['origin-title'])) $params['origin-title'] = $_GET['origin-title']; + if (isset($_GET['type'])) $params['type'] = $_GET['type']; + if (isset($_GET['collection'])) $params['collection'] = $_GET['collection']; + if (isset($_GET['tag_id'])) $params['tag_id'] = $_GET['tag_id']; + if (isset($_GET['tag'])) $params['tag'] = $_GET['tag']; + if (isset($_GET['tags'])) $params['tags'] = $_GET['tags']; + if (isset($_GET['search'])) $params['search'] = $_GET['search']; + + // set(unset) current + if(!is_null($value)){ + $params[$filter] = $value; + } else { + unset($params[$filter]); + } + + // Rebuild the route. + // return $_SERVER['HTTP_HOST'] . "?" . http_build_query($params); + return 'browse?' . http_build_query($params); + } + + function isFacetActive($element_name, $settings) { + return ($settings['item_elements']['Dublin Core'][$element_name] == 1); + } + + function isNotSingleEntry($count) { + return ($count != 1); + } +?> \ No newline at end of file From e2edf192f3fab299d079fdcc1d3eacb72fc4d0d1 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Tue, 8 Jun 2021 10:54:20 +0200 Subject: [PATCH 003/161] Update file, commented out faulty rules --- views/public/css/facets.css | 225 ++++++++++++++++++------------------ 1 file changed, 115 insertions(+), 110 deletions(-) diff --git a/views/public/css/facets.css b/views/public/css/facets.css index d836305..f61f28d 100644 --- a/views/public/css/facets.css +++ b/views/public/css/facets.css @@ -1,110 +1,115 @@ -.container-fluid { - display: flex; -} - -.search-container h4 { - font-family: 'montserrat-light'; - text-align: center; - width: 80%; - color: #56575a; - font-size: 16px; -} - -.search-container { - width: 350px; -} - -.search-container .container { - width: 100%; -} - -.search-container form { - padding-bottom: 25px; - background-color: #F1F1F1; - width: 80%; -} - -.search-container .container .container-fluid { - padding-top: 20px; -} - -.search-container form label { - /* font-family: 'montserrat-regular'; */ - margin-left: auto; - margin-right: auto; - /* font-size: 15px; */ - margin-bottom: 8px; - color: #545759; -} - -.search-container form select { - font-family: 'open-italic'; - width: 100%; - border-radius: 0; - border: 0; - padding: 2px; - -webkit-appearance: none; - -moz-appearance: none; - appearance: none; - background-color: #FFF; - text-align: center; -} - -.facet-selected { - color: #FFF; - background-color: #545759!important; -} - -.search-container .select-arrow, .search-container .select-cross { - position: relative; - font-family: "open-italic"; - width: 73%; - margin-left: auto; - margin-right: auto; -} - -.search-container .select-arrow select::-ms-expand, .search-container .select-cross select::-ms-expand { - display: none; -} - -.search-container .select-cross:after { - pointer-events: none; - position: absolute; - content: ''; - top: 9px; - right: 10px; - height: 10px; - width: 10px; - background-size: cover!important; - background: url('../images/cross.svg'); -} - -.search-container .select-arrow:after { - width: 0; - pointer-events: none; - position: absolute; - content: ''; - top: 8px; - right: 10px; - border-top: 8px solid #3D3D3D; - border-bottom: 8px solid transparent; - border-left: 8px solid transparent; - border-right: 8px solid transparent; -} - -.search-container .select-arrow span, .container-fluid .search-container .select-cross span { - padding-right:5%; -} - -.search-container button { - width: 73%; - font-family: 'open-bold'; - margin-left: auto; - margin-right: auto; - padding-top: 7px; - padding-bottom: 7px; - border-radius: 0; - border: 0; - background-color: #FF5E4D; - color: white; -} +.container-fluid { + display: flex; +} + +.search-container h4 { + text-align: center; + color: white; + background-color: black; + margin-bottom: 0; + padding: 10px; +} + +.search-container h5 { + text-align: left; + color: #545759; + font-size: 90%; + margin: 10px 10px 0 10px; + border-bottom: 1px solid #545759; + font-style: italic; + padding-bottom: 10px; + line-height: 140%; +} + +.search-container { + max-width: 350px; + margin-bottom: 20px; +} + +.search-container .container { + width: 100%; + background-color: #F1F1F1; +} + +.search-container form { + padding: 20px 10px; +} + +.search-container .container .container-fluid:not(:first-child) { + padding-top: 20px; +} + +.search-container form label { + /* margin-left: auto; */ + /* margin-right: auto; */ + margin-bottom: 8px; + color: #545759; +} + +.search-container form select { + width: 100%; + border: 0; + appearance: none !important; + -webkit-appearance: none !important; + -moz-appearance: none !important; + background-color: #FFF; + text-align: left; + font-size: 80%; +} + +.facet-selected { + color: #FFF; + background-color: #545759!important; +} + +.search-container .select-arrow, .search-container .select-cross { + position: relative; + margin-left: auto; + margin-right: auto; +} + +.search-container .select-arrow select::-ms-expand, .search-container .select-cross select::-ms-expand { + display: none; +} + +.search-container .select-cross:after { + /* pointer-events: none; */ + /* position: absolute; */ + /* content: ''; */ + /* top: 9px; */ + /* right: 10px; */ + /* height: 10px; */ + /* width: 10px; */ + /* background-size: cover!important; */ + /* background: url('../images/cross.svg'); */ +} + +.search-container .select-arrow:after { + /* width: 0; */ + /* pointer-events: none; */ + /* position: absolute; */ + /* content: ''; */ + /* top: 8px; */ + /* right: 10px; */ + /* border-top: 8px solid #3D3D3D; */ + /* border-bottom: 8px solid transparent; */ + /* border-left: 8px solid transparent; */ + /* border-right: 8px solid transparent; */ +} + +.search-container .select-arrow span, .container-fluid .search-container .select-cross span { + /* padding-right: 5%; */ +} + +.search-container button { + width: 73%; + font-family: 'open-bold'; + margin-left: auto; + margin-right: auto; + padding-top: 7px; + padding-bottom: 7px; + border-radius: 0; + border: 0; + background-color: #FF5E4D; + color: white; +} \ No newline at end of file From 73e0897be99d1e22202fd7126be1a1dde963e194 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Tue, 8 Jun 2021 10:55:36 +0200 Subject: [PATCH 004/161] Update file with improved functions --- views/public/facets/browse.php | 224 +++++++++++++-------------------- 1 file changed, 85 insertions(+), 139 deletions(-) diff --git a/views/public/facets/browse.php b/views/public/facets/browse.php index 8ba531d..5a98198 100644 --- a/views/public/facets/browse.php +++ b/views/public/facets/browse.php @@ -1,139 +1,85 @@ - - - - - - getCollection()): ?> - - id; ?> - - - - - getItemType()): ?> - name; ?> - id; ?> - - - - - - - -name] = $tag->id; - $facetTag[$tag->name] = $tag->name; - } - - $facetTag = array_unique($facetTag); - - // collections - $collections = get_collections_for_items_array($itemsArray); - foreach ($collections as $collection) { - $facetCollection[$collection->id] = $collection->getDisplayTitle(); - } - - $facetCollection = array_unique($facetCollection); - - // item types - $itemTypes = get_item_types_for_items_array($itemsArray); - foreach ($itemTypes as $itemType) { - $facetItemType[$itemType->id] = $itemType->name; - } - - $facetItemType = array_unique($facetItemType); - ?> -
-
-

-
- -
- -
- - - -
- -
- - - -
- -
- - - -
- -
- - -
- -
-
- -
-
- -
-
- -
-
- -
-
- - -
- -
- -
- - - -
-
-
- +getTable('Element'); + $select = $table->getSelect() + ->where('element_sets.name = \'Dublin Core\'') + ->order('elements.element_set_id') + ->order('ISNULL(elements.order)') + ->order('elements.order'); + $elements = $table->fetchObjects($select); +?> + +
+
+

+ + " . $description . "\n"; + } + ?> +
+ name, $facetsElements)) { + $isDate = in_array($element->name, array('Date')); + if ($html = get_dc_facet_select($itemsArray, $element->name, $isDate, $hideSingleEntries, $sortOrder)) { + echo "
\n"; + echo "\n"; + echo "
"; + echo $html; + } + } + } + ?> + + \n"; + echo "\n"; + echo "
"; + echo $html; + } + } + ?> + + \n"; + echo "\n"; + echo "
"; + echo $html; + } + } + ?> + + \n"; + echo "\n"; + echo ""; + echo $html; + } + } + ?> + + + + \ No newline at end of file From 4e4e6b65a095766a7fe3825e8196c7cdf1e92b35 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Tue, 8 Jun 2021 11:23:08 +0200 Subject: [PATCH 005/161] Update Readme.md --- Readme.md | 46 ++++++++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/Readme.md b/Readme.md index 1657f7d..df9651b 100644 --- a/Readme.md +++ b/Readme.md @@ -1,35 +1,49 @@ -# Omeka Facets Plugin +# Facets -This is a plugin, for the [Omeka Classic](https://omeka.org/classic/) Publishing platform. +## Description -Allows you to insert a Facets block made of Option blocks containing available metadata values extracted from browsing context. +Plugin for Omeka Classic. Once installed and active, allows to insert a Facets block made of Option blocks containing available metadata values extracted from browsing context + +Settings allow to choose the hook to be used, which elements use for search refinement, whether to ignore single entries, sorting order for values. ![Facets screenshot](./facets.jpg) ## Credits -This Development is part of the [Armarium](https://www.armarium-hautsdefrance.fr/) Project, managed by the french association [AR2L Hauts de France](http://www.ar2l-hdf.fr/). +Original development is part of the [Armarium](https://www.armarium-hautsdefrance.fr/) Project, managed by the french association [AR2L Hauts de France](http://www.ar2l-hdf.fr/). -## How to Use +Fixed and improved version by [DBinaghi]. -## Install the FacetsPlugin +## Installation +Uncompress files and rename plugin folder "Facets". -Copy to your Omeka plugins Folder, should be : -``` -/plugins/Facets +Then install it like any other Omeka plugin. + +## (Eventually) Customize your Theme + +Facets will appear by default in the Items browse page, where you have set the `public_items_browse` hook. It is possible to use instead a custom `public_items_facets` hook, that can be positioned wherever needed (`YOUR_THEME/items/browse.php` or `YOUR_THEME/common/header.php`, f.i.) according to the theme used. For Thanks, Roy theme, for example, best way is to change `common/header.php` code using the custom hook: +```php + + $this, 'item' => $item)); ?> ``` -Then Install the plugin from the Admin/extensions page. +## Plugin configuration -## (Eventually) Customize your Theme +The elements used for search refinement can be selected in the configuration page; best practice suggestion is to activate only elements that are displayed in the browse page, and that are offering some kind of data aggregation (a unique id would not offer any really useful refinement). -Facets will appear in the Items browse page, where you have set the public_items_browse Hook. +Similarly, one can choose to also include Item Types, Collections and Tags to the facets block. -You can Edit your Theme (should be in YOUR_THEME/items/browse) & place the plugin hook where you need to display the facets. +Single values can be exluded as not really significant, although they will be listed anyway if less than 10 values are available. -```php - $items, 'view' => $this)); ?> -``` +Sorting order can be alphabetical, or first by popularity and then alphabetical. + +Date element filter's behaviour is a bit different: dates are ordered decrescently, and only year is displayed; consequently, the matching will be with the beginning of the date (assuming the format is 'yyyy-mm-dd'). ## Licence MIT Licence, please credit AR2L [AR2L Hauts de France](http://www.ar2l-hdf.fr/) From d4c8475757cf170c57d82559978582fd04168894 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Tue, 8 Jun 2021 11:36:20 +0200 Subject: [PATCH 006/161] Fixed indentation --- FacetsPlugin.php | 108 +++++++++++++++++++++++------------------------ 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/FacetsPlugin.php b/FacetsPlugin.php index 30161fe..3692228 100644 --- a/FacetsPlugin.php +++ b/FacetsPlugin.php @@ -19,8 +19,8 @@ class FacetsPlugin extends Omeka_Plugin_AbstractPlugin 'install', 'uninstall', 'initialize', - 'config_form', - 'config', + 'config_form', + 'config', 'define_routes', 'public_head', 'public_items_browse', @@ -33,17 +33,17 @@ class FacetsPlugin extends Omeka_Plugin_AbstractPlugin public function hookInstall() { set_option('facets_public_hook', 'public_items_browse'); - set_option('facets_description', ''); - set_option('facets_hide_single_entries', 0); - set_option('facets_sort_order', 'count_alpha'); + set_option('facets_description', ''); + set_option('facets_hide_single_entries', 0); + set_option('facets_sort_order', 'count_alpha'); $defaults = array( - 'item_elements' => array() - ); - set_option('facets_elements', json_encode($defaults)); - set_option('facets_item_types', 1); - set_option('facets_collections', 1); - set_option('facets_tags', 0); + 'item_elements' => array() + ); + set_option('facets_elements', json_encode($defaults)); + set_option('facets_item_types', 1); + set_option('facets_collections', 1); + set_option('facets_tags', 0); } /** @@ -52,13 +52,13 @@ public function hookInstall() public function hookUninstall() { delete_option('facets_public_hook'); - delete_option('facets_description'); - delete_option('facets_hide_single_entries'); - delete_option('facets_sort_order'); - delete_option('facets_elements'); - delete_option('facets_item_types'); - delete_option('facets_collections'); - delete_option('facets_tags'); + delete_option('facets_description'); + delete_option('facets_hide_single_entries'); + delete_option('facets_sort_order'); + delete_option('facets_elements'); + delete_option('facets_item_types'); + delete_option('facets_collections'); + delete_option('facets_tags'); } /** @@ -68,49 +68,49 @@ public function hookInitialize() { get_view()->addHelperPath(dirname(__FILE__) . '/views/helpers', 'Facets_View_Helper_'); - $settings = json_decode(get_option('facets_elements'), true); - $this->_settings = $settings; + $settings = json_decode(get_option('facets_elements'), true); + $this->_settings = $settings; } - /** - * Shows plugin configuration page. - */ - public function hookConfigForm($args) - { - $settings = $this->_settings; + /** + * Shows plugin configuration page. + */ + public function hookConfigForm($args) + { + $settings = $this->_settings; - $table = get_db()->getTable('Element'); - $select = $table->getSelect() + $table = get_db()->getTable('Element'); + $select = $table->getSelect() ->where('element_sets.name = \'Dublin Core\'') - ->order('elements.element_set_id') - ->order('ISNULL(elements.order)') - ->order('elements.order'); - $elements = $table->fetchObjects($select); - - include('config_form.php'); - } - - /** - * Handle the config form. - */ - public function hookConfig($args) - { - $post = $args['post']; + ->order('elements.element_set_id') + ->order('ISNULL(elements.order)') + ->order('elements.order'); + $elements = $table->fetchObjects($select); + + include('config_form.php'); + } + + /** + * Handle the config form. + */ + public function hookConfig($args) + { + $post = $args['post']; - set_option('facets_public_hook', $post['facets_public_hook']); - set_option('facets_description', $post['facets_description']); - set_option('facets_hide_single_entries', $post['facets_hide_single_entries']); - set_option('facets_sort_order', $post['facets_sort_order']); + set_option('facets_public_hook', $post['facets_public_hook']); + set_option('facets_description', $post['facets_description']); + set_option('facets_hide_single_entries', $post['facets_hide_single_entries']); + set_option('facets_sort_order', $post['facets_sort_order']); $settings = array( - 'item_elements' => isset($post['item_elements']) ? $post['item_elements'] : array() - ); - set_option('facets_elements', json_encode($settings)); + 'item_elements' => isset($post['item_elements']) ? $post['item_elements'] : array() + ); + set_option('facets_elements', json_encode($settings)); - set_option('facets_item_types', $post['facets_item_types']); - set_option('facets_collections', $post['facets_collections']); - set_option('facets_tags', $post['facets_tags']); - } + set_option('facets_item_types', $post['facets_item_types']); + set_option('facets_collections', $post['facets_collections']); + set_option('facets_tags', $post['facets_tags']); + } public function hookPublicHead($args) { @@ -190,4 +190,4 @@ public function showFacets($args) } } } -} \ No newline at end of file +} From c301c59e9427e057ed825300e01d2a1e73d801cd Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Tue, 8 Jun 2021 12:49:11 +0200 Subject: [PATCH 007/161] Added config option to hide popularity count --- FacetsPlugin.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/FacetsPlugin.php b/FacetsPlugin.php index 3692228..4bc58af 100644 --- a/FacetsPlugin.php +++ b/FacetsPlugin.php @@ -36,6 +36,7 @@ public function hookInstall() set_option('facets_description', ''); set_option('facets_hide_single_entries', 0); set_option('facets_sort_order', 'count_alpha'); + set_option('facets_hide_popularity', 0); $defaults = array( 'item_elements' => array() @@ -55,6 +56,7 @@ public function hookUninstall() delete_option('facets_description'); delete_option('facets_hide_single_entries'); delete_option('facets_sort_order'); + delete_option('facets_hide_popularity'); delete_option('facets_elements'); delete_option('facets_item_types'); delete_option('facets_collections'); @@ -101,6 +103,7 @@ public function hookConfig($args) set_option('facets_description', $post['facets_description']); set_option('facets_hide_single_entries', $post['facets_hide_single_entries']); set_option('facets_sort_order', $post['facets_sort_order']); + set_option('facets_hide_popularity', $post['facets_hide_popularity']); $settings = array( 'item_elements' => isset($post['item_elements']) ? $post['item_elements'] : array() From 917f3e351a5fefc7f03ca6760e95071b84948803 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Tue, 8 Jun 2021 12:49:53 +0200 Subject: [PATCH 008/161] Added config option to hide popularity count --- config_form.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/config_form.php b/config_form.php index 3e96e19..9e32408 100644 --- a/config_form.php +++ b/config_form.php @@ -68,12 +68,24 @@ null, array( 'alpha' => __('Alphabetical'), - 'count_alpha' => __('Count first, then alphabetical'), + 'count_alpha' => __('Popularity first, then alphabetical'), )); ?> +
+
+ formLabel('facets_hide_popularity', __('Hide popularity')); ?> +
+
+

+ +

+ formCheckbox('facets_hide_popularity', get_option('facets_hide_popularity'), null, array('1', '0')); ?> +
+
+

@@ -150,4 +162,4 @@

formCheckbox('facets_tags', get_option('facets_tags'), null, array('1', '0')); ?>
- \ No newline at end of file + From d52c1bc9ffabb51999f4afde423cccfd9353ada3 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Tue, 8 Jun 2021 12:50:41 +0200 Subject: [PATCH 009/161] Added config option to hide popularity count --- views/public/facets/browse.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/views/public/facets/browse.php b/views/public/facets/browse.php index 5a98198..fdb2fe7 100644 --- a/views/public/facets/browse.php +++ b/views/public/facets/browse.php @@ -6,6 +6,7 @@ $facetsElements = json_decode(get_option('facets_elements'), true); $hideSingleEntries = (bool)get_option('facets_hide_single_entries'); $sortOrder = get_option('facets_sort_order'); + $hidePopularity = (bool)get_option('facets_hide_popularity'); $table = get_db()->getTable('Element'); $select = $table->getSelect() @@ -30,7 +31,7 @@ foreach ($elements as $element) { if (isFacetActive($element->name, $facetsElements)) { $isDate = in_array($element->name, array('Date')); - if ($html = get_dc_facet_select($itemsArray, $element->name, $isDate, $hideSingleEntries, $sortOrder)) { + if ($html = get_dc_facet_select($itemsArray, $element->name, $isDate, $hideSingleEntries, $sortOrder, $hidePopularity)) { echo "
\n"; echo "\n"; echo "
"; @@ -42,7 +43,7 @@ \n"; echo "\n"; echo ""; @@ -53,7 +54,7 @@ \n"; echo "\n"; echo ""; @@ -64,7 +65,7 @@ \n"; echo "\n"; echo ""; @@ -82,4 +83,4 @@ window.location.href = option.data("url"); }); }); - \ No newline at end of file + From ed1c9176ab5ad3be03e0e71af719628a821fbd33 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Tue, 8 Jun 2021 12:52:01 +0200 Subject: [PATCH 010/161] Added option to hide popularity count, added tags count and sorting by count --- helpers/FacetsFunctions.php | 54 +++++++++++++++++++++++-------------- 1 file changed, 34 insertions(+), 20 deletions(-) diff --git a/helpers/FacetsFunctions.php b/helpers/FacetsFunctions.php index c4c8228..7667618 100644 --- a/helpers/FacetsFunctions.php +++ b/helpers/FacetsFunctions.php @@ -11,12 +11,20 @@ * @param itemsArray * @param hideSingleEntries * @param sortOrder + * @param hidePopularity * @return html. */ - function get_tags_facet_select($itemsArray = array(), $hideSingleEntries = false, $sortOrder = 'count_alpha') { + function get_tags_facet_select($itemsArray = array(), $hideSingleEntries = false, $sortOrder = 'count_alpha', $hidePopularity = false) { // Return, if no Item is available if (empty($itemsArray)) return ""; + // Define Order by clause + if ($sortOrder == 'count_alpha') { + $orderBy = array('tagCount DESC', 'name ASC'); + } else { + $orderBy = array('name ASC'); + } + // Get the database. $db = get_db(); // Get the table. @@ -25,13 +33,15 @@ function get_tags_facet_select($itemsArray = array(), $hideSingleEntries = false $select = $table->getSelectForFindBy(); $table->filterByTagType($select, 'Item'); $select->where('items.id IN ('. implode(', ', $itemsArray) . ')'); - $select->order('tags.name'); + $select->order($orderBy); if ($tags = $table->fetchObjects($select)) { // Build array $facetTags = array(); foreach ($tags as $tag) { - $facetTags[$tag->id] = $tag->name; + $facetTags[$tag->id]['id'] = $tag->id; + $facetTags[$tag->id]['name'] = $tag->name; + $facetTags[$tag->id]['count'] = $tag->tagCount; } // Stores data for selected tag, if any @@ -55,8 +65,8 @@ function get_tags_facet_select($itemsArray = array(), $hideSingleEntries = false } if ($addOptions) { - foreach ($facetTags as $tag_id => $tag_name) { - $html .= ""; + foreach ($facetTags as $tag) { + $html .= ""; } } $html .= ""; @@ -73,9 +83,10 @@ function get_tags_facet_select($itemsArray = array(), $hideSingleEntries = false * @param itemsArray * @param hideSingleEntries * @param sortOrder + * @param hidePopularity * @return html. */ - function get_collections_facet_select($itemsArray = array(), $hideSingleEntries = false, $sortOrder = 'count_alpha') { + function get_collections_facet_select($itemsArray = array(), $hideSingleEntries = false, $sortOrder = 'count_alpha', $hidePopularity = false) { // Return, if no Item is available if (empty($itemsArray)) return ""; @@ -131,7 +142,7 @@ function get_collections_facet_select($itemsArray = array(), $hideSingleEntries if ($addOptions) { foreach ($facetCollections as $collection) { - $html .= ""; + $html .= ""; } } $html .= ""; @@ -148,12 +159,20 @@ function get_collections_facet_select($itemsArray = array(), $hideSingleEntries * @param itemsArray * @param hideSingleEntries * @param sortOrder + * @param hidePopularity * @return html. */ - function get_item_types_facet_select($itemsArray = array(), $hideSingleEntries = false, $sortOrder = 'count_alpha') { + function get_item_types_facet_select($itemsArray = array(), $hideSingleEntries = false, $sortOrder = 'count_alpha', $hidePopularity = false) { // Return, if no Item is available if (empty($itemsArray)) return ""; + // Define Order by clause + if ($sortOrder == 'count_alpha') { + $orderBy = array('count DESC', 'text ASC'); + } else { + $orderBy = array('text ASC'); + } + // Get the database. $db = get_db(); // Get the table. @@ -164,7 +183,8 @@ function get_item_types_facet_select($itemsArray = array(), $hideSingleEntries = ->joinInner(array('items' => $db->Items), 'item_types.id = items.item_type_id', array()) ->where('items.id IN ('. implode(', ', $itemsArray) . ')') - ->group('item_types.id'); + ->group('item_types.id') + ->order(orderBy); if ($itemTypes = $table->fetchObjects($select)) { // Build array @@ -185,13 +205,6 @@ function get_item_types_facet_select($itemsArray = array(), $hideSingleEntries = $facetItemTypes = array_filter($facetItemTypes, "isNotSingleEntry"); } - // Sort array - if ($sortOrder == 'count_alpha') { - array_multisort(array_column($facetItemTypes, 'count'), SORT_DESC, array_column($facetItemTypes, 'name'), SORT_ASC, $facetItemTypes); - } else { - array_multisort(array_column($facetItemTypes, 'name'), SORT_ASC, $facetItemTypes); - } - $addOptions = false; // get current parameters to check if one is selected if (isset($selectedItemType)) { @@ -206,7 +219,7 @@ function get_item_types_facet_select($itemsArray = array(), $hideSingleEntries = if ($addOptions) { foreach ($facetItemTypes as $itemType) { - $html .= ""; + $html .= ""; } } $html .= ""; @@ -225,9 +238,10 @@ function get_item_types_facet_select($itemsArray = array(), $hideSingleEntries = * @param isDate * @param hideSingleEntries * @param sortOrder + * @param hidePopularity * @return html. */ - function get_dc_facet_select($itemsArray = array(), $dcElementName = 'Title', $isDate = false, $hideSingleEntries = false, $sortOrder = 'count_alpha') { + function get_dc_facet_select($itemsArray = array(), $dcElementName = 'Title', $isDate = false, $hideSingleEntries = false, $sortOrder = 'count_alpha', $hidePopularity = false) { if (empty($itemsArray)) return ""; // Get the database. @@ -309,7 +323,7 @@ function get_dc_facet_select($itemsArray = array(), $dcElementName = 'Title', $i if ($addOptions) { foreach ($facet as $name => $count) { $url = getElementFieldUrl($element_id, $name, $isDate); - $html .= ""; + $html .= ""; } } $html .= ""; @@ -408,4 +422,4 @@ function isFacetActive($element_name, $settings) { function isNotSingleEntry($count) { return ($count != 1); } -?> \ No newline at end of file +?> From 7e23883ccb997a14e45360d2c86fe7aa6d89e555 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Tue, 8 Jun 2021 13:52:48 +0200 Subject: [PATCH 011/161] Added localization support --- FacetsPlugin.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/FacetsPlugin.php b/FacetsPlugin.php index 4bc58af..b542e53 100644 --- a/FacetsPlugin.php +++ b/FacetsPlugin.php @@ -68,6 +68,8 @@ public function hookUninstall() */ public function hookInitialize() { + add_translation_source(dirname(__FILE__) . '/languages'); + get_view()->addHelperPath(dirname(__FILE__) . '/views/helpers', 'Facets_View_Helper_'); $settings = json_decode(get_option('facets_elements'), true); From 87e44b027037d4781bb64a81c5fcea09d261c6d1 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Tue, 8 Jun 2021 14:09:14 +0200 Subject: [PATCH 012/161] Fixed translatable string --- views/public/facets/browse.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/public/facets/browse.php b/views/public/facets/browse.php index fdb2fe7..c4b6d90 100644 --- a/views/public/facets/browse.php +++ b/views/public/facets/browse.php @@ -19,7 +19,7 @@
-

+

...

Date: Tue, 8 Jun 2021 14:09:41 +0200 Subject: [PATCH 013/161] Removed useless array variable --- views/public/facets/browse.php | 1 - 1 file changed, 1 deletion(-) diff --git a/views/public/facets/browse.php b/views/public/facets/browse.php index c4b6d90..8074396 100644 --- a/views/public/facets/browse.php +++ b/views/public/facets/browse.php @@ -1,5 +1,4 @@ Date: Tue, 8 Jun 2021 14:29:05 +0200 Subject: [PATCH 014/161] Initial commit --- languages/it.po | 1 + 1 file changed, 1 insertion(+) create mode 100644 languages/it.po diff --git a/languages/it.po b/languages/it.po new file mode 100644 index 0000000..8026076 --- /dev/null +++ b/languages/it.po @@ -0,0 +1 @@ +initial commit From a5fbe2b7bb2fe6f01e279c2d774282f8ae7b2cf3 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Tue, 8 Jun 2021 14:29:43 +0200 Subject: [PATCH 015/161] Add files via upload --- languages/it.mo | Bin 0 -> 3349 bytes languages/it.po | 139 +++++++++++++++++++++++++++++++++++- languages/template.base.pot | 17 +++++ languages/template.pot | 134 ++++++++++++++++++++++++++++++++++ 4 files changed, 289 insertions(+), 1 deletion(-) create mode 100644 languages/it.mo create mode 100644 languages/template.base.pot create mode 100644 languages/template.pot diff --git a/languages/it.mo b/languages/it.mo new file mode 100644 index 0000000000000000000000000000000000000000..4d223c2abdf220d7926d5ae76e68344b3d45a56f GIT binary patch literal 3349 zcmb_eO^h7H748rV$i{$`gd_(a9zuwvk%NWVY!K&$g(^G6s zRZ~?xoACu9<&s+zi8CA%i4zhxPV9jL2ZXpGh=dg76e)_t0U-{2uX=iCS3MLJ%aHm z;G@7_0-pdr1^g-S9Pl!59rzsZ&%oaS-vb)pSHLN-`eBwW06zyl4g3#K&N+1gf56kg z$ACFdcw7X^{Hs9x%eL^}?}59(E5N@2FM{L8z-5e|z#?p!T?Tr*zY3In-T`^p=Ut%0 z@&0W5AyCf$1SoO+dxrl7{tV+UfxiGghA+2)&j9}jY=F0b9|0YZeuS8Te+7yjPvWqr zfMt918X3rX0HOD1pZ|U3RixGJqYMZvA!Ib8w(Y`i@225(Av{3`Y%MV_@5qV7g zY0ckhbzfBvS~pRq;ec6jL@zfXlCy1e({`nGQ8*hNBA2w-Si>Pu9I@wT1I-4?(lepc zgtV3K(~>jCLu?Pjy1A;yPAPS$jhf0q!TAWO$@!9fJ1ImFFseN!9dSx@RKP^IB7qh3Y65~#fmB&);ie3g^IW6FsOui>G1n4G7-1t2?nAXT zVPTOr9yYWYDRQew1yt^K9y;HVo2Og5f$*oPYiM8D#0FG)v_0lM1>s8`s>VdRRJf8a z*D2(?8bXD;1Ml_&Us_4uEI}L3s+>aN5}_oudBT25wW?VBAq)LS%3`DgS!T>TvxK*P ztc;mTRQuv!Qxn)rMzAf(4b!7+auM3K1JhL6f}Pv9-^OgH3Xb8BSyE#Jaa*a65cE)N zlENP00w$(`2F-Ep_9b@_3ADhZlDw`)vDNN)(uv5k>j6hX@*Ek!rVPv3?ZDZNcP}Fk z@{KZoiG6_0JwoPSdt30rF4wR%-wKs3^Q%o2^1kcQD8{?++%7vZnetr!$NCxF=D#FO~XV0I@&;B+)dx6gVy7wDA;Dd?zE>E;jn9aMh zzPg)lZRcyNbYr`>wehPzY~Na6*i<3reXndVDmvez_Hd@F+Nx@#>5?kP+Flvx=pygA zWgRbLk*yl|mG@bVd$hTF>-z20>+5uBbMuPP%g$HxIX&d_!q&#t`dpE7%V!s^IU7+j zbE#xKinu2$xaitmlnnBL<8!zB&*vBB^MoRV%-1dKMHcnw0yr&Xs}XhGp{@_xvW`bo z^%z}S*6%?8J*(>S%w08i-Gk06UPhU==C>Zig+9sI;gE45c)1no)?D3NO-I#DGpQ z+sG#Iq_rqizhlziJm`AFAt-%FpgS1ij$MeT{)!ecy+q+}mB%q?9EUEUrJ-z#8Mttb zeWhXP91({EkmLd_4K3bD37)CVRCZG1n(Of~E=wS$Q6LX<@P^b}6jNy+F57JrL;^UH z7}>5KH*TU+5AiPbkd#*0+9B;DoU_gwMq3GzX$nn6p(`K+uuILP4OV(g+6li)7E?#8 zj7F&$qY|=ZZ=_H9DB)c(y?ZYE1_awN5C8xG literal 0 HcmV?d00001 diff --git a/languages/it.po b/languages/it.po index 8026076..98a8c19 100644 --- a/languages/it.po +++ b/languages/it.po @@ -1 +1,138 @@ -initial commit +# Translation for the Facets plugin for Omeka. +# This file is distributed under the same license as the Omeka plugin. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Reference\n" +"Report-Msgid-Bugs-To: http://github.com/Daniel-KM/Reference/issues\n" +"POT-Creation-Date: 2021-06-08 13:56-0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: Daniele Binaghi \n" +"Language-Team: LANGUAGE \n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: browse.php:22 +msgid "Refine search by" +msgstr "Raffina la ricerca per" + +#: FacetsFunctions.php:59 +#: FacetsFunctions.php:135 +#: FacetsFunctions.php:212 +#: FacetsFunctions.php:315 +msgid "Remove filter" +msgstr "Rimuovi filtro" + +#: FacetsFunctions.php:63 +#: FacetsFunctions.php:139 +#: FacetsFunctions.php:216 +#: FacetsFunctions.php:319 +msgid "Select" +msgstr "Seleziona" + +#: config_form.php:11 +msgid "Use" +msgstr "Utilizzo" + +#: config_form.php:15 +msgid "Public hook" +msgstr "Hook pubblico" + +#: config_form.php:19 +msgid "" +"The hook you want to use: Omeka's default public_items_browse, already coded into every page " +"(so no change is needed), normally showing up at the end of the page; or the plugin's own " +"public_items_facets, that has to be coded into relevant theme pages but can be used wherever deemed right." +msgstr "" +"L'hook che si vuole usare: quello di default di Omeka (public_items_browse), già codificato " +"in ogni pagina (così nessuna modifica è necessaria), solitamente mostrato alla fine della pagina; oppure, " +"quello proprio del plugin (public_items_facets), che deve essere codificato nelle giuste " +"pagine del tema ma può essere usato ovunque lo si ritenga opportuno." + +#: config_form.php:32 +msgid "Aspect" +msgstr "Aspetto" + +#: config_form.php:36 +msgid "Description" +msgstr "Descrizione" + +#: config_form.php:40 +msgid "Text to be used as additional description (tip: keep it short)." +msgstr "Testo da usare come descrizione addizionale (consiglio: mantenerlo corto)." + +#: config_form.php:48 +msgid "Hide single entries" +msgstr "Nascondi valori singoli" + +#: config_form.php:52 +msgid "If checked, values with just one entry will not be listed (unless there's less than %s entries in the list)." +msgstr "Se selezionato, i valori singoli non verranno elencati (a meno che non ci siano meno di %s valori nella lista)." + +#: config_form.php:60 +msgid "Sort order" +msgstr "Direzione ordinamento" + +#: config_form.php:64 +msgid "The sorting order for values in select fields." +msgstr "La direzione di ordinamento per i valori dei campi di selezione." + +#: config_form.php:70 +msgid "Alphabetical" +msgstr "Alfabetico" + +#: config_form.php:71 +msgid "Popularity first, then alphabetical" +msgstr "Prima popolarità, poi alfabetico" + +#: config_form.php:79 +msgid "Hide popularity" +msgstr "Nascondi popolarità" + +#: config_form.php:83 +msgid "If checked, values's popularity will not be displayed (sorting order will still take it into consideration, if required)." +msgstr "Se selezionato, la popolarità dei valori non verrà mostrata (la direzione di ordinamento ne terrà comunque conto, se necessario)." + +#: config_form.php:89 +msgid "Elements" +msgstr "Elementi" + +#: config_form.php:97 +msgid "The Dublin Core elements that can be used for search refinement." +msgstr "Gli elementi Dublin Core che possono essere usati per il raffinamento della ricerca." + +#: config_form.php:102 +msgid "Element" +msgstr "Elemento" + +#: config_form.php:103 +msgid "Active" +msgstr "Attivo" + +#: config_form.php:133 +msgid "Item Types" +msgstr "Tipologie documento" + +#: config_form.php:137 +msgid "If checked, search refinement by Item Type will be available." +msgstr "Se selezionata, il raffinamento della ricerca per Tipologia di Documento sarà disponibile." + +#: config_form.php:145 +msgid "Collections" +msgstr "Collezioni" + +#: config_form.php:149 +msgid "If checked, search refinement by Collection will be available." +msgstr "Se selezionata, il raffinamento della ricerca per Collezione sarà disponibile." + +#: config_form.php:157 +msgid "Tags" +msgstr "Etichette" + +#: config_form.php:161 +msgid "If checked, search refinement by Tag will be available." +msgstr "Se selezionata, il raffinamento della ricerca per Etichetta sarà disponibile." \ No newline at end of file diff --git a/languages/template.base.pot b/languages/template.base.pot new file mode 100644 index 0000000..09f46d6 --- /dev/null +++ b/languages/template.base.pot @@ -0,0 +1,17 @@ +# Translation for the Facets plugin for Omeka. +# This file is distributed under the same license as the Omeka plugin. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Reference\n" +"Report-Msgid-Bugs-To: http://github.com/Daniel-KM/Reference/issues\n" +"POT-Creation-Date: 2021-06-08 13:56-0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" \ No newline at end of file diff --git a/languages/template.pot b/languages/template.pot new file mode 100644 index 0000000..16c96f5 --- /dev/null +++ b/languages/template.pot @@ -0,0 +1,134 @@ +# Translation for the Facets plugin for Omeka. +# This file is distributed under the same license as the Omeka plugin. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Reference\n" +"Report-Msgid-Bugs-To: http://github.com/Daniel-KM/Reference/issues\n" +"POT-Creation-Date: 2021-06-08 13:56-0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: browse.php:22 +msgid "Refine search by" +msgstr "" + +#: FacetsFunctions.php:59 +#: FacetsFunctions.php:135 +#: FacetsFunctions.php:212 +#: FacetsFunctions.php:315 +msgid "Remove filter" +msgstr "" + +#: FacetsFunctions.php:63 +#: FacetsFunctions.php:139 +#: FacetsFunctions.php:216 +#: FacetsFunctions.php:319 +msgid "Select" +msgstr "" + +#: config_form.php:11 +msgid "Use" +msgstr "" + +#: config_form.php:15 +msgid "Public hook" +msgstr "" + +#: config_form.php:19 +msgid "" +"The hook you want to use: Omeka's default public_items_browse, already coded into every page " +"(so no change is needed), normally showing up at the end of the page; or the plugin's own " +"public_items_facets, that has to be coded into relevant theme pages but can be used wherever deemed right." +msgstr "" + +#: config_form.php:32 +msgid "Aspect" +msgstr "" + +#: config_form.php:36 +msgid "Description" +msgstr "" + +#: config_form.php:40 +msgid "Text to be used as additional description (tip: keep it short)." +msgstr "" + +#: config_form.php:48 +msgid "Hide single entries" +msgstr "" + +#: config_form.php:52 +msgid "If checked, values with just one entry will not be listed (unless there's less than %s entries in the list)." +msgstr "" + +#: config_form.php:60 +msgid "Sort order" +msgstr "" + +#: config_form.php:64 +msgid "The sorting order for values in select fields." +msgstr "" + +#: config_form.php:70 +msgid "Alphabetical" +msgstr "" + +#: config_form.php:71 +msgid "Popularity first, then alphabetical" +msgstr "" + +#: config_form.php:79 +msgid "Hide popularity" +msgstr "" + +#: config_form.php:83 +msgid "If checked, values's popularity will not be displayed (sorting order will still take it into consideration, if required)." +msgstr "" + +#: config_form.php:89 +msgid "Elements" +msgstr "" + +#: config_form.php:97 +msgid "The Dublin Core elements that can be used for search refinement." +msgstr "" + +#: config_form.php:102 +msgid "Element" +msgstr "" + +#: config_form.php:103 +msgid "Active" +msgstr "" + +#: config_form.php:133 +msgid "Item Types" +msgstr "" + +#: config_form.php:137 +msgid "If checked, search refinement by Item Type will be available." +msgstr "" + +#: config_form.php:145 +msgid "Collections" +msgstr "" + +#: config_form.php:149 +msgid "If checked, search refinement by Collection will be available." +msgstr "" + +#: config_form.php:157 +msgid "Tags" +msgstr "" + +#: config_form.php:161 +msgid "If checked, search refinement by Tag will be available." +msgstr "" \ No newline at end of file From 5dd1109397f51cbd237bd2cf0a16679a6a5442fe Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Tue, 8 Jun 2021 15:05:06 +0200 Subject: [PATCH 016/161] Corrected typo --- config_form.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config_form.php b/config_form.php index 9e32408..283e8f1 100644 --- a/config_form.php +++ b/config_form.php @@ -158,7 +158,7 @@

- +

formCheckbox('facets_tags', get_option('facets_tags'), null, array('1', '0')); ?>
From 01e449e3b6c52ff899a3287d3afd3f72b15bd9d1 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Tue, 8 Jun 2021 18:13:32 +0200 Subject: [PATCH 017/161] Update Readme.md --- Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index df9651b..0390960 100644 --- a/Readme.md +++ b/Readme.md @@ -2,7 +2,7 @@ ## Description -Plugin for Omeka Classic. Once installed and active, allows to insert a Facets block made of Option blocks containing available metadata values extracted from browsing context +Plugin for Omeka Classic. Once installed and active, allows to insert a Facets block made of option dropdown boxes containing available metadata values extracted from browsing context Settings allow to choose the hook to be used, which elements use for search refinement, whether to ignore single entries, sorting order for values. From d23614bc42b6396b5e678f0b41a18c37a03250c3 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Tue, 8 Jun 2021 18:13:47 +0200 Subject: [PATCH 018/161] Create Readme.md From ee733fa672da510bc704571d5dd820d0d886814a Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Tue, 8 Jun 2021 21:46:32 +0200 Subject: [PATCH 019/161] Fixed issue with search page --- FacetsPlugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FacetsPlugin.php b/FacetsPlugin.php index b542e53..7ec1d56 100644 --- a/FacetsPlugin.php +++ b/FacetsPlugin.php @@ -168,10 +168,10 @@ public function showFacets($args) $itemsArray = array(); $params = array('advanced' => $_GET['advanced'], 'collection' => $_GET['collection'], 'type' => $_GET['type'], 'tags' => $_GET['tags']); - $items = get_records('item', $params, null); if (count($items) > 0) { if ($controller == 'items') { + $items = get_records('item', $params, null); foreach ($items as $item) { $itemsArray[] = $item->id; } From 7d28b8c0dcf7f4baf0d07e7d1deba49ba5882d5d Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Tue, 8 Jun 2021 21:52:52 +0200 Subject: [PATCH 020/161] Update FacetsPlugin.php --- FacetsPlugin.php | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/FacetsPlugin.php b/FacetsPlugin.php index 7ec1d56..bc51e3b 100644 --- a/FacetsPlugin.php +++ b/FacetsPlugin.php @@ -167,30 +167,29 @@ public function showFacets($args) if (!($controller == 'search' && $action == 'index') && !($controller == 'items' && $action == 'browse')) return; $itemsArray = array(); - $params = array('advanced' => $_GET['advanced'], 'collection' => $_GET['collection'], 'type' => $_GET['type'], 'tags' => $_GET['tags']); - - if (count($items) > 0) { - if ($controller == 'items') { - $items = get_records('item', $params, null); + if ($controller == 'items') { + $params = array('advanced' => $_GET['advanced'], 'collection' => $_GET['collection'], 'type' => $_GET['type'], 'tags' => $_GET['tags']); + $items = get_records('item', $params, null); + if (count($items) > 0) { foreach ($items as $item) { $itemsArray[] = $item->id; } echo get_view()->partial('facets/browse.php', array( 'itemsArray' => $itemsArray )); - } elseif ($controller == 'search') { - // this would be for the site-wide simple search; - // main problem is that, differently from advanced search, - // it uses its own "search_texts" table, so results from that - // would have to be crossjoined with the "advanced" ones used - // by the facets; - // besides, advanced search works only for Items, so one might - // want to check whether the site-wide search has been performed - // just on Items. - if ($recordTypes = $_GET['record_types']) { - if (count($recordTypes) == 1 && in_array('Item', $recordTypes)) { - // site-wide search was performend just on Items - } + } + } elseif ($controller == 'search') { + // this would be for the site-wide simple search; + // main problem is that, differently from advanced search, + // it uses its own "search_texts" table, so results from that + // would have to be crossjoined with the "advanced" ones used + // by the facets; + // besides, advanced search works only for Items, so one might + // want to check whether the site-wide search has been performed + // just on Items. + if ($recordTypes = $_GET['record_types']) { + if (count($recordTypes) == 1 && in_array('Item', $recordTypes)) { + // site-wide search was performend just on Items } } } From 31ff6953ee4aff1cc491486491d23c3c03a2a631 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Tue, 8 Jun 2021 21:56:45 +0200 Subject: [PATCH 021/161] Update Readme.md --- Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index 0390960..11a7892 100644 --- a/Readme.md +++ b/Readme.md @@ -41,7 +41,7 @@ Similarly, one can choose to also include Item Types, Collections Single values can be exluded as not really significant, although they will be listed anyway if less than 10 values are available. -Sorting order can be alphabetical, or first by popularity and then alphabetical. +Sorting order can be alphabetical, or first by popularity and then alphabetical. Popularity count can be hidden, if needed. Date element filter's behaviour is a bit different: dates are ordered decrescently, and only year is displayed; consequently, the matching will be with the beginning of the date (assuming the format is 'yyyy-mm-dd'). From 0e9554ddf6578257749023c7c15dfd94e9b5e7f7 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Wed, 9 Jun 2021 09:43:48 +0200 Subject: [PATCH 022/161] Corrected variable name --- helpers/FacetsFunctions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helpers/FacetsFunctions.php b/helpers/FacetsFunctions.php index 7667618..24ac46d 100644 --- a/helpers/FacetsFunctions.php +++ b/helpers/FacetsFunctions.php @@ -184,7 +184,7 @@ function get_item_types_facet_select($itemsArray = array(), $hideSingleEntries = 'item_types.id = items.item_type_id', array()) ->where('items.id IN ('. implode(', ', $itemsArray) . ')') ->group('item_types.id') - ->order(orderBy); + ->order($orderBy); if ($itemTypes = $table->fetchObjects($select)) { // Build array From b54e5ffcdb25258e6c681b6cbf63ea1f776ec344 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Wed, 9 Jun 2021 10:26:00 +0200 Subject: [PATCH 023/161] Changed parameter passed to builder functions Instead of passing an array of already selected Items, we pass the Items subset SQL; this should fix possible issues with very large Items array --- helpers/FacetsFunctions.php | 70 ++++++++++++++++++++++--------------- 1 file changed, 42 insertions(+), 28 deletions(-) diff --git a/helpers/FacetsFunctions.php b/helpers/FacetsFunctions.php index 24ac46d..8378c5c 100644 --- a/helpers/FacetsFunctions.php +++ b/helpers/FacetsFunctions.php @@ -14,11 +14,11 @@ * @param hidePopularity * @return html. */ - function get_tags_facet_select($itemsArray = array(), $hideSingleEntries = false, $sortOrder = 'count_alpha', $hidePopularity = false) { - // Return, if no Item is available - if (empty($itemsArray)) return ""; + function get_tags_facet_select($itemsSubsetSQL, $hideSingleEntries = false, $sortOrder = 'count_alpha', $hidePopularity = false) { + // Define Where clause + $where = createWhereClause($itemsSubsetSQL); - // Define Order by clause + // Define Order By clause if ($sortOrder == 'count_alpha') { $orderBy = array('tagCount DESC', 'name ASC'); } else { @@ -32,7 +32,7 @@ function get_tags_facet_select($itemsArray = array(), $hideSingleEntries = false // Build the select query. $select = $table->getSelectForFindBy(); $table->filterByTagType($select, 'Item'); - $select->where('items.id IN ('. implode(', ', $itemsArray) . ')'); + $select->where($where); $select->order($orderBy); if ($tags = $table->fetchObjects($select)) { @@ -53,7 +53,7 @@ function get_tags_facet_select($itemsArray = array(), $hideSingleEntries = false } $addOptions = false; - // get current parameters to check if one is selected + // Build first part of the select tag if ($selectedTagName != '') { $html = "
"; $html .= ""; @@ -140,6 +141,7 @@ function get_collections_facet_select($itemsArray = array(), $hideSingleEntries $addOptions = true; } + // Build additional part of the select tag (if needed) if ($addOptions) { foreach ($facetCollections as $collection) { $html .= ""; @@ -162,9 +164,9 @@ function get_collections_facet_select($itemsArray = array(), $hideSingleEntries * @param hidePopularity * @return html. */ - function get_item_types_facet_select($itemsArray = array(), $hideSingleEntries = false, $sortOrder = 'count_alpha', $hidePopularity = false) { - // Return, if no Item is available - if (empty($itemsArray)) return ""; + function get_item_types_facet_select($itemsSubsetSQL, $hideSingleEntries = false, $sortOrder = 'count_alpha', $hidePopularity = false) { + // Define Where clause + $where = createWhereClause($itemsSubsetSQL); // Define Order by clause if ($sortOrder == 'count_alpha') { @@ -182,7 +184,7 @@ function get_item_types_facet_select($itemsArray = array(), $hideSingleEntries = ->columns('COUNT(item_types.id) AS count') ->joinInner(array('items' => $db->Items), 'item_types.id = items.item_type_id', array()) - ->where('items.id IN ('. implode(', ', $itemsArray) . ')') + ->where($where) ->group('item_types.id') ->order($orderBy); @@ -206,7 +208,7 @@ function get_item_types_facet_select($itemsArray = array(), $hideSingleEntries = } $addOptions = false; - // get current parameters to check if one is selected + // Build first part of the select tag if (isset($selectedItemType)) { $html = "
"; $url = getElementFieldUrl($element_id, null, $isDate); @@ -320,6 +325,7 @@ function get_dc_facet_select($itemsArray = array(), $dcElementName = 'Title', $i $addOptions = true; } + // Build additional part of the select tag (if needed) if ($addOptions) { foreach ($facet as $name => $count) { $url = getElementFieldUrl($element_id, $name, $isDate); @@ -422,4 +428,12 @@ function isFacetActive($element_name, $settings) { function isNotSingleEntry($count) { return ($count != 1); } + + function createWhereClause($sql) { + if ($sql != '') { + return 'items.id IN (' . $sql . ')'; + } else { + return '1=1'; + } + } ?> From bb8bfa6dd11d0f540c187f9ed75316d44ae41050 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Wed, 9 Jun 2021 10:26:53 +0200 Subject: [PATCH 024/161] Changed parameter passed to builder functions --- views/public/facets/browse.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/views/public/facets/browse.php b/views/public/facets/browse.php index 8074396..359e6ef 100644 --- a/views/public/facets/browse.php +++ b/views/public/facets/browse.php @@ -4,7 +4,7 @@ $facetTags = array(); $facetsElements = json_decode(get_option('facets_elements'), true); $hideSingleEntries = (bool)get_option('facets_hide_single_entries'); - $sortOrder = get_option('facets_sort_order'); + $sortOrder = (string)get_option('facets_sort_order'); $hidePopularity = (bool)get_option('facets_hide_popularity'); $table = get_db()->getTable('Element'); @@ -14,6 +14,8 @@ ->order('ISNULL(elements.order)') ->order('elements.order'); $elements = $table->fetchObjects($select); + + $itemsSubsetSQL = str_replace('`items`.*', '`items`.`id`', (string)get_db()->getTable('Item')->getSelectForFindBy($params)); ?>
@@ -30,7 +32,7 @@ foreach ($elements as $element) { if (isFacetActive($element->name, $facetsElements)) { $isDate = in_array($element->name, array('Date')); - if ($html = get_dc_facet_select($itemsArray, $element->name, $isDate, $hideSingleEntries, $sortOrder, $hidePopularity)) { + if ($html = get_dc_facet_select($itemsSubsetSQL, $element->name, $isDate, $hideSingleEntries, $sortOrder, $hidePopularity)) { echo "
\n"; echo "\n"; echo "
"; @@ -42,7 +44,7 @@ \n"; echo "\n"; echo "
"; @@ -53,7 +55,7 @@ \n"; echo "\n"; echo "
"; @@ -64,7 +66,7 @@ \n"; echo "\n"; echo "
"; From b36fc2d4f0269d74db04a4bafff340c8a7352017 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Wed, 9 Jun 2021 10:27:55 +0200 Subject: [PATCH 025/161] Modified showFacets function --- FacetsPlugin.php | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/FacetsPlugin.php b/FacetsPlugin.php index bc51e3b..e5b5e84 100644 --- a/FacetsPlugin.php +++ b/FacetsPlugin.php @@ -163,22 +163,20 @@ public function showFacets($args) $controller = $request->getControllerName(); $action = $request->getActionName(); - // checks whether it's one of the facet cases - if (!($controller == 'search' && $action == 'index') && !($controller == 'items' && $action == 'browse')) return; - - $itemsArray = array(); - if ($controller == 'items') { - $params = array('advanced' => $_GET['advanced'], 'collection' => $_GET['collection'], 'type' => $_GET['type'], 'tags' => $_GET['tags']); - $items = get_records('item', $params, null); - if (count($items) > 0) { - foreach ($items as $item) { - $itemsArray[] = $item->id; - } + if ($controller == 'items' && $action == 'browse') { + $params = array( + 'advanced' => $_GET['advanced'], + 'collection' => $_GET['collection'], + 'type' => $_GET['type'], + 'tags' => $_GET['tags'] + ); + if (count(get_records('item', $params, null)) > 0) { echo get_view()->partial('facets/browse.php', array( - 'itemsArray' => $itemsArray + 'itemsArray' => $itemsArray, + 'params' => $params )); } - } elseif ($controller == 'search') { + } elseif ($controller == 'search' && $action == 'index') { // this would be for the site-wide simple search; // main problem is that, differently from advanced search, // it uses its own "search_texts" table, so results from that @@ -189,7 +187,7 @@ public function showFacets($args) // just on Items. if ($recordTypes = $_GET['record_types']) { if (count($recordTypes) == 1 && in_array('Item', $recordTypes)) { - // site-wide search was performend just on Items + // site-wide search was performed just on Items } } } From 0ec47159de0c587b4d5a002409aac487b7ba5054 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Wed, 9 Jun 2021 14:52:03 +0200 Subject: [PATCH 026/161] Added feature for Collections --- config_form.php | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/config_form.php b/config_form.php index 283e8f1..05f721f 100644 --- a/config_form.php +++ b/config_form.php @@ -16,14 +16,14 @@

- public_items_browse, already coded into every page (so no change is needed), normally showing up at the end of the page; or the plugin\'s own public_items_facets, that has to be coded into relevant theme pages but can be used wherever deemed right.'); ?> + public_items_browse and public_collections_browse, already coded into every page (so no changes are needed), normally showing up at the end of the page; or the plugin\'s own public_facets, that has to be coded into relevant theme pages but can be used wherever deemed right.'); ?>

formRadio('facets_public_hook', get_option('facets_public_hook'), null, array( - 'public_items_browse' => __('public_items_browse'), - 'public_items_facets' => __('public_items_facets'), + 'default' => 'public_items_browse + public_collections_browse', + 'custom' => 'public_facets', )); ?>
@@ -99,8 +99,9 @@ - - + + + @@ -119,6 +120,16 @@ ) ); ?> +

- +

formCheckbox('facets_item_types', get_option('facets_item_types'), null, array('1', '0')); ?>
@@ -146,7 +157,7 @@

- +

formCheckbox('facets_collections', get_option('facets_collections'), null, array('1', '0')); ?>
@@ -158,7 +169,7 @@

- +

formCheckbox('facets_tags', get_option('facets_tags'), null, array('1', '0')); ?>
From 1a7269a049a67aa3c4f076313a560f1e185439cf Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Wed, 9 Jun 2021 14:52:48 +0200 Subject: [PATCH 027/161] Extended feature to Collections --- views/public/facets/browse.php | 85 ++++++++++++++++++++-------------- 1 file changed, 49 insertions(+), 36 deletions(-) diff --git a/views/public/facets/browse.php b/views/public/facets/browse.php index 359e6ef..8fc63c7 100644 --- a/views/public/facets/browse.php +++ b/views/public/facets/browse.php @@ -15,7 +15,11 @@ ->order('elements.order'); $elements = $table->fetchObjects($select); - $itemsSubsetSQL = str_replace('`items`.*', '`items`.`id`', (string)get_db()->getTable('Item')->getSelectForFindBy($params)); + if ($recordType == 'item') { + $subsetSQL = str_replace('`items`.*', '`items`.`id`', (string)get_db()->getTable('Item')->getSelectForFindBy($params)); + } else { + $subsetSQL = str_replace('`collections`.*', '`collections`.`id`', (string)get_db()->getTable('Collection')->getSelectForFindBy($params)); + } ?>
@@ -27,50 +31,59 @@ echo "
" . $description . "
\n"; } ?> +
name, $facetsElements)) { - $isDate = in_array($element->name, array('Date')); - if ($html = get_dc_facet_select($itemsSubsetSQL, $element->name, $isDate, $hideSingleEntries, $sortOrder, $hidePopularity)) { + if ($recordType == 'collection') { + foreach ($elements as $element) { + if (isFacetActive($recordType, $element->name, $facetsElements)) { + $isDate = in_array($element->name, array('Date')); + if ($html = get_dc_facet_select('collection', $subsetSQL, $element->name, $isDate, $hideSingleEntries, $sortOrder, $hidePopularity)) { + echo "
\n"; + echo "\n"; + echo "
"; + echo $html; + } + } + } + } else { + foreach ($elements as $element) { + if (isFacetActive($recordType, $element->name, $facetsElements)) { + $isDate = in_array($element->name, array('Date')); + if ($html = get_dc_facet_select('item', $subsetSQL, $element->name, $isDate, $hideSingleEntries, $sortOrder, $hidePopularity)) { + echo "
\n"; + echo "\n"; + echo "
"; + echo $html; + } + } + } + + if (get_option('facets_item_types')) { + if ($html = get_item_types_facet_select($subsetSQL, $hideSingleEntries, $sortOrder, $hidePopularity)) { echo "
\n"; - echo "\n"; + echo "\n"; echo "
"; echo $html; } } - } - ?> - \n"; - echo "\n"; - echo "
"; - echo $html; - } - } - ?> - - \n"; - echo "\n"; - echo ""; - echo $html; + if (get_option('facets_collections')) { + if ($html = get_collections_facet_select($subsetSQL, $hideSingleEntries, $sortOrder, $hidePopularity)) { + echo "
\n"; + echo "\n"; + echo "
"; + echo $html; + } } - } - ?> - \n"; - echo "\n"; - echo ""; - echo $html; + if (get_option('facets_tags')) { + if ($html = get_tags_facet_select($subsetSQL, $hideSingleEntries, $sortOrder, $hidePopularity)) { + echo "
\n"; + echo "\n"; + echo "
"; + echo $html; + } } } ?> @@ -81,7 +94,7 @@ window.jQuery( document ).ready(function() { window.jQuery('select').change(function() { var option = window.jQuery(this).find('option:selected'); - window.location.href = option.data("url"); + if (typeof(option.data("url")) !== 'undefined') window.location.href = option.data("url"); }); }); From 607f34400955b67c324ca7f92eabc8d0ba7fea4e Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Wed, 9 Jun 2021 14:54:05 +0200 Subject: [PATCH 028/161] Extended feature to Collections, improved Single Entries exclusion --- helpers/FacetsFunctions.php | 95 ++++++++++++++++++++++--------------- 1 file changed, 56 insertions(+), 39 deletions(-) diff --git a/helpers/FacetsFunctions.php b/helpers/FacetsFunctions.php index 8378c5c..bd8af4f 100644 --- a/helpers/FacetsFunctions.php +++ b/helpers/FacetsFunctions.php @@ -14,9 +14,9 @@ * @param hidePopularity * @return html. */ - function get_tags_facet_select($itemsSubsetSQL, $hideSingleEntries = false, $sortOrder = 'count_alpha', $hidePopularity = false) { - // Define Where clause - $where = createWhereClause($itemsSubsetSQL); + function get_tags_facet_select($subsetSQL, $hideSingleEntries = false, $sortOrder = 'count_alpha', $hidePopularity = false) { + // Create Where clause + $whereSubset = createWhereSubsetClause('item', $subsetSQL); // Define Order By clause if ($sortOrder == 'count_alpha') { @@ -32,7 +32,7 @@ function get_tags_facet_select($itemsSubsetSQL, $hideSingleEntries = false, $sor // Build the select query. $select = $table->getSelectForFindBy(); $table->filterByTagType($select, 'Item'); - $select->where($where); + $select->where($whereSubset); $select->order($orderBy); if ($tags = $table->fetchObjects($select)) { @@ -48,7 +48,7 @@ function get_tags_facet_select($itemsSubsetSQL, $hideSingleEntries = false, $sor $selectedTagName = $_GET['tags']; // Remove single entries if required - if ($hideSingleEntries && count($facetTags) > FACETS_MINIMUM_AMOUNT) { + if ($hideSingleEntries && count(array_filter($facetTags, 'excludeSingleValues')) > FACETS_MINIMUM_AMOUNT) { $facetTags = array_filter($facetTags, "isNotSingleEntry"); } @@ -87,9 +87,9 @@ function get_tags_facet_select($itemsSubsetSQL, $hideSingleEntries = false, $sor * @param hidePopularity * @return html. */ - function get_collections_facet_select($itemsSubsetSQL, $hideSingleEntries = false, $sortOrder = 'count_alpha', $hidePopularity = false) { - // Define Where clause - $where = createWhereClause($itemsSubsetSQL); + function get_collections_facet_select($subsetSQL, $hideSingleEntries = false, $sortOrder = 'count_alpha', $hidePopularity = false) { + // Create Where clause + $whereSubset = createWhereSubsetClause('item', $subsetSQL); // Get the database. $db = get_db(); @@ -100,7 +100,7 @@ function get_collections_facet_select($itemsSubsetSQL, $hideSingleEntries = fals ->columns('COUNT(collections.id) AS count') ->joinInner(array('items' => $db->Items), 'collections.id = items.collection_id', array()) - ->where($where) + ->where($whereSubset) ->group('collections.id'); if ($collections = $table->fetchObjects($select)) { @@ -118,7 +118,7 @@ function get_collections_facet_select($itemsSubsetSQL, $hideSingleEntries = fals } // Remove single entries if required - if ($hideSingleEntries && count($facetCollections) > FACETS_MINIMUM_AMOUNT) { + if ($hideSingleEntries && count(array_filter($facetCollections, 'excludeSingleValues')) > FACETS_MINIMUM_AMOUNT) { $facetCollections = array_filter($facetCollections, "isNotSingleEntry"); } @@ -164,9 +164,9 @@ function get_collections_facet_select($itemsSubsetSQL, $hideSingleEntries = fals * @param hidePopularity * @return html. */ - function get_item_types_facet_select($itemsSubsetSQL, $hideSingleEntries = false, $sortOrder = 'count_alpha', $hidePopularity = false) { - // Define Where clause - $where = createWhereClause($itemsSubsetSQL); + function get_item_types_facet_select($subsetSQL, $hideSingleEntries = false, $sortOrder = 'count_alpha', $hidePopularity = false) { + // Create Where Subset clause + $whereSubset = createWhereSubsetClause('item', $subsetSQL); // Define Order by clause if ($sortOrder == 'count_alpha') { @@ -184,7 +184,7 @@ function get_item_types_facet_select($itemsSubsetSQL, $hideSingleEntries = false ->columns('COUNT(item_types.id) AS count') ->joinInner(array('items' => $db->Items), 'item_types.id = items.item_type_id', array()) - ->where($where) + ->where($whereSubset) ->group('item_types.id') ->order($orderBy); @@ -203,7 +203,7 @@ function get_item_types_facet_select($itemsSubsetSQL, $hideSingleEntries = false } // Remove single entries if required - if ($hideSingleEntries && count($facetItemTypes) > FACETS_MINIMUM_AMOUNT) { + if ($hideSingleEntries && count(array_filter($facetItemTypes, 'excludeSingleValues')) > FACETS_MINIMUM_AMOUNT) { $facetItemTypes = array_filter($facetItemTypes, "isNotSingleEntry"); } @@ -244,12 +244,14 @@ function get_item_types_facet_select($itemsSubsetSQL, $hideSingleEntries = false * @param hidePopularity * @return html. */ - function get_dc_facet_select($itemsSubsetSQL, $dcElementName = 'Title', $isDate = false, $hideSingleEntries = false, $sortOrder = 'count_alpha', $hidePopularity = false) { - // Define Where clause - $where = createWhereClause($itemsSubsetSQL); + function get_dc_facet_select($recordType, $subsetSQL, $dcElementName = 'Title', $isDate = false, $hideSingleEntries = false, $sortOrder = 'count_alpha', $hidePopularity = false) { + // Create Where clauses + $whereRecordType = createWhereRecordTypeClause($recordType); + $whereSubset = createWhereSubsetClause($recordType, $subsetSQL); - // Create the orderby rules + // Create the columns, groupBy and orderBy clauses if ($isDate) { + $columns = array('SUBSTR(element_texts.text, 1, 4) AS year', 'COUNT(text) AS count'); $groupBy = 'year'; if ($sortOrder == 'count_alpha') { $orderBy = array('count DESC', 'year DESC'); @@ -257,6 +259,7 @@ function get_dc_facet_select($itemsSubsetSQL, $dcElementName = 'Title', $isDate $orderBy = array('year DESC'); } } else { + $columns = array('COUNT(text) AS count'); $groupBy = 'text'; if ($sortOrder == 'count_alpha') { $orderBy = array('count DESC', 'text ASC'); @@ -270,21 +273,27 @@ function get_dc_facet_select($itemsSubsetSQL, $dcElementName = 'Title', $isDate // Get the table. $table = $db->getTable('ElementText'); // Build the select query. - $select = $table->getSelect() - ->columns(array('SUBSTR(element_texts.text, 1, 4) AS year', 'COUNT(text) AS count')) - ->joinInner(array('elements' => $db->Elements), - 'element_texts.element_id = elements.id', array()) - ->joinInner(array('element_sets' => $db->ElementSet), - 'element_sets.id = elements.element_set_id', array()) - ->joinInner(array('items' => $db->Item), - 'items.id = element_texts.record_id', array()) - ->where('element_sets.name = '. $db->quote('Dublin Core')) - ->where('elements.name = '. $db->quote($dcElementName)) - ->where($where) - ->group($groupBy) - ->order($orderBy); - - // Build table + $select = $table->getSelect(); + $select->columns($columns); + $select->joinInner(array('elements' => $db->Elements), + 'element_texts.element_id = elements.id', array()); + $select->joinInner(array('element_sets' => $db->ElementSet), + 'element_sets.id = elements.element_set_id', array()); + if ($recordType == 'item') { + $select->joinInner(array('items' => $db->Item), + 'items.id = element_texts.record_id', array()); + } else { + $select->joinInner(array('collections' => $db->Collection), + 'collections.id = element_texts.record_id', array()); + } + $select->where('element_sets.name = '. $db->quote('Dublin Core')); + $select->where('elements.name = '. $db->quote($dcElementName)); + $select->where($whereRecordType); + $select->where($whereSubset); + $select->group($groupBy); + $select->order($orderBy); + + // Build array if ($elements = $table->fetchObjects($select)) { $facet = array(); foreach ($elements as $element) { @@ -297,7 +306,7 @@ function get_dc_facet_select($itemsSubsetSQL, $dcElementName = 'Title', $isDate $element_id = $element->element_id; // Remove single entries if required - if ($hideSingleEntries && count($facet) > FACETS_MINIMUM_AMOUNT) { + if ($hideSingleEntries && count(array_filter($facet, 'excludeSingleValues')) > FACETS_MINIMUM_AMOUNT) { $facet = array_filter($facet, "isNotSingleEntry"); } @@ -421,19 +430,27 @@ function getFieldUrl($filter, $value = null) return 'browse?' . http_build_query($params); } - function isFacetActive($element_name, $settings) { - return ($settings['item_elements']['Dublin Core'][$element_name] == 1); + function isFacetActive($recordType, $element_name, $settings) { + return ($settings[$recordType . '_elements']['Dublin Core'][$element_name] == 1); } function isNotSingleEntry($count) { return ($count != 1); } - function createWhereClause($sql) { + function createWhereRecordTypeClause($recordType) { + return 'element_texts.record_type = \'' . ucfirst($recordType) . '\''; + } + + function createWhereSubsetClause($recordType, $sql) { if ($sql != '') { - return 'items.id IN (' . $sql . ')'; + return $recordType . 's.id IN (' . $sql . ')'; } else { return '1=1'; } } + + function excludeSingleValues($element) { + if ($element > 1) return $element; + } ?> From e49aed0d15f5b9af2c509e49eeade3fb73af2af5 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Wed, 9 Jun 2021 14:54:37 +0200 Subject: [PATCH 029/161] Extended feature to Collections --- FacetsPlugin.php | 169 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 151 insertions(+), 18 deletions(-) diff --git a/FacetsPlugin.php b/FacetsPlugin.php index e5b5e84..d0958ad 100644 --- a/FacetsPlugin.php +++ b/FacetsPlugin.php @@ -9,7 +9,7 @@ if (!defined('FACETS_PLUGIN_DIR')) { define('FACETS_PLUGIN_DIR', dirname(__FILE__)); } -define('FACETS_MINIMUM_AMOUNT', 10); +define('FACETS_MINIMUM_AMOUNT', 5); require_once FACETS_PLUGIN_DIR . '/helpers/FacetsFunctions.php'; @@ -22,9 +22,11 @@ class FacetsPlugin extends Omeka_Plugin_AbstractPlugin 'config_form', 'config', 'define_routes', + 'collections_browse_sql', 'public_head', 'public_items_browse', - 'public_items_facets' + 'public_collections_browse', + 'public_facets' ); /** @@ -32,14 +34,15 @@ class FacetsPlugin extends Omeka_Plugin_AbstractPlugin */ public function hookInstall() { - set_option('facets_public_hook', 'public_items_browse'); + set_option('facets_public_hook', 'default'); set_option('facets_description', ''); set_option('facets_hide_single_entries', 0); set_option('facets_sort_order', 'count_alpha'); set_option('facets_hide_popularity', 0); $defaults = array( - 'item_elements' => array() + 'item_elements' => array(), + 'collection_elements' => array() ); set_option('facets_elements', json_encode($defaults)); set_option('facets_item_types', 1); @@ -68,7 +71,7 @@ public function hookUninstall() */ public function hookInitialize() { - add_translation_source(dirname(__FILE__) . '/languages'); + add_translation_source(dirname(__FILE__) . '/languages'); get_view()->addHelperPath(dirname(__FILE__) . '/views/helpers', 'Facets_View_Helper_'); @@ -108,7 +111,8 @@ public function hookConfig($args) set_option('facets_hide_popularity', $post['facets_hide_popularity']); $settings = array( - 'item_elements' => isset($post['item_elements']) ? $post['item_elements'] : array() + 'item_elements' => isset($post['item_elements']) ? $post['item_elements'] : array(), + 'collection_elements' => isset($post['collection_elements']) ? $post['collection_elements'] : array() ); set_option('facets_elements', json_encode($settings)); @@ -117,11 +121,6 @@ public function hookConfig($args) set_option('facets_tags', $post['facets_tags']); } - public function hookPublicHead($args) - { - queue_css_file('facets'); - } - public function hookDefineRoutes($args) { if (is_admin_theme()) { @@ -143,26 +142,150 @@ public function hookDefineRoutes($args) ); } + /** + * Hook into collections_browse_sql + * + * @select array $args + * @params array $args + */ + public function hookCollectionsBrowseSql($args) + { + $db = $this->_db; + $select = $args['select']; + $params = $args['params']; + + if (strpos($select, '_advanced') !== false) return; + + if ($advancedTerms = @$params['advanced']) { + $where = ''; + $advancedIndex = 0; + foreach ($advancedTerms as $v) { + // Do not search on blank rows. + if (empty($v['element_id']) || empty($v['type'])) { + continue; + } + + $value = isset($v['terms']) ? $v['terms'] : null; + $type = $v['type']; + $elementId = (int) $v['element_id']; + $alias = "_advanced_{$advancedIndex}"; + + $joiner = isset($v['joiner']) && $advancedIndex > 0 ? $v['joiner'] : null; + + $negate = false; + // Determine what the WHERE clause should look like. + switch ($type) { + case 'does not contain': + $negate = true; + case 'contains': + $predicate = "LIKE " . $db->quote('%'.$value .'%'); + break; + + case 'is not exactly': + $negate = true; + case 'is exactly': + $predicate = ' = ' . $db->quote($value); + break; + + case 'is empty': + $negate = true; + case 'is not empty': + $predicate = 'IS NOT NULL'; + break; + + case 'starts with': + $predicate = "LIKE " . $db->quote($value.'%'); + break; + + case 'ends with': + $predicate = "LIKE " . $db->quote('%'.$value); + break; + + case 'does not match': + $negate = true; + case 'matches': + if (!strlen($value)) { + continue 2; + } + $predicate = 'REGEXP ' . $db->quote($value); + break; + + default: + throw new Omeka_Record_Exception(__('Invalid search type given!')); + } + + $predicateClause = "{$alias}.text {$predicate}"; + + // Note that $elementId was earlier forced to int, so manual quoting + // is unnecessary here + $joinCondition = "{$alias}.record_id = collections.id AND {$alias}.record_type = 'Collection' AND {$alias}.element_id = $elementId"; + + if ($negate) { + $joinCondition .= " AND {$predicateClause}"; + $whereClause = "{$alias}.text IS NULL"; + } else { + $whereClause = $predicateClause; + } + + $select->joinLeft(array($alias => $db->ElementText), $joinCondition, array()); + if ($where == '') { + $where = $whereClause; + } elseif ($joiner == 'or') { + $where .= " OR $whereClause"; + } else { + $where .= " AND $whereClause"; + } + + $advancedIndex++; + } + + if ($where) { + $select->where($where); + } + } + } + + public function hookPublicHead($args) + { + $request = Zend_Controller_Front::getInstance()->getRequest(); + $controller = $request->getControllerName(); + $action = $request->getActionName(); + + if (($action == 'browse' && ($controller == 'items' || $controller == 'collections')) || ($controller == 'search' && $action == 'index')) { + queue_css_file('facets'); + } + } + public function hookPublicItemsBrowse($args) { - if (get_option('facets_public_hook') == 'public_items_browse') { + $settings = $this->_settings; + if (get_option('facets_public_hook') == 'default') { self::showFacets($args); } } - public function hookPublicItemsFacets($args) + public function hookPublicCollectionsBrowse($args) { - if (get_option('facets_public_hook') == 'public_items_facets') { + $settings = $this->_settings; + if (get_option('facets_public_hook') == 'default') { + self::showFacets($args); + } + } + + public function hookPublicFacets($args) + { + if (get_option('facets_public_hook') == 'custom') { self::showFacets($args); } } public function showFacets($args) { + $settings = $this->_settings; $request = Zend_Controller_Front::getInstance()->getRequest(); $controller = $request->getControllerName(); $action = $request->getActionName(); - + if ($controller == 'items' && $action == 'browse') { $params = array( 'advanced' => $_GET['advanced'], @@ -170,10 +293,20 @@ public function showFacets($args) 'type' => $_GET['type'], 'tags' => $_GET['tags'] ); - if (count(get_records('item', $params, null)) > 0) { + if (count($settings['item_elements']) > 0 && count(get_records('item', $params, null)) > 0) { + echo get_view()->partial('facets/browse.php', array( + 'params' => $params, + 'recordType' => 'item' + )); + } + } elseif ($controller == 'collections' && $action == 'browse') { + $params = array( + 'advanced' => $_GET['advanced'] + ); + if (count($settings['collection_elements']) > 0 && count(get_records('collection', $params, null)) > 0) { echo get_view()->partial('facets/browse.php', array( - 'itemsArray' => $itemsArray, - 'params' => $params + 'params' => $params, + 'recordType' => 'collection' )); } } elseif ($controller == 'search' && $action == 'index') { From 2154e1335afb2b47ab66329eec353110b7bbcf95 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Wed, 9 Jun 2021 14:56:16 +0200 Subject: [PATCH 030/161] Update Readme.md --- Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index 11a7892..d26483a 100644 --- a/Readme.md +++ b/Readme.md @@ -12,7 +12,7 @@ Settings allow to choose the hook to be used, which elements use for search refi Original development is part of the [Armarium](https://www.armarium-hautsdefrance.fr/) Project, managed by the french association [AR2L Hauts de France](http://www.ar2l-hdf.fr/). -Fixed and improved version by [DBinaghi]. +Fixed and improved version by [DBinaghi](https://github.com/DBinaghi). ## Installation Uncompress files and rename plugin folder "Facets". From 4f7ed84f115559c2162ad5df7182018ee4df8144 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Wed, 9 Jun 2021 14:56:49 +0200 Subject: [PATCH 031/161] Update plugin.ini --- plugin.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.ini b/plugin.ini index 56f30a7..8d1b305 100644 --- a/plugin.ini +++ b/plugin.ini @@ -1,6 +1,6 @@ [info] name = "Facets" -author = "Jean-Baptiste HEREN, Daniele BINAGHI" +author = "Jean-Baptiste HEREN and Daniele BINAGHI" description="Filter browse/advanced search using facets" license="GPLv3" link="" From b8e5366fb1aa8d4e097252a31275725fb086ad19 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Wed, 9 Jun 2021 15:14:26 +0200 Subject: [PATCH 032/161] Files updated, addes esperanto language --- languages/eo.mo | Bin 0 -> 543 bytes languages/eo.po | 138 +++++++++++++++++++++++++++++++++++++++++ languages/it.mo | Bin 3349 -> 3896 bytes languages/it.po | 54 +++++++++------- languages/template.pot | 34 +++++----- 5 files changed, 188 insertions(+), 38 deletions(-) create mode 100644 languages/eo.mo create mode 100644 languages/eo.po diff --git a/languages/eo.mo b/languages/eo.mo new file mode 100644 index 0000000000000000000000000000000000000000..85390589f090f8bbb1aace50e4d6355c027100ee GIT binary patch literal 543 zcmYLG!EO^V5H+YmVkJ=369*2yBWIIVpvVN&wAq%3Y*Q^;BoG{&&D1+|W3TMlib~u# z@d5l1-@#{a?xd;6NKbEUzwwOy{_gGk792Z_=Zw*M!SQ87cf8B_SH=^DV?1K~V1x%k z{AAu^{Nwy7^W%q`^JmPWfJ<~BBbZRta&f~OD}N305*vabK0pH%iSyvUF{|lPeS{Fv zJ1w~q0=Np20$LwP<NtQQzFJKTftLII{ekMgQvIPE9O##vaIjDnaE<(KHJmP4K?5rtu6kc|m{et9QbHsizxw0LJt@J?h6Tu~=(0jMFI&Hw-a literal 0 HcmV?d00001 diff --git a/languages/eo.po b/languages/eo.po new file mode 100644 index 0000000..f70c673 --- /dev/null +++ b/languages/eo.po @@ -0,0 +1,138 @@ +# Translation for the Facets plugin for Omeka. +# This file is distributed under the same license as the Omeka plugin. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: Reference\n" +"Report-Msgid-Bugs-To: http://github.com/Daniel-KM/Reference/issues\n" +"POT-Creation-Date: 2021-06-08 13:56-0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: Daniele Binaghi \n" +"Language-Team: LANGUAGE \n" +"Language: eo\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: browse.php:22 +msgid "Refine search by" +msgstr "Rafini serĉon per" + +#: FacetsFunctions.php:59 +#: FacetsFunctions.php:135 +#: FacetsFunctions.php:212 +#: FacetsFunctions.php:315 +msgid "Remove filter" +msgstr "Forigi filtron" + +#: FacetsFunctions.php:63 +#: FacetsFunctions.php:139 +#: FacetsFunctions.php:216 +#: FacetsFunctions.php:319 +msgid "Select" +msgstr "Elektu" + +#: config_form.php:11 +msgid "Use" +msgstr "" + +#: config_form.php:15 +msgid "Public hooks" +msgstr "" + +#: config_form.php:19 +msgid "" +"The hooks you want to use: Omeka's default public_items_browse and public_collections_browse, " +"already coded into every page (so no changes are needed), normally showing up at the end of the page; or the plugin's " +"own public_facets, that has to be coded into relevant theme pages but can be used wherever deemed right." +msgstr "" + +#: config_form.php:32 +msgid "Aspect" +msgstr "" + +#: config_form.php:36 +msgid "Description" +msgstr "" + +#: config_form.php:40 +msgid "Text to be used as additional description (tip: keep it short)." +msgstr "" + +#: config_form.php:48 +msgid "Hide single entries" +msgstr "" + +#: config_form.php:52 +msgid "If checked, values with just one entry will not be listed (unless there's less than %s entries in the list)." +msgstr "" + +#: config_form.php:60 +msgid "Sort order" +msgstr "" + +#: config_form.php:64 +msgid "The sorting order for values in select fields." +msgstr "" + +#: config_form.php:70 +msgid "Alphabetical" +msgstr "" + +#: config_form.php:71 +msgid "Popularity first, then alphabetical" +msgstr "" + +#: config_form.php:79 +msgid "Hide popularity" +msgstr "" + +#: config_form.php:83 +msgid "If checked, values's popularity will not be displayed (sorting order will still take it into consideration, if required)." +msgstr "" + +#: config_form.php:89 +msgid "Elements" +msgstr "" + +#: config_form.php:97 +msgid "The Dublin Core elements that can be used for search refinement." +msgstr "" + +#: config_form.php:102 +msgid "Element name" +msgstr "" + +#: config_form.php:103 +msgid "Item" +msgstr "" + +#: config_form.php:104 +msgid "Collection" +msgstr "" + +#: config_form.php:144 +msgid "Item Types" +msgstr "" + +#: config_form.php:148 +msgid "If checked, search refinement by Item Type will be available (Items only)." +msgstr "" + +#: config_form.php:156 +msgid "Collections" +msgstr "" + +#: config_form.php:160 +msgid "If checked, search refinement by Collection will be available (Items only)." +msgstr "" + +#: config_form.php:168 +msgid "Tags" +msgstr "" + +#: config_form.php:172 +msgid "If checked, search refinement by Tag will be available (Items only)." +msgstr "" \ No newline at end of file diff --git a/languages/it.mo b/languages/it.mo index 4d223c2abdf220d7926d5ae76e68344b3d45a56f..e80aafa0d6500a1d6f5bdc3ca9853211f734335b 100644 GIT binary patch delta 911 zcmZ|MPe>F|9Ki9n|6SLAm8Pl56Gil3?Mg|Sl%^Ca*2Soku{-<7$=Q9Yvl|$J2tpmY z#6ySzc6o%nA-oinAgLkO4FCxSN z;p(%u zU>CuI_}F1E@GKr>Am~B#AhLsqH~)bko+dI79OA+64+4fHpZA(y-tWEi>A}^m=9k^p zs^aL5uD?3r_+yV1rx>P7}puOCHDRpxdMr*H%x;2=%D$6oR@FHuqr zW6fytB7rWnLHoMUbJUZ(j`Fvt8~A{FvhR^UaS!OWAb*6H@E0yKVTmqB$T#_)*i$8S(L!Z0 zSn_4dI3!uqkyGZp(JM3NVc9hIM^QHBNPp~yoUr<2)_U<|r8Qcd zxtQF}P4vu#;k;X!^WA#jE;Yic?>6eQHGjap+3>5?P_Em3^2Xl9`j7TF_nuTq%59x; HC-v+fF9&SP diff --git a/languages/it.po b/languages/it.po index 98a8c19..5afb21d 100644 --- a/languages/it.po +++ b/languages/it.po @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: Reference\n" "Report-Msgid-Bugs-To: http://github.com/Daniel-KM/Reference/issues\n" "POT-Creation-Date: 2021-06-08 13:56-0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"PO-Revision-Date: 2021-06-09 15:09-0000\n" "Last-Translator: Daniele Binaghi \n" "Language-Team: LANGUAGE \n" "Language: it\n" @@ -39,19 +39,23 @@ msgid "Use" msgstr "Utilizzo" #: config_form.php:15 -msgid "Public hook" -msgstr "Hook pubblico" +msgid "Public hooks" +msgstr "Hook pubblici" #: config_form.php:19 msgid "" +"The hooks you want to use: Omeka's default public_items_browse and public_collections_browse, " +"already coded into every page (so no changes are needed), normally showing up at the end of the page; or the plugin's " +"own public_facets, that has to be coded into relevant theme pages but can be used wherever deemed right." + "The hook you want to use: Omeka's default public_items_browse, already coded into every page " "(so no change is needed), normally showing up at the end of the page; or the plugin's own " "public_items_facets, that has to be coded into relevant theme pages but can be used wherever deemed right." msgstr "" -"L'hook che si vuole usare: quello di default di Omeka (public_items_browse), già codificato " -"in ogni pagina (così nessuna modifica è necessaria), solitamente mostrato alla fine della pagina; oppure, " -"quello proprio del plugin (public_items_facets), che deve essere codificato nelle giuste " -"pagine del tema ma può essere usato ovunque lo si ritenga opportuno." +"Gli hook che si vogliono usare: quelli di default di Omeka (public_items_browse e public_collections_browse), " +"già codificati in ogni pagina (così nessuna modifica è necessaria), solitamente mostrati alla fine della pagina; oppure, " +"quello proprio del plugin (public_facets), che deve essere codificato nelle giuste pagine del tema " +"ma può essere usato ovunque lo si ritenga opportuno." #: config_form.php:32 msgid "Aspect" @@ -106,33 +110,37 @@ msgid "The Dublin Core elements that can be used for search refinement." msgstr "Gli elementi Dublin Core che possono essere usati per il raffinamento della ricerca." #: config_form.php:102 -msgid "Element" -msgstr "Elemento" +msgid "Element name" +msgstr "Nome elemento" #: config_form.php:103 -msgid "Active" -msgstr "Attivo" +msgid "Item" +msgstr "Documento" + +#: config_form.php:104 +msgid "Collection" +msgstr "Collezione" -#: config_form.php:133 +#: config_form.php:144 msgid "Item Types" msgstr "Tipologie documento" -#: config_form.php:137 -msgid "If checked, search refinement by Item Type will be available." -msgstr "Se selezionata, il raffinamento della ricerca per Tipologia di Documento sarà disponibile." +#: config_form.php:148 +msgid "If checked, search refinement by Item Type will be available (Items only)." +msgstr "Se selezionata, il raffinamento della ricerca per Tipologia di Documento sarà disponibile (solo per Documenti)." -#: config_form.php:145 +#: config_form.php:156 msgid "Collections" msgstr "Collezioni" -#: config_form.php:149 -msgid "If checked, search refinement by Collection will be available." -msgstr "Se selezionata, il raffinamento della ricerca per Collezione sarà disponibile." +#: config_form.php:160 +msgid "If checked, search refinement by Collection will be available (Items only)." +msgstr "Se selezionata, il raffinamento della ricerca per Collezione sarà disponibile (solo per Documenti)." -#: config_form.php:157 +#: config_form.php:168 msgid "Tags" msgstr "Etichette" -#: config_form.php:161 -msgid "If checked, search refinement by Tag will be available." -msgstr "Se selezionata, il raffinamento della ricerca per Etichetta sarà disponibile." \ No newline at end of file +#: config_form.php:172 +msgid "If checked, search refinement by Tag will be available (Items only)." +msgstr "Se selezionata, il raffinamento della ricerca per Etichetta sarà disponibile (solo per Documenti)." \ No newline at end of file diff --git a/languages/template.pot b/languages/template.pot index 16c96f5..fd7adf2 100644 --- a/languages/template.pot +++ b/languages/template.pot @@ -39,14 +39,14 @@ msgid "Use" msgstr "" #: config_form.php:15 -msgid "Public hook" +msgid "Public hooks" msgstr "" #: config_form.php:19 msgid "" -"The hook you want to use: Omeka's default public_items_browse, already coded into every page " -"(so no change is needed), normally showing up at the end of the page; or the plugin's own " -"public_items_facets, that has to be coded into relevant theme pages but can be used wherever deemed right." +"The hooks you want to use: Omeka's default public_items_browse and public_collections_browse, " +"already coded into every page (so no changes are needed), normally showing up at the end of the page; or the plugin's " +"own public_facets, that has to be coded into relevant theme pages but can be used wherever deemed right." msgstr "" #: config_form.php:32 @@ -102,33 +102,37 @@ msgid "The Dublin Core elements that can be used for search refinement." msgstr "" #: config_form.php:102 -msgid "Element" +msgid "Element name" msgstr "" #: config_form.php:103 -msgid "Active" +msgid "Item" msgstr "" -#: config_form.php:133 +#: config_form.php:104 +msgid "Collection" +msgstr "" + +#: config_form.php:144 msgid "Item Types" msgstr "" -#: config_form.php:137 -msgid "If checked, search refinement by Item Type will be available." +#: config_form.php:148 +msgid "If checked, search refinement by Item Type will be available (Items only)." msgstr "" -#: config_form.php:145 +#: config_form.php:156 msgid "Collections" msgstr "" -#: config_form.php:149 -msgid "If checked, search refinement by Collection will be available." +#: config_form.php:160 +msgid "If checked, search refinement by Collection will be available (Items only)." msgstr "" -#: config_form.php:157 +#: config_form.php:168 msgid "Tags" msgstr "" -#: config_form.php:161 -msgid "If checked, search refinement by Tag will be available." +#: config_form.php:172 +msgid "If checked, search refinement by Tag will be available (Items only)." msgstr "" \ No newline at end of file From 8490d257add7d76ed60c66b5f7856b50601e4cfe Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sat, 12 Jun 2021 17:06:01 +0200 Subject: [PATCH 033/161] Added more control on individual elements --- FacetsPlugin.php | 75 ++++++++++++++++++++++++++---------------------- 1 file changed, 40 insertions(+), 35 deletions(-) diff --git a/FacetsPlugin.php b/FacetsPlugin.php index d0958ad..8ec11a7 100644 --- a/FacetsPlugin.php +++ b/FacetsPlugin.php @@ -37,17 +37,18 @@ public function hookInstall() set_option('facets_public_hook', 'default'); set_option('facets_description', ''); set_option('facets_hide_single_entries', 0); - set_option('facets_sort_order', 'count_alpha'); - set_option('facets_hide_popularity', 0); $defaults = array( - 'item_elements' => array(), - 'collection_elements' => array() + 'item_elements' => array('active', 'showPopularity'), + 'collection_elements' => array('active', 'showPopularity') ); set_option('facets_elements', json_encode($defaults)); - set_option('facets_item_types', 1); - set_option('facets_collections', 1); - set_option('facets_tags', 0); + set_option('facets_item_types_active', 'count_alpha'); + set_option('facets_item_types_show_popularity', 1); + set_option('facets_collections_active', 'count_alpha'); + set_option('facets_collections_show_popularity', 1); + set_option('facets_tags_active', ''); + set_option('facets_tags_show_popularity', 1); } /** @@ -58,12 +59,13 @@ public function hookUninstall() delete_option('facets_public_hook'); delete_option('facets_description'); delete_option('facets_hide_single_entries'); - delete_option('facets_sort_order'); - delete_option('facets_hide_popularity'); delete_option('facets_elements'); - delete_option('facets_item_types'); - delete_option('facets_collections'); - delete_option('facets_tags'); + delete_option('facets_item_types_active'); + delete_option('facets_item_types_show_popularity'); + delete_option('facets_collections_active'); + delete_option('facets_collections_show_popularity'); + delete_option('facets_tags_active'); + delete_option('facets_tags_show_popularity'); } /** @@ -107,8 +109,6 @@ public function hookConfig($args) set_option('facets_public_hook', $post['facets_public_hook']); set_option('facets_description', $post['facets_description']); set_option('facets_hide_single_entries', $post['facets_hide_single_entries']); - set_option('facets_sort_order', $post['facets_sort_order']); - set_option('facets_hide_popularity', $post['facets_hide_popularity']); $settings = array( 'item_elements' => isset($post['item_elements']) ? $post['item_elements'] : array(), @@ -116,30 +116,33 @@ public function hookConfig($args) ); set_option('facets_elements', json_encode($settings)); - set_option('facets_item_types', $post['facets_item_types']); - set_option('facets_collections', $post['facets_collections']); - set_option('facets_tags', $post['facets_tags']); + set_option('facets_item_types_active', $post['facets_item_types_active']); + set_option('facets_item_types_show_popularity', $post['facets_item_types_show_popularity']); + set_option('facets_collections_active', $post['facets_collections_active']); + set_option('facets_collections_show_popularity', $post['facets_collections_show_popularity']); + set_option('facets_tags_active', $post['facets_tags_active']); + set_option('facets_tags_show_popularity', $post['facets_tags_show_popularity']); } public function hookDefineRoutes($args) { - if (is_admin_theme()) { - return; - } - - //Itemtypes browse - $router = $args['router']; - $router->addRoute( - 'facets', - new Zend_Controller_Router_Route ( - "facets", - array( - 'module' => 'facets', - 'controller' => 'facets', - 'action' => 'browse' - ) - ) - ); + // if (is_admin_theme()) { + // return; + // } + + // ItemTypes browse + // $router = $args['router']; + // $router->addRoute( + // 'facets', + // new Zend_Controller_Router_Route ( + // "facets", + // array( + // 'module' => 'facets', + // 'controller' => 'facets', + // 'action' => 'browse' + // ) + // ) + // ); } /** @@ -153,8 +156,10 @@ public function hookCollectionsBrowseSql($args) $db = $this->_db; $select = $args['select']; $params = $args['params']; + + // if (array_key_exists('_advanced_0', $select->getPart('from')) return; - if (strpos($select, '_advanced') !== false) return; + if (strpos($select, '_advanced_') !== false) return; if ($advancedTerms = @$params['advanced']) { $where = ''; From 1930545f81abeb9d04c56728dbda526e1569ebe8 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sat, 12 Jun 2021 17:06:32 +0200 Subject: [PATCH 034/161] Added more control on individual elements --- config_form.php | 169 +++++++++++++++++++++++++++++++++--------------- 1 file changed, 118 insertions(+), 51 deletions(-) diff --git a/config_form.php b/config_form.php index 05f721f..e1bd80b 100644 --- a/config_form.php +++ b/config_form.php @@ -12,7 +12,7 @@
- formLabel('facets_public_hook', __('Public hook')); ?> + formLabel('facets_public_hook', __('Public hooks')); ?>

@@ -22,7 +22,7 @@ get_option('facets_public_hook'), null, array( - 'default' => 'public_items_browse + public_collections_browse', + 'default' => 'public_items_browse & public_collections_browse', 'custom' => 'public_facets', )); ?> @@ -55,53 +55,27 @@

-
-
- formLabel('facets_sort_order', __('Sort order')); ?> -
-
-

- -

- formRadio('facets_sort_order', - get_option('facets_sort_order'), - null, - array( - 'alpha' => __('Alphabetical'), - 'count_alpha' => __('Popularity first, then alphabetical'), - )); - ?> -
-
+

-
- formLabel('facets_hide_popularity', __('Hide popularity')); ?> -
-
-

- -

- formCheckbox('facets_hide_popularity', get_option('facets_hide_popularity'), null, array('1', '0')); ?> -
-
- -

- -
-
- formLabel('facets_elements-table', __('Dublin Core')); ?> -
-
+

+
+
+ formCheckbox( + "collection_elements[{$element->set_name}][{$element->name}]", + '1', + array( + 'disableHidden' => true, + 'checked' => isset($settings['collection_elements'][$element->set_name][$element->name]) + ) + ); ?> +
- - - + + + + + + + + + @@ -110,23 +84,47 @@ ?> + + @@ -139,38 +137,107 @@ +

+
- formLabel('facets_item_types', __('Item Types')); ?> + formLabel('facets_item_types_active', __('Active')); ?>

- formCheckbox('facets_item_types', get_option('facets_item_types'), null, array('1', '0')); ?> + formSelect( + 'facets_item_types_active', + get_option('facets_item_types_active'), + array(), + array( + '' => __('Not active'), + 'alpha' => __('Alphabetical sort'), + 'count_alpha' => __('Popularity + alphabetical sort') + )); + ?> +
+
+ +
+
+ formLabel('facets_item_types_show_popularity', __('Show popularity')); ?> +
+
+

+ +

+ formCheckbox('facets_item_types_show_popularity', get_option('facets_item_types_show_popularity'), null, array('1', '0')); ?>
+

+
- formLabel('facets_collections', __('Collections')); ?> + formLabel('facets_collections_active', __('Active')); ?>

- formCheckbox('facets_collections', get_option('facets_collections'), null, array('1', '0')); ?> + formSelect( + 'facets_collections_active', + get_option('facets_collections_active'), + array(), + array( + '' => __('Not active'), + 'alpha' => __('Alphabetical sort'), + 'count_alpha' => __('Popularity + alphabetical sort') + )); + ?> +
+
+ +
+
+ formLabel('facets_collections_show_popularity', __('Show popularity')); ?> +
+
+

+ +

+ formCheckbox('facets_collections_show_popularity', get_option('facets_collections_show_popularity'), null, array('1', '0')); ?>
+

+
- formLabel('facets_tags', __('Tags')); ?> + formLabel('facets_tags_active', __('Active')); ?>

- formCheckbox('facets_tags', get_option('facets_tags'), null, array('1', '0')); ?> + formSelect( + 'facets_tags_active', + get_option('facets_tags_active'), + array(), + array( + '' => __('Not active'), + 'alpha' => __('Alphabetical sort'), + 'count_alpha' => __('Popularity + alphabetical sort') + )); + ?> +
+
+ +
+
+ formLabel('facets_tags_show_popularity', __('Show popularity')); ?> +
+
+

+ +

+ formCheckbox('facets_tags_show_popularity', get_option('facets_tags_show_popularity'), null, array('1', '0')); ?>
From 089723bfb0edf0e45e2c49fb56528f1e21d2e3fe Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sat, 12 Jun 2021 17:07:15 +0200 Subject: [PATCH 035/161] Added more control on individual elements --- views/public/facets/browse.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/views/public/facets/browse.php b/views/public/facets/browse.php index 8fc63c7..2ac6381 100644 --- a/views/public/facets/browse.php +++ b/views/public/facets/browse.php @@ -4,8 +4,6 @@ $facetTags = array(); $facetsElements = json_decode(get_option('facets_elements'), true); $hideSingleEntries = (bool)get_option('facets_hide_single_entries'); - $sortOrder = (string)get_option('facets_sort_order'); - $hidePopularity = (bool)get_option('facets_hide_popularity'); $table = get_db()->getTable('Element'); $select = $table->getSelect() @@ -38,7 +36,8 @@ foreach ($elements as $element) { if (isFacetActive($recordType, $element->name, $facetsElements)) { $isDate = in_array($element->name, array('Date')); - if ($html = get_dc_facet_select('collection', $subsetSQL, $element->name, $isDate, $hideSingleEntries, $sortOrder, $hidePopularity)) { + $facetElement = $facetsElements['collection_elements']['Dublin Core'][$element->name]; + if ($html = get_dc_facet_select('collection', $subsetSQL, $element->name, $isDate, $hideSingleEntries, $facetElement['active'], $facetElement['showPopularity'])) { echo "
\n"; echo "\n"; echo "
"; @@ -50,7 +49,8 @@ foreach ($elements as $element) { if (isFacetActive($recordType, $element->name, $facetsElements)) { $isDate = in_array($element->name, array('Date')); - if ($html = get_dc_facet_select('item', $subsetSQL, $element->name, $isDate, $hideSingleEntries, $sortOrder, $hidePopularity)) { + $facetElement = $facetsElements['item_elements']['Dublin Core'][$element->name]; + if ($html = get_dc_facet_select('item', $subsetSQL, $element->name, $isDate, $hideSingleEntries, $facetElement['active'], $facetElement['showPopularity'])) { echo "
\n"; echo "\n"; echo "
"; @@ -59,8 +59,8 @@ } } - if (get_option('facets_item_types')) { - if ($html = get_item_types_facet_select($subsetSQL, $hideSingleEntries, $sortOrder, $hidePopularity)) { + if (get_option('facets_item_types_active') != '') { + if ($html = get_item_types_facet_select($subsetSQL, $hideSingleEntries, get_option('facets_item_types_active'), get_option('facets_item_types_show_popularity'))) { echo "
\n"; echo "\n"; echo "
"; @@ -68,8 +68,8 @@ } } - if (get_option('facets_collections')) { - if ($html = get_collections_facet_select($subsetSQL, $hideSingleEntries, $sortOrder, $hidePopularity)) { + if (get_option('facets_collections_active')) { + if ($html = get_collections_facet_select($subsetSQL, $hideSingleEntries, get_option('facets_collections_active'), get_option('facets_collections_show_popularity'))) { echo "
\n"; echo "\n"; echo "
"; @@ -77,8 +77,8 @@ } } - if (get_option('facets_tags')) { - if ($html = get_tags_facet_select($subsetSQL, $hideSingleEntries, $sortOrder, $hidePopularity)) { + if (get_option('facets_tags_active')) { + if ($html = get_tags_facet_select($subsetSQL, $hideSingleEntries, get_option('facets_tags_active'), get_option('facets_tags_show_popularity'))) { echo "
\n"; echo "\n"; echo "
"; From f77718a309fbc1f2db6663d6d944af6f030b64a4 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sat, 12 Jun 2021 17:07:48 +0200 Subject: [PATCH 036/161] Added more control on individual elements --- helpers/FacetsFunctions.php | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/helpers/FacetsFunctions.php b/helpers/FacetsFunctions.php index bd8af4f..e1672a2 100644 --- a/helpers/FacetsFunctions.php +++ b/helpers/FacetsFunctions.php @@ -11,10 +11,10 @@ * @param itemsArray * @param hideSingleEntries * @param sortOrder - * @param hidePopularity + * @param showPopularity * @return html. */ - function get_tags_facet_select($subsetSQL, $hideSingleEntries = false, $sortOrder = 'count_alpha', $hidePopularity = false) { + function get_tags_facet_select($subsetSQL, $hideSingleEntries = false, $sortOrder = 'count_alpha', $showPopularity = false) { // Create Where clause $whereSubset = createWhereSubsetClause('item', $subsetSQL); @@ -67,7 +67,7 @@ function get_tags_facet_select($subsetSQL, $hideSingleEntries = false, $sortOrde // Build additional part of the select tag (if needed) if ($addOptions) { foreach ($facetTags as $tag) { - $html .= ""; + $html .= ""; } } $html .= ""; @@ -84,10 +84,10 @@ function get_tags_facet_select($subsetSQL, $hideSingleEntries = false, $sortOrde * @param itemsArray * @param hideSingleEntries * @param sortOrder - * @param hidePopularity + * @param showPopularity * @return html. */ - function get_collections_facet_select($subsetSQL, $hideSingleEntries = false, $sortOrder = 'count_alpha', $hidePopularity = false) { + function get_collections_facet_select($subsetSQL, $hideSingleEntries = false, $sortOrder = 'count_alpha', $showPopularity = false) { // Create Where clause $whereSubset = createWhereSubsetClause('item', $subsetSQL); @@ -144,7 +144,7 @@ function get_collections_facet_select($subsetSQL, $hideSingleEntries = false, $s // Build additional part of the select tag (if needed) if ($addOptions) { foreach ($facetCollections as $collection) { - $html .= ""; + $html .= ""; } } $html .= ""; @@ -161,18 +161,18 @@ function get_collections_facet_select($subsetSQL, $hideSingleEntries = false, $s * @param itemsArray * @param hideSingleEntries * @param sortOrder - * @param hidePopularity + * @param showPopularity * @return html. */ - function get_item_types_facet_select($subsetSQL, $hideSingleEntries = false, $sortOrder = 'count_alpha', $hidePopularity = false) { + function get_item_types_facet_select($subsetSQL, $hideSingleEntries = false, $sortOrder = 'count_alpha', $showPopularity = false) { // Create Where Subset clause $whereSubset = createWhereSubsetClause('item', $subsetSQL); // Define Order by clause if ($sortOrder == 'count_alpha') { - $orderBy = array('count DESC', 'text ASC'); + $orderBy = array('count DESC', 'name ASC'); } else { - $orderBy = array('text ASC'); + $orderBy = array('name ASC'); } // Get the database. @@ -222,7 +222,7 @@ function get_item_types_facet_select($subsetSQL, $hideSingleEntries = false, $so // Build additional part of the select tag (if needed) if ($addOptions) { foreach ($facetItemTypes as $itemType) { - $html .= ""; + $html .= ""; } } $html .= ""; @@ -241,10 +241,10 @@ function get_item_types_facet_select($subsetSQL, $hideSingleEntries = false, $so * @param isDate * @param hideSingleEntries * @param sortOrder - * @param hidePopularity + * @param showPopularity * @return html. */ - function get_dc_facet_select($recordType, $subsetSQL, $dcElementName = 'Title', $isDate = false, $hideSingleEntries = false, $sortOrder = 'count_alpha', $hidePopularity = false) { + function get_dc_facet_select($recordType, $subsetSQL, $dcElementName = 'Title', $isDate = false, $hideSingleEntries = false, $sortOrder = 'count_alpha', $showPopularity = false) { // Create Where clauses $whereRecordType = createWhereRecordTypeClause($recordType); $whereSubset = createWhereSubsetClause($recordType, $subsetSQL); @@ -338,7 +338,7 @@ function get_dc_facet_select($recordType, $subsetSQL, $dcElementName = 'Title', if ($addOptions) { foreach ($facet as $name => $count) { $url = getElementFieldUrl($element_id, $name, $isDate); - $html .= ""; + $html .= ""; } } $html .= ""; @@ -431,7 +431,7 @@ function getFieldUrl($filter, $value = null) } function isFacetActive($recordType, $element_name, $settings) { - return ($settings[$recordType . '_elements']['Dublin Core'][$element_name] == 1); + return ($settings[$recordType . '_elements']['Dublin Core'][$element_name]['active'] != ''); } function isNotSingleEntry($count) { From 77253454dc65f2c0569cb53d7239f510ce0d4731 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sun, 13 Jun 2021 01:22:11 +0200 Subject: [PATCH 037/161] Simplified code --- views/public/facets/browse.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/views/public/facets/browse.php b/views/public/facets/browse.php index 2ac6381..41a6525 100644 --- a/views/public/facets/browse.php +++ b/views/public/facets/browse.php @@ -36,8 +36,8 @@ foreach ($elements as $element) { if (isFacetActive($recordType, $element->name, $facetsElements)) { $isDate = in_array($element->name, array('Date')); - $facetElement = $facetsElements['collection_elements']['Dublin Core'][$element->name]; - if ($html = get_dc_facet_select('collection', $subsetSQL, $element->name, $isDate, $hideSingleEntries, $facetElement['active'], $facetElement['showPopularity'])) { + $facetElement = $facetsElements['elements'][$element->name]; + if ($html = get_dc_facet_select('collection', $subsetSQL, $element->name, $isDate, $hideSingleEntries, $facetElement['sort'], $facetElement['popularity'])) { echo "
\n"; echo "\n"; echo "
"; @@ -49,8 +49,8 @@ foreach ($elements as $element) { if (isFacetActive($recordType, $element->name, $facetsElements)) { $isDate = in_array($element->name, array('Date')); - $facetElement = $facetsElements['item_elements']['Dublin Core'][$element->name]; - if ($html = get_dc_facet_select('item', $subsetSQL, $element->name, $isDate, $hideSingleEntries, $facetElement['active'], $facetElement['showPopularity'])) { + $facetElement = $facetsElements['elements'][$element->name]; + if ($html = get_dc_facet_select('item', $subsetSQL, $element->name, $isDate, $hideSingleEntries, $facetElement['sort'], $facetElement['popularity'])) { echo "
\n"; echo "\n"; echo "
"; @@ -59,8 +59,8 @@ } } - if (get_option('facets_item_types_active') != '') { - if ($html = get_item_types_facet_select($subsetSQL, $hideSingleEntries, get_option('facets_item_types_active'), get_option('facets_item_types_show_popularity'))) { + if ((bool)get_option('facets_item_types_active')) { + if ($html = get_item_types_facet_select($subsetSQL, $hideSingleEntries, get_option('facets_item_types_sort'), get_option('facets_item_types_popularity'))) { echo "
\n"; echo "\n"; echo "
"; @@ -68,8 +68,8 @@ } } - if (get_option('facets_collections_active')) { - if ($html = get_collections_facet_select($subsetSQL, $hideSingleEntries, get_option('facets_collections_active'), get_option('facets_collections_show_popularity'))) { + if ((bool)get_option('facets_collections_active')) { + if ($html = get_collections_facet_select($subsetSQL, $hideSingleEntries, get_option('facets_collections_sort'), get_option('facets_collections_popularity'))) { echo "
\n"; echo "\n"; echo "
"; @@ -77,8 +77,8 @@ } } - if (get_option('facets_tags_active')) { - if ($html = get_tags_facet_select($subsetSQL, $hideSingleEntries, get_option('facets_tags_active'), get_option('facets_tags_show_popularity'))) { + if ((bool)get_option('facets_tags_active')) { + if ($html = get_tags_facet_select($subsetSQL, $hideSingleEntries, get_option('facets_tags_sort'), get_option('facets_tags_popularity'))) { echo "
\n"; echo "\n"; echo "
"; From fbe7bded929b7680697050fbef5911014c9487f6 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sun, 13 Jun 2021 01:23:08 +0200 Subject: [PATCH 038/161] Added config options --- FacetsPlugin.php | 44 ++++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/FacetsPlugin.php b/FacetsPlugin.php index 8ec11a7..e955b8f 100644 --- a/FacetsPlugin.php +++ b/FacetsPlugin.php @@ -39,16 +39,18 @@ public function hookInstall() set_option('facets_hide_single_entries', 0); $defaults = array( - 'item_elements' => array('active', 'showPopularity'), - 'collection_elements' => array('active', 'showPopularity') + 'elements' => array('item', 'collection', 'sort', 'popularity') ); set_option('facets_elements', json_encode($defaults)); - set_option('facets_item_types_active', 'count_alpha'); - set_option('facets_item_types_show_popularity', 1); - set_option('facets_collections_active', 'count_alpha'); - set_option('facets_collections_show_popularity', 1); - set_option('facets_tags_active', ''); - set_option('facets_tags_show_popularity', 1); + set_option('facets_item_types_active', 0); + set_option('facets_item_types_sort', ''); + set_option('facets_item_types_popularity', 0); + set_option('facets_collections_active', 1); + set_option('facets_collections_sort', 'count_alpha'); + set_option('facets_collections_popularity', 1); + set_option('facets_tags_active', 0); + set_option('facets_tags_sort', ''); + set_option('facets_tags_popularity', 0); } /** @@ -61,11 +63,14 @@ public function hookUninstall() delete_option('facets_hide_single_entries'); delete_option('facets_elements'); delete_option('facets_item_types_active'); - delete_option('facets_item_types_show_popularity'); + delete_option('facets_item_types_sort'); + delete_option('facets_item_types_popularity'); delete_option('facets_collections_active'); - delete_option('facets_collections_show_popularity'); + delete_option('facets_collections_sort'); + delete_option('facets_collections_popularity'); delete_option('facets_tags_active'); - delete_option('facets_tags_show_popularity'); + delete_option('facets_tags_sort'); + delete_option('facets_tags_popularity'); } /** @@ -111,17 +116,19 @@ public function hookConfig($args) set_option('facets_hide_single_entries', $post['facets_hide_single_entries']); $settings = array( - 'item_elements' => isset($post['item_elements']) ? $post['item_elements'] : array(), - 'collection_elements' => isset($post['collection_elements']) ? $post['collection_elements'] : array() + 'elements' => isset($post['elements']) ? $post['elements'] : array() ); set_option('facets_elements', json_encode($settings)); set_option('facets_item_types_active', $post['facets_item_types_active']); - set_option('facets_item_types_show_popularity', $post['facets_item_types_show_popularity']); + set_option('facets_item_types_sort', $post['facets_item_types_sort']); + set_option('facets_item_types_popularity', $post['facets_item_types_popularity']); set_option('facets_collections_active', $post['facets_collections_active']); - set_option('facets_collections_show_popularity', $post['facets_collections_show_popularity']); + set_option('facets_collections_sort', $post['facets_collections_sort']); + set_option('facets_collections_popularity', $post['facets_collections_popularity']); set_option('facets_tags_active', $post['facets_tags_active']); - set_option('facets_tags_show_popularity', $post['facets_tags_show_popularity']); + set_option('facets_tags_sort', $post['facets_tags_sort']); + set_option('facets_tags_popularity', $post['facets_tags_popularity']); } public function hookDefineRoutes($args) @@ -298,7 +305,8 @@ public function showFacets($args) 'type' => $_GET['type'], 'tags' => $_GET['tags'] ); - if (count($settings['item_elements']) > 0 && count(get_records('item', $params, null)) > 0) { + + if (recordTypeActive('item', $settings['elements']) && count(get_records('item', $params, null)) > 0) { echo get_view()->partial('facets/browse.php', array( 'params' => $params, 'recordType' => 'item' @@ -308,7 +316,7 @@ public function showFacets($args) $params = array( 'advanced' => $_GET['advanced'] ); - if (count($settings['collection_elements']) > 0 && count(get_records('collection', $params, null)) > 0) { + if (recordTypeActive('collection', $settings['elements']) && count(get_records('collection', $params, null)) > 0) { echo get_view()->partial('facets/browse.php', array( 'params' => $params, 'recordType' => 'collection' From da3a7e0664d82cd215e8d73fbfedb49eabc30017 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sun, 13 Jun 2021 01:23:39 +0200 Subject: [PATCH 039/161] Added config options --- config_form.php | 134 +++++++++++++++++++++++++++++------------------- 1 file changed, 82 insertions(+), 52 deletions(-) diff --git a/config_form.php b/config_form.php index e1bd80b..84c645b 100644 --- a/config_form.php +++ b/config_form.php @@ -6,6 +6,9 @@ text-align: center; vertical-align: middle; } + .field select { + margin-bottom: 0; + }

@@ -55,27 +58,24 @@ -

+

-
+
+ formLabel('facets_elements-table', __('Dublin Core')); ?> +
+

-
-
name); ?> + formSelect( + "item_elements[{$element->set_name}][{$element->name}][active]", + $settings['item_elements'][$element->set_name][$element->name]['active'], + array(), + array( + '' => __('Not active'), + 'alpha' => __('Alphabetical sort'), + 'count_alpha' => __('Popularity + alphabetical sort') + )); + ?> + formCheckbox( - "item_elements[{$element->set_name}][{$element->name}]", + "item_elements[{$element->set_name}][{$element->name}][showPopularity]", '1', array( 'disableHidden' => true, - 'checked' => isset($settings['item_elements'][$element->set_name][$element->name]) + 'checked' => isset($settings['item_elements'][$element->set_name][$element->name]['showPopularity']) ) ); ?> + formSelect( + "collection_elements[{$element->set_name}][{$element->name}][active]", + $settings['collection_elements'][$element->set_name][$element->name]['active'], + array(), + array( + '' => __('Not active'), + 'alpha' => __('Alphabetical sort'), + 'count_alpha' => __('Popularity + alphabetical sort') + )); + ?> + formCheckbox( - "collection_elements[{$element->set_name}][{$element->name}]", + "collection_elements[{$element->set_name}][{$element->name}][showPopularity]", '1', array( 'disableHidden' => true, - 'checked' => isset($settings['collection_elements'][$element->set_name][$element->name]) + 'checked' => isset($settings['collection_elements'][$element->set_name][$element->name]['showPopularity']) ) ); ?>
- - - - - - - - - + + + + + @@ -85,46 +85,43 @@ @@ -147,14 +144,25 @@

+ formCheckbox('facets_item_types_active', get_option('facets_item_types_active'), null, array('1', '0')); ?> + + + +
+
+ formLabel('facets_item_types_sort', __('Sort order')); ?> +
+
+

+ +

formSelect( - 'facets_item_types_active', - get_option('facets_item_types_active'), + 'facets_item_types_sort', + get_option('facets_item_types_sort'), array(), array( - '' => __('Not active'), - 'alpha' => __('Alphabetical sort'), - 'count_alpha' => __('Popularity + alphabetical sort') + 'alpha' => __('Alphabetical'), + 'count_alpha' => __('Popularity first, then alphabetical') )); ?>
@@ -162,13 +170,13 @@
- formLabel('facets_item_types_show_popularity', __('Show popularity')); ?> + formLabel('facets_item_types_popularity', __('Show popularity')); ?>

- formCheckbox('facets_item_types_show_popularity', get_option('facets_item_types_show_popularity'), null, array('1', '0')); ?> + formCheckbox('facets_item_types_popularity', get_option('facets_item_types_popularity'), null, array('1', '0')); ?>
@@ -182,14 +190,25 @@

+ formCheckbox('facets_collections_active', get_option('facets_collections_active'), null, array('1', '0')); ?> +
+ + +
+
+ formLabel('facets_collections_sort', __('Sort order')); ?> +
+
+

+ +

formSelect( - 'facets_collections_active', - get_option('facets_collections_active'), + 'facets_collections_sort', + get_option('facets_collections_sort'), array(), array( - '' => __('Not active'), - 'alpha' => __('Alphabetical sort'), - 'count_alpha' => __('Popularity + alphabetical sort') + 'alpha' => __('Alphabetical'), + 'count_alpha' => __('Popularity first, then alphabetical') )); ?>
@@ -197,13 +216,13 @@
- formLabel('facets_collections_show_popularity', __('Show popularity')); ?> + formLabel('facets_collections_popularity', __('Show popularity')); ?>

- formCheckbox('facets_collections_show_popularity', get_option('facets_collections_show_popularity'), null, array('1', '0')); ?> + formCheckbox('facets_collections_popularity', get_option('facets_collections_popularity'), null, array('1', '0')); ?>
@@ -217,14 +236,25 @@

+ formCheckbox('facets_tags_active', get_option('facets_tags_active'), null, array('1', '0')); ?> +
+ + +
+
+ formLabel('facets_tags_sort', __('Sort order')); ?> +
+
+

+ +

formSelect( - 'facets_tags_active', - get_option('facets_tags_active'), + 'facets_tags_sort', + get_option('facets_tags_sort'), array(), array( - '' => __('Not active'), - 'alpha' => __('Alphabetical sort'), - 'count_alpha' => __('Popularity + alphabetical sort') + 'alpha' => __('Alphabetical'), + 'count_alpha' => __('Popularity first, then alphabetical') )); ?>
@@ -232,12 +262,12 @@
- formLabel('facets_tags_show_popularity', __('Show popularity')); ?> + formLabel('facets_tags_popularity', __('Show popularity')); ?>

- formCheckbox('facets_tags_show_popularity', get_option('facets_tags_show_popularity'), null, array('1', '0')); ?> + formCheckbox('facets_tags_popularity', get_option('facets_tags_popularity'), null, array('1', '0')); ?>
From 35cf008e99b2d972be266c79b498d64c4cdfcf78 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sun, 13 Jun 2021 01:24:51 +0200 Subject: [PATCH 040/161] Added function, simplified code --- helpers/FacetsFunctions.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/helpers/FacetsFunctions.php b/helpers/FacetsFunctions.php index e1672a2..16d822b 100644 --- a/helpers/FacetsFunctions.php +++ b/helpers/FacetsFunctions.php @@ -431,7 +431,7 @@ function getFieldUrl($filter, $value = null) } function isFacetActive($recordType, $element_name, $settings) { - return ($settings[$recordType . '_elements']['Dublin Core'][$element_name]['active'] != ''); + return ((bool)$settings['elements'][$element_name][$recordType]); } function isNotSingleEntry($count) { @@ -453,4 +453,11 @@ function createWhereSubsetClause($recordType, $sql) { function excludeSingleValues($element) { if ($element > 1) return $element; } + + function recordTypeActive($recordType, $elements) { + foreach ($elements as $element) { + if (array_key_exists($recordType, $element)) return true; + } + return false; + } ?> From 7e893dfdc6e06e5a57e9e6c49813d9f609ec47b9 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sun, 13 Jun 2021 01:25:16 +0200 Subject: [PATCH 041/161] Update plugin.ini --- plugin.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.ini b/plugin.ini index 8d1b305..40b8f5e 100644 --- a/plugin.ini +++ b/plugin.ini @@ -5,6 +5,6 @@ description="Filter browse/advanced search using facets" license="GPLv3" link="" support_link="" -version="2.0" +version="2.1" omeka_minimum_version="2.6.1" omeka_target_version="2.6.1" From d2c264849f1326b9c0bcfc035da1c1175c9de525 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sun, 13 Jun 2021 01:26:16 +0200 Subject: [PATCH 042/161] Update Readme.md --- Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index d26483a..3465594 100644 --- a/Readme.md +++ b/Readme.md @@ -2,7 +2,7 @@ ## Description -Plugin for Omeka Classic. Once installed and active, allows to insert a Facets block made of option dropdown boxes containing available metadata values extracted from browsing context +Plugin for Omeka Classic. Once installed and active, allows to insert a Facets block made of option dropdown boxes containing available metadata values extracted from browsing context. Works for both Items and Collections. Settings allow to choose the hook to be used, which elements use for search refinement, whether to ignore single entries, sorting order for values. From 508b84dfccc1cab06e732fd0f21ca51e376440e9 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sun, 13 Jun 2021 15:51:04 +0200 Subject: [PATCH 043/161] Update Readme.md --- Readme.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Readme.md b/Readme.md index 3465594..e62742c 100644 --- a/Readme.md +++ b/Readme.md @@ -6,8 +6,6 @@ Plugin for Omeka Classic. Once installed and active, allows to insert a Facets b Settings allow to choose the hook to be used, which elements use for search refinement, whether to ignore single entries, sorting order for values. -![Facets screenshot](./facets.jpg) - ## Credits Original development is part of the [Armarium](https://www.armarium-hautsdefrance.fr/) Project, managed by the french association [AR2L Hauts de France](http://www.ar2l-hdf.fr/). @@ -21,7 +19,9 @@ Then install it like any other Omeka plugin. ## (Eventually) Customize your Theme -Facets will appear by default in the Items browse page, where you have set the `public_items_browse` hook. It is possible to use instead a custom `public_items_facets` hook, that can be positioned wherever needed (`YOUR_THEME/items/browse.php` or `YOUR_THEME/common/header.php`, f.i.) according to the theme used. For Thanks, Roy theme, for example, best way is to change `common/header.php` code using the custom hook: +Facets will appear by default in the **Items browse** and **Collections browse** pages, where the `public_items_browse` and `public_collections_browse` hooks are set. It is possible to use instead a custom `public_items_facets` hook, that can be positioned wherever needed (`YOUR_THEME/items/browse.php` or `YOUR_THEME/common/header.php`, f.i.) according to the theme used. + +For **Thanks, Roy** theme, for example, best way is to change `common/header.php` code using the custom hook, while unchecking **Block collapsable** option and setting **Vertical** as **Block layout**: ```php $this, 'item' => $item)); ?> ``` +For **Berlin** theme, instead, check **Block collapsable** option, set **Horizontal** as **Block layout** and then add the custom hook in `items/browse.php`: +```php + + $this, 'item' => $item)); ?> + +``` ## Plugin configuration @@ -39,7 +45,9 @@ The elements used for search refinement can be selected in the configuration pag Similarly, one can choose to also include Item Types, Collections and Tags to the facets block. -Single values can be exluded as not really significant, although they will be listed anyway if less than 10 values are available. +Single values can be exluded as not really significant, although they will be listed anyway if less than 5 values are available. + +Facets block can be set up for vertical or horizontal layout, according to the theme layout; and it can be made collapsable, to use less vertical space (recommended for horizontal layout). Sorting order can be alphabetical, or first by popularity and then alphabetical. Popularity count can be hidden, if needed. From 11ed71b353f60086523b82ab603ff398bcdd508e Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sun, 13 Jun 2021 15:52:35 +0200 Subject: [PATCH 044/161] Update Readme.md --- Readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Readme.md b/Readme.md index e62742c..58f96f8 100644 --- a/Readme.md +++ b/Readme.md @@ -4,7 +4,7 @@ Plugin for Omeka Classic. Once installed and active, allows to insert a Facets block made of option dropdown boxes containing available metadata values extracted from browsing context. Works for both Items and Collections. -Settings allow to choose the hook to be used, which elements use for search refinement, whether to ignore single entries, sorting order for values. +Settings allow to choose the hook to be used, which elements use for search refinement, whether to ignore single entries, sorting order for values, whether to show values popolarity, whether to use an horizontal or vertical layout, etc. ## Credits @@ -17,7 +17,7 @@ Uncompress files and rename plugin folder "Facets". Then install it like any other Omeka plugin. -## (Eventually) Customize your Theme +## (optional) Theme customization Facets will appear by default in the **Items browse** and **Collections browse** pages, where the `public_items_browse` and `public_collections_browse` hooks are set. It is possible to use instead a custom `public_items_facets` hook, that can be positioned wherever needed (`YOUR_THEME/items/browse.php` or `YOUR_THEME/common/header.php`, f.i.) according to the theme used. From 4e471e90686937957cf5e1e802087c63d91fafd4 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sun, 13 Jun 2021 15:56:17 +0200 Subject: [PATCH 045/161] Update Readme.md --- Readme.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Readme.md b/Readme.md index 58f96f8..b795771 100644 --- a/Readme.md +++ b/Readme.md @@ -30,12 +30,12 @@ For **Thanks, Roy** theme, for example, best way is to change `common/header.php
- $this, 'item' => $item)); ?> + $this)); ?> ``` -For **Berlin** theme, instead, check **Block collapsable** option, set **Horizontal** as **Block layout** and then add the custom hook in `items/browse.php`: +For **Berlin** theme, instead, check **Block collapsable** option, set **Horizontal** as **Block layout** and then add the custom hook in `items/browse.php` and `collections/browse.php`: ```php - $this, 'item' => $item)); ?> + $this)); ?> ``` From 041654a8073eeb15a4dd4278679f0692fc5509c6 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sun, 13 Jun 2021 15:56:51 +0200 Subject: [PATCH 046/161] Update Readme.md --- Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index b795771..f092760 100644 --- a/Readme.md +++ b/Readme.md @@ -32,7 +32,7 @@ For **Thanks, Roy** theme, for example, best way is to change `common/header.php $this)); ?> ``` -For **Berlin** theme, instead, check **Block collapsable** option, set **Horizontal** as **Block layout** and then add the custom hook in `items/browse.php` and `collections/browse.php`: +For **Berlin** theme, instead, check **Block collapsable** option, set **Horizontal** as **Block layout** and then add the custom hook in `YOUR_THEME/items/browse.php` and `YOUR_THEME/collections/browse.php`: ```php $this)); ?> From 74283a5176f7a0d7578fc5017c98dc8ac0ad4d9c Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sun, 13 Jun 2021 15:57:10 +0200 Subject: [PATCH 047/161] Update Readme.md --- Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index f092760..86dcee6 100644 --- a/Readme.md +++ b/Readme.md @@ -30,7 +30,7 @@ For **Thanks, Roy** theme, for example, best way is to change `common/header.php - $this)); ?> + $this)); ?> ``` For **Berlin** theme, instead, check **Block collapsable** option, set **Horizontal** as **Block layout** and then add the custom hook in `YOUR_THEME/items/browse.php` and `YOUR_THEME/collections/browse.php`: ```php From 3121cbae9be2d70c2a9e5236cfdc877a27a60065 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sun, 13 Jun 2021 15:57:44 +0200 Subject: [PATCH 048/161] Update Readme.md --- Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index 86dcee6..b3d06fe 100644 --- a/Readme.md +++ b/Readme.md @@ -32,7 +32,7 @@ For **Thanks, Roy** theme, for example, best way is to change `common/header.php $this)); ?> ``` -For **Berlin** theme, instead, check **Block collapsable** option, set **Horizontal** as **Block layout** and then add the custom hook in `YOUR_THEME/items/browse.php` and `YOUR_THEME/collections/browse.php`: +For **Berlin** theme, instead, check **Block collapsable** option, set **Horizontal** as **Block layout** and then add the custom hook in `items/browse.php` and `collections/browse.php`: ```php $this)); ?> From 0a341c920595c38c102585e9fd814298e0f849bc Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sun, 13 Jun 2021 15:59:26 +0200 Subject: [PATCH 049/161] Update Readme.md --- Readme.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Readme.md b/Readme.md index b3d06fe..f523dae 100644 --- a/Readme.md +++ b/Readme.md @@ -43,15 +43,15 @@ For **Berlin** theme, instead, check **Block collapsable** option, set **Horizon The elements used for search refinement can be selected in the configuration page; best practice suggestion is to activate only elements that are displayed in the browse page, and that are offering some kind of data aggregation (a unique id would not offer any really useful refinement). -Similarly, one can choose to also include Item Types, Collections and Tags to the facets block. +Similarly, one can choose to also include **Item Types**, **Collections** and **Tags** to the facets block. -Single values can be exluded as not really significant, although they will be listed anyway if less than 5 values are available. +**Single values** can be exluded as not really significant, although they will be listed anyway if less than 5 values are available. -Facets block can be set up for vertical or horizontal layout, according to the theme layout; and it can be made collapsable, to use less vertical space (recommended for horizontal layout). +Facets block can be set up for **vertical** or **horizontal** layout, according to the theme layout; and it can be made **collapsable**, to use less vertical space (recommended for horizontal layout). -Sorting order can be alphabetical, or first by popularity and then alphabetical. Popularity count can be hidden, if needed. +Sorting order can be **alphabetical**, or **first by popularity and then alphabetical**. Popularity count can be shown, if needed. -Date element filter's behaviour is a bit different: dates are ordered decrescently, and only year is displayed; consequently, the matching will be with the beginning of the date (assuming the format is 'yyyy-mm-dd'). +**Date** element filter's behaviour is a bit different: dates are ordered decrescently, and only year is displayed; consequently, the matching will be with the beginning of the date (assuming the format is 'yyyy-mm-dd'). ## Licence MIT Licence, please credit AR2L [AR2L Hauts de France](http://www.ar2l-hdf.fr/) From fdb52056df10b6a96b558a3df9b93e1319593447 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sun, 13 Jun 2021 15:59:55 +0200 Subject: [PATCH 050/161] Update Readme.md --- Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index f523dae..fc4570c 100644 --- a/Readme.md +++ b/Readme.md @@ -54,4 +54,4 @@ Sorting order can be **alphabetical**, or **first by popularity and then alphabe **Date** element filter's behaviour is a bit different: dates are ordered decrescently, and only year is displayed; consequently, the matching will be with the beginning of the date (assuming the format is 'yyyy-mm-dd'). ## Licence -MIT Licence, please credit AR2L [AR2L Hauts de France](http://www.ar2l-hdf.fr/) +MIT Licence, please credit AR2L [AR2L Hauts de France](http://www.ar2l-hdf.fr/) and Daniele Binaghi. From 4fde0b10a5c58c7294eb45cbe32e5cc377fd5ba9 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sun, 13 Jun 2021 16:01:46 +0200 Subject: [PATCH 051/161] Update plugin.ini --- plugin.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.ini b/plugin.ini index 40b8f5e..3298253 100644 --- a/plugin.ini +++ b/plugin.ini @@ -5,6 +5,6 @@ description="Filter browse/advanced search using facets" license="GPLv3" link="" support_link="" -version="2.1" +version="2.2" omeka_minimum_version="2.6.1" omeka_target_version="2.6.1" From 27fa2159b5abe9667b743d07095b80fc51d76d7c Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sun, 13 Jun 2021 16:02:15 +0200 Subject: [PATCH 052/161] Added layout options --- config_form.php | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/config_form.php b/config_form.php index 84c645b..91ad045 100644 --- a/config_form.php +++ b/config_form.php @@ -58,6 +58,38 @@ +
+
+ formLabel('facets_collapsable', __('Block collapsable')); ?> +
+
+

+ +

+ formCheckbox('facets_collapsable', get_option('facets_collapsable'), null, array('1', '0')); ?> +
+
+ +
+
+ formLabel('facets_direction', __('Block layout')); ?> +
+
+

+ +

+ formSelect( + 'facets_direction', + get_option('facets_direction'), + array(), + array( + 'horizontal' => __('Horizontal (useful for themes with top main navigation menu)'), + 'vertical' => __('Vertical (useful for themes with side main navigation menu)') + )); + ?> +
+
+

From 83bde60e0c8da9a53ff6a5d83630190b20221bce Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sun, 13 Jun 2021 16:02:46 +0200 Subject: [PATCH 053/161] Added layout options --- FacetsPlugin.php | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/FacetsPlugin.php b/FacetsPlugin.php index e955b8f..873ac3f 100644 --- a/FacetsPlugin.php +++ b/FacetsPlugin.php @@ -21,7 +21,6 @@ class FacetsPlugin extends Omeka_Plugin_AbstractPlugin 'initialize', 'config_form', 'config', - 'define_routes', 'collections_browse_sql', 'public_head', 'public_items_browse', @@ -37,6 +36,8 @@ public function hookInstall() set_option('facets_public_hook', 'default'); set_option('facets_description', ''); set_option('facets_hide_single_entries', 0); + set_option('facets_collapsable', 0); + set_option('facets_direction', 'vertical'); $defaults = array( 'elements' => array('item', 'collection', 'sort', 'popularity') @@ -61,6 +62,8 @@ public function hookUninstall() delete_option('facets_public_hook'); delete_option('facets_description'); delete_option('facets_hide_single_entries'); + delete_option('facets_collapsable'); + delete_option('facets_direction'); delete_option('facets_elements'); delete_option('facets_item_types_active'); delete_option('facets_item_types_sort'); @@ -114,6 +117,8 @@ public function hookConfig($args) set_option('facets_public_hook', $post['facets_public_hook']); set_option('facets_description', $post['facets_description']); set_option('facets_hide_single_entries', $post['facets_hide_single_entries']); + set_option('facets_collapsable', $post['facets_collapsable']); + set_option('facets_direction', $post['facets_direction']); $settings = array( 'elements' => isset($post['elements']) ? $post['elements'] : array() @@ -131,27 +136,6 @@ public function hookConfig($args) set_option('facets_tags_popularity', $post['facets_tags_popularity']); } - public function hookDefineRoutes($args) - { - // if (is_admin_theme()) { - // return; - // } - - // ItemTypes browse - // $router = $args['router']; - // $router->addRoute( - // 'facets', - // new Zend_Controller_Router_Route ( - // "facets", - // array( - // 'module' => 'facets', - // 'controller' => 'facets', - // 'action' => 'browse' - // ) - // ) - // ); - } - /** * Hook into collections_browse_sql * From f759c5ac9a0fdcb9fa909ceeec74722014a9f75b Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sun, 13 Jun 2021 16:03:35 +0200 Subject: [PATCH 054/161] Added layout features --- views/public/css/facets.css | 139 +++++++++++++++++++----------------- 1 file changed, 74 insertions(+), 65 deletions(-) diff --git a/views/public/css/facets.css b/views/public/css/facets.css index f61f28d..6b08d09 100644 --- a/views/public/css/facets.css +++ b/views/public/css/facets.css @@ -1,52 +1,103 @@ -.container-fluid { - display: flex; +.facets-container { + margin-bottom: 20px; +} + +.facets-layout-vertical { + max-width: 350px; +} + +.facets-layout-horizontal { + margin-top: 20px; + width: 100%; } -.search-container h4 { +.facets-container button { + width: 100%; text-align: center; + font-weight: bold; color: white; - background-color: black; margin-bottom: 0; padding: 10px; } -.search-container h5 { +.facets-collapsed:after { + font-size: larger; + content: '\002B'; + float: right; + margin-left: 5px; +} + +.facets-collapsible:after { + font-size: larger; + content: "\2212"; + float: right; + margin-left: 5px; +} + +.container-vertical { + max-width: 350px; +} + +.container-vertical:not(:last-child) { + padding-bottom: 20px; +} + +.flex { + /* We first create a flex layout context */ + display: flex; + /* Then we define the flow direction + and if we allow the items to wrap + * Remember this is the same as: + * flex-direction: row; + * flex-wrap: wrap; + */ + flex-flow: row wrap; + + /* Then we define how is distributed the remaining space */ + justify-content: space-between; +} + +.container-horizontal { + max-width: 350px; + display: inline-block; + /* float: left; */ + /* display: flex; */ +} + +.container-horizontal:not(:last-child) { + padding-bottom: 20px; +} + +.facets-container p.description { text-align: left; color: #545759; font-size: 90%; - margin: 10px 10px 0 10px; + margin: 0; border-bottom: 1px solid #545759; font-style: italic; - padding-bottom: 10px; line-height: 140%; + padding: 10px; } -.search-container { - max-width: 350px; - margin-bottom: 20px; -} - -.search-container .container { +.facets-container .container { width: 100%; background-color: #F1F1F1; } -.search-container form { - padding: 20px 10px; +.facets-container .hidden { + display: none; } -.search-container .container .container-fluid:not(:first-child) { - padding-top: 20px; +.facets-container form { + padding: 20px 10px; } -.search-container form label { - /* margin-left: auto; */ - /* margin-right: auto; */ +.facets-container form label { margin-bottom: 8px; color: #545759; } -.search-container form select { +.facets-container form select { width: 100%; border: 0; appearance: none !important; @@ -62,54 +113,12 @@ background-color: #545759!important; } -.search-container .select-arrow, .search-container .select-cross { +.facets-container .select-arrow, .facets-container .select-cross { position: relative; margin-left: auto; margin-right: auto; } -.search-container .select-arrow select::-ms-expand, .search-container .select-cross select::-ms-expand { +.facets-container .select-arrow select::-ms-expand, .facets-container .select-cross select::-ms-expand { display: none; } - -.search-container .select-cross:after { - /* pointer-events: none; */ - /* position: absolute; */ - /* content: ''; */ - /* top: 9px; */ - /* right: 10px; */ - /* height: 10px; */ - /* width: 10px; */ - /* background-size: cover!important; */ - /* background: url('../images/cross.svg'); */ -} - -.search-container .select-arrow:after { - /* width: 0; */ - /* pointer-events: none; */ - /* position: absolute; */ - /* content: ''; */ - /* top: 8px; */ - /* right: 10px; */ - /* border-top: 8px solid #3D3D3D; */ - /* border-bottom: 8px solid transparent; */ - /* border-left: 8px solid transparent; */ - /* border-right: 8px solid transparent; */ -} - -.search-container .select-arrow span, .container-fluid .search-container .select-cross span { - /* padding-right: 5%; */ -} - -.search-container button { - width: 73%; - font-family: 'open-bold'; - margin-left: auto; - margin-right: auto; - padding-top: 7px; - padding-bottom: 7px; - border-radius: 0; - border: 0; - background-color: #FF5E4D; - color: white; -} \ No newline at end of file From 06ad8b9981c238689480c8f43f4593bb610dc046 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sun, 13 Jun 2021 16:04:17 +0200 Subject: [PATCH 055/161] Added layout features --- views/public/facets/browse.php | 48 ++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/views/public/facets/browse.php b/views/public/facets/browse.php index 41a6525..81b07c1 100644 --- a/views/public/facets/browse.php +++ b/views/public/facets/browse.php @@ -1,9 +1,8 @@ getTable('Element'); $select = $table->getSelect() @@ -20,17 +19,16 @@ } ?> -
+
"> +
-

...

- " . $description . "\n"; + echo "

" . $description . "

\n"; } ?> - + > name, array('Date')); $facetElement = $facetsElements['elements'][$element->name]; if ($html = get_dc_facet_select('collection', $subsetSQL, $element->name, $isDate, $hideSingleEntries, $facetElement['sort'], $facetElement['popularity'])) { - echo "
\n"; + echo "
\n"; echo "\n"; - echo "
"; echo $html; + echo "
\n"; } } } @@ -51,38 +49,38 @@ $isDate = in_array($element->name, array('Date')); $facetElement = $facetsElements['elements'][$element->name]; if ($html = get_dc_facet_select('item', $subsetSQL, $element->name, $isDate, $hideSingleEntries, $facetElement['sort'], $facetElement['popularity'])) { - echo "
\n"; + echo "
\n"; echo "\n"; - echo "
"; echo $html; + echo "
\n"; } } } if ((bool)get_option('facets_item_types_active')) { if ($html = get_item_types_facet_select($subsetSQL, $hideSingleEntries, get_option('facets_item_types_sort'), get_option('facets_item_types_popularity'))) { - echo "
\n"; + echo "
\n"; echo "\n"; - echo "
"; echo $html; + echo "
\n"; } } if ((bool)get_option('facets_collections_active')) { if ($html = get_collections_facet_select($subsetSQL, $hideSingleEntries, get_option('facets_collections_sort'), get_option('facets_collections_popularity'))) { - echo "
\n"; + echo "
\n"; echo "\n"; - echo "
"; echo $html; + echo "
\n"; } } if ((bool)get_option('facets_tags_active')) { if ($html = get_tags_facet_select($subsetSQL, $hideSingleEntries, get_option('facets_tags_sort'), get_option('facets_tags_popularity'))) { - echo "
\n"; + echo "
\n"; echo "\n"; - echo "
"; echo $html; + echo "
\n"; } } } @@ -91,10 +89,22 @@
From faf642e9a1589a55718545bdf95f08ade129883e Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sun, 13 Jun 2021 16:29:41 +0200 Subject: [PATCH 056/161] Update language files --- languages/eo.po | 102 +++++++++++++++++++++++---------- languages/it.mo | Bin 3896 -> 4081 bytes languages/it.po | 126 +++++++++++++++++++++++++++-------------- languages/template.pot | 106 +++++++++++++++++++++++----------- 4 files changed, 226 insertions(+), 108 deletions(-) diff --git a/languages/eo.po b/languages/eo.po index f70c673..aec4aeb 100644 --- a/languages/eo.po +++ b/languages/eo.po @@ -34,105 +34,145 @@ msgstr "Forigi filtron" msgid "Select" msgstr "Elektu" -#: config_form.php:11 +#: config_form.php:14 msgid "Use" msgstr "" -#: config_form.php:15 +#: config_form.php:18 msgid "Public hooks" msgstr "" -#: config_form.php:19 +#: config_form.php:22 msgid "" "The hooks you want to use: Omeka's default public_items_browse and public_collections_browse, " "already coded into every page (so no changes are needed), normally showing up at the end of the page; or the plugin's " "own public_facets, that has to be coded into relevant theme pages but can be used wherever deemed right." msgstr "" -#: config_form.php:32 +#: config_form.php:35 msgid "Aspect" msgstr "" -#: config_form.php:36 +#: config_form.php:39 msgid "Description" msgstr "" -#: config_form.php:40 +#: config_form.php:43 msgid "Text to be used as additional description (tip: keep it short)." msgstr "" -#: config_form.php:48 +#: config_form.php:51 msgid "Hide single entries" msgstr "" -#: config_form.php:52 +#: config_form.php:55 msgid "If checked, values with just one entry will not be listed (unless there's less than %s entries in the list)." msgstr "" -#: config_form.php:60 -msgid "Sort order" +#: config_form.php:63 +msgid "Block collapsable" msgstr "" -#: config_form.php:64 -msgid "The sorting order for values in select fields." +#: config_form.php:67 +msgid "If checked, facets block will be collapsable (tip: as it saves space, it's particularly useful with horizontal theme layouts)." msgstr "" -#: config_form.php:70 -msgid "Alphabetical" +#: config_form.php:75 +msgid "Block layout" msgstr "" -#: config_form.php:71 -msgid "Popularity first, then alphabetical" +#: config_form.php:79 +msgid "The layout direction of the facets block." msgstr "" -#: config_form.php:79 -msgid "Hide popularity" +#: config_form.php:86 +msgid "Horizontal (useful for themes with top main navigation menu)" msgstr "" -#: config_form.php:83 -msgid "If checked, values's popularity will not be displayed (sorting order will still take it into consideration, if required)." +#: config_form.php:87 +msgid "Vertical (useful for themes with side main navigation menu)" msgstr "" -#: config_form.php:89 +#: config_form.php:93 msgid "Elements" msgstr "" -#: config_form.php:97 +#: config_form.php:101 msgid "The Dublin Core elements that can be used for search refinement." msgstr "" -#: config_form.php:102 +#: config_form.php:106 msgid "Element name" msgstr "" -#: config_form.php:103 +#: config_form.php:107 msgid "Item" msgstr "" -#: config_form.php:104 +#: config_form.php:108 msgid "Collection" msgstr "" -#: config_form.php:144 +#: config_form.php:109 +#: config_form.php:185 +#: config_form.php:231 +#: config_form.php:277 +msgid "Sort order" +msgstr "" + +#: config_form.php:110 +#: config_form.php:205 +#: config_form.php:251 +#: config_form.php:297 +msgid "Popularity" +msgstr "" + +#: config_form.php:145 +#: config_form.php:196 +#: config_form.php:242 +#: config_form.php:288 +msgid "Alphabetical" +msgstr "" + +#: config_form.php:146 +#: config_form.php:197 +#: config_form.php:243 +#: config_form.php:289 +msgid "Popularity first, then alphabetical" +msgstr "" + +#: config_form.php:169 msgid "Item Types" msgstr "" -#: config_form.php:148 +#: config_form.php:173 +#: config_form.php:219 +#: config_form.php:265 +msgid "Active" +msgstr "" + +#: config_form.php:177 msgid "If checked, search refinement by Item Type will be available (Items only)." msgstr "" -#: config_form.php:156 +#: config_form.php:209 +#: config_form.php:255 +#: config_form.php:301 +msgid "If checked, values's popularity will be displayed." +msgstr "" + +#: config_form.php:215 msgid "Collections" msgstr "" -#: config_form.php:160 +#: config_form.php:223 msgid "If checked, search refinement by Collection will be available (Items only)." msgstr "" -#: config_form.php:168 +#: config_form.php:261 msgid "Tags" msgstr "" -#: config_form.php:172 +#: config_form.php:269 msgid "If checked, search refinement by Tag will be available (Items only)." msgstr "" \ No newline at end of file diff --git a/languages/it.mo b/languages/it.mo index e80aafa0d6500a1d6f5bdc3ca9853211f734335b..08b2f60fffd62bb141f0064332368f8dd5b4d617 100644 GIT binary patch delta 1563 zcmbV~&ug4T7{_Ph*8J#dYfH@~nyEcBThd@Hfs#fv8n88DTC63C9%kR2%}zV}&g(m~ z8(P7Y9&!}%MGr->7t!7-d-0$Lt)K<}20bhEAb1q?GrMn$74+b;yPtVx=9%X^&v(9f z^w-(`j|Zyn3qFtWo8dQKiIEV?W4pYc;giHQxC&!@9zFy&%K1xhig*j|h1W{HQ?6f! z6U=`K55ik;S%|*)mcd(0RPGaE4ZaPZhd;noI9(OO!q?yv@DAiFe&;V1tn3-F29FR= z!zlDL+z-#d2jD9(3g3h=KZQ?GUw8&jGckY(xBm^+i8scDK!dmjPs44Pv;GZ?2Q5yH z3NJ&Z#B=ZfT!*n>qg>BQz6oPzw#)VR-~{!>4F=QjCVUZo4L^qaxn2|Af*CwSb^^Dd zgTKI2@Kvr$iYQ=g?ME;c`WzmHU%@EoC-^YD3m=44Ci^k*AcM$9U~K(Scmd|{CO7^L z9wUBZ-^jxc;TrKLP^=`u^t4#9Sz9%9Fp08a#b-JR;u-6b%QA7+s?4i~)#Z#;S6nxU zXIUurj4k!ONjI&QIt{teUYv2cx$4rOteoq5-RfG|a=8p`-O*ldnb4NOWwN78DpS=n zn<^NW%8pLEb#b;OleSJS>*l;{sYC}a8$%ge##-6Xf0rZYg2|TTn)1>F=~a*8eMZte z@lh``m2;o2Rk^()OC`hd?OlaKRdRGAUtbu!KISSl$~2A7nAOc#n<7Yxtu&NZ+}*L>+m*i z9&L<|Bi)g%c5I4Xmp800{8M1@<O-B`rwe`XET4OBNc1KH-;XVD}nT&4e{(39_-v_IL J&M~Ae{sef?mu>(6 delta 1059 zcmY+>Pe>F|90%~<{#Dntwm+7E)e|KYY|}%BL`Y+aFsg$}H({K4n@?xvjq~0ZE`bR` z-5)_ngh3Gr;bAY{B0P2JTBoi-e<=t;2>L!(M3mNdV$>4SwK87RkBYcWlr*cGP z#G6e-8PuoGc!)98S7;MVwGiQv1hnz|uJ@pw_yM$q4YZR!gU8`IJPF@G4}O3V97Yls zzJ?MWL6Q}?3|mm2@)*l*Q3-az9%u_(g(u(yJOt+;a#9Vp!y}yXGyif|%xwOAh6!b!1@}Ewrb)%k+ol&y1DDv~#i0QcG`}nP)yCWsV@F(T6Sh>kF}B

; zu?P;dVBQyRwO96P>?=_3Y;)7Y2Wv(+x4n*S^R5#_!ggl2aHmadAI?\n" "Language-Team: LANGUAGE \n" "Language: it\n" @@ -16,7 +16,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: browse.php:22 +#: browse.php:23 msgid "Refine search by" msgstr "Raffina la ricerca per" @@ -34,113 +34,151 @@ msgstr "Rimuovi filtro" msgid "Select" msgstr "Seleziona" -#: config_form.php:11 +#: config_form.php:14 msgid "Use" msgstr "Utilizzo" -#: config_form.php:15 +#: config_form.php:18 msgid "Public hooks" msgstr "Hook pubblici" -#: config_form.php:19 +#: config_form.php:22 msgid "" "The hooks you want to use: Omeka's default public_items_browse and public_collections_browse, " "already coded into every page (so no changes are needed), normally showing up at the end of the page; or the plugin's " "own public_facets, that has to be coded into relevant theme pages but can be used wherever deemed right." - -"The hook you want to use: Omeka's default public_items_browse, already coded into every page " -"(so no change is needed), normally showing up at the end of the page; or the plugin's own " -"public_items_facets, that has to be coded into relevant theme pages but can be used wherever deemed right." msgstr "" "Gli hook che si vogliono usare: quelli di default di Omeka (public_items_browse e public_collections_browse), " "già codificati in ogni pagina (così nessuna modifica è necessaria), solitamente mostrati alla fine della pagina; oppure, " "quello proprio del plugin (public_facets), che deve essere codificato nelle giuste pagine del tema " "ma può essere usato ovunque lo si ritenga opportuno." -#: config_form.php:32 +#: config_form.php:35 msgid "Aspect" msgstr "Aspetto" -#: config_form.php:36 +#: config_form.php:39 msgid "Description" msgstr "Descrizione" -#: config_form.php:40 +#: config_form.php:43 msgid "Text to be used as additional description (tip: keep it short)." msgstr "Testo da usare come descrizione addizionale (consiglio: mantenerlo corto)." -#: config_form.php:48 +#: config_form.php:51 msgid "Hide single entries" msgstr "Nascondi valori singoli" -#: config_form.php:52 +#: config_form.php:55 msgid "If checked, values with just one entry will not be listed (unless there's less than %s entries in the list)." -msgstr "Se selezionato, i valori singoli non verranno elencati (a meno che non ci siano meno di %s valori nella lista)." - -#: config_form.php:60 -msgid "Sort order" -msgstr "Direzione ordinamento" +msgstr "Se selezionata, i valori singoli non verranno elencati (a meno che non ci siano meno di %s valori nella lista)." -#: config_form.php:64 -msgid "The sorting order for values in select fields." -msgstr "La direzione di ordinamento per i valori dei campi di selezione." +#: config_form.php:63 +msgid "Block collapsable" +msgstr "Blocco contraibile" -#: config_form.php:70 -msgid "Alphabetical" -msgstr "Alfabetico" +#: config_form.php:67 +msgid "If checked, facets block will be collapsable (tip: as it saves space, it's particularly useful with horizontal theme layouts)." +msgstr "" +"Se selezionata, il blocco filtri sarà contraibile (consiglio: dal momento che utilizza meno spazio, è particolarmente " +"utile con i temi a layout orizzontale)." -#: config_form.php:71 -msgid "Popularity first, then alphabetical" -msgstr "Prima popolarità, poi alfabetico" +#: config_form.php:75 +msgid "Block layout" +msgstr "Layout blocco" #: config_form.php:79 -msgid "Hide popularity" -msgstr "Nascondi popolarità" +msgid "The layout direction of the facets block." +msgstr "La direzione del layout del blocco filtri." -#: config_form.php:83 -msgid "If checked, values's popularity will not be displayed (sorting order will still take it into consideration, if required)." -msgstr "Se selezionato, la popolarità dei valori non verrà mostrata (la direzione di ordinamento ne terrà comunque conto, se necessario)." +#: config_form.php:86 +msgid "Horizontal (useful for themes with top main navigation menu)" +msgstr "Orizzontale (utile per i temi con un menu di navigazione principale superiore)" -#: config_form.php:89 +#: config_form.php:87 +msgid "Vertical (useful for themes with side main navigation menu)" +msgstr "Verticale (utile per i temi con un menu di navigazione principale laterale)" + +#: config_form.php:93 msgid "Elements" msgstr "Elementi" -#: config_form.php:97 +#: config_form.php:101 msgid "The Dublin Core elements that can be used for search refinement." msgstr "Gli elementi Dublin Core che possono essere usati per il raffinamento della ricerca." -#: config_form.php:102 +#: config_form.php:106 msgid "Element name" msgstr "Nome elemento" -#: config_form.php:103 +#: config_form.php:107 msgid "Item" msgstr "Documento" -#: config_form.php:104 +#: config_form.php:108 msgid "Collection" msgstr "Collezione" -#: config_form.php:144 +#: config_form.php:109 +#: config_form.php:185 +#: config_form.php:231 +#: config_form.php:277 +msgid "Ordinamento" +msgstr "" + +#: config_form.php:110 +#: config_form.php:205 +#: config_form.php:251 +#: config_form.php:297 +msgid "Popularity" +msgstr "Popolarità" + +#: config_form.php:145 +#: config_form.php:196 +#: config_form.php:242 +#: config_form.php:288 +msgid "Alphabetical" +msgstr "Alfabetico" + +#: config_form.php:146 +#: config_form.php:197 +#: config_form.php:243 +#: config_form.php:289 +msgid "Popularity first, then alphabetical" +msgstr "Popolarità prima, poi alfabetico" + +#: config_form.php:169 msgid "Item Types" msgstr "Tipologie documento" -#: config_form.php:148 +#: config_form.php:173 +#: config_form.php:219 +#: config_form.php:265 +msgid "Active" +msgstr "Attivo" + +#: config_form.php:177 msgid "If checked, search refinement by Item Type will be available (Items only)." msgstr "Se selezionata, il raffinamento della ricerca per Tipologia di Documento sarà disponibile (solo per Documenti)." -#: config_form.php:156 +#: config_form.php:209 +#: config_form.php:255 +#: config_form.php:301 +msgid "If checked, values's popularity will be displayed." +msgstr "Se selezionata, la poporità dei valori verrà mostrata." + +#: config_form.php:215 msgid "Collections" msgstr "Collezioni" -#: config_form.php:160 +#: config_form.php:223 msgid "If checked, search refinement by Collection will be available (Items only)." msgstr "Se selezionata, il raffinamento della ricerca per Collezione sarà disponibile (solo per Documenti)." -#: config_form.php:168 +#: config_form.php:261 msgid "Tags" msgstr "Etichette" -#: config_form.php:172 +#: config_form.php:269 msgid "If checked, search refinement by Tag will be available (Items only)." msgstr "Se selezionata, il raffinamento della ricerca per Etichetta sarà disponibile (solo per Documenti)." \ No newline at end of file diff --git a/languages/template.pot b/languages/template.pot index fd7adf2..16dc8da 100644 --- a/languages/template.pot +++ b/languages/template.pot @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: Reference\n" "Report-Msgid-Bugs-To: http://github.com/Daniel-KM/Reference/issues\n" "POT-Creation-Date: 2021-06-08 13:56-0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"PO-Revision-Date: 2021-06-13 15:39-0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -16,7 +16,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: browse.php:22 +#: browse.php:23 msgid "Refine search by" msgstr "" @@ -34,105 +34,145 @@ msgstr "" msgid "Select" msgstr "" -#: config_form.php:11 +#: config_form.php:14 msgid "Use" msgstr "" -#: config_form.php:15 +#: config_form.php:18 msgid "Public hooks" msgstr "" -#: config_form.php:19 +#: config_form.php:22 msgid "" "The hooks you want to use: Omeka's default public_items_browse and public_collections_browse, " "already coded into every page (so no changes are needed), normally showing up at the end of the page; or the plugin's " "own public_facets, that has to be coded into relevant theme pages but can be used wherever deemed right." msgstr "" -#: config_form.php:32 +#: config_form.php:35 msgid "Aspect" msgstr "" -#: config_form.php:36 +#: config_form.php:39 msgid "Description" msgstr "" -#: config_form.php:40 +#: config_form.php:43 msgid "Text to be used as additional description (tip: keep it short)." msgstr "" -#: config_form.php:48 +#: config_form.php:51 msgid "Hide single entries" msgstr "" -#: config_form.php:52 +#: config_form.php:55 msgid "If checked, values with just one entry will not be listed (unless there's less than %s entries in the list)." msgstr "" -#: config_form.php:60 -msgid "Sort order" +#: config_form.php:63 +msgid "Block collapsable" msgstr "" -#: config_form.php:64 -msgid "The sorting order for values in select fields." +#: config_form.php:67 +msgid "If checked, facets block will be collapsable (tip: as it saves space, it's particularly useful with horizontal theme layouts)." msgstr "" -#: config_form.php:70 -msgid "Alphabetical" +#: config_form.php:75 +msgid "Block layout" msgstr "" -#: config_form.php:71 -msgid "Popularity first, then alphabetical" +#: config_form.php:79 +msgid "The layout direction of the facets block." msgstr "" -#: config_form.php:79 -msgid "Hide popularity" +#: config_form.php:86 +msgid "Horizontal (useful for themes with top main navigation menu)" msgstr "" -#: config_form.php:83 -msgid "If checked, values's popularity will not be displayed (sorting order will still take it into consideration, if required)." +#: config_form.php:87 +msgid "Vertical (useful for themes with side main navigation menu)" msgstr "" -#: config_form.php:89 +#: config_form.php:93 msgid "Elements" msgstr "" -#: config_form.php:97 +#: config_form.php:101 msgid "The Dublin Core elements that can be used for search refinement." msgstr "" -#: config_form.php:102 +#: config_form.php:106 msgid "Element name" msgstr "" -#: config_form.php:103 +#: config_form.php:107 msgid "Item" msgstr "" -#: config_form.php:104 +#: config_form.php:108 msgid "Collection" msgstr "" -#: config_form.php:144 +#: config_form.php:109 +#: config_form.php:185 +#: config_form.php:231 +#: config_form.php:277 +msgid "Sort order" +msgstr "" + +#: config_form.php:110 +#: config_form.php:205 +#: config_form.php:251 +#: config_form.php:297 +msgid "Popularity" +msgstr "" + +#: config_form.php:145 +#: config_form.php:196 +#: config_form.php:242 +#: config_form.php:288 +msgid "Alphabetical" +msgstr "" + +#: config_form.php:146 +#: config_form.php:197 +#: config_form.php:243 +#: config_form.php:289 +msgid "Popularity first, then alphabetical" +msgstr "" + +#: config_form.php:169 msgid "Item Types" msgstr "" -#: config_form.php:148 +#: config_form.php:173 +#: config_form.php:219 +#: config_form.php:265 +msgid "Active" +msgstr "" + +#: config_form.php:177 msgid "If checked, search refinement by Item Type will be available (Items only)." msgstr "" -#: config_form.php:156 +#: config_form.php:209 +#: config_form.php:255 +#: config_form.php:301 +msgid "If checked, values's popularity will be displayed." +msgstr "" + +#: config_form.php:215 msgid "Collections" msgstr "" -#: config_form.php:160 +#: config_form.php:223 msgid "If checked, search refinement by Collection will be available (Items only)." msgstr "" -#: config_form.php:168 +#: config_form.php:261 msgid "Tags" msgstr "" -#: config_form.php:172 +#: config_form.php:269 msgid "If checked, search refinement by Tag will be available (Items only)." msgstr "" \ No newline at end of file From 606286488cb07f261f280799348a856421991e6c Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Mon, 14 Jun 2021 21:40:54 +0200 Subject: [PATCH 057/161] Update plugin.ini --- plugin.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.ini b/plugin.ini index 3298253..98605fa 100644 --- a/plugin.ini +++ b/plugin.ini @@ -1,7 +1,7 @@ [info] name = "Facets" author = "Jean-Baptiste HEREN and Daniele BINAGHI" -description="Filter browse/advanced search using facets" +description="Adds a faceted navigation block to narrow down Items and Collections search results by applying multiple filters" license="GPLv3" link="" support_link="" From bb2441d27ee841d573038de396d9adaa32c506bb Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Tue, 15 Jun 2021 08:19:51 +0200 Subject: [PATCH 058/161] Update plugin.ini --- plugin.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.ini b/plugin.ini index 98605fa..4b72021 100644 --- a/plugin.ini +++ b/plugin.ini @@ -1,6 +1,6 @@ [info] name = "Facets" -author = "Jean-Baptiste HEREN and Daniele BINAGHI" +author = "Jean-Baptiste Heren and Daniele Binaghi" description="Adds a faceted navigation block to narrow down Items and Collections search results by applying multiple filters" license="GPLv3" link="" From 14892555315ddfcfd51a68d51056360b9b0938d6 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Tue, 15 Jun 2021 08:20:25 +0200 Subject: [PATCH 059/161] Delete facets.jpg --- facets.jpg | Bin 24284 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 facets.jpg diff --git a/facets.jpg b/facets.jpg deleted file mode 100644 index 23c948d82240fe105ffddeb0e98ec16a1f7a4c99..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 24284 zcmeHucR&=&((f!w&N(MZA_yo^a*`~PL9!%?OU`K(6_g-~3MvvLND`171<4{x4w92d z65JJm1(w}6sCdr1_q^|T?{~lV{&@p4{oC&9?yBmZnd<5q><8=|K&h>+r4B$K0B{%l z1F-YJRkdK(D*&LY3kU!JKnUPLr~xR5AmASWVFvKNV*t>Gu>8V?5dNPuH~jMf18n)I_Rkb26X%!$VwDL!#yHwXq}UDMoW6^fzn7njmp7-F@EPEoik2?!QH$X5 z9rJ#Nl*4TCt8r(^Emz9{;$i<=y%?MA)%wTer5k2pmKEb za{z_c2g&Un{TyH*t^@#FMh91c+&UK?VT;|43e1=O38y2;2X_ zr@zw}8>)gdO5pI2+S&O!0|5CE|D1si&R{#_M?9YKbaeFu@ly~hIJnq3f_MtVr(rNJ z5K|C>nBV?S?KuAl+u7OwYSYfn`4|2n3s@8E_`Iv1w})NG_aFbs3(O+`)Ytce3%ruL z_-Y!0DJ`hCe0MLMBTNe7Mo;^TdLX6-@f%lAqMvxeB|y^z#7Fd>9sE>}W*|KP4z{D+ zc^we5f|x$Q-9-5(7Pa#Q(RX^Bi?04!#y_#Wub1J^_HhC|JuV*U_o$s)E>2p1Ji)6G5DIJno*<3iuX-xqOPzo~F#qsZ?vJ`cz?JW%f!}Mm1E0Vi zV7Sb<3b?Yk7r?6$c#7hl!<9a+$4PO_C%zi~d3;TLb^KGuIe-JmwFh|m0b*HNC~|Kt$=nxTcF+0MraMd32lbfLf=7O z9pRrmtAE#y^RM0vziZSTl)?3w=1kF<)iday^v4p|fu%?NAB}*Yzf-V3IQIZmFYgdv zS7#T0PG#_E?8K?%=^%WXQ}oQ)a{zGkY(Js_fGzs(&uj?&+duMrUIT!1EcjeFdaQCD zQ2~G*HvrUq0sxwwKk~T0g46vj0KDpV2=ER3L5F*k;DK)p3h=IA0^b|l06!>?C?E;Q z0!n}ypbh8&#(+6s18Up_fPp**0pY+kAR34R-+B*$CqM>}4desGKsitYGy*L^C(r}* z10%pBI4_ofbpQeE00$5VgaASYp@A?#I3T|E+?)KI5#zMO>iA>eQ+aj<8hzh=Hpi5w&M=r z&f_9*F?eKntayTWGI&~em++kNg7Bj8lJTD7RpE7j_stUC4n96UJ^o32De%5D$9KaI z!;i;L!!N~ujX!|Dh`&uhK)^&GNFYz3M_@kgph+!lu(_} zg3yyNiZGe5kg$nxkZ_ssfQXWamq><4kI0cIgeZ|Hhp3*Yk7$YLfS8K-B(XfPF|ix* zHR4CaCBz-XQ^Z>&BqUrU(j*2Xt|V7U9+A8xc|$T!vPViyDnP1AYDF4AdWSTR^fl=? z=@uCo86TMvnFX0Y*&VV1vNp0AG88!txiGmFxg$B8Je9nfe2{#Tf{22bLYcybB9tPT zqJpB2;xi=?B_E|Kr5$A?Wh!MINe^{8Ym4njVg@;&2^d_nhu&JT724*v|6-ov~je>w7s+lI%+y`I#aq}x>UMXbaV7j zdOmtBdJp| z;afS$cv9n7SBTtX2#uE-3CKo-Y1Df<{7DB1WQB;!sjb(pR!X za#e~)>ax^Rsj+jk=k(9TpL-*XC#@n4mu{5alaZA1mnoO|A}b{8E?X$OB6m{GNiIij zQJzcQPX3wvoC2r9Wra+IImHu-c8Xbw3rgHdj!Ms!mX%K_yD7g=-c&iG;;T}nva2ei z8ln37JoLQA`PlQlYSd~bYERT=)Vb81)r-^-8WI{|8m~3+G<7uZX^v^JX*p;WXd$$v zv?H|Jbx3uLbe`xeToAb6d!b$zM^{_-zV6gT-iw|WYxDp;Exr4C)A}d%ee@d)@D210 zQVl*Co;3_N>@uP;vNb9++A&r!PBfl0;Wr5|X*H!VwK6R*-8DOJmSi?}N#s(*r5GmTHy{Etjk$tfH+(txsA9TX)+q+j!W#vZb)Kv#q#{ciHT6;bpX) zo?VvRw!N19Q+tGiszZvyx}%cg1IJY-d8Z_&c%RAq9UUgA)Np|_{s_Od0 z73rqwmf^PRuIHZTj`c9}D1{NiF2m|PsXg62+r8Mmg1rX31-+xa=X_**9{M1Bb$p-u zLHw-!YW-Y=$|xM2=qt>Gua zuZ7P?C`UYtghbj$w!*pLH{eTGHLm7gBfjQ-?S0glsHCWG*Uhfi-(b6O^~T~&jhjW$ z)x+^!1*Bd!MBID54)4alQU9?Qvy=v9$k1;`A{MRZ>fzvOc~2bT`d0Z7^Lay(EJzBQ9e<(>3$MGmU4}S$tW^+4$Lk*`IPubGmZR z>02QBuiU`Lv3rDz+L@9a4>`ajBWBHLo40)2?f+m#wdA5N^n8Jkgl? zitbfn6LHgxCTw$P^Y&}+*PmOQTNYbwTPNEtwGFo$wD)%CbiC*E7@D!C)HQmFWp~1AUDu7s5sa%bbhFFSZlavBb&6dtd&b^vHKmTsQXkl{E zVR8MV-$(S)jZb8sl9xG_3syu|8dud<``0Yjme#%34?ah4P;ETj5IgEjo)J0%KIk%t#w;}du9i=bFdqWVnXHbo!jf$H``x62tpH}A03`LtjFkJrm!$9 z*4xh4?z=4j1+O?)z!mb>JOCgw2W^Lb03as+vG)2-@qMNI6M^Q&cl0Cu6aKM2`(7pq z0C`FPU~&}zF1!YSbnxT_F)5fHncl`q0FId0uM^BUI{dDPiGBwVQeV(CL1D35Yydz| z4*-Y0SnNR>7JHZj+U(;1@Y?6cn(v4jpArBvkJeSdd+x9kN9msr>}!CE5Jwwg1%+?{ zI8+cQ6$IN3aDcqyfrbfq91}xuptyMW1cXGyBp^W*C4d8gLUC}Rcz8z(bw~tQ4&YMZ zQJ*-gj89`=N5JJnD|+qTGeT~avKBhS0R)ejy>Ao|F+Bq#6EiR0N&Zs;;u4Zl=cHv+ z&#S3xXliL28Jn1zfhL)Qqtg{<7gskw|A4@t;E>SkH*QA9+`1i`bpOG_V>=%PXsE$gf-9ws&?> zd;3RnK>+9vv3^PR4{}j~a^c|OLU9R>3PKGd67q=eV6R_1dIB&B>N@UA978CCNs|W1BwHV5)=xK6fSt+ z5#Svi1cabj1s;Sy5903!Xah zg+jo|1f>ELfkSjwEI;t~=bqVOUq>?=S^|j$+A_$3Vc)Xt785KF1cI8XlFebnl_3wA zgt<-e92Es2QDR9l;w6J@iG}&40Aj3zB~>hcJyLSCGBtzLdTP=~w1{H-98&1ID}8<9j@(eniN#^`fY%P+t!w-Z zVrSx&E8YvM-0Y)0SH_;F7Q&;*ra)u0YC6$TdTYZucGswG05*R^i+Act+TFmqN=p+} zZ%@uk)47Q~)64~@0o*Z`e9T}vV9SbPXqn-tWqzk1Re9g2W<&`3-tn|t-kEONvg{Wd zr=OX*v8v}(-i*|5)op-$gV8O^P;|g!W=@WbsrE}e@+$e5gy9d*x!WPT>PzT#UW}GX zXUA19MYs!=__dmXZe{o?e^xB;cPF<0_r{XLOK(chcL0)}KZ^T*GLVT+fcXW#fXYNg&_kptW1y8%$ z!uDALIoP~jEEXULcb!wj5h}Sk4-;$Ok&>}kL-z2c@zu#0st@UkoptgMzrUw$9Z#(B z$y;xQj&@Ost-0uS(OTclCK5C!>iV2WY_dgX0)5#tlniFpv~et4zHr8Jc6H}T?(nSv zg$MH=(@af8rE#CX>Fw&CDA?7dHLl50UHf35M*Ft|haLF6LHqj~>z{5uD0c8y+mIJ; zn}e@ypUc^@$LwS5%L6jDeXu|y{Nd%x`ULKuIu5td9qb;qv$pTd=&q^b0f9~5e;E8I z@wr6%|H=N33gP$ns#o4;Uho#Q)xZLlCl9js`UzCkX!RlBNq`;tH3(1^b1Y!SaL~19 zis!YixVC@=g0Xr9+j{{P-tEe_u3iLYj-d+b2tDdZ#9C-^mmsOgfb zyoR#cQGe9u4cNEDa!uv>sByWJI>TFf$?s*)+I4?wXpUvatw3cUzO>s?cx^hB$Fwv1 z?sNN+xWUvLz^QT_zyqMqXo#&F~i( zJqy_xbIZ8rVYeGwaT?Flk<`_(L`CCH3^mCF+kD#a2!M%M^lu7_vy{?&P|Y9z`~(YV zm5(pKCpD0}!+!R()3dugZSSm}`w|dvv?|gEXSXyng;OnPX7$gb;==O#@@6cjHA4H< z!kozpA9H`ed6Pi?Rl$k#T9ThRJ)E?OOEF4<<1?JZMS%j9=rtd9cv2gAo;l8qi{#+e zfJt$(i}_;B!$or*YDm>X^|4MB)9P2v8v9tlI&FIolUHDYb{qOKd1+`Ku~X;%!u1KR z4R_7Z7oo+3FE50pUKpzMh-sv)oWIv_`d&P}!NXpH8%+w6HfSM4-kor}?3oX13a1h; zM76fQJ>hd$kneUjBuoCB*DQ}V^lXwHrRIZfz7E_w?k$RB;c(buLk5+*h5W0V>A7=X zJ`*{nSf!dY-a%SV=iXZ~`o!}N4dZsv*AuD=N#K}2*>Nk9C7h$8aj^0YS_ct|1@zK{ zqH|N_ZO*-L9uj`5&3WbO9!=%T7!L7Rs@Q^QGnehJ2PI!nmizs2P3iEYL(ee$+ymuc zRki+b^B3+io)u1hbAd4jK^Kxo6vo}jT8X&othDW(j1TeX(%z{f&4@79$O|@VUtf5o zV681AW;nQ@6>lJ1;I(7!oak2m?q2d~Ztp2C;&EI$y05c$BFWJz$aqD%a3ilg3rlw! zxdHJ+GS?>_^-(u!$_Jl>-0T=$XW@GDb?S{=?e%%Oi@us1wyS-9yf+(DUPdI(wWoV1 z*!L{eG77$mH0{b?*M2+3?71UsphgEJ=FhtNPv?gLEHK)QS-}J(S~4r{k1I}d^j?)Y zCR4J>M*?o&!T;$?>ODU2Z{Wv3T@2Z8X9;k-%qHZH=UMonT!irIqT&`MQ(I?fPzm$R z9Fr?!Vz$9|{Mb4(id=UjC!D$_ge+zP8Y+?mFKtp8BFvZ9h z1BZF)_qz{tKW41FU(%yr4YWkJ>c(xAY|123*anw>(I4YN(x zbYuQx?_*M*J?fC$p&mSp30cEaqL;lTvHUql#s|d473pPxx<5Y)U1R>znug!i!OmHx zC&R|RzwudZ?W72+(F(5jzj+-EL=mixeV#{BEPUy(g>)=t#5Pe>Af$(HrCb=| zYDiz(*r1rIt))@+yet|odcOM;9%s`iFTO~uq9aEXy9jC^5A8czX~$RNT4T zvLYFgyt6sW;#6Bra>L&HgDPiWG!4hlH;5q?z{o9OfxtR}buTQi*lWA%p7g_L`WxeC z?6>cJ@x-z&6c!M(DrORgOgS3dvr^Xu(d5Vf8W}p8(cD+p1p>!u>*(4Y2ktAeRjUcB z`7nt)_7iyBQ~wu{c?1?<_r(GYRu7rPzuSGJ`53!Ilm!i)d@X0t^xnI=Ukp+Zl8gs33jtEnK0N-9xui=-;07 z*74!AQ{3$|Ye#artCPbK6hX+Y`NNc(+s%wqS_Q(7=Qm7sS@adhgKYezd>)v-Q?Px+ z{VwjH6~}LkZh00GNx3>f5nVai#~Q4B8f}n0J3D1LHPb^kA3xnEUL;h~{rnF7*IcSH z;)JJnG*0%(InTl4is!IEtSxz^7g2SVoX!H#cAAti!%nxC#KRuTw@BI`>fFI{IhXh* z13*kOJ9bDTZ+i$sSU|joZH7RSfG?u<4e`&5gx7?yKy*CTBZ% zTCFoyUgSKSs}Ep#Y-PB9=z<02sQ5PWwhO_>N+`iK1z}fH3?5=Ldx0!;tHUDkc7X21 zt_$wgHSF8Y+bG2t__q;PX+6>HZz<+X0%4QcO{Dy%ml;R zEUGg~*ZO;0xEY?@t~pD6YkQNits-#E3fz;!1q@XN76LoI1WKkjdD|E|+J>a1@LMYEd4;Q!Fc z|IVs<_IKu9^8XWeZvPf{ZvRp4)P8XHe^+(PKULR+k8(KhRYh_voQ#nJv{S?eIC1VI6WerZGi~Q!<~L_E_VGD@W(jT92mX-%Z2cb=@?RHhYxrotve_0%P)0 zSU_{WbZP=EdRX54aWUKo3s`-dJ>-rqVYx4#_z3jk4!8f=l`B|`ppVH$WpvhaLSu*(GLiQj z?227?$IR+;-&9sbljz*~^q}$uBmRdQT#L)$!s@=lMACxyWxqDC*DZM6fD?&}Frju| zo63yc$r}l$^9o39NQE)$a)q^1#<{RsGd9BY+}9I=5iB2IWo` zpgb`!ON$}9VOVjoo!HYixzB4(*XcD z#xcyOw3F`EGCk&14Wsk1xLTQaItO5s#XVD9HM>La8q8~X@@-1nF=8mc1wE?ZPdbVm zE|ksf8PWA3F_qC_bvUc_(N8NR+L`0iZF(dcMY|}cCZBeyijX`#T%w)90tk*Z_s!`^ zFO=Xn1x7`3g%cvN8rLS*AA5oLsyfsxfdHUVk!e>6ZP3g_0 zdy$+;Rfmdt>-$5C#X7Iqr3cWmu!TdTwu!X#o1t&3Cm!sSBoFRo_>pTsu)x)q5Yz`t zt~%mFJQNZsr8DYZ%HlS|fVw$vnL!-9);Xc0N3j~}CUW~q!);E@%wh8fk4{uN`fgQ^ zn-I6hvMGD@Rdn+`oNgbaj^%%@2|BF-@Pw>0bF?Vlvf)8F6^2{%zc4&d8Q7c{-4Ob? z<)zORo#a))De|%FF5^>4h0D44Yl&T001v~7J_D{XqtRN6mbgQ6$n(D4&Ypvb)oM$2 z)l*7JE|2@8If6k8-fYi(rElD5L8`6qnhiZtv7VnQ$nJM=77KKDprx_E%SkM-N;e&eCXZ?cRdz*j?_6_?;tmV^kgK6| z_FBKO@rsoseJuZr9^$|ACj725wV71Wqgweu9hG;QVDsBd9_A_dRM=nGhDXnmqm}b@ ziri-y2C4*CclK(e0x9*xK10m>>gmtv1Ko3^CTbrH%`~>+K52Y+%sax59P{4{umEw; zJjWrC0vi@+u?C$oEZG>^FRhCE)ZwzAb=Ba7kuuw$Vt=2}+x(bgcWjF`y#fEmg9-x2DR36;nTRrKCd2|OT8J+g;*Dn1H2VNSh4WVFzuu!prSj)-^!nb9 zt~9=POm|2NZ%spiYZVo}7&yWVh6OrTK<|SrA`x>VgB&yoOTYn17}%f;lZ4A)zRRc2 ztK`cH{XFuoRFzd<#rcb9ZY=QZWLq;z zuo_(L`iGtWe>AGMhe9#-iDxO0rJn@%`Tt@F|3Y6AoI4(9t;0uY6dO#4Ief#5)hH&8 zt;HbQW{1oY4qcQjVoZHlXxo~jHIz4DqiFB0)uihVQkQ0~w~eXuf-u-X^HK6 z@fNRY;ynFDC{RHL8LbxY_Khx)Og4mgbu{Yt_L26{@c4@A+(;OXTEu%T%@!1mkq(y~ zLz85pcD@)Us#hX$sdc>E^C?rbc$?JT=`wrrZj4{jHm0+3yerrf&bFAENCc z@Qp~YnRPJKCnx5$WLux#MZU_d^s#rpwNP`@M)Pry?rA%vZqCaYiinz+a5y4*Y`*KJ zLA0A0(F&~)^PsECdF5Uvk1+ME0W8+qLkJHzatA7xd9 zD%=+pFyDg(h$gJul6UDbXUwmZH$}P3j0kaGTV}X8Ul*SItIYe&@BqThzfaT z+m^eoz&+$qvaI7ueQMeGa!qmhhh~@dFJC(vOLpdc-9J(gPP)%9A{ag&7OvT_jhQNv z%+5}@-_^*|73xhNTHW<7s%ms`3=aQvsjdA*o;UZ$kE(^i^kGHMljwSNP3YZdBxUYKYG_nm!)^r z6WJgZ;sV~sIROE-*?rpR?!#>VS2!@EPB>E&o!$Zk6b(bDzADagtxhpgUQ~7m!emdq zXjf-5B^q^#^M&$OUdMZVC&dzOi_q5M$fZx|x3QR)SP!L>sb@-5ZfS zBC&E|i+YfzdwzL(bF1P@?vHb$HNQ9v+qq^ZQPEUz#UZ7 zpj#8y{SI43VSia6-%CPOwlNIMA1xvtlv`P?B#T~u(FJ?N%z~snU;IuIpNY2lKeSS;Bz zV$inPs1*G%@#)jnM2+(B!?a*ep({12iVs<5>p~1ngLgEW8{^A8-!5~;W~}cYwC!V> z77IZa3FDE8ZuS&yj7o$dvRhJSq=&_=ZLMAoF}!b#QM)EwvQT4?lG^Rc?R=i~rEV{Q ztS0^|<|iwxFi+*V>%A_}t$Xmfe8q~Pn~sBx#`9MNOk1a-3GOO0T;kl}E{?E9$S#)L zL~gbD1vj@oVXt|<(sL?$X3MN5c3i}oh?>RwzGm+&^&vhS`gt8npRbDX&2y<(fJ{yo zSvcEe5iz@Cd);$F=e>KIHEhojjJT@?Ch*?$1-NK7*H`lOq5;&mx+O-f7{{zyRPUz-PJF6N8Y(nOEVe!L$Sb! z65CC>H;46Gm@uhT3~j_QfQ%VfB~F$qE>}cm%xfG2CANTniI}lOV`D61YrI(xk$ns@ z$s1@NmFOJ*{H=U5?w$3%z0b3GD1&35PhhR)tLWJXZri@!hu`G*g@AzJ{{*=P{MXLJ zrLcy_wApVv^bERCCZWIixcws>>A!y5{*{sRyLo?Or~R%+=l{?h#TjH?e7Nm1cW+l4 zCd9BsBgeQ@eev}6$d7>k#fC2yJk zLKa-qW{XIgaPuk%>Gq;JLl^bMpR$Yg#r;jjd)FpDoTU3~BQ`AL-$&%m5LDuD%iQXO zK;j7@9*=V-KU?#sdSRw3VYz3X~m#&>3HPU`fe`gl5! zEo){kG4Z>va9o>6yn)t5GIS}NVNR<+)fmL--Z?nWtk#hjj&(o-|d(E?h-y$;Il=Yl0hYYsnR-PbJ5ar(pr0Pp?7|x1Xk*iL){{7cxwJ(7iUySohhCcent$2ef0^) ztxdE;Km`27`dGF8>Yy8Qe131Wx9pp{U96{Q&z9_7u`j6Wm7>PEwmLg*mL3Os4Gaz+ zhO9L2j)+fuU`kU1&8Hs%YaDZPwKuC0US2BCfZ5MJ5ZD@ke<=k18(F0~c~)&Kn)8AA z-JkONzmMeKjpFYH(){T;{|o*_SjU{giNj2^Y?hmiX!+1LwlLe6`L8FCyrcJFwB1gp zljA~9Xr{Yt3OmscYH*VT=Mb}!Zju&#>1-Bmc9BFh$80y>YUWTNK-KHvqRkPHnFDL) z4|2D@%`$6wu?ji3D?DA&ofOpGQT?_#`iZ5-rDUUbB`?8I zoi(Zi3hgQ@VQ9qyRQ_LRP<Bx9V^y$*ik}z?ih?HRm9&^_p#mZ4!x;h+zOo%{25g*zalG%+<4Jib75!A zoV4uQdcr-VhMGz%x84QgH;YSTu%c93cIp}8>7vbq>fBF<1-Q*)Y-&1=pT?%bZO8IA1B`!$4ACvy(qc}c zyykYVdxb|V5?0|4`1iB#z+^gMDmuZ5_-4`5HnykW39WapfAZkx2^CV4qq1t>*(EGj z<9gul&18P*aufwFRSQ8e5Dq$tD1;6lHmpT*fnF{LQ*dL-ZC__Dud5jn4)6DDG(gM; zXnl**NvV)Z*@yL}v8GT_m-DDBal4XwNY?3_SPER6Q$n$H%pxx6k-23sZ3K9cx~*rS zMH@vz3RYe+=&Wm*Tsxpo<6jWeiBDoo+lhT~7lCAf55viV-IWl5*YZ%7t>A}Ti;*;a6Xqb`0*Xr+(X^ETCsd zp|9(Q1tx0Ji$Eviz+q9yTJ!FEz#m5I`Sx>WxwAV}lGqqQwaZugkDqOPDWFfc(d$n! zBaPd(2cHr*Ec;BbK$8nJ>ypEzcI`q+QWyY9yx^b5*njoRnOaVV=kkK7|4jVVLHg~T zOK0bN+n((sN7M5Qwe%ql_pilg7+H<&6fc9D>9gW+x0%q=!!0E?dAfH$vBq&3WN5&u z>-fjNOvnQ6aUz#R4yw9MR>6JzY?rB$QARlv=HE2*e%r0_Kj)D9cSB-oo7sa8+A_$+ zPn4pPv~KuLwK=(axszB~TTf5D)Vv%;iz(ccCqoR0*e663jE%}U z=cQ^{g%?{tBJaO0eHtknu3M8h504lB5-pSe3V9zTXff(0w?^{GDeCs3Ij6R)g@~VkT-Q3Z#kDs@F z{Jvj(ben`p=^+@;dpEUadllncu-eRy|7^aQ5cME9FgO!wb}JXLSkQ2zDxuv>%<@Y( z#Y_<+BRcIIL5W7cHFD}3d)40b{B)3tB4HEV+W=XiM5O(y31*0X)UMEt=W5X9yM%M0 zi3SE_r^0;}W^e6#mMy>-+GfrUHo{;5css>D0qkXYs|X#>Q4;$omxmrD&*HnvxtFxR z@ZYnJD{zy-yi$C3(bNo61OFHq7X+RzY-LJ=Ud90hAsto12=*5gydWlLcEN)Jy^kN0wC^cr!2Qj0q6PGx& z?z|I=))CB2bjaa${5)9X6lWZXKN!h4VS$DXl^AJPk9bIIgib#TNoIK@bfqk6-i+P8 zzH{=%_yEt()JFwQL>|uGEQ}yi~$BR2mO=tq7r| zA?@S~Mz_mJb~*K_xcdN153HD@ioT(Sdu+O1gO+cj z0`EB{P4*hGI#SDJ7RK1&PR6|QS`UNUoIiC?gQ>3DH`wGaebhuWjtXkypldoE%+flj z3d{Xqv$A{FRe#DW_N`?q9nGz0!ZRvjToqh5tv^2XwAUM|BBT2VI^#KyL!5u5f47tN zy9@PLfmVyDH()T*V?7ncLw|@(Y}F1+-`)ba_8m9|{dg7vV;{T}m*XNc7B!B65}iwt zt=-XrSZE)f!0`(KCeQ0n#~QqLx~wWl8bzV6JQrJc+|nOS;^SvLa|u14q?5Bc8Ym*N z-&tLAhaSEgD{vn*IKC1poIXZo2S${$G#+NQd9g+YhVG>rd#%q(y!xl6hH6D5^I%riJAz@Kr82fUn)Q&`#~=qEcb`5cz_H$GG|gG!N%cI8 zw-H8Yuk|LrK;PHz>6M%m&B2qG4Bc7G=|8}(%2B<%t$v1*ZVz}p@6&HOd#vnVTE9U0 zsB%MQ=9A83m`-pBZ{K54l{oHAY1ya1`}^J9A4lH)^Y9Jg6w|pMv-69uOyWwD(w8&v zKKet&&ctJIRbarhsVxKx$XSA}H)e%DAW)=sDNN_la6@~GhEW%4M_ zGyJFxL_^Ei#Ppq4FXS}ZD0w^U#3h5wOzX9^7}7IfwNXqbs;|UQ<2@Xy7OjJrYwges zJwXqn#+*ygV#7@Wm_aOn6Rzb@^kKDtAN)*a*V^7gf=ImKoT(P<6HD&PCfGT?euITt z_4o%LsY|`q_xoKra>{gA2Xe}u7UerBWZn@>>JJZ_htmWnwzJa=Z04jGBPx@TZg=Gy z`}c$bqcyz;vrb>@_atL-+AX~upm&>H8adO9q)&qZjSNA26X)ayoe0|4EfoAh-Jq~%ab@+eHI;?V z`hoGKrMn^Pq)W!pXEm!DVL6$oHiUxU>@As;TSA}FJ_{d`Ry~uag%)Law}%6hD$lF= z31v}mUVPoN#Ki4Tm&4oQCwuY`uD3t9D-r}>hksR6@Hc5%=W#GRLn= z#99eEGS#Ck6R#I>jX#hH9DgjbC>MmJY2hFhr$_3w3%T{R?aTS{7}~B;-xA6WA*Yl} z_*(L5K8PwwiS@2v#ft>E(m=RT)@-m}d!W9Xg-tGQa!qm&KTmY96N@>UC1(NtRfPa> zF*bIX1YapZ$zlQg9V~!032kmGjkhJi2wP0ghMz$yJYI;iB%&95{H^F_eKZrJBe&*b zebln2UljQn<DG_C_S>5E^ezUS52ITUUiUp8Bf}ciNz?ctT2Yh*e6G25;JJ zo_+#{KU{|a;PdT=ZTWk_&A;oi`_s)?S-dSRv~cMmUDR??gbVa}Rvi}Dcnn`o!dyxG znSx*B2xef$Q!pVSpInYpFaq(nDN7ZGF?8W#qg6}+5w@-M5*wd)sjPKly2b>tfa z)p+9H=rmr49jI`8rf-HzyaKNV;|SAr_MRvn1DPqgcx(84Oj{ydaGW+0ej6>6?Y6%e ztu-VexK1c6a{9LPI~vV+!bOkN=yS!T|0rj(QA#CB8S%WWMKoNz4B>f=;Kr5NPcCOylY5>kKAL=5m7myc z|9*?wjAzUAIm!|-xU4=PC+#yYPp*5i%}C8B>qAqTC(M65(^PY2kSmqb-_*&7(GbEJ zAo1$3LInNQ_T9j7`UzjHuMHlvn*lp8i>`d!Tv;U>;kNaz{ASZY!T4UJ+Q&M*^aTz+ zMPbvPl8zP@HJGan3u5PHP{HiV1T6PvXO+K56;pAhW=>;0RgR7S=S(J^uZ!oW#$}Dk zuNwVQ+b;la8(T6p zfk^AgYE)hVZ^BFUkKRldDdeIAm*d>ed13)K4yti$rSggQh%KEc%``uj_T60<{p&4; zd5o)f1bem{umD}KU}vNVO5(7pD5Ob3My>1W7v`q&P1Q(`lm4>%Dn9x>3o^k;T3EbL<>bP86*TJ?z84{M1 z%G!G+Y#-RxNZl?Ndfu+DFY7#~h!?!R(A+6+N=9IEU%zt1Xg(ua;=>F7jSDX2lWr4( z)*-v)PvJQ?l4wnC6{)ea_(~$Lr_^jW??D4+!H?Se`qu;>B1BOIatxVychV>Hs7g}Z z>MO>ZAA5|oO3+m5R!N<>&wFv?&1V@i6K(C@HcKmT!&>P$+~v>d-$us#c38@(7S{N} zBzYxqVB!?Us(H%m&A?L6VJA8P5RHYWi0ra_6%PTwN%3jsRwB*H_)*0Eovt6spSSm; zNaF_~@b({?@X-&KN9fkX@gk>~CCY=N{lDf8UximThR-wA_+Ixpaki3L6WF@sH8<^N zf=Z=`ms9o0)6H2i{hAk3oLOxbLf7%xEyZxEchjWFWRkkG5V#^zyU~^ZzxTRH(5HjA zIA)1@xG>8QyxFHS@-2}{Ij;rpwtF;xeQ*HIf+)Csu740)e)pyl%Qc=*joXn-;flyR z*$zdh6s7W}=AjcwGrb#&r+jc}=tNbLIt|+Os)97q@}OJ|v%ymt0p&fhEOcXUj9 zm-NA9h3HfzJX!-Kyg$V=bo~l4QDXaE29|SRf7b=`r?=)W_!rLcCCn*QAELCy;^xld zg+AKVCnlXK?sS`(HDWjDC5OIz&8_!p@J!nCT6(PgWg>8yZVkU#3M1|chV`lzqAwg~ zMlxBg&PXB1pAYIFHD2#$p0(m~H6?Kk@_RlF$6a@(RolojVl68%xaK7OSj*~=O~c&4 zn%v|n=bgE45FQ#aI{Pc-2Pbyf6_`$Toq+!y!VZz3hTKd5*p6UV~ z!>+Qqz^QkPq+TrO3!{-7;i{--rNNPwE+W)Qk+*J=)kX9kPHibSHrF6zeGpMA=#77I%m!?d!`n& zoi=g{^^D`Y9{^{Sg0EEXG`rO{RD`)ZQ?a(T+}Sg}|8S8-@fKyc14<~Sf&A8=kSNZuTn-iqx`);Twyh}HHUw-}syR*|_0BeRogTiiBA4KG-o zuyPm94Ztgug_)+S-J1plg(;=B-|<`7>TG(L&J4W!tjQJK+u1r1%#XC|#HFEd=?)6%~F zn&;Fx0y^{>ssTe(hZIpm^|>Qz+7vj3sv;;%M11m4)e$myWi>;Kmw6+U9n{8y04F2d zFts7kN?FRD9r#r9_`yyX%I`ob7-#miEyZa=+UcDHmBZ`=;VQw-gI$_OBW65^TbVps zH`Gi3eS(Tvc-PbB%`skUFaQ-D(u3LXHU6!a`0siTf88=Ard6;i#fsLKdtuefPZtaJ z^$9f8?680b78nvihk?5e8asW5qFA7-d4CvE_a85^(S3m?L+LEAq}i-nAeu6Q!&ODC z+|Ry=w;TSLU_d$3%BU7l#jS?pMdC)rK4_UH!ngC+z0Y}3 zp{Y=63*cLIB6zudhH6kkD6*4q|SKdp0s;O$EDQf;UUPjc-u9IM?3d>Jm?F6MGxSEYLvxwy=;8fMkME%uTckaakyD zl#w>GSB&S(fp)c})1?jJ9CDuIGiPHSXfLR*^X<&0b;+0hp?UZp<8kqe59`C_R*~o+ z(6g@yLww4R+G(nAUtrllLU$4@y51hhPj0;{3pu;tIZ2S~|AgU&oY;KPhJ#VR|6~|T zDWwe-a9O*rl4`U0<*jD;svc4?g;_X))+FN(ef~+@yDSe(IsTFlrT=URv()kG%CvDm zFN36GY0-V-|e%mMaKj*stQ<#XNepS*cl>;Xo&z5<{ID_qs-a9Y^+23EE zK>9ce@mDyanT8tR_XiQj|0h3I(f^2MOx8(G!K^1#a?St_=@~cO27VYO-;Iwymh68S P6${3&{k!>4?D+oz$Z@_Z From e5347d42992596186a3c3cd8f48f43d2cd769e82 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Tue, 15 Jun 2021 08:20:50 +0200 Subject: [PATCH 060/161] Delete cross.svg --- views/public/images/cross.svg | 5 ----- 1 file changed, 5 deletions(-) delete mode 100755 views/public/images/cross.svg diff --git a/views/public/images/cross.svg b/views/public/images/cross.svg deleted file mode 100755 index e4226af..0000000 --- a/views/public/images/cross.svg +++ /dev/null @@ -1,5 +0,0 @@ - - -cross - - From 8b327502c6496962d7135b504ce13e1cebca489f Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Tue, 15 Jun 2021 09:23:42 +0200 Subject: [PATCH 061/161] Improved styling for vertical layout --- views/public/css/facets.css | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/views/public/css/facets.css b/views/public/css/facets.css index 6b08d09..629bd41 100644 --- a/views/public/css/facets.css +++ b/views/public/css/facets.css @@ -3,7 +3,15 @@ } .facets-layout-vertical { - max-width: 350px; + margin-left: 5.26316%; + margin-right: 5.26316%; +} + +@media screen and (min-width: 768px) { + .facets-layout-vertical { + margin-left: 0; + margin-right: 0; + } } .facets-layout-horizontal { From 2c38930ff1ae58b6c136b3218bcf1e5c7b5b28f6 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Tue, 15 Jun 2021 10:21:01 +0200 Subject: [PATCH 062/161] Fixed references, cleaned up code --- views/public/css/facets.css | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/views/public/css/facets.css b/views/public/css/facets.css index 629bd41..fcbe7a9 100644 --- a/views/public/css/facets.css +++ b/views/public/css/facets.css @@ -43,7 +43,7 @@ } .container-vertical { - max-width: 350px; + /* max-width: 350px; */ } .container-vertical:not(:last-child) { @@ -53,11 +53,9 @@ .flex { /* We first create a flex layout context */ display: flex; + /* Then we define the flow direction and if we allow the items to wrap - * Remember this is the same as: - * flex-direction: row; - * flex-wrap: wrap; */ flex-flow: row wrap; @@ -68,8 +66,6 @@ .container-horizontal { max-width: 350px; display: inline-block; - /* float: left; */ - /* display: flex; */ } .container-horizontal:not(:last-child) { @@ -87,7 +83,7 @@ padding: 10px; } -.facets-container .container { +#facets-body { width: 100%; background-color: #F1F1F1; } @@ -120,13 +116,3 @@ color: #FFF; background-color: #545759!important; } - -.facets-container .select-arrow, .facets-container .select-cross { - position: relative; - margin-left: auto; - margin-right: auto; -} - -.facets-container .select-arrow select::-ms-expand, .facets-container .select-cross select::-ms-expand { - display: none; -} From 46286f40b538f1b8c7569468b967562d12910125 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Tue, 15 Jun 2021 10:21:46 +0200 Subject: [PATCH 063/161] Added ability to collapse automatically if screen size is too small --- views/public/facets/browse.php | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/views/public/facets/browse.php b/views/public/facets/browse.php index 81b07c1..8027f5e 100644 --- a/views/public/facets/browse.php +++ b/views/public/facets/browse.php @@ -1,7 +1,7 @@ getTable('Element'); @@ -20,8 +20,8 @@ ?>

"> - -
+ +
" . $description . "

\n"; @@ -89,22 +89,33 @@
From 66e67e8b5a134da9370415f6268b2aeaabc6db8d Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Tue, 15 Jun 2021 10:24:27 +0200 Subject: [PATCH 064/161] Update Readme.md --- Readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Readme.md b/Readme.md index fc4570c..e5e8c89 100644 --- a/Readme.md +++ b/Readme.md @@ -21,7 +21,7 @@ Then install it like any other Omeka plugin. Facets will appear by default in the **Items browse** and **Collections browse** pages, where the `public_items_browse` and `public_collections_browse` hooks are set. It is possible to use instead a custom `public_items_facets` hook, that can be positioned wherever needed (`YOUR_THEME/items/browse.php` or `YOUR_THEME/common/header.php`, f.i.) according to the theme used. -For **Thanks, Roy** theme, for example, best way is to change `common/header.php` code using the custom hook, while unchecking **Block collapsable** option and setting **Vertical** as **Block layout**: +For **Thanks, Roy** theme, for example, best way is to change `common/header.php` code using the custom hook, while unchecking **Block collapsible** option and setting **Vertical** as **Block layout**: ```php $this)); ?> ``` -For **Berlin** theme, instead, check **Block collapsable** option, set **Horizontal** as **Block layout** and then add the custom hook in `items/browse.php` and `collections/browse.php`: +For **Berlin** theme, instead, check **Block collapsible** option, set **Horizontal** as **Block layout** and then add the custom hook in `items/browse.php` and `collections/browse.php`: ```php $this)); ?> From 57841d00a8b2a9daa8491e5e71fbed23e489df1b Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Tue, 15 Jun 2021 10:26:44 +0200 Subject: [PATCH 065/161] Corrected typo --- config_form.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config_form.php b/config_form.php index 91ad045..24a966b 100644 --- a/config_form.php +++ b/config_form.php @@ -60,13 +60,13 @@
- formLabel('facets_collapsable', __('Block collapsable')); ?> + formLabel('facets_collapsible', __('Block collapsible')); ?>

- +

- formCheckbox('facets_collapsable', get_option('facets_collapsable'), null, array('1', '0')); ?> + formCheckbox('facets_collapsible', get_option('facets_collapsible'), null, array('1', '0')); ?>
From fa74ece196bd2f8f7a39047d9d0f053c02e773b6 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Tue, 15 Jun 2021 10:28:03 +0200 Subject: [PATCH 066/161] Update template.pot --- languages/template.pot | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/languages/template.pot b/languages/template.pot index 16dc8da..65b72c6 100644 --- a/languages/template.pot +++ b/languages/template.pot @@ -70,11 +70,11 @@ msgid "If checked, values with just one entry will not be listed (unless there's msgstr "" #: config_form.php:63 -msgid "Block collapsable" +msgid "Block collapsible" msgstr "" #: config_form.php:67 -msgid "If checked, facets block will be collapsable (tip: as it saves space, it's particularly useful with horizontal theme layouts)." +msgid "If checked, facets block will be collapsible (tip: as it saves space, it's particularly useful with horizontal theme layouts)." msgstr "" #: config_form.php:75 @@ -175,4 +175,4 @@ msgstr "" #: config_form.php:269 msgid "If checked, search refinement by Tag will be available (Items only)." -msgstr "" \ No newline at end of file +msgstr "" From 0e6c543410da24e67b9fce57b2661845cca24073 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Tue, 15 Jun 2021 10:28:47 +0200 Subject: [PATCH 067/161] Update it.po --- languages/it.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/languages/it.po b/languages/it.po index 45d124f..c47eb2f 100644 --- a/languages/it.po +++ b/languages/it.po @@ -74,11 +74,11 @@ msgid "If checked, values with just one entry will not be listed (unless there's msgstr "Se selezionata, i valori singoli non verranno elencati (a meno che non ci siano meno di %s valori nella lista)." #: config_form.php:63 -msgid "Block collapsable" +msgid "Block collapsible" msgstr "Blocco contraibile" #: config_form.php:67 -msgid "If checked, facets block will be collapsable (tip: as it saves space, it's particularly useful with horizontal theme layouts)." +msgid "If checked, facets block will be collapsible (tip: as it saves space, it's particularly useful with horizontal theme layouts)." msgstr "" "Se selezionata, il blocco filtri sarà contraibile (consiglio: dal momento che utilizza meno spazio, è particolarmente " "utile con i temi a layout orizzontale)." @@ -181,4 +181,4 @@ msgstr "Etichette" #: config_form.php:269 msgid "If checked, search refinement by Tag will be available (Items only)." -msgstr "Se selezionata, il raffinamento della ricerca per Etichetta sarà disponibile (solo per Documenti)." \ No newline at end of file +msgstr "Se selezionata, il raffinamento della ricerca per Etichetta sarà disponibile (solo per Documenti)." From 8d1ea80c46c42a3fbdf5bbb5eae117dfbe6f2d84 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Tue, 15 Jun 2021 10:29:31 +0200 Subject: [PATCH 068/161] Update eo.po --- languages/eo.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/languages/eo.po b/languages/eo.po index aec4aeb..7215739 100644 --- a/languages/eo.po +++ b/languages/eo.po @@ -70,11 +70,11 @@ msgid "If checked, values with just one entry will not be listed (unless there's msgstr "" #: config_form.php:63 -msgid "Block collapsable" +msgid "Block collapsible" msgstr "" #: config_form.php:67 -msgid "If checked, facets block will be collapsable (tip: as it saves space, it's particularly useful with horizontal theme layouts)." +msgid "If checked, facets block will be collapsible (tip: as it saves space, it's particularly useful with horizontal theme layouts)." msgstr "" #: config_form.php:75 @@ -175,4 +175,4 @@ msgstr "" #: config_form.php:269 msgid "If checked, search refinement by Tag will be available (Items only)." -msgstr "" \ No newline at end of file +msgstr "" From ce0924f65cc0a0e30a12d0a9b58e461a1de8c7d8 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sun, 4 Jul 2021 19:54:26 +0200 Subject: [PATCH 069/161] Added isset() controls to fix possible warnings issue --- FacetsPlugin.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/FacetsPlugin.php b/FacetsPlugin.php index 873ac3f..f204d26 100644 --- a/FacetsPlugin.php +++ b/FacetsPlugin.php @@ -104,7 +104,7 @@ public function hookConfigForm($args) ->order('elements.order'); $elements = $table->fetchObjects($select); - include('config_form.php'); + include 'config_form.php'; } /** @@ -284,10 +284,10 @@ public function showFacets($args) if ($controller == 'items' && $action == 'browse') { $params = array( - 'advanced' => $_GET['advanced'], - 'collection' => $_GET['collection'], - 'type' => $_GET['type'], - 'tags' => $_GET['tags'] + 'advanced' => (isset($_GET['advanced']) ? $_GET['advanced'] : ''), + 'collection' => (isset($_GET['collection']) ? $_GET['collection'] : ''), + 'type' => (isset($_GET['type']) ? $_GET['type'] : ''), + 'tags' => (isset($_GET['tags']) ? $_GET['tags'] : '') ); if (recordTypeActive('item', $settings['elements']) && count(get_records('item', $params, null)) > 0) { @@ -298,7 +298,7 @@ public function showFacets($args) } } elseif ($controller == 'collections' && $action == 'browse') { $params = array( - 'advanced' => $_GET['advanced'] + 'advanced' => (isset($_GET['advanced']) ? $_GET['advanced'] : '') ); if (recordTypeActive('collection', $settings['elements']) && count(get_records('collection', $params, null)) > 0) { echo get_view()->partial('facets/browse.php', array( From 5b3e7fa3ec10ad5f38675ee30d7efa8ec55ca773 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sun, 4 Jul 2021 19:55:15 +0200 Subject: [PATCH 070/161] Added isset() controls to solve possible warnings issue --- views/public/facets/browse.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/views/public/facets/browse.php b/views/public/facets/browse.php index 8027f5e..5663918 100644 --- a/views/public/facets/browse.php +++ b/views/public/facets/browse.php @@ -35,7 +35,7 @@ if (isFacetActive($recordType, $element->name, $facetsElements)) { $isDate = in_array($element->name, array('Date')); $facetElement = $facetsElements['elements'][$element->name]; - if ($html = get_dc_facet_select('collection', $subsetSQL, $element->name, $isDate, $hideSingleEntries, $facetElement['sort'], $facetElement['popularity'])) { + if ($html = get_dc_facet_select('collection', $subsetSQL, $element->name, $isDate, $hideSingleEntries, (isset($facetElement['sort']) ? $facetElement['sort'] : ''), (isset($facetElement['popularity']) ? $facetElement['popularity'] : ''))) { echo "
\n"; echo "\n"; echo $html; @@ -48,7 +48,7 @@ if (isFacetActive($recordType, $element->name, $facetsElements)) { $isDate = in_array($element->name, array('Date')); $facetElement = $facetsElements['elements'][$element->name]; - if ($html = get_dc_facet_select('item', $subsetSQL, $element->name, $isDate, $hideSingleEntries, $facetElement['sort'], $facetElement['popularity'])) { + if ($html = get_dc_facet_select('item', $subsetSQL, $element->name, $isDate, $hideSingleEntries, (isset($facetElement['sort']) ? $facetElement['sort'] : ''), (isset($facetElement['popularity']) ? $facetElement['popularity'] : ''))) { echo "
\n"; echo "\n"; echo $html; From e1faef31fb863c1377c4d3d31a643db5dbe423ab Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sun, 4 Jul 2021 21:19:09 +0200 Subject: [PATCH 071/161] Added isset() check to avoid warnings issue --- helpers/FacetsFunctions.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/helpers/FacetsFunctions.php b/helpers/FacetsFunctions.php index 16d822b..9e99b11 100644 --- a/helpers/FacetsFunctions.php +++ b/helpers/FacetsFunctions.php @@ -431,7 +431,10 @@ function getFieldUrl($filter, $value = null) } function isFacetActive($recordType, $element_name, $settings) { - return ((bool)$settings['elements'][$element_name][$recordType]); + if (isset($settings['elements'][$element_name][$recordType]) { + return ((bool)$settings['elements'][$element_name][$recordType]); + } + return false; } function isNotSingleEntry($count) { From 20ed45f2ae3b0359eea01c9ca2639c92a43efd02 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sun, 4 Jul 2021 21:22:41 +0200 Subject: [PATCH 072/161] Added isset() checks to avoid warnings issues --- helpers/FacetsFunctions.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/helpers/FacetsFunctions.php b/helpers/FacetsFunctions.php index 9e99b11..02b4dca 100644 --- a/helpers/FacetsFunctions.php +++ b/helpers/FacetsFunctions.php @@ -113,8 +113,10 @@ function get_collections_facet_select($subsetSQL, $hideSingleEntries = false, $s } // Stores data for selected collection, if any - if ($collection_id = $_GET['collection']) { - $selectedCollection = $facetCollections[$collection_id]; + if (isset($_GET['collection'])) { + if ($collection_id = $_GET['collection']) { + $selectedCollection = $facetCollections[$collection_id]; + } } // Remove single entries if required @@ -198,8 +200,10 @@ function get_item_types_facet_select($subsetSQL, $hideSingleEntries = false, $so } // Stores data for selected item type, if any - if ($itemType_id = $_GET['type']) { - $selectedItemType = $facetItemTypes[$itemType_id]; + if (isset($_GET['type'])) { + if ($itemType_id = $_GET['type']) { + $selectedItemType = $facetItemTypes[$itemType_id]; + } } // Remove single entries if required From d964977e78e66f3eae9a32d14516cc7965d8afec Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sun, 4 Jul 2021 21:23:43 +0200 Subject: [PATCH 073/161] Update FacetsFunctions.php --- helpers/FacetsFunctions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helpers/FacetsFunctions.php b/helpers/FacetsFunctions.php index 02b4dca..2382947 100644 --- a/helpers/FacetsFunctions.php +++ b/helpers/FacetsFunctions.php @@ -45,7 +45,7 @@ function get_tags_facet_select($subsetSQL, $hideSingleEntries = false, $sortOrde } // Stores data for selected tag, if any - $selectedTagName = $_GET['tags']; + $selectedTagName = (isset($_GET['tags']) ? $_GET['tags'] : ''); // Remove single entries if required if ($hideSingleEntries && count(array_filter($facetTags, 'excludeSingleValues')) > FACETS_MINIMUM_AMOUNT) { From 5695eaf449ed991243eb1e5abd15a659ce39f1c7 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sun, 4 Jul 2021 21:56:39 +0200 Subject: [PATCH 074/161] Closed brackets --- helpers/FacetsFunctions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helpers/FacetsFunctions.php b/helpers/FacetsFunctions.php index 2382947..9d3b4e7 100644 --- a/helpers/FacetsFunctions.php +++ b/helpers/FacetsFunctions.php @@ -435,7 +435,7 @@ function getFieldUrl($filter, $value = null) } function isFacetActive($recordType, $element_name, $settings) { - if (isset($settings['elements'][$element_name][$recordType]) { + if (isset($settings['elements'][$element_name][$recordType])) { return ((bool)$settings['elements'][$element_name][$recordType]); } return false; From 7b6eed633aeead4e33b5ac5230cc252d7efe755f Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Mon, 5 Jul 2021 10:01:01 +0200 Subject: [PATCH 075/161] Update Readme.md --- Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index e5e8c89..0eaf5ad 100644 --- a/Readme.md +++ b/Readme.md @@ -4,7 +4,7 @@ Plugin for Omeka Classic. Once installed and active, allows to insert a Facets block made of option dropdown boxes containing available metadata values extracted from browsing context. Works for both Items and Collections. -Settings allow to choose the hook to be used, which elements use for search refinement, whether to ignore single entries, sorting order for values, whether to show values popolarity, whether to use an horizontal or vertical layout, etc. +Settings allow to choose the hook to be used, which criteria use for search refinement, whether to ignore single entries, sorting order for values, whether to show values popolarity, whether to use an horizontal or vertical layout, etc. ## Credits From eebc7d8844f3b1d2ddb9e9ba90249de50a449230 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Mon, 5 Jul 2021 15:26:12 +0200 Subject: [PATCH 076/161] Update plugin.ini --- plugin.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.ini b/plugin.ini index 4b72021..7eab199 100644 --- a/plugin.ini +++ b/plugin.ini @@ -5,6 +5,6 @@ description="Adds a faceted navigation block to narrow down Items and Collection license="GPLv3" link="" support_link="" -version="2.2" +version="2.3" omeka_minimum_version="2.6.1" omeka_target_version="2.6.1" From fb04250f9d0ba21598a27af8cbef3571cad5c18e Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Mon, 5 Jul 2021 15:26:51 +0200 Subject: [PATCH 077/161] Changed elements table, adding not-DC elements --- config_form.php | 320 ++++++++++++++++++++++++------------------------ 1 file changed, 160 insertions(+), 160 deletions(-) diff --git a/config_form.php b/config_form.php index 24a966b..420d044 100644 --- a/config_form.php +++ b/config_form.php @@ -64,7 +64,7 @@

- +

formCheckbox('facets_collapsible', get_option('facets_collapsible'), null, array('1', '0')); ?>
@@ -93,12 +93,9 @@

-
- formLabel('facets_elements-table', __('Dublin Core')); ?> -
-
+

- +

name); ?> - formSelect( - "item_elements[{$element->set_name}][{$element->name}][active]", - $settings['item_elements'][$element->set_name][$element->name]['active'], - array(), + formCheckbox( + "elements[{$element->name}][item]", + '1', array( - '' => __('Not active'), - 'alpha' => __('Alphabetical sort'), - 'count_alpha' => __('Popularity + alphabetical sort') - )); - ?> + 'disableHidden' => true, + 'checked' => isset($settings['elements'][$element->name]['item']) + ) + ); ?> formCheckbox( - "item_elements[{$element->set_name}][{$element->name}][showPopularity]", + "elements[{$element->name}][collection]", '1', array( 'disableHidden' => true, - 'checked' => isset($settings['item_elements'][$element->set_name][$element->name]['showPopularity']) + 'checked' => isset($settings['elements'][$element->name]['collection']) ) ); ?> formSelect( - "collection_elements[{$element->set_name}][{$element->name}][active]", - $settings['collection_elements'][$element->set_name][$element->name]['active'], + "elements[{$element->name}][sort]", + $settings['elements'][$element->name]['sort'], array(), array( - '' => __('Not active'), - 'alpha' => __('Alphabetical sort'), - 'count_alpha' => __('Popularity + alphabetical sort') + 'alpha' => __('Alphabetical'), + 'count_alpha' => __('Popularity first, then alphabetical') )); ?> formCheckbox( - "collection_elements[{$element->set_name}][{$element->name}][showPopularity]", + "elements[{$element->name}][popularity]", '1', array( 'disableHidden' => true, - 'checked' => isset($settings['collection_elements'][$element->set_name][$element->name]['showPopularity']) + 'checked' => isset($settings['elements'][$element->name]['popularity']) ) ); ?>
@@ -111,9 +108,18 @@ - + set_name != $current_element_set): + $current_element_set = $element->set_name; + ?> + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
name); ?> @@ -127,19 +133,27 @@ ); ?> - formCheckbox( - "elements[{$element->name}][collection]", - '1', - array( - 'disableHidden' => true, - 'checked' => isset($settings['elements'][$element->name]['collection']) - ) - ); ?> + set_name == 'Dublin Core') { + echo $view->formCheckbox( + "elements[{$element->name}][collection]", + '1', + array( + 'disableHidden' => true, + 'checked' => isset($settings['elements'][$element->name]['collection']) + ) + ); + } else { + echo " "; + } + ?> - formSelect( + name]['sort']) ? $settings['elements'][$element->name]['sort'] : ''); + echo $view->formSelect( "elements[{$element->name}][sort]", - $settings['elements'][$element->name]['sort'], + $sortOrder, array(), array( 'alpha' => __('Alphabetical'), @@ -158,148 +172,134 @@ ); ?>
+ +
+ formCheckbox( + "facets_item_types_active", + get_option('facets_item_types_popularity'), + null, + array('1', '0') + ); ?> + +   + + formSelect( + 'facets_item_types_sort', + get_option('facets_item_types_sort'), + array(), + array( + 'alpha' => __('Alphabetical'), + 'count_alpha' => __('Popularity first, then alphabetical') + ) + ); + ?> + + formCheckbox( + 'facets_item_types_popularity', + get_option('facets_item_types_popularity'), + null, + array('1', '0') + ); + ?> +
+ +
+ formCheckbox( + "facets_collections_active", + get_option('facets_collections_popularity'), + null, + array('1', '0') + ); ?> + +   + + formSelect( + 'facets_collections_sort', + get_option('facets_collections_sort'), + array(), + array( + 'alpha' => __('Alphabetical'), + 'count_alpha' => __('Popularity first, then alphabetical') + ) + ); + ?> + + formCheckbox( + 'facets_collections_popularity', + get_option('facets_collections_popularity'), + null, + array('1', '0') + ); + ?> +
+ +
+ formCheckbox( + "facets_tags_active", + get_option('facets_tags_popularity'), + null, + array('1', '0') + ); ?> + +   + + formSelect( + 'facets_tags_sort', + get_option('facets_tags_sort'), + array(), + array( + 'alpha' => __('Alphabetical'), + 'count_alpha' => __('Popularity first, then alphabetical') + ) + ); + ?> + + formCheckbox( + 'facets_tags_popularity', + get_option('facets_tags_popularity'), + null, + array('1', '0') + ); + ?> +
- -

- -
-
- formLabel('facets_item_types_active', __('Active')); ?> -
-
-

- -

- formCheckbox('facets_item_types_active', get_option('facets_item_types_active'), null, array('1', '0')); ?> -
-
- -
-
- formLabel('facets_item_types_sort', __('Sort order')); ?> -
-
-

- -

- formSelect( - 'facets_item_types_sort', - get_option('facets_item_types_sort'), - array(), - array( - 'alpha' => __('Alphabetical'), - 'count_alpha' => __('Popularity first, then alphabetical') - )); - ?> -
-
- -
-
- formLabel('facets_item_types_popularity', __('Show popularity')); ?> -
-
-

- -

- formCheckbox('facets_item_types_popularity', get_option('facets_item_types_popularity'), null, array('1', '0')); ?> -
-
- -

- -
-
- formLabel('facets_collections_active', __('Active')); ?> -
-
-

- -

- formCheckbox('facets_collections_active', get_option('facets_collections_active'), null, array('1', '0')); ?> -
-
- -
-
- formLabel('facets_collections_sort', __('Sort order')); ?> -
-
-

- -

- formSelect( - 'facets_collections_sort', - get_option('facets_collections_sort'), - array(), - array( - 'alpha' => __('Alphabetical'), - 'count_alpha' => __('Popularity first, then alphabetical') - )); - ?> -
-
- -
-
- formLabel('facets_collections_popularity', __('Show popularity')); ?> -
-
-

- -

- formCheckbox('facets_collections_popularity', get_option('facets_collections_popularity'), null, array('1', '0')); ?> -
-
- -

- -
-
- formLabel('facets_tags_active', __('Active')); ?> -
-
-

- -

- formCheckbox('facets_tags_active', get_option('facets_tags_active'), null, array('1', '0')); ?> -
-
- -
-
- formLabel('facets_tags_sort', __('Sort order')); ?> -
-
-

- -

- formSelect( - 'facets_tags_sort', - get_option('facets_tags_sort'), - array(), - array( - 'alpha' => __('Alphabetical'), - 'count_alpha' => __('Popularity first, then alphabetical') - )); - ?> -
-
- -
-
- formLabel('facets_tags_popularity', __('Show popularity')); ?> -
-
-

- -

- formCheckbox('facets_tags_popularity', get_option('facets_tags_popularity'), null, array('1', '0')); ?> -
-
From 6dcf43684274e6b7da92800b39fc54308cbde45a Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Mon, 5 Jul 2021 15:27:59 +0200 Subject: [PATCH 078/161] Added not-DC elements --- FacetsPlugin.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/FacetsPlugin.php b/FacetsPlugin.php index f204d26..ada45fd 100644 --- a/FacetsPlugin.php +++ b/FacetsPlugin.php @@ -6,9 +6,7 @@ * @package FacetsPlugin */ -if (!defined('FACETS_PLUGIN_DIR')) { - define('FACETS_PLUGIN_DIR', dirname(__FILE__)); -} +define('FACETS_PLUGIN_DIR', dirname(__FILE__)); define('FACETS_MINIMUM_AMOUNT', 5); require_once FACETS_PLUGIN_DIR . '/helpers/FacetsFunctions.php'; @@ -98,7 +96,6 @@ public function hookConfigForm($args) $table = get_db()->getTable('Element'); $select = $table->getSelect() - ->where('element_sets.name = \'Dublin Core\'') ->order('elements.element_set_id') ->order('ISNULL(elements.order)') ->order('elements.order'); From 2bd82c60e63b87ab576c6f2b3ab9ac549a7b8515 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Mon, 5 Jul 2021 15:28:53 +0200 Subject: [PATCH 079/161] Update template.pot --- languages/template.pot | 80 +++++++++++++++--------------------------- 1 file changed, 28 insertions(+), 52 deletions(-) diff --git a/languages/template.pot b/languages/template.pot index 65b72c6..132c708 100644 --- a/languages/template.pot +++ b/languages/template.pot @@ -5,10 +5,11 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Reference\n" -"Report-Msgid-Bugs-To: http://github.com/Daniel-KM/Reference/issues\n" -"POT-Creation-Date: 2021-06-08 13:56-0000\n" -"PO-Revision-Date: 2021-06-13 15:39-0000\n" +"Project-Id-Version: Facets\n" +"Report-Msgid-Bugs-To: https://github.com/DBinaghi/plugin-Facets/issues\n" +"POT-Creation-Date: 2021-06-08 13:56-0001\n" +"PO-Revision-Date: 2021-06-13 15:39-0001\n" +"PO-Revision-Date: 2021-07-05 15:17-0001\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -97,82 +98,57 @@ msgstr "" msgid "Elements" msgstr "" -#: config_form.php:101 -msgid "The Dublin Core elements that can be used for search refinement." +#: config_form.php:98 +msgid +"The elements that can be used for search refinement. Item and Collection columns to (de)activate, " +"Sort order column to choose sorting order, Popularity column to show counters near names." msgstr "" -#: config_form.php:106 +#: config_form.php:103 msgid "Element name" msgstr "" -#: config_form.php:107 +#: config_form.php:104 msgid "Item" msgstr "" -#: config_form.php:108 +#: config_form.php:105 msgid "Collection" msgstr "" -#: config_form.php:109 -#: config_form.php:185 -#: config_form.php:231 -#: config_form.php:277 +#: config_form.php:106 msgid "Sort order" msgstr "" -#: config_form.php:110 -#: config_form.php:205 -#: config_form.php:251 -#: config_form.php:297 +#: config_form.php:107 msgid "Popularity" msgstr "" -#: config_form.php:145 -#: config_form.php:196 -#: config_form.php:242 -#: config_form.php:288 +#: config_form.php:159 +#: config_form.php:201 +#: config_form.php:243 +#: config_form.php:285 msgid "Alphabetical" msgstr "" -#: config_form.php:146 -#: config_form.php:197 -#: config_form.php:243 -#: config_form.php:289 +#: config_form.php:160 +#: config_form.php:202 +#: config_form.php:244 +#: config_form.php:286 msgid "Popularity first, then alphabetical" msgstr "" -#: config_form.php:169 +#: config_form.php:178 +#: config_form.php:182 msgid "Item Types" msgstr "" -#: config_form.php:173 -#: config_form.php:219 -#: config_form.php:265 -msgid "Active" -msgstr "" - -#: config_form.php:177 -msgid "If checked, search refinement by Item Type will be available (Items only)." -msgstr "" - -#: config_form.php:209 -#: config_form.php:255 -#: config_form.php:301 -msgid "If checked, values's popularity will be displayed." -msgstr "" - -#: config_form.php:215 +#: config_form.php:220 +#: config_form.php:224 msgid "Collections" msgstr "" -#: config_form.php:223 -msgid "If checked, search refinement by Collection will be available (Items only)." -msgstr "" - -#: config_form.php:261 +#: config_form.php:262 +#: config_form.php:266 msgid "Tags" msgstr "" - -#: config_form.php:269 -msgid "If checked, search refinement by Tag will be available (Items only)." -msgstr "" From 62c853db399c28dd458950714629809afffb2cfe Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Mon, 5 Jul 2021 15:29:23 +0200 Subject: [PATCH 080/161] Updated fi --- languages/eo.mo | Bin 543 -> 574 bytes languages/eo.po | 84 ++++++++++++++++----------------------------- languages/it.mo | Bin 4081 -> 3644 bytes languages/it.po | 89 ++++++++++++++++++------------------------------ 4 files changed, 64 insertions(+), 109 deletions(-) diff --git a/languages/eo.mo b/languages/eo.mo index 85390589f090f8bbb1aace50e4d6355c027100ee..0c30b48f2e59fdf343a504a34035a9fdb8cd7e14 100644 GIT binary patch delta 222 zcmbQwvX5ngjqF5528Lz^1_mJ@7G+{!-~-YcK$;Cmn@^0iV{=PPPAw^(xIkL9*h*hN zJ+maEG)XTxKUd$yDKjrIJtI@UAg44vGfx+)@Q!}HAyEs;7%>V)0JaGU3 delta 187 zcmdnTGM{CFjcgGk14Al2j{&NLR-o zU0;7)7e@sTe=A>4?I?dgS1zB#;u77EqQt!7oWzp+A}a-miKz-snR$un8JP+;i7C06 Wc@9aLCHW<(+4*{zC6n73w*vrv`Z(GE diff --git a/languages/eo.po b/languages/eo.po index 7215739..eeb01cd 100644 --- a/languages/eo.po +++ b/languages/eo.po @@ -5,11 +5,12 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Reference\n" -"Report-Msgid-Bugs-To: http://github.com/Daniel-KM/Reference/issues\n" -"POT-Creation-Date: 2021-06-08 13:56-0000\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: Daniele Binaghi \n" +"Project-Id-Version: Facets\n" +"Report-Msgid-Bugs-To: https://github.com/DBinaghi/plugin-Facets/issues\n" +"POT-Creation-Date: 2021-06-08 13:56-0001\n" +"PO-Revision-Date: 2021-06-13 15:39-0001\n" +"PO-Revision-Date: 2021-07-05 15:17-0001\n" +"Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: eo\n" "MIME-Version: 1.0\n" @@ -97,82 +98,57 @@ msgstr "" msgid "Elements" msgstr "" -#: config_form.php:101 -msgid "The Dublin Core elements that can be used for search refinement." +#: config_form.php:98 +msgid +"The elements that can be used for search refinement. Item and Collection columns to (de)activate, " +"Sort order column to choose sorting order, Popularity column to show counters near names." msgstr "" -#: config_form.php:106 +#: config_form.php:103 msgid "Element name" msgstr "" -#: config_form.php:107 +#: config_form.php:104 msgid "Item" msgstr "" -#: config_form.php:108 +#: config_form.php:105 msgid "Collection" msgstr "" -#: config_form.php:109 -#: config_form.php:185 -#: config_form.php:231 -#: config_form.php:277 +#: config_form.php:106 msgid "Sort order" msgstr "" -#: config_form.php:110 -#: config_form.php:205 -#: config_form.php:251 -#: config_form.php:297 +#: config_form.php:107 msgid "Popularity" msgstr "" -#: config_form.php:145 -#: config_form.php:196 -#: config_form.php:242 -#: config_form.php:288 +#: config_form.php:159 +#: config_form.php:201 +#: config_form.php:243 +#: config_form.php:285 msgid "Alphabetical" msgstr "" -#: config_form.php:146 -#: config_form.php:197 -#: config_form.php:243 -#: config_form.php:289 +#: config_form.php:160 +#: config_form.php:202 +#: config_form.php:244 +#: config_form.php:286 msgid "Popularity first, then alphabetical" msgstr "" -#: config_form.php:169 +#: config_form.php:178 +#: config_form.php:182 msgid "Item Types" msgstr "" -#: config_form.php:173 -#: config_form.php:219 -#: config_form.php:265 -msgid "Active" -msgstr "" - -#: config_form.php:177 -msgid "If checked, search refinement by Item Type will be available (Items only)." -msgstr "" - -#: config_form.php:209 -#: config_form.php:255 -#: config_form.php:301 -msgid "If checked, values's popularity will be displayed." -msgstr "" - -#: config_form.php:215 +#: config_form.php:220 +#: config_form.php:224 msgid "Collections" msgstr "" -#: config_form.php:223 -msgid "If checked, search refinement by Collection will be available (Items only)." -msgstr "" - -#: config_form.php:261 +#: config_form.php:262 +#: config_form.php:266 msgid "Tags" -msgstr "" - -#: config_form.php:269 -msgid "If checked, search refinement by Tag will be available (Items only)." -msgstr "" +msgstr "" \ No newline at end of file diff --git a/languages/it.mo b/languages/it.mo index 08b2f60fffd62bb141f0064332368f8dd5b4d617..e6601e7e1358ae1357a135c9c2640cfdd48c39f0 100644 GIT binary patch delta 992 zcmYk&O=uHA6bJB0nzreeXbOt7#SszPnwsQLiv2)i(?V@hi&4arOg3XOxH}VeCoPJY zi#HEN78NO?C#&8hH!XT79(&ZDR20Qa6+do@;D6E;8aDIWH}huR?EA5AwYT;z7P&?6 z>%+en|47J0glulJ6Y*EXE$}zo1w&y%%zQU&hZJ_e!+|5g`Xr2Eejawi^KcwG@ERdC z@&qq7CI*^N9NvcJz~#V)@Brec&=h6^% zVh73CLhisZ)F;b$xru}gXbKBlw-ss_gIA#`v;@uiy}(D%d~rQke+luBbqssp8#o8Q z!TWHcjSvOjLOdjg!@5zQoWqMb=n~uy7ojP57w(2Da0h$=&Bpb>4R{jq2lyGramZtQ zNDOTnM7)Ya%!R(dS@_)?nzk!tR^VD#%qD5i&xd0n;a?1|VH|8K_~l5!{~LMcuQexY zbVhTBGFhaP%C@_Trm5l46kd|aRC|_rdgzSH zq-Qg&+)+AxHk+k$>D&|@pUS0Yvd7bz%;~9o-d~9>)hF7nhx|Vs7ks~S)4$O*Rx>?O zQgWJ6R@LDWAIrD;bOmkVw1PhL7lk*#wCRwG4xMs~xan4|S@tYmvITcJ6*jfd4(_>k#NC@^o7U2XeLmSVZLLF$dv6?svF+`5T zb~podLZkLPSMv(gH&d=XzX?OgPnOW=gv)RmK7sdPD~^|hD=-JQVYLa%P{9vy3|_!- zv4nU~U+q1p6Fq|6a24tey@T7~C%6>`FsL_8I?&MWg!<}xVFKE487F=Y_o6@FQmx@# z7)SpBB!^8`6u9@%*W+Vei+>IOulz>I;mkHO)aEH+@hrDoY82^FB_+pvWzhv8B{eu@ z1tugjB&U5-F3&ntS+dwaM5a>I%y4s#CkN=JvGi=3DCYR4p{D;SR)VEBjq)>yx2JA? z_?I0On9Osh*P%I;%S&bpxA-$aQaCxuiahDvs#^`m@`e-^PHuZMfssn6{=Kj9EKhNp zTPF9`8+LS$M}Dmy`#h7Q_OJ(6E?FP$y{ZR z)9M0Fj|hvUGlE80GApb}L%7Q2b81Mq-kac!dKXnvl}xDYD@kgz6w1PMSrkojDH*ke z$!(L-9Ji}wx{NAu>M(n4iRvRMOBh0z$x%{$pB7VQUWX7U*Evk(lIumxWdl_FIZ3IO zB_VQ%lokx(>5o|Ie`KsBJmw0#Qf{Bi{w|64y3slC`@wKksJTML^}TRG@hYH43*6Q> bl~s;w;|9EV_;b@n?YTGB6s@#1@AH2Hi+EZ$ diff --git a/languages/it.po b/languages/it.po index c47eb2f..0f41193 100644 --- a/languages/it.po +++ b/languages/it.po @@ -5,11 +5,12 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Reference\n" -"Report-Msgid-Bugs-To: http://github.com/Daniel-KM/Reference/issues\n" -"POT-Creation-Date: 2021-06-08 13:56-0000\n" -"PO-Revision-Date: 2021-06-13 15:39-0000\n" -"Last-Translator: Daniele Binaghi \n" +"Project-Id-Version: Facets\n" +"Report-Msgid-Bugs-To: https://github.com/DBinaghi/plugin-Facets/issues\n" +"POT-Creation-Date: 2021-06-08 13:56-0001\n" +"PO-Revision-Date: 2021-06-13 15:39-0001\n" +"PO-Revision-Date: 2021-07-05 15:17-0001\n" +"Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: it\n" "MIME-Version: 1.0\n" @@ -104,81 +105,59 @@ msgid "Elements" msgstr "Elementi" #: config_form.php:101 -msgid "The Dublin Core elements that can be used for search refinement." -msgstr "Gli elementi Dublin Core che possono essere usati per il raffinamento della ricerca." - -#: config_form.php:106 +msgid +"The elements that can be used for search refinement. Item and Collection columns to (de)activate, " +"Sort order column to choose sorting order, Popularity column to show counters near names." +msgstr +"Gli elementi che possono essere usati per il raffinamento della ricerca. Colonne Documento e Collezione " +"per (dis)attivare, Ordinamento per scegliere il criterio di ordinamento, Popolarità per mostrare i " +"contatori vicino ai nomi." + +#: config_form.php:103 msgid "Element name" msgstr "Nome elemento" -#: config_form.php:107 +#: config_form.php:104 msgid "Item" msgstr "Documento" -#: config_form.php:108 +#: config_form.php:105 msgid "Collection" msgstr "Collezione" -#: config_form.php:109 -#: config_form.php:185 -#: config_form.php:231 -#: config_form.php:277 +#: config_form.php:106 msgid "Ordinamento" msgstr "" -#: config_form.php:110 -#: config_form.php:205 -#: config_form.php:251 -#: config_form.php:297 +#: config_form.php:107 msgid "Popularity" msgstr "Popolarità" -#: config_form.php:145 -#: config_form.php:196 -#: config_form.php:242 -#: config_form.php:288 +#: config_form.php:159 +#: config_form.php:201 +#: config_form.php:243 +#: config_form.php:285 msgid "Alphabetical" msgstr "Alfabetico" -#: config_form.php:146 -#: config_form.php:197 -#: config_form.php:243 -#: config_form.php:289 +#: config_form.php:160 +#: config_form.php:202 +#: config_form.php:244 +#: config_form.php:286 msgid "Popularity first, then alphabetical" msgstr "Popolarità prima, poi alfabetico" -#: config_form.php:169 +#: config_form.php:178 +#: config_form.php:182 msgid "Item Types" msgstr "Tipologie documento" -#: config_form.php:173 -#: config_form.php:219 -#: config_form.php:265 -msgid "Active" -msgstr "Attivo" - -#: config_form.php:177 -msgid "If checked, search refinement by Item Type will be available (Items only)." -msgstr "Se selezionata, il raffinamento della ricerca per Tipologia di Documento sarà disponibile (solo per Documenti)." - -#: config_form.php:209 -#: config_form.php:255 -#: config_form.php:301 -msgid "If checked, values's popularity will be displayed." -msgstr "Se selezionata, la poporità dei valori verrà mostrata." - -#: config_form.php:215 +#: config_form.php:220 +#: config_form.php:224 msgid "Collections" msgstr "Collezioni" -#: config_form.php:223 -msgid "If checked, search refinement by Collection will be available (Items only)." -msgstr "Se selezionata, il raffinamento della ricerca per Collezione sarà disponibile (solo per Documenti)." - -#: config_form.php:261 +#: config_form.php:262 +#: config_form.php:266 msgid "Tags" -msgstr "Etichette" - -#: config_form.php:269 -msgid "If checked, search refinement by Tag will be available (Items only)." -msgstr "Se selezionata, il raffinamento della ricerca per Etichetta sarà disponibile (solo per Documenti)." +msgstr "Etichette" \ No newline at end of file From 7c39d1910be62806e16f0e1ed1865eb31a4cc852 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Tue, 6 Jul 2021 10:13:57 +0200 Subject: [PATCH 081/161] Fixed typos, tidied up indentation --- FacetsPlugin.php | 214 +++++++++++++++++++++++------------------------ 1 file changed, 107 insertions(+), 107 deletions(-) diff --git a/FacetsPlugin.php b/FacetsPlugin.php index ada45fd..da8617c 100644 --- a/FacetsPlugin.php +++ b/FacetsPlugin.php @@ -19,7 +19,7 @@ class FacetsPlugin extends Omeka_Plugin_AbstractPlugin 'initialize', 'config_form', 'config', - 'collections_browse_sql', + 'collections_browse_sql', 'public_head', 'public_items_browse', 'public_collections_browse', @@ -34,7 +34,7 @@ public function hookInstall() set_option('facets_public_hook', 'default'); set_option('facets_description', ''); set_option('facets_hide_single_entries', 0); - set_option('facets_collapsable', 0); + set_option('facets_collapsible', 0); set_option('facets_direction', 'vertical'); $defaults = array( @@ -60,7 +60,7 @@ public function hookUninstall() delete_option('facets_public_hook'); delete_option('facets_description'); delete_option('facets_hide_single_entries'); - delete_option('facets_collapsable'); + delete_option('facets_collapsible'); delete_option('facets_direction'); delete_option('facets_elements'); delete_option('facets_item_types_active'); @@ -79,7 +79,7 @@ public function hookUninstall() */ public function hookInitialize() { - add_translation_source(dirname(__FILE__) . '/languages'); + add_translation_source(dirname(__FILE__) . '/languages'); get_view()->addHelperPath(dirname(__FILE__) . '/views/helpers', 'Facets_View_Helper_'); @@ -114,7 +114,7 @@ public function hookConfig($args) set_option('facets_public_hook', $post['facets_public_hook']); set_option('facets_description', $post['facets_description']); set_option('facets_hide_single_entries', $post['facets_hide_single_entries']); - set_option('facets_collapsable', $post['facets_collapsable']); + set_option('facets_collapsible', $post['facets_collapsible']); set_option('facets_direction', $post['facets_direction']); $settings = array( @@ -133,117 +133,117 @@ public function hookConfig($args) set_option('facets_tags_popularity', $post['facets_tags_popularity']); } - /** - * Hook into collections_browse_sql - * - * @select array $args - * @params array $args - */ - public function hookCollectionsBrowseSql($args) - { - $db = $this->_db; - $select = $args['select']; - $params = $args['params']; + /** + * Hook into collections_browse_sql + * + * @select array $args + * @params array $args + */ + public function hookCollectionsBrowseSql($args) + { + $db = $this->_db; + $select = $args['select']; + $params = $args['params']; // if (array_key_exists('_advanced_0', $select->getPart('from')) return; if (strpos($select, '_advanced_') !== false) return; - - if ($advancedTerms = @$params['advanced']) { - $where = ''; - $advancedIndex = 0; - foreach ($advancedTerms as $v) { - // Do not search on blank rows. - if (empty($v['element_id']) || empty($v['type'])) { - continue; - } - - $value = isset($v['terms']) ? $v['terms'] : null; - $type = $v['type']; - $elementId = (int) $v['element_id']; - $alias = "_advanced_{$advancedIndex}"; - - $joiner = isset($v['joiner']) && $advancedIndex > 0 ? $v['joiner'] : null; - - $negate = false; - // Determine what the WHERE clause should look like. - switch ($type) { - case 'does not contain': - $negate = true; - case 'contains': - $predicate = "LIKE " . $db->quote('%'.$value .'%'); - break; - - case 'is not exactly': - $negate = true; - case 'is exactly': - $predicate = ' = ' . $db->quote($value); - break; - - case 'is empty': - $negate = true; - case 'is not empty': - $predicate = 'IS NOT NULL'; - break; - - case 'starts with': - $predicate = "LIKE " . $db->quote($value.'%'); - break; - - case 'ends with': - $predicate = "LIKE " . $db->quote('%'.$value); - break; - - case 'does not match': - $negate = true; - case 'matches': - if (!strlen($value)) { - continue 2; - } - $predicate = 'REGEXP ' . $db->quote($value); - break; - - default: - throw new Omeka_Record_Exception(__('Invalid search type given!')); - } - - $predicateClause = "{$alias}.text {$predicate}"; - - // Note that $elementId was earlier forced to int, so manual quoting - // is unnecessary here - $joinCondition = "{$alias}.record_id = collections.id AND {$alias}.record_type = 'Collection' AND {$alias}.element_id = $elementId"; - - if ($negate) { - $joinCondition .= " AND {$predicateClause}"; - $whereClause = "{$alias}.text IS NULL"; - } else { - $whereClause = $predicateClause; - } - - $select->joinLeft(array($alias => $db->ElementText), $joinCondition, array()); - if ($where == '') { - $where = $whereClause; - } elseif ($joiner == 'or') { - $where .= " OR $whereClause"; - } else { - $where .= " AND $whereClause"; - } - - $advancedIndex++; - } - - if ($where) { - $select->where($where); - } - } - } + + if ($advancedTerms = @$params['advanced']) { + $where = ''; + $advancedIndex = 0; + foreach ($advancedTerms as $v) { + // Do not search on blank rows. + if (empty($v['element_id']) || empty($v['type'])) { + continue; + } + + $value = isset($v['terms']) ? $v['terms'] : null; + $type = $v['type']; + $elementId = (int) $v['element_id']; + $alias = "_advanced_{$advancedIndex}"; + + $joiner = isset($v['joiner']) && $advancedIndex > 0 ? $v['joiner'] : null; + + $negate = false; + // Determine what the WHERE clause should look like. + switch ($type) { + case 'does not contain': + $negate = true; + case 'contains': + $predicate = "LIKE " . $db->quote('%'.$value .'%'); + break; + + case 'is not exactly': + $negate = true; + case 'is exactly': + $predicate = ' = ' . $db->quote($value); + break; + + case 'is empty': + $negate = true; + case 'is not empty': + $predicate = 'IS NOT NULL'; + break; + + case 'starts with': + $predicate = "LIKE " . $db->quote($value.'%'); + break; + + case 'ends with': + $predicate = "LIKE " . $db->quote('%'.$value); + break; + + case 'does not match': + $negate = true; + case 'matches': + if (!strlen($value)) { + continue 2; + } + $predicate = 'REGEXP ' . $db->quote($value); + break; + + default: + throw new Omeka_Record_Exception(__('Invalid search type given!')); + } + + $predicateClause = "{$alias}.text {$predicate}"; + + // Note that $elementId was earlier forced to int, so manual quoting + // is unnecessary here + $joinCondition = "{$alias}.record_id = collections.id AND {$alias}.record_type = 'Collection' AND {$alias}.element_id = $elementId"; + + if ($negate) { + $joinCondition .= " AND {$predicateClause}"; + $whereClause = "{$alias}.text IS NULL"; + } else { + $whereClause = $predicateClause; + } + + $select->joinLeft(array($alias => $db->ElementText), $joinCondition, array()); + if ($where == '') { + $where = $whereClause; + } elseif ($joiner == 'or') { + $where .= " OR $whereClause"; + } else { + $where .= " AND $whereClause"; + } + + $advancedIndex++; + } + + if ($where) { + $select->where($where); + } + } + } public function hookPublicHead($args) { $request = Zend_Controller_Front::getInstance()->getRequest(); $controller = $request->getControllerName(); $action = $request->getActionName(); - + if (($action == 'browse' && ($controller == 'items' || $controller == 'collections')) || ($controller == 'search' && $action == 'index')) { queue_css_file('facets'); } @@ -278,7 +278,7 @@ public function showFacets($args) $request = Zend_Controller_Front::getInstance()->getRequest(); $controller = $request->getControllerName(); $action = $request->getActionName(); - + if ($controller == 'items' && $action == 'browse') { $params = array( 'advanced' => (isset($_GET['advanced']) ? $_GET['advanced'] : ''), From 782a9f961fff1f018b7db7bc26c98f04af3e7f08 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Tue, 6 Jul 2021 10:40:36 +0200 Subject: [PATCH 082/161] Changed header string --- views/public/facets/browse.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/public/facets/browse.php b/views/public/facets/browse.php index 5663918..45c24d9 100644 --- a/views/public/facets/browse.php +++ b/views/public/facets/browse.php @@ -20,7 +20,7 @@ ?>
"> - +
Date: Tue, 6 Jul 2021 10:41:16 +0200 Subject: [PATCH 083/161] Changed string --- languages/template.pot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/languages/template.pot b/languages/template.pot index 132c708..20b8436 100644 --- a/languages/template.pot +++ b/languages/template.pot @@ -18,7 +18,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" #: browse.php:23 -msgid "Refine search by" +msgid "Refine search" msgstr "" #: FacetsFunctions.php:59 From 0fc4143a37bb7e9d0b022bb7e9bfc45c739dad3b Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Tue, 6 Jul 2021 10:41:34 +0200 Subject: [PATCH 084/161] Changed string --- languages/it.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/languages/it.po b/languages/it.po index 0f41193..88ef543 100644 --- a/languages/it.po +++ b/languages/it.po @@ -18,8 +18,8 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" #: browse.php:23 -msgid "Refine search by" -msgstr "Raffina la ricerca per" +msgid "Refine search" +msgstr "Raffina la ricerca" #: FacetsFunctions.php:59 #: FacetsFunctions.php:135 @@ -160,4 +160,4 @@ msgstr "Collezioni" #: config_form.php:262 #: config_form.php:266 msgid "Tags" -msgstr "Etichette" \ No newline at end of file +msgstr "Etichette" From 1d61b847ec7dee2fee6cea2887f4b1291ddeef01 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Tue, 6 Jul 2021 10:41:57 +0200 Subject: [PATCH 085/161] Changed string --- languages/eo.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/languages/eo.po b/languages/eo.po index eeb01cd..3f3838b 100644 --- a/languages/eo.po +++ b/languages/eo.po @@ -18,8 +18,8 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" #: browse.php:22 -msgid "Refine search by" -msgstr "Rafini serĉon per" +msgid "Refine search" +msgstr "Rafini serĉon" #: FacetsFunctions.php:59 #: FacetsFunctions.php:135 @@ -151,4 +151,4 @@ msgstr "" #: config_form.php:262 #: config_form.php:266 msgid "Tags" -msgstr "" \ No newline at end of file +msgstr "" From d4206e7959320f65dd4533974a23e653c43484e6 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Tue, 6 Jul 2021 10:46:11 +0200 Subject: [PATCH 086/161] Updated files --- languages/eo.mo | Bin 574 -> 567 bytes languages/it.mo | Bin 3644 -> 3637 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/languages/eo.mo b/languages/eo.mo index 0c30b48f2e59fdf343a504a34035a9fdb8cd7e14..89935c25f2ec71e563f07175cb789d904569985d 100644 GIT binary patch delta 105 zcmdnTvYlmuiW@Hj14AqjgXnA^W&`3%AfCv`z|a7s`G8o62|_CZX^^}DkY)%C^J1%AuThfq$od+!8Io}yQGu>02}BOIRF3v delta 93 zcmdnavX5ngil+br14Aqj^8#@m5VHYs4G>RcWMF6p(n3Hi%EZ9H2c$KCG)UeYNHYYb gre)@(Dio(C7A0pWBvo$A+Q!JDP>@Dof4f}Jvn&>?gweE{kAYT>xg{r~sB|J|jvq&8edCz5uyWc)@K_gF-S=?r~bV~AH4 zHICFIzM+^>jj@YU9I^j_KJm3D9bq3UI6!mHJ(~TQr|567AQ6yw{4Yq6p*N-~Ztw!X zaE_glbc-1>6w>V!FVXbrVIA+#TsT4VfCnt&6Pj}`e*3U^ClQj!@Dm$!S@M(MSZWa` YbTJRw;yLDVZn=f{$9{F=XFsxk0bOS(-T(jq delta 342 zcmXZXu}eZx6vy%3>*@3P(g=lI9CS?D8zkHlTiulg2{A+vL3n>cHi<+umh)4WL`NrA zof;BCS}gD%=zA+T+|NDd-h1x7MX-el?4r5n4$bgq92`T;Ub&@Ch%X zQUl+RP>F6yETidjgIR2&xp06d_>4z5LvwEFo&QbN6fP;e;|HG6WyntwF)2qrrHgsc c7K`{Dd|J+dovCz!FMHvHGPl>wVB-1q5A9Ma+W-In From cf6e5932fa113e68422ef2b8c64a0ec9eb7e8655 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Wed, 7 Jul 2021 10:26:24 +0200 Subject: [PATCH 087/161] Corrected bug --- helpers/FacetsFunctions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helpers/FacetsFunctions.php b/helpers/FacetsFunctions.php index 9d3b4e7..34111fc 100644 --- a/helpers/FacetsFunctions.php +++ b/helpers/FacetsFunctions.php @@ -302,7 +302,7 @@ function get_dc_facet_select($recordType, $subsetSQL, $dcElementName = 'Title', $facet = array(); foreach ($elements as $element) { if ($isDate) { - $facet[$element->year] = $facet[$element->year] + $element->count; + $facet[$element->year] = $element->count; } else { $facet[$element->text] = $element->count; } From 69a131ed7d46856f33d84d5cc9b079122ad24f4b Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Wed, 7 Jul 2021 10:27:18 +0200 Subject: [PATCH 088/161] Update plugin.ini --- plugin.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.ini b/plugin.ini index 7eab199..c3c07ac 100644 --- a/plugin.ini +++ b/plugin.ini @@ -5,6 +5,6 @@ description="Adds a faceted navigation block to narrow down Items and Collection license="GPLv3" link="" support_link="" -version="2.3" +version="2.4" omeka_minimum_version="2.6.1" omeka_target_version="2.6.1" From 60477e8b9e38552ac0664db130dacf5374b0543b Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Thu, 8 Jul 2021 09:24:47 +0200 Subject: [PATCH 089/161] Update plugin.ini --- plugin.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin.ini b/plugin.ini index c3c07ac..fee0875 100644 --- a/plugin.ini +++ b/plugin.ini @@ -3,8 +3,8 @@ name = "Facets" author = "Jean-Baptiste Heren and Daniele Binaghi" description="Adds a faceted navigation block to narrow down Items and Collections search results by applying multiple filters" license="GPLv3" -link="" -support_link="" +link="https://github.com/DBinaghi/plugin-Facets" +support_link="https://github.com/DBinaghi/plugin-Facets/issues" version="2.4" omeka_minimum_version="2.6.1" omeka_target_version="2.6.1" From df27bb9ff1686d1c140c000e362c01254af8cd8b Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Fri, 9 Jul 2021 23:43:47 +0200 Subject: [PATCH 090/161] Modified get_facet_select() function --- helpers/FacetsFunctions.php | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/helpers/FacetsFunctions.php b/helpers/FacetsFunctions.php index 34111fc..15c4a58 100644 --- a/helpers/FacetsFunctions.php +++ b/helpers/FacetsFunctions.php @@ -241,14 +241,14 @@ function get_item_types_facet_select($subsetSQL, $hideSingleEntries = false, $so * Return HTML Select associated with Array of facets values. * * @param itemsArray - * @param dcElementName + * @param elementId * @param isDate * @param hideSingleEntries * @param sortOrder * @param showPopularity - * @return html. + * @return html */ - function get_dc_facet_select($recordType, $subsetSQL, $dcElementName = 'Title', $isDate = false, $hideSingleEntries = false, $sortOrder = 'count_alpha', $showPopularity = false) { + function get_facet_select($recordType, $subsetSQL, $elementId = 50, $isDate = false, $hideSingleEntries = false, $sortOrder = 'count_alpha', $showPopularity = false) { // Create Where clauses $whereRecordType = createWhereRecordTypeClause($recordType); $whereSubset = createWhereSubsetClause($recordType, $subsetSQL); @@ -279,19 +279,15 @@ function get_dc_facet_select($recordType, $subsetSQL, $dcElementName = 'Title', // Build the select query. $select = $table->getSelect(); $select->columns($columns); - $select->joinInner(array('elements' => $db->Elements), - 'element_texts.element_id = elements.id', array()); - $select->joinInner(array('element_sets' => $db->ElementSet), - 'element_sets.id = elements.element_set_id', array()); + $select->joinInner(array('elements' => $db->Elements), 'element_texts.element_id = elements.id', array()); + $select->joinInner(array('element_sets' => $db->ElementSet), 'element_sets.id = elements.element_set_id', array()); if ($recordType == 'item') { - $select->joinInner(array('items' => $db->Item), - 'items.id = element_texts.record_id', array()); + $select->joinInner(array('items' => $db->Item), 'items.id = element_texts.record_id', array()); } else { - $select->joinInner(array('collections' => $db->Collection), - 'collections.id = element_texts.record_id', array()); + $select->joinInner(array('collections' => $db->Collection), 'collections.id = element_texts.record_id', array()); } - $select->where('element_sets.name = '. $db->quote('Dublin Core')); - $select->where('elements.name = '. $db->quote($dcElementName)); + // $select->where('element_sets.name = '. $db->quote('Dublin Core')); + $select->where('elements.id = '. $elementId); $select->where($whereRecordType); $select->where($whereSubset); $select->group($groupBy); From 24b5efdb67cd7dba3a4f77239ead8e1991798152 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Fri, 9 Jul 2021 23:45:00 +0200 Subject: [PATCH 091/161] Removes Dublin Core element set limit --- views/public/facets/browse.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/views/public/facets/browse.php b/views/public/facets/browse.php index 45c24d9..023b9e3 100644 --- a/views/public/facets/browse.php +++ b/views/public/facets/browse.php @@ -6,7 +6,6 @@ $table = get_db()->getTable('Element'); $select = $table->getSelect() - ->where('element_sets.name = \'Dublin Core\'') ->order('elements.element_set_id') ->order('ISNULL(elements.order)') ->order('elements.order'); @@ -35,7 +34,7 @@ if (isFacetActive($recordType, $element->name, $facetsElements)) { $isDate = in_array($element->name, array('Date')); $facetElement = $facetsElements['elements'][$element->name]; - if ($html = get_dc_facet_select('collection', $subsetSQL, $element->name, $isDate, $hideSingleEntries, (isset($facetElement['sort']) ? $facetElement['sort'] : ''), (isset($facetElement['popularity']) ? $facetElement['popularity'] : ''))) { + if ($html = get_facet_select('collection', $subsetSQL, $element->id, $isDate, $hideSingleEntries, (isset($facetElement['sort']) ? $facetElement['sort'] : ''), (isset($facetElement['popularity']) ? $facetElement['popularity'] : ''))) { echo "
\n"; echo "\n"; echo $html; @@ -48,7 +47,7 @@ if (isFacetActive($recordType, $element->name, $facetsElements)) { $isDate = in_array($element->name, array('Date')); $facetElement = $facetsElements['elements'][$element->name]; - if ($html = get_dc_facet_select('item', $subsetSQL, $element->name, $isDate, $hideSingleEntries, (isset($facetElement['sort']) ? $facetElement['sort'] : ''), (isset($facetElement['popularity']) ? $facetElement['popularity'] : ''))) { + if ($html = get_facet_select('item', $subsetSQL, $element->id, $isDate, $hideSingleEntries, (isset($facetElement['sort']) ? $facetElement['sort'] : ''), (isset($facetElement['popularity']) ? $facetElement['popularity'] : ''))) { echo "
\n"; echo "\n"; echo $html; From be8e02fca9caf25fee26a3dcbac84b6548b868c2 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sat, 10 Jul 2021 01:52:51 +0200 Subject: [PATCH 092/161] Corrected name of variable --- helpers/FacetsFunctions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helpers/FacetsFunctions.php b/helpers/FacetsFunctions.php index 15c4a58..0143c64 100644 --- a/helpers/FacetsFunctions.php +++ b/helpers/FacetsFunctions.php @@ -324,12 +324,12 @@ function get_facet_select($recordType, $subsetSQL, $elementId = 50, $isDate = fa $addOptions = false; // Build first part of the select tag if (isset($term)){ - $html = "
"; $url = getElementFieldUrl($element_id, null, $isDate); $html .= ""; $html .= ""; } elseif (count($facet) > 0) { - $html = "
"; $html .= ""; $addOptions = true; } From 13f4b5c7148c4d2baf2ba89c5ae4529dc02c5ab7 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sat, 10 Jul 2021 09:51:29 +0200 Subject: [PATCH 093/161] Added extra check for Collection and ItemType id existence --- helpers/FacetsFunctions.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/helpers/FacetsFunctions.php b/helpers/FacetsFunctions.php index 0143c64..ade6b58 100644 --- a/helpers/FacetsFunctions.php +++ b/helpers/FacetsFunctions.php @@ -114,7 +114,7 @@ function get_collections_facet_select($subsetSQL, $hideSingleEntries = false, $s // Stores data for selected collection, if any if (isset($_GET['collection'])) { - if ($collection_id = $_GET['collection']) { + if ($collection_id = $_GET['collection'] && array_key_exists($collection_id, $facetCollections)) { $selectedCollection = $facetCollections[$collection_id]; } } @@ -201,7 +201,7 @@ function get_item_types_facet_select($subsetSQL, $hideSingleEntries = false, $so // Stores data for selected item type, if any if (isset($_GET['type'])) { - if ($itemType_id = $_GET['type']) { + if ($itemType_id = $_GET['type'] && array_key_exists($itemType_id, $facetItemTypes)) { $selectedItemType = $facetItemTypes[$itemType_id]; } } @@ -286,7 +286,6 @@ function get_facet_select($recordType, $subsetSQL, $elementId = 50, $isDate = fa } else { $select->joinInner(array('collections' => $db->Collection), 'collections.id = element_texts.record_id', array()); } - // $select->where('element_sets.name = '. $db->quote('Dublin Core')); $select->where('elements.id = '. $elementId); $select->where($whereRecordType); $select->where($whereSubset); From cab0ad541b5c7df1b23305d158d1fd9371ba93ef Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sat, 10 Jul 2021 10:00:08 +0200 Subject: [PATCH 094/161] Removed dropdown arrows hiding --- views/public/css/facets.css | 3 --- 1 file changed, 3 deletions(-) diff --git a/views/public/css/facets.css b/views/public/css/facets.css index fcbe7a9..2a8cec5 100644 --- a/views/public/css/facets.css +++ b/views/public/css/facets.css @@ -104,9 +104,6 @@ .facets-container form select { width: 100%; border: 0; - appearance: none !important; - -webkit-appearance: none !important; - -moz-appearance: none !important; background-color: #FFF; text-align: left; font-size: 80%; From 3d08bc51656e68f3ea0df9434c9a3a4512271cd4 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sat, 10 Jul 2021 10:02:03 +0200 Subject: [PATCH 095/161] Update Readme.md --- Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index 0eaf5ad..40d0611 100644 --- a/Readme.md +++ b/Readme.md @@ -47,7 +47,7 @@ Similarly, one can choose to also include **Item Types**, **Collections** and ** **Single values** can be exluded as not really significant, although they will be listed anyway if less than 5 values are available. -Facets block can be set up for **vertical** or **horizontal** layout, according to the theme layout; and it can be made **collapsable**, to use less vertical space (recommended for horizontal layout). +Facets block can be set up for **vertical** or **horizontal** layout, according to the theme layout; and it can be made **collapsible**, to use less vertical space (recommended for horizontal layout). Sorting order can be **alphabetical**, or **first by popularity and then alphabetical**. Popularity count can be shown, if needed. From 60e899d117feaab5603653ab412887d37f0132ff Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sat, 10 Jul 2021 10:02:59 +0200 Subject: [PATCH 096/161] Update Readme.md --- Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index 40d0611..886ea6a 100644 --- a/Readme.md +++ b/Readme.md @@ -54,4 +54,4 @@ Sorting order can be **alphabetical**, or **first by popularity and then alphabe **Date** element filter's behaviour is a bit different: dates are ordered decrescently, and only year is displayed; consequently, the matching will be with the beginning of the date (assuming the format is 'yyyy-mm-dd'). ## Licence -MIT Licence, please credit AR2L [AR2L Hauts de France](http://www.ar2l-hdf.fr/) and Daniele Binaghi. +MIT Licence, please credit AR2L [AR2L Hauts de France](http://www.ar2l-hdf.fr/) and [Daniele Binaghi](https://github.com/DBinaghi). From 521c14912190e688680b7f43f5203c03dcf0beb6 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sun, 11 Jul 2021 09:43:46 +0200 Subject: [PATCH 097/161] Corrected check in functions --- helpers/FacetsFunctions.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/helpers/FacetsFunctions.php b/helpers/FacetsFunctions.php index ade6b58..4a715f5 100644 --- a/helpers/FacetsFunctions.php +++ b/helpers/FacetsFunctions.php @@ -114,8 +114,10 @@ function get_collections_facet_select($subsetSQL, $hideSingleEntries = false, $s // Stores data for selected collection, if any if (isset($_GET['collection'])) { - if ($collection_id = $_GET['collection'] && array_key_exists($collection_id, $facetCollections)) { - $selectedCollection = $facetCollections[$collection_id]; + if ($collection_id = $_GET['collection']) { + if (array_key_exists($collection_id, $facetCollections)) { + $selectedCollection = $facetCollections[$collection_id]; + } } } @@ -201,8 +203,10 @@ function get_item_types_facet_select($subsetSQL, $hideSingleEntries = false, $so // Stores data for selected item type, if any if (isset($_GET['type'])) { - if ($itemType_id = $_GET['type'] && array_key_exists($itemType_id, $facetItemTypes)) { - $selectedItemType = $facetItemTypes[$itemType_id]; + if ($itemType_id = $_GET['type']) { + if (array_key_exists($itemType_id, $facetItemTypes)) { + $selectedItemType = $facetItemTypes[$itemType_id]; + } } } From c052abfec1eb140d1a2cfe38c9d2dce90fd4bf1c Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Fri, 16 Jul 2021 10:43:28 +0200 Subject: [PATCH 098/161] Update FacetsFunctions.php --- helpers/FacetsFunctions.php | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/helpers/FacetsFunctions.php b/helpers/FacetsFunctions.php index 4a715f5..24132ed 100644 --- a/helpers/FacetsFunctions.php +++ b/helpers/FacetsFunctions.php @@ -98,8 +98,7 @@ function get_collections_facet_select($subsetSQL, $hideSingleEntries = false, $s // Build the select query. $select = $table->getSelect() ->columns('COUNT(collections.id) AS count') - ->joinInner(array('items' => $db->Items), - 'collections.id = items.collection_id', array()) + ->joinInner(array('items' => $db->Items), 'collections.id = items.collection_id', array()) ->where($whereSubset) ->group('collections.id'); @@ -115,9 +114,9 @@ function get_collections_facet_select($subsetSQL, $hideSingleEntries = false, $s // Stores data for selected collection, if any if (isset($_GET['collection'])) { if ($collection_id = $_GET['collection']) { - if (array_key_exists($collection_id, $facetCollections)) { - $selectedCollection = $facetCollections[$collection_id]; - } + if (array_key_exists($collection_id, $facetCollections)) { + $selectedCollection = $facetCollections[$collection_id]; + } } } @@ -186,8 +185,7 @@ function get_item_types_facet_select($subsetSQL, $hideSingleEntries = false, $so // Build the select query. $select = $table->getSelect() ->columns('COUNT(item_types.id) AS count') - ->joinInner(array('items' => $db->Items), - 'item_types.id = items.item_type_id', array()) + ->joinInner(array('items' => $db->Items), 'item_types.id = items.item_type_id', array()) ->where($whereSubset) ->group('item_types.id') ->order($orderBy); @@ -204,9 +202,9 @@ function get_item_types_facet_select($subsetSQL, $hideSingleEntries = false, $so // Stores data for selected item type, if any if (isset($_GET['type'])) { if ($itemType_id = $_GET['type']) { - if (array_key_exists($itemType_id, $facetItemTypes)) { - $selectedItemType = $facetItemTypes[$itemType_id]; - } + if (array_key_exists($itemType_id, $facetItemTypes)) { + $selectedItemType = $facetItemTypes[$itemType_id]; + } } } From 7429568d504b20bf21e27fec098eaabc9fe5bcc7 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Fri, 16 Jul 2021 13:33:31 +0200 Subject: [PATCH 099/161] Update Readme.md --- Readme.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Readme.md b/Readme.md index 886ea6a..43f40e2 100644 --- a/Readme.md +++ b/Readme.md @@ -19,7 +19,7 @@ Then install it like any other Omeka plugin. ## (optional) Theme customization -Facets will appear by default in the **Items browse** and **Collections browse** pages, where the `public_items_browse` and `public_collections_browse` hooks are set. It is possible to use instead a custom `public_items_facets` hook, that can be positioned wherever needed (`YOUR_THEME/items/browse.php` or `YOUR_THEME/common/header.php`, f.i.) according to the theme used. +Facets will appear by default in the **Items browse** and **Collections browse** pages, where the `public_items_browse` and `public_collections_browse` hooks are set. It is possible to use instead a custom `public_items_facets` hook, that can be positioned wherever needed (`YOUR_THEME/items/browse.php` or `YOUR_THEME/common/header.php`, f.i.) according to the theme used; in such a case, the use of [get_specific_plugin_hook_output](http://omeka.readthedocs.io/en/latest/Reference/libraries/globals/get_specific_plugin_hook_output.html) function is suggested. For **Thanks, Roy** theme, for example, best way is to change `common/header.php` code using the custom hook, while unchecking **Block collapsible** option and setting **Vertical** as **Block layout**: ```php @@ -30,12 +30,12 @@ For **Thanks, Roy** theme, for example, best way is to change `common/header.php
- $this)); ?> + $this)); ?> ``` For **Berlin** theme, instead, check **Block collapsible** option, set **Horizontal** as **Block layout** and then add the custom hook in `items/browse.php` and `collections/browse.php`: ```php - $this)); ?> + $this)); ?> ``` From 0e26cdfa189e18b30f8f9d22ab53d65afbdac324 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Fri, 16 Jul 2021 14:00:56 +0200 Subject: [PATCH 100/161] Added echo --- Readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Readme.md b/Readme.md index 43f40e2..3745008 100644 --- a/Readme.md +++ b/Readme.md @@ -30,12 +30,12 @@ For **Thanks, Roy** theme, for example, best way is to change `common/header.php
- $this)); ?> + $this)); ?> ``` For **Berlin** theme, instead, check **Block collapsible** option, set **Horizontal** as **Block layout** and then add the custom hook in `items/browse.php` and `collections/browse.php`: ```php - $this)); ?> + $this)); ?> ``` From 35e495bfe99834fcbf224469c19a02774113bc91 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sat, 17 Jul 2021 18:16:55 +0200 Subject: [PATCH 101/161] Added style and Minimum checkbox count options --- config_form.php | 81 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 73 insertions(+), 8 deletions(-) diff --git a/config_form.php b/config_form.php index 420d044..0521a0e 100644 --- a/config_form.php +++ b/config_form.php @@ -60,13 +60,13 @@
- formLabel('facets_collapsible', __('Block collapsible')); ?> + formLabel('facets_checkbox_minimum_amount', __('Minimum checkbox count')); ?>

- +

- formCheckbox('facets_collapsible', get_option('facets_collapsible'), null, array('1', '0')); ?> + formText('facets_checkbox_minimum_amount', get_option('facets_checkbox_minimum_amount')); ?>
@@ -90,12 +90,24 @@
+
+
+ formLabel('facets_collapsible', __('Block collapsible')); ?> +
+
+

+ +

+ formCheckbox('facets_collapsible', get_option('facets_collapsible'), null, array('1', '0')); ?> +
+
+

- +

@@ -103,6 +115,7 @@ + @@ -115,7 +128,7 @@ $current_element_set = $element->set_name; ?> - @@ -148,6 +161,19 @@ } ?> + - @@ -191,6 +217,19 @@ + - @@ -233,6 +272,19 @@ + - @@ -275,6 +327,19 @@ + @@ -207,12 +211,14 @@ @@ -260,11 +260,6 @@ ?> - - - - - - + array('label' => 'Item Types', 'collection' => 0), + 'collections' => array('label' => 'Collections', 'collection' => 0), + 'tags' => array('label' => 'Tags', 'collection' => 0), + 'users' => array('label' => 'Owners', 'collection' => 1), + 'public' => array('label' => 'Public', 'collection' => 1), + 'featured' => array('label' => 'Featured', 'collection' => 1) + ); + foreach ($extraParameters as $key => $value): + ?> - + - - - - - - - - - - - - - - - - +
+
+ name]['type']) ? $settings['elements'][$element->name]['type'] : ''); + echo $view->formSelect( + "elements[{$element->name}][type]", + $type, + array(), + array( + 'dropdown' => __('Dropdown'), + 'checkbox' => __('Checkbox') + )); + ?> + name]['sort']) ? $settings['elements'][$element->name]['sort'] : ''); @@ -174,7 +200,7 @@
+
  + formSelect( + "facets_item_types_style", + $type, + array(), + array( + 'dropdown' => __('Dropdown'), + 'checkbox' => __('Checkbox') + )); + ?> + formSelect( @@ -216,7 +255,7 @@
+
  + formSelect( + "facets_collections_style", + $type, + array(), + array( + 'dropdown' => __('Dropdown'), + 'checkbox' => __('Checkbox') + )); + ?> + formSelect( @@ -258,7 +310,7 @@
+
  + formSelect( + "facets_tags_style", + $type, + array(), + array( + 'dropdown' => __('Dropdown'), + 'checkbox' => __('Checkbox') + )); + ?> + formSelect( From dca686c6c3896e07b519bb3e0897806cdaa9780a Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sat, 17 Jul 2021 18:17:45 +0200 Subject: [PATCH 102/161] Added checkbox support --- views/public/css/facets.css | 59 ++++++++++++++++++++++++++----------- 1 file changed, 41 insertions(+), 18 deletions(-) diff --git a/views/public/css/facets.css b/views/public/css/facets.css index 2a8cec5..b4abb86 100644 --- a/views/public/css/facets.css +++ b/views/public/css/facets.css @@ -1,4 +1,4 @@ -.facets-container { +#facets-container { margin-bottom: 20px; } @@ -19,7 +19,7 @@ width: 100%; } -.facets-container button { +#facets-container button { width: 100%; text-align: center; font-weight: bold; @@ -42,11 +42,20 @@ margin-left: 5px; } -.container-vertical { +.facets-container-vertical { /* max-width: 350px; */ } -.container-vertical:not(:last-child) { +.facets-container-vertical:not(:last-child) { + padding-bottom: 20px; +} + +.facets-container-horizontal { + max-width: 350px; + display: inline-block; +} + +.facets-container-horizontal:not(:last-child) { padding-bottom: 20px; } @@ -63,16 +72,7 @@ justify-content: space-between; } -.container-horizontal { - max-width: 350px; - display: inline-block; -} - -.container-horizontal:not(:last-child) { - padding-bottom: 20px; -} - -.facets-container p.description { +#facets-container p.description { text-align: left; color: #545759; font-size: 90%; @@ -88,20 +88,20 @@ background-color: #F1F1F1; } -.facets-container .hidden { +#facets-container .hidden { display: none; } -.facets-container form { +#facets-container form { padding: 20px 10px; } -.facets-container form label { +#facets-container form label { margin-bottom: 8px; color: #545759; } -.facets-container form select { +#facets-container form select { width: 100%; border: 0; background-color: #FFF; @@ -113,3 +113,26 @@ color: #FFF; background-color: #545759!important; } + +.facet-checkbox, .facet-checkbox-all, .facet-visibility-toggle { + display: block; + font-size: 90%; +} + +.facet-visibility-toggle { + float: right; + cursor: pointer; +} + +.facet-checkbox-count { + float: right; + color: #545759; +} + +.hidden { + display: none; +} + +.unhidden { + display: block; +} From 6b7bc257dc11c027d243c7539551291b39b28159 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sat, 17 Jul 2021 18:18:19 +0200 Subject: [PATCH 103/161] Create facets.js --- views/public/javascripts/facets.js | 54 ++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 views/public/javascripts/facets.js diff --git a/views/public/javascripts/facets.js b/views/public/javascripts/facets.js new file mode 100644 index 0000000..96b1cf2 --- /dev/null +++ b/views/public/javascripts/facets.js @@ -0,0 +1,54 @@ +jQuery(document).ready(function () { + // loads language variables + var language = facetsLanguage.language; + + // submits results of refining search to reload the page + window.jQuery('#facets-body select').change(function() { + var option = window.jQuery(this).find('option:selected'); + if (typeof(option.data('url')) !== 'undefined') window.location.href = option.data('url'); + }); + + // submits results of refining search to reload the page + window.jQuery('#facets-body input:checkbox').change(function() { + var checkbox = window.jQuery(this); + if (typeof(checkbox.data('url')) !== 'undefined') window.location.href = checkbox.data('url'); + }); + + // toggles extra values visibility + jQuery('.facet-visibility-toggle').click(function () { + var id = jQuery(this).data('element-id'); + var div = jQuery('#facet-extra-values-' + id); + var link = jQuery('#facet-extra-link-' + id); + div.toggleClass("hidden unhidden"); + if (div.hasClass('hidden')) { + link.text(language.ShowMore); + } else { + link.text(language.ShowLess); + } + }); + + // collapses/expands facets block + jQuery('#facets-title').click(function () { + var header = jQuery(this); + if (!header.hasClass('facets-collapsible') && !header.hasClass('facets-collapsed')) return; + //getting the next element + var content = header.next(); + //open up the content needed - toggle the slide- if visible, slide up, if not slidedown. + content.slideToggle(300, function () { + //execute this after slideToggle is done + //change icon of header based on visibility of content div + header.toggleClass('facets-collapsible facets-collapsed'); + }); + }); +}); + +// forces block collapsible if screen size small +jQuery(window).on('load', function() { + if (jQuery(window).width() < 768) { + jQuery('#facets-title').addClass('facets-collapsed'); + jQuery('#facets-body').addClass('hidden'); + } + + // hides facets block (but for title) on load + jQuery('#facets-body').next().addClass('hidden'); +}); From f88eceb838c40ff9b60e1bf415bf2213c491fbe3 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sat, 17 Jul 2021 18:19:16 +0200 Subject: [PATCH 104/161] Added checkbox style --- views/public/facets/browse.php | 65 +++++++++++----------------------- 1 file changed, 20 insertions(+), 45 deletions(-) diff --git a/views/public/facets/browse.php b/views/public/facets/browse.php index 023b9e3..fad7a38 100644 --- a/views/public/facets/browse.php +++ b/views/public/facets/browse.php @@ -3,6 +3,7 @@ $hideSingleEntries = (bool)get_option('facets_hide_single_entries'); $facetsCollapsible = (bool)get_option('facets_collapsible'); $facetsDirection = (string)get_option('facets_direction'); + $checkboxMinCount = (int)get_option('facets_checkbox_minimum_amount'); $table = get_db()->getTable('Element'); $select = $table->getSelect() @@ -18,7 +19,7 @@ } ?> -
"> +
">
name, $facetsElements)) { $isDate = in_array($element->name, array('Date')); $facetElement = $facetsElements['elements'][$element->name]; - if ($html = get_facet_select('collection', $subsetSQL, $element->id, $isDate, $hideSingleEntries, (isset($facetElement['sort']) ? $facetElement['sort'] : ''), (isset($facetElement['popularity']) ? $facetElement['popularity'] : ''))) { - echo "
\n"; + if ($html = get_element_facet_select('collection', $subsetSQL, $element->id, $isDate, $hideSingleEntries, (isset($facetElement['sort']) ? $facetElement['sort'] : ''), (isset($facetElement['popularity']) ? $facetElement['popularity'] : ''))) { + echo "
id . "\" class=\"facets-container-" . $facetsDirection . "\">\n"; echo "\n"; - echo $html; + echo $html . "\n"; echo "
\n"; } } @@ -47,38 +48,43 @@ if (isFacetActive($recordType, $element->name, $facetsElements)) { $isDate = in_array($element->name, array('Date')); $facetElement = $facetsElements['elements'][$element->name]; - if ($html = get_facet_select('item', $subsetSQL, $element->id, $isDate, $hideSingleEntries, (isset($facetElement['sort']) ? $facetElement['sort'] : ''), (isset($facetElement['popularity']) ? $facetElement['popularity'] : ''))) { - echo "
\n"; + if (isset($facetElement['type']) && $facetElement['type'] == 'checkbox') { + $html = get_element_facet_checkboxes('item', $subsetSQL, $element->id, $isDate, $hideSingleEntries, (isset($facetElement['sort']) ? $facetElement['sort'] : ''), (isset($facetElement['popularity']) ? $facetElement['popularity'] : ''), $checkboxMinCount); + } else { + $html = get_element_facet_select('item', $subsetSQL, $element->id, $isDate, $hideSingleEntries, (isset($facetElement['sort']) ? $facetElement['sort'] : ''), (isset($facetElement['popularity']) ? $facetElement['popularity'] : '')); + } + if ($html != '') { + echo "
id . "\" class=\"facets-container-" . $facetsDirection . "\">\n"; echo "\n"; - echo $html; + echo $html . "\n"; echo "
\n"; - } + } } } if ((bool)get_option('facets_item_types_active')) { if ($html = get_item_types_facet_select($subsetSQL, $hideSingleEntries, get_option('facets_item_types_sort'), get_option('facets_item_types_popularity'))) { - echo "
\n"; + echo "
\n"; echo "\n"; - echo $html; + echo $html . "\n"; echo "
\n"; } } if ((bool)get_option('facets_collections_active')) { if ($html = get_collections_facet_select($subsetSQL, $hideSingleEntries, get_option('facets_collections_sort'), get_option('facets_collections_popularity'))) { - echo "
\n"; + echo "
\n"; echo "\n"; - echo $html; + echo $html . "\n"; echo "
\n"; } } if ((bool)get_option('facets_tags_active')) { if ($html = get_tags_facet_select($subsetSQL, $hideSingleEntries, get_option('facets_tags_sort'), get_option('facets_tags_popularity'))) { - echo "
\n"; + echo "
\n"; echo "\n"; - echo $html; + echo $html . "\n"; echo "
\n"; } } @@ -87,34 +93,3 @@
- From 59f00d583ae87641f81c20219f1b002d4ec18351 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sat, 17 Jul 2021 18:20:16 +0200 Subject: [PATCH 105/161] Added checkbox style options --- FacetsPlugin.php | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/FacetsPlugin.php b/FacetsPlugin.php index da8617c..7ff576d 100644 --- a/FacetsPlugin.php +++ b/FacetsPlugin.php @@ -5,6 +5,9 @@ * @license http://www.gnu.org/licenses/gpl-3.0.txt * @package FacetsPlugin */ +ini_set('display_errors', 1); +ini_set('display_startup_errors', 1); +error_reporting(E_ALL); define('FACETS_PLUGIN_DIR', dirname(__FILE__)); define('FACETS_MINIMUM_AMOUNT', 5); @@ -34,20 +37,25 @@ public function hookInstall() set_option('facets_public_hook', 'default'); set_option('facets_description', ''); set_option('facets_hide_single_entries', 0); - set_option('facets_collapsible', 0); set_option('facets_direction', 'vertical'); + set_option('facets_collapsible', 0); + set_option('facets_checkbox_minimum_amount', FACETS_MINIMUM_AMOUNT); $defaults = array( - 'elements' => array('item', 'collection', 'sort', 'popularity') + 'elements' => array('item', 'collection', 'type', 'sort', 'popularity') ); set_option('facets_elements', json_encode($defaults)); + set_option('facets_item_types_active', 0); + set_option('facets_item_types_style', ''); set_option('facets_item_types_sort', ''); set_option('facets_item_types_popularity', 0); set_option('facets_collections_active', 1); + set_option('facets_collections_style', ''); set_option('facets_collections_sort', 'count_alpha'); set_option('facets_collections_popularity', 1); set_option('facets_tags_active', 0); + set_option('facets_tags_style', ''); set_option('facets_tags_sort', ''); set_option('facets_tags_popularity', 0); } @@ -60,16 +68,20 @@ public function hookUninstall() delete_option('facets_public_hook'); delete_option('facets_description'); delete_option('facets_hide_single_entries'); - delete_option('facets_collapsible'); delete_option('facets_direction'); + delete_option('facets_collapsible'); + delete_option('facets_checkbox_minimum_amount'); delete_option('facets_elements'); delete_option('facets_item_types_active'); + delete_option('facets_item_types_style'); delete_option('facets_item_types_sort'); delete_option('facets_item_types_popularity'); delete_option('facets_collections_active'); + delete_option('facets_collections_style'); delete_option('facets_collections_sort'); delete_option('facets_collections_popularity'); delete_option('facets_tags_active'); + delete_option('facets_tags_style'); delete_option('facets_tags_sort'); delete_option('facets_tags_popularity'); } @@ -114,8 +126,9 @@ public function hookConfig($args) set_option('facets_public_hook', $post['facets_public_hook']); set_option('facets_description', $post['facets_description']); set_option('facets_hide_single_entries', $post['facets_hide_single_entries']); - set_option('facets_collapsible', $post['facets_collapsible']); set_option('facets_direction', $post['facets_direction']); + set_option('facets_collapsible', $post['facets_collapsible']); + set_option('facets_checkbox_minimum_amount', $post['facets_checkbox_minimum_amount']); $settings = array( 'elements' => isset($post['elements']) ? $post['elements'] : array() @@ -123,12 +136,15 @@ public function hookConfig($args) set_option('facets_elements', json_encode($settings)); set_option('facets_item_types_active', $post['facets_item_types_active']); + set_option('facets_item_types_style', $post['facets_item_types_style']); set_option('facets_item_types_sort', $post['facets_item_types_sort']); set_option('facets_item_types_popularity', $post['facets_item_types_popularity']); set_option('facets_collections_active', $post['facets_collections_active']); + set_option('facets_collections_style', $post['facets_collections_style']); set_option('facets_collections_sort', $post['facets_collections_sort']); set_option('facets_collections_popularity', $post['facets_collections_popularity']); set_option('facets_tags_active', $post['facets_tags_active']); + set_option('facets_tags_style', $post['facets_tags_style']); set_option('facets_tags_sort', $post['facets_tags_sort']); set_option('facets_tags_popularity', $post['facets_tags_popularity']); } @@ -245,6 +261,13 @@ public function hookPublicHead($args) $action = $request->getActionName(); if (($action == 'browse' && ($controller == 'items' || $controller == 'collections')) || ($controller == 'search' && $action == 'index')) { + $language = array( + 'ShowMore' => __('show more'), + 'ShowLess' => __('show less') + ); + $language = json_encode($language); + queue_js_string("facetsLanguage = {language: $language};"); + queue_js_file('facets'); queue_css_file('facets'); } } From 8f5ca2d4592fc69dff93c2e4d8e40e9b0c2cea57 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sat, 17 Jul 2021 19:49:50 +0200 Subject: [PATCH 106/161] Update facets.css --- views/public/css/facets.css | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/views/public/css/facets.css b/views/public/css/facets.css index b4abb86..02ad830 100644 --- a/views/public/css/facets.css +++ b/views/public/css/facets.css @@ -44,19 +44,21 @@ .facets-container-vertical { /* max-width: 350px; */ + clear: both; } -.facets-container-vertical:not(:last-child) { - padding-bottom: 20px; +.facets-container-vertical:not(:last-child), .facets-container-horizontal:not(:last-child) { + margin-bottom: 20px; } .facets-container-horizontal { max-width: 350px; + clear: both; display: inline-block; } -.facets-container-horizontal:not(:last-child) { - padding-bottom: 20px; +.facets-container-vertical label, .facets-container-horizontal label { + font-weight: bold; } .flex { @@ -122,6 +124,11 @@ .facet-visibility-toggle { float: right; cursor: pointer; + line-height: 90%; +} + +.facet-visibility-toggle:hover { + font-weight: normal!important; } .facet-checkbox-count { From cc3f79afb97ba3f667a0ffc5c5d38c569dfad002 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sun, 18 Jul 2021 10:35:35 +0200 Subject: [PATCH 107/161] Modified code for new style option --- config_form.php | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/config_form.php b/config_form.php index 0521a0e..a4f5b82 100644 --- a/config_form.php +++ b/config_form.php @@ -219,15 +219,15 @@
formSelect( - "facets_item_types_style", - $type, - array(), - array( - 'dropdown' => __('Dropdown'), - 'checkbox' => __('Checkbox') - )); + "facets_item_types_style", + get_option('facets_item_types_style'), + array(), + array( + 'dropdown' => __('Dropdown'), + 'checkbox' => __('Checkbox') + ) + ); ?> @@ -274,15 +274,15 @@ formSelect( - "facets_collections_style", - $type, - array(), - array( - 'dropdown' => __('Dropdown'), - 'checkbox' => __('Checkbox') - )); + "facets_collections_style", + get_option('facets_collections_style'), + array(), + array( + 'dropdown' => __('Dropdown'), + 'checkbox' => __('Checkbox') + ) + ); ?> @@ -329,15 +329,15 @@ formSelect( - "facets_tags_style", - $type, - array(), - array( - 'dropdown' => __('Dropdown'), - 'checkbox' => __('Checkbox') - )); + "facets_tags_style", + get_option('facets_tags_style'), + array(), + array( + 'dropdown' => __('Dropdown'), + 'checkbox' => __('Checkbox') + ) + ); ?> From 3100647593ccd207e3e30814843107a0f97876b7 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sun, 18 Jul 2021 10:46:29 +0200 Subject: [PATCH 108/161] Sligtly modified appearance --- views/public/css/facets.css | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/views/public/css/facets.css b/views/public/css/facets.css index 02ad830..f74ea92 100644 --- a/views/public/css/facets.css +++ b/views/public/css/facets.css @@ -95,7 +95,7 @@ } #facets-container form { - padding: 20px 10px; + padding: 10px 10px 20px 10px; } #facets-container form label { @@ -121,6 +121,10 @@ font-size: 90%; } +.facet-checkbox { + clear: both; +} + .facet-visibility-toggle { float: right; cursor: pointer; From ea16d1cf28ce7a9f6932eb60672e099ee36b0ade Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sun, 18 Jul 2021 12:03:20 +0200 Subject: [PATCH 109/161] Tidied up indentation --- config_form.php | 90 +++++++++++++++++++++++++++---------------------- 1 file changed, 50 insertions(+), 40 deletions(-) diff --git a/config_form.php b/config_form.php index a4f5b82..3372508 100644 --- a/config_form.php +++ b/config_form.php @@ -165,37 +165,41 @@ name]['type']) ? $settings['elements'][$element->name]['type'] : ''); echo $view->formSelect( - "elements[{$element->name}][type]", - $type, - array(), - array( - 'dropdown' => __('Dropdown'), - 'checkbox' => __('Checkbox') - )); + "elements[{$element->name}][type]", + $type, + array(), + array( + 'dropdown' => __('Dropdown'), + 'checkbox' => __('Checkbox') + ) + ); ?> name]['sort']) ? $settings['elements'][$element->name]['sort'] : ''); echo $view->formSelect( - "elements[{$element->name}][sort]", - $sortOrder, - array(), - array( - 'alpha' => __('Alphabetical'), - 'count_alpha' => __('Popularity first, then alphabetical') - )); + "elements[{$element->name}][sort]", + $sortOrder, + array(), + array( + 'alpha' => __('Alphabetical'), + 'count_alpha' => __('Popularity first, then alphabetical') + ) + ); ?> - formCheckbox( - "elements[{$element->name}][popularity]", - '1', - array( - 'disableHidden' => true, - 'checked' => isset($settings['elements'][$element->name]['popularity']) - ) - ); ?> + formCheckbox( + "elements[{$element->name}][popularity]", + '1', + array( + 'disableHidden' => true, + 'checked' => isset($settings['elements'][$element->name]['popularity']) + ) + ); + ?>
- formCheckbox( - "facets_item_types_active", - get_option('facets_item_types_popularity'), - null, - array('1', '0') - ); ?> + formCheckbox( + "facets_item_types_active", + get_option('facets_item_types_popularity'), + null, + array('1', '0') + ); + ?>   @@ -262,12 +268,14 @@
- formCheckbox( - "facets_collections_active", - get_option('facets_collections_popularity'), - null, - array('1', '0') - ); ?> + formCheckbox( + "facets_collections_active", + get_option('facets_collections_popularity'), + null, + array('1', '0') + ); + ?>   @@ -317,12 +325,14 @@
- formCheckbox( - "facets_tags_active", - get_option('facets_tags_popularity'), - null, - array('1', '0') - ); ?> + formCheckbox( + "facets_tags_active", + get_option('facets_tags_popularity'), + null, + array('1', '0') + ); + ?>   From 9ff53f268cd0422fae2f792865014c6b892bf0fb Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sun, 18 Jul 2021 12:47:32 +0200 Subject: [PATCH 110/161] Added checkbox option to collections, tags and item types --- views/public/facets/browse.php | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/views/public/facets/browse.php b/views/public/facets/browse.php index fad7a38..2f62173 100644 --- a/views/public/facets/browse.php +++ b/views/public/facets/browse.php @@ -35,7 +35,12 @@ if (isFacetActive($recordType, $element->name, $facetsElements)) { $isDate = in_array($element->name, array('Date')); $facetElement = $facetsElements['elements'][$element->name]; - if ($html = get_element_facet_select('collection', $subsetSQL, $element->id, $isDate, $hideSingleEntries, (isset($facetElement['sort']) ? $facetElement['sort'] : ''), (isset($facetElement['popularity']) ? $facetElement['popularity'] : ''))) { + if (isset($facetElement['type']) && $facetElement['type'] == 'checkbox') { + $html = get_element_facet_checkboxes('collection', $subsetSQL, $element->id, $isDate, $hideSingleEntries, (isset($facetElement['sort']) ? $facetElement['sort'] : ''), (isset($facetElement['popularity']) ? $facetElement['popularity'] : ''), $checkboxMinCount); + } else { + $html = get_element_facet_select('collection', $subsetSQL, $element->id, $isDate, $hideSingleEntries, (isset($facetElement['sort']) ? $facetElement['sort'] : ''), (isset($facetElement['popularity']) ? $facetElement['popularity'] : '')); + } + if ($html != '') { echo "
id . "\" class=\"facets-container-" . $facetsDirection . "\">\n"; echo "\n"; echo $html . "\n"; @@ -63,7 +68,12 @@ } if ((bool)get_option('facets_item_types_active')) { - if ($html = get_item_types_facet_select($subsetSQL, $hideSingleEntries, get_option('facets_item_types_sort'), get_option('facets_item_types_popularity'))) { + if (get_option('facets_item_types_style') == 'checkbox') { + $html = get_item_types_facet_checkboxes($subsetSQL, $hideSingleEntries, get_option('facets_item_types_sort'), get_option('facets_item_types_popularity'), $checkboxMinCount); + } else { + $html = get_item_types_facet_select($subsetSQL, $hideSingleEntries, get_option('facets_item_types_sort'), get_option('facets_item_types_popularity')); + } + if ($html != '') { echo "
\n"; echo "\n"; echo $html . "\n"; @@ -72,7 +82,12 @@ } if ((bool)get_option('facets_collections_active')) { - if ($html = get_collections_facet_select($subsetSQL, $hideSingleEntries, get_option('facets_collections_sort'), get_option('facets_collections_popularity'))) { + if (get_option('facets_collections_style') == 'checkbox') { + $html = get_collections_facet_checkboxes($subsetSQL, $hideSingleEntries, get_option('facets_collections_sort'), get_option('facets_collections_popularity'), $checkboxMinCount); + } else { + $html = get_collections_facet_select($subsetSQL, $hideSingleEntries, get_option('facets_collections_sort'), get_option('facets_collections_popularity')); + } + if ($html != '') { echo "
\n"; echo "\n"; echo $html . "\n"; @@ -81,7 +96,12 @@ } if ((bool)get_option('facets_tags_active')) { - if ($html = get_tags_facet_select($subsetSQL, $hideSingleEntries, get_option('facets_tags_sort'), get_option('facets_tags_popularity'))) { + if (get_option('facets_item_types_style') == 'checkbox') { + $html = get_tags_facet_checkboxes($subsetSQL, $hideSingleEntries, get_option('facets_tags_sort'), get_option('facets_tags_popularity'), $checkboxMinCount); + } else { + $html = get_tags_facet_select($subsetSQL, $hideSingleEntries, get_option('facets_tags_sort'), get_option('facets_tags_popularity')); + } + if ($html != '') { echo "
\n"; echo "\n"; echo $html . "\n"; From 1f2a3e17ecd680c8ea25f3dd168e8e14ed09a932 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sun, 18 Jul 2021 13:42:00 +0200 Subject: [PATCH 111/161] Fixed typos --- config_form.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config_form.php b/config_form.php index 3372508..2b36998 100644 --- a/config_form.php +++ b/config_form.php @@ -214,7 +214,7 @@ formCheckbox( "facets_item_types_active", - get_option('facets_item_types_popularity'), + get_option('facets_item_types_active'), null, array('1', '0') ); @@ -271,7 +271,7 @@ formCheckbox( "facets_collections_active", - get_option('facets_collections_popularity'), + get_option('facets_collections_active'), null, array('1', '0') ); @@ -328,7 +328,7 @@ formCheckbox( "facets_tags_active", - get_option('facets_tags_popularity'), + get_option('facets_tags_active'), null, array('1', '0') ); From 66e82b0a2ba50ebb7e0075eac000c2c20a54a37b Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sun, 18 Jul 2021 13:48:09 +0200 Subject: [PATCH 112/161] Corrected typo --- views/public/facets/browse.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/public/facets/browse.php b/views/public/facets/browse.php index 2f62173..09f86a0 100644 --- a/views/public/facets/browse.php +++ b/views/public/facets/browse.php @@ -96,7 +96,7 @@ } if ((bool)get_option('facets_tags_active')) { - if (get_option('facets_item_types_style') == 'checkbox') { + if (get_option('facets_tags_style') == 'checkbox') { $html = get_tags_facet_checkboxes($subsetSQL, $hideSingleEntries, get_option('facets_tags_sort'), get_option('facets_tags_popularity'), $checkboxMinCount); } else { $html = get_tags_facet_select($subsetSQL, $hideSingleEntries, get_option('facets_tags_sort'), get_option('facets_tags_popularity')); From 9fb0e1e7b438b2724675336c4aa970c8016fd86c Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sun, 18 Jul 2021 17:01:46 +0200 Subject: [PATCH 113/161] Fixed function --- views/public/javascripts/facets.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/views/public/javascripts/facets.js b/views/public/javascripts/facets.js index 96b1cf2..4e23fb2 100644 --- a/views/public/javascripts/facets.js +++ b/views/public/javascripts/facets.js @@ -50,5 +50,7 @@ jQuery(window).on('load', function() { } // hides facets block (but for title) on load - jQuery('#facets-body').next().addClass('hidden'); + if (jQuery('#facets-title').hasClass('facets-collapsed')) { + jQuery('#facets-body').addClass('hidden'); + } }); From f13195bcfc79dc678e1f9539a4119b35656fc6b2 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sun, 18 Jul 2021 17:02:35 +0200 Subject: [PATCH 114/161] Chanced initial collapsed status --- views/public/facets/browse.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/public/facets/browse.php b/views/public/facets/browse.php index 09f86a0..22a4a6b 100644 --- a/views/public/facets/browse.php +++ b/views/public/facets/browse.php @@ -20,7 +20,7 @@ ?>
"> - +
Date: Sun, 18 Jul 2021 17:04:26 +0200 Subject: [PATCH 115/161] Added internationalization to js strings --- FacetsPlugin.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/FacetsPlugin.php b/FacetsPlugin.php index 7ff576d..969d901 100644 --- a/FacetsPlugin.php +++ b/FacetsPlugin.php @@ -5,12 +5,11 @@ * @license http://www.gnu.org/licenses/gpl-3.0.txt * @package FacetsPlugin */ -ini_set('display_errors', 1); -ini_set('display_startup_errors', 1); -error_reporting(E_ALL); define('FACETS_PLUGIN_DIR', dirname(__FILE__)); define('FACETS_MINIMUM_AMOUNT', 5); +define('FACETS_SHOW_MORE', __('show more')); +define('FACETS_SHOW_LESS', __('show less')); require_once FACETS_PLUGIN_DIR . '/helpers/FacetsFunctions.php'; @@ -262,8 +261,8 @@ public function hookPublicHead($args) if (($action == 'browse' && ($controller == 'items' || $controller == 'collections')) || ($controller == 'search' && $action == 'index')) { $language = array( - 'ShowMore' => __('show more'), - 'ShowLess' => __('show less') + 'ShowMore' => FACETS_SHOW_MORE, + 'ShowLess' => FACETS_SHOW_LESS ); $language = json_encode($language); queue_js_string("facetsLanguage = {language: $language};"); From ba6f890fa46edf394b2694ba9bb502c7f8311075 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sun, 18 Jul 2021 17:05:11 +0200 Subject: [PATCH 116/161] Added checkbox style --- helpers/FacetsFunctions.php | 654 +++++++++++++++++++++++++++++------- 1 file changed, 529 insertions(+), 125 deletions(-) diff --git a/helpers/FacetsFunctions.php b/helpers/FacetsFunctions.php index 24132ed..f5b76a7 100644 --- a/helpers/FacetsFunctions.php +++ b/helpers/FacetsFunctions.php @@ -2,19 +2,14 @@ /** * Helper to display a Facets Block */ - // class Facets_View_Helper_Facets extends Zend_View_Helper_Abstract - // { /** - * Return HTML Select associated with Array of facets tag values. + * Return list of objects associated to collection. * - * @param itemsArray - * @param hideSingleEntries - * @param sortOrder - * @param showPopularity - * @return html. + * @param subsetSQL + * @return objects */ - function get_tags_facet_select($subsetSQL, $hideSingleEntries = false, $sortOrder = 'count_alpha', $showPopularity = false) { + function get_objects_for_tags($subsetSQL, $sortOrder) { // Create Where clause $whereSubset = createWhereSubsetClause('item', $subsetSQL); @@ -24,7 +19,7 @@ function get_tags_facet_select($subsetSQL, $hideSingleEntries = false, $sortOrde } else { $orderBy = array('name ASC'); } - + // Get the database. $db = get_db(); // Get the table. @@ -34,22 +29,30 @@ function get_tags_facet_select($subsetSQL, $hideSingleEntries = false, $sortOrde $table->filterByTagType($select, 'Item'); $select->where($whereSubset); $select->order($orderBy); + + return $table->fetchObjects($select); + } - if ($tags = $table->fetchObjects($select)) { + /** + * Return HTML Select associated with Array of facets tag values. + * + * @param subsetSQL + * @param hideSingleEntries + * @param sortOrder + * @param showPopularity + * @return html. + */ + function get_tags_facet_select($subsetSQL, $hideSingleEntries = false, $sortOrder = 'count_alpha', $showPopularity = false) { + if ($tags = get_objects_for_tags($subsetSQL, $sortOrder)) { // Build array - $facetTags = array(); - foreach ($tags as $tag) { - $facetTags[$tag->id]['id'] = $tag->id; - $facetTags[$tag->id]['name'] = $tag->name; - $facetTags[$tag->id]['count'] = $tag->tagCount; - } + $facetTags = buildTagsArray($tags); // Stores data for selected tag, if any $selectedTagName = (isset($_GET['tags']) ? $_GET['tags'] : ''); // Remove single entries if required - if ($hideSingleEntries && count(array_filter($facetTags, 'excludeSingleValues')) > FACETS_MINIMUM_AMOUNT) { - $facetTags = array_filter($facetTags, "isNotSingleEntry"); + if ($hideSingleEntries && count(array_filter($facetTags, 'isNotSingleExtra')) > FACETS_MINIMUM_AMOUNT) { + $facetTags = array_filter($facetTags, "isNotSingleExtra"); } $addOptions = false; @@ -77,20 +80,81 @@ function get_tags_facet_select($subsetSQL, $hideSingleEntries = false, $sortOrde return $html; } - + /** - * Return HTML Select associated with Array of facets collection values. + * Return HTML Checkboxes associated with Array of facets tag values. * - * @param itemsArray + * @param subsetSQL * @param hideSingleEntries * @param sortOrder * @param showPopularity * @return html. */ - function get_collections_facet_select($subsetSQL, $hideSingleEntries = false, $sortOrder = 'count_alpha', $showPopularity = false) { + function get_tags_facet_checkboxes($subsetSQL, $hideSingleEntries = false, $sortOrder = 'count_alpha', $showPopularity = false, $limitCheckboxes = 0) { + if ($tags = get_objects_for_tags($subsetSQL, $sortOrder)) { + // Build array + $facetTags = buildTagsArray($tags); + + // Stores data for selected tags, if any + $selectedTags = (isset($_GET['tags']) ? $_GET['tags'] : ''); + $selectedTagNames = explode(option('tag_delimiter'), $selectedTags); + + // Remove single entries if required + if ($hideSingleEntries && count(array_filter($facetTags, 'isNotSingleExtra')) > FACETS_MINIMUM_AMOUNT) { + $facetTags = array_filter($facetTags, "isNotSingleExtra"); + } + + $countCheckboxes = 0; + $html = '
'; + // Build first part of the checkboxes tag + if ($selectedTags != '') { + $selectedTagNames = explode(option('tag_delimiter'), $selectedTags); + foreach ($selectedTagNames as $selectedTagName) { + $url = getTagUrl($selectedTagName); + $html .= "
" . html_escape($selectedTagName) . "
"; + $countCheckboxes++; + } + } + + $hidingSeparator = false; + // Build additional part of the select tag (if needed) + foreach ($facetTags as $tag) { + if (!in_array($tag['name'], $selectedTagNames)) { + if ($limitCheckboxes != 0 && $countCheckboxes >= $limitCheckboxes && !$hidingSeparator) { + // Add link to show other values + $html .= "
"; + $hidingSeparator = true; + } + + $url = getTagUrl($tag['name']); + $html .= "
" . html_escape($tag['name']) . ($showPopularity ? " (" . $tag['count'] . ")" : "") . "
"; + $countCheckboxes++; + } + } + + if ($hidingSeparator) { + $html .= "
"; + $html .= "" . FACETS_SHOW_MORE . ""; + } + + $html .= "
"; + } else { + $html = false; + } + + return $html; + } + + /** + * Return list of objects associated to collection. + * + * @param subsetSQL + * @return objects + */ + function get_objects_for_collection($subsetSQL) { // Create Where clause $whereSubset = createWhereSubsetClause('item', $subsetSQL); - + // Get the database. $db = get_db(); // Get the table. @@ -102,35 +166,33 @@ function get_collections_facet_select($subsetSQL, $hideSingleEntries = false, $s ->where($whereSubset) ->group('collections.id'); - if ($collections = $table->fetchObjects($select)) { + return $table->fetchObjects($select); + } + + /** + * Return HTML Select associated with Array of facets collection values. + * + * @param subsetSQL + * @param hideSingleEntries + * @param sortOrder + * @param showPopularity + * @return html. + */ + function get_collections_facet_select($subsetSQL, $hideSingleEntries = false, $sortOrder = 'count_alpha', $showPopularity = false) { + if ($collections = get_objects_for_collection($subsetSQL, $sortOrder)) { // Build array - $facetCollections = array(); - foreach ($collections as $collection) { - $facetCollections[$collection->id]['id'] = $collection->id; - $facetCollections[$collection->id]['name'] = $collection->getDisplayTitle(); - $facetCollections[$collection->id]['count'] = $collection->count; - } + $facetCollections = buildCollectionsArray($collections); - // Stores data for selected collection, if any - if (isset($_GET['collection'])) { - if ($collection_id = $_GET['collection']) { - if (array_key_exists($collection_id, $facetCollections)) { - $selectedCollection = $facetCollections[$collection_id]; - } - } - } + // Store data for selected collection, if any + $selectedCollection = getSelectedCollection($facetCollections); // Remove single entries if required - if ($hideSingleEntries && count(array_filter($facetCollections, 'excludeSingleValues')) > FACETS_MINIMUM_AMOUNT) { - $facetCollections = array_filter($facetCollections, "isNotSingleEntry"); + if ($hideSingleEntries && count(array_filter($facetCollections, 'isNotSingleExtra')) > FACETS_MINIMUM_AMOUNT) { + $facetCollections = array_filter($facetCollections, "isNotSingleExtra"); } // Sort array (have to do it now instead than in select because of the way we get the Collection name) - if ($sortOrder == 'count_alpha') { - array_multisort(array_column($facetCollections, 'count'), SORT_DESC, array_column($facetCollections, 'name'), SORT_ASC, $facetCollections); - } else { - array_multisort(array_column($facetCollections, 'name'), SORT_ASC, $facetCollections); - } + $facetCollections = sortCollections($facetCollections, $sortOrder); $addOptions = false; // Build first part of the select tag @@ -159,15 +221,77 @@ function get_collections_facet_select($subsetSQL, $hideSingleEntries = false, $s } /** - * Return HTML Select associated with Array of facets item type values. + * Return HTML Checkboxes associated with Array of facets values. * - * @param itemsArray + * @param subsetSQL * @param hideSingleEntries * @param sortOrder * @param showPopularity - * @return html. + * @param limitCheckboxes + * @return html */ - function get_item_types_facet_select($subsetSQL, $hideSingleEntries = false, $sortOrder = 'count_alpha', $showPopularity = false) { + function get_collections_facet_checkboxes($subsetSQL, $hideSingleEntries = false, $sortOrder = 'count_alpha', $showPopularity = false, $limitCheckboxes = 0) { + if ($collections = get_objects_for_collection($subsetSQL, $sortOrder)) { + // Build array + $facetCollections = buildCollectionsArray($collections); + + // Store data for selected collection, if any + $selectedCollection = getSelectedCollection($facetCollections); + + // Remove single entries if required + if ($hideSingleEntries && count(array_filter($facetCollections, 'isNotSingleExtra')) > FACETS_MINIMUM_AMOUNT) { + $facetCollections = array_filter($facetCollections, "isNotSingleExtra"); + } + + // Sort array (have to do it now instead than in select because of the way we get the Collection's name) + $facetCollections = sortCollections($facetCollections, $sortOrder); + + $countCheckboxes = 0; + $html = '
'; + // Build first part of the checkboxes tag + if (isset($selectedCollection)) { + $url = getFieldUrl('collection', null, $selectedCollection); + $html .= "
" . html_escape($selectedCollection['name']) . "
"; + $countCheckboxes++; + } + + $hidingSeparator = false; + // Build additional part of the select tag (if needed) + foreach ($facetCollections as $collection) { + if ($collection != $selectedCollection) { + if ($limitCheckboxes != 0 && $countCheckboxes >= $limitCheckboxes && !$hidingSeparator) { + // Add link to show other values + $html .= "
"; + $hidingSeparator = true; + } + + $url = getFieldUrl('collection', $collection['id']); + $html .= "
" . html_escape($collection['name']) . ($showPopularity ? " (" . $collection['count'] . ")" : "") . "
"; + $countCheckboxes++; + } + } + + if ($hidingSeparator) { + $html .= "
"; + $html .= "" . FACETS_SHOW_MORE . ""; + } + + $html .= "
"; + } else { + $html = false; + } + + return $html; + } + + /** + * Return list of objects associated to collection. + * + * @param subsetSQL + * @param sortOrder + * @return objects + */ + function get_objects_for_item_type($subsetSQL, $sortOrder) { // Create Where Subset clause $whereSubset = createWhereSubsetClause('item', $subsetSQL); @@ -177,7 +301,7 @@ function get_item_types_facet_select($subsetSQL, $hideSingleEntries = false, $so } else { $orderBy = array('name ASC'); } - + // Get the database. $db = get_db(); // Get the table. @@ -189,33 +313,35 @@ function get_item_types_facet_select($subsetSQL, $hideSingleEntries = false, $so ->where($whereSubset) ->group('item_types.id') ->order($orderBy); + + return $table->fetchObjects($select); + } - if ($itemTypes = $table->fetchObjects($select)) { + /** + * Return HTML Select associated with Array of facets item type values. + * + * @param subsetSQL + * @param hideSingleEntries + * @param sortOrder + * @param showPopularity + * @return html. + */ + function get_item_types_facet_select($subsetSQL, $hideSingleEntries = false, $sortOrder = 'count_alpha', $showPopularity = false) { + if ($itemTypes = get_objects_for_item_type($subsetSQL, $sortOrder)) { // Build array - $facetItemTypes = array(); - foreach ($itemTypes as $itemType) { - $facetItemTypes[$itemType->id]['id'] = $itemType->id; - $facetItemTypes[$itemType->id]['name'] = $itemType->name; - $facetItemTypes[$itemType->id]['count'] = $itemType->count; - } - - // Stores data for selected item type, if any - if (isset($_GET['type'])) { - if ($itemType_id = $_GET['type']) { - if (array_key_exists($itemType_id, $facetItemTypes)) { - $selectedItemType = $facetItemTypes[$itemType_id]; - } - } - } + $facetItemTypes = buildItemTypesArray($itemTypes); + + // Store data for selected item type, if any + $selectedItemType = getSelectedItemType($facetItemTypes); // Remove single entries if required - if ($hideSingleEntries && count(array_filter($facetItemTypes, 'excludeSingleValues')) > FACETS_MINIMUM_AMOUNT) { - $facetItemTypes = array_filter($facetItemTypes, "isNotSingleEntry"); + if ($hideSingleEntries && count(array_filter($facetItemTypes, 'isNotSingleExtra')) > FACETS_MINIMUM_AMOUNT) { + $facetItemTypes = array_filter($facetItemTypes, "isNotSingleExtra"); } $addOptions = false; // Build first part of the select tag - if (isset($selectedItemType)) { + if (!empty($selectedItemType)) { $html = "
" . html_escape($selectedItemType['name']) . "
"; + $countCheckboxes++; + } + + $hidingSeparator = false; + // Build additional part of the select tag (if needed) + foreach ($facetItemTypes as $itemType) { + if ($itemType != $selectedItemType) { + if ($limitCheckboxes != 0 && $countCheckboxes >= $limitCheckboxes && !$hidingSeparator) { + // Add link to show other values + $html .= "
"; + $hidingSeparator = true; + } + + $url = getFieldUrl('type', $itemType['id']); + $html .= "
" . html_escape($itemType['name']) . ($showPopularity ? " (" . $itemType['count'] . ")" : "") . "
"; + $countCheckboxes++; + } + } + + if ($hidingSeparator) { + $html .= "
"; + $html .= "" . FACETS_SHOW_MORE . ""; + } + + $html .= "
"; + } else { + $html = false; + } + + return $html; + } /** - * Return HTML Select associated with Array of facets values. + * Return list of objects associated to element. * - * @param itemsArray + * @param recordType + * @param subsetSQL * @param elementId * @param isDate - * @param hideSingleEntries * @param sortOrder - * @param showPopularity - * @return html + * @return objects */ - function get_facet_select($recordType, $subsetSQL, $elementId = 50, $isDate = false, $hideSingleEntries = false, $sortOrder = 'count_alpha', $showPopularity = false) { + function get_objects_for_element($recordType, $subsetSQL, $elementId, $isDate, $sortOrder) { // Create Where clauses $whereRecordType = createWhereRecordTypeClause($recordType); $whereSubset = createWhereSubsetClause($recordType, $subsetSQL); - + // Create the columns, groupBy and orderBy clauses if ($isDate) { - $columns = array('SUBSTR(element_texts.text, 1, 4) AS year', 'COUNT(text) AS count'); - $groupBy = 'year'; + $columns1 = array('SUBSTR(element_texts.text, 1, 4) AS year'); + $columns2 = 'COUNT(year) AS count'; + $groupBy = array('year', 'record_id'); if ($sortOrder == 'count_alpha') { - $orderBy = array('count DESC', 'year DESC'); + $orderBy = 'count DESC, year DESC'; } else { - $orderBy = array('year DESC'); + $orderBy = 'year DESC'; } } else { - $columns = array('COUNT(text) AS count'); - $groupBy = 'text'; + $columns1 = ''; + $columns2 = 'COUNT(text) AS count'; + $groupBy = array('text', 'record_id'); if ($sortOrder == 'count_alpha') { - $orderBy = array('count DESC', 'text ASC'); + $orderBy = 'count DESC, text ASC'; } else { - $orderBy = array('text ASC'); + $orderBy = 'text ASC'; } - } + } // Get the database. $db = get_db(); // Get the table. $table = $db->getTable('ElementText'); // Build the select query. - $select = $table->getSelect(); - $select->columns($columns); - $select->joinInner(array('elements' => $db->Elements), 'element_texts.element_id = elements.id', array()); - $select->joinInner(array('element_sets' => $db->ElementSet), 'element_sets.id = elements.element_set_id', array()); + $subQuery = $table->getSelect(); + $subQuery->columns($columns1); + $subQuery->joinInner(array('elements' => $db->Elements), 'element_texts.element_id = elements.id', array()); + $subQuery->joinInner(array('element_sets' => $db->ElementSet), 'element_sets.id = elements.element_set_id', array()); if ($recordType == 'item') { - $select->joinInner(array('items' => $db->Item), 'items.id = element_texts.record_id', array()); + $subQuery->joinInner(array('items' => $db->Item), 'items.id = element_texts.record_id', array()); } else { - $select->joinInner(array('collections' => $db->Collection), 'collections.id = element_texts.record_id', array()); + $subQuery->joinInner(array('collections' => $db->Collection), 'collections.id = element_texts.record_id', array()); } - $select->where('elements.id = '. $elementId); - $select->where($whereRecordType); - $select->where($whereSubset); - $select->group($groupBy); - $select->order($orderBy); + $subQuery->where('elements.id = '. $elementId); + $subQuery->where($whereRecordType); + $subQuery->where($whereSubset); + $subQuery->group($groupBy); + + $select = "SELECT *, " . $columns2 . " FROM (" . $subQuery . ") foo GROUP BY `text` ORDER BY " . $orderBy; + + return $table->fetchObjects($select); + } + /** + * Return HTML Select associated with Array of facets values. + * + * @param recordType + * @param subsetSQL + * @param elementId + * @param isDate + * @param hideSingleEntries + * @param sortOrder + * @param showPopularity + * @return html + */ + function get_element_facet_select($recordType, $subsetSQL, $elementId = 50, $isDate = false, $hideSingleEntries = false, $sortOrder = 'count_alpha', $showPopularity = false) { // Build array - if ($elements = $table->fetchObjects($select)) { - $facet = array(); + if ($elements = get_objects_for_element($recordType, $subsetSQL, $elementId, $isDate, $sortOrder)) { + $facetElement = array(); foreach ($elements as $element) { if ($isDate) { - $facet[$element->year] = $element->count; + $facetElement[$element->year] = $element->count; } else { - $facet[$element->text] = $element->count; + $facetElement[$element->text] = $element->count; } } $element_id = $element->element_id; // Remove single entries if required - if ($hideSingleEntries && count(array_filter($facet, 'excludeSingleValues')) > FACETS_MINIMUM_AMOUNT) { - $facet = array_filter($facet, "isNotSingleEntry"); + if ($hideSingleEntries && count(array_filter($facetElement, 'isNotSingleElement')) > FACETS_MINIMUM_AMOUNT) { + $facetElement = array_filter($facetElement, "isNotSingleElement"); } // Get current parameters to check if one is selected if (!empty($_GET['advanced'])) { $search = $_GET['advanced']; - foreach ($search as $Searchindex => $SearchArray){ - if (isset($SearchArray['element_id']) && $SearchArray['element_id'] == $element_id) { - $term = $SearchArray['terms']; + foreach ($search as $searchIndex => $searchArray){ + if (isset($searchArray['element_id']) && $searchArray['element_id'] == $element_id) { + $term = $searchArray['terms']; break; } } @@ -329,7 +533,7 @@ function get_facet_select($recordType, $subsetSQL, $elementId = 50, $isDate = fa $url = getElementFieldUrl($element_id, null, $isDate); $html .= ""; $html .= ""; - } elseif (count($facet) > 0) { + } elseif (count($facetElement) > 0) { $html = "
" . html_escape($term) . "
"; + $countCheckboxes++; + } + } + + $hidingSeparator = false; + // Build additional part of the select tag (if needed) + foreach ($facetElement as $name => $count) { + if (!in_array($name, $selectedTerms)) { + if ($limitCheckboxes != 0 && $countCheckboxes >= $limitCheckboxes && !$hidingSeparator) { + // Add link to show other values + $html .= "
"; + $hidingSeparator = true; + } + + $url = getElementFieldUrl($element_id, $name, $isDate); + $html .= "
" . html_escape($name) . ($showPopularity ? " (" . $count . ")" : "") . "
"; + $countCheckboxes++; + } + } + + if ($hidingSeparator) { + $html .= "
"; + $html .= "" . FACETS_SHOW_MORE . ""; + } + + $html .= "
"; + } else { + $html = false; + } + + return $html; + } /** * Add an Element Field to Search to the current URL. * - * @param string $field The Element id. + * @param string $field_id The Element id. * @param string $value The Element value. + * @param string $isDate * @return string The new URL. */ - function getElementFieldUrl($field_id, $value = null, $isDate = false) + function getElementFieldUrl($field_id, $value = null, $isDate = false, $oldValue = null) { // Get the current facets. if (!empty($_GET['advanced'])) { $search = $_GET['advanced']; - // unset current element filter if already set - foreach ($search as $Searchindex => $SearchArray){ - if (isset($SearchArray['element_id']) && $SearchArray['element_id'] == $field_id){ - unset ($search[$Searchindex]); + if ($value == '') { + if ($oldValue == '') { + // unset current element filter(s) if already set + foreach ($search as $searchIndex => $searchArray){ + if (isset($searchArray['element_id']) && $searchArray['element_id'] == $field_id){ + unset ($search[$searchIndex]); + } + } + } else { + // unset current element filter with specific value if already set + foreach ($search as $searchIndex => $searchArray){ + if (isset($searchArray['element_id']) && $searchArray['element_id'] == $field_id && $searchArray['terms'] == $oldValue){ + unset ($search[$searchIndex]); + break; + } + } } } } else { @@ -389,7 +688,6 @@ function getElementFieldUrl($field_id, $value = null, $isDate = false) if (isset($_GET['search'])) $params['search'] = $_GET['search']; // Rebuild the route. - // return $_SERVER['HTTP_HOST'] . "?" . http_build_query($params); return 'browse?' . http_build_query($params); } @@ -400,7 +698,7 @@ function getElementFieldUrl($field_id, $value = null, $isDate = false) * @param string $value The Element value. * @return string The new URL. */ - function getFieldUrl($filter, $value = null) + function getFieldUrl($filter, $value = null, $oldValue = null) { // Get the current facets. if (!empty($_GET['advanced'])) { @@ -420,17 +718,66 @@ function getFieldUrl($filter, $value = null) if (isset($_GET['search'])) $params['search'] = $_GET['search']; // set(unset) current - if(!is_null($value)){ + if (!is_null($value)){ $params[$filter] = $value; } else { unset($params[$filter]); } // Rebuild the route. - // return $_SERVER['HTTP_HOST'] . "?" . http_build_query($params); return 'browse?' . http_build_query($params); } + /** + * Add a Tag Field to Search to the current URL. + * + * @param string $filter The filter field name (tags|tag_id|type|collection). + * @param string $value The Element value. + * @return string The new URL. + */ + function getTagUrl($value = null) + { + // Get the current facets. + if (!empty($_GET['advanced'])) { + $search = $_GET['advanced']; + } else { + $search = array(); + } + // set previous parameters + $params['advanced'] = $search; + if (isset($_GET['origin'])) $params['origin'] = $_GET['origin']; + if (isset($_GET['origin-title'])) $params['origin-title'] = $_GET['origin-title']; + if (isset($_GET['type'])) $params['type'] = $_GET['type']; + if (isset($_GET['collection'])) $params['collection'] = $_GET['collection']; + if (isset($_GET['tag_id'])) $params['tag_id'] = $_GET['tag_id']; + if (isset($_GET['tag'])) $params['tag'] = $_GET['tag']; + if (isset($_GET['tags'])) $params['tags'] = $_GET['tags']; + if (isset($_GET['search'])) $params['search'] = $_GET['search']; + + // set(unset) current + if (!is_null($value)) { + if (isset($params['tags'])) { + $tags = explode(option('tag_delimiter'), $params['tags']); + if (in_array($value, $tags)) { + $tagToRemove = array($value); + $tags = array_diff($tags, $tagToRemove); + } else { + $tags[] = $value; + } + $params['tags'] = implode(option('tag_delimiter'), $tags); + + if (empty($params['tags'])) unset($params['tags']); + } else { + $params['tags'] = $value; + } + } else { + unset($params['tags']); + } + + // Rebuild the route. + return 'browse?' . http_build_query($params); + } + function isFacetActive($recordType, $element_name, $settings) { if (isset($settings['elements'][$element_name][$recordType])) { return ((bool)$settings['elements'][$element_name][$recordType]); @@ -438,8 +785,12 @@ function isFacetActive($recordType, $element_name, $settings) { return false; } - function isNotSingleEntry($count) { - return ($count != 1); + function isNotSingleElement($count) { + if ($count > 1) return $count; + } + + function isNotSingleExtra($element) { + if ($element['count'] > 1) return $element; } function createWhereRecordTypeClause($recordType) { @@ -454,14 +805,67 @@ function createWhereSubsetClause($recordType, $sql) { } } - function excludeSingleValues($element) { - if ($element > 1) return $element; - } - function recordTypeActive($recordType, $elements) { foreach ($elements as $element) { if (array_key_exists($recordType, $element)) return true; } return false; - } + } + + function buildCollectionsArray($collections) { + $facetCollections = array(); + foreach ($collections as $collection) { + $facetCollections[$collection->id]['id'] = $collection->id; + $facetCollections[$collection->id]['name'] = $collection->getDisplayTitle(); + $facetCollections[$collection->id]['count'] = $collection->count; + } + return $facetCollections; + } + + function getSelectedCollection($collections) { + if (isset($_GET['collection'])) { + $collection_id = $_GET['collection']; + if (array_key_exists($collection_id, $collections)) { + return $collections[$collection_id]; + } + } + } + + function sortCollections($collections, $sortOrder = 'count_alpha') { + if ($sortOrder == 'count_alpha') { + array_multisort(array_column($collections, 'count'), SORT_DESC, array_column($collections, 'name'), SORT_ASC, $collections); + } else { + array_multisort(array_column($collections, 'name'), SORT_ASC, $collections); + } + return $collections; + } + + function buildItemTypesArray($itemTypes) { + $facetItemTypes = array(); + foreach ($itemTypes as $itemType) { + $facetItemTypes[$itemType->id]['id'] = $itemType->id; + $facetItemTypes[$itemType->id]['name'] = $itemType->name; + $facetItemTypes[$itemType->id]['count'] = $itemType->count; + } + return $facetItemTypes; + } + + function getSelectedItemType($itemTypes) { + if (isset($_GET['type'])) { + $itemType_id = $_GET['type']; + if (array_key_exists($itemType_id, $itemTypes)) { + return $itemTypes[$itemType_id]; + } + } + } + + function buildTagsArray($tags) { + $facetTags = array(); + foreach ($tags as $tag) { + $facetTags[$tag->id]['id'] = $tag->id; + $facetTags[$tag->id]['name'] = $tag->name; + $facetTags[$tag->id]['count'] = $tag->tagCount; + } + return $facetTags; + } ?> From 6cee805bc730bb870de2cc3575b7101f7b3493e3 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sun, 18 Jul 2021 17:17:36 +0200 Subject: [PATCH 117/161] Update config_form.php --- config_form.php | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/config_form.php b/config_form.php index 2b36998..95ffc57 100644 --- a/config_form.php +++ b/config_form.php @@ -205,7 +205,7 @@
- +
- -
@@ -317,11 +312,6 @@ ?>
- -
From 9f94c0f472693cc94b470a7750aa9c79e64c5eb9 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sun, 18 Jul 2021 17:29:21 +0200 Subject: [PATCH 118/161] Strings updated --- languages/eo.mo | Bin 567 -> 607 bytes languages/eo.po | 78 +++++++++++++++++++---------- languages/it.mo | Bin 3637 -> 4243 bytes languages/it.po | 109 ++++++++++++++++++++++++++--------------- languages/template.pot | 96 +++++++++++++++++++++++------------- 5 files changed, 184 insertions(+), 99 deletions(-) diff --git a/languages/eo.mo b/languages/eo.mo index 89935c25f2ec71e563f07175cb789d904569985d..bdde674e7a4ccdafaf1e4aee0da23da238aede3a 100644 GIT binary patch delta 57 zcmdnaa-U^_jqFZF28IR(1_nMLwqkm{E$u&_cn`+{(~wawy{? E02!$Y761SM delta 44 rcmcc5vYlmujqF5528IR(1_nML7Gi?Xia?qT$T!#+$;3Fhneh$)r5Oh! diff --git a/languages/eo.po b/languages/eo.po index 3f3838b..2f29425 100644 --- a/languages/eo.po +++ b/languages/eo.po @@ -10,6 +10,7 @@ msgstr "" "POT-Creation-Date: 2021-06-08 13:56-0001\n" "PO-Revision-Date: 2021-06-13 15:39-0001\n" "PO-Revision-Date: 2021-07-05 15:17-0001\n" +"PO-Revision-Date: 2021-07-18 17:16-0001\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: eo\n" @@ -71,11 +72,11 @@ msgid "If checked, values with just one entry will not be listed (unless there's msgstr "" #: config_form.php:63 -msgid "Block collapsible" +msgid "Minimum checkbox count" msgstr "" #: config_form.php:67 -msgid "If checked, facets block will be collapsible (tip: as it saves space, it's particularly useful with horizontal theme layouts)." +msgid "For all fields using the checkbox style, minimum amount of values to be displayed (0 means all values displayed)." msgstr "" #: config_form.php:75 @@ -94,61 +95,88 @@ msgstr "" msgid "Vertical (useful for themes with side main navigation menu)" msgstr "" -#: config_form.php:93 +#: config_form.php:95 +msgid "Block collapsible" +msgstr "" + +#: config_form.php:99 +msgid "If checked, facets block will be collapsible (tip: as it saves space, it's particularly useful with horizontal theme layouts)." +msgstr "" + +#: config_form.php:105 msgid "Elements" msgstr "" -#: config_form.php:98 +#: config_form.php:110 msgid -"The elements that can be used for search refinement. Item and Collection columns to (de)activate, " +"The elements that can be used for search refinement. Item and Collection columns to (de)activate, Style column to choose the facet style, " "Sort order column to choose sorting order, Popularity column to show counters near names." msgstr "" -#: config_form.php:103 +#: config_form.php:115 msgid "Element name" msgstr "" -#: config_form.php:104 +#: config_form.php:116 msgid "Item" msgstr "" -#: config_form.php:105 +#: config_form.php:117 msgid "Collection" msgstr "" -#: config_form.php:106 +#: config_form.php:118 +msgid "Style" +msgstr "" + +#: config_form.php:119 msgid "Sort order" msgstr "" -#: config_form.php:107 +#: config_form.php:120 msgid "Popularity" msgstr "" -#: config_form.php:159 -#: config_form.php:201 -#: config_form.php:243 -#: config_form.php:285 +#: config_form.php:172 +#: config_form.php:233 +#: config_form.php:290 +#: config_form.php:347 +msgid "Dropdown" +msgstr "" + +#: config_form.php:173 +#: config_form.php:234 +#: config_form.php:291 +#: config_form.php:348 +msgid "Checkbox" +msgstr "" + +#: config_form.php:186 +#: config_form.php:246 +#: config_form.php:303 +#: config_form.php:360 msgid "Alphabetical" msgstr "" -#: config_form.php:160 -#: config_form.php:202 -#: config_form.php:244 -#: config_form.php:286 +#: config_form.php:187 +#: config_form.php:247 +#: config_form.php:303 +#: config_form.php:361 msgid "Popularity first, then alphabetical" msgstr "" -#: config_form.php:178 -#: config_form.php:182 +#: config_form.php:208 +msgid "Extra parameters" +msgstr "" + +#: config_form.php:212 msgid "Item Types" msgstr "" -#: config_form.php:220 -#: config_form.php:224 +#: config_form.php:264 msgid "Collections" msgstr "" -#: config_form.php:262 -#: config_form.php:266 +#: config_form.php:316 msgid "Tags" -msgstr "" +msgstr "" \ No newline at end of file diff --git a/languages/it.mo b/languages/it.mo index 34248112e3ab81b26d1c5ed67d3b3765c8de6b2b..e2e5c22753877f02ebf7b4ea87f6f907f6ee7abd 100644 GIT binary patch delta 1173 zcmYMxJ7^R^7zgmVM;=}h$wL#1pc5mKlMpO~6pBGe45&E-1w}2K?9L^lvpeU`ZcHpZ zTd`5sCxQ{wB4U-0(niomM52}=Y7F)XncuoEsq z3j79Af}bGmTTA^7sYA5bh4`!$1A2i&YUL2z3WwosI01X$H&}vy;XEA2DF&`WoXJk1 zZ0ewZJ7EMV&;!^9pFxWA7E+?0VQDi4s~FG$e;|racG0{MyN|$j*oKPF!Ud@C(jKgL z;R8~_2jNjT-X5=IhMT6Pb8*tl#yhgRnnnXtan0rUPExD5(!EHFF$?#qK+Ay?+Wf2iw_Y<>XubgzA7t6BuB3YOZU#mAP_!+)!qmd8u+pKUZyW;prIfX uqm}`EhI$5Zxo`o!M1Jvy!piPs#49KV9huTfB6z(3SL&oXv-G&-e)d0WwIPxl+vtev<+<+7rV0iW1`Nuza6-58mGQ_xU})-|u~%=Y37rMWpl`^pu6GlPALCu{09-{AVli z7qJ(Au^la!h^~jwk5O#F0mngSe+-*hpTZE%;0We$U8E!@OtLKWxhakn)P%c^huA}W zhFb6u1Nh?jgW6aF^?jRR6#aOGaZG9RHZ_QsILuMm#$oD9mB|(d9#9J}&~6j1Vi4C* z3vQzB?>HWye(|ZZe~sL7%MiwUOyCFZ;gC;c8K00_;v@@EU#6L8q6~In5w&0iwSj$X z!%Nf`ZyfJ1PW*(g*h`XQKBR@;)K7dt5^boC6Zo!4W7(BVaz0&LOeM1tE0|eVui0>Q zcZ_G#xpcl5%_nndae_i^(w(r(xo6IV?W5Y8{p~iNzNm@%!?n7\n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -21,17 +22,17 @@ msgstr "" msgid "Refine search" msgstr "" -#: FacetsFunctions.php:59 -#: FacetsFunctions.php:135 -#: FacetsFunctions.php:212 -#: FacetsFunctions.php:315 +#: FacetsFunctions.php:62 +#: FacetsFunctions.php:201 +#: FacetsFunctions.php:346 +#: FacetsFunctions.php:534 msgid "Remove filter" msgstr "" -#: FacetsFunctions.php:63 -#: FacetsFunctions.php:139 -#: FacetsFunctions.php:216 -#: FacetsFunctions.php:319 +#: FacetsFunctions.php:66 +#: FacetsFunctions.php:205 +#: FacetsFunctions.php:350 +#: FacetsFunctions.php:538 msgid "Select" msgstr "" @@ -71,11 +72,11 @@ msgid "If checked, values with just one entry will not be listed (unless there's msgstr "" #: config_form.php:63 -msgid "Block collapsible" +msgid "Minimum checkbox count" msgstr "" #: config_form.php:67 -msgid "If checked, facets block will be collapsible (tip: as it saves space, it's particularly useful with horizontal theme layouts)." +msgid "For all fields using the checkbox style, minimum amount of values to be displayed (0 means all values displayed)." msgstr "" #: config_form.php:75 @@ -94,61 +95,88 @@ msgstr "" msgid "Vertical (useful for themes with side main navigation menu)" msgstr "" -#: config_form.php:93 +#: config_form.php:95 +msgid "Block collapsible" +msgstr "" + +#: config_form.php:99 +msgid "If checked, facets block will be collapsible (tip: as it saves space, it's particularly useful with horizontal theme layouts)." +msgstr "" + +#: config_form.php:105 msgid "Elements" msgstr "" -#: config_form.php:98 +#: config_form.php:110 msgid -"The elements that can be used for search refinement. Item and Collection columns to (de)activate, " -"Sort order column to choose sorting order, Popularity column to show counters near names." +"The elements that can be used for search refinement. Item and Collection columns to (de)activate, Style column to " +"choose the facet style, Sort order column to choose sorting order, Popularity column to show counters near names." msgstr "" -#: config_form.php:103 +#: config_form.php:115 msgid "Element name" msgstr "" -#: config_form.php:104 +#: config_form.php:116 msgid "Item" msgstr "" -#: config_form.php:105 +#: config_form.php:117 msgid "Collection" msgstr "" -#: config_form.php:106 +#: config_form.php:118 +msgid "Style" +msgstr "" + +#: config_form.php:119 msgid "Sort order" msgstr "" -#: config_form.php:107 +#: config_form.php:120 msgid "Popularity" msgstr "" -#: config_form.php:159 -#: config_form.php:201 -#: config_form.php:243 -#: config_form.php:285 +#: config_form.php:172 +#: config_form.php:233 +#: config_form.php:290 +#: config_form.php:347 +msgid "Dropdown" +msgstr "" + +#: config_form.php:173 +#: config_form.php:234 +#: config_form.php:291 +#: config_form.php:348 +msgid "Checkbox" +msgstr "" + +#: config_form.php:186 +#: config_form.php:246 +#: config_form.php:303 +#: config_form.php:360 msgid "Alphabetical" msgstr "" -#: config_form.php:160 -#: config_form.php:202 -#: config_form.php:244 -#: config_form.php:286 +#: config_form.php:187 +#: config_form.php:247 +#: config_form.php:303 +#: config_form.php:361 msgid "Popularity first, then alphabetical" msgstr "" -#: config_form.php:178 -#: config_form.php:182 +#: config_form.php:208 +msgid "Extra parameters" +msgstr "" + +#: config_form.php:212 msgid "Item Types" msgstr "" -#: config_form.php:220 -#: config_form.php:224 +#: config_form.php:264 msgid "Collections" msgstr "" -#: config_form.php:262 -#: config_form.php:266 +#: config_form.php:316 msgid "Tags" -msgstr "" +msgstr "" \ No newline at end of file From 6c509079b670cd4ce0827f318fba75f32d98b989 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sun, 18 Jul 2021 17:33:28 +0200 Subject: [PATCH 119/161] Update Readme.md --- Readme.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Readme.md b/Readme.md index 3745008..895eb36 100644 --- a/Readme.md +++ b/Readme.md @@ -2,9 +2,9 @@ ## Description -Plugin for Omeka Classic. Once installed and active, allows to insert a Facets block made of option dropdown boxes containing available metadata values extracted from browsing context. Works for both Items and Collections. +Plugin for Omeka Classic. Once installed and active, allows to insert a Faceted search refining block containing available metadata values extracted from browsing context. Works for both Items and Collections. -Settings allow to choose the hook to be used, which criteria use for search refinement, whether to ignore single entries, sorting order for values, whether to show values popolarity, whether to use an horizontal or vertical layout, etc. +Settings allow to choose the hook to be used, which criteria to use for search refinement, whether to ignore single entries, sorting order for values, whether to show values popularity, whether to use an horizontal or vertical layout, whether to make the block collapsible, etc. ## Credits @@ -35,7 +35,9 @@ For **Thanks, Roy** theme, for example, best way is to change `common/header.php For **Berlin** theme, instead, check **Block collapsible** option, set **Horizontal** as **Block layout** and then add the custom hook in `items/browse.php` and `collections/browse.php`: ```php + $this)); ?> + ``` @@ -49,6 +51,8 @@ Similarly, one can choose to also include **Item Types**, **Collections** and ** Facets block can be set up for **vertical** or **horizontal** layout, according to the theme layout; and it can be made **collapsible**, to use less vertical space (recommended for horizontal layout). +Style for facets can be either **dropdown selectbox**, or **checkbox**; this last one allows to choose more values, while with the first one one value excludes other. For checkbox style, a **minimum amount of values** can be set too. + Sorting order can be **alphabetical**, or **first by popularity and then alphabetical**. Popularity count can be shown, if needed. **Date** element filter's behaviour is a bit different: dates are ordered decrescently, and only year is displayed; consequently, the matching will be with the beginning of the date (assuming the format is 'yyyy-mm-dd'). From 0a77a1b3fd7c0b3657aca17e43a7e647745582aa Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sun, 18 Jul 2021 17:33:59 +0200 Subject: [PATCH 120/161] Update Readme.md --- Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index 895eb36..e05494c 100644 --- a/Readme.md +++ b/Readme.md @@ -55,7 +55,7 @@ Style for facets can be either **dropdown selectbox**, or **checkbox**; this las Sorting order can be **alphabetical**, or **first by popularity and then alphabetical**. Popularity count can be shown, if needed. -**Date** element filter's behaviour is a bit different: dates are ordered decrescently, and only year is displayed; consequently, the matching will be with the beginning of the date (assuming the format is 'yyyy-mm-dd'). +**Date** element filter's behaviour is a bit different: dates are ordered decrescently, and only year is displayed; consequently, the matching will be with the beginning of the date (assuming the format is '_yyyy-mm-dd_'). ## Licence MIT Licence, please credit AR2L [AR2L Hauts de France](http://www.ar2l-hdf.fr/) and [Daniele Binaghi](https://github.com/DBinaghi). From 0c58562523a892c10a2a5bfb9d0bc47f6baafb7f Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sun, 18 Jul 2021 17:38:53 +0200 Subject: [PATCH 121/161] Strings updated --- languages/eo.mo | Bin 607 -> 684 bytes languages/eo.po | 8 ++++++++ languages/it.mo | Bin 4243 -> 4320 bytes languages/it.po | 8 ++++++++ languages/template.pot | 8 ++++++++ 5 files changed, 24 insertions(+) diff --git a/languages/eo.mo b/languages/eo.mo index bdde674e7a4ccdafaf1e4aee0da23da238aede3a..8b9b586f9c36439623bbd3265b15c1b6c7b11050 100644 GIT binary patch delta 185 zcmcc5vWB((o)F7a1|VPqVi_Rz0dat!210>pULd;`h(UBW5QEgt1Y%AgUI3+60qLEL z3=CUF+u2BAPrLA1EfLvCj)6NAiWSsGX$khj8_yc&d4uU$Vn|OW&pEt^NUh9 a)<0mB%+1d$DausHP0T6C$z*`?KuiFY$spqZ delta 101 zcmZ3(dY>ioo)F7a1|VPoVi_Q|0dasJ210>pULZRbh(UBV5VHYsB@pjqWMF6j(tJQ{ U#RQ=}fiy@yVq&HG#x3_50V&!God5s; diff --git a/languages/eo.po b/languages/eo.po index 2f29425..de2bfb0 100644 --- a/languages/eo.po +++ b/languages/eo.po @@ -18,6 +18,14 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +#: FacetsPlugin.php:11 +msgid "show more" +msgstr "montri pli" + +#: FacetsPlugin.php:12 +msgid "show less" +msgstr "montri malpli" + #: browse.php:22 msgid "Refine search" msgstr "Rafini serĉon" diff --git a/languages/it.mo b/languages/it.mo index e2e5c22753877f02ebf7b4ea87f6f907f6ee7abd..4549dea6a500113d8da429734d949328d3dc0be6 100644 GIT binary patch delta 700 zcmYMxPbhkKVH0_x(K2?|pvn^ZWgF9DEJtUVP4i@EhRn=8icu6ESQ4 z^$;e>>v0QPF^@WajBY%`Ml50zUfJH-@5`w5k9J|IpFzN|R zp-z}bJ=!H~$5lMSJa%Fmljd*;Pce%Y2G~BmWFPf=1?LzK% z0O|)q$YDs>&c|?uJceF&e1JtfVN!_kY5q`Ma0+KJi`wuWX(1JqsJWgnmg1R}Wy6$c tX`$w_&Yw+Y^wc}Y9_;@8Wa;~s3XOqvY+8z=P0 zBRGvIETN4rV-(jgh8x(1dx1y6{5jhCiy*(kq*T!z!4ebCn89MRG=g)uiasu2mm_g$ zlZO@B!cII4@+w*rmuQ7vF@Ya}KWGia!V;HKJRIsPOOR(Ehi^EG^PEDS)qUj0EfRas zJr3goZZn^tZQF?7Dlw!pOk)+T@D17qAJNvm2Y#ZRkPT+2uQ-9d(2aJK1K5E>xPu;M zv5rOjMjs1&Wf2?5H#J4uc7i4B!4BM hVuFrm@D$6u)X#W^KhQQjiW69 Date: Sun, 18 Jul 2021 17:43:24 +0200 Subject: [PATCH 122/161] Update browse.php --- views/public/facets/browse.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/views/public/facets/browse.php b/views/public/facets/browse.php index 22a4a6b..1f5ac31 100644 --- a/views/public/facets/browse.php +++ b/views/public/facets/browse.php @@ -4,6 +4,7 @@ $facetsCollapsible = (bool)get_option('facets_collapsible'); $facetsDirection = (string)get_option('facets_direction'); $checkboxMinCount = (int)get_option('facets_checkbox_minimum_amount'); + $dateFields = array('Date', 'Date Available', 'Date Created', 'Date Accepted', 'Date Copyrighted', 'Date Submitted', 'Date Issued', 'Date Modified', 'Date Valid'); $table = get_db()->getTable('Element'); $select = $table->getSelect() @@ -33,7 +34,7 @@ if ($recordType == 'collection') { foreach ($elements as $element) { if (isFacetActive($recordType, $element->name, $facetsElements)) { - $isDate = in_array($element->name, array('Date')); + $isDate = in_array($element->name, $dateFields); $facetElement = $facetsElements['elements'][$element->name]; if (isset($facetElement['type']) && $facetElement['type'] == 'checkbox') { $html = get_element_facet_checkboxes('collection', $subsetSQL, $element->id, $isDate, $hideSingleEntries, (isset($facetElement['sort']) ? $facetElement['sort'] : ''), (isset($facetElement['popularity']) ? $facetElement['popularity'] : ''), $checkboxMinCount); @@ -51,7 +52,7 @@ } else { foreach ($elements as $element) { if (isFacetActive($recordType, $element->name, $facetsElements)) { - $isDate = in_array($element->name, array('Date')); + $isDate = in_array($element->name, $dateFields); $facetElement = $facetsElements['elements'][$element->name]; if (isset($facetElement['type']) && $facetElement['type'] == 'checkbox') { $html = get_element_facet_checkboxes('item', $subsetSQL, $element->id, $isDate, $hideSingleEntries, (isset($facetElement['sort']) ? $facetElement['sort'] : ''), (isset($facetElement['popularity']) ? $facetElement['popularity'] : ''), $checkboxMinCount); From d7b9ddb35b67a2dc6f8d4d1078900b0177c38dab Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Sun, 18 Jul 2021 17:43:51 +0200 Subject: [PATCH 123/161] Update plugin.ini --- plugin.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.ini b/plugin.ini index fee0875..48b009e 100644 --- a/plugin.ini +++ b/plugin.ini @@ -5,6 +5,6 @@ description="Adds a faceted navigation block to narrow down Items and Collection license="GPLv3" link="https://github.com/DBinaghi/plugin-Facets" support_link="https://github.com/DBinaghi/plugin-Facets/issues" -version="2.4" +version="2.5" omeka_minimum_version="2.6.1" omeka_target_version="2.6.1" From 88c184e932e28441e415c6247d8a51fc2c04467c Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Mon, 19 Jul 2021 22:58:32 +0200 Subject: [PATCH 124/161] Rename Readme.md to README.md --- Readme.md => README.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Readme.md => README.md (100%) diff --git a/Readme.md b/README.md similarity index 100% rename from Readme.md rename to README.md From e86634a7e501efd95288fe202e40937936ac0ada Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Tue, 20 Jul 2021 09:35:12 +0200 Subject: [PATCH 125/161] Added new options, compacted code --- config_form.php | 179 +++++++++++++++--------------------------------- 1 file changed, 54 insertions(+), 125 deletions(-) diff --git a/config_form.php b/config_form.php index 95ffc57..ff2828b 100644 --- a/config_form.php +++ b/config_form.php @@ -136,14 +136,16 @@
name); ?> - formCheckbox( - "elements[{$element->name}][item]", - '1', - array( - 'disableHidden' => true, - 'checked' => isset($settings['elements'][$element->name]['item']) - ) - ); ?> + formCheckbox( + "elements[{$element->name}][item]", + '1', + array( + 'disableHidden' => true, + 'checked' => (isset($settings['elements'][$element->name]['item']) && $settings['elements'][$element->name]['item'] == 1) + ) + ); + ?> true, - 'checked' => isset($settings['elements'][$element->name]['collection']) + 'checked' => (isset($settings['elements'][$element->name]['collection']) && $settings['elements'][$element->name]['collection'] == 1) ) ); } else { @@ -163,10 +165,10 @@ name]['type']) ? $settings['elements'][$element->name]['type'] : ''); + $style = (isset($settings['elements'][$element->name]['style']) ? $settings['elements'][$element->name]['style'] : ''); echo $view->formSelect( - "elements[{$element->name}][type]", - $type, + "elements[{$element->name}][style]", + $style, array(), array( 'dropdown' => __('Dropdown'), @@ -196,7 +198,7 @@ '1', array( 'disableHidden' => true, - 'checked' => isset($settings['elements'][$element->name]['popularity']) + 'checked' => (isset($settings['elements'][$element->name]['popularity']) && $settings['elements'][$element->name]['popularity'] == 1) ) ); ?> @@ -208,78 +210,53 @@
formCheckbox( - "facets_item_types_active", - get_option('facets_item_types_active'), - null, - array('1', '0') - ); - ?> - -   - - formSelect( - "facets_item_types_style", - get_option('facets_item_types_style'), - array(), - array( - 'dropdown' => __('Dropdown'), - 'checkbox' => __('Checkbox') - ) - ); - ?> - - formSelect( - 'facets_item_types_sort', - get_option('facets_item_types_sort'), - array(), + "{$key}[item]", + '1', array( - 'alpha' => __('Alphabetical'), - 'count_alpha' => __('Popularity first, then alphabetical') + 'disableHidden' => true, + 'checked' => (isset($settings[$key]['item']) && $settings[$key]['item'] == 1) ) ); ?> formCheckbox( - 'facets_item_types_popularity', - get_option('facets_item_types_popularity'), - null, - array('1', '0') - ); - ?> -
- formCheckbox( - "facets_collections_active", - get_option('facets_collections_active'), - null, - array('1', '0') - ); + if ($value['collection']) { + echo $view->formCheckbox( + "{$key}[collection]", + '1', + array( + 'disableHidden' => true, + 'checked' => isset($settings[$key]['collection']) + ) + ); + } else { + echo " "; + } ?> -   - formSelect( - "facets_collections_style", - get_option('facets_collections_style'), + "{$key}[style]", + $style, array(), array( 'dropdown' => __('Dropdown'), @@ -290,9 +267,10 @@ formSelect( - 'facets_collections_sort', - get_option('facets_collections_sort'), + "{$key}[sort]", + $sort, array(), array( 'alpha' => __('Alphabetical'), @@ -304,66 +282,17 @@ formCheckbox( - 'facets_collections_popularity', - get_option('facets_collections_popularity'), - null, - array('1', '0') - ); - ?> -
- formCheckbox( - "facets_tags_active", - get_option('facets_tags_active'), - null, - array('1', '0') - ); - ?> - -   - - formSelect( - "facets_tags_style", - get_option('facets_tags_style'), - array(), - array( - 'dropdown' => __('Dropdown'), - 'checkbox' => __('Checkbox') - ) - ); - ?> - - formSelect( - 'facets_tags_sort', - get_option('facets_tags_sort'), - array(), + "{$key}[popularity]", + '1', array( - 'alpha' => __('Alphabetical'), - 'count_alpha' => __('Popularity first, then alphabetical') + 'disableHidden' => true, + 'checked' => (isset($settings[$key]['popularity']) && $settings[$key]['popularity'] == 1) ) ); ?> - formCheckbox( - 'facets_tags_popularity', - get_option('facets_tags_popularity'), - null, - array('1', '0') - ); - ?> -
From 44780ffc752e95de85f65eb16bf8967f7f6477c1 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Tue, 20 Jul 2021 09:36:06 +0200 Subject: [PATCH 126/161] Added upgrade hook, compacted code --- FacetsPlugin.php | 121 +++++++++++++++++++++++++++-------------------- 1 file changed, 71 insertions(+), 50 deletions(-) diff --git a/FacetsPlugin.php b/FacetsPlugin.php index 969d901..6a3070c 100644 --- a/FacetsPlugin.php +++ b/FacetsPlugin.php @@ -8,8 +8,6 @@ define('FACETS_PLUGIN_DIR', dirname(__FILE__)); define('FACETS_MINIMUM_AMOUNT', 5); -define('FACETS_SHOW_MORE', __('show more')); -define('FACETS_SHOW_LESS', __('show less')); require_once FACETS_PLUGIN_DIR . '/helpers/FacetsFunctions.php'; @@ -18,6 +16,7 @@ class FacetsPlugin extends Omeka_Plugin_AbstractPlugin protected $_hooks = array( 'install', 'uninstall', + 'upgrade', 'initialize', 'config_form', 'config', @@ -41,22 +40,15 @@ public function hookInstall() set_option('facets_checkbox_minimum_amount', FACETS_MINIMUM_AMOUNT); $defaults = array( - 'elements' => array('item', 'collection', 'type', 'sort', 'popularity') + 'elements' => array('item', 'collection', 'style', 'sort', 'popularity'), + 'item_types' => array('item', 'style', 'sort', 'popularity'), + 'collections' => array('item', 'style', 'sort', 'popularity'), + 'tags' => array('item', 'style', 'sort', 'popularity'), + 'users' => array('item', 'collection', 'style', 'sort', 'popularity'), + 'public' => array('item', 'collection', 'style', 'sort', 'popularity'), + 'featured' => array('item', 'collection', 'style', 'sort', 'popularity') ); - set_option('facets_elements', json_encode($defaults)); - - set_option('facets_item_types_active', 0); - set_option('facets_item_types_style', ''); - set_option('facets_item_types_sort', ''); - set_option('facets_item_types_popularity', 0); - set_option('facets_collections_active', 1); - set_option('facets_collections_style', ''); - set_option('facets_collections_sort', 'count_alpha'); - set_option('facets_collections_popularity', 1); - set_option('facets_tags_active', 0); - set_option('facets_tags_style', ''); - set_option('facets_tags_sort', ''); - set_option('facets_tags_popularity', 0); + set_option('facets_parameters', json_encode($defaults)); } /** @@ -70,19 +62,48 @@ public function hookUninstall() delete_option('facets_direction'); delete_option('facets_collapsible'); delete_option('facets_checkbox_minimum_amount'); - delete_option('facets_elements'); - delete_option('facets_item_types_active'); - delete_option('facets_item_types_style'); - delete_option('facets_item_types_sort'); - delete_option('facets_item_types_popularity'); - delete_option('facets_collections_active'); - delete_option('facets_collections_style'); - delete_option('facets_collections_sort'); - delete_option('facets_collections_popularity'); - delete_option('facets_tags_active'); - delete_option('facets_tags_style'); - delete_option('facets_tags_sort'); - delete_option('facets_tags_popularity'); + delete_option('facets_parameters'); + } + + public function hookUpgrade() + { + $oldVersion = $args['old_version']; + $newVersion = $args['new_version']; + + if (version_compare($oldVersion, '2.5', '<')) { + $parameters = json_decode(str_replace('type', 'style', get_option('facets_elements')), true); + + $parameters['item_types']['item'] = get_option('facets_item_types_active'); + $parameters['item_types']['style'] = get_option('facets_item_types_style'); + $parameters['item_types']['sort'] = get_option('facets_item_types_sort'); + $parameters['item_types']['popularity'] = get_option('facets_item_types_popularity'); + $parameters['collections']['item'] = get_option('facets_collections_active'); + $parameters['collections']['style'] = get_option('facets_collections_style'); + $parameters['collections']['sort'] = get_option('facets_collections_sort'); + $parameters['collections']['popularity'] = get_option('facets_collections_popularity'); + $parameters['tags']['item'] = get_option('facets_tags_active'); + $parameters['tags']['style'] = get_option('facets_tags_style'); + $parameters['tags']['sort'] = get_option('facets_tags_sort'); + $parameters['tags']['popularity'] = get_option('facets_tags_popularity'); + $parameters['users'] = array('item', 'collection', 'style', 'sort', 'popularity'); + $parameters['public'] = array('item', 'collection', 'style', 'sort', 'popularity'); + $parameters['featured'] = array('item', 'collection', 'style', 'sort', 'popularity'); + set_option('facets_parameters', json_encode($parameters)); + + delete_option('facets_elements'); + delete_option('facets_item_types_active'); + delete_option('facets_item_types_style'); + delete_option('facets_item_types_sort'); + delete_option('facets_item_types_popularity'); + delete_option('facets_collections_active'); + delete_option('facets_collections_style'); + delete_option('facets_collections_sort'); + delete_option('facets_collections_popularity'); + delete_option('facets_tags_active'); + delete_option('facets_tags_style'); + delete_option('facets_tags_sort'); + delete_option('facets_tags_popularity'); + } } /** @@ -94,7 +115,7 @@ public function hookInitialize() get_view()->addHelperPath(dirname(__FILE__) . '/views/helpers', 'Facets_View_Helper_'); - $settings = json_decode(get_option('facets_elements'), true); + $settings = json_decode(get_option('facets_parameters'), true); $this->_settings = $settings; } @@ -130,22 +151,15 @@ public function hookConfig($args) set_option('facets_checkbox_minimum_amount', $post['facets_checkbox_minimum_amount']); $settings = array( - 'elements' => isset($post['elements']) ? $post['elements'] : array() + 'elements' => isset($post['elements']) ? $post['elements'] : array(), + 'item_types' => isset($post['item_types']) ? $post['item_types'] : array(), + 'collections' => isset($post['collections']) ? $post['collections'] : array(), + 'tags' => isset($post['tags']) ? $post['tags'] : array(), + 'users' => isset($post['users']) ? $post['users'] : array(), + 'public' => isset($post['public']) ? $post['public'] : array(), + 'featured' => isset($post['featured']) ? $post['featured'] : array() ); - set_option('facets_elements', json_encode($settings)); - - set_option('facets_item_types_active', $post['facets_item_types_active']); - set_option('facets_item_types_style', $post['facets_item_types_style']); - set_option('facets_item_types_sort', $post['facets_item_types_sort']); - set_option('facets_item_types_popularity', $post['facets_item_types_popularity']); - set_option('facets_collections_active', $post['facets_collections_active']); - set_option('facets_collections_style', $post['facets_collections_style']); - set_option('facets_collections_sort', $post['facets_collections_sort']); - set_option('facets_collections_popularity', $post['facets_collections_popularity']); - set_option('facets_tags_active', $post['facets_tags_active']); - set_option('facets_tags_style', $post['facets_tags_style']); - set_option('facets_tags_sort', $post['facets_tags_sort']); - set_option('facets_tags_popularity', $post['facets_tags_popularity']); + set_option('facets_parameters', json_encode($settings)); } /** @@ -261,8 +275,8 @@ public function hookPublicHead($args) if (($action == 'browse' && ($controller == 'items' || $controller == 'collections')) || ($controller == 'search' && $action == 'index')) { $language = array( - 'ShowMore' => FACETS_SHOW_MORE, - 'ShowLess' => FACETS_SHOW_LESS + 'ShowMore' => __('show more'), + 'ShowLess' => __('show less') ); $language = json_encode($language); queue_js_string("facetsLanguage = {language: $language};"); @@ -306,7 +320,11 @@ public function showFacets($args) 'advanced' => (isset($_GET['advanced']) ? $_GET['advanced'] : ''), 'collection' => (isset($_GET['collection']) ? $_GET['collection'] : ''), 'type' => (isset($_GET['type']) ? $_GET['type'] : ''), - 'tags' => (isset($_GET['tags']) ? $_GET['tags'] : '') + 'tags' => (isset($_GET['tags']) ? $_GET['tags'] : ''), + 'user' => (isset($_GET['user']) ? $_GET['user'] : ''), + 'public' => (isset($_GET['public']) ? $_GET['public'] : ''), + 'featured' => (isset($_GET['featured']) ? $_GET['featured'] : '') + ); if (recordTypeActive('item', $settings['elements']) && count(get_records('item', $params, null)) > 0) { @@ -317,7 +335,10 @@ public function showFacets($args) } } elseif ($controller == 'collections' && $action == 'browse') { $params = array( - 'advanced' => (isset($_GET['advanced']) ? $_GET['advanced'] : '') + 'advanced' => (isset($_GET['advanced']) ? $_GET['advanced'] : ''), + 'user' => (isset($_GET['user']) ? $_GET['user'] : ''), + 'public' => (isset($_GET['public']) ? $_GET['public'] : ''), + 'featured' => (isset($_GET['featured']) ? $_GET['featured'] : '') ); if (recordTypeActive('collection', $settings['elements']) && count(get_records('collection', $params, null)) > 0) { echo get_view()->partial('facets/browse.php', array( From 00ed1f2d5880cffd9a1eda0f8a5b52d398b1f5ff Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Tue, 20 Jul 2021 09:36:54 +0200 Subject: [PATCH 127/161] Added new options, compacted code --- views/public/facets/browse.php | 139 ++++++++++++++++++--------------- 1 file changed, 74 insertions(+), 65 deletions(-) diff --git a/views/public/facets/browse.php b/views/public/facets/browse.php index 1f5ac31..ecb9f36 100644 --- a/views/public/facets/browse.php +++ b/views/public/facets/browse.php @@ -1,5 +1,5 @@ > name, $facetsElements)) { - $isDate = in_array($element->name, $dateFields); - $facetElement = $facetsElements['elements'][$element->name]; - if (isset($facetElement['type']) && $facetElement['type'] == 'checkbox') { - $html = get_element_facet_checkboxes('collection', $subsetSQL, $element->id, $isDate, $hideSingleEntries, (isset($facetElement['sort']) ? $facetElement['sort'] : ''), (isset($facetElement['popularity']) ? $facetElement['popularity'] : ''), $checkboxMinCount); - } else { - $html = get_element_facet_select('collection', $subsetSQL, $element->id, $isDate, $hideSingleEntries, (isset($facetElement['sort']) ? $facetElement['sort'] : ''), (isset($facetElement['popularity']) ? $facetElement['popularity'] : '')); - } - if ($html != '') { - echo "
id . "\" class=\"facets-container-" . $facetsDirection . "\">\n"; - echo "\n"; - echo $html . "\n"; - echo "
\n"; - } - } - } - } else { - foreach ($elements as $element) { - if (isFacetActive($recordType, $element->name, $facetsElements)) { - $isDate = in_array($element->name, $dateFields); - $facetElement = $facetsElements['elements'][$element->name]; - if (isset($facetElement['type']) && $facetElement['type'] == 'checkbox') { - $html = get_element_facet_checkboxes('item', $subsetSQL, $element->id, $isDate, $hideSingleEntries, (isset($facetElement['sort']) ? $facetElement['sort'] : ''), (isset($facetElement['popularity']) ? $facetElement['popularity'] : ''), $checkboxMinCount); - } else { - $html = get_element_facet_select('item', $subsetSQL, $element->id, $isDate, $hideSingleEntries, (isset($facetElement['sort']) ? $facetElement['sort'] : ''), (isset($facetElement['popularity']) ? $facetElement['popularity'] : '')); - } - if ($html != '') { - echo "
id . "\" class=\"facets-container-" . $facetsDirection . "\">\n"; - echo "\n"; - echo $html . "\n"; - echo "
\n"; - } + // Elements + foreach ($elements as $element) { + if (isFacetActive($recordType, $element->name, $facetParameters)) { + $isDate = in_array($element->name, $dateFields); + $facetParameter = $facetParameters['elements'][$element->name]; + if (isset($facetParameter['style']) && $facetParameter['style'] == 'checkbox') { + $html = getFacetCheckboxesForElement($recordType, $subsetSQL, $element->id, $isDate, $hideSingleEntries, (isset($facetParameter['sort']) ? $facetParameter['sort'] : ''), (isset($facetParameter['popularity']) ? $facetParameter['popularity'] : ''), $checkboxMinCount); + } else { + $html = getFacetSelectForElement($recordType, $subsetSQL, $element->id, $isDate, $hideSingleEntries, (isset($facetParameter['sort']) ? $facetParameter['sort'] : ''), (isset($facetParameter['popularity']) ? $facetParameter['popularity'] : '')); } + + if ($html != '') printHtml($html, $element->id, $facetsDirection, $element->name); } + } - if ((bool)get_option('facets_item_types_active')) { - if (get_option('facets_item_types_style') == 'checkbox') { - $html = get_item_types_facet_checkboxes($subsetSQL, $hideSingleEntries, get_option('facets_item_types_sort'), get_option('facets_item_types_popularity'), $checkboxMinCount); + if ($recordType == 'item') { + // Collections (only for items) + if (isFacetActive($recordType, null, $facetParameters, 'item_types')) { + $facetParameter = $facetParameters['item_types']; + if (isset($facetParameter['style']) && $facetParameter['style'] == 'checkbox') { + $html = getFacetCheckboxesForItemType($subsetSQL, $hideSingleEntries, (isset($facetParameter['sort']) ? $facetParameter['sort'] : ''), (isset($facetParameter['popularity']) ? $facetParameter['popularity'] : ''), $checkboxMinCount); } else { - $html = get_item_types_facet_select($subsetSQL, $hideSingleEntries, get_option('facets_item_types_sort'), get_option('facets_item_types_popularity')); - } - if ($html != '') { - echo "
\n"; - echo "\n"; - echo $html . "\n"; - echo "
\n"; + $html = getFacetSelectForItemType($subsetSQL, $hideSingleEntries, (isset($facetParameter['sort']) ? $facetParameter['sort'] : ''), (isset($facetParameter['popularity']) ? $facetParameter['popularity'] : '')); } + + if ($html != '') printHtml($html, 'item-type', $facetsDirection, 'Item Type'); } - if ((bool)get_option('facets_collections_active')) { - if (get_option('facets_collections_style') == 'checkbox') { - $html = get_collections_facet_checkboxes($subsetSQL, $hideSingleEntries, get_option('facets_collections_sort'), get_option('facets_collections_popularity'), $checkboxMinCount); + // Item Type (only for items) + if (isFacetActive($recordType, null, $facetParameters, 'collections')) { + $facetParameter = $facetParameters['collections']; + if (isset($facetParameter['style']) && $facetParameter['style'] == 'checkbox') { + $html = getFacetCheckboxesForCollection($subsetSQL, $hideSingleEntries, (isset($facetParameter['sort']) ? $facetParameter['sort'] : ''), (isset($facetParameter['popularity']) ? $facetParameter['popularity'] : ''), $checkboxMinCount); } else { - $html = get_collections_facet_select($subsetSQL, $hideSingleEntries, get_option('facets_collections_sort'), get_option('facets_collections_popularity')); - } - if ($html != '') { - echo "
\n"; - echo "\n"; - echo $html . "\n"; - echo "
\n"; + $html = getFacetSelectForCollection($subsetSQL, $hideSingleEntries, (isset($facetParameter['sort']) ? $facetParameter['sort'] : ''), (isset($facetParameter['popularity']) ? $facetParameter['popularity'] : '')); } + + if ($html != '') printHtml($html, 'collection', $facetsDirection, 'Collection'); } - if ((bool)get_option('facets_tags_active')) { - if (get_option('facets_tags_style') == 'checkbox') { - $html = get_tags_facet_checkboxes($subsetSQL, $hideSingleEntries, get_option('facets_tags_sort'), get_option('facets_tags_popularity'), $checkboxMinCount); + // Tags (only for items) + if (isFacetActive($recordType, null, $facetParameters, 'tags')) { + $facetParameter = $facetParameters['tags']; + if (isset($facetParameter['style']) && $facetParameter['style'] == 'checkbox') { + $html = getFacetCheckboxesForTag($subsetSQL, $hideSingleEntries, (isset($facetParameter['sort']) ? $facetParameter['sort'] : ''), (isset($facetParameter['popularity']) ? $facetParameter['popularity'] : ''), $checkboxMinCount); } else { - $html = get_tags_facet_select($subsetSQL, $hideSingleEntries, get_option('facets_tags_sort'), get_option('facets_tags_popularity')); - } - if ($html != '') { - echo "
\n"; - echo "\n"; - echo $html . "\n"; - echo "
\n"; + $html = getFacetSelectForTag($subsetSQL, $hideSingleEntries, (isset($facetParameter['sort']) ? $facetParameter['sort'] : ''), (isset($facetParameter['popularity']) ? $facetParameter['popularity'] : '')); } + + if ($html != '') printHtml($html, 'tags', $facetsDirection, 'Tag'); + } + } + + // Users + if (isFacetActive($recordType, null, $facetParameters, 'users')) { + $facetParameter = $facetParameters['users']; + if (isset($facetParameter['style']) && $facetParameter['style'] == 'checkbox') { + $html = getFacetCheckboxesForUser($recordType, $subsetSQL, $hideSingleEntries, (isset($facetParameter['sort']) ? $facetParameter['sort'] : ''), (isset($facetParameter['popularity']) ? $facetParameter['popularity'] : ''), $checkboxMinCount); + } else { + $html = getFacetSelectForUser($recordType, $subsetSQL, $hideSingleEntries, (isset($facetParameter['sort']) ? $facetParameter['sort'] : ''), (isset($facetParameter['popularity']) ? $facetParameter['popularity'] : '')); + } + + if ($html != '') printHtml($html, 'user', $facetsDirection, 'Owner'); + } + + // Public + if (isFacetActive($recordType, null, $facetParameters, 'public')) { + $facetParameter = $facetParameters['public']; + if (isset($facetParameter['style']) && $facetParameter['style'] == 'checkbox') { + $html = getFacetCheckboxesForExtra($recordType, $subsetSQL, 'public', $hideSingleEntries, (isset($facetParameter['sort']) ? $facetParameter['sort'] : ''), (isset($facetParameter['popularity']) ? $facetParameter['popularity'] : ''), $checkboxMinCount); + } else { + $html = getFacetSelectForExtra($recordType, $subsetSQL, 'public', $hideSingleEntries, (isset($facetParameter['sort']) ? $facetParameter['sort'] : ''), (isset($facetParameter['popularity']) ? $facetParameter['popularity'] : '')); } + + if ($html != '') printHtml($html, 'public', $facetsDirection, 'Public'); + } + + // Featured + if (isFacetActive($recordType, null, $facetParameters, 'featured')) { + $facetParameter = $facetParameters['featured']; + if (isset($facetParameter['style']) && $facetParameter['style'] == 'checkbox') { + $html = getFacetCheckboxesForExtra($recordType, $subsetSQL, 'featured', $hideSingleEntries, (isset($facetParameter['sort']) ? $facetParameter['sort'] : ''), (isset($facetParameter['popularity']) ? $facetParameter['popularity'] : ''), $checkboxMinCount); + } else { + $html = getFacetSelectForExtra($recordType, $subsetSQL, 'featured', $hideSingleEntries, (isset($facetParameter['sort']) ? $facetParameter['sort'] : ''), (isset($facetParameter['popularity']) ? $facetParameter['popularity'] : '')); + } + + if ($html != '') printHtml($html, 'featured', $facetsDirection, 'Featured'); } ?> From b8ab4a47808d79b6c78a1f730720b60f5071cc2c Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Tue, 20 Jul 2021 09:37:41 +0200 Subject: [PATCH 128/161] Added new options --- helpers/FacetsFunctions.php | 403 +++++++++++++++++++++++++++++++++--- 1 file changed, 376 insertions(+), 27 deletions(-) diff --git a/helpers/FacetsFunctions.php b/helpers/FacetsFunctions.php index f5b76a7..8c73a08 100644 --- a/helpers/FacetsFunctions.php +++ b/helpers/FacetsFunctions.php @@ -4,12 +4,300 @@ */ /** - * Return list of objects associated to collection. + * Return list of objects associated to extra parameters (public, featured). + * + * @param subsetSQL + * @return objects + */ + function getObjectsForExtra($recordType, $subsetSQL, $extraType, $sortOrder) { + // Create Where clause + $whereSubset = createWhereSubsetClause($recordType, $subsetSQL); + + // Define Order By clause + if ($sortOrder == 'count_alpha') { + $orderBy = 'count DESC, ' . $extraType . ' DESC'; + } else { + $orderBy = $extraType . ' DESC'; + } + + // Get the database. + $db = get_db(); + // Get the table. + $table = $db->getTable($recordType); + // Build the select query. + $subQuery = $table->getSelect(); + $subQuery->where($whereSubset); + + $select = "SELECT `" . $extraType . "`, COUNT(id) AS count FROM (" . $subQuery . ") foo GROUP BY `" . $extraType . "` ORDER BY " . $orderBy; + + return $table->fetchObjects($select); + } + + /** + * Return HTML Select associated with Array of facets extra parameter values. + * + * @param recordType + * @param subsetSQL + * @param extraType + * @param hideSingleEntries + * @param sortOrder + * @param showPopularity + * @return html. + */ + function getFacetSelectForExtra($recordType, $subsetSQL, $extraType, $hideSingleEntries = false, $sortOrder = 'count_alpha', $showPopularity = false) { + if ($extras = getObjectsForExtra($recordType, $subsetSQL, $extraType, $sortOrder)) { + // Build array + $facetExtras = buildExtrasArray($extras, $extraType); + + // Stores data for selected extra, if any + $selectedExtra = getSelectedExtra($facetExtras, $extraType); + + // Remove single entries if required + if ($hideSingleEntries && count(array_filter($facetExtras, 'isNotSingleExtra')) > FACETS_MINIMUM_AMOUNT) { + $facetExtras = array_filter($facetExtras, "isNotSingleExtra"); + } + + $addOptions = false; + // Build first part of the select tag + if (isset($selectedExtra)) { + $html = "
"; + $html .= ""; + $addOptions = true; + } + + // Build additional part of the select tag (if needed) + if ($addOptions) { + foreach ($facetExtras as $value => $count) { + $html .= ""; + } + } + $html .= "
"; + } else { + $html = false; + } + + return $html; + } + + /** + * Return HTML Checkboxes associated with Array of facets extra parametervalues. + * + * @param recordType + * @param subsetSQL + * @param extraType + * @param hideSingleEntries + * @param sortOrder + * @param showPopularity + * @param limitCheckboxes + * @return html + */ + function getFacetCheckboxesForExtra($recordType, $subsetSQL, $extraType, $hideSingleEntries = false, $sortOrder = 'count_alpha', $showPopularity = false, $limitCheckboxes = 0) { + if ($extras = getObjectsForExtra($recordType, $subsetSQL, $extraType, $sortOrder)) { + // Build array + $facetExtras = buildExtrasArray($extras, $extraType); + + // Stores data for selected extra, if any + $selectedExtra = getSelectedExtra($facetExtras, $extraType); + + // Remove single entries if required + if ($hideSingleEntries && count(array_filter($facetExtras, 'isNotSingleExtra')) > FACETS_MINIMUM_AMOUNT) { + $facetExtras = array_filter($facetExtras, "isNotSingleExtra"); + } + + $countCheckboxes = 0; + $html = '
'; + // Build first part of the checkboxes tag + if (isset($selectedExtra)) { + $url = getFieldUrl($extraType, null, $selectedExtra); + $html .= "
" . html_escape(__(getExtraName($extraType, $selectedExtra))) . "
"; + $countCheckboxes++; + } + + $hidingSeparator = false; + // Build additional part of the select tag (if needed) + foreach ($facetExtras as $value => $count) { + if (!isset($selectedExtra) || $value <> $selectedExtra) { + if ($limitCheckboxes != 0 && $countCheckboxes >= $limitCheckboxes && !$hidingSeparator) { + // Add link to show other values + $html .= "
"; + $hidingSeparator = true; + } + + $url = getFieldUrl($extraType, $value); + $html .= "
" . html_escape(__(getExtraName($extraType, $value))) . ($showPopularity ? " (" . $count . ")" : "") . "
"; + $countCheckboxes++; + } + } + + if ($hidingSeparator) { + $html .= "
"; + $html .= "" . __('show more') . ""; + } + + $html .= "
"; + } else { + $html = false; + } + + return $html; + } + + /** + * Return list of objects associated to extra parameters (user, public, featured). + * + * @param subsetSQL + * @return objects + */ + function getObjectsForUser($recordType, $subsetSQL, $sortOrder) { + // Create Where clause + $whereSubset = createWhereSubsetClause($recordType, $subsetSQL); + + // Define Order By clause + if ($sortOrder == 'count_alpha') { + $orderBy = array('count DESC', 'name ASC'); + } else { + $orderBy = array('name ASC'); + } + + // Get the database. + $db = get_db(); + // Get the table. + $table = $db->getTable('User'); + // Build the select query. + $select = $table->getSelect(); + $select->columns('COUNT(users.id) AS count'); + if ($recordType == 'item') { + $select->joinInner(array('items' => $db->Item), 'users.id = items.owner_id', array()); + } else { + $select->joinInner(array('collections' => $db->Collection), 'users.id = collections.owner_id', array()); + } + $select->where($whereSubset); + $select->group('users.id'); + $select->order($orderBy); + + return $table->fetchObjects($select); + } + + /** + * Return HTML Select associated with Array of facets extra parameter values. + * + * @param subsetSQL + * @param hideSingleEntries + * @param sortOrder + * @param showPopularity + * @return html. + */ + function getFacetSelectForUser($recordType, $subsetSQL, $hideSingleEntries = false, $sortOrder = 'count_alpha', $showPopularity = false) { + if ($users = getObjectsForUser($recordType, $subsetSQL, $sortOrder)) { + // Build array + $facetUsers = buildUsersArray($users); + + // Stores data for selected user, if any + $selectedUser = getSelectedUser($facetUsers); + + // Remove single entries if required + if ($hideSingleEntries && count(array_filter($facetUsers, 'isNotSingleExtra')) > FACETS_MINIMUM_AMOUNT) { + $facetUsers = array_filter($facetUsers, "isNotSingleExtra"); + } + + $addOptions = false; + // Build first part of the select tag + if (isset($selectedUser)) { + $html = "
"; + $html .= ""; + $addOptions = true; + } + + // Build additional part of the select tag (if needed) + if ($addOptions) { + foreach ($facetUsers as $user) { + $html .= ""; + } + } + $html .= "
"; + } else { + $html = false; + } + + return $html; + } + + /** + * Return HTML Checkboxes associated with Array of facets values. + * + * @param subsetSQL + * @param hideSingleEntries + * @param sortOrder + * @param showPopularity + * @param limitCheckboxes + * @return html + */ + function getFacetCheckboxesForUser($recordType, $subsetSQL, $hideSingleEntries = false, $sortOrder = 'count_alpha', $showPopularity = false, $limitCheckboxes = 0) { + if ($users = getObjectsForUser($recordType, $subsetSQL, $sortOrder)) { + // Build array + $facetUsers = buildUsersArray($users); + + // Store data for selected user, if any + $selectedUser = getSelectedUser($facetUsers); + + // Remove single entries if required + if ($hideSingleEntries && count(array_filter($facetUsers, 'isNotSingleExtra')) > FACETS_MINIMUM_AMOUNT) { + $facetUsers = array_filter($facetUsers, "isNotSingleExtra"); + } + + $countCheckboxes = 0; + $html = '
'; + // Build first part of the checkboxes tag + if (isset($selectedUser)) { + $url = getFieldUrl('user', null, $selectedUser); + $html .= "
" . html_escape($selectedUser['name']) . "
"; + $countCheckboxes++; + } + + $hidingSeparator = false; + // Build additional part of the select tag (if needed) + foreach ($facetUsers as $user) { + if ($user != $selectedUser) { + if ($limitCheckboxes != 0 && $countCheckboxes >= $limitCheckboxes && !$hidingSeparator) { + // Add link to show other values + $html .= "
"; + $hidingSeparator = true; + } + + $url = getFieldUrl('user', $user['id']); + $html .= "
" . html_escape($user['name']) . ($showPopularity ? " (" . $user['count'] . ")" : "") . "
"; + $countCheckboxes++; + } + } + + if ($hidingSeparator) { + $html .= "
"; + $html .= "" . __('show more') . ""; + } + + $html .= "
"; + } else { + $html = false; + } + + return $html; + } + + /** + * Return list of objects associated to tag. * * @param subsetSQL * @return objects */ - function get_objects_for_tags($subsetSQL, $sortOrder) { + function getObjectsForTag($subsetSQL, $sortOrder) { // Create Where clause $whereSubset = createWhereSubsetClause('item', $subsetSQL); @@ -42,8 +330,8 @@ function get_objects_for_tags($subsetSQL, $sortOrder) { * @param showPopularity * @return html. */ - function get_tags_facet_select($subsetSQL, $hideSingleEntries = false, $sortOrder = 'count_alpha', $showPopularity = false) { - if ($tags = get_objects_for_tags($subsetSQL, $sortOrder)) { + function getFacetSelectForTag($subsetSQL, $hideSingleEntries = false, $sortOrder = 'count_alpha', $showPopularity = false) { + if ($tags = getObjectsForTag($subsetSQL, $sortOrder)) { // Build array $facetTags = buildTagsArray($tags); @@ -90,8 +378,8 @@ function get_tags_facet_select($subsetSQL, $hideSingleEntries = false, $sortOrde * @param showPopularity * @return html. */ - function get_tags_facet_checkboxes($subsetSQL, $hideSingleEntries = false, $sortOrder = 'count_alpha', $showPopularity = false, $limitCheckboxes = 0) { - if ($tags = get_objects_for_tags($subsetSQL, $sortOrder)) { + function getFacetCheckboxesForTag($subsetSQL, $hideSingleEntries = false, $sortOrder = 'count_alpha', $showPopularity = false, $limitCheckboxes = 0) { + if ($tags = getObjectsForTag($subsetSQL, $sortOrder)) { // Build array $facetTags = buildTagsArray($tags); @@ -134,7 +422,7 @@ function get_tags_facet_checkboxes($subsetSQL, $hideSingleEntries = false, $sort if ($hidingSeparator) { $html .= "
"; - $html .= "" . FACETS_SHOW_MORE . ""; + $html .= "" . __('show more') . ""; } $html .= "
"; @@ -151,7 +439,7 @@ function get_tags_facet_checkboxes($subsetSQL, $hideSingleEntries = false, $sort * @param subsetSQL * @return objects */ - function get_objects_for_collection($subsetSQL) { + function getObjectsForCollection($subsetSQL) { // Create Where clause $whereSubset = createWhereSubsetClause('item', $subsetSQL); @@ -178,8 +466,8 @@ function get_objects_for_collection($subsetSQL) { * @param showPopularity * @return html. */ - function get_collections_facet_select($subsetSQL, $hideSingleEntries = false, $sortOrder = 'count_alpha', $showPopularity = false) { - if ($collections = get_objects_for_collection($subsetSQL, $sortOrder)) { + function getFacetSelectForCollection($subsetSQL, $hideSingleEntries = false, $sortOrder = 'count_alpha', $showPopularity = false) { + if ($collections = getObjectsForCollection($subsetSQL, $sortOrder)) { // Build array $facetCollections = buildCollectionsArray($collections); @@ -230,8 +518,8 @@ function get_collections_facet_select($subsetSQL, $hideSingleEntries = false, $s * @param limitCheckboxes * @return html */ - function get_collections_facet_checkboxes($subsetSQL, $hideSingleEntries = false, $sortOrder = 'count_alpha', $showPopularity = false, $limitCheckboxes = 0) { - if ($collections = get_objects_for_collection($subsetSQL, $sortOrder)) { + function getFacetCheckboxesForCollection($subsetSQL, $hideSingleEntries = false, $sortOrder = 'count_alpha', $showPopularity = false, $limitCheckboxes = 0) { + if ($collections = getObjectsForCollection($subsetSQL, $sortOrder)) { // Build array $facetCollections = buildCollectionsArray($collections); @@ -273,7 +561,7 @@ function get_collections_facet_checkboxes($subsetSQL, $hideSingleEntries = false if ($hidingSeparator) { $html .= "
"; - $html .= "" . FACETS_SHOW_MORE . ""; + $html .= "" . __('show more') . ""; } $html .= ""; @@ -291,7 +579,7 @@ function get_collections_facet_checkboxes($subsetSQL, $hideSingleEntries = false * @param sortOrder * @return objects */ - function get_objects_for_item_type($subsetSQL, $sortOrder) { + function getObjectsForItemType($subsetSQL, $sortOrder) { // Create Where Subset clause $whereSubset = createWhereSubsetClause('item', $subsetSQL); @@ -326,8 +614,8 @@ function get_objects_for_item_type($subsetSQL, $sortOrder) { * @param showPopularity * @return html. */ - function get_item_types_facet_select($subsetSQL, $hideSingleEntries = false, $sortOrder = 'count_alpha', $showPopularity = false) { - if ($itemTypes = get_objects_for_item_type($subsetSQL, $sortOrder)) { + function getFacetSelectForItemType($subsetSQL, $hideSingleEntries = false, $sortOrder = 'count_alpha', $showPopularity = false) { + if ($itemTypes = getObjectsForItemType($subsetSQL, $sortOrder)) { // Build array $facetItemTypes = buildItemTypesArray($itemTypes); @@ -374,8 +662,8 @@ function get_item_types_facet_select($subsetSQL, $hideSingleEntries = false, $so * @param showPopularity * @return html. */ - function get_item_types_facet_checkboxes($subsetSQL, $hideSingleEntries = false, $sortOrder = 'count_alpha', $showPopularity = false, $limitCheckboxes = 0) { - if ($itemTypes = get_objects_for_item_type($subsetSQL, $sortOrder)) { + function getFacetCheckboxesForItemType($subsetSQL, $hideSingleEntries = false, $sortOrder = 'count_alpha', $showPopularity = false, $limitCheckboxes = 0) { + if ($itemTypes = getObjectsForItemType($subsetSQL, $sortOrder)) { // Build array $facetItemTypes = buildItemTypesArray($itemTypes); @@ -414,7 +702,7 @@ function get_item_types_facet_checkboxes($subsetSQL, $hideSingleEntries = false, if ($hidingSeparator) { $html .= ""; - $html .= "" . FACETS_SHOW_MORE . ""; + $html .= "" . __('show more') . ""; } $html .= ""; @@ -435,7 +723,7 @@ function get_item_types_facet_checkboxes($subsetSQL, $hideSingleEntries = false, * @param sortOrder * @return objects */ - function get_objects_for_element($recordType, $subsetSQL, $elementId, $isDate, $sortOrder) { + function getObjectsForElement($recordType, $subsetSQL, $elementId, $isDate, $sortOrder) { // Create Where clauses $whereRecordType = createWhereRecordTypeClause($recordType); $whereSubset = createWhereSubsetClause($recordType, $subsetSQL); @@ -497,9 +785,9 @@ function get_objects_for_element($recordType, $subsetSQL, $elementId, $isDate, $ * @param showPopularity * @return html */ - function get_element_facet_select($recordType, $subsetSQL, $elementId = 50, $isDate = false, $hideSingleEntries = false, $sortOrder = 'count_alpha', $showPopularity = false) { + function getFacetSelectForElement($recordType, $subsetSQL, $elementId = 50, $isDate = false, $hideSingleEntries = false, $sortOrder = 'count_alpha', $showPopularity = false) { // Build array - if ($elements = get_objects_for_element($recordType, $subsetSQL, $elementId, $isDate, $sortOrder)) { + if ($elements = getObjectsForElement($recordType, $subsetSQL, $elementId, $isDate, $sortOrder)) { $facetElement = array(); foreach ($elements as $element) { if ($isDate) { @@ -567,9 +855,9 @@ function get_element_facet_select($recordType, $subsetSQL, $elementId = 50, $isD * @param limitCheckboxes * @return html */ - function get_element_facet_checkboxes($recordType, $subsetSQL, $elementId = 50, $isDate = false, $hideSingleEntries = false, $sortOrder = 'count_alpha', $showPopularity = false, $limitCheckboxes = 0) { + function getFacetCheckboxesForelement($recordType, $subsetSQL, $elementId = 50, $isDate = false, $hideSingleEntries = false, $sortOrder = 'count_alpha', $showPopularity = false, $limitCheckboxes = 0) { // Build array - if ($elements = get_objects_for_element($recordType, $subsetSQL, $elementId, $isDate, $sortOrder)) { + if ($elements = getObjectsForElement($recordType, $subsetSQL, $elementId, $isDate, $sortOrder)) { $facetElement = array(); foreach ($elements as $element) { if ($isDate) { @@ -625,7 +913,7 @@ function get_element_facet_checkboxes($recordType, $subsetSQL, $elementId = 50, if ($hidingSeparator) { $html .= ""; - $html .= "" . FACETS_SHOW_MORE . ""; + $html .= "" . __('show more') . ""; } $html .= ""; @@ -778,8 +1066,12 @@ function getTagUrl($value = null) return 'browse?' . http_build_query($params); } - function isFacetActive($recordType, $element_name, $settings) { - if (isset($settings['elements'][$element_name][$recordType])) { + function isFacetActive($recordType, $element_name, $settings, $extra_name = null) { + if ($extra_name != '') { + if (isset($settings[$extra_name][$recordType])) { + return ((bool)$settings[$extra_name][$recordType]); + } + } elseif (isset($settings['elements'][$element_name][$recordType])) { return ((bool)$settings['elements'][$element_name][$recordType]); } return false; @@ -868,4 +1160,61 @@ function buildTagsArray($tags) { } return $facetTags; } + + function buildUsersArray($users) { + $facetUsers = array(); + foreach ($users as $user) { + $facetUsers[$user->id]['id'] = $user->id; + $facetUsers[$user->id]['name'] = $user->name; + $facetUsers[$user->id]['count'] = $user->count; + } + return $facetUsers; + } + + function getSelectedUser($users) { + if (isset($_GET['user'])) { + $user_id = $_GET['user']; + if (array_key_exists($user_id, $users)) { + return $users[$user_id]; + } + } + } + + function buildExtrasArray($extras, $extraType) { + $facetExtras = array(); + foreach ($extras as $extra) { + if ($extra->{$extraType}) { + $facetExtras[1] = $extra->count; + } else { + $facetExtras[0] = $extra->count; + } + } + return $facetExtras; + } + + function getSelectedExtra($extras, $extraType) { + if (isset($_GET[$extraType])) { + $extra = $_GET[$extraType]; + if (array_key_exists($extra, $extras)) { + return $extra; + } + } + } + + function getExtraName($extraType, $value) { + if ($value == 0) { + return "Not " . ucfirst($extraType); + } else { + return ucfirst($extraType); + } + } + + function printHtml($html, $key, $facetsDirection, $label) { + if ($html != '') { + echo "
\n"; + echo "\n"; + echo $html . "\n"; + echo "
\n"; + } + } ?> From 167fc7ef98037f2e9225dd77b29725162dec6471 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Tue, 20 Jul 2021 09:38:26 +0200 Subject: [PATCH 129/161] Update plugin.ini --- plugin.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.ini b/plugin.ini index 48b009e..8a055f7 100644 --- a/plugin.ini +++ b/plugin.ini @@ -5,6 +5,6 @@ description="Adds a faceted navigation block to narrow down Items and Collection license="GPLv3" link="https://github.com/DBinaghi/plugin-Facets" support_link="https://github.com/DBinaghi/plugin-Facets/issues" -version="2.5" +version="2.6" omeka_minimum_version="2.6.1" omeka_target_version="2.6.1" From 05c4b855656c3b71aa4a72d94790c8ff9dcf8520 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Tue, 20 Jul 2021 09:47:34 +0200 Subject: [PATCH 130/161] Updated strings --- languages/eo.po | 48 ++++++++++++++++++++++------------------- languages/it.mo | Bin 4320 -> 4425 bytes languages/it.po | 48 ++++++++++++++++++++++------------------- languages/template.pot | 44 ++++++++++++++++++++----------------- 4 files changed, 76 insertions(+), 64 deletions(-) diff --git a/languages/eo.po b/languages/eo.po index de2bfb0..c041a3b 100644 --- a/languages/eo.po +++ b/languages/eo.po @@ -117,8 +117,8 @@ msgstr "" #: config_form.php:110 msgid -"The elements that can be used for search refinement. Item and Collection columns to (de)activate, Style column to choose the facet style, " -"Sort order column to choose sorting order, Popularity column to show counters near names." +"The elements that can be used for search refinement. Item and Collection columns to (de)activate, Style column to " +"choose the facet style, Sort order column to choose sorting order, Popularity column to show counters near names." msgstr "" #: config_form.php:115 @@ -145,46 +145,50 @@ msgstr "" msgid "Popularity" msgstr "" -#: config_form.php:172 -#: config_form.php:233 -#: config_form.php:290 -#: config_form.php:347 +#: config_form.php:174 +#: config_form.php:262 msgid "Dropdown" msgstr "" -#: config_form.php:173 -#: config_form.php:234 -#: config_form.php:291 -#: config_form.php:348 +#: config_form.php:175 +#: config_form.php:263 msgid "Checkbox" msgstr "" -#: config_form.php:186 -#: config_form.php:246 -#: config_form.php:303 -#: config_form.php:360 +#: config_form.php:188 +#: config_form.php:276 msgid "Alphabetical" msgstr "" -#: config_form.php:187 -#: config_form.php:247 -#: config_form.php:303 -#: config_form.php:361 +#: config_form.php:189 +#: config_form.php:277 msgid "Popularity first, then alphabetical" msgstr "" -#: config_form.php:208 +#: config_form.php:210 msgid "Extra parameters" msgstr "" -#: config_form.php:212 +#: config_form.php:225 msgid "Item Types" msgstr "" -#: config_form.php:264 +#: config_form.php:225 msgid "Collections" msgstr "" -#: config_form.php:316 +#: config_form.php:225 msgid "Tags" +msgstr "" + +#: config_form.php:225 +msgid "Owners" +msgstr "" + +#: config_form.php:225 +msgid "Public" +msgstr "" + +#: config_form.php:225 +msgid "Featured" msgstr "" \ No newline at end of file diff --git a/languages/it.mo b/languages/it.mo index 4549dea6a500113d8da429734d949328d3dc0be6..8d3284f457f85700b04beae357f6440b90bea79f 100644 GIT binary patch delta 757 zcmYMyJxE(o6u|M5m>1i8SWT%8Dn^B(MYM~hMWHwp{J@XJMY_cJiYbybPopBmC+JW| zeRWehIEX@_@E9`@~fhD+!8sEkzxQ`+HjbY4tUU>iiN6j}19`a*YEMiN!7ihpN z3C;K%*RU10a2l_11SbL_49PR;g{N4Gm#77XjfZ#)YuQ(##@kQ}XvZk_-)oB`y@V_> zWRgiQn8x=wi~n#NlXPc|)9TrWd2MQvW^BQC_!M)VHZG7qk6LIsQz5>@7&c;*`=yPA zzCkZCwUu8{JMs;+@@3>q*}xa*qUP=3A|7HH4ioIb8T^5Jn86Hf&_e&9tp}g7 zsKHy*gW}wxHefZrMZItU8IokuH^^cU&Y>RYAWf1LZ@-G2?0;gEPF&+U2A_$%BL1sb zs_qXy=1b@zkVn1vHD4IDNNb7n+3ysZiLsnz4!Jk}BVVw0B5hiu&OzYKqH*qvyXVID sK)53v|1h2!GSgEDcP7;B4_TQnR>~YpSSe>W(q#1I1_wvntH@cw9Y8@`5C8xG delta 680 zcmYMxJxD@P6u|MLKGQ6v>}yB@iv}f!z!FL-K?o|G+M^^WdVSKAk=WW0^>U0_#U-$< zp`alGr$T5c!oejP8jFVh2OcEvz280eo%_zY*T??%aQ-c56oua)cZfUf&`88|{@coM zowy12upJAi^A>vX5`9?07QD8-v)@-y^J{io$2O6?d@$JN#V>Z?hD#)ghj@UuXySw+ z!X;%MTIdS9@y3pyaDey~wUEOt;>Un(2z3Kd)^Q)RoWcUx5#oD~ z2tCLrj^h_LV~lO92|OV`h1%FNlcdNS2C;$K$Tw=k9+EV#Po=&@80eA3QBPnBb-_I9 z(Jo;ZuHh*bum?L?l))jqz#ML3FWaY<9HD-%i2YbXty9G?zF=Mp{V>o@y#xX5Mg2e& zISh&0@fgk!r_s-jkFkX3EQ&He%^#`_@8B%vPzydFCFB_;Wp1r3E-mk_W*1FKS!L&8 gWz Date: Fri, 23 Jul 2021 12:40:30 +0200 Subject: [PATCH 131/161] Changed way to build $params array --- FacetsPlugin.php | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/FacetsPlugin.php b/FacetsPlugin.php index 6a3070c..a01fefe 100644 --- a/FacetsPlugin.php +++ b/FacetsPlugin.php @@ -314,19 +314,16 @@ public function showFacets($args) $request = Zend_Controller_Front::getInstance()->getRequest(); $controller = $request->getControllerName(); $action = $request->getActionName(); + $params = array(); if ($controller == 'items' && $action == 'browse') { - $params = array( - 'advanced' => (isset($_GET['advanced']) ? $_GET['advanced'] : ''), - 'collection' => (isset($_GET['collection']) ? $_GET['collection'] : ''), - 'type' => (isset($_GET['type']) ? $_GET['type'] : ''), - 'tags' => (isset($_GET['tags']) ? $_GET['tags'] : ''), - 'user' => (isset($_GET['user']) ? $_GET['user'] : ''), - 'public' => (isset($_GET['public']) ? $_GET['public'] : ''), - 'featured' => (isset($_GET['featured']) ? $_GET['featured'] : '') - - ); - + if (isset($_GET['advanced'])) $params['advanced'] = $_GET['advanced']; + if (isset($_GET['collection'])) $params['collection'] = $_GET['collection']; + if (isset($_GET['type'])) $params['type'] = $_GET['type']; + if (isset($_GET['tags'])) $params['tags'] = $_GET['tags']; + if (isset($_GET['user'])) $params['user'] = $_GET['user']; + if (isset($_GET['public'])) $params['public'] = $_GET['public']; + if (isset($_GET['featured'])) $params['featured'] = $_GET['featured']; if (recordTypeActive('item', $settings['elements']) && count(get_records('item', $params, null)) > 0) { echo get_view()->partial('facets/browse.php', array( 'params' => $params, @@ -334,12 +331,10 @@ public function showFacets($args) )); } } elseif ($controller == 'collections' && $action == 'browse') { - $params = array( - 'advanced' => (isset($_GET['advanced']) ? $_GET['advanced'] : ''), - 'user' => (isset($_GET['user']) ? $_GET['user'] : ''), - 'public' => (isset($_GET['public']) ? $_GET['public'] : ''), - 'featured' => (isset($_GET['featured']) ? $_GET['featured'] : '') - ); + if (isset($_GET['advanced'])) $params['advanced'] = $_GET['advanced']; + if (isset($_GET['user'])) $params['user'] = $_GET['user']; + if (isset($_GET['public'])) $params['public'] = $_GET['public']; + if (isset($_GET['featured'])) $params['featured'] = $_GET['featured']; if (recordTypeActive('collection', $settings['elements']) && count(get_records('collection', $params, null)) > 0) { echo get_view()->partial('facets/browse.php', array( 'params' => $params, From 8d5dc5563b9b7e2b617fc9958cda8cef3cd31b89 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Fri, 3 Sep 2021 09:24:46 +0200 Subject: [PATCH 132/161] Corrected typo --- config_form.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config_form.php b/config_form.php index ff2828b..08ef5bf 100644 --- a/config_form.php +++ b/config_form.php @@ -215,7 +215,7 @@ 'item_types' => array('label' => 'Item Types', 'collection' => 0), 'collections' => array('label' => 'Collections', 'collection' => 0), 'tags' => array('label' => 'Tags', 'collection' => 0), - 'users' => array('label' => 'Owners', 'collection' => 1), + 'users' => array('label' => 'Owner', 'collection' => 1), 'public' => array('label' => 'Public', 'collection' => 1), 'featured' => array('label' => 'Featured', 'collection' => 1) ); From ca6536752368d475e369e4b008f8a4cc5fb7eaa8 Mon Sep 17 00:00:00 2001 From: DBinaghi <39097246+DBinaghi@users.noreply.github.com> Date: Fri, 3 Sep 2021 09:27:57 +0200 Subject: [PATCH 133/161] Vertically centered table cells of first column --- config_form.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/config_form.php b/config_form.php index 08ef5bf..c6ac8cf 100644 --- a/config_form.php +++ b/config_form.php @@ -2,9 +2,11 @@ $view = get_view(); ?>