non-cat editor is now work-ou aware. default focus org is workstation. staff is...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 26 Aug 2008 21:39:36 +0000 (21:39 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 26 Aug 2008 21:39:36 +0000 (21:39 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@10459 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/server/admin/non_cat_types.js
Open-ILS/xul/staff_client/server/admin/non_cat_types.xhtml

index 210e7a7..cfa0b8f 100644 (file)
@@ -7,29 +7,53 @@ var myPerms = [
        'UPDATE_NON_CAT_TYPE',
        'DELETE_NON_CAT_TYPE' ];
 
+var focusOrg;
+
 function ncEditorInit() {
        fetchUser();
        $('nc_user').appendChild(text(USER.usrname()));
-       setTimeout( function() { 
-               fetchHighestPermOrgs( SESSION, USER.id(), myPerms );
-               ncBuildNew();
-               ncFetchTypes(); }, 20 );
+       setTimeout( 
+        function() { 
+            fetchHighestWorkPermOrgs(SESSION, USER.id(), myPerms,
+                function() {
+                    ncSetupFocus();
+                           ncBuildNew();
+                           ncFetchTypes();
+                }
+            ); 
+        }, 20 );
 }
 
+function ncSetupFocus() {
+       var fselector = $('nc_org_filter');
+    var org_list = OILS_WORK_PERMS.UPDATE_NON_CAT_TYPE;
+    if(org_list.length == 0) 
+        return;
+       fselector.disabled = false;
+       buildMergedOrgSel(fselector, org_list, 0, 'shortname');
+    fselector.onchange = function() {
+        focusOrg = getSelectorVal(fselector);
+        ncBuildNew();
+        ncFetchTypes();
+    }
+    
+    focusOrg = USER.ws_ou();
+    if(!orgIsMineFromSet(org_list, USER.ws_ou())) 
+        focusOrg = org_list[0];
+    setSelector(fselector, focusOrg);
+}
 
 function ncBuildNew() {
 
        var name = $('nc_new_name');
        name.focus();
 
-       var org = findOrgUnit(PERMS['CREATE_NON_CAT_TYPE']);
-       var mydepth = findOrgDepth(org);
-       if( mydepth == -1 ) return;
+    var org_list = OILS_WORK_PERMS.CREATE_NON_CAT_TYPE;
+    if(org_list.length == 0) return;
 
        var selector = $('nc_new_owner');
-       buildOrgSel(selector, org, mydepth );
-       if(org.children() && org.children()[0]) 
-               selector.disabled = false;
+       buildMergedOrgSel(selector, org_list, 0, 'shortname');
+       selector.disabled = false;
 
        $('nc_new_submit').disabled = false;
        $('nc_new_submit').onclick = ncCreateNew;
@@ -37,7 +61,7 @@ function ncBuildNew() {
 
 
 function ncFetchTypes() {
-       var req = new Request( FETCH_NON_CAT_TYPES, USER.home_ou() );   
+       var req = new Request( FETCH_NON_CAT_TYPES, focusOrg ); 
        req.callback(ncDisplayTypes);
        setTimeout(function(){req.send();}, 500);
 }
@@ -128,9 +152,9 @@ function _splitInterval( interval ) {
 
 function ncSetRowCallbacks( type, owner, tbody, row ) {
 
-       checkDisabled( $n(row, 'nc_edit'), owner, 'UPDATE_NON_CAT_TYPE');
+       checkPermOrgDisabled($n(row, 'nc_edit'), owner, 'UPDATE_NON_CAT_TYPE');
 
-       checkDisabled( $n(row, 'nc_delete'), owner, 'DELETE_NON_CAT_TYPE' );
+       checkPermOrgDisabled($n(row, 'nc_delete'), owner, 'DELETE_NON_CAT_TYPE');
 
        $n(row, 'nc_edit').onclick = 
                function() { ncEditType( tbody, row, type ); };
index 0fb9230..c2e07da 100644 (file)
@@ -59,8 +59,7 @@
                                                        </select>
                                                </td>
                                                <td>&staff.server.admin.non_cat_types.in_house_circ;
-                                                       <a href='javascript:alert($("cd_in_house_exp").innerHTML);' style='color:red'>&staff.server.admin.non_cat_types.in_house.help;</a>
-                                                       <input id='nc_new_inhouse' type='checkbox'/>
+                                                   <input id='nc_new_inhouse' type='checkbox'/>
                                                </td>
                                                <td><select class='select_big' id='nc_new_owner' disabled='disabled'> </select></td>
                                                <td><input id='nc_new_submit' type='submit' value='&staff.server.admin.non_cat_types.editor.create;' disabled='disabled'> </input></td>
@@ -70,6 +69,9 @@
 
                        <br/> <hr/> <br/>
 
+            &staff.server.admin.copy_locations.editor.library.filter; <select disabled='disabled' id='nc_org_filter'> </select>
+            <br/><br/>
+
                        <table id='nc_table' class='data_grid' width='85%'>
                                <thead>
                                        <tr>