[Koha-cvs] koha/koha-tmpl/intranet-tmpl/prog/en/bookshelve... [rel_3_0]

Antoine Farnault antoine at koha-fr.org
Mon Feb 5 15:54:51 CET 2007


CVSROOT:	/sources/koha
Module name:	koha
Branch:		rel_3_0
Changes by:	Antoine Farnault <toins>	07/02/05 14:54:51

Modified files:
	koha-tmpl/intranet-tmpl/prog/en/bookshelves: shelves.tmpl 

Log message:
	add missing function checkAll. 
	checkAll checks all checkbox if they are not all checked.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/intranet-tmpl/prog/en/bookshelves/shelves.tmpl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.1.2.12&r2=1.1.2.13

Patches:
Index: shelves.tmpl
===================================================================
RCS file: /sources/koha/koha/koha-tmpl/intranet-tmpl/prog/en/bookshelves/shelves.tmpl,v
retrieving revision 1.1.2.12
retrieving revision 1.1.2.13
diff -u -b -r1.1.2.12 -r1.1.2.13
--- shelves.tmpl	5 Feb 2007 11:19:16 -0000	1.1.2.12
+++ shelves.tmpl	5 Feb 2007 14:54:51 -0000	1.1.2.13
@@ -24,8 +24,8 @@
         <input type="hidden" name="modifyshelfcontents" value="1" />
             <tr>
                 <th>
-                    <a href="/cgi-bin/koha/bookshelves/shelves.pl" onclick="CheckAll(); return false;">
-                        Check All
+                    <a href="javascript:CheckAll();">
+                        <small>(Un)Check All</small>
                     </a>
                 </th>
                 <th>&nbsp;</th>
@@ -202,8 +202,37 @@
 			return true;
 		return false;
 	}
-</script>
+	/**
+	 * this function checks all checkbox 
+	 * or uncheck all if there are already checked.
+	 */
+	function CheckAll(){
+		var checkboxes = document.getElementsByTagName('input');
+		var nbCheckbox = checkboxes.length;
+		var check = areAllChecked();
+		check = !check;
+		for(var i=0;i<nbCheckbox;i++){
+			if(checkboxes[i].getAttribute('type') == "checkbox" ){
+				checkboxes[i].checked = check;
+			}
+		}
+	}
+	/**
+	 * this function return true if all checkbox are checked
+	 */
+	function areAllChecked(){
+		var checkboxes = document.getElementsByTagName('input');
+		var nbCheckbox = checkboxes.length;
+		for(var i=0;i<nbCheckbox;i++){
+			if(checkboxes[i].getAttribute('type') == "checkbox" ){
+				if(checkboxes[i].checked == 0){
+					return false;
+				}
+			}
+		}
+		return true;
+	}
 
-</body>
-</html>
+</script>
 
+<!-- TMPL_INCLUDE NAME="opac-bottom.inc"-->





More information about the Koha-cvs mailing list