Book SP Customization

  • libraries/bookreader/BookReader/BookReader.css
div#BRpage {
    float: right;
-    width: 280px;
+    width: 300px;
    padding-left:12px;
    text-align: right;
}

NOTE required only by Islandora+IABRv1

  • modules/islandora_paged_content/islandora_paged_content.module

Hide pages in search results if option checked AND not fulltext search AND not dismax.

+      if ((strpos($islandora_solr_query->solrQuery, 'OCR_t') === false) AND ((strpos($islandora_solr_query->solrDefType, 'dismax') === false))){
        $fq = variable_get('islandora_paged_content_solr_fq', '-RELS_EXT_isPageOf_uri_ms:[* TO *]');
        if (!empty($fq)) {
                       $islandora_solr_query->solrParams['fq'][] = $fq;
        }
+      }


  • modules/islandora_solution_pack_book/islandora_book.module

Link advanced search result pages to bookreader with searched terms highlighted.

...
    if (islandora_object_access(ISLANDORA_VIEW_OBJECTS, islandora_object_load($book_pid))) {
      $search_results['object_url'] = "islandora/object/$book_pid";
-      $search_results['object_url_fragment'] = "page/$page_number/mode/1up";
+      $search_results['object_url_fragment'] = "page/$page_number/mode/2up";
 
      // XXX: Won't handle fielded searches nicely... then again, if our
      // highlighting field is not the one being search on, this makes sense?
 
 
      if ($query_processor->solrDefType == 'dismax' || $query_processor->solrDefType == 'edismax') {
        $search_results['object_url_fragment'] .= "/search/" . rawurlencode($query_processor->solrQuery);
+      } elseif ((strpos($query_processor->solrQuery,"OCR_t")) !== false) {
+        $solr_Query = $query_processor->solrQuery;
+        $words_searched = "";
+        if ((strpos($solr_Query,'OCR_t')) == 0) {
+                //first position
+                $words_searched = substr($solr_Query, strpos($solr_Query,'(')+1, strpos($solr_Query,')')-strpos($solr_Query,'(')-1);
+                $words_searched = str_replace(" ", "+", $words_searched);
+                $solr_Query = substr($solr_Query, strpos($solr_Query,')')+2);
+        }
+        find_words_recursive($solr_Query, $words_searched);
+        if ($words_searched != '') {
+                $search_results['object_url_fragment'] .= "/search/" . rawurlencode($words_searched);
+        }
      }
    }
...
+function find_words_recursive($solr_Query, &$words) {
+        $words_searched = "";
+        if ((((strpos($solr_Query,"AND OCR_t")) !== false) && ((strpos($solr_Query,"AND OCR_t")) == 0)) || (((strpos($solr_Query,"OR OCR_t")) !== false) && ((strpos($solr_Query,"OR OCR_t")) == 0))){
+                $words_searched = substr($solr_Query, strpos($solr_Query,'(')+1, strpos($solr_Query,')')-strpos($solr_Query,'(')-1);
+                $words_searched = str_replace(" ", "+", $words_searched);
+                if (strlen($words) > 0) {
+                        $words_searched = '+'.$words_searched;
+                }
+                $words = $words.$words_searched;
+        }
+        $solr_Query = substr($solr_Query, strpos($solr_Query,')')+2);
+        if ((strpos($solr_Query,"OCR_t")) !== false) {
+                find_words_recursive($solr_Query, $words);
+        }
+        return;
+}
...


  • modules/islandora/theme/theme.inc

Changes for custom CSS.

...
  $variables['display_links'] = array(
    array(
      'title' => t('Grid view'),
      'href' => current_path(),
      'attributes' => array(
        'class' => array(
-          $grid_display ? 'active' : '',
+          $grid_display ? 'yes' : 'no',
        ),
      ),
      'query' => array('display' => 'grid') + $query_params,
      'language' => $language_hack,
    ),
    array(
      'title' => t('List view'),
      'href' => current_path(),
      'attributes' => array(
        'class' => array(
-          $list_display ? 'active' : '',
+          $list_display ? 'yes' : 'no',
        ),
      ),
      'query' => array('display' => 'list') + $query_params,
      'language' => $language_hack,
    ),
...
 
 
isla7xh/ibcustom.txt ยท Last modified: 2017/07/31 17:01 by giancarlo

Developers: CNR IRCrES IT Office and Library
Giancarlo Birello (giancarlo.birello _@_ ircres.cnr.it) and Anna Perin (anna.perin _@_ ircres.cnr.it)
V2P2@TO.CNR is licensed under: Creative Commons License
Recent changes RSS feed Creative Commons License Valid XHTML 1.0 Valid CSS Driven by DokuWiki
Drupal Garland Theme for Dokuwiki