Markup-based dijit.Dialog implementation, inspired by and based on a patch from Josep...
authorMike Rylander <mrylander@gmail.com>
Tue, 2 Aug 2011 16:42:53 +0000 (12:42 -0400)
committerDan Scott <dscott@laurentian.ca>
Fri, 30 Sep 2011 02:45:22 +0000 (22:45 -0400)
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Dan Scott <dscott@laurentian.ca>

Open-ILS/web/opac/skin/default/js/rdetail.js
Open-ILS/web/opac/skin/default/xml/page_rdetail.xml

index eae2aa0..0b04880 100644 (file)
@@ -51,6 +51,9 @@ if(location.href.match(/&place_hold=1/)) {
     hideMe(dojo.byId('canvas_main'));
 }
 
+dojo.require("dijit.Dialog");
+dojo.require("dijit.form.TextBox");
+
 /* serials are currently the only use of Dojo strings in the OPAC */
 if (rdetailDisplaySerialHoldings) {
        dojo.require("dijit.Menu");
@@ -675,13 +678,23 @@ function rdetailAddBookbags(r) {
 }
 
 var _actions = {};
-function rdetailNewBookbag() {
-       var name = prompt($('rdetail_bb_new').innerHTML,"");
-       if(!name) return;
-
+/**
+ * Adds a new bookbag and exits.
+ * 
+ * exitstatus should be 0 if the status is to be read.
+ */
+function finishBookbag(exitstatus) {
+       var name = bbName.attr('value');
+       
+       newBBDialog.hide();     
+       bbName.attr("value", ""); // Do this after hide so the text doesn't disappear.
+       
+       if(exitstatus != 0) return; // If the user canceled, just drop off here.
+       
        var id;
+       
        if( id = containerCreate( name ) ) {
-               alert($('rdetail_bb_success').innerHTML);
+               new dijit.Dialog({content: $('rdetail_bb_success').innerHTML,}).show();
                var selector = $('rdetail_more_actions_selector');
                insertSelectorVal( selector, nextContainerIndex++, name, 
                                "container_" + id, rdetailAddToBookbag, 1 );
@@ -689,6 +702,12 @@ function rdetailNewBookbag() {
        }
 }
 
+/**
+ * Creates a new Bookbag for the user.
+ */
+function rdetailNewBookbag() {
+       newBBDialog.show(); // Show the bookbag dialog.
+}
 
 function rdetailAddToBookbag() {
        var selector = $('rdetail_more_actions_selector');
index c816b6d..44e35ff 100644 (file)
 
        <div class='hide_me' id='rdetail_bb_none'>&rdetail.none;</div>
        <div class='hide_me' id='rdetail_bb_item_success'>&rdetail.bookbag.add.success;</div>
-       <div class='hide_me' id='rdetail_bb_new'>&rdetail.bookbag.name;</div>
+       <div dojoType='dijit.Dialog' id='newBBDialog' jsId='newBBDialog' title='&rdetail.bookbag.name;'>
+        <input id='bbName' jsId='bbName' dojoType='dijit.form.TextBox'></input><br/>
+        <button id='bbok' dojoType='dijit.form.Button' onClick='finishBookbag(0);' type='button'>&advanced.go;</button>
+        <button id='bbca' dojoType='dijit.form.Button' onClick='finishBookbag(1);' type='button'>&common.cancel;</button>
+    </div>
        <div class='hide_me' id='rdetail_bb_success'>&rdetail.bookbag.create.success;</div>
 
 </div>