From 05997cbb5a2975c6b9ac4d67baea75ffb741f1ed Mon Sep 17 00:00:00 2001 From: miker Date: Mon, 7 Apr 2008 20:28:55 +0000 Subject: [PATCH] adding status editor git-svn-id: svn://svn.open-ils.org/ILS/branches/dojo-admin@9257 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/conify/global/config/copy_status.html | 263 +++++++++++++++++++++ Open-ILS/web/conify/global/config/copy_status.js | 88 +++++++ 2 files changed, 351 insertions(+) create mode 100644 Open-ILS/web/conify/global/config/copy_status.html create mode 100644 Open-ILS/web/conify/global/config/copy_status.js diff --git a/Open-ILS/web/conify/global/config/copy_status.html b/Open-ILS/web/conify/global/config/copy_status.html new file mode 100644 index 0000000000..7e0e79a78e --- /dev/null +++ b/Open-ILS/web/conify/global/config/copy_status.html @@ -0,0 +1,263 @@ + + + Confiy :: Global :: Config :: Copy Status + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ New Status: +
+ +
+ +
+
+
+ +
+
+ +
+ + + + + +
+
+ + + diff --git a/Open-ILS/web/conify/global/config/copy_status.js b/Open-ILS/web/conify/global/config/copy_status.js new file mode 100644 index 0000000000..68c907ee84 --- /dev/null +++ b/Open-ILS/web/conify/global/config/copy_status.js @@ -0,0 +1,88 @@ +dojo.require('fieldmapper.dojoData'); +dojo.require('dojo.parser'); +dojo.require('dojo.string'); +dojo.require('dojo.data.ItemFileWriteStore'); +dojo.require('dijit.form.TextBox'); +dojo.require('dijit.form.ValidationTextBox'); +dojo.require('dijit.form.Textarea'); +dojo.require('dijit.layout.ContentPane'); +dojo.require('dijit.layout.LayoutContainer'); +dojo.require('dijit.layout.BorderContainer'); +dojo.require('dojox.widget.Toaster'); +dojo.require('dojox.fx'); +dojo.require('dojox.grid.Grid'); +dojo.require('dojox.grid._data.model'); +dojo.require("dojox.grid.editors"); + +// some handy globals +var cgi = new CGI(); +var cookieManager = new HTTP.Cookies(); +var ses = cookieManager.read('ses') || cgi.param('ses'); +var pCRUD = new OpenSRF.ClientSession('open-ils.permacrud'); + +var current_status; +var virgin_out_id = -1; + +var highlighter = {}; + +function status_update (markup) { + if (parent !== window && parent.status_update) parent.status_update( markup ); +} + +function save_status () { + + var modified_ccs = new ccs().fromStoreItem( current_status ); + modified_ccs.ischanged( 1 ); + + pCRUD.request({ + method : 'open-ils.permacrud.update.ccs', + timeout : 10, + params : [ ses, modified_ccs ], + onerror : function (r) { + highlighter.red.play(); + status_update( 'Problem saving ' + status_store.getValue( current_status, 'name' ) ); + }, + oncomplete : function (r) { + var res = r.recv(); + if ( res && res.content() ) { + status_store.setValue( current_status, 'ischanged', 0 ); + highlighter.green.play(); + status_update( 'Saved changes to ' + status_store.getValue( current_status, 'name' ) ); + } else { + highlighter.red.play(); + status_update( 'Problem saving ' + status_store.getValue( current_status, 'name' ) ); + } + }, + }).send(); +} + +function save_them_all (event) { + + status_store.fetch({ + query : { ischanged : 1 }, + onItem : function (item, req) { try { if (this.isItem( item )) window.dirtyStore.push( item ); } catch (e) { /* meh */ } }, + scope : status_store + }); + + var confirmation = true; + + + if (event && dirtyStore.length > 0) { + confirmation = confirm( + 'There are unsaved modified Statuses! '+ + 'OK to save these changes, Cancel to abandon them.' + ); + } + + if (confirmation) { + for (var i in window.dirtyStore) { + window.current_status = window.dirtyStore[i]; + save_status(true); + } + + window.dirtyStore = []; + } +} + +dojo.addOnUnload( save_them_all ); + -- 2.11.0