fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [10450] property: test formvalidator


From: Sigurd Nes
Subject: [Fmsystem-commits] [10450] property: test formvalidator
Date: Sun, 04 Nov 2012 13:34:16 +0000

Revision: 10450
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10450
Author:   sigurdne
Date:     2012-11-04 13:34:13 +0000 (Sun, 04 Nov 2012)
Log Message:
-----------
property: test formvalidator

Modified Paths:
--------------
    trunk/property/inc/class.uicondition_survey.inc.php
    trunk/property/js/portico/condition_survey_edit.js
    trunk/property/templates/base/condition_survey.xsl

Modified: trunk/property/inc/class.uicondition_survey.inc.php
===================================================================
--- trunk/property/inc/class.uicondition_survey.inc.php 2012-11-04 13:14:30 UTC 
(rev 10449)
+++ trunk/property/inc/class.uicondition_survey.inc.php 2012-11-04 13:34:13 UTC 
(rev 10450)
@@ -275,12 +275,13 @@
 
                        $data = array
                        (
-                               'project'               => $survey,
+                               'survey'                => $survey,
                                'categories'    => array('options' => 
$categories),
                                'editable'              => $mode == 'edit'
                        );
 
-                       $this->use_yui_editor('description');
+//                     $this->use_yui_editor(array('description'));
+                       $GLOBALS['phpgw']->jqcal->add_listener('report_date');
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . '::' . lang('condition survey');
                        
                        phpgwapi_jquery::load_widget('core');

Modified: trunk/property/js/portico/condition_survey_edit.js
===================================================================
--- trunk/property/js/portico/condition_survey_edit.js  2012-11-04 13:14:30 UTC 
(rev 10449)
+++ trunk/property/js/portico/condition_survey_edit.js  2012-11-04 13:34:13 UTC 
(rev 10450)
@@ -19,6 +19,7 @@
                function(Y) {   
                 Y.on("domready", function () {
 
+  /*
                     var form = new Y.Validator(
                         {
                             form:'basicExample1',
@@ -41,6 +42,17 @@
                             incorrectIndicatorText:'<span 
class="validator">&nbsp;</span>'
                         }
                     );
+*/
+                   var form3 = new Y.Validator(
+                        {
+                            form:'form',
+                            defaultIncorrectIndicatorCss:'validator',
+                            defaultCorrectIndicatorCss:'indicator',
+                            createCorrectIndicator:true,
+                            createIncorrectIndicator:true
+                        }
+                    );
+
                     
Y.Event.attach('click',function(){form.clear();},'#clearButton');
                     
Y.Event.attach('click',function(){form2.clear();},'#clearButton2');
                 });

Modified: trunk/property/templates/base/condition_survey.xsl
===================================================================
--- trunk/property/templates/base/condition_survey.xsl  2012-11-04 13:14:30 UTC 
(rev 10449)
+++ trunk/property/templates/base/condition_survey.xsl  2012-11-04 13:34:13 UTC 
(rev 10450)
@@ -9,211 +9,138 @@
                        <xsl:value-of select="php:function('lang', 'condition 
survey')" />
        </h1>
        
-       <div id="project_details" class="content-wrp">
-               <div id="details">
+               <div class="content-wrp">
                        <xsl:variable name="action_url">
                                <xsl:value-of 
select="php:function('get_phpgw_link', '/index.php', 
'menuaction:property.uicondition_survey.save')" />
                        </xsl:variable>
+
+                       <xsl:variable name="disabled">
+                               <xsl:choose>
+                                       <xsl:when test="editable = 1">
+                                               <xsl:text>disabled</xsl:text>
+                                       </xsl:when>
+                                       <xsl:otherwise>
+                                               <xsl:text></xsl:text>
+                                       </xsl:otherwise>
+                               </xsl:choose>
+                       </xsl:variable>
+
+
                        <form name="form" id="form" action="{$action_url}" 
method="post" ENCTYPE="multipart/form-data">
-                               <input type="hidden" name="id" value = 
"{value_id}">
-                               </input>
-                               <dl class="proplist-col">
-                                       <dt>
-                                               <label for="name"><xsl:value-of 
select="php:function('lang','title')" /></label>
-                                       </dt>
-                                       <dd>
-                                       <xsl:choose>
-                                               <xsl:when test="editable = 1">
-                                                       <xsl:if 
test="project/error_msg_array/name != ''">
-                                                               <xsl:variable 
name="error_msg"><xsl:value-of select="project/error_msg_array/name" 
/></xsl:variable>
-                                                               <div 
class='input_error_msg'><xsl:value-of select="php:function('lang', $error_msg)" 
/></div>
-                                                       </xsl:if>
-                                                       <div 
style="margin-left:0; margin-bottom: 3px;" class="help_text line">Angi 
startdato for aktiviteten</div>
-                                                       <input class = 
"required" type="text" name="name" id="name" value="{project/name}" size="100"/>
-                                               </xsl:when>
-                                               <xsl:otherwise>
-                                                       <xsl:value-of 
select="project/name" />
-                                               </xsl:otherwise>
-                                       </xsl:choose>
-                                       </dd>
-                                       <dt>
-                                               <label 
for="project_type"><xsl:value-of select="php:function('lang','Project_type')" 
/></label>
-                                       </dt>
-                                       <dd>
-                                       <xsl:choose>
-                                               <xsl:when test="editable = 1">
-                                                       <xsl:if 
test="project/error_msg_array/project_type_id != ''">
-                                                               <xsl:variable 
name="error_msg"><xsl:value-of select="project/error_msg_array/project_type_id" 
/></xsl:variable>
-                                                               <div 
class='input_error_msg'><xsl:value-of select="php:function('lang', $error_msg)" 
/></div>
-                                                       </xsl:if>
-                                                       <div 
style="margin-left:0; margin-bottom: 3px;" class="help_text line">Angi 
startdato for aktiviteten</div>
-                                                       <select  class = 
"required" id="project_type_id" name="project_type_id">
-                                                               
<xsl:apply-templates select="categories/options"/>
-                                                       </select>
-                                               </xsl:when>
-                                               <xsl:otherwise>
-                                                       <xsl:value-of 
select="project/project_type_label" />
-                                               </xsl:otherwise>
-                                       </xsl:choose>
-                                       </dd>
-                                       <dt>
-                                               <label 
for="description"><xsl:value-of select="php:function('lang', 'Description')" 
/></label>
-                                       </dt>
-                                       <dd>
-                                       <xsl:choose>
-                                               <xsl:when test="editable = 1">
-                                                       <xsl:if 
test="project/error_msg_array/description != ''">
-                                                               <xsl:variable 
name="error_msg"><xsl:value-of select="project/error_msg_array/description" 
/></xsl:variable>
-                                                               <div 
class='input_error_msg'><xsl:value-of select="php:function('lang', $error_msg)" 
/></div>
-                                                       </xsl:if>
-                                                       <div 
style="margin-left:0; margin-bottom: 3px;" class="help_text line">Angi 
startdato for aktiviteten</div>
-                                                       <textarea 
id="description" name="description" rows="5" cols="60"><xsl:value-of 
select="project/description" disable-output-escaping="yes"/></textarea>
-                                               </xsl:when>
-                                               <xsl:otherwise>
-                                                       <xsl:value-of 
select="project/description" disable-output-escaping="yes"/>
-                                               </xsl:otherwise>
-                                       </xsl:choose>
-                                       </dd>
-                               </dl>
+                               <div class="formBody">
+                                        <div class="row">
+                                               <div class="label">
+                                                       <label 
for="name"><xsl:value-of select="php:function('lang', 'name')" /></label>
+                                               </div>
+                                               <xsl:choose>
+                                                       <xsl:when 
test="editable = 1">
+                                                               <input 
id="title" name='title' type="text"
+                                                                       
formvalidator:FormField="yes"
+                                                                       
formvalidator:Type="TextBaseField">
+                                                               </input>
+                                                       </xsl:when>
+                                                       <xsl:otherwise>
+                                                               <xsl:value-of 
select="survey/title" />
+                                                       </xsl:otherwise>
+                                               </xsl:choose>
+                                               <div class="clearDiv"></div>
+                                       </div>
+                                        <div class="row">
+                                               <div class="label">
+                                                       <label 
for="name"><xsl:value-of select="php:function('lang', 'description')" /></label>
+                                               </div>
+                                               <xsl:choose>
+                                                       <xsl:when 
test="editable = 1">
+                                                               <textarea 
id="description" name="values[description]" rows="5" cols="60"
+                                                                       
formvalidator:FormField="yes"
+                                                                       
formvalidator:Type="TextBaseField">
+                                                                       
<xsl:value-of select="project/description" disable-output-escaping="yes"/>
+                                                               </textarea>
+                                                       </xsl:when>
+                                                       <xsl:otherwise>
+                                                               <xsl:value-of 
select="project/description" disable-output-escaping="yes"/>
+                                                       </xsl:otherwise>
+                                               </xsl:choose>
+                                                <div class="clearDiv"></div>
+                                       </div>
+                                        <div class="row">
+                                               <div class="label">
+                                                       <label 
for="category"><xsl:value-of select="php:function('lang', 'category')" 
/></label>
+                                               </div>
+                                               <xsl:choose>
+                                                       <xsl:when 
test="editable = 1">
+                                                               <select 
id="cat_id" name="values[cat_id]"
+                                                                       
formvalidator:FormField="yes"
+                                                                       
formvalidator:Type="SelectField">
+                                                                       
<xsl:apply-templates select="categories/options"/>
+                                                               </select>
+                                                       </xsl:when>
+                                                       <xsl:otherwise>
+                                                               <select 
id="cat_id" disabled="disabled">
+                                                                       
<xsl:apply-templates select="categories/options"/>
+                                                               </select>
+                                                       </xsl:otherwise>
+                                               </xsl:choose>
+                                               <div class="clearDiv"></div>
+                                       </div>
 
-                               <div class="form-buttons">
-                                       <xsl:choose>
-                                               <xsl:when test="editable = 1">
-                                                       <xsl:variable 
name="lang_save"><xsl:value-of select="php:function('lang', 'save')" 
/></xsl:variable>
-                                                       <xsl:variable 
name="lang_cancel"><xsl:value-of select="php:function('lang', 'cancel')" 
/></xsl:variable>
-                                                       <input type="submit" 
name="save_project" value="{$lang_save}" title = "{$lang_save}" />
-                                                       <input type="submit" 
name="cancel_project" value="{$lang_cancel}" title = "{$lang_cancel}" />
-                                               </xsl:when>
-                                               <xsl:otherwise>
-                                                       <xsl:variable 
name="lang_edit"><xsl:value-of select="php:function('lang', 'edit')" 
/></xsl:variable>
-                                                       <xsl:variable 
name="lang_new_activity"><xsl:value-of select="php:function('lang', 
't_new_activity')" /></xsl:variable>
-                                                       <input type="submit" 
name="edit_project" value="{$lang_edit}" title = "{$lang_edit}" />
-                                                       <input type="submit" 
name="new_activity" value="{$lang_new_activity}" title = "{$lang_new_activity}" 
/>
-                                               </xsl:otherwise>
-                                       </xsl:choose>
+                                       <div class="row">
+                                                <div class="label">
+                                                       <label 
for="category"><xsl:value-of select="php:function('lang', 'date')" /></label>
+                                                </div>
+                                                       <input id="report_date" 
name='values[report_date]' type="text"
+                                                               
formvalidator:FormField="yes"
+                                                               
formvalidator:type="TextBaseField"/>
+                                                       <div 
class="clearDiv"></div>
+                                       </div>
+
+
+
+                                       <div class="row">
+                                                <div class="label">
+                                                       <label 
for="age2">Age:</label>                                          
+                                                </div>
+                                                       <input id="age2" 
type="text"
+                                                               
formvalidator:FormField="yes"
+                                                               
formvalidator:type="IntegerField"
+                                                               
formvalidator:max="100"
+                                                               
formvalidator:min="10"/>
+                                               <div class="clearDiv"></div>
+                                       </div>
+                                       <div class="row">
+                                                 <div class="label">
+                                                       <label 
for="income2">Income ($):</label>                                               
 
+                                                </div>
+                                                       <input id="income2" 
type="text"
+                                                               
formvalidator:FormField="yes"
+                                                               
formvalidator:type="DoubleField"
+                                                               
formvalidator:maxDecimalPlaces="2"
+                                                               
formvalidator:max="40000"
+                                                               
formvalidator:maxInclusive="true"/>
+                                               <div class="clearDiv"></div>
+                                       </div>
+                                       <div class="form-buttons">
+                                               <xsl:choose>
+                                                       <xsl:when 
test="editable = 1">
+                                                               <xsl:variable 
name="lang_save"><xsl:value-of select="php:function('lang', 'save')" 
/></xsl:variable>
+                                                               <xsl:variable 
name="lang_cancel"><xsl:value-of select="php:function('lang', 'cancel')" 
/></xsl:variable>
+                                                               <input 
type="submit" name="save_project" value="{$lang_save}" title = "{$lang_save}" />
+                                                               <input 
type="submit" name="cancel_project" value="{$lang_cancel}" title = 
"{$lang_cancel}" />
+                                                       </xsl:when>
+                                                       <xsl:otherwise>
+                                                               <xsl:variable 
name="lang_edit"><xsl:value-of select="php:function('lang', 'edit')" 
/></xsl:variable>
+                                                               <xsl:variable 
name="lang_new_activity"><xsl:value-of select="php:function('lang', 
't_new_activity')" /></xsl:variable>
+                                                               <input 
type="submit" name="edit_project" value="{$lang_edit}" title = "{$lang_edit}" />
+                                                               <input 
type="submit" name="new_activity" value="{$lang_new_activity}" title = 
"{$lang_new_activity}" />
+                                                       </xsl:otherwise>
+                                               </xsl:choose>
+                                       </div>
                                </div>
                        </form>
                </div>
-       </div>
-</div>
 
-        <div class="mainContainer">
-            <form id="basicExample1" action="formPost.html">
-                <div class="formBody">
-                    <h2>Simple Dynamic Validators</h2>
-                    <div class="info">
-                        This shows the bare minimum needed in order to
-                        get the form validator working with your existing form.
-                        The form validator will insert indicators and 
validators
-                        for your inputs.
-                    </div>
-                    <div class="row">
-                        <div class="column1Backing"></div>
-                        <div class="column2Backing"></div>
-                        <div class="label">First Name:</div>
-                        <div class="value">
-                            <input id="firstName" type="text"
-                                formvalidator:FormField="yes"
-                                formvalidator:Type="TextBaseField" />
-                        </div>
-                        <div class="label">Last Name:</div>
-                        <div class="value">
-                            <input id="lastName" type="text"
-                                formvalidator:FormField="yes"
-                                formvalidator:Type="TextBaseField" />
-                        </div>
-                        <div class="clearDiv"></div>
-                    </div>
-                    <div class="row">
-                        <div class="column1Backing"></div>
-                        <div class="column2Backing"></div>
-                        <div class="label">Age:</div>
-                        <div class="value">
-                            <input id="age" type="text"
-                                formvalidator:FormField="yes"
-                                formvalidator:type="IntegerField"
-                                formvalidator:max="100"
-                                formvalidator:min="10"/>
-                        </div>
-                        <div class="label">Income ($):</div>
-                        <div class="value">
-                            <input id="income" type="text"
-                                formvalidator:FormField="yes"
-                                formvalidator:type="DoubleField"
-                                formvalidator:maxDecimalPlaces="2"
-                                formvalidator:max="40000"
-                                formvalidator:maxInclusive="true"/>
-                        </div>
-                        <div class="clearDiv"></div>
-                    </div>
-                    <div class="buttonRow">
-                        <input type="submit" id="save" class="button" 
value="Save" />
-                        <input type="button" id="clearButton" class="button" 
value="Clear" />
-                        <input type="reset" class="button" value="Reset" />
-                        <input type="button" class="button" value="Cancel" />
-                    </div>
-                </div>
-            </form>
-            <form id="basicExample2" action="formPost.html">
-                <div class="formBody">
-                    <h2>Advanced Dynamic Validators</h2>
-                    <div class="info">
-                        This will show you how to get creative with the form
-                        validator and do more than the basics, while still not
-                        changing your HTML very much.
-                    </div>
-                    <div class="row">
-                        <div class="column1Backing"></div>
-                        <div class="column2Backing"></div>
-                        <div class="label">First Name:</div>
-                        <div class="value">
-                            <input id="firstName2" type="text"
-                                formvalidator:FormField="yes"
-                                formvalidator:Type="TextBaseField"/>
-                        </div>
-                        <div class="label">Last Name:</div>
-                        <div class="value">
-                            <input id="lastName2" type="text"
-                                formvalidator:FormField="yes"
-                                formvalidator:Type="TextBaseField"/>
-                        </div>
-                        <div class="clearDiv"></div>
-                    </div>
-                    <div class="row">
-                        <div class="column1Backing"></div>
-                        <div class="column2Backing"></div>
-                        <div class="label">Age:</div>
-                        <div class="value">
-                            <input id="age2" type="text"
-                                formvalidator:FormField="yes"
-                                formvalidator:type="IntegerField"
-                                formvalidator:max="100"
-                                formvalidator:min="10"/>
-                        </div>
-                        <div class="label">Income ($):</div>
-                        <div class="value">
-                            <input id="income2" type="text"
-                                formvalidator:FormField="yes"
-                                formvalidator:type="DoubleField"
-                                formvalidator:maxDecimalPlaces="2"
-                                formvalidator:max="40000"
-                                formvalidator:maxInclusive="true"/>
-                        </div>
-                        <div class="clearDiv"></div>
-                    </div>
-                    <div class="buttonRow">
-                        <input type="submit" class="button" value="Save" />
-                        <input type="button" id="clearButton2" class="button" 
value="Clear" />
-                        <input type="reset" class="button" value="Reset" />
-                        <input type="button" class="button" value="Cancel" />
-                    </div>
-                </div>
-            </form>
-        </div>
 
-<script type="text/javascript">
-       var lang = <xsl:value-of select="php:function('js_lang', 'please choose 
from list', 'please enter a value', 'please choose an entry')"/>;
-</script>
+</div>
 
 
 </xsl:template>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]