fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [14766] form validation


From: Sigurd Nes
Subject: [Fmsystem-commits] [14766] form validation
Date: Mon, 22 Feb 2016 11:29:15 +0000

Revision: 14766
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=14766
Author:   sigurdne
Date:     2016-02-22 11:29:15 +0000 (Mon, 22 Feb 2016)
Log Message:
-----------
form validation

Modified Paths:
--------------
    trunk/property/inc/class.uitts.inc.php
    trunk/property/js/portico/tts.add.js
    trunk/property/templates/base/location_form2.xsl
    trunk/property/templates/base/tts.xsl
    trunk/property/templates/base/user_id_select.xsl

Modified: trunk/property/inc/class.uitts.inc.php
===================================================================
--- trunk/property/inc/class.uitts.inc.php      2016-02-22 09:17:13 UTC (rev 
14765)
+++ trunk/property/inc/class.uitts.inc.php      2016-02-22 11:29:15 UTC (rev 
14766)
@@ -692,7 +692,9 @@
                                );
                        }
 
-                       //              if($order_read)
+                       $order_read = $this->acl->check('.ticket.order', 
PHPGW_ACL_READ, 'property');
+
+                       if($order_read)
                        {
                                $combos[] = array('type' => 'filter',
                                        'name' => 'vendor_id',
@@ -1392,6 +1394,7 @@
                                'lang_send' => lang('send'),
                                'value_details' => (isset($values['details']) ? 
$values['details'] : ''),
                                'value_subject' => (isset($values['subject']) ? 
$values['subject'] : ''),
+                               'tts_mandatory_title' => 
$this->bo->config->config_data['tts_mandatory_title'],
                                'value_finnish_date' => 
(isset($values['finnish_date']) ? $values['finnish_date'] : ''),
                                'lang_finnish_date_statustext' => lang('Select 
the estimated date for closing the task'),
                                'lang_cancel_statustext' => lang('Back to the 
ticket list'),

Modified: trunk/property/js/portico/tts.add.js
===================================================================
--- trunk/property/js/portico/tts.add.js        2016-02-22 09:17:13 UTC (rev 
14765)
+++ trunk/property/js/portico/tts.add.js        2016-02-22 11:29:15 UTC (rev 
14766)
@@ -48,8 +48,32 @@
                },
                failure: function (o)
                {
-                       window.alert('failure - try again - once')
+                       window.alert('failure - try again - once');
                },
                timeout: 5000
        });
-}
+};
+$(document).ready(function ()
+{
+
+       $('#group_id').attr("data-validation", 
"assigned").attr("data-validation-error-msg", lang['Please select a person or a 
group to handle the ticket !']);
+       $('#user_id').attr("data-validation", 
"assigned").attr("data-validation-error-msg", lang['Please select a person or a 
group to handle the ticket !']);
+});
+
+$.formUtils.addValidator({
+       name: 'assigned',
+       validatorFunction: function (value, $el, config, languaje, $form)
+       {
+               var v = false;
+               var group_id = $('#group_id').val();
+               var user_id = $('#user_id').val();
+               if (group_id != "" || user_id != "")
+               {
+                       v = true;
+               }
+               return v;
+       },
+       errorMessage: 'Assigned is required',
+       errorMessageKey: ''
+});
+

Modified: trunk/property/templates/base/location_form2.xsl
===================================================================
--- trunk/property/templates/base/location_form2.xsl    2016-02-22 09:17:13 UTC 
(rev 14765)
+++ trunk/property/templates/base/location_form2.xsl    2016-02-22 11:29:15 UTC 
(rev 14766)
@@ -29,7 +29,7 @@
                                                                        
<xsl:value-of select="statustext"/>
                                                                </xsl:attribute>
                                                        <xsl:attribute 
name="data-validation">
-                                                               
<xsl:text>number</xsl:text>
+                                                               
<xsl:text>required</xsl:text>
                                                                </xsl:attribute>
                                                        <xsl:attribute 
name="data-validation-error-msg">
                                                                <xsl:value-of 
select="php:function('lang', 'Please select a location !')"/>

Modified: trunk/property/templates/base/tts.xsl
===================================================================
--- trunk/property/templates/base/tts.xsl       2016-02-22 09:17:13 UTC (rev 
14765)
+++ trunk/property/templates/base/tts.xsl       2016-02-22 11:29:15 UTC (rev 
14766)
@@ -19,6 +19,7 @@
                self.name="first_Window";
                <xsl:value-of select="lookup_functions"/>
                var my_groups = <xsl:value-of select="my_groups"/>;
+               var lang = <xsl:value-of select="php:function('js_lang', 
'Please select a person or a group to handle the ticket !')"/>;
        </script>
 
        <dl>
@@ -156,12 +157,14 @@
                                                        <xsl:attribute 
name="title">
                                                                <xsl:value-of 
select="php:function('lang', 'Enter the subject of this ticket')"/>
                                                        </xsl:attribute>
-                                                       <xsl:attribute 
name="data-validation">
-                                                               
<xsl:text>required</xsl:text>
-                                                       </xsl:attribute>
-                                                       <xsl:attribute 
name="data-validation-error-msg">
-                                                               <xsl:value-of 
select="php:function('lang', 'Please enter a title !')"/>
-                                                       </xsl:attribute>
+                                                       <xsl:if 
test="tts_mandatory_title != ''">
+                                                               <xsl:attribute 
name="data-validation">
+                                                                       
<xsl:text>required</xsl:text>
+                                                               </xsl:attribute>
+                                                               <xsl:attribute 
name="data-validation-error-msg">
+                                                                       
<xsl:value-of select="php:function('lang', 'Please enter a title !')"/>
+                                                               </xsl:attribute>
+                                                       </xsl:if>
 
                                                </input>
                                        </div>

Modified: trunk/property/templates/base/user_id_select.xsl
===================================================================
--- trunk/property/templates/base/user_id_select.xsl    2016-02-22 09:17:13 UTC 
(rev 14765)
+++ trunk/property/templates/base/user_id_select.xsl    2016-02-22 11:29:15 UTC 
(rev 14766)
@@ -7,7 +7,7 @@
                <xsl:variable name="select_user_name">
                        <xsl:value-of select="select_user_name"/>
                </xsl:variable>
-               <select name="{$select_user_name}" class="forms" 
title="{$lang_user_statustext}" 
onMouseover="window.status='{$lang_user_statustext}'; return true;" 
onMouseout="window.status='';return true;">
+               <select name="{$select_user_name}" id="user_id" class="forms" 
title="{$lang_user_statustext}">
                        <option value="">
                                <xsl:value-of select="lang_no_user"/>
                        </option>




reply via email to

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