From 1313c6ac9fcca017b1059e2ff20458937be1687c Mon Sep 17 00:00:00 2001
From: miker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Date: Fri, 5 Mar 2010 16:58:40 +0000
Subject: [PATCH] provide formatters for translation grid cells; move some
 inline js to the end, as the nodes referenced to exist yet; fix a couple
 typos/double-pastes

git-svn-id: svn://svn.open-ils.org/ILS/trunk@15714 dcc99617-32d9-48b4-a31d-7c20da2025e4
---
 Open-ILS/web/conify/global/config/copy_status.html | 15 +++++++----
 .../web/conify/global/config/marc_code_maps.html   | 15 ++++++++---
 .../web/conify/global/config/marc_code_maps.js     |  2 +-
 .../web/conify/global/permission/perm_list.html    | 30 ++++++++++++----------
 4 files changed, 40 insertions(+), 22 deletions(-)

diff --git a/Open-ILS/web/conify/global/config/copy_status.html b/Open-ILS/web/conify/global/config/copy_status.html
index b385ef02ca..2fa14c9a56 100644
--- a/Open-ILS/web/conify/global/config/copy_status.html
+++ b/Open-ILS/web/conify/global/config/copy_status.html
@@ -65,10 +65,6 @@
 
         <script type="text/javascript">
 <![CDATA[
-            var highlighter= {};
-            highlighter.green = dojox.fx.highlight( { color : '#B4FFB4', node : 'grid_container', duration : 500 } );
-            highlighter.red = dojox.fx.highlight( { color : '#FF2018', node : 'grid_container', duration : 500 } );
-
             var dirtyStore = [];
 
             var _status_list = pCRUD.retrieveAll('ccs', { order_by : { ccs : 'name' } });
@@ -173,6 +169,9 @@
 										{ name : ccs_strings.TRANSLATION,
 										  width : "10em",
 										  height : "2em",
+                                          formatter: function (row) {
+												return '<span class="status_grid_trans_cell_'+row+'"></span>';
+                                          },
 										  get : function (row) {
 											if (!window.status_rows) window.status_rows = [];
 											var r = window.status_data_model.getRow(row);
@@ -185,7 +184,7 @@
 														'status_grid.rowHeightChanged('+row+')',
 													0
 												);
-												return '<span class="status_grid_trans_cell_'+row+'"></span>';
+												return row;
 											}
 											return '';
 										  }
@@ -284,5 +283,11 @@
 			</div>
 		</div>
 	
+        <script type="text/javascript">
+            var highlighter= {};
+            highlighter.green = dojox.fx.highlight( { color : '#B4FFB4', node : 'grid_container', duration : 500 } );
+            highlighter.red = dojox.fx.highlight( { color : '#FF2018', node : 'grid_container', duration : 500 } );
+        </script>
+ 
 	</body>
 </html>
diff --git a/Open-ILS/web/conify/global/config/marc_code_maps.html b/Open-ILS/web/conify/global/config/marc_code_maps.html
index 7974a4538e..7501bdcc0b 100644
--- a/Open-ILS/web/conify/global/config/marc_code_maps.html
+++ b/Open-ILS/web/conify/global/config/marc_code_maps.html
@@ -81,6 +81,9 @@
                             { name : cam_strings.LABEL_TRANSLATION,
                               width : "10em",
                               height : "2em",
+                              formatter : function (row) {
+                                    return '<span class="cam_value_'+row+'"></span>';
+                              },
                               get : function (row) {
                                 if (!grid_row_object_cache.cam) grid_row_object_cache.cam = [];
                                 var r = this.grid.model.getRow(row);
@@ -96,7 +99,7 @@
                                     );
                                     var oldnode = dojo.byId('value_translation_cam_' + row);
                                     if (oldnode) dijit.byNode(oldnode).destroyRecursive();
-                                    return '<span class="cam_value_'+row+'"></span>';
+                                    return row;
                                 }
                                 return '';
                               }
@@ -104,6 +107,9 @@
                             { name : cam_strings.LABEL_TRANSLATION,
                               width : "10em",
                               height : "2em",
+                              formatter : function (row) {
+                                    return '<span class="cam_description_'+row+'"></span>';
+                              },
                               get : function (row) {
                                 if (!grid_row_object_cache.cam) grid_row_object_cache.cam = [];
                                 var r = this.grid.model.getRow(row);
@@ -119,7 +125,7 @@
                                     );
                                     var oldnode = dojo.byId('description_translation_cam_' + row);
                                     if (oldnode) dijit.byNode(oldnode).destroyRecursive();
-                                    return '<span class="cam_description_'+row+'"></span>';
+                                    return row;
                                 }
                                 return '';
                               }
@@ -171,6 +177,9 @@
 								        { name : cam_strings.LABEL_TRANSLATION,
 									      width : "10em",
 										  height : "2em",
+                                          formatter : function (row) {
+					                            return '<span class="'+classname+'_value_'+row+'"></span>';
+                                          },
 	                                      get : function (row) {
 		                                    if (!grid_row_object_cache[classname]) grid_row_object_cache[classname] = [];
 			                                var r = this.grid.model.getRow(row);
@@ -186,7 +195,7 @@
 		                                        );
 												var oldnode = dojo.byId('value_translation_' + classname + '_' + row);
 												if (oldnode) dijit.byNode(oldnode).destroyRecursive();
-					                            return '<span class="'+classname+'_value_'+row+'"></span>';
+					                            return row;
 						                    }
 							                return '';
 								          }
diff --git a/Open-ILS/web/conify/global/config/marc_code_maps.js b/Open-ILS/web/conify/global/config/marc_code_maps.js
index 8cc2306d29..4589a9870b 100644
--- a/Open-ILS/web/conify/global/config/marc_code_maps.js
+++ b/Open-ILS/web/conify/global/config/marc_code_maps.js
@@ -41,7 +41,7 @@ console.log('loading marc_code_maps.js');
 // some handy globals
 var cgi = new CGI();
 var ses = dojo.cookie('ses') || cgi.param('ses');
-var pCRUD = new openils.PermaCrudopenils.PermaCrud({authtoken:ses});
+var pCRUD = new openils.PermaCrud({authtoken:ses});
 
 console.log('initialized pcrud session');
 
diff --git a/Open-ILS/web/conify/global/permission/perm_list.html b/Open-ILS/web/conify/global/permission/perm_list.html
index a5cf65ae15..480d7e5a0a 100644
--- a/Open-ILS/web/conify/global/permission/perm_list.html
+++ b/Open-ILS/web/conify/global/permission/perm_list.html
@@ -63,10 +63,6 @@
 		<script type="text/javascript" src="perm_list.js"></script>
 
 		<script type="text/javascript"><![CDATA[
-			var highlighter= {};
-			highlighter.green = dojox.fx.highlight( { color : '#B4FFB4', node : 'grid_container', duration : 500 } );
-			highlighter.red = dojox.fx.highlight( { color : '#FF2018', node : 'grid_container', duration : 500 } );
-
 			var dirtyStore = [];
 			var perm_rows = [];
 
@@ -74,12 +70,13 @@
             var _perm_data = ppl.toStoreData( _perm_list, 'code' );
             var perm_store = new dojo.data.ItemFileWriteStore({ data : _perm_data });
 
+
             perm_store.onSet = function (item, attr, o, n) {
                 if (attr == 'ischanged') return;
                 if (n == o) return;
                 this.setValue( item, 'ischanged', 1);
             };
-			var perm_data_model = new dojox.grid.data.DojoData({ store: perm_store, query: { code : '*' } });
+
 
 			var perm_grid_layout = [
 				{	cells : [
@@ -91,6 +88,9 @@
 							{ name : ppl_strings.LABEL_TRANSLATION,
 							  width : "10em",
 							  height : "2em",
+							  formatter : function (value) {
+                                return '<span class="perm_grid_trans_desc_'+value+'"></span>';
+                              },
 							  get : function (row) {
 								var r = perm_data_model.getRow(row);
 								if (r) {
@@ -104,7 +104,7 @@
 									);
 									var oldnode = dojo.byId('description_translation_' + row);
 									if (oldnode) dijit.byNode(oldnode).destroyRecursive();
-									return '<span class="perm_grid_trans_desc_'+row+'"></span>';
+									return row;
 								}
 								return '';
 							  }
@@ -118,7 +118,7 @@
 
                 perm_store.fetch({
                     query : { ischanged : 1 },
-                    onItem : function (item, req) { try { if (this.isItem( item )) window.dirtyStore.push( item ); } catch (e) { /* meh */ } },
+                    onItem : function (item, req) { try { if (this.isItem( item )) dirtyStore.push( item ); } catch (e) { /* meh */ } },
                     scope : perm_store
                 });
 
@@ -127,7 +127,7 @@
 
                     if (confirmation) {
                         for (var i in dirtyStore) {
-                            window.current_perm = dirtyStore[i];
+                            current_perm = dirtyStore[i];
                             save_perm(true);
                         }
                     }
@@ -158,7 +158,7 @@
 	                    });
     
     	                var err = false;
-        	            pCRUD.create(new_fm_objnew_fm_obj, {
+        	            pCRUD.create(new_fm_obj, {
 	                        onerror : function (r) {
     	                        highlighter.red.play();
         	                    status_update( ppl_strings.ERROR_CALLING_METHOD_PPL );
@@ -178,11 +178,9 @@
 			</div>
 
 			<div dojoType="dijit.layout.ContentPane" style="width:100%; height:100%;" layoutAlign="client">
+                <div dojoType="dojox.grid.data.DojoData" id="perm_data_model" jsId="perm_data_model" store="perm_store" query="{ code : '*' }">
+                </div>
 				<div id="perm_grid" dojoType="dojox.Grid" model="perm_data_model" structure="perm_grid_layout" jsId="perm_grid">
-					<!--
-					<script type="dojo/connect" event="onSet" args="item,attr,oldVal,newVal">
-					</script>
-					-->
 				</div>
 			</div>
 
@@ -244,5 +242,11 @@
 			</div>
 		</div>
 	
+        <script type="text/javascript">
+            var highlighter= {};
+    		highlighter.green = dojox.fx.highlight( { color : '#B4FFB4', node : 'grid_container', duration : 500 } );
+	    	highlighter.red = dojox.fx.highlight( { color : '#FF2018', node : 'grid_container', duration : 500 } );
+        </script>
+
 	</body>
 </html>
-- 
2.11.0