|
From: <bri...@us...> - 2008-12-03 16:52:03
|
Revision: 894
http://equanda.svn.sourceforge.net/equanda/?rev=894&view=rev
Author: brian_reynolds
Date: 2008-12-03 16:51:59 +0000 (Wed, 03 Dec 2008)
Log Message:
-----------
Improvments in javascript for checkboxes. Fieldset checkbox now switches on/off children correctly. Also fix bugs where not much would work when there was no writeboxes.
Modified Paths:
--------------
trunk/equanda-generate/src/main/velocity/t5gui/pages/AuthAndConfigField.tml.vm
trunk/equanda-generate/src/main/velocity/t5gui/pages/AuthAndConfigGroup.tml.vm
trunk/equanda-tapestry5/src/main/resources/org/equanda/tapestry5/resources/authandconfig.js
Modified: trunk/equanda-generate/src/main/velocity/t5gui/pages/AuthAndConfigField.tml.vm
===================================================================
--- trunk/equanda-generate/src/main/velocity/t5gui/pages/AuthAndConfigField.tml.vm 2008-12-03 15:56:59 UTC (rev 893)
+++ trunk/equanda-generate/src/main/velocity/t5gui/pages/AuthAndConfigField.tml.vm 2008-12-03 16:51:59 UTC (rev 894)
@@ -59,8 +59,9 @@
</div>
<div class="readCol">
- <input t:id="${readBox}" name="${readBox}" value="${readBox}"
- onclick="eqHandleFieldReadBox( ${page.Name}_pageReadCheck, this, ${writeBox}, ${listBox}, ${summaryBox}, ${printBox} )" t:type="CheckBox"/>
+ <input t:id="${readBox}" name="${readBox}" value="${readBox}"
+ onclick="eqHandleFieldReadBox( ${page.Name}_pageReadCheck, '$!{page.Name}', '_readCheck', this, '${writeBox}', ${listBox}, ${summaryBox}, ${printBox} )"
+ t:type="CheckBox"/>
</div>
<t:if test="writeAllowed">
Modified: trunk/equanda-generate/src/main/velocity/t5gui/pages/AuthAndConfigGroup.tml.vm
===================================================================
--- trunk/equanda-generate/src/main/velocity/t5gui/pages/AuthAndConfigGroup.tml.vm 2008-12-03 15:56:59 UTC (rev 893)
+++ trunk/equanda-generate/src/main/velocity/t5gui/pages/AuthAndConfigGroup.tml.vm 2008-12-03 16:51:59 UTC (rev 894)
@@ -65,13 +65,16 @@
<div class="readCol">
<input t:id="${readBox}" name="${readBox}" value="${readBox}"
- onclick="eqHandleFieldReadBox( ${group.Name}_groupReadCheck, this, ${writeBox}, ${listBox}, ${summaryBox}, ${printBox} )" t:type="CheckBox"/>
+ onclick="eqHandleFieldReadBox( ${group.Name}_groupReadCheck, '$!{group.Name}', '_readCheck', this, '${writeBox}', ${listBox}, ${summaryBox}, ${printBox} )"
+ t:type="CheckBox"/>
</div>
+ <t:if test="writeAllowed">
<div class="writeCol">
<input t:id="${writeBox}" name="${writeBox}" value="${writeBox}"
onclick="eqEnableBoxes( ${readBox}, ${writeBox}, false)" t:type="CheckBox"/>
</div>
+ </t:if>
<div class="listCol">
<input t:id="${listBox}" name="${listBox}" value="${listBox}"
Modified: trunk/equanda-tapestry5/src/main/resources/org/equanda/tapestry5/resources/authandconfig.js
===================================================================
--- trunk/equanda-tapestry5/src/main/resources/org/equanda/tapestry5/resources/authandconfig.js 2008-12-03 15:56:59 UTC (rev 893)
+++ trunk/equanda-tapestry5/src/main/resources/org/equanda/tapestry5/resources/authandconfig.js 2008-12-03 16:51:59 UTC (rev 894)
@@ -11,11 +11,17 @@
if( check2.checked == true && check1.checked == false )
{
if( readCheck.checked == false )
+ {
readCheck.click();
+ }
+
check1.click();
- if( check2.checked == false ) // may be reset by on of the clickers
+ if( check2.checked == false )
+ {
+ // may be reset by on of the clickers
check2.click();
+ }
}
if( readCheck.checked == false && check1.checked == false && check2.checked == true)
@@ -92,22 +98,48 @@
setFieldChecks( false, fieldSetId, inputId );
}
}
+
+ if( pageReadBox.checked == true )
+ {
+ if( anyFieldsChecked( fieldSetId, inputId ) == false )
+ {
+ // no boxes checked at all - switch them all on
+ setFieldChecks( true, fieldSetId, inputId );
+ }
+ }
}
/**
*
*/
-function eqHandleFieldReadBox( pageReadCheck, fieldReadCheck, fieldWriteCheck, fieldListCheck, fieldSummaryCheck, fieldPrintCheck )
+function eqHandleFieldReadBox( pageReadCheck, fieldSetId, inputId, fieldReadCheck, fieldWriteCheckStr, fieldListCheck, fieldSummaryCheck, fieldPrintCheck )
{
if( pageReadCheck.checked == false && fieldReadCheck.checked == true)
+ {
pageReadCheck.click();
+ }
if( fieldReadCheck.checked == false )
{
- fieldWriteCheck.checked=false;
+ var fieldWriteCheck = $$( 'fieldSet#' + fieldSetId + " input#" + fieldWriteCheckStr );
+ if( fieldWriteCheck.length != 0 )
+ {
+ fieldWriteCheck[0].checked = false;
+ }
+
fieldListCheck.checked=false;
fieldSummaryCheck.checked=false;
fieldPrintCheck.checked=false;
+
+ if( anyFieldsChecked( fieldSetId, inputId ) == false )
+ {
+ // all fields are off
+ if( pageReadCheck.checked == true )
+ {
+ pageReadCheck.click();
+ }
+ }
+
}
}
@@ -177,11 +209,11 @@
function allFieldsChecked( fieldSetId, inputId )
{
var allInputs = $$( 'fieldSet#' + fieldSetId + " input" );
- for( i = 0; i < allInputs.length; i++ )
+ for( j = 0; j < allInputs.length; j++ )
{
- if( allInputs[ i ].name.match( inputId ) )
+ if( allInputs[ j ].name.match( inputId ) )
{
- if( allInputs[ i ].checked == false)
+ if( allInputs[ j ].checked == false)
return false;
}
}
@@ -198,12 +230,12 @@
function setFieldChecks( value, fieldSetId, inputId )
{
var allInputs = $$( 'fieldSet#' + fieldSetId + " input" );
- for( i = 0; i < allInputs.length; i++ )
+ for( x = 0; x < allInputs.length; x++ )
{
- if( allInputs[ i ].name.match( inputId ) )
+ if( allInputs[ x ].name.match( inputId ) )
{
- if( allInputs[ i ].checked != value )
- allInputs[ i ].click();
+ if( allInputs[ x ].checked != value )
+ allInputs[ x ].click();
}
}
}
@@ -215,13 +247,13 @@
{
// var allInputs=$$( 'fieldSet#' + identityString + ' input');
var allInputs=$$( 'input' );
- for(i = 0; i < allInputs.length; i++)
+ for(y = 0; y < allInputs.length; y++)
{
- var inputNameAttr = allInputs[ i ].attributes.getNamedItem( "name" ).nodeValue;
+ var inputNameAttr = allInputs[ y ].attributes.getNamedItem( "name" ).nodeValue;
if( inputNameAttr.match( identityString ) )
{
- if( allInputs[ i ].checked != masterCheck.checked ){
- allInputs[ i ].click();
+ if( allInputs[ y ].checked != masterCheck.checked ){
+ allInputs[ y ].click();
}
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|