fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [10413] property: condition survey


From: Sigurd Nes
Subject: [Fmsystem-commits] [10413] property: condition survey
Date: Thu, 01 Nov 2012 14:19:30 +0000

Revision: 10413
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10413
Author:   sigurdne
Date:     2012-11-01 14:19:30 +0000 (Thu, 01 Nov 2012)
Log Message:
-----------
property: condition survey

Modified Paths:
--------------
    trunk/property/inc/class.bocondition_survey.inc.php
    trunk/property/inc/class.socondition_survey.inc.php
    trunk/property/inc/class.uicondition_survey.inc.php

Added Paths:
-----------
    trunk/property/js/portico/condition_survey_edit.js

Modified: trunk/property/inc/class.bocondition_survey.inc.php
===================================================================
--- trunk/property/inc/class.bocondition_survey.inc.php 2012-11-01 14:15:40 UTC 
(rev 10412)
+++ trunk/property/inc/class.bocondition_survey.inc.php 2012-11-01 14:19:30 UTC 
(rev 10413)
@@ -148,7 +148,7 @@
                        }
                        if($custom_fields)
                        {
-                               $values = $this->custom->prepare($values, 
'property',$this->acl_location, $data['view']);
+                               $values = $this->custom->prepare($values, 
'property', $this->acl_location, $data['view']);
                        }
                        return $values;
                }

Modified: trunk/property/inc/class.socondition_survey.inc.php
===================================================================
--- trunk/property/inc/class.socondition_survey.inc.php 2012-11-01 14:15:40 UTC 
(rev 10412)
+++ trunk/property/inc/class.socondition_survey.inc.php 2012-11-01 14:19:30 UTC 
(rev 10413)
@@ -23,7 +23,7 @@
        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package property
-       * @subpackage custom
+       * @subpackage project
        * @version $Id$
        */
 
@@ -34,14 +34,64 @@
 
        class property_socondition_survey
        {
-               function __construct()
+               /**
+               * @var int $_total_records total number of records found
+               */
+               protected $_total_records = 0;
+
+
+               /**
+               * @var int $_receipt feedback on actions
+               */
+               protected $_receipt = array();
+
+
+               /**
+                * @var object $_db reference to the global database object
+                */
+               protected $_db;
+
+               /**
+                * @var string $_join SQL JOIN statement
+                */
+               protected $_join;
+
+               /**
+                * @var string $_like SQL LIKE statement
+                */
+               protected $_like;
+
+
+               public function __construct()
                {
                        $this->account  = 
$GLOBALS['phpgw_info']['user']['account_id'];
-                       $this->db               = & $GLOBALS['phpgw']->db;
-                       $this->join             = & $this->db->join;
-                       $this->like             = & $this->db->like;
+                       $this->_db              = & $GLOBALS['phpgw']->db;
+                       $this->_join    = & $this->_db->join;
+                       $this->_like    = & $this->_db->like;
                }
 
+               /**
+                * Magic get method
+                *
+                * @param string $varname the variable to fetch
+                *
+                * @return mixed the value of the variable sought - null if not 
found
+                */
+               public function __get($varname)
+               {
+                       switch ($varname)
+                       {
+                               case 'total_records':
+                                       return $this->_total_records;
+                                       break;
+                               case 'receipt':
+                                       return $this->_receipt;
+                                       break;
+                               default:
+                                       return null;
+                       }
+               }
+
                function read($data = array())
                {
                        $start          = isset($data['start'])  ? (int) 
$data['start'] : 0;
@@ -71,265 +121,116 @@
 
                        if($query)
                        {
-                               $query                  = 
$this->db->db_addslashes($query);
-                               $querymethod    = " {$where} name {$this->like} 
'%{$query}%'";
+                               $query                  = 
$this->_db->db_addslashes($query);
+                               $querymethod    = " {$where} name 
{$this->_like} '%{$query}%'";
                        }
 
                        $sql = "SELECT * FROM {$table} $filtermethod 
$querymethod";
 
-                       $this->db->query($sql,__LINE__,__FILE__);
-                       $this->total_records = $this->db->num_rows();
+                       $this->_db->query($sql,__LINE__,__FILE__);
+                       $this->_total_records = $this->_db->num_rows();
 
                        if(!$allrows)
                        {
-                               $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
+                               $this->_db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
                        }
                        else
                        {
-                               $this->db->query($sql . 
$ordermethod,__LINE__,__FILE__);
+                               $this->_db->query($sql . 
$ordermethod,__LINE__,__FILE__);
                        }
 
-                       while ($this->db->next_record())
+                       while ($this->_db->next_record())
                        {
                                $customs[] = array
                                        (
-                                               'custom_id'             => 
$this->db->f('id'),
-                                               'name'                  => 
stripslashes($this->db->f('name')),
-                                               'entry_date'    => 
$this->db->f('entry_date'),
-                                               'user'                  => 
$GLOBALS['phpgw']->accounts->id2name($this->db->f('user_id'))
+                                               'custom_id'             => 
$this->_db->f('id'),
+                                               'name'                  => 
stripslashes($this->_db->f('name')),
+                                               'entry_date'    => 
$this->_db->f('entry_date'),
+                                               'user'                  => 
$GLOBALS['phpgw']->accounts->id2name($this->_db->f('user_id'))
                                        );
                        }
                        return $customs;
                }
 
-               function read_single($custom_id)
+               function read_single($id)
                {
-                       $custom_id = (int) $custom_id;
-                       $this->db->query("SELECT * from fm_custom where 
id={$custom_id}",__LINE__,__FILE__);
+                       $table = 'fm_condition_survey';
 
-                       $custom = array();
-                       if ($this->db->next_record())
-                       {
-                               $custom = array
-                                       (
-                                               'id'                    => 
(int)$this->db->f('id'),
-                                               'name'                  => 
$this->db->f('name', true),
-                                               'sql_text'              => 
$this->db->f('sql_text', true),
-                                               'entry_date'    => 
$this->db->f('entry_date'),
-                                               'cols'                  => 
$this->read_cols($custom_id)
-                                       );
-                       }
+                       $id = (int) $id;
+                       $this->_db->query("SELECT * FROM {$table} WHERE 
id={$id}",__LINE__,__FILE__);
 
-                       return $custom;
-               }
-
-               function read_cols($custom_id)
-               {
-                       $custom_id = (int) $custom_id;
-                       $sql = "SELECT * FROM fm_custom_cols WHERE 
custom_id={$custom_id} ORDER by sorting";
-                       $this->db->query($sql);
-
-                       $cols = array();
-                       while ($this->db->next_record())
+                       $values = array();
+                       if ($this->_db->next_record())
                        {
-                               $cols[] = array
-                                       (
-                                               'id'    => $this->db->f('id'),
-                                               'name'  => $this->db->f('name'),
-                                               'descr' => 
$this->db->f('descr', true),
-                                               'sorting'=> 
$this->db->f('sorting')
-                                       );
+                               $values = array
+                               (
+                                       'id'                    => 
(int)$this->_db->f('id'),
+                                       'name'                  => 
$this->_db->f('name', true),
+                                       'sql_text'              => 
$this->_db->f('sql_text', true),
+                                       'entry_date'    => 
$this->_db->f('entry_date'),
 
+                               );
                        }
-                       return $cols;
-               }
 
-               function read_custom_name($custom_id)
-               {
-                       $custom_id = (int) $custom_id;
-                       $this->db->query("SELECT name FROM fm_custom where 
id={$custom_id}",__LINE__,__FILE__);
-                       $this->db->next_record();
-                       return $this->db->f('name', true);
+                       return $values;
                }
 
-               function add($custom)
-               {
-                       $custom['name'] = 
$this->db->db_addslashes($custom['name']);
-                       $custom['sql_text'] = 
$this->db->db_addslashes(htmlspecialchars_decode($custom['sql_text']));
 
-                       $this->db->transaction_begin();
-
-                       $id = $this->db->next_id('fm_custom');
-
-                       $this->db->query("INSERT INTO fm_custom 
(id,entry_date,sql_text,name,user_id) "
-                               . "VALUES ($id,'" . time() . "','" . 
$custom['sql_text'] . "','" . $custom['name'] . "'," . $this->account . 
")",__LINE__,__FILE__);
-
-                       $receipt['custom_id']= $id;
-
-
-                       $this->db->transaction_commit();
-
-                       $receipt['message'][] = array('msg'=>lang('custom %1 
has been saved',$receipt['custom_id']));
-                       return $receipt;
-               }
-
-               function edit($custom)
+               function add($data)
                {
-                       $custom['name'] = 
$this->db->db_addslashes($custom['name']);
-                       $custom['sql_text'] = 
$this->db->db_addslashes(htmlspecialchars_decode($custom['sql_text']));
+                       $table = 'fm_condition_survey';
+                       $custom['sql_text'] = 
$this->_db->db_addslashes(htmlspecialchars_decode($custom['sql_text']));
 
-                       $this->db->query("UPDATE fm_custom set 
sql_text='{$custom['sql_text']}', entry_date='" . time() . "', 
name='{$custom['name']}' WHERE id=" . (int) 
$custom['custom_id'],__LINE__,__FILE__);
+                       $this->_db->transaction_begin();
 
-                       if($custom['new_name'])
-                       {
-                               $column_id = 
$this->db->next_id('fm_custom_cols', array('custom_id'=>$custom['custom_id']));
+                       $id = $this->_db->next_id($table);
 
-                               $sql = "SELECT max(sorting) as max_sort FROM 
fm_custom_cols WHERE custom_id=" . $custom['custom_id'];
-                               $this->db->query($sql);
-                               $this->db->next_record();
-                               $sorting        = $this->db->f('max_sort')+1;
+                       $value_set = array
+                       (
+                               'id'                            => $id,
+                               'title'                         => 
$this->_db->db_addslashes($data['title']),
+                               'month'                         => 
$entry['month'],
+                               'budget'                        => 
$entry['budget'],
+                               'user_id'                       => 
$entry['user_id'],
+                               'entry_date'            => $entry['entry_date'],
+                               'modified_date'         => 
$entry['modified_date']
+                       );
+                       $cols = implode(',', array_keys($value_set));
+                       $values = 
$this->_db->validate_insert(array_values($value_set));
+                       $this->_db->query("INSERT INTO {$table} ({$cols}) 
VALUES ({$values})",__LINE__,__FILE__);
 
-                               $values= array(
-                                       $custom['custom_id'],
-                                       $column_id,
-                                       $custom['new_name'],
-                                       
$this->db->db_addslashes($custom['new_descr']),
-                                       $sorting
-                               );
+                       $receipt['id']= $id;
 
-                               $values = $this->db->validate_insert($values);
-
-                               $this->db->query("INSERT INTO fm_custom_cols 
(custom_id,id,name,descr,sorting) "
-                                       . "VALUES ($values)");
-                       }
-
-
-                       if($custom['delete_cols'])
+                       if($this->_db->transaction_commit())
                        {
-                               for ($i=0;$i<count($custom['delete_cols']);$i++)
-                               {
-
-                                       $sql = "SELECT sorting FROM 
fm_custom_cols where custom_id=" . $custom['custom_id'] . " AND id=" . 
$custom['delete_cols'][$i];
-                                       $this->db->query($sql);
-                                       $this->db->next_record();
-                                       $sorting        = 
$this->db->f('sorting');
-                                       $sql2 = "SELECT max(sorting) as 
max_sort FROM fm_custom_cols";
-                                       $this->db->query($sql2);
-                                       $this->db->next_record();
-                                       $max_sort       = 
$this->db->f('max_sort');
-
-                                       if($max_sort>$sorting)
-                                       {
-                                               $sql = "UPDATE fm_custom_cols 
set sorting=sorting-1 WHERE sorting > $sorting AND custom_id=" . 
$custom['custom_id'];
-                                               $this->db->query($sql);
-                                       }
-
-
-                                       $this->db->query("DELETE FROM 
fm_custom_cols WHERE  custom_id=" . $custom['custom_id']  ." AND id=" . 
$custom['delete_cols'][$i]);
-                               }
+                               $this->_receipt['message'][] = 
array('msg'=>lang('survey %1 has been saved',$id));
+                               return $id;
                        }
-
-                       $receipt['custom_id']= $custom['custom_id'];
-                       $receipt['message'][] = array('msg'=>lang('custom %1 
has been edited',$custom['custom_id']));
-                       return $receipt;
+                       return 0;
                }
 
-               function resort($data)
+               function edit($data)
                {
-                       //html_print_r($data);
-                       if(is_array($data))
-                       {
-                               $resort = 
(isset($data['resort'])?$data['resort']:'up');
-                               $custom_id = 
(isset($data['id'])?$data['custom_id']:'');
-                               $id = (isset($data['id'])?$data['id']:'');
-                       }
+                       $table = 'fm_condition_survey';
+                       $id = (int)$data['id'];
 
-                       $sql = "SELECT sorting FROM fm_custom_cols WHERE 
custom_id = $custom_id AND id=$id";
-                       $this->db->query($sql);
-                       $this->db->next_record();
-                       $sorting        = $this->db->f('sorting');
-                       $sql = "SELECT max(sorting) as max_sort FROM 
fm_custom_cols WHERE custom_id = $custom_id";
-                       $this->db->query($sql);
-                       $this->db->next_record();
-                       $max_sort       = $this->db->f('max_sort');
-                       switch($resort)
-                       {
-                               case 'up':
-                                       if($sorting>1)
-                                       {
-                                               $sql = "UPDATE fm_custom_cols 
set sorting=$sorting WHERE custom_id = $custom_id AND sorting =" . ($sorting-1);
-                                               $this->db->query($sql);
-                                               $sql = "UPDATE fm_custom_cols 
set sorting=" . ($sorting-1) ." WHERE custom_id = $custom_id AND id=$id";
-                                               $this->db->query($sql);
-                                       }
-                                       break;
-                               case 'down':
-                                       if($max_sort > $sorting)
-                                       {
-                                               $sql = "UPDATE fm_custom_cols 
set sorting=$sorting WHERE custom_id = $custom_id AND sorting =" . ($sorting+1);
-                                               $this->db->query($sql);
-                                               $sql = "UPDATE fm_custom_cols 
set sorting=" . ($sorting+1) ." WHERE custom_id = $custom_id AND id=$id";
-                                               $this->db->query($sql);
-                                       }
-                                       break;
-                               default:
-                                       return;
-                                       break;
-                       }
-               }
+                       $value_set      = 
$this->db->validate_update($value_set);
 
-               function read_custom($data)
-               {
-                       $start          = isset($data['start']) && 
$data['start'] ? $data['start'] : 0;
-                       $filter         = isset($data['filter']) && 
$data['filter'] ? $data['filter'] : 'none';
-                       $query          = isset($data['query']) ? 
$data['query'] : '';
-                       $sort           = isset($data['sort']) && $data['sort'] 
? $data['sort'] : 'DESC';
-                       $order          = isset($data['order']) ? 
$data['order'] : '';
-                       $allrows        = isset($data['allrows']) ? 
$data['allrows'] : '';
-                       $custom_id      = isset($data['custom_id']) && 
$data['custom_id'] ? (int)$data['custom_id'] : 0;
+                       $this->db->transaction_begin();
 
-                       $this->db->query("SELECT sql_text FROM fm_custom where 
id={$custom_id}",__LINE__,__FILE__);
-                       $this->db->next_record();
-                       $sql = $this->db->f('sql_text', true);
+                       $this->db->query("UPDATE {$table} SET $value_set WHERE 
id= {$id}",__LINE__,__FILE__);
 
-                       $uicols = $this->read_cols($custom_id);
-                       $this->uicols = $uicols;
-
-                       //FIXME:
-                       $ordermethod = '';
-
-                       $this->db->query($sql,__LINE__,__FILE__);
-                       $this->total_records = $this->db->num_rows();
-
-                       if(!$allrows)
+                       if($this->_db->transaction_commit())
                        {
-                               $this->db->limit_query($sql . 
$ordermethod,$start,__LINE__,__FILE__);
+                               $this->_receipt['message'][] = 
array('msg'=>lang('survey %1 has been saved',$id));
                        }
-                       else
-                       {
-                               $this->db->query($sql . 
$ordermethod,__LINE__,__FILE__);
-                       }
-
-                       $n=count($uicols);
-                       $j=0;
-                       while ($this->db->next_record())
-                       {
-                               for ($i=0;$i<$n;$i++)
-                               {
-                                       $custom[$j][$uicols[$i]['name']] = 
$this->db->f($uicols[$i]['name']);
-                                       $custom[$j]['grants'] = 
(int)$grants[$this->db->f('user_id')];
-                               }
-                               $j++;
-                       }
-
-                       //_debug_array($custom);
-                       return $custom;
+                       return $id;
                }
 
-               function delete($custom_id)
+               function delete($id)
                {
-                       $custom_id = (int) $custom_id;
-                       $this->db->query("DELETE FROM fm_custom WHERE 
id={$custom_id}",__LINE__,__FILE__);
-                       $this->db->query("DELETE FROM fm_custom_cols WHERE 
custom_id={$custom_id}",__LINE__,__FILE__);
+                       $id = (int) $id;
+                       $table = 'fm_condition_survey';
+                       $this->_db->query("DELETE FROM $table WHERE 
id={$id}",__LINE__,__FILE__);
                }
        }

Modified: trunk/property/inc/class.uicondition_survey.inc.php
===================================================================
--- trunk/property/inc/class.uicondition_survey.inc.php 2012-11-01 14:15:40 UTC 
(rev 10412)
+++ trunk/property/inc/class.uicondition_survey.inc.php 2012-11-01 14:19:30 UTC 
(rev 10413)
@@ -58,8 +58,10 @@
                        $this->acl_manage                       = 
$this->acl->check($this->acl_location, 16, 'property');
 
                        $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
"property::condition_survey";
+                       
$GLOBALS['phpgw']->css->add_external_file('logistic/templates/base/css/base.css');
                }
 
+
                public function index()
                {
                        if (phpgw::get_var('phpgw_return_as') == 'json')
@@ -71,30 +73,9 @@
                        phpgwapi_yui::load_widget('datatable');
                        phpgwapi_yui::load_widget('paginator');
 
-                       $cats   = CreateObject('phpgwapi.categories', -1, 
'property', $this->acl_location);
-                       $cats->supress_info     = true;
-
-                       $categories = 
$cats->formatted_xslt_list(array('format'=>'filter','selected' => 
$this->cat_id,'globals' => true,'use_acl' => $this->_category_acl));
-                       $default_value = array ('cat_id'=>'','name'=> lang('no 
category'));
-                       array_unshift ($categories['cat_list'],$default_value);
+                       $categories = $this->_get_categories();
                        
-                       foreach ($categories['cat_list'] as & $_category)
-                       {
-                               $_category['id'] = $_category['cat_id'];
-                       }
 
-                       $survey_type_array = array();
-                       $survey_type_array[] = array
-                       (
-                               'id'    => 0,
-                               'name'  => 'Select'
-                       );
-                       $survey_type_array[] = array
-                       (
-                               'id'    => 1,
-                               'name'  => 'type 1'
-                       );
-
                        $data = array(
                                'datatable_name'        => lang('condition 
survey'),
                                'form' => array(
@@ -103,7 +84,7 @@
                                                        array('type' => 
'filter',
                                                                'name' => 
'cat_id',
                                                                'text' => 
lang('category') . ':',
-                                                               'list' => 
$categories['cat_list'],
+                                                               'list' => 
$categories,
                                                        ),
                                                        array('type' => 'text',
                                                                'text' => 
lang('search'),
@@ -174,7 +155,7 @@
                                        (
                                                array
                                                (
-                                                       'name'          => 
'survey_id',
+                                                       'name'          => 'id',
                                                        'source'        => 'id'
                                                ),
                                        )
@@ -191,8 +172,6 @@
                                                'parameters'    => 
json_encode($parameters)
                                        );
 
-                       
$GLOBALS['phpgw']->css->add_external_file('logistic/templates/base/css/base.css');
-
                        self::render_template_xsl('datatable_common', $data);
                }
 
@@ -285,52 +264,37 @@
                                }
                        }
 
+                       $survey = array();
 
-
-                       $project_id = phpgw::get_var('id');
-                       if ($project_id && is_numeric($project_id))
+                       if ($id)
                        {
-                               $project = $this->so->get_single($project_id);
+                               $survey = $this->so->read_single( array('id' => 
$id,  'view' => $mode == 'view') );
                        }
-                       else
-                       {
-                               if($project == null)
-                               {
-                                       $project = new logistic_project();      
-                               }
-                       }
 
-                       $project_types = $this->so->get_project_types();
-                       foreach ($project_types as &$p_type)
-                       {
-                               if ($project->get_project_type_id() == 
$p_type['id'])
-                               {
-                                       $p_type['selected'] = 1;
-                               }
-                       }
-                       
+                       $categories = 
$this->_get_categories($survey['category']);
+
                        $data = array
                        (
-                               'project' => $project,
-                               'options' => $project_types,
-                               'editable' => true
+                               'project'               => $survey,
+                               'categories'    => array('options' => 
$categories),
+                               'editable'              => $mode == 'edit'
                        );
 
                        $this->use_yui_editor('description');
                        $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('property') . '::' . lang('condition survey');
                        
                        phpgwapi_jquery::load_widget('core');
-                       self::add_javascript('project', 'yahoo', 
'condition_survey.edit.js');
+                       self::add_javascript('property', 'portico', 
'condition_survey_edit.js');
                        self::render_template_xsl(array('condition_survey'), 
$data);
                }
                
                public function save()
                {
-                       $project_id = phpgw::get_var('id');
+                       $id = phpgw::get_var('id');
                        
-                       if ($project_id && is_numeric($project_id))
+                       if ($id )
                        {
-                               $project = $this->so->get_single($project_id);
+                               $project = $this->so->get_single($id);
                        }
                        else
                        {
@@ -341,13 +305,28 @@
                        
                        if( $project->validate() )
                        {
-                               $project_id = $this->so->store($project);
-                               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'property.uicondition_survey.view', 'id' => 
$project_id)); 
+                               $id = $this->so->store($project);
+                               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'property.uicondition_survey.view', 'id' => $id)); 
                        }
                        else
                        {
                                $this->edit( $project );
                        }
                }
-       }
 
+               private function _get_categories($selected = 0)
+               {
+                       $cats   = CreateObject('phpgwapi.categories', -1, 
'property', $this->acl_location);
+                       $cats->supress_info     = true;
+                       $categories = 
$cats->formatted_xslt_list(array('format'=>'filter','selected' => 
$selected,'globals' => true,'use_acl' => $this->_category_acl));
+                       $default_value = array ('cat_id'=>'','name'=> lang('no 
category'));
+                       array_unshift ($categories['cat_list'],$default_value);
+
+                       foreach ($categories['cat_list'] as & $_category)
+                       {
+                               $_category['id'] = $_category['cat_id'];
+                       }
+                       
+                       return $categories['cat_list'];
+               }
+       }

Added: trunk/property/js/portico/condition_survey_edit.js
===================================================================
--- trunk/property/js/portico/condition_survey_edit.js                          
(rev 0)
+++ trunk/property/js/portico/condition_survey_edit.js  2012-11-01 14:19:30 UTC 
(rev 10413)
@@ -0,0 +1,55 @@
+$(document).ready(function(){
+
+       $("#form").submit(function(e){
+               
+               var thisForm = $(this);
+
+               var $required_input_fields = $(this).find(".required");
+               var status = true;
+       
+               // Checking that required fields (fields with class required) 
is not null
+           $required_input_fields.each(function() {
+               
+               // User has selected a value from select list
+               if( $(this).is("select") & $(this).val() == 0 ){
+                       var nextElem = $(this).next();
+                       
+                       if( !$(nextElem).hasClass("input_error_msg") )
+                               $(this).after("<div class='input_error_msg'>" + 
lang['please choose from list'] + "</div>");
+                                               
+                       status = false;
+               }
+
+               // Input field is not empty
+               else if( $(this).is("input") & $(this).val() == '' ){
+                       var nextElem = $(this).next();
+                       
+                       if( !$(nextElem).hasClass("input_error_msg") )
+                               $(this).after("<div class='input_error_msg'>" + 
lang['please enter a value'] + "</div>");
+                                               
+                       status = false;
+               }
+               else{
+                       var nextElem = $(this).next();
+
+                       if( $(nextElem).hasClass("input_error_msg") )
+                               $(nextElem).remove();
+               }
+           }); 
+           
+           if( $(thisForm).find('input[type=checkbox]:checked').length == 0){
+               
+               if( 
!$(thisForm).find("ul.cases").prev().hasClass("input_error_msg") )
+                       $(thisForm).find("ul.cases").before("<div 
class='input_error_msg'>" + lang['please choose an entry'] + "</div>");
+               
+               status = false;
+           }
+         
+           if( !status ){
+               e.preventDefault();
+           }
+               
+       });
+       
+});
+




reply via email to

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