From 0991f58a4dc3e50c7ead6f11243bbc503c22c955 Mon Sep 17 00:00:00 2001 From: erickson Date: Tue, 31 Aug 2010 19:49:03 +0000 Subject: [PATCH] distribution formula config UI repairs/enhancements added distribution formula cloning added ability to change distrib formula name from formula detail page plugged some i18n holes using local copy of dimple grippy icons in distrib formula UI added local copy of dimple.png w/ new license file indicating image origin/license. git-svn-id: svn://svn.open-ils.org/ILS/trunk@17413 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../src/perlmods/OpenILS/Application/Acq/Order.pm | 44 +++++++++++++++++++ Open-ILS/web/images/dimple.png | Bin 0 -> 155 bytes Open-ILS/web/images/licenses.txt | 3 ++ Open-ILS/web/js/dojo/openils/conify/nls/conify.js | 4 +- .../conify/global/acq/distribution_formula.js | 36 ++++++++++++++++ .../conify/global/acq/distribution_formula.tt2 | 47 +++++++++++---------- 6 files changed, 110 insertions(+), 24 deletions(-) create mode 100644 Open-ILS/web/images/dimple.png create mode 100644 Open-ILS/web/images/licenses.txt diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm b/Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm index 044e5d166..a99ac8282 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Acq/Order.pm @@ -3124,4 +3124,48 @@ sub fetch_and_check_li { } +__PACKAGE__->register_method( + method => "clone_distrib_form", + api_name => "open-ils.acq.distribution_formula.clone", + stream => 1, + signature => { + desc => q/Clone a distribution formula/, + params => [ + {desc => "Authentication token", type => "string"}, + {desc => "Original formula ID", type => 'integer'}, + {desc => "Name of new formula", type => 'string'}, + ], + return => {desc => "ID of newly created formula"} + } +); + +sub clone_distrib_form { + my($self, $client, $auth, $form_id, $new_name) = @_; + + my $e = new_editor("xact"=> 1, "authtoken" => $auth); + return $e->die_event unless $e->checkauth; + + my $old_form = $e->retrieve_acq_distribution_formula($form_id) or return $e->die_event; + return $e->die_event unless $e->allowed('ADMIN_ACQ_DISTRIB_FORMULA', $old_form->owner); + + my $new_form = Fieldmapper::acq::distribution_formula->new; + + $new_form->owner($old_form->owner); + $new_form->name($new_name); + $e->create_acq_distribution_formula($new_form) or return $e->die_event; + + my $entries = $e->search_acq_distribution_formula_entry({formula => $form_id}); + for my $entry (@$entries) { + my $new_entry = Fieldmapper::acq::distribution_formula_entry->new; + $new_entry->$_($entry->$_()) for $entry->real_fields; + $new_entry->formula($new_form->id); + $new_entry->clear_id; + $e->create_acq_distribution_formula_entry($new_entry) or return $e->die_event; + } + + $e->commit; + return $new_form->id; +} + 1; + diff --git a/Open-ILS/web/images/dimple.png b/Open-ILS/web/images/dimple.png new file mode 100644 index 0000000000000000000000000000000000000000..4d0b91bfea743f38796fabf7e599ce6f23b6e246 GIT binary patch literal 155 zcmeAS@N?(olHy`uVBq!ia0vp^EI`c4!3HFg*81KCQj#UE5hcO-X(i=}MX3yqDfvmM z3ZA)%>8U}fi7AzZCsS>Jiflby978y+CnqE%Y+!g~rLiqRKupY!)##3c#F?_f!jB9^ zSAeX0+j64=oSmChIht?q{Qv*|I@==_jcaTSt)|kvPPx6SfCe#my85}Sb4q9e0Ol?* A$p8QV literal 0 HcmV?d00001 diff --git a/Open-ILS/web/images/licenses.txt b/Open-ILS/web/images/licenses.txt new file mode 100644 index 000000000..3392eb524 --- /dev/null +++ b/Open-ILS/web/images/licenses.txt @@ -0,0 +1,3 @@ +dimple.png derived from: +http://mxr.mozilla.org/mozilla-central/source/toolkit/themes/pinstripe/global/splitter/dimple.png +Mozilla Public License/GPL/GLPL diff --git a/Open-ILS/web/js/dojo/openils/conify/nls/conify.js b/Open-ILS/web/js/dojo/openils/conify/nls/conify.js index eea305da1..363d21dbd 100644 --- a/Open-ILS/web/js/dojo/openils/conify/nls/conify.js +++ b/Open-ILS/web/js/dojo/openils/conify/nls/conify.js @@ -85,6 +85,8 @@ "SURVEY_QUESTION": "Question:", "SURVEY_ID": "Survey ID # ${0}", "SURVEY_FOOT_LABEL": "Questions & Answers", - "EVENT_DEF_LABEL" : "${0}: ${1}" + "EVENT_DEF_LABEL" : "${0}: ${1}", + "ACQ_DISTRIB_FORMULA_NAME_PROMPT" : "Enter new formula name", + "ACQ_DISTRIB_FORMULA_NAME_CLONE" : "${0} (Clone)" } diff --git a/Open-ILS/web/js/ui/default/conify/global/acq/distribution_formula.js b/Open-ILS/web/js/ui/default/conify/global/acq/distribution_formula.js index 130bcc922..b992d2600 100644 --- a/Open-ILS/web/js/ui/default/conify/global/acq/distribution_formula.js +++ b/Open-ILS/web/js/ui/default/conify/global/acq/distribution_formula.js @@ -4,6 +4,9 @@ dojo.require('openils.widget.AutoGrid'); dojo.require('dijit.form.FilteringSelect'); dojo.require('openils.PermaCrud'); dojo.require('openils.widget.AutoFieldWidget'); +dojo.requireLocalization('openils.conify', 'conify'); +var localeStrings = dojo.i18n.getLocalization('openils.conify', 'conify'); + var formCache = []; var formula, entryTbody, entryTemplate, dndSource; @@ -42,6 +45,29 @@ function draw() { } } + +function cloneSelectedFormula() { + var item = fListGrid.getSelectedItems()[0]; + if(!item) return; + var formula = new fieldmapper.acqf().fromStoreItem(item); + fieldmapper.standardRequest( + ['open-ils.acq', 'open-ils.acq.distribution_formula.clone'], + { + asnyc : true, + params : [ + openils.User.authtoken, + formula.id(), + dojo.string.substitute(localeStrings.ACQ_DISTRIB_FORMULA_NAME_CLONE, [formula.name()]) + ], + oncomplete : function(r) { + if(r = openils.Util.readResponse(r)) { + location.href = oilsBasePath + '/conify/global/acq/distribution_formula/' + r; + } + } + } + ); +} + openils.Util.addOnLoad(draw); function getItemCount(rowIndex, item) { @@ -65,6 +91,16 @@ function drawFormulaSummary() { formula.entries(entries); dojo.byId('formula_head').innerHTML = formula.name(); + dojo.byId('formula_head').onclick = function() { + var name = prompt(localeStrings.ACQ_DISTRIB_FORMULA_NAME_PROMPT, formula.name()); + if(name && name != formula.name()) { + formula.name(name); + pcrud = new openils.PermaCrud(); + pcrud.update(formula); + dojo.byId('formula_head').innerHTML = name; + } + } + dojo.forEach(entries, function(entry) { addEntry(entry); } ); } diff --git a/Open-ILS/web/templates/default/conify/global/acq/distribution_formula.tt2 b/Open-ILS/web/templates/default/conify/global/acq/distribution_formula.tt2 index 2f900f2db..94a7e2ec3 100644 --- a/Open-ILS/web/templates/default/conify/global/acq/distribution_formula.tt2 +++ b/Open-ILS/web/templates/default/conify/global/acq/distribution_formula.tt2 @@ -1,22 +1,23 @@ [% WRAPPER default/base.tt2 %] [% ctx.page_title = 'Distribution Formulas' %] - @@ -27,6 +28,7 @@ function formatName(value) {
+
-
+
@@ -78,20 +80,19 @@ function formatName(value) {
- - - - + + +
- -
-
- - - +
+
+ + + +
[% END %] -- 2.11.0