more general web cleanup
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 21 Jun 2005 21:38:59 +0000 (21:38 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 21 Jun 2005 21:38:59 +0000 (21:38 +0000)
more record_detail and supporting work
bugfixes

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

Evergreen/css/opac/nav_bar.css
Open-ILS/src/javascript/opac/AbstractRecordResultPage.js
Open-ILS/src/javascript/opac/LocationTree.js
Open-ILS/src/javascript/opac/Page.js
Open-ILS/src/javascript/opac/RecordDetailPage.js
Open-ILS/src/javascript/util/ils_utils.js
Open-ILS/src/javascript/util/webutils.js
Open-ILS/src/templates/opac/pages/chunks/init.ttk
Open-ILS/src/templates/opac/pages/chunks/org_tree.ttk
Open-ILS/src/templates/opac/pages/record_result.ttk

index d951585..e6dfdff 100644 (file)
@@ -21,7 +21,7 @@
        background: #FFF;
 }
 
-#ot_nav_widget_box {
+.ot_nav_widget_box {
        height: 400px;
        width: 400px;
        padding-left: 2px;
index f86c237..e42783b 100644 (file)
@@ -463,7 +463,8 @@ AbstractRecordResultPage.prototype.displayCopyCounts =
                        var cell = trow.insertCell(trow.cells.length);
                        add_css_class(cell,"record_result_thead_header");
                        cell.innerHTML = 
-                               findOrgType(findOrgUnit(copy_counts[i].org_unit).ou_type()).name();
+                               findOrgType(findOrgUnit(
+                                       copy_counts[i].org_unit).ou_type()).opac_label();
                }
                this.theadDrawn = true;
        }
index 42081a1..7bfc7ab 100644 (file)
@@ -6,6 +6,7 @@ function LocationTree( tree, box_id, container_id ) {
        this.treeContainerBoxId = container_id;
        this.treeBoxId = box_id;
        this.setObjects();
+       this.treeBuilder = buildOrgTreeWidget;
 }
 
 
@@ -16,7 +17,7 @@ LocationTree.prototype.setObjects = function() {
                this.treeContainerBox = getById("ot_nav_widget");
 
        if(this.treeBoxId)
-               this.treeBox = getById(treeBoxId);
+               this.treeBox = getById(this.treeBoxId);
        else
                this.treeBox = getById("ot_nav_widget_box");
 
@@ -26,7 +27,8 @@ LocationTree.prototype.buildOrgTreeWidget = function() {
 
        debug("Somebody called buildOrgTreeWidget on me...");
        this.setObjects();
-       this.widget = buildOrgTreeWidget(globalOrgTree, true);
+       //this.widget = buildOrgTreeWidget(globalOrgTree, true);
+       this.widget = this.treeBuilder(globalOrgTree, true);
 }
 
 
@@ -61,10 +63,10 @@ function buildOrgTreeWidget(org_node, root) {
 
 LocationTree.prototype.hide = function() {
        this.setObjects();
-       this.widget = buildOrgTreeWidget(globalOrgTree, true);
+       this.widget = this.treeBuilder(globalOrgTree, true);
        if(this.treeContainerBox &&  
-                       this.treeContainerBox.className.indexOf("nav_bar_visible") != -1 ) {
-               swapClass( this.treeContainerBox, "nav_bar_hidden", "nav_bar_visible" );
+                       this.treeContainerBox.className.indexOf("show_me") != -1 ) {
+               swapClass( this.treeContainerBox, "hide_me", "show_me" );
        }
 }
 
@@ -76,13 +78,18 @@ LocationTree.prototype.toggle = function(button_div, offsetx, offsety) {
        debug("Tree container " + this.treeContainerBox );
        debug("Tree box " + this.treeBox );
 
-       swapClass( this.treeContainerBox, "nav_bar_hidden", "nav_bar_visible" );
+       swapClass( this.treeContainerBox, "hide_me", "show_me" );
 
        var obj = this;
-       if(this.treeBox && this.treeBox.firstChild.nodeType == 3) {
+       if( (this.treeBox && this.treeBox.firstChild && 
+                       this.treeBox.firstChild.nodeType == 3) ||
+                       (!this.treeBox.firstChild)) {
+
+               debug("location tree has not been rendered... rendering..");
                setTimeout(function() { renderTree(obj); }, 5 );
        }
 
+       //alert(this.treeBox.firstChild.nodeType);
 
        if( button_div && offsetx == null && offsety == null ) {
                var x = findPosX(button_div);
@@ -107,7 +114,48 @@ LocationTree.prototype.toggle = function(button_div, offsetx, offsety) {
 function renderTree(tree) {
        tree.setObjects();
        if(!tree.widget) tree.buildOrgTreeWidget(); 
+       /*
+       debug("Spitting tree out to the treeBox:\n" +
+                       tree.widget.toString() ); */
        tree.treeBox.innerHTML = tree.widget.toString();
 }
 
 
+
+/* generates a new chunk within with the tree is inserted */
+LocationTree.prototype.newSpot = function(box_id, container_id) {
+
+       var cont                        = elem("div", { id : this.treeContainerBoxId } );
+       var box                         = elem("div", { id : this.treeBoxId } );
+       var expando_line        = elem("div");
+       var expando             = elem("div");
+       var expand_all          = elem("a", null, null, "Expand All");
+       var collapse_all        = elem("a", null, null, "Collapse All");
+
+       add_css_class(cont, "nav_widget");
+       add_css_class(cont, "hide_me");
+       add_css_class(box, "ot_nav_widget_box");
+       add_css_class(expando_line, "expando_links");
+       add_css_class(expando, "expando_links");
+
+
+       cont.appendChild(expando_line);
+       cont.appendChild(expando);
+       cont.appendChild(elem("br"));
+       cont.appendChild(box);
+
+       expando_line.appendChild(elem("br"));
+       var obj = this;
+       expand_all.onclick = function() { obj.widget.expandAll(); };
+       collapse_all.onclick = function() {
+       obj.widget.collapseAll();
+               obj.widget.expand(); };
+
+       expando.appendChild(expand_all);
+       expando.appendChild(createAppTextNode(" "));
+       expando.appendChild(collapse_all);
+       expando.appendChild(createAppTextNode(" "));
+
+       return cont;
+
+}
index 0c045e2..6153f86 100644 (file)
@@ -86,7 +86,7 @@ Page.prototype.resetRange = function() {
                        if( otype.depth() > findOrgType(orgunit.ou_type()).depth() )
                                continue;
 
-                       var select =  new Option(otype.name(), otype.depth());
+                       var select =  new Option(otype.opac_label(), otype.depth());
 
                        this.searchRange.options[this.searchRange.options.length] = select;
 
index 2950d9b..299bac8 100644 (file)
@@ -3,6 +3,8 @@ RecordDetailPage.prototype                                      = new Page();
 RecordDetailPage.prototype.constructor = RecordDetailPage;
 RecordDetailPage.baseClass                                     = Page.constructor;
 
+var globalDetailRecord;
+
 function RecordDetailPage() {
        if( globalRecordDetailPage != null )
                return globalRecordDetailPage;
@@ -54,15 +56,44 @@ RecordDetailPage.prototype.init = function() {
 RecordDetailPage.prototype.draw = function() {
        this.mainBox = getById("record_detail_copy_info");
 
+       var linksDiv = elem("div");
+       var leftLink = elem("div", { style: "width: 50%;text-align: left" });
+       var rightLink = elem("div", { style: "width: 50%;text-align: right"});
+       linksDiv.appendChild(leftLink);
+       linksDiv.appendChild(rightLink);
+       this.mainBox.appendChild(linksDiv);
+
        this.mainBox.appendChild(elem("br"));
        this.parentLink = elem("a",
                { href : "javascript:void(0)",
                        id : "parent_link",
                  style : "text-decoration:underline" } );
 
-       this.mainBox.appendChild(this.parentLink);
-       this.locationTree = elem("div");
-       this.mainBox.appendChild(this.locationTree);
+       var a = elem("a", 
+               {       href : "javascript:void(0)", 
+                       style : "text-decoration:underline" }, null,
+               "Select a location whose Volumes/Copies you wish to see");
+
+       var obj = this;
+       a.onclick =  function(evt) {
+               obj.copyLocationTree.toggle(null, 100, 100);
+       };
+
+       leftLink.appendChild(a);
+       rightLink.appendChild(this.parentLink);
+
+       /* --------------------------------------------- */
+
+               
+       this.copyLocationTree =  new LocationTree(
+               globalOrgTree, "record_detail_tree", "record_detail_tree_container" );
+       td = this.copyLocationTree.newSpot();
+       this.copyLocationTree.treeBuilder = buildCustomOrgTree;
+       this.mainBox.appendChild(td);
+
+       this.copyLocationTree.setObjects();
+
+
 
        this.treeDiv = elem("div");
        this.mainBox.appendChild(this.treeDiv);
@@ -73,6 +104,39 @@ RecordDetailPage.prototype.draw = function() {
 
 }
 
+
+function buildCustomOrgTree(org_node, root) {
+
+       debug("performing custom org tree build");
+       var item;
+
+       if(root) {
+               item = new WebFXTree(org_node.name());
+               item.setBehavior('classic');
+       } else {
+               item = new WebFXTreeItem(org_node.name());
+       }
+
+       item.action = 
+               "javascript:globalPage.drawCopyTrees(" + 
+               org_node.id() + ", logicNode.globalDetailRecord );" +
+               "globalPage.copyLocationTree.hide();"; 
+               
+       
+       for( var index in org_node.children()) {
+               var childorg = org_node.children()[index];
+               if( childorg != null ) {
+                       debug("Adding " + childorg.name() + " to org tree");
+                       var tree_node = buildCustomOrgTree(childorg);
+                       if(tree_node != null)
+                               item.add(tree_node);
+               }
+       }
+
+       return item;
+}
+
+
 RecordDetailPage.prototype.setViewMarc = function(record) {
        var marcb = elem( "a", 
                { 
@@ -103,6 +167,9 @@ RecordDetailPage.prototype.fetchRecord = function(id) {
        req.setCompleteCallback(
                function() { 
                        obj.record = req.getResultObject();
+                       globalDetailRecord = obj.record;
+                       obj.copyLocationTree.widget = 
+                               buildCustomOrgTree(globalOrgTree, obj.record, true);
                        obj.drawRecord(obj.record); 
                        obj.setViewMarc(obj.record);
                } 
@@ -232,9 +299,12 @@ RecordDetailPage.prototype.grabCopyTree = function(record, orgUnit, callback, sy
 /* entry point for displaying the copy details pane */
 RecordDetailPage.prototype.drawCopyTrees = function(orgUnit, record) {
 
+       debug("Got ORG unit " + orgUnit);
+       orgUnit = findOrgUnit(orgUnit);
+
        debug("OrgUnit depth is: " + findOrgType(orgUnit.ou_type()).depth());
 
-       this.displayLocationTree(record);
+       //this.displayLocationTree(record);
 
        /* display a 'hold on' message */
        this.treeDiv.appendChild(elem("br"));
@@ -251,15 +321,12 @@ RecordDetailPage.prototype.drawCopyTrees = function(orgUnit, record) {
 }
 
 
-/* displays a link to choose another location and embeds a 
-       copy of the location tree for choosing said location */
+/*
 RecordDetailPage.prototype.displayLocationTree = function(record) {
-
-       var locTree = new LocationTree(globalOrgTree);
-       locTree.buildOrgTreeWidget();
+}
+*/
 
 
-}
 
 /* displays a link to view info for the parent org 
        if showMe == true, we don't search for the parent, 
index e7d3bab..a6e4ace 100644 (file)
@@ -32,6 +32,7 @@ function findOrgType(type_id) {
 /* locates a specific org unit */
 function findOrgUnit(org_id, branch) {
        if(org_id == null) return null;
+       if(typeof org_id == 'object') return org_id;
        if(globalOrgTree == null)
                throw new EXArg("Need globalOrgTree");
 
index ff71cb0..ba33981 100644 (file)
@@ -617,7 +617,7 @@ function elem(name, attrs, style, text) {
         }
     }
     if (text) {
-        e.appendChild(document.createTextNode(text));
+        e.appendChild(createAppTextNode(text));
     }
     return e;
 }
index c1b4f7b..770b28c 100644 (file)
                function setDeepLink() {
                        var node = document.getElementById("deep_link_div");
                        if(node) {
+                               var org = logicNode.globalSelectedLocation;
+                               if(org == null)
+                                       org = logicNode.globalLocation;
+                               org = org.id();
+
+                               var depth = logicNode.globalSearchDepth;
+
                                var a = document.createElement("a");
-                               a.setAttribute("href", location.href + "&sub_frame=1");
+                               a.setAttribute("href", location.href + 
+                                       "&sub_frame=1&location=" + org + "&depth=" + depth);
+
                                a.setAttribute("target", "_blank");
                                a.appendChild(document.createTextNode("Link to this page"));
                                node.appendChild(a);
index 182ecb3..fc21d13 100644 (file)
@@ -2,7 +2,7 @@
 
        WRAPPER html/div id='ot_wrapper_box' class='nav_wrapper_box'; 
 
-               WRAPPER html/div id='ot_nav_widget' class='nav_widget nav_bar_hidden' ; 
+               WRAPPER html/div id='ot_nav_widget' class='nav_widget hide_me' ; 
 
                        WRAPPER html/div class='expando_links';
                                lines(1);
@@ -23,7 +23,7 @@
 
                        lines(1);
 
-                       WRAPPER html/div id='ot_nav_widget_box'; 
+                       WRAPPER html/div class='ot_nav_widget_box' id='ot_nav_widget_box'; 
                                "Loading Tree...";
                        END;
 
index 0b04f7d..0b6d532 100644 (file)
@@ -32,8 +32,9 @@
                                                WRAPPER html/table class='record_result_box', id='record_result_box'; 
                                                        WRAPPER html/thead class='record_result_thead'; 
                                                                WRAPPER html/row id='record_result_thead_row';
-                                                                       cell(nowrap='nowrap', colspan='2', 
-                                                                                       content="Title / Author", class='record_box_descriptor' ); 
+                                                                               cell(nowrap='nowrap', colspan='2', 
+                                                                                       #content="Title / Author", class='record_box_descriptor' ); 
+                                                                                       content="&nbsp;", class='record_box_descriptor' ); 
                                                                END;
                                                        END;
                                                END;