]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/web/conify/global/permission/grp_tree.html
LP#1617556 - Remove openils_dojo.js references
[Evergreen.git] / Open-ILS / web / conify / global / permission / grp_tree.html
1 <!--
2 # Copyright (C) 2008  Georgia Public Library Service / Equinox Software, Inc
3 # Mike Rylander <miker@esilibrary.com>
4
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
9
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 -->
15 <!DOCTYPE html PUBLIC 
16         "-//W3C//DTD XHTML 1.0 Transitional//EN" 
17         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" [
18         <!--#include virtual="/opac/locale/${locale}/conify.dtd"-->
19 ]>
20 <html xmlns="http://www.w2.org/1999/xhtml">
21         <head>
22                 <title>&conify.grp_tree.group_tree.title;</title>
23
24                 <style type="text/css">
25                         @import url('/js/dojo/dojox/grid/_grid/tundraGrid.css');
26                         @import url('/js/dojo/dojo/resources/dojo.css');
27                         @import url('/js/dojo/dijit/themes/tundra/tundra.css');
28                         @import url('/js/dojo/dojox/widget/Toaster/Toaster.css');
29                 </style>
30
31                 <style type="text/css">
32                         html, body
33                         {
34                                 height: 100%;
35                                 width: 100%;
36                                 margin: 0px 0px 0px 0px;
37                                 padding: 0px 0px 0px 0px;
38                                 overflow: hidden;
39                         }
40
41                         th
42                         {
43                                 text-align: right;
44                                 font-weight: bold;
45                                 padding-left: 20px;
46                                 padding-right: 5px;
47                         }
48
49             #perm_grid {
50                 border: 0px;
51                 width: 100%;
52                 height: 100%;
53             }
54
55             #grid_container {
56                 width: 75%;
57                 height: 100%;
58             }
59
60             /* this is a hack to get the right pane to display
61                in recent browsers when using this interface
62                embedded in the web staff client
63             */
64             .dijitLayoutContainer {
65                 position: static;
66             }
67
68                 </style>
69
70                 <!-- The OpenSRF API writ JS -->
71                 <script language='javascript' src='/IDL2js' type='text/javascript'></script>
72                 <script language='javascript' src='/opac/common/js/utils.js' type='text/javascript'></script>
73                 <script language='javascript' src='/opac/common/js/CGI.js' type='text/javascript'></script>
74                 <script language='javascript' src='/opac/common/js/JSON_v1.js' type='text/javascript'></script>
75
76                 <!-- Dojo goodness -->
77                 <script type="text/javascript" src="../admin.js"></script>
78                 <script type="text/javascript" src="/js/dojo/dojo/dojo.js"></script>
79                 <script type="text/javascript" src="/js/dojo/dijit/dijit.js"></script>
80
81                 <script type="text/javascript" src="grp_tree.js"></script>
82
83         <script type="text/javascript"><![CDATA[
84             var dirtyStore = [];
85             var current_group;
86
87             var _group_list = server.pcrud.retrieveAll('pgt', { order_by : { pgt : 'name' } });
88             var _group_data = pgt.toStoreData( _group_list );
89             var group_store = new dojo.data.ItemFileWriteStore({ data : _group_data });
90
91             group_store.onSet = function (item, attr, o, n) {
92                 if (attr == 'ischanged') return;
93                 if (n == o) return;
94                 this.setValue( item, 'ischanged', 1);
95             };
96
97             dojo.addOnUnload( function (event) {
98
99                 group_store.fetch({
100                     query : { ischanged : 1 },
101                     queryOptions : { deep : true },
102                     onItem : function (item, req) { try { if (this.isItem( item )) dirtyStore.push( item ); } catch (e) { /* meh */ } },
103                     scope : group_store
104                 });
105
106                 if (dirtyStore.length > 0) {
107                     var confirmation = confirm( pgt_strings.CONFIRM_EXIT_PGT );
108
109                     if (confirmation) {
110                         for (var i in dirtyStore) {
111                             current_group = dirtyStore[i];
112                             save_group(true);
113                         }
114                     }
115                 }
116
117             });
118
119             var _ou_type_list = server.pcrud.retrieveAll('aout', { order_by : { aout : 'depth' } });
120             var _ou_type_data = aout.toStoreData( _ou_type_list );
121             var ou_type_store = new dojo.data.ItemFileReadStore({ data : _ou_type_data });
122
123             var _perm_list = server.pcrud.retrieveAll('ppl', { order_by : { ppl : 'code' } });
124             var _perm_data = ppl.toStoreData( _perm_list, 'code' );
125             var _perm_name_data = ppl.toStoreData( _perm_list, 'code', { identifier : 'code' } );
126
127             var perm_store = new dojo.data.ItemFileWriteStore({ data : _perm_data });
128             var perm_name_store = new dojo.data.ItemFileWriteStore({ data : _perm_name_data });
129
130             var _perm_map_list = server.pcrud.retrieveAll('pgpm');
131             var _perm_map_data = pgpm.toStoreData( _perm_map_list, 'id' );
132             var perm_map_store = new dojo.data.ItemFileWriteStore({ data : _perm_map_data });
133
134             perm_map_store.onSet = function (item, attr, o, n) {
135                 if (attr == 'ischanged') return;
136                 if (n == o) return;
137
138                 this.setValue( item, 'ischanged', 1);
139
140                 if (attr == 'grantable' && (typeof (n) != 'string'))
141                     this.setValue(item, 'grantable', n ? 't' : 'f');
142             }
143
144             dojo.addOnUnload( function (event) { save_them_all(); });
145
146         ]]></script>
147
148         </head>
149
150         <body class="tundra" id='pagebody'>
151
152                 <div dojoType="dijit.layout.SplitContainer" orientation="horizontal" style="height: 100%">
153
154                         <div dojoType="dijit.layout.ContentPane" sizeShare="100">
155                                 <div
156                                   id="group_tree"
157                   label="&conify.grp_tree.permission_groups.label;"
158                                   dojoType="dijit.Tree"
159                                   store="group_store"
160                   query="{'_top':'true'}"
161                                   minSize="200"
162                                   jsId="group_tree"
163                                 >
164
165                                         <script type="dojo/method" event="onClick" args="item,node">
166 <![CDATA[
167                                                 right_pane_toggler.show();
168
169                                                 current_group = item;
170                                                 window.current_fm_group = new pgt().fromStoreItem(item);
171
172                                                 perm_map_model.query = { grp : current_group ? group_store.getValue(current_group,'id') : -1 };
173                                                 perm_map_model.refresh();
174                                                 perm_grid.refresh();
175
176                                                 highlighter.editor_pane.green.play();
177                                                 status_update( dojo.string.substitute( pgt_strings.STATUS_EDITING, [this.store.getValue( item, 'name' )]) );
178
179                                                 new_kid_button.disabled = false;
180                                                 save_group_button.disabled = false;
181                                                 delete_group_button.disabled = false;
182
183                                                 var main_settings_fields = [ 'name', 'perm_interval', 'description'];
184                                                 for ( var i in main_settings_fields ) {
185                                                         var field = main_settings_fields[i];
186                                                         var value = this.store.getValue( current_group, field );
187
188                                                         if (!value) {
189                                                                 window["editor_pane_" + field].setValue( '' ); // unset the value
190                                                                 if (field != 'description') window["editor_pane_" + field].setDisplayedValue( '' ); // unset the value
191                                                         } else window["editor_pane_" + field].setValue( value );
192                                                 }
193
194                                                 if ( this.store.getValue( current_group, '_trueRoot' ) == 'true' ) {
195                                                         editor_pane_parent.disabled = true;
196                                                         editor_pane_parent.setValue(null);
197                                                         editor_pane_parent.setDisplayedValue('');
198                                                         editor_pane_parent.validate(false);
199                                                 } else {
200                                                         editor_pane_parent.disabled = false;
201                                                         editor_pane_parent.validate(true);
202                                                         editor_pane_parent.setValue( this.store.getValue( current_group, 'parent' ) );
203                                                 }
204
205                                                 editor_pane_application_perm.setValue( this.store.getValue( current_group, 'application_perm' ) );
206                                                 editor_pane_hold_priority.setValue( this.store.getValue( current_group, 'hold_priority' ) );
207
208                                                 editor_pane_usergroup.setChecked( this.store.getValue( current_group, 'usergroup' ) == 't' ? true : false );
209 ]]>
210                                         </script>
211
212                                         <script type="dojo/method" event="getLabel" args="item,pI">
213                                                 var label = this.store.getValue(item,'name');
214                                                 if (this.store.getValue(item,'ischanged') == 1) label = '* ' + label;
215                                                 return label;
216                                         </script>
217
218                                 </div>
219                         </div>
220
221                         <div id="right_pane" dojoType="dijit.layout.ContentPane"  sizeShare="300">
222                                 <script type="dojo/method">
223                                         window.right_pane_toggler = new dojo.fx.Toggler({ node: 'right_pane'});
224                                         window.right_pane_toggler.hide();
225                                 </script>
226
227                                 <div dojoType="dijit.layout.TabContainer">
228                                         <div id="editor_pane" dojoType="dijit.layout.ContentPane" title="&conify.grp_tree.group_config.label;">
229                                                 <script type="dojo/method">
230                                                         highlighter.group_tree = {};
231                                                         highlighter.editor_pane = {};
232                                                         highlighter.group_tree.green = dojox.fx.highlight( { color : '#B4FFB4', node : 'group_tree', duration : 500 } );
233                                                         highlighter.group_tree.red = dojox.fx.highlight( { color : '#FF2018', node : 'group_tree', duration : 500 } );
234                                                         highlighter.editor_pane.green = dojox.fx.highlight( { color : '#B4FFB4', node : 'editor_pane', duration : 500 } );
235                                                         highlighter.editor_pane.red = dojox.fx.highlight( { color : '#FF2018', node : 'editor_pane', duration : 500 } );
236                                                 </script>
237         
238                                                 <table class="tundra" style="margin:10px;">
239                                                         <tr>
240                                                                 <th>&conify.grp_tree.group_name.label;</th>
241                                                                 <td>
242                                                                         <span id="editor_pane_name" dojoType="dijit.form.ValidationTextBox" jsId="editor_pane_name" regExp=".+" required="true">
243                                                                                 <script type="dojo/connect" event="onChange">
244                                                                                         if (current_group) {
245                                                                                                 group_store.setValue( current_group, "name", this.getValue() );
246                                                                                         }
247                                                                                 </script>
248                                                                         </span>
249                                                                         <span dojoType="openils.widget.TranslatorPopup" targetObject="current_fm_group" field="name"></span>
250                                                                 </td>
251                                                         </tr>
252                                                         <tr>
253                                                                 <th>&conify.grp_tree.description.label;</th>
254                                                                 <td>
255                                                                         <span>
256                                                                                 <textarea
257                                                                                   id="editor_pane_description"
258                                                                                   dojoType="dijit.form.Textarea"
259                                                                                   jsId="editor_pane_description"
260                                                                                   onChange="if (current_group) group_store.setValue( current_group, 'description', this.getValue() );"
261                                                                                 ></textarea>
262                                                                         </span>
263                                                                         <span dojoType="openils.widget.TranslatorPopup" targetObject="current_fm_group" field="description"></span>
264                                                                 </td>
265                                                         </tr>
266                                                         <tr>
267                                                                 <th>&conify.grp_tree.permission_interval.label;</th>
268                                                                 <td>
269                                                                         <span id="editor_pane_perm_interval" dojoType="dijit.form.ValidationTextBox" jsId="editor_pane_perm_interval" regExp="^\d+ (?:y.*|mo.*|d.*)$" required="true">
270                                                                                 <script type="dojo/connect" event="onChange">
271                                                                                         if (current_group) {
272                                                                                                 group_store.setValue( current_group, "perm_interval", this.getValue() );
273                                                                                         }
274                                                                                 </script>
275                                                                         </span>
276                                                                 </td>
277                                                         </tr>
278                                                         <tr>
279                                                                 <th>&conify.grp_tree.editing_permission.label;</th>
280                                                                 <td>
281                                                                         <div
282                                                                           id="editor_pane_application_perm"
283                                                                           dojoType="dijit.form.FilteringSelect"
284                                                                           store="perm_name_store"
285                                                                           searchAttr="code"
286                                                                           jsId="editor_pane_application_perm"
287                                                                         >
288                                                                                 <script type="dojo/connect" event="onChange">
289 <![CDATA[
290                                                                                         if (current_group && this.getValue()) {
291                                                                                                 group_store.setValue( current_group, "application_perm", this.getValue() );
292                                                                                         }
293 ]]>
294                                                                                 </script>
295                                                                         </div>
296                                                                 </td>
297                                                         </tr>
298                                                         <tr>
299                                                                 <th>&conify.grp_tree.hold_priority.label;</th>
300                                                                 <td>
301                                                                         <div
302                                                                           id="editor_pane_hold_priority"
303                                                                           dojoType="dijit.form.NumberSpinner"
304                                                                           jsId="editor_pane_hold_priority"
305                                                                         >
306                                                                                 <script type="dojo/connect" event="onChange">
307 <![CDATA[
308                                                                                         if (current_group && this.getValue()) {
309                                                                                                 group_store.setValue( current_group, "hold_priority", this.getValue() );
310                                                                                         }
311 ]]>
312                                                                                 </script>
313                                                                         </div>
314                                                                 </td>
315                                                         </tr>
316                                                         <tr>
317                                                                 <th>&conify.grp_tree.parent_group.label;</th>
318                                                                 <td>
319                                                                         <div
320                                                                           id="editor_pane_parent"
321                                                                           dojoType="dijit.form.FilteringSelect"
322                                                                           jsId="editor_pane_parent"
323                                                                           store="group_store"
324                                                                           searchAttr="name"
325                                                                           ignoreCase="true"
326                                                                           required="true"
327                                                                         >
328                                                                                 <script type="dojo/connect" event="onChange">
329 <![CDATA[
330                                                                                         if (current_group && this.getValue()) {
331                                                                                                 this.store.setValue( current_group, "parent", this.getValue() );
332                                                                                         }
333 ]]>
334                                                                                 </script>
335                                                                         </div>
336                                                                 </td>
337                                                         </tr>
338                                                         <tr>
339                                                                 <th>&conify.grp_tree.user_group.label;</th>
340                                                                 <td>
341                                                                         <input
342                                                                           id="editor_pane_usergroup"
343                                                                           jsId="editor_pane_usergroup"
344                                                                           type="checkbox"
345                                                                           dojoType="dijit.form.CheckBox"
346                                                                           onChange="if (current_group) group_store.setValue( current_group, 'usergroup', this.checked ? 't' : 'f' );"
347                                                                         />
348                                                                 </td>
349                                                         </tr>
350                                                 </table>
351         
352                                                 <div dojoType="dijit.layout.ContentPane" orientation="horizontal" style="margin-bottom: 20px;">
353         
354                                                         <button jsId="save_group_button" dojoType="dijit.form.Button" label="&conify.grp_tree.save_button.label;" onClick="save_group()">
355                                                                 <script type="dojo/connect" event="startup">
356                                                                         this.disabled = true;
357                                                                 </script>
358                                                         </button>
359         
360                                                         <button jsId="delete_group_button" dojoType="dijit.form.Button" label="&conify.grp_tree.delete_button.label;">
361                                                                 <script type="dojo/connect" event="startup">
362                                                                         this.disabled = true;
363                                                                 </script>
364                                                                 <script type="dojo/connect" event="onClick">
365 <![CDATA[
366         
367                                                                         if (group_store.getValue( current_group, '_trueRoot' ) == 'true') {
368                                                                                 highlighter.editor_pane.red.play();
369                                                                                 status_update( dojo.string.substitute( pgt_strings.STATUS_ERR_DELETING, [group_store.getValue( current_group, 'name' )])  );
370                                                                                 return false;
371                                                                         }
372
373                                                                         if ( current_group.children ) {
374                                                                                 var kids = current_group.children;
375                                                                                 if (!dojo.isArray(kids)) kids = [kids];
376         
377                                                                                 var existing_kids = dojo.filter(
378                                                                                         kids,
379                                                                                         function(kid){ return kid.isdeleted[0] != 1 }
380                                                                                 );
381                                                                                 if ( existing_kids.length > 0) {
382                                                                                         highlighter.editor_pane.red.play();
383                                                                                         status_update( dojo.string.substitute( pgt_strings.STATUS_ERR_DELETING_DEPENDENCY, [group_store.getValue( current_group, 'name' ), existing_kids.length]) );
384                                                                                         return;
385                                                                                 }
386                                                                         }
387         
388                                                                         if ( confirm( dojo.string.substitute( pgt_strings.CONFIRM_DELETE, [current_group.name]) ) ) {
389                                                                                 group_store.setValue( current_group, 'isdeleted', 1 );
390         
391                                                                                 var modified_pgt = new pgt().fromStoreItem( current_group );
392                                                                                 modified_pgt.isdeleted( 1 );
393         
394                                                                                 server.pcrud.eliminate( modified_pgt, {
395                                                                                         onerror : function (r) {
396                                                                                                 highlighter.editor_pane.red.play();
397                                                                                                 status_update( dojo.string.substitute( pgt_strings.CONFIRM_DELETE, [group_store.getValue( current_group, 'name' )]) );
398                                                                                         },
399                                                                                         oncomplete : function (r) {
400                                                                                                 var old_name = group_store.getValue( current_group, 'name' );
401
402                                                                                                 group_store.fetch({
403                                                                                                         query : { id : group_store.getValue( current_group, 'id' ) },
404                                                                                                         queryOptions : { deep : true },
405                                                                                                         onItem : function (item, req) { try { if (this.isItem( item )) this.deleteItem( item ); } catch (e) { /* meh */ } },
406                                                                                                         scope : group_store
407                                                                                                 });
408
409                                                                                                 current_group = null;
410
411                                                                                                 new_kid_button.disabled = true;
412                                                                                                 save_group_button.disabled = true;
413                                                                                                 delete_group_button.disabled = true;
414                 
415                                                                                                 var main_settings_fields = [ 'name', 'perm_interval', 'description' ];
416                                                                                                 for ( var i in main_settings_fields ) {
417                                                                                                         var field = main_settings_fields[i];
418                                                                                                         window["editor_pane_" + field].setValue( '' ); // unset the value
419                                                                                                         window["editor_pane_" + field].setDisplayedValue( '' ); // unset the value
420                                                                                                 }
421
422                                                                                                 window["editor_pane_usergroup"].setChecked( false ); // unset the value
423                 
424                                                                                                 highlighter.editor_pane.green.play();
425                                                                                                 status_update( dojo.string.substitute( pgt_strings.STATUS_DELETED, [old_name]) );
426                                                                                         }
427                                                                                 });
428         
429                                                                         }
430 ]]>     
431                                                                 </script>
432                                                         </button>
433         
434                                                 </div>
435         
436                                                 <button jsId="new_kid_button" dojoType="dijit.form.Button" label="&conify.grp_tree.new_child_button.label;">
437                                                         <script type="dojo/connect" event="startup">
438                                                                 this.disabled = true;
439                                                         </script>
440                                                         <script type="dojo/connect" event="onClick">
441 <![CDATA[
442         
443                                                                 var new_fm_obj = new pgt().fromHash({
444                                                                         isnew                   : 1,
445                                                                         name                    : pgt_strings.LABEL_NEW_GROUP,
446                                                                         usergroup               : 'f',
447                                                                         parent                  : group_store.getValue( current_group, 'id' )
448                                                                 });
449         
450                                                                 var err = false;
451
452                                                                 server.pcrud.create( new_fm_obj, {
453                                                                         onerror : function (r) {
454                                                                                 highlighter.editor_pane.red.play();
455                                                                                 status_update( pgt_strings.ERROR_CALLING_METHOD_PGT );
456                                                                                 err = true;
457                                                                         },
458                                     oncomplete : function (r,list) {
459                                                                         group_store.newItem( list[0].toStoreItem(), { parent : current_group, attribute : 'children' } );
460                                     }
461                                 });
462
463                                                                 if (!err) {
464                                                                         highlighter.editor_pane.green.play();
465                                                                         highlighter.group_tree.green.play();
466                                                                         status_update( dojo.string.substitute( pgt_strings.SUCCESS_NEW_CHILD_GROUP, [group_store.getValue( current_group, 'name' )]) );
467                                                                 }
468 ]]>     
469                                                         </script>
470                                                 </button>
471         
472                                         </div>
473
474                                         <div id="perm_pane" dojoType="dijit.layout.ContentPane" title="&conify.grp_tree.group_permissions.title;">
475                                                 <script type="dojo/connect" event="onShow">
476                                                         perm_map_model.query = { grp : current_group ? group_store.getValue(current_group,'id') : -1 };
477                                                         perm_map_model.refresh();
478                                                         perm_grid.refresh();
479                                                 </script>
480                                                 <div dojoType="dijit.layout.LayoutContainer" orientation="horizontal" style="width:100%; height:100%; min-height: 250px">
481                                                         <div id="grid_container" dojoType="dijit.layout.ContentPane" sizeShare="1" layoutAlign="left">
482                                                                 <div dojoType="dojox.grid.data.DojoData" id="perm_map_model" jsId="perm_map_model" store="perm_map_store"></div>
483         
484                                                                 <div id="perm_grid" dojoType="dojox.Grid" model="perm_map_model" jsId="perm_grid">
485                                                                         <script type="dojo/connect" event="startup">
486 <![CDATA[
487                                                                                 function get_item_part(model_field, item_search_field, item_part, model, store, datum, row) {
488                                                                                         var formatter = true;
489         
490                                                                                         if (!row && row != '0') {
491                                                                                                 row = datum;
492                                                                                                 formatter = false;
493                                                                                         }
494         
495                                                                                         if(!model.getRow(row)) return null;
496                                                                                         var value = null;
497         
498                                                                                         if(!formatter) { //this.editor && (this.editor.alwaysOn || (this.grid.edit.info.rowIndex==row && this.grid.edit.info.cell==this))) {
499                                                                                                 return model.getRow(row)[model_field];
500                                                                                         }
501         
502                                                                                         var q = {};
503                                                                                         q[item_search_field] = model.getRow(row)[model_field];
504         
505                                                                                         store.fetch({
506                                                                                                 query : q,
507                                                                                                 onItem : function (item) { value = store.getValue( item, item_part ) }
508                                                                                         });
509
510                                                                                         return value;
511                                                                                 }
512         
513                                                     window.current_perm_grid_layout = [
514                                                         {   cells : [
515                                                                     [
516                                                                             {   name : pgt_strings.LABEL_CODE,
517                                                                                                                         field: "perm",
518                                                                                                                         formatter : dojo.partial(get_item_part, "perm", "id", "code", perm_map_model, perm_store),
519                                                                                                                         width : "auto"
520                                                                                                                 },
521                                                                                                 {       name : pgt_strings.LABEL_DEPTH,
522                                                                                                                         field : "depth",
523                                                                                                                         formatter : dojo.partial(get_item_part, "depth", "depth", "name", perm_map_model, ou_type_store),
524                                                                                                                         editor : dojox.grid.editors.select,
525                                                                                                                         options : dojo.map( _ou_type_list, function (x) { return x.name() } ),
526                                                                                                                         values : dojo.map( _ou_type_list, function (x) { return x.depth() } )
527                                                                                                                 }, 
528                                                                     {   name : pgt_strings.LABEL_GRANTABLE,
529                                                                                                                         field : "grantable",
530                                                                                                                         editor : dojox.grid.editors.bool,
531                                                                                                                         get : function (row) {
532                                                                                                                                 var gr = get_item_part("id", "id", "grantable", perm_map_model, perm_map_model.store, row, row);
533                                                                                                                                 if (gr == 't' || gr === true) return true;
534                                                                                                                                 return false;
535                                                                                                                         },
536                                                                                                                 }
537                                                                                                 ]
538                                                                                                 ]
539                                                         }
540                                                     ];
541
542                                                                                 perm_grid.setStructure(window.current_perm_grid_layout);
543 ]]>
544                                                                         </script>
545                                                                 </div>
546                                                         </div>
547
548                                                         <div id="new_perm_container" dojoType="dijit.layout.ContentPane" sizeShare="1" layoutAlign="client">
549
550                                                                 <div dojoType="dijit.form.DropDownButton" id="new_popup" jsId="new_popup">
551                                                                         <span>&conify.grp_tree.new_mapping.label;</span>
552                                                                         <div  dojoType="dijit.TooltipDialog"> 
553                                                                                 <table class="tundra">
554                                                                                         <tr>
555                                                                                                 <td>&conify.grp_tree.permission.label;</td>
556                                                                                                 <td>
557                                                                                                         <div
558                                                                                                           dojoType="dijit.form.FilteringSelect"
559                                                                                                           Id="new_perm_select"
560                                                                                                           jsId="new_perm_select"
561                                                                                                           store="perm_store"
562                                                                                                           searchAttr="code"
563                                                                                                           ignoreCase="true"
564                                                                                                           required="true"></div>
565                                                                                                 </td>
566                                                                                         </tr>
567                                                                                         <tr>
568                                                                                                 <td>&conify.grp_tree.depth.label;</td>
569                                                                                                 <td>
570                                                                                                         <div
571                                                                                                           dojoType="dijit.form.FilteringSelect"
572                                                                                                           Id="new_depth_select"
573                                                                                                           jsId="new_depth_select"
574                                                                                                           store="ou_type_store"
575                                                                                                           searchAttr="name"
576                                                                                                           ignoreCase="true"
577                                                                                                           required="true"></div>
578                                                                                                 </td>
579                                                                                         </tr>
580                                                                                         <tr>
581                                                                                                 <td>&conify.grp_tree.grantable.label;</td>
582                                                                                                 <td>
583                                                                                                         <input
584                                                                                                           type="checkbox"
585                                                                                                           dojoType="dijit.form.CheckBox"
586                                                                                                           Id="new_grant_checkbox"
587                                                                                                           jsId="new_grant_checkbox"
588                                                                                                           value="t"></input>
589                                                                                                 </td>
590                                                                                         </tr>
591                                                                                 </table>
592
593                                                                                 <button dojoType="dijit.form.Button" jsId="new_mapping_add" label="&conify.grp_tree.add_mapping_button.label;">
594                                                                     <script type="dojo/connect" event="onClick">
595 <![CDATA[
596                                                                         var new_perm = new_perm_select.getValue();
597                                                                         if (!new_perm) return;
598                 
599                                                                         var new_type_id = new_depth_select.getValue();
600                                                                         if (!new_type_id) return;
601                 
602                                                                                                 var new_type;
603                                                                 window.ou_type_store.fetch({
604                                                                 query : { id : new_type_id },
605                                                                 onItem : function (item, req) { try { new_type = item } catch (e) { /* meh */ } },
606                                                                 });
607                 
608                                                                         var new_depth = ou_type_store.getValue( new_type, 'depth')
609                                                                         var new_grant = new_grant_checkbox.getValue();
610                                                 
611                                                                         var new_fm_obj = new pgpm().fromHash({
612                                                                             isnew       : 1,
613                                                                             perm        : new_perm,
614                                                                             depth       : new_depth,
615                                                                                                         grp                     : group_store.getValue( current_group, 'id' ),
616                                                                                                         grantable       : new_grant ? 't' : 'f'
617                                                                         });
618                                                     
619                                                                         var err = false;
620                                                                         server.pcrud.create(new_fm_obj, {
621                                                                             onerror : function (r) {
622                                                                                 highlighter.group_tree.red.play();
623                                                                                 status_update( pgt_strings.ERROR_CALLING_METHOD_PERM_MAP );
624                                                                                 err = true;
625                                                                             },
626                                                                             oncomplete : function (r, list) {
627                 
628                                                                                 var new_item_hash = list[0].toStoreItem();
629                                                                                 perm_map_store.newItem( new_item_hash );
630                                                                                 status_update( pgt_strings.SUCCESS_NEW_PERM_MAP );
631                                                                                 highlighter.group_tree.green.play();
632                 
633                                                                                         perm_map_model.query = { grp : current_group ? group_store.getValue(current_group,'id') : -1 };
634                                                                                 perm_grid.model.sort(-1);
635                                                                                         perm_map_model.refresh();
636                                                                                         perm_grid.refresh();
637                 
638                                                                             }
639                                                                         });
640
641                                                                                                 new_popup._closeDropDown();
642 ]]>    
643                                                                     </script>
644                 
645                                                                                 </button>
646                                                                         </div>
647                                                                 </div>
648
649                                                                 <button jsId="save_pgpm_button" dojoType="dijit.form.Button" label="&conify.grp_tree.save_changes.label;" onClick="save_them_all()"></button><br/>
650
651                                                 <button jsId="delete_pgpm_button" dojoType="dijit.form.Button" label="&conify.grp_tree.remove_selected.label;">
652                                                         <script type="dojo/connect" event="onClick">
653 <![CDATA[
654                                                         var selected_rows = perm_grid.selection.getSelected();
655                                         
656                                                         var selected_items = [];
657                                                         for (var i in selected_rows) {
658                                                             selected_items.push(
659                                                                 perm_grid.model.getRow( selected_rows[i] ).__dojo_data_item
660                                                             );
661                                                         }
662                         
663                                                         perm_grid.selection.clear();
664                                 
665                                                             for (var i in selected_items) {
666                                                                     window.current_perm_map = selected_items[i];
667                         
668                                                                         perm_map_store.setValue( window.current_perm_map, 'isdeleted', 1 );
669                                                         
670                                                                             var modified_pgpm = new pgpm().fromStoreItem( window.current_perm_map );
671                                                                                 modified_pgpm.isdeleted( 1 );
672                                     
673                                                         server.pcrud.eliminate( modified_pgpm, {
674                                                                     onerror : function (r) {
675                                                                                                         highlighter.editor_pane.red.play();
676                                                                                 status_update( dojo.string.substitute( pgt_strings.ERROR_DELETING_PERM_MAPPING, [perm_map_store.getValue( window.current_perm_map, 'id' )] ) );
677                                                                                 },
678                                                                                     oncomplete : function (r, list) {
679                                                 
680                                                                             perm_map_store.fetch({
681                                                                                     query : { id : perm_map_store.getValue( window.current_perm_map, 'id' ) },
682                                                                                         onItem : function (item, req) { try { if (this.isItem( item )) this.deleteItem( item ); } catch (e) { /* meh */ } },
683                                                                                             scope : perm_map_store
684                                                                                             });
685                             
686                                                                                                 window.current_perm_map = null;
687                                                 
688                                                                                                         highlighter.editor_pane.green.play();
689                                                                                 status_update( pgt_strings.SUCCESS_DELETED_PERM_MAP );
690                                                             }
691                                                         });
692                                         
693                                                         }
694 ]]>
695                                                         </script>
696                                                         </button>
697         
698                                                         </div>
699                                                 </div>
700                                         </div>
701                                 </div>
702                         </div>
703                 </div>
704         </body>
705 </html>