[open-ils-commits] r10459 - trunk/Open-ILS/xul/staff_client/server/admin

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Aug 26 17:39:40 EDT 2008


Author: erickson
Date: 2008-08-26 17:39:36 -0400 (Tue, 26 Aug 2008)
New Revision: 10459

Modified:
   trunk/Open-ILS/xul/staff_client/server/admin/non_cat_types.js
   trunk/Open-ILS/xul/staff_client/server/admin/non_cat_types.xhtml
Log:
non-cat  editor is now work-ou aware.  default focus org is workstation.  staff is given an option to change the focus org

Modified: trunk/Open-ILS/xul/staff_client/server/admin/non_cat_types.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/admin/non_cat_types.js	2008-08-26 20:46:52 UTC (rev 10458)
+++ trunk/Open-ILS/xul/staff_client/server/admin/non_cat_types.js	2008-08-26 21:39:36 UTC (rev 10459)
@@ -7,29 +7,53 @@
 	'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 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 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 ); };

Modified: trunk/Open-ILS/xul/staff_client/server/admin/non_cat_types.xhtml
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/admin/non_cat_types.xhtml	2008-08-26 20:46:52 UTC (rev 10458)
+++ trunk/Open-ILS/xul/staff_client/server/admin/non_cat_types.xhtml	2008-08-26 21:39:36 UTC (rev 10459)
@@ -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>



More information about the open-ils-commits mailing list