[Koha-patches] [PATCH] Moving some list functions into the standard toolbar.

Owen Leonard oleonard at myacpl.org
Thu Dec 31 18:43:57 CET 2009


- Adding download functions to menu button
- Some markup corrections
---
 C4/VirtualShelves/Page.pm                          |    2 +
 .../prog/en/includes/virtualshelves-toolbar.inc    |   85 +++++++++++++++++---
 .../en/modules/virtualshelves/sendshelfform.tmpl   |    6 +-
 .../prog/en/modules/virtualshelves/shelves.tmpl    |   32 +++----
 4 files changed, 93 insertions(+), 32 deletions(-)

diff --git a/C4/VirtualShelves/Page.pm b/C4/VirtualShelves/Page.pm
index 9e618c5..d80c72c 100644
--- a/C4/VirtualShelves/Page.pm
+++ b/C4/VirtualShelves/Page.pm
@@ -33,6 +33,7 @@ use C4::Output;
 use C4::Dates qw/format_date/;
 use Exporter;
 use Data::Dumper;
+use C4::Csv;
 
 use vars qw($debug @EXPORT @ISA $VERSION);
 
@@ -317,6 +318,7 @@ $template->param(
     shelvesloopall  => [(@shelvesloop, @shelveslooppriv)],
     numberCanManage => $numberCanManage,
 	"BiblioDefaultView".C4::Context->preference("BiblioDefaultView") => 1,
+    csv_profiles => GetCsvProfilesLoop()
 );
 if ($template->param('viewshelf') or
 	$template->param( 'shelves' ) or
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/virtualshelves-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/virtualshelves-toolbar.inc
index 5ad8bb9..f05764d 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/virtualshelves-toolbar.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/virtualshelves-toolbar.inc
@@ -5,32 +5,95 @@
 	// prepare DOM for YUI Toolbar
 
 	 $(document).ready(function() {
-		$("#deleteshelfc").empty();
+	 	$("#editlistc").empty();
+		$("#deletelistc").remove();
+		$("#sendlistc").empty();
+		$("#downloadlistc").empty();
+		$("#printlistc").empty();
+		$("#sendlistc").before("<li id=\"downloadmenuc\"><\/li>");
 	    yuiToolbar();
 	 });
+	 
+	<!-- TMPL_IF NAME="viewshelf" --> function sendList(){
+		open(CGIBIN+'virtualshelves/sendshelf.pl?shelfid=<!-- TMPL_VAR NAME="shelfnumber" -->','win_form','dependant=yes,scrollbars=no,resizable=no,height=300,width=450,top=50,left=100');
+	 }
+	 
+	 function downloadList(){
+		open(CGIBIN+'virtualshelves/downloadshelf.pl?shelfid=<!-- TMPL_VAR NAME="shelfnumber" -->','win_form','dependant=yes,scrollbars=no,resizable=no,height=300,width=450,top=50,left=100');
+	 }<!-- /TMPL_IF -->
 
 	// YUI Toolbar Functions
 
 	function yuiToolbar() {
 	   	    newshelfButton = new YAHOO.widget.Button("newshelf");
-	   	    editshelfButton = new YAHOO.widget.Button("editshelf");
-			deleteshelfButton = new YAHOO.widget.Button({
-                                            id: "deleteshelf", 
+	   	    <!-- TMPL_IF NAME="viewshelf" --><!-- TMPL_IF name="manageshelf" -->editshelfButton = new YAHOO.widget.Button("editshelf");
+			
+	    var editmenu = [
+	        { text: _("Edit list"), url: "/cgi-bin/koha/virtualshelves/shelves.pl?shelfnumber=<!-- TMPL_VAR NAME="shelfnumber" -->&amp;op=modif" },
+			{ text: _("Delete list"), onclick: {fn:function(){confirmDelete(_("Are you sure you want to delete this list?"))}}}
+	    ];
+		
+		var downloadmenu = [
+		{ text: _("iso2709"), url: "/cgi-bin/koha/virtualshelves/downloadshelf.pl?format=iso2709&shelfid=<!-- TMPL_VAR NAME="shelfnumber" -->" },
+		{ text: _("RIS"), url: "/cgi-bin/koha/virtualshelves/downloadshelf.pl?format=ris&shelfid=<!-- TMPL_VAR NAME="shelfnumber" -->" },
+		{ text: _("BibTex"), url: "/cgi-bin/koha/virtualshelves/downloadshelf.pl?format=bibtex&shelfid=<!-- TMPL_VAR NAME="shelfnumber" -->" },
+<!-- TMPL_LOOP NAME="csv_profiles" -->
+		{ text: _("CSV - <!-- TMPL_VAR NAME="profile" -->"), url: "/cgi-bin/koha/virtualshelves/downloadshelf.pl?format=<!-- TMPL_VAR NAME="export_format_id" -->&shelfid=<!-- TMPL_VAR NAME="shelfnumber" -->" },
+<!-- /TMPL_LOOP -->
+		];
+
+	    new YAHOO.widget.Button({
+	        type: "menu",
+	        label: _("Download list"),
+	        name: "downloadmenubutton",
+	        menu: downloadmenu,
+	        container: "downloadmenuc"
+	    });
+
+		new YAHOO.widget.Button({
+	        type: "menu",
+	        label: _("Edit"),
+	        name: "editmenubutton",
+	        menu: editmenu,
+	        container: "editlistc"
+	    });
+
+<!-- /TMPL_IF -->
+			downloadlistButton = new YAHOO.widget.Button({
+                                            id: "downloadlist", 
                                             type: "button", 
-                                            label: _("Delete List"), 
-                                            container: "deleteshelfc",
-											onclick: {fn:function(){confirmDelete(_("Are you sure you want to delete this shelf?"))}}
+                                            label: _("Download list"), 
+                                            container: "downloadlistc",
+											onclick: {fn:downloadList}
                                         });
+			sendlistButton = new YAHOO.widget.Button({
+                                            id: "sendlist", 
+                                            type: "button", 
+                                            label: _("Send list"), 
+                                            container: "sendlistc",
+											onclick: {fn:sendList}
+                                        });
+			printlistButton = new YAHOO.widget.Button({
+                                            id: "printbiblio", 
+                                            type: "button", 
+                                            label: _("Print list"), 
+                                            container: "printlistc",
+											onclick: {fn:function(){print();}}
+                                        });<!-- /TMPL_IF -->
 	}
 
 	//]]>
 	</script>
 	
 <ul class="toolbar">
-	<li><a id="newshelf" href="/cgi-bin/koha/virtualshelves/shelves.pl?shelves=1">New List</a></li>
+	<li><a id="newshelf" href="/cgi-bin/koha/virtualshelves/shelves.pl?shelves=1">New list</a></li>
 	<!-- TMPL_IF NAME="viewshelf" --><!-- TMPL_IF name="manageshelf" -->
-	<li><a id="editshelf" href="/cgi-bin/koha/virtualshelves/shelves.pl?shelfnumber=<!-- TMPL_VAR NAME="shelfnumber" -->&amp;op=modif">Edit List</a></li>
-	<li id="deleteshelfc"><!-- TMPL_IF NAME="showprivateshelves" --><a id="deleteshelf" href="/cgi-bin/koha/virtualshelves/shelves.pl?display=privateshelves&amp;shelves=1&amp;DEL-<!-- TMPL_VAR NAME="shelfnumber" -->=1">Delete List</a><!-- TMPL_ELSE --><a id="deleteshelf" href="/cgi-bin/koha/virtualshelves/shelves.pl?shelves=1&amp;DEL-<!-- TMPL_VAR NAME="shelfnumber" -->=1">Delete List</a><!-- /TMPL_IF --></li>
-	<!-- /TMPL_IF --><!-- /TMPL_IF -->
+	<li id="editlistc"><a id="editshelf" href="/cgi-bin/koha/virtualshelves/shelves.pl?shelfnumber=<!-- TMPL_VAR NAME="shelfnumber" -->&amp;op=modif">Edit list</a></li>
+	<li id="deletelistc"><!-- TMPL_IF NAME="showprivateshelves" --><a id="deleteshelf" href="/cgi-bin/koha/virtualshelves/shelves.pl?display=privateshelves&amp;shelves=1&amp;DEL-<!-- TMPL_VAR NAME="shelfnumber" -->=1">Delete list</a><!-- TMPL_ELSE --><a id="deleteshelf" href="/cgi-bin/koha/virtualshelves/shelves.pl?shelves=1&amp;DEL-<!-- TMPL_VAR NAME="shelfnumber" -->=1">Delete list</a><!-- /TMPL_IF --></li>
+	<!-- /TMPL_IF -->
+	<li id="sendlistc"><a href="#" id="sendlist">Send list</a></li>
+	<li id="printlistc"><a id="printbiblio" href="#">Print list</a></li>
+	<!-- /TMPL_IF -->
 </ul>
 </div>
+ 
\ No newline at end of file
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/sendshelfform.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/sendshelfform.tmpl
index 41f7d32..1aec4c8 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/sendshelfform.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/sendshelfform.tmpl
@@ -1,11 +1,11 @@
-<!-- TMPL_INCLUDE NAME="doc-head-open.inc" --><!-- TMPL_IF NAME="LibraryNameTitle" --><!-- TMPL_VAR NAME="LibraryNameTitle" --><!-- TMPL_ELSE -->Koha Online<!-- /TMPL_IF --> Catalog &rsaquo;  Sending Your List
+<!-- TMPL_INCLUDE NAME="doc-head-open.inc" --><title>Koha &rsaquo; Lists &rsaquo;  Sending your list</title>
 <!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
 </head>
 <body style="padding: 1em;" id="sendbasket">
 <div class="container"><!-- TMPL_IF NAME="email" -->
 
     <!-- TMPL_IF NAME="SENT" -->
-        <h3>Message Sent</h3>
+        <h3>Message sent</h3>
         <p>The list was sent to: <!-- TMPL_VAR NAME="email" --></p>
         <p><a class="close focus" href="#">Close window</a></p>
     <!-- /TMPL_IF  -->
@@ -20,7 +20,7 @@
 <fieldset class="rows"> 
 <legend>Sending your list</legend>
 <ol>   <li>
-        <label for="email">Email Address:</label>
+        <label for="email">Email address:</label>
         <input type="text" id="email" name="email" size="43" class="focus" />
     </li>
     <li>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tmpl
index 5a808bd..de0e58b 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tmpl
@@ -24,7 +24,7 @@ $(document).ready(function(){
 
 	function confirmDelete(message){
 		if (window.confirm(message)) {
-			location.href="/cgi-bin/koha/virtualshelves/shelves.pl?<!-- TMPL_IF NAME="showprivateshelves" -->display=privateshelves&<!-- /TMPL_IF -->shelves=1&amp;DEL-<!-- TMPL_VAR NAME="shelfnumber" -->=1";
+			location.href="/cgi-bin/koha/virtualshelves/shelves.pl?<!-- TMPL_IF NAME="showprivateshelves" -->display=privateshelves&<!-- /TMPL_IF -->shelves=1&DEL-<!-- TMPL_VAR NAME="shelfnumber" -->=1";
 		} else { 
 			return false;
 		}
@@ -140,16 +140,12 @@ function placeHold () {
         <input type="hidden" name="modifyshelfcontents" value="1" />
  <fieldset>
   <legend>Contents of <i><!-- TMPL_VAR NAME="shelfname" --></i></legend>
-   <div id="toolbar" class="list-actions">
+   
  <!--TMPL_IF NAME="manageshelf" -->
-     <span class="checkall"></span> |
-     <span class="clearall"></span> |
+     <p><span class="checkall"></span> |
+     <span class="clearall"></span></p>
  <!-- /TMPL_IF -->
-  <a class="print" href="shelves.pl" onclick="print(); return false;">Print</a> |
-  <a href="#" class="send tag_hides" onclick="open(CGIBIN+'virtualshelves/sendshelf.pl?shelfid=<!-- TMPL_VAR NAME="shelfnumber" -->','win_form','dependant=yes,scrollbars=no,resizable=no,height=300,width=450,top=50,left=100')">Send List</a> |
- <a href="#" class="download tag_hides" onclick="open(CGIBIN+'virtualshelves/downloadshelf.pl?shelfid=<!-- TMPL_VAR NAME="shelfnumber" -->','win_form','dependant=yes,scrollbars=no,resizable=no,height=300,width=450,top=50,left=100')">Download List</a>
-
- </div>
+	
  <!-- TMPL_VAR name='pagination_bar'-->
     <table>
             <tr>
@@ -198,15 +194,15 @@ function placeHold () {
 			</td>
 			</tr>
 		<!-- /TMPL_LOOP --><!-- /itemsloop -->
-    </table>
- </fieldset>
- <fieldset class="action">
+    </table><fieldset class="action">
         <!-- TMPL_IF name="manageshelf" -->
-            <input type="button" id="placehold" style="display:none" onclick="placeHold(); return false;" value="Place Hold"/>
-            <input type="submit" value="Remove selected Items" onclick='return confirm(_("Are you sure you want to remove these items from the shelf?"))' />
-            <input type="submit" value="Merge selected Items" onclick='return MergeItems();' />
+            <input type="button" id="placehold" style="display:none" onclick="placeHold(); return false;" value="Place Holds" />
+            <input type="submit" value="Remove selected Items" onclick="return confirm(_('Are you sure you want to remove these items from the shelf?'));" />
+            <input type="submit" value="Merge selected Items" onclick="return MergeItems();" />
         <!-- /TMPL_IF -->
  </fieldset>
+ </fieldset>
+ 
 </form>
 	<!-- /TMPL_IF -->
    </div>
@@ -215,7 +211,7 @@ function placeHold () {
 <!-- TMPL_IF name="manageshelf" -->
 <div class="yui-g">
 <form action="/cgi-bin/koha/virtualshelves/shelves.pl" method="post">
- <fieldset class="brief action">
+ <fieldset class="brief">
     <legend>Add an item to <i><!-- TMPL_VAR NAME="shelfname" --></i></legend>
         <ol>
             <li>
@@ -370,10 +366,10 @@ function placeHold () {
 		</td>
 		</tr>
                 <!-- /TMPL_LOOP -->
+        </table>
             <!-- TMPL_ELSE -->
-            <tr><td colspan="4">No Private Lists.</td></tr>
+            <p>No Private Lists.</p>
             <!-- /TMPL_IF --><!-- /shelveslooppriv -->
-        </table>
 		</div><!-- /privateshelves -->
 
         <!-- TMPL_IF NAME="showpublicshelves" -->
-- 
1.6.3.3




More information about the Koha-patches mailing list