Pretty start page for staff client menu to land on (that part TODO)
authorLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Fri, 21 Sep 2012 22:35:47 +0000 (18:35 -0400)
committerLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Fri, 21 Sep 2012 22:35:47 +0000 (18:35 -0400)
Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Open-ILS/src/templates/url_verify/sessions.tt2 [new file with mode: 0644]
Open-ILS/web/js/dojo/openils/URLVerify/Sessions.js [new file with mode: 0644]
Open-ILS/web/js/dojo/openils/URLVerify/nls/URLVerify.js

diff --git a/Open-ILS/src/templates/url_verify/sessions.tt2 b/Open-ILS/src/templates/url_verify/sessions.tt2
new file mode 100644 (file)
index 0000000..80cc3c6
--- /dev/null
@@ -0,0 +1,51 @@
+[% WRAPPER base.tt2 no_content_pane=1 %]
+[% ctx.page_title = "Link Checker" %]
+<script type="text/javascript">
+    dojo.require("dijit.form.Button");
+    dojo.require("openils.widget.FlattenerGrid");
+    dojo.require("openils.widget.OrgUnitFilteringSelect")
+    dojo.require("openils.URLVerify.Sessions");
+
+    /* Minimize namespace pollution, but save us some typing later. */
+    var module = openils.URLVerify.Sessions;
+
+    openils.Util.addOnLoad(
+        function() {
+            module.setup(grid, org_selector);
+        }
+    );
+</script>
+<div class="oils-header-panel" dojoType="dijit.layout.ContentPane" layoutAlign="top">
+    <div>[% ctx.page_title %]</div>
+    <div>
+        <strong><a href="create_session">[% l("New Link Checker Session") %]</a></strong>
+    </div>
+</div>
+<div class="oils-acq-basic-roomy" dojoType="dijit.layout.ContentPane" layoutAlign="top">
+    <label for="org_selector">[% l("View sessions started at:") %]</label>
+    <select id="org_selector" jsId="org_selector"
+        dojoType="openils.widget.OrgUnitFilteringSelect"
+        searchAttr="name" labelAttr="name">
+    </select>
+</div>
+<div dojoType="dijit.layout.ContentPane" layoutAlign="bottom" style="height: 85%;">
+    <table jsid="grid"
+        dojoType="openils.widget.FlattenerGrid"
+        editOnEnter="false"
+        hideSelector="true"
+        fetchLock="true"
+        fmClass="'uvs'">
+        <thead>
+            <tr>
+                <th field="id" fpath="id" formatter="module.format_id"></th>
+                <th field="name" fpath="name" width="auto"></th>
+                <th field="attempts" fpath="attempts.id" formatter="module.format_attempts" width="auto">[% l("Verification Attempts") %]</th>
+                <th field="creator" fpath="creator.usrname">[% l("Creator ") %]</th>
+                <th field="create_time" fpath="create_time" width="auto"></th>
+                <th field="search" fpath="search" width="auto"></th>
+                <th field="selectors" fpath="selectors.xpath" width="auto">[% l("URL Selectors") %]</th>
+            </tr>
+        </thead>
+    </table>
+</div>
+[% END %]
diff --git a/Open-ILS/web/js/dojo/openils/URLVerify/Sessions.js b/Open-ILS/web/js/dojo/openils/URLVerify/Sessions.js
new file mode 100644 (file)
index 0000000..a2283e5
--- /dev/null
@@ -0,0 +1,74 @@
+if (!dojo._hasResource["openils.URLVerify.Sessions"]) {
+    dojo.require("dojo.string");
+    dojo.require("openils.Util");
+    dojo.require("openils.URLVerify.Verify");
+
+    dojo.requireLocalization("openils.URLVerify", "URLVerify");
+
+    dojo._hasResource["openils.URLVerify.Sessions"] = true;
+    dojo.provide("openils.URLVerify.Sessions");
+
+    dojo.declare("openils.URLVerify.Sessions", null, {});
+
+    /* Take care that we add nothing to the global namespace.
+     * This is not an OO module so much as a container for
+     * functions needed by a specific interface. */
+
+(function() {
+    var module = openils.URLVerify.Sessions;
+    var localeStrings =
+        dojo.i18n.getLocalization("openils.URLVerify", "URLVerify");
+
+    module.setup = function(grid, org_selector) {
+        module.grid = grid;
+
+        module.setup_org_selector_for_grid(org_selector);
+    };
+
+    module.setup_org_selector_for_grid = function(org_selector) {
+        function filter_grid_by_selected_org() {
+            module.grid.query = {
+                "owning_lib": org_selector.attr("value")
+            };
+            module.grid.refresh();
+        }
+
+        new openils.User().buildPermOrgSelector(
+            "URL_VERIFY", org_selector, null,
+            function() {
+                dojo.connect(
+                    org_selector, "onChange", filter_grid_by_selected_org
+                );
+                filter_grid_by_selected_org();
+            }
+        );
+    };
+
+    module.format_id = function(str) {
+        if (!str)
+            return "";
+
+        return "<a href='select_urls?session_id=" + str + "' title='" +
+            localeStrings.REREVIEW + "'>" + str +
+            "</a> <a href='create_session?clone=" + str + "' title='" +
+            localeStrings.CLONE_SESSION + "'>" +
+            localeStrings.CLONE_SESSION + "</a>";
+    };
+
+    module.format_attempts = function(list) {
+        if (!dojo.isArray(list)) return "";
+
+        return dojo.map(
+            list, function(id) {
+                if (isNaN(id))
+                    return "";
+                return "<a title='" + localeStrings.REVIEW_ATTEMPT +
+                    "' href='review_attempt?attempt_id=" + id + "'>" +
+                    id + "</a>";
+            }
+        ).join(", ");
+    };
+
+}());
+
+}
index 03bbd7c..2fc04c2 100644 (file)
@@ -9,5 +9,8 @@
     "VERIFY_ALL": "Click 'OK' to verify ALL the URLs that belong to this session and match all your search terms.  Click 'Cancel' if the selected, visible URLs are the only ones you want verified.",
     "VERIFICATION_DIALOG": "Verifying URLs ...",
     "VERIFICATION_ATTEMPT_ID": "Verification attempt ID: ${0}",
-    "NOTHING_SELECTED": "No rows are selected, so no action will be taken."
+    "NOTHING_SELECTED": "No rows are selected, so no action will be taken.",
+    "REVIEW_ATTEMPT": "Review this verification attempt",
+    "CLONE_SESSION": "Clone",
+    "REREVIEW": "Review / Verify"
 }