adding first round
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 3 Feb 2006 17:59:54 +0000 (17:59 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 3 Feb 2006 17:59:54 +0000 (17:59 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@2961 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/server/admin/copy_locations.js [new file with mode: 0644]
Open-ILS/xul/staff_client/server/admin/copy_locations.xml [new file with mode: 0644]

diff --git a/Open-ILS/xul/staff_client/server/admin/copy_locations.js b/Open-ILS/xul/staff_client/server/admin/copy_locations.js
new file mode 100644 (file)
index 0000000..b029aae
--- /dev/null
@@ -0,0 +1,110 @@
+var RETRIEVE_CL = 'open-ils.circ:open-ils.circ.copy_location.retrieve.all';
+var CREATE_CL = 'open-ils.circ:open-ils.circ.copy_location.create';
+var UPDATE_CL = 'open-ils.circ:open-ils.circ.copy_location.update';
+var DELETE_CL = 'open-ils.circ:open-ils.circ.copy_location.delete';
+
+
+var YES;
+var NO;
+
+var myPerms = [
+       'CREATE_COPY_LOCATION',
+       'UPDATE_COPY_LOCATION', 
+       'DELETE_COPY_LOCATION',
+       ];
+
+function clEditorInit() {
+       cgi = new CGI();
+       session = cgi.param('ses');
+       if(!session) throw "User session is not defined!";
+       fetchUser(session);
+       $('user').appendChild(text(USER.usrname()));
+       YES = $('yes').innerHTML;
+       NO = $('no').innerHTML;
+       setTimeout( function() { 
+               fetchHighestPermOrgs( SESSION, USER.id(), myPerms ); clGo(); }, 20 );
+}
+
+
+function clHoldMsg() {
+       alert($('cl_hold_msg').innerHTML);
+}
+
+function clGo() {
+       var req = new Request(RETRIEVE_CL, SESSION, USER.home_ou());
+       req.callback(clDraw);
+       req.send();
+}
+
+var rowTemplate;
+function clDraw(r) {
+
+       var cls = r.getResultObject();
+       if(checkILSEvent(cls)) throw cls;
+
+       var tbody = $('cl_tbody');
+       if(!rowTemplate)
+               rowTemplate = tbody.removeChild($('cl_row'));
+       removeChildren(tbody);
+
+       cls = cls.sort( function(a,b) {
+                       if( a.name().toLowerCase() > b.name().toLowerCase() ) return 1;
+                       if( a.name().toLowerCase() < b.name().toLowerCase() ) return -1;
+                       return 0;
+               });
+
+       for( var c in cls ) {
+               var cl = cls[c];
+               var row = rowTemplate.cloneNode(true);
+               clBuildRow( tbody, row, cl );
+               tbody.appendChild(row);
+       }
+}
+
+function clBuildRow( tbody, row, cl ) {
+       $n( row, 'cl_name').appendChild(text(cl.name()));
+       $n( row, 'cl_owner').appendChild(text(findOrgUnit(cl.owning_lib()).name()));
+       $n( row, 'cl_holdable').appendChild(text( (cl.holdable()) ? YES : NO ) );
+       $n( row, 'cl_visible').appendChild(text( (cl.opac_visible()) ? YES : NO ) );
+       $n( row, 'cl_circulate').appendChild(text( (cl.circulate()) ? YES : NO ) );
+       $n( row, 'cl_edit').onclick = function() { clEdit( cl, tbody, row ); };
+}
+
+function clEdit( cl, tbody, row ) {
+
+       cleanTbody(tbody, 'edit');
+       var r = $('cl_new').cloneNode(true);
+       r.setAttribute('edit','1');
+       
+       var name = $n(r, 'cl_new_name');
+       name.setAttribute('size', cl.name().length + 3);
+       name.value = cl.name();
+
+       $n(r, 'cl_new_owner').appendChild(text(findOrgUnit(cl.owning_lib()).name()));
+
+       var yhold = $n( $n(r,'cl_new_holdable_yes'), 'cl_new_holdable');
+       var nhold = $n( $n(r,'cl_new_holdable_no'), 'cl_new_holdable');
+       var yvis = $n( $n(r,'cl_new_visible_yes'), 'cl_new_visible');
+       var nvis = $n( $n(r,'cl_new_visible_no'), 'cl_new_visible');
+       var ycirc = $n( $n(r,'cl_new_circulate_yes'), 'cl_new_circulate');
+       var ncirc = $n( $n(r,'cl_new_circulate_no'), 'cl_new_circulate');
+
+       if(cl.holdable()) yhold.checked = true;
+       else nhold.checked = true;
+       if(cl.opac_visible()) yvis.checked = true;
+       else nvis.checked = true;
+       if(cl.circulate()) ycirc.checked = true;
+       else ncirc.checked = true;
+
+       $n(r, 'cl_new_cancel').onclick = function(){cleanTbody(tbody,'edit');}
+       $n(r, 'cl_new_commit').onclick = function(){clEditCommit( tbody, cl ); }
+
+       insRow(tbody, row, r);
+       name.focus();
+       name.select();
+}
+
+function clEditCommit( tbody, cl ) {
+       alert("committing: " + cl.id());        
+       cleanTbody(tbody,'edit');
+}
diff --git a/Open-ILS/xul/staff_client/server/admin/copy_locations.xml b/Open-ILS/xul/staff_client/server/admin/copy_locations.xml
new file mode 100644 (file)
index 0000000..15a4204
--- /dev/null
@@ -0,0 +1,114 @@
+<?xml version='1.0'?>
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xi="http://www.w3.org/2001/XInclude">
+
+       <head>
+               <title>Evergreen: Copy Locations Editor</title>
+               <script language='javascript' src='/opac/common/js/utils.js'> </script>
+               <script language='javascript' src='/opac/common/js//config.js'> </script>
+               <script language='javascript' src='/opac/common/js/CGI.js'> </script>
+               <script language='javascript' src='/opac/common/js/Cookie.js'> </script>
+       
+               <script language='javascript' src='/opac/common/js/slimtree.js'> </script>
+               <script language='javascript' src='/opac/common/js/JSON.js'> </script>
+               <script language='javascript' src='/opac/common/js/fmall.js'> </script>
+               <script language='javascript' src='/opac/common/js/fmgen.js'> </script>
+               <script language='javascript' src='/opac/common/js/opac_utils.js'> </script>
+               <script language='javascript' src='/opac/common/js/OrgTree.js'> </script>
+               <script language='javascript' src='/opac/common/js/org_utils.js'> </script>
+               <script language='javascript' src='/opac/common/js/init.js'> </script>
+               <script language='javascript' src='/opac/common/js/RemoteRequest.js'> </script>
+               <script language='javascript' src='adminlib.js'> </script>
+               <script language='javascript' src='copy_locations.js'> </script>
+
+               <link type='text/css' rel='stylesheet' href='admin.css' />
+       </head>
+
+       <body onload='try{clEditorInit();}catch(e){alert(js2JSON(e));}'>
+
+               <div class='welcome_box'>
+                       <span>Welcome </span><b><span id='user'/></b>
+               </div>
+
+               <center>
+                       <div class='title'> Copy Locations Editor </div>
+
+
+                       <table class='data_grid data_grid_center' style='width: 95%'>
+                               <thead>
+                                       <tr>
+                                               <td width='15%'>Name</td>
+                                               <td width='20%'>Owning Library</td>
+                                               <td width='15%'>
+                                                       <span>Holdable </span>
+                                                       <a class='context_help' href='javascript:void(0);' onclick='clHoldMsg();'> ??</a>
+                                               </td>
+                                               <td width='15%'>OPAC Visible</td>
+                                               <td width='15%'>Circulate</td>
+                                               <td width='10%'>Edit</td>
+                                               <td width='10%'>Delete</td>
+                                       </tr>
+                               </thead>
+                               <tbody id='cl_tbody'>
+                                       <tr id='cl_row'>
+                                               <td name='cl_name'> </td>
+                                               <td name='cl_owner'> </td>
+                                               <td name='cl_holdable'> </td>
+                                               <td name='cl_visible'> </td>
+                                               <td name='cl_circulate'> </td>
+                                               <td><input type='submit' value='Edit' name='cl_edit'> </input></td>
+                                               <td><input type='submit' value='Delete' name='cl_delete'> </input></td>
+                                       </tr>
+                               </tbody>
+                       </table>
+                </center>
+
+                <div class='hide_me'>
+                       <span id='yes'>Yes</span>
+                       <span id='no'>No</span>
+                       <span id='cl_hold_msg'>
+                               If a copy location is "Holdable", copies in that location may have holds placed on them.
+                       </span>
+                       <table>
+                               <tbody>
+                                       <tr id='cl_new' class='insert_row'>
+                                               <td><input name='cl_new_name' type='text'> </input></td>
+                                               <td name='cl_new_owner'></td>
+                                               <td>
+                                                       <span>Yes</span>
+                                                       <span name='cl_new_holdable_yes'>
+                                                               <input type='radio' name='cl_new_holdable'/>
+                                                       </span>
+                                                       <span>No</span>
+                                                       <span name='cl_new_holdable_no'>
+                                                               <input type='radio' name='cl_new_holdable'/>
+                                                       </span>
+                                               </td>
+                                               <td>
+                                                       <span>Yes</span>
+                                                       <span name='cl_new_visible_yes'>
+                                                               <input type='radio' name='cl_new_visible'/>
+                                                       </span>
+                                                       <span>No</span>
+                                                       <span name='cl_new_visible_no'>
+                                                               <input type='radio' name='cl_new_visible'/>
+                                                       </span>
+                                               </td>
+                                               <td>
+                                                       <span>Yes</span>
+                                                       <span name='cl_new_circulate_yes'>
+                                                               <input type='radio' name='cl_new_circulate'/>
+                                                       </span>
+                                                       <span>No</span>
+                                                       <span name='cl_new_circulate_no'>
+                                                               <input type='radio' name='cl_new_circulate'/>
+                                                       </span>
+                                               </td>
+                                               <td><input type='submit' name='cl_new_commit' value='Submit'/></td>
+                                               <td><input type='submit' name='cl_new_cancel' value='Cancel'/></td>
+                                       </tr>
+                               </tbody>
+                       </table>
+               </div>
+       </body>
+</html>
+