[pLog-svn] r5022 - in plog/branches/lifetype-1.2: js/ui templates/admin
oscar at devel.lifetype.net
oscar at devel.lifetype.net
Thu Mar 8 07:40:21 EST 2007
Author: oscar
Date: 2007-03-08 07:40:21 -0500 (Thu, 08 Mar 2007)
New Revision: 5022
Modified:
plog/branches/lifetype-1.2/js/ui/forms.js
plog/branches/lifetype-1.2/templates/admin/header.template
Log:
Added a couple of javascript functions in the Lifetype.Forms.List namespace
Modified: plog/branches/lifetype-1.2/js/ui/forms.js
===================================================================
--- plog/branches/lifetype-1.2/js/ui/forms.js 2007-03-08 09:04:06 UTC (rev 5021)
+++ plog/branches/lifetype-1.2/js/ui/forms.js 2007-03-08 12:40:21 UTC (rev 5022)
@@ -1,4 +1,65 @@
+/********
+ * Lifetype.Forms namespace
+ *
+ * Includes all functions related to forms, form validation, lists, etc.
+ ***************/
+
+Lifetype.Forms = function() {}
+
+Lifetype.Forms.List = function() {}
+
+/**
+ * @static
+ * Removes the selected items from the list
+ * @param elem The id of an HTML object
+ */
+Lifetype.Forms.List.removeSelected = function( elem )
+{
+ list = document.getElementById( elem );
+
+ for( i = 0; i < list.options.length; i++ ) {
+ if( list.options[i].selected ) {
+ // the element is selected, remove it
+ list.remove( i );
+ }
+ }
+}
+
+/**
+ * @static
+ * Removes al elements from a list
+ * @param elem The id of an HTML object
+ */
+Lifetype.Forms.List.removeAll = function( elem )
+{
+ list = document.getElementById( elem );
+
+ for( i = 0; i < list.options.length; i++ ) {
+ list.remove( i );
+ }
+}
+
+/**
+ * @static
+ * Selects all elements from a list
+ * @param elem The id of an HTML object
+ */
+Lifetype.Forms.List.selectAll = function( elem )
+{
+ list = document.getElementById( elem );
+
+ for( i = 0; i < list.options.length; i++ ) {
+ list.options[i].selected = true;
+ }
+}
+
+
//
+// :TODO:
+// Move the functions above to the Lifetype.Forms.List namespace
+//
+
+//
// counter to keep track of how many elements we have!
//
var numFields = 2;
Modified: plog/branches/lifetype-1.2/templates/admin/header.template
===================================================================
--- plog/branches/lifetype-1.2/templates/admin/header.template 2007-03-08 09:04:06 UTC (rev 5021)
+++ plog/branches/lifetype-1.2/templates/admin/header.template 2007-03-08 12:40:21 UTC (rev 5022)
@@ -27,10 +27,10 @@
<script type="text/javascript" src="js/cookie/cookie.js"></script>
<script type="text/javascript" src="js/prototype/prototype.js"></script>
<!-- LifeType UI Library -->
+<script type="text/javascript" src="js/ui/core.js"></script>
<script type="text/javascript" src="js/ui/default.js"></script>
<script type="text/javascript" src="js/ui/common.js"></script>
<script type="text/javascript" src="js/ui/forms.js"></script>
-<script type="text/javascript" src="js/ui/core.js"></script>
<script type="text/javascript" src="js/ui/tableeffects.js"></script>
<!-- Yahoo UI Library -->
<script type="text/javascript" src="js/yui/yahoo/yahoo-min.js"></script>
More information about the pLog-svn
mailing list