Basic auto-grid based editor for copy templates. Useful esp. for serials.
authorsenator <senator@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 30 Aug 2010 17:02:22 +0000 (17:02 +0000)
committersenator <senator@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 30 Aug 2010 17:02:22 +0000 (17:02 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@17387 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/examples/fm_IDL.xml
Open-ILS/web/js/ui/default/conify/global/asset/copy_template.js [new file with mode: 0644]
Open-ILS/web/opac/locale/en-US/lang.dtd
Open-ILS/web/templates/default/conify/global/asset/copy_template.tt2 [new file with mode: 0644]
Open-ILS/xul/staff_client/chrome/content/main/menu.js
Open-ILS/xul/staff_client/chrome/content/main/menu_frame_menus.xul

index 639018d..3151c01 100644 (file)
@@ -4406,7 +4406,7 @@ SELECT  usr,
 
        <class id="act" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="asset::copy_template" oils_persist:tablename="asset.copy_template" reporter:label="Asset Copy Template">
                <fields oils_persist:primary="id" oils_persist:sequence="asset.copy_template_id_seq">
-                       <field reporter:label="ID" name="id" reporter:datatype="id"/>
+                       <field reporter:label="ID" name="id" reporter:datatype="id" reporter:selector="name" />
                        <field reporter:label="Owning Lib" name="owning_lib" reporter:datatype="link"/>
                        <field reporter:label="Creator" name="creator" reporter:datatype="link"/>
                        <field reporter:label="Editor" name="editor" reporter:datatype="link"/>
diff --git a/Open-ILS/web/js/ui/default/conify/global/asset/copy_template.js b/Open-ILS/web/js/ui/default/conify/global/asset/copy_template.js
new file mode 100644 (file)
index 0000000..70d3812
--- /dev/null
@@ -0,0 +1,60 @@
+dojo.require("dojo.data.ItemFileWriteStore");
+dojo.require("dijit.form.CurrencyTextBox");
+dojo.require("dijit.form.FilteringSelect");
+dojo.require("openils.widget.AutoGrid");
+dojo.require("openils.PermaCrud");
+dojo.require("openils.widget.OrgUnitFilteringSelect");
+
+var pcrud;
+var actOwner;
+var actList;
+
+function actInit() {
+    pcrud = new openils.PermaCrud();
+
+    new openils.User().buildPermOrgSelector(
+        "ADMIN_ASSET_COPY_TEMPLATE",
+        actOwnerSelect,
+        null,
+        function() {
+            dojo.connect(
+                actOwnerSelect,
+                "onChange",
+                function() {
+                    actOwner = fieldmapper.aou.findOrgUnit(this.attr("value"));
+                    actGrid.resetStore();
+                    buildActGrid();
+                }
+            );
+            buildActGrid();
+        }
+    );
+}
+
+function buildActGrid() {
+    if (!actOwner)
+        actOwner = fieldmapper.aou.findOrgUnit(openils.User.user.ws_ou());
+
+    pcrud.search(
+        "act", {
+            "owning_lib": fieldmapper.aou.orgNodeTrail(actOwner, true /* asId */)
+        }, {
+            "async": true,
+            "onresponse": function(r) {
+                if ((actList = openils.Util.readResponse(r))) {
+                    actList = openils.Util.objectSort(actList);
+                    actList.forEach(
+                        function(o) {
+                            actGrid.store.newItem(act.toStoreItem(o));
+                        }
+                    );
+                }
+            },
+            "oncomplete": function() {
+                actGrid.hideLoadProgressIndicator();
+            }
+        }
+    );
+}
+
+openils.Util.addOnLoad(actInit);
index 9c48de5..ff0b626 100644 (file)
 <!ENTITY staff.main.menu.admin.local_admin.hold_matrix_matchpoint.label "Hold Policies">
 <!ENTITY staff.main.menu.admin.local_admin.work_log.label "Work Log">
 <!ENTITY staff.main.menu.admin.local_admin.work_log.accesskey "W">
+<!ENTITY staff.main.menu.admin.local_admin.copy_template.label "Copy Template Editor">
+<!ENTITY staff.main.menu.admin.local_admin.copy_template.accesskey "T">
 <!ENTITY staff.main.menu.admin.local_admin.patrons_due_refunds.label "Patrons with Negative Balances">
 <!ENTITY staff.main.menu.admin.local_admin.patrons_due_refunds.accesskey "N">
 
diff --git a/Open-ILS/web/templates/default/conify/global/asset/copy_template.tt2 b/Open-ILS/web/templates/default/conify/global/asset/copy_template.tt2
new file mode 100644 (file)
index 0000000..fa5081b
--- /dev/null
@@ -0,0 +1,33 @@
+[% WRAPPER default/base.tt2 %]
+[% ctx.page_title = "Copy Templates" %]
+<script type="text/javascript" src="[% ctx.media_prefix %]/js/ui/default/conify/global/asset/copy_template.js"> </script>
+<div dojoType="dijit.layout.ContentPane" layoutAlign="client">
+    <div dojoType="dijit.layout.ContentPane"
+         layoutAlign="top" class="oils-header-panel">
+        <div>Copy Templates</div>
+        <div>
+            <button dojoType="dijit.form.Button"
+                onClick="actGrid.showCreateDialog()">New Copy Template</button>
+            <button dojoType="dijit.form.Button"
+                onClick="actGrid.deleteSelected()">Delete Selected</button>
+        </div>
+    </div>
+    <div class="oils-acq-basic-roomy">
+        <span>Show templates available at or above</span>
+        <select
+            dojoType="openils.widget.OrgUnitFilteringSelect"
+            jsId="actOwnerSelect"
+            searchAttr="shortname" labelAttr="shortname">
+        </select>
+    </div>
+    <table jsId="actGrid"
+        dojoType="openils.widget.AutoGrid"
+        fieldOrder="['name', 'owning_lib']"
+        suppressFields="['creator','editor','edit_date', 'create_date']"
+        query="{id: '*'}"
+        fmClass="act"
+        autoHeight="true"
+        editOnEnter="true">
+    </table>
+</div>
+[% END %]
index 3eea821..d7293f7 100644 (file)
@@ -684,6 +684,12 @@ main.menu.prototype = {
                     );
                 }
             ],
+            "cmd_local_admin_copy_template": [
+                ["oncommand"],
+                function() {
+                    open_eg_web_page("conify/global/asset/copy_template");
+                }
+            ],
             'cmd_local_admin_patrons_due_refunds' : [
                 ['oncommand'],
                 function() {
index d65d934..4b9db59 100644 (file)
     <command id="cmd_local_admin_hold_matrix_matchpoint"/>
     <command id="cmd_local_admin_work_log"/>
     <command id="cmd_local_admin_patrons_due_refunds"/>
+    <command id="cmd_local_admin_copy_template"/>
 
     <!-- server admin menu commands -->
     <command id="cmd_server_admin_org_type"/>
                 <menuitem label="&staff.main.menu.admin.local_admin.conify.survey.label;" command="cmd_local_admin_survey"/>
                 <menuitem label="&staff.server.admin.index.transit_list;" command="cmd_local_admin_transit_list"/>
                 <menuitem label="&staff.main.menu.admin.local_admin.work_log.label;" accesskey="&staff.main.menu.admin.local_admin.work_log.accesskey;" command="cmd_local_admin_work_log"/>
+                <menuitem label="&staff.main.menu.admin.local_admin.copy_template.label;" accesskey="&staff.main.menu.admin.local_admin.copy_template.accesskey;" command="cmd_local_admin_copy_template"/>
             </menupopup>
         </menu>
         <menu id="main.menu.admin.server" label="&staff.main.menu.admin.server_admin.label;">