Index: images/grid.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: images\grid.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: images/list.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: images\list.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: interface/themes/classic/Search/list-grid.tpl =================================================================== --- interface/themes/classic/Search/list-grid.tpl (revision 0) +++ interface/themes/classic/Search/list-grid.tpl (revision 0) @@ -0,0 +1,22 @@ +
+ + + {foreach from=$recordSet item=record name="recordLoop"} + + {if (($smarty.foreach.recordLoop.iteration % 4) == 0) && (!$smarty.foreach.recordLoop.last)}{/if} + {/foreach} + +
{* This is raw HTML -- do not escape it: *}{$record}
+
+ + Index: interface/themes/classic/RecordDrivers/Index/result-grid.tpl =================================================================== --- interface/themes/classic/RecordDrivers/Index/result-grid.tpl (revision 0) +++ interface/themes/classic/RecordDrivers/Index/result-grid.tpl (revision 0) @@ -0,0 +1,46 @@ +
+ + + {if $summISBN} + {translate text='Cover Image'} + {else} + {translate text='No Cover Image'} + {/if} + + + + + {if !$summTitle}{translate text='Title not available'}{else}{$summTitle|truncate:80:"..."|highlight:$lookfor}{/if} + + {if $summOpenUrl || !empty($summURLs)} + {if $summOpenUrl} + {include file="Search/openurl.tpl" openUrl=$summOpenUrl} + {/if} + {foreach from=$summURLs key=recordurl item=urldesc} +
{if $recordurl == $urldesc}{translate text='Get full text'}{else}{$urldesc|escape}{/if} + {/foreach} + {else} + + {translate text='Loading'}... +
+ {/if} + + + +{if $summCOinS}{/if} + +{if $summAjaxStatus} + +{/if} +{if $showPreviews} + +{/if} Index: interface/themes/classic/RecordDrivers/Index/result-list.tpl =================================================================== --- interface/themes/classic/RecordDrivers/Index/result-list.tpl (revision 0) +++ interface/themes/classic/RecordDrivers/Index/result-list.tpl (revision 0) @@ -0,0 +1,102 @@ +
+
+ {if $summISBN} + {translate text='Cover Image'} + {else} + {translate text='No Cover Image'} + {/if} +
+ + +
+ {if !empty($summAuthor)} + {translate text='by'} + {$summAuthor|highlight:$lookfor} + {/if} + + {if $summDate}{translate text='Published'} {$summDate.0|escape}{/if} +
+ +
+ {if $summAjaxStatus} + {translate text='Call Number'}: {translate text='Loading'}
+ {translate text='Located'}: {translate text='Loading'} + {elseif !empty($summCallNo)} + {translate text='Call Number'}: {$summCallNo|escape} + {/if} + + {if $summOpenUrl || !empty($summURLs)} + {if $summOpenUrl} +
+ {include file="Search/openurl.tpl" openUrl=$summOpenUrl} + {/if} + {foreach from=$summURLs key=recordurl item=urldesc} +
{if $recordurl == $urldesc}{translate text='Get full text'}{else}{$urldesc|escape}{/if} + {/foreach} + {elseif $summAjaxStatus} +
+ {translate text='Loading'}... +
+ {/if} +
+ {foreach from=$summFormats item=format} + {translate text=$format} + {/foreach} +
+
+ +
+
+ {translate text='Add to favorites'} +
    + +
    + {if $showPreviews} + {if (!empty($summLCCN)|!empty($summISBN)|!empty($summOCLC))} + {if $showGBSPreviews} +
    + +
    + {/if} + {if $showOLPreviews} +
    + +
    + {/if} + {if $showHTPreviews} +
    + +
    + {/if} + {/if} + {/if} +
    +
    + +{if $summCOinS}{/if} + +{if $summAjaxStatus} + +{/if} +{if $showPreviews} + +{/if} Index: interface/themes/classic/RecordDrivers/Index/result.tpl =================================================================== --- interface/themes/classic/RecordDrivers/Index/result.tpl (revision 2979) +++ interface/themes/classic/RecordDrivers/Index/result.tpl (working copy) @@ -1,102 +0,0 @@ -
    -
    - {if $summISBN} - {translate text='Cover Image'} - {else} - {translate text='No Cover Image'} - {/if} -
    - - -
    - {if !empty($summAuthor)} - {translate text='by'} - {$summAuthor|highlight:$lookfor} - {/if} - - {if $summDate}{translate text='Published'} {$summDate.0|escape}{/if} -
    - -
    - {if $summAjaxStatus} - {translate text='Call Number'}: {translate text='Loading'}
    - {translate text='Located'}: {translate text='Loading'} - {elseif !empty($summCallNo)} - {translate text='Call Number'}: {$summCallNo|escape} - {/if} - - {if $summOpenUrl || !empty($summURLs)} - {if $summOpenUrl} -
    - {include file="Search/openurl.tpl" openUrl=$summOpenUrl} - {/if} - {foreach from=$summURLs key=recordurl item=urldesc} -
    {if $recordurl == $urldesc}{translate text='Get full text'}{else}{$urldesc|escape}{/if} - {/foreach} - {elseif $summAjaxStatus} -
    - {translate text='Loading'}... -
    - {/if} -
    - {foreach from=$summFormats item=format} - {translate text=$format} - {/foreach} -
    -
    - -
    -
    - {translate text='Add to favorites'} -
      - -
      - {if $showPreviews} - {if (!empty($summLCCN)|!empty($summISBN)|!empty($summOCLC))} - {if $showGBSPreviews} -
      - -
      - {/if} - {if $showOLPreviews} -
      - -
      - {/if} - {if $showHTPreviews} -
      - -
      - {/if} - {/if} - {/if} -
      -
      - -{if $summCOinS}{/if} - -{if $summAjaxStatus} - -{/if} -{if $showPreviews} - -{/if} Index: interface/themes/classic/css/styles.css =================================================================== --- interface/themes/classic/css/styles.css (revision 3010) +++ interface/themes/classic/css/styles.css (working copy) @@ -1089,3 +1089,31 @@ .alphaBrowseRelatedHeading li { margin-left: 4em; } +.gridRecordBox { + margin: 0px 3px 3px 3px; + padding: 5px 1px 3px 3px; +} + +.gridImageBox { + text-align:center; + width:155px; + height:130px; + overflow:hidden; + display:block; +} + +.gridImage{ + height:130px; +} + +.gridTitleBox { + height:55px; + display:block; + text-align:center; + font-size:86%; +} + +.gridTitle { + display:block; + height:40px; +} \ No newline at end of file Index: conf/searches.ini =================================================================== --- conf/searches.ini (revision 2961) +++ conf/searches.ini (working copy) @@ -8,6 +8,10 @@ ; below. default_sort = relevance +; This setting controls the default view for search results; the selected option +; should be one of the options present in the [Views] section below. +default_view = list + ; If this setting is true, boolean operators in searches (AND/OR/NOT) will only ; be recognized if they are ALL UPPERCASE. If set to false, they will be ; recognized regardless of case. @@ -89,6 +93,13 @@ [DefaultSortingByType] CallNumber = callnumber +; This section defines the view options available on standard search results. +; If only one view is required, set default_view under [General] above, and +; leave this section commented out. +[Views] +list = List +grid = Grid + ; Each search type defined in searchspecs.yaml can have one or more "recommendations ; modules" associated with it in the following sections. These plug-ins will cause ; boxes of suggestions to appear beside (in [SideRecommendations]) or above (in Index: sys/SearchObject/Base.php =================================================================== --- sys/SearchObject/Base.php (revision 2961) +++ sys/SearchObject/Base.php (working copy) @@ -32,6 +32,7 @@ // SEARCH PARAMETERS // RSS feed? protected $view = null; + protected $defaultView = 'list'; // Search terms protected $searchTerms = array(); // Sorting @@ -63,6 +64,8 @@ protected $defaultIndex = null; // Available sort options protected $sortOptions = array(); + // Available view options + protected $viewOptions = array(); // An ID number for saving/retrieving search protected $searchId = null; protected $savedSearch = false; @@ -486,10 +489,22 @@ */ protected function initView() { - //******************** - // RSS feed? We should only see this in GET from a url. - if (isset($_REQUEST['view']) && ($_REQUEST['view'] == 'rss')) { - $this->view = 'rss'; + // Check for a view parameter in the url. + if (isset($_REQUEST['view'])) { + if ($_REQUEST['view'] == 'rss') { + // we don't want to store rss in the Session variable + $this->view = 'rss'; + } else { + // store non-rss views in Session for persistence + $this->view = $_REQUEST['view']; + $_SESSION['lastView'] = $this->view; + } + } else if (isset($_SESSION['lastView'])) { + // if there is nothing in the URL, check the Session variable + $this->view = $_SESSION['lastView']; + } else { + // otherwise load the default + $this->view = $this->defaultView; } } @@ -657,8 +672,49 @@ } return $list; } + /** + * Return a url for the current search with a new sort + * + * @access public + * @param string $new_sort A field to sort by + * @return string URL of a new search + */ + public function renderLinkWithView($newView) + { + // Stash our old data for a minute + $oldView = $this->view; + // Add the new sort + $this->view = $newView; + // Get the new url + $url = $this->renderSearchUrl(); + // Restore the old data + $this->view = $oldView; + // Return the URL + return $url; + } /** + * Return a list of urls for possible views, along with which option + * should be currently selected. + * + * @access public + * @return array View urls, descriptions and selected flags + */ + public function getViewList() + { + // Loop through all the current filter fields + $valid = $this->getViewOptions(); + $list = array(); + foreach ($valid as $view => $desc) { + $list[$view] = array( + 'sortUrl' => $this->renderLinkWithView($view), + 'desc' => $desc, + 'selected' => ($view == $this->view) + ); + } + return $list; + } + /** * Basic 'getters' * * @access public @@ -687,7 +743,8 @@ * @return mixed various internal variables */ protected function getSortOptions() { return $this->sortOptions; } - + protected function getViewOptions() { return $this->viewOptions; } + /** * Reset a simple query against the default index. * Index: RecordDrivers/IndexRecord.php =================================================================== --- RecordDrivers/IndexRecord.php (revision 3010) +++ RecordDrivers/IndexRecord.php (working copy) @@ -568,14 +568,15 @@ } /** - * Assign necessary Smarty variables and return a template name to + * Assign necessary Smarty variables and return a template name for the current view to * load in order to display a summary of the item suitable for use in * search results. * * @access public + * @param string $view The current view. * @return string Name of Smarty template file to display. */ - public function getSearchResult() + public function getSearchResult($view) { global $configArray; global $interface; @@ -618,7 +619,7 @@ $interface->assign('summAjaxStatus', false); // Send back the template to display: - return 'RecordDrivers/Index/result.tpl'; + return 'RecordDrivers/Index/result-' . $view . '.tpl'; } /** Index: RecordDrivers/Interface.php =================================================================== --- RecordDrivers/Interface.php (revision 3010) +++ RecordDrivers/Interface.php (working copy) @@ -192,14 +192,15 @@ public function getReviews(); /** - * Assign necessary Smarty variables and return a template name to + * Assign necessary Smarty variables and return a template name for the current view to * load in order to display a summary of the item suitable for use in * search results. * * @access public + * @param string $view The current view. * @return string Name of Smarty template file to display. */ - public function getSearchResult(); + public function getSearchResult($view); /** * Assign necessary Smarty variables and return a template name to Index: RecordDrivers/MarcRecord.php =================================================================== --- RecordDrivers/MarcRecord.php (revision 3010) +++ RecordDrivers/MarcRecord.php (working copy) @@ -158,21 +158,22 @@ } /** - * Assign necessary Smarty variables and return a template name to + * Assign necessary Smarty variables and return a template name for the current view to * load in order to display a summary of the item suitable for use in * search results. * * @access public + * @param string $view The current view. * @return string Name of Smarty template file to display. */ - public function getSearchResult() + public function getSearchResult($view) { global $interface; // MARC results work just like index results, except that we want to // enable the AJAX status display since we assume that MARC records // come from the ILS: - $template = parent::getSearchResult(); + $template = parent::getSearchResult($view); $interface->assign('summAjaxStatus', true); return $template; } Index: services/Search/Results.php =================================================================== --- services/Search/Results.php (revision 2961) +++ services/Search/Results.php (working copy) @@ -86,6 +86,7 @@ // Those we can construct BEFORE the search is executed $interface->setPageTitle('Search Results'); $interface->assign('sortList', $searchObject->getSortList()); + $interface->assign('viewList', $searchObject->getViewList()); $interface->assign('rssLink', $searchObject->getRSSUrl()); // Process Search @@ -157,7 +158,10 @@ // Setup Display $interface->assign('sitepath', $configArray['Site']['path']); - $interface->assign('subpage', 'Search/list-list.tpl'); + + //Get view & load template + $currentView = $searchObject->getView(); + $interface->assign('subpage', 'Search/list-' . $currentView .'.tpl'); $interface->setTemplate('list.tpl'); // Process Paging Index: sys/SearchObject/Solr.php =================================================================== --- sys/SearchObject/Solr.php (revision 2961) +++ sys/SearchObject/Solr.php (working copy) @@ -102,6 +102,9 @@ if (isset($searchSettings['General']['default_sort'])) { $this->defaultSort = $searchSettings['General']['default_sort']; } + if (isset($searchSettings['General']['default_view'])) { + $this->defaultView = $searchSettings['General']['default_view']; + } if (isset($searchSettings['DefaultSortingByType']) && is_array($searchSettings['DefaultSortingByType'])) { $this->defaultSortByType = $searchSettings['DefaultSortingByType']; @@ -122,6 +125,15 @@ 'callnumber' => 'sort_callnumber', 'author' => 'sort_author', 'title' => 'sort_title'); } + + // Load view preferences (or defaults if none in .ini file): + if (isset($searchSettings['Views'])) { + $this->viewOptions = $searchSettings['Views']; + } elseif (isset($searchSettings['General']['default_view'])) { + $this->viewOptions = array($this->defaultView => $this->defaultView); + } else { + $this->viewOptions = array('list' => 'List'); + } // Load Spelling preferences $this->spellcheck = $configArray['Spelling']['enabled']; @@ -447,7 +459,8 @@ for ($x = 0; $x < count($this->indexResult['response']['docs']); $x++) { $current = & $this->indexResult['response']['docs'][$x]; $record = RecordDriverFactory::initRecordDriver($current); - $html[] = $interface->fetch($record->getSearchResult()); + $currentView = $this->getView(); + $html[] = $interface->fetch($record->getSearchResult($currentView)); } return $html; } Index: interface/themes/classic/Search/list.tpl =================================================================== --- interface/themes/classic/Search/list.tpl (revision 2961) +++ interface/themes/classic/Search/list.tpl (working copy) @@ -33,6 +33,13 @@
      + {if $viewList|@count gt 1} + {foreach from=$viewList item=viewData key=viewLabel} + {if !$viewData.selected}{/if} + + {if !$viewData.selected}{/if} + {/foreach} + {/if}
      {translate text='Sort'}