-function addInstance() {
- try {
- var query = "backend.php?op=dlg&method=addInstance";
-
- if (dijit.byId("instanceAddDlg"))
- dijit.byId("instanceAddDlg").destroyRecursive();
-
- dialog = new dijit.Dialog({
- id: "instanceAddDlg",
- title: __("Link Instance"),
- style: "width: 600px",
- regenKey: function() {
- new Ajax.Request("backend.php", {
- parameters: "?op=rpc&method=genHash",
- onComplete: function(transport) {
- var reply = JSON.parse(transport.responseText);
- if (reply)
- dijit.byId('instance_add_key').attr('value', reply.hash);
-
- } });
- },
- execute: function() {
- if (this.validate()) {
- console.warn(dojo.objectToQuery(this.attr('value')));
-
- notify_progress('Saving data...', true);
- new Ajax.Request("backend.php", {
- parameters: dojo.objectToQuery(this.attr('value')),
- onComplete: function(transport) {
- dialog.hide();
- notify('');
- updateInstanceList();
- } });
- }
- },
- href: query,
- });
-
- dialog.show();
-
- } catch (e) {
- exception_error("addInstance", e);
- }
-}
-
-function editInstance(id, event) {
- try {
- if (!event || !event.ctrlKey) {
-
- selectTableRows('prefInstanceList', 'none');
- selectTableRowById('LIRR-'+id, 'LICHK-'+id, true);
-
- var query = "backend.php?op=pref-instances&method=edit&id=" +
- param_escape(id);
-
- if (dijit.byId("instanceEditDlg"))
- dijit.byId("instanceEditDlg").destroyRecursive();
-
- dialog = new dijit.Dialog({
- id: "instanceEditDlg",
- title: __("Edit Instance"),
- style: "width: 600px",
- regenKey: function() {
- new Ajax.Request("backend.php", {
- parameters: "?op=rpc&method=genHash",
- onComplete: function(transport) {
- var reply = JSON.parse(transport.responseText);
- if (reply)
- dijit.byId('instance_edit_key').attr('value', reply.hash);
-
- } });
- },
- execute: function() {
- if (this.validate()) {
-// console.warn(dojo.objectToQuery(this.attr('value')));
-
- notify_progress('Saving data...', true);
- new Ajax.Request("backend.php", {
- parameters: dojo.objectToQuery(this.attr('value')),
- onComplete: function(transport) {
- dialog.hide();
- notify('');
- updateInstanceList();
- } });
- }
- },
- href: query,
- });
-
- dialog.show();
-
- } else if (event.ctrlKey) {
- var cb = $('LICHK-' + id);
- cb.checked = !cb.checked;
- toggleSelectRow(cb);
- }
-
-
- } catch (e) {
- exception_error("editInstance", e);
- }