using new slimtree for sidebars
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 11 Nov 2005 19:18:07 +0000 (19:18 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 11 Nov 2005 19:18:07 +0000 (19:18 +0000)
added authority retrieval

git-svn-id: svn://svn.open-ils.org/ILS/trunk@2003 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/opac/common/js/config.js
Open-ILS/web/opac/common/js/opac_utils.js
Open-ILS/web/opac/locale/en-US/lang.dtd
Open-ILS/web/opac/skin/default/css/layout.css
Open-ILS/web/opac/skin/default/js/result_common.js
Open-ILS/web/opac/skin/default/xml/js_common.xml
Open-ILS/web/opac/skin/default/xml/result_common.xml
Open-ILS/web/opac/skin/default/xml/result_table.xml
Open-ILS/web/opac/skin/default/xml/sidebar.xml

index 6840706..b6272c1 100644 (file)
@@ -193,6 +193,7 @@ var FETCH_CHECKED_OUT                       = "open-ils.circ:open-ils.circ.actor.user.checked_out";
 var FETCH_HOLDS                                        = "open-ils.circ:open-ils.circ.holds.retrieve";
 var FETCH_FINES_SUMMARY                        = "open-ils.actor:open-ils.actor.user.fines.summary";
 var FETCH_TRANSACTIONS                 = "open-ils.actor:open-ils.actor.user.transactions.have_charge.fleshed";
+var FETCH_CROSSREF                             = "open-ils.search:open-ils.search.authority.crossref";
 /* ---------------------------------------------------------------------------- */
 
 
index 07779ee..e500548 100644 (file)
@@ -416,11 +416,13 @@ function unHideMe(obj) { removeCSSClass(obj, config.css.hide_me); }
 /* ----------------------------------------------------------------------- */
 function drawOrgTree() {
        G.ui.common.org_tree.innerHTML = buildOrgSelector().toString();
+       //buildOrgSelector(G.ui.common.org_tree);
 }
        
 var orgTreeSelector;
-function buildOrgSelector() {
+function buildOrgSelector(node) {
        var tree = new dTree("orgTreeSelector"); 
+       //var tree = new SlimTree(node);
        for( var i in orgArraySearcher ) { 
                var node = orgArraySearcher[i];
                if( node == null ) continue;
index 40a8223..6be654f 100644 (file)
@@ -1,7 +1,7 @@
 <!ENTITY nbsp "  ">
 <!ENTITY space "&nsbp;">
 <!ENTITY llt "&lt;">
-<!ENTITY gt ">">
+<!ENTITY ggt "&gt;">
 
 <!-- Navigations links -->
 <!ENTITY navigate.home "Home">
index c190ac0..9ffd4c1 100644 (file)
@@ -92,7 +92,7 @@ border-left: 1px solid #E0E0E0; border-top: 1px solid #E0E0E0; border-bottom: 1p
 .result_table_pic { height: 50px; width: 40px;  border: none;}
 .result_table_pic_header { width: 43px; }
 
-.result_table_row { text-align: left; }
+.result_table_row { text-align: left; width: 100%;}
 .result_table_subtable { width: 100%; border-collapse: collapse; vertical-align: top;}
 .result_table_subtbody { height: 100%; width: 100%; }
 .result_table_title_cell { text-align: left; }
index 740e54a..6788a1d 100644 (file)
@@ -329,42 +329,98 @@ function resultDrawSubjects() {
 
        var ss = [];
        for( var s in subjs ) ss.push(subjs[s].sub);
-       resultDrawSidebarStuff(STYPE_SUBJECT, G.ui.sidebar.subject_item,  
-               config.names.sidebar.subject_item, ss, G.ui.sidebar.subject);
+
+       resultDrawSidebarTrees( 
+               STYPE_SUBJECT, 
+               "subjectSidebarTree", ss, 
+               getId("subject_tree_sidebar"), 
+               getId("subject_sidebar_tree_div") );
 }
 
 function resultDrawAuthors() {
        var auths = new Array();
        for( var s in authorCache ) auths.push(s);
-       resultDrawSidebarStuff(STYPE_AUTHOR, G.ui.sidebar.author_item,  
-               config.names.sidebar.author_item, auths.sort(), G.ui.sidebar.author);
+
+       resultDrawSidebarTrees( 
+               STYPE_AUTHOR, 
+               "authorSidebarTree", auths.sort(), 
+               getId("author_tree_sidebar"), 
+               getId("author_sidebar_tree_div") );
 }
 
 function resultDrawSeries() {
        var sers = new Array();
        for( var s in seriesCache ) sers.push(s);
-       resultDrawSidebarStuff(STYPE_SERIES, G.ui.sidebar.series_item,  
-               config.names.sidebar.series_item, sers.sort(), G.ui.sidebar.series);
+       resultDrawSidebarTrees( 
+               STYPE_SERIES, 
+               "seriesSidebarTree", sers.sort(), 
+               getId("series_tree_sidebar"), 
+               getId("series_sidebar_tree_div") );
 }
 
-/* search type, template node, href link name, array of text, node to unhide */
-function resultDrawSidebarStuff(stype, node, linkname, items, wrapperNode) {
-       var parent = node.parentNode;
-       var template = parent.removeChild(node);
-       var x = 0;
-       var newnode = template.cloneNode(true);
+function resultDrawSidebarTrees( stype, treeName, items, wrapperNode, destNode ) {
+       var tree;
+       eval("tree = " + treeName);
+
        var found = false;
+       var x = 0;
        for( var i in items ) {
+
                if(isNull(items[i])) continue;
                if(x++ > 7) break;
-               buildSearchLink(stype, items[i], findNodeByName(newnode, linkname), 100);
-               parent.appendChild(newnode);
-               newnode = template.cloneNode(true);
+
+               var item = normalize(truncate(items[i], 65));
+               var trunc = 65;
+               var args = {};
+               var href = resultQuickLink( items[i], stype );
+               tree.addNode( stype + "_" + items[i], treeName + 'Root', item, href );
+
+               var req = new Request(FETCH_CROSSREF, stype, items[i]);
+               req.request._tree = tree;
+               req.request._item = items[i];
+               req.request._stype = stype;
+               req.callback(resultAppendCrossRef);
+               req.send();     
+
                found = true;
        }
        if(found) unHideMe(wrapperNode);
 }
 
+function resultQuickLink( term, type ) {
+       var args = {};
+       args.page = MRESULT;
+       args[PARAM_OFFSET] = 0;
+       args[PARAM_TERM] = term;
+       args[PARAM_STYPE] = type;
+       return buildOPACLink(args);
+}
+
+
+function resultAppendCrossRef(r) {
+       var tree                = r._tree
+       var item                = r._item
+       var stype       = r._stype;
+       var result      = r.getResultObject();
+       var froms       = result['from'];
+       var alsos       = result['also'];
+
+       var total = 0;
+
+       for( var i = 0; (total++ < 5 && i < froms.length); i++ ) {
+               var string = normalize(truncate(froms[i], 45));
+               if(getId(stype + '_' + froms[i])) continue;
+               tree.addNode(stype + '_' + froms[i], 
+                       stype + '_' + item, string, resultQuickLink(froms[i],stype));
+       }
+       for( var i = 0; (total++ < 10 && i < alsos.length); i++ ) {
+               var string = normalize(truncate(alsos[i], 45));
+               if(getId(stype + '_' + alsos[i])) continue;
+               tree.addNode(stype + '_' + alsos[i], 
+                       stype + '_' + item, string, resultQuickLink(alsos[i],stype));
+       }
+}
+
 
 
 
index cc55261..15f99e9 100644 (file)
@@ -10,6 +10,7 @@
        <script language='javascript' src='../../../common/js/Cookie.js'> </script>
        <script language='javascript' src='../../../common/js/md5.js'> </script>
 
+       <script language='javascript' src='../../../common/js/slimtree.js'> </script>
        <script language='javascript' src='../../../common/js/dtree.js'> </script>
 
        <script language='javascript' src='../../../common/js/JSON.js'> </script>
index dd69fd4..944c32a 100644 (file)
                config.names.result.count_cell  = "copy_count_cell";
        </script>
 
-
-       <!--
-       <table id='search_nav_links'>
-               <tbody>
-                       <tr>
-                               <td valign='bottom' id='result_info_box'>
-                                       <div class='hide_me' id='result_info_div'>
-                                               <span> Results </span> 
-                                               <span id='offset_start'> </span>
-                                               <span> - </span>
-                                               <span id='offset_end'> </span>
-                                               <span> of </span>
-                                               <span id='result_count'> </span>
-                                               <span> (page </span>
-                                               <span id='current_page'> </span>
-                                               <span> of </span>
-                                               <span id='num_pages'> </span>
-                                       </div>
-                               </td>
-                               <td style='text-align:right; padding-right: 10px;'>
-                                       <span> Avaible copies / Total copies </span>
-                               </td>
-                       </tr>
-               </tbody>
-       </table>
-       -->
-
        <div id='loading_div' class='color_1'> Loading Results... </div>
-       <!-- Load the result table -->
        <xi:include href="result_table.xml"/>
-
-
 </div>
 
 
index 3495506..c8e1525 100644 (file)
@@ -42,7 +42,7 @@
                                                                                <a class='search_page_nav_link' id='search_home_link' title="First results page">Start</a>
                                                                                <a class='search_page_nav_link' id='prev_link' title='Previus page'> &llt;&llt; </a>
                                                                                <span class='search_page_nav_link' id='page_numbers'> </span>
-                                                                               <a  class='search_page_nav_link' id='next_link' title='Next Page'> &gt;&gt; </a>
+                                                                               <a  class='search_page_nav_link' id='next_link' title='Next Page'> &ggt;&ggt; </a>
                                                                                <a  class='search_page_nav_link' id='end_link' title="Last results page">End</a>
                                                                        </span>
 
index c979dca..56fddee 100644 (file)
                                <span>My Title Details</span>
                        </div>
                </div>
-
-
        </div>
 
-       <div id='subject_sidebar' class='sidebar_chunk hide_me'> 
-               <div class='sidebar_header color_1'>&sidebar.relevantSubjects.headerLabel;</div>
-               <ul style='margin-left: 1em; padding-left: 1em;'>
-                       <li id='subject_item' class='sidebar_extra_item'>
-                               <a class='sidebar_extra_link' name='subject_item'> </a>
-                       </li>
-               </ul>
+       <br/>
+       <div id='subject_tree_sidebar' class='sidebar_chunk hide_me'> 
+               <div id='subject_sidebar_tree_div'> </div>
+               <script language='javascript'>
+                       var subjectSidebarTree = new SlimTree(
+                               document.getElementById('subject_sidebar_tree_div'));
+                       subjectSidebarTree.addNode( 'subjectSidebarTreeRoot', -1, 
+                               "&sidebar.relevantSubjects.headerLabel;", null);
+               </script>
        </div>
 
-       <div id='author_sidebar' class='sidebar_chunk hide_me'> 
-               <div class='sidebar_header color_1'>&sidebar.relevantAuthors.headerLabel;</div>
-               <ul style='margin-left: 1em; padding-left: 1em;'>
-                       <li id='author_item' class='sidebar_extra_item'>
-                               <a class='sidebar_extra_link' name='author_item'> </a>
-                       </li>
-               </ul>
+       <div id='author_tree_sidebar' class='sidebar_chunk hide_me'> 
+               <div id='author_sidebar_tree_div'> </div>
+               <script language='javascript'>
+                       var authorSidebarTree = new SlimTree(
+                               document.getElementById('author_sidebar_tree_div'));
+                       authorSidebarTree.addNode( 'authorSidebarTreeRoot', -1, 
+                               "&sidebar.relevantAuthors.headerLabel;", null);
+               </script>
        </div>
 
-       <div id='series_sidebar' class='sidebar_chunk hide_me'> 
-               <div class='sidebar_header color_1'>&sidebar.relevantSeries.headerLabel;</div>
-               <ul style='margin-left: 1em; padding-left: 1em;'>
-                       <li id='series_item' class='sidebar_extra_item'>
-                               <a class='sidebar_extra_link' name='series_item'> </a>
-                       </li>
-               </ul>
+       <div id='series_tree_sidebar' class='sidebar_chunk hide_me'> 
+               <div id='series_sidebar_tree_div'> </div>
+               <script language='javascript'>
+                       var seriesSidebarTree = new SlimTree(
+                               document.getElementById('series_sidebar_tree_div'));
+                       seriesSidebarTree.addNode( 'seriesSidebarTreeRoot', -1, 
+                               "&sidebar.relevantSeries.headerLabel;", null);
+               </script>
        </div>
 
 
+
+
+
        <!-- ============================================================================= -->
        <!-- Our javascript -->
        <script language='javascript' src='../js/sidebar.js'> </script>