From 9a55cb40055631f482bceb14d2571e90da1beb78 Mon Sep 17 00:00:00 2001 From: erickson Date: Tue, 26 May 2009 20:51:59 +0000 Subject: [PATCH] started plugging in the abiliy to define circ mod groups for a circ matrix test. just wireframe now. more later git-svn-id: svn://svn.open-ils.org/ILS/trunk@13238 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../global/config/circ_matrix_matchpoint.js | 72 +++++++++++++++++++ .../global/config/circ_matrix_matchpoint.tt2 | 39 +++++++--- 2 files changed, 100 insertions(+), 11 deletions(-) create mode 100644 Open-ILS/web/js/ui/default/conify/global/config/circ_matrix_matchpoint.js diff --git a/Open-ILS/web/js/ui/default/conify/global/config/circ_matrix_matchpoint.js b/Open-ILS/web/js/ui/default/conify/global/config/circ_matrix_matchpoint.js new file mode 100644 index 0000000000..c7a643f404 --- /dev/null +++ b/Open-ILS/web/js/ui/default/conify/global/config/circ_matrix_matchpoint.js @@ -0,0 +1,72 @@ +dojo.require('dijit.layout.ContentPane'); +dojo.require('dijit.form.Button'); +dojo.require('openils.widget.AutoGrid'); +dojo.require('openils.widget.AutoFieldWidget'); +dojo.require('openils.PermaCrud'); + +var circModEditor = null; + +function load(){ + cmGrid.loadAll({order_by:{ccmm:'circ_modifier'}}); + cmGrid.onEditPane = buildEditPaneAdditions; + circModEditor = dojo.byId('circ-mod-editor').parentNode.removeChild(dojo.byId('circ-mod-editor')); +} + +function byName(name, ctxt) { + return dojo.query('[name=' + name + ']', ctxt)[0]; +} + +function buildEditPaneAdditions(editPane) { + var node = circModEditor.cloneNode(true); + var tableTmpl = node.removeChild(byName('circ-mod-group-table', node)); + + byName('add-circ-mod-group', node).onclick = function() { + addCircModGroup(node, tableTmpl) + } + + var group = null; + if(editPane.mode == 'update') { + //group = + } + + editPane.domNode.appendChild(node); +} + +function addCircModGroup(node, tableTmpl, group) { + + var table = tableTmpl.cloneNode(true); + var circModRowTmpl = byName('circ-mod-entry-tbody', table).removeChild(byName('circ-mod-entry-row', table)); + + // loop over mods + // + + function addMod(mod) { + var row = circModRowTmpl.cloneNode(true); + byName('circ-mod', row).innerHTML = mod; + byName('circ-mod-entry-tbody', table).appendChild(row); + } + + new openils.widget.AutoFieldWidget({ + fmClass : 'ccmcmt', + fmField : 'items_out', + fmObject : group, + parentNode : byName('circ-mod-count', table) + }).build(); + + var selector = new openils.widget.AutoFieldWidget({ + fmClass : 'ccmcmtm', + fmField : 'circ_mod', + parentNode : byName('circ-mod-selector', table) + }); + selector.build(); + + byName('add-circ-mod', table).onclick = function() { + addMod(selector.widget.attr('value')); + } + + node.insertBefore(table, byName('add-circ-mod-group', node)); + node.insertBefore(dojo.create('hr'), byName('add-circ-mod-group', node)); +} + +openils.Util.addOnLoad(load); + diff --git a/Open-ILS/web/templates/default/conify/global/config/circ_matrix_matchpoint.tt2 b/Open-ILS/web/templates/default/conify/global/config/circ_matrix_matchpoint.tt2 index 7157e52267..5884f15142 100644 --- a/Open-ILS/web/templates/default/conify/global/config/circ_matrix_matchpoint.tt2 +++ b/Open-ILS/web/templates/default/conify/global/config/circ_matrix_matchpoint.tt2 @@ -1,15 +1,6 @@ [% ctc.page_title = 'Circulation Policy Configuration' %] [% WRAPPER default/base.tt2 %] - +
Circulation Policy Configuration
@@ -28,5 +19,31 @@ showColumnPicker='true' columnPickerPrefix='"conify.config.circ_matrix_matchpoint"'> -
+ + + + [% END %] + -- 2.43.2