first round of the callnumber browse interface
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 30 Dec 2005 23:11:34 +0000 (23:11 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 30 Dec 2005 23:11:34 +0000 (23:11 +0000)
methods added and basic opac functionality added

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

Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm
Open-ILS/web/opac/common/js/config.js
Open-ILS/web/opac/skin/default/css/layout.css
Open-ILS/web/opac/skin/default/js/cn_browse.js [new file with mode: 0644]
Open-ILS/web/opac/skin/default/js/rdetail.js
Open-ILS/web/opac/skin/default/xml/common/altcanvas.xml
Open-ILS/web/opac/skin/default/xml/common/cn_browse.xml [new file with mode: 0644]
Open-ILS/web/opac/skin/default/xml/page_rdetail.xml

index 21f047f..15bb93d 100644 (file)
@@ -1176,4 +1176,48 @@ sub fetch_mods_by_copy {
 
 
 
+
+# -------------------------------------------------------------------------------------
+
+__PACKAGE__->register_method(
+       method  => "cn_browse",
+       api_name        => "open-ils.search.callnumber.browse.target",
+       notes           => "Starts a callnumber browse"
+       );
+
+__PACKAGE__->register_method(
+       method  => "cn_browse",
+       api_name        => "open-ils.search.callnumber.browse.page_up",
+       notes           => "Returns the previous page of callnumbers", 
+       );
+
+__PACKAGE__->register_method(
+       method  => "cn_browse",
+       api_name        => "open-ils.search.callnumber.browse.page_down",
+       notes           => "Returns the next page of callnumbers", 
+       );
+
+
+# RETURNS array of arrays like so: label, owning_lib, record, id
+sub cn_browse {
+       my( $self, $client, @params ) = @_;
+       my $method;
+
+       $method = 'open-ils.storage.asset.call_number.browse.target.atomic' 
+               if( $self->api_name =~ /target/ );
+       $method = 'open-ils.storage.asset.call_number.browse.page_up.atomic'
+               if( $self->api_name =~ /page_up/ );
+       $method = 'open-ils.storage.asset.call_number.browse.page_down.atomic'
+               if( $self->api_name =~ /page_down/ );
+
+       return $apputils->simplereq( 'open-ils.storage', $method, @params );
+}
+# -------------------------------------------------------------------------------------
+
+
+
+
+
+
+
 1;
index b3f7262..d194a6a 100644 (file)
@@ -222,6 +222,9 @@ var FETCH_ACONT_SUMMARY                     = "open-ils.search:open-ils.search.added_content.summa
 var FETCH_USER_BYBARCODE               = "open-ils.actor:open-ils.actor.user.fleshed.retrieve_by_barcode";
 var FETCH_ADV_MRIDS                            = "open-ils.search:open-ils.search.biblio.multiclass:1";
 var FETCH_ADV_MARC_MRIDS               = "open-ils.search:open-ils.search.biblio.marc:1";
+var FETCH_CNBROWSE_TARGET              = 'open-ils.search:open-ils.search.callnumber.browse.target';
+var FETCH_CNBROWSE_PREV                        = 'open-ils.search:open-ils.search.callnumber.browse.page_up';
+var FETCH_CNBROWSE_NEXT                        = 'open-ils.search:open-ils.search.callnumber.browse.page_down';
 /* ---------------------------------------------------------------------------- */
 
 
index 78fe91a..8f03031 100644 (file)
@@ -168,4 +168,15 @@ table { border-collapse: collapse; }
 
 .rdetail_extras_td { padding-right: 15px; padding-left: 15px; border-right: 1px solid #888; }
 
+.cn_browse_item { }
+.cn_browse_info { padding: 4px; border-bottom: 1px dashed #E0E0E0;}
+
+.bookshelf {
+        /*
+        background-image: url(wood.jpg);
+        background-repeat: no-repeat;
+        */
+        border-bottom: 1px solid black;
+}
+
 
diff --git a/Open-ILS/web/opac/skin/default/js/cn_browse.js b/Open-ILS/web/opac/skin/default/js/cn_browse.js
new file mode 100644 (file)
index 0000000..ddb0846
--- /dev/null
@@ -0,0 +1,121 @@
+var cnBrowseCurrent;
+var cnBrowseTopCn;
+var cnBrowseTopId;
+var cnBrowseBottomCn;
+var cnBrowseBottomId;
+var MAX_CN = 9;
+
+function cnBrowseGo(cn) { 
+       cnBrowseCurrent = cn;
+       var req = new Request( FETCH_CNBROWSE_TARGET, 
+               'org_unit', getLocation(), 
+               'depth', getDepth(), 
+               'label', cn, 
+               'page_size', MAX_CN );
+       req.callback( cnBrowseDraw );
+       req.send();
+}
+
+function cnBrowseNext() {
+       var req = new Request( FETCH_CNBROWSE_NEXT, 
+               'org_unit', getLocation(), 
+               'depth', getDepth(), 
+               'label', cnBrowseBottomCn, 
+               'boundry_id', cnBrowseBottomId,
+               'page_size', MAX_CN );
+       req.callback( cnBrowseDraw );
+       req.send();
+}
+
+function cnBrowsePrev() {
+       var req = new Request( FETCH_CNBROWSE_PREV,
+               'org_unit', getLocation(), 
+               'depth', getDepth(), 
+               'label', cnBrowseTopCn, 
+               'boundry_id', cnBrowseTopId,
+               'page_size', MAX_CN );
+       req.callback( cnBrowseDraw );
+       req.send();
+}
+
+
+var cnTbody;
+var cnRowT;
+var cnTdT;
+
+function cnBrowseDraw( r ) {
+       swapCanvas($('cn_browse'));
+       var list = r.getResultObject();
+
+       if(!cnTbody) {
+               cnTbody = $('cn_tbody');
+               cnRowT = $('cn_browse_row');
+               cnTdT = cnRowT.removeChild($('cn_browse_td'));
+               cnTbody.removeChild(cnRowT);
+       }
+       removeChildren(cnTbody);
+
+       var counter = 1;
+       var currentRow = cnRowT.cloneNode(true);
+       cnTbody.appendChild(currentRow);
+
+       for( var idx in list ) {
+               
+
+               var currentTd = cnTdT.cloneNode(true);
+               currentRow.appendChild(currentTd);
+
+               var td = cnTdT.cloneNode(true);
+               var label       = list[idx][0];
+               var lib         = list[idx][1];
+               var record      = list[idx][2];
+               var id          = list[idx][3];
+
+
+               if( idx == 0 ) {
+                       cnBrowseTopCn = label;
+                       cnBrowseTopId = id;
+               } else if( idx == MAX_CN - 1 ) {
+                       cnBrowseBottomCn = label;
+                       cnBrowseBottomId = id;
+               }
+
+               var cn_td                       = $n(currentTd, 'cn_browse_cn');
+               var lib_td                      = $n(currentTd, 'cn_browse_lib');
+               var title_td            = $n(currentTd, 'cn_browse_title');
+               var author_td           = $n(currentTd, 'cn_browse_author');
+               var pic_td                      = $n(currentTd, 'cn_browse_pic');
+
+               cn_td.appendChild(text(label));
+               lib_td.appendChild(text(findOrgUnit(lib).name()));
+
+               var req = new Request( FETCH_RMODS, record );
+               req.request.title_td            = title_td;
+               req.request.author_td   = author_td;
+               req.request.pic_td              = pic_td;
+               req.callback( cnBrowseDrawTitle );
+               req.send();
+
+       
+               if( counter++ % 3 == 0 ) {
+                       counter = 1;
+                       currentRow = cnRowT.cloneNode(true);
+                       cnTbody.appendChild(currentRow);
+               }
+       }
+}
+
+function cnBrowseDrawTitle(r) {
+       var mods = r.getResultObject();
+       buildTitleDetailLink(mods, r.title_td); 
+       buildSearchLink(STYPE_AUTHOR, mods.author(), r.author_td);
+       r.pic_td.setAttribute("src", buildISBNSrc(cleanISBN(mods.isbn())));
+
+       var args = {};
+       args.page = RDETAIL;
+       args[PARAM_OFFSET] = 0;
+       args[PARAM_RID] = mods.doc_id();
+       args[PARAM_MRID] = 0;
+       r.pic_td.parentNode.setAttribute("href", buildOPACLink(args));
+}
+
index c23a798..2e5f92b 100644 (file)
@@ -257,7 +257,11 @@ function _rdetailBuildInfoRows(r) {
 
                } else rowNode.setAttribute("used", "1");
 
-               findNodeByName( rowNode, config.names.rdetail.cn_cell ).appendChild(text(arr[1]));
+               var a = elem("a", {href:'javascript:cnBrowseGo("' + arr[1] + '");' }, arr[1]);
+               addCSSClass(a, 'classic_link');
+               findNodeByName( rowNode, config.names.rdetail.cn_cell ).appendChild(a);
+               
+               //findNodeByName( rowNode, config.names.rdetail.cn_cell ).appendChild(text(arr[1]));
 
                var cpc_temp = rowNode.removeChild(
                        findNodeByName(rowNode, config.names.rdetail.cp_count_cell));
index 6a29369..61cf2a0 100644 (file)
                config.ids.altcanvas.holds                      = 'holds_box';
                config.ids.altcanvas.xulholds           = 'xulholds_box';
                config.ids.altcanvas.loading            = 'loading_alt';
+               config.ids.altcanvas.cnbrowse           = 'cn_browse';
        </script>
 
        <!--#if expr="$FRONT_PAGE!='true'"-->
                <!--#include virtual="holds.xml"-->
+               <!--#include virtual="cn_browse.xml"-->
        <!--#endif-->
 
        <div id='loading_alt' class='hide_me non_canvas' style='margin-top: 6px;'>
diff --git a/Open-ILS/web/opac/skin/default/xml/common/cn_browse.xml b/Open-ILS/web/opac/skin/default/xml/common/cn_browse.xml
new file mode 100644 (file)
index 0000000..7ecc4d6
--- /dev/null
@@ -0,0 +1,26 @@
+<div id='cn_browse' class='hide_me non_canvas cn_browser' style='width: 90%; text-align: center; padding: 15px;'>
+       <div id='cn_browse_div'> 
+               <table class='data_grid bookshelf' width='100%'>
+                       <thead>
+                               <tr>
+                                       <td><a id='cn_browse_next' class='classic_link' 
+                                               href='javascript:cnBrowsePrev();'>&lt;&lt; Previous Page</a></td>
+                                       <td colspan='1' align='center'>Callnumber Browser</td>
+                                       <td><a id='cn_browse_prev' class='classic_link' 
+                                               href='javascript:cnBrowseNext();'>Next Page&gt;&gt;</a></td>
+                               </tr>
+                       </thead>
+                       <tbody id='cn_tbody'>
+                               <tr id='cn_browse_row'>
+                                       <td id='cn_browse_td' class='cn_browse_item' width='25%' valign='top'>
+                                               <a><img height='60' width='50' class='cn_browse_info' name='cn_browse_pic' border='0'> </img></a>
+                                               <div style='font-weight: bold;' class='cn_browse_info' name='cn_browse_cn'>  </div>
+                                               <div class='cn_browse_info'><a name='cn_browse_title' class='classic_link'> </a></div>
+                                               <div class='cn_browse_info'><a name='cn_browse_author' class='classic_link'>  </a></div>
+                                               <div class='cn_browse_info' name='cn_browse_lib'>  </div>
+                                       </td>
+                               </tr>
+                       </tbody>
+               </table>
+       </div>
+</div>
index 934a420..0486721 100644 (file)
@@ -3,6 +3,7 @@
        <script language='javascript' src='../js/sidebar_extras.js'> </script>
        <script language='javascript' src='../js/rdetail.js'> </script>
        <script language='javascript' src='../js/holds.js'> </script>
+       <script language='javascript' src='../js/cn_browse.js'> </script>
 
        <script language='javascript'>
                config.ids.rdetail = {};