fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [9124] more on registration


From: Sigurd Nes
Subject: [Fmsystem-commits] [9124] more on registration
Date: Thu, 12 Apr 2012 07:26:28 +0000

Revision: 9124
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9124
Author:   sigurdne
Date:     2012-04-12 07:26:25 +0000 (Thu, 12 Apr 2012)
Log Message:
-----------
more on registration

Modified Paths:
--------------
    trunk/property/inc/class.solocation.inc.php
    trunk/registration/inc/class.boreg.inc.php
    trunk/registration/inc/class.uireg.inc.php
    trunk/registration/main.php
    trunk/registration/templates/base/personal_info.tpl

Modified: trunk/property/inc/class.solocation.inc.php
===================================================================
--- trunk/property/inc/class.solocation.inc.php 2012-04-11 14:15:32 UTC (rev 
9123)
+++ trunk/property/inc/class.solocation.inc.php 2012-04-12 07:26:25 UTC (rev 
9124)
@@ -1789,10 +1789,19 @@
                        return $this->db->f('id');
                }
 
-               function get_children($location_code)
+               function get_children($location_code = '')
                {
-                       $level = count(explode('-', $location_code));
+                       if(!$location_code)
+                       {
+                               $level = 0;
+                       }
+                       else
+                       {
+                               $level = count(explode('-', $location_code));
+                       }
+
                        $child_level = $level + 1;
+
                        $location_types = 
$this->soadmin_location->select_location_type();
 
                        $values = array();
@@ -1805,10 +1814,11 @@
                        $this->db->query("SELECT loc{$child_level} AS id, 
loc{$child_level}_name AS name FROM fm_location{$child_level} WHERE 
location_code {$this->like} '{$location_code}%'",__LINE__,__FILE__);
                        while ($this->db->next_record())
                        {
+                               $id = $this->db->f('id');
                                $values[] = array
                                (
-                                       'id'    =>  $this->db->f('id'),
-                                       'name'  =>  $this->db->f('name')
+                                       'id'    =>  $id,
+                                       'name'  =>  $id . ' :: ' 
.$this->db->f('name')
                                );
                        }
                        return $values;

Modified: trunk/registration/inc/class.boreg.inc.php
===================================================================
--- trunk/registration/inc/class.boreg.inc.php  2012-04-11 14:15:32 UTC (rev 
9123)
+++ trunk/registration/inc/class.boreg.inc.php  2012-04-12 07:26:25 UTC (rev 
9124)
@@ -29,7 +29,8 @@
                        'step4' => True,
                        'lostpw1' => True,
                        'lostpw2' => True,
-                       'lostpw3' => True
+                       'lostpw3' => True,
+                       'get_locations'=> true
                );
 
                function boreg()
@@ -56,7 +57,7 @@
 
                        if (! is_array($errors) && 
$so->account_exists($r_reg['loginid']))
                        {
-                               $errors[] = lang('Sorry, that username is 
already taken.');
+//                             $errors[] = lang('Sorry, that username is 
already taken.');
                        }
 
                        $ui = createobject('registration.uireg');
@@ -427,4 +428,9 @@
 
                        return True;
                }
+
+               function get_locations()
+               {
+                       return execMethod('property.solocation.get_children', 
phpgw::get_var('location_code'));
+               }
        }

Modified: trunk/registration/inc/class.uireg.inc.php
===================================================================
--- trunk/registration/inc/class.uireg.inc.php  2012-04-11 14:15:32 UTC (rev 
9123)
+++ trunk/registration/inc/class.uireg.inc.php  2012-04-12 07:26:25 UTC (rev 
9124)
@@ -149,6 +149,9 @@
 
                function step2($errors = '',$r_reg = '',$o_reg = 
'',$missing_fields='')
                {
+                       $GLOBALS['phpgw']->js->validate_file('controller', 
'jquery', 'controller');
+                       $GLOBALS['phpgw']->js->validate_file('portico', 'ajax', 
'registration');
+
                        $show_password_prompt = True;
                        $select_password = $this->bo->check_select_password();
                        if (is_string ($select_password))
@@ -171,6 +174,15 @@
                                
$this->template->set_var('errors',$GLOBALS['phpgw']->common->error_list($errors));
                        }
 
+                       $tpl_vars = array
+                       (
+                               'css'                   => 
$GLOBALS['phpgw']->common->get_css(),
+                               'javascript'    => 
$GLOBALS['phpgw']->common->get_javascript(),
+                               'str_base_url'  => $GLOBALS['phpgw']->link('/', 
array(), true),
+                       );
+
+                       $this->template->set_var($tpl_vars);
+
                        if ($missing_fields)
                        {
                                while (list(,$field) = each($missing_fields))
@@ -210,9 +222,63 @@
 
                        $this->template->set_block ('form', 
'other_fields_proto', 'other_fields_list');
                        reset ($this->fields);
+                       
+
+                       $this->fields['loc1'] = array
+                       (
+                               'field_name' => 'loc1',
+                               'field_text' => 'Eiendom',
+                               'field_type' => 'location',
+                               'field_values' => '',
+                               'field_required' => 'Y',
+                               'field_order' => 0
+               );
+
+                       $this->fields['loc2'] = array
+                       (
+                               'field_name' => 'loc2',
+                               'field_text' => 'Bygning',
+                               'field_type' => 'location',
+                               'field_values' => '',
+                               'field_required' => 'Y',
+                               'field_order' => 0
+               );
+
+                       $this->fields['loc3'] = array
+                       (
+                               'field_name' => 'loc3',
+                               'field_text' => 'Etasje',
+                               'field_type' => 'location',
+                               'field_values' => '',
+                               'field_required' => 'Y',
+                               'field_order' => 0
+               );
+
+                       $this->fields['loc4'] = array
+                       (
+                               'field_name' => 'loc4',
+                               'field_text' => 'Sone',
+                               'field_type' => 'location',
+                               'field_values' => '',
+                               'field_required' => 'Y',
+                               'field_order' => 0
+               );
+
+                       $this->fields['loc5'] = array
+                       (
+                               'field_name' => 'loc5',
+                               'field_text' => 'Rom',
+                               'field_type' => 'location',
+                               'field_values' => '',
+                               'field_required' => 'Y',
+                               'field_order' => 0
+               );
+
+//_debug_array($this->fields);
                        foreach ($this->fields as $num => $field_info)
                        {
                                $input_field = $this->get_input_field 
($field_info, $post_values);
+
                                $var = array (
                                        'missing_indicator' => 
$missing[$field_info['field_name']] ? '<font color="#CC0000">*</font>' : '',
                                        'bold_start'  => 
$field_info['field_required'] == 'Y' ? '<b>' : '',
@@ -413,6 +479,29 @@
                                $rstring .= $sbox->getyears ($a . '[' . $name . 
'_year]', $post_values[$name . '_year'], 1900, date ('Y') + 1);
                        }
 
+                       if ($type == 'location')
+                       {
+                               $rstring = <<<HTML
+                               <select id="{$name}" name="{$a}[{$name}]">
+HTML;
+                               if($name == 'loc1')
+                               {
+                                       $locations = 
execMethod('property.solocation.get_children');
+                                       foreach ($locations as $location)
+                                       {
+                                               $selected = $location['id'] == 
$post_value ? ' selected = "selected"' : '';
+                                               $rstring .= <<<HTML
+                                               <option value 
="{$location['id']}" $selected>{$location['name']}</option>
+HTML;
+                                       }
+                               }
+
+                               $rstring .= <<<HTML
+                               </select>
+HTML;
+
+                       }
+
                        return $rstring;
                }
 

Modified: trunk/registration/main.php
===================================================================
--- trunk/registration/main.php 2012-04-11 14:15:32 UTC (rev 9123)
+++ trunk/registration/main.php 2012-04-12 07:26:25 UTC (rev 9124)
@@ -54,7 +54,8 @@
                                'step4'                         => true,
                                'lostpw1'                       => true,
                                'lostpw2'                       => true,
-                               'lostpw3'                       => true
+                               'lostpw3'                       => true,
+                               'get_locations'         => true
                        )
                )
        );

Modified: trunk/registration/templates/base/personal_info.tpl
===================================================================
--- trunk/registration/templates/base/personal_info.tpl 2012-04-11 14:15:32 UTC 
(rev 9123)
+++ trunk/registration/templates/base/personal_info.tpl 2012-04-12 07:26:25 UTC 
(rev 9124)
@@ -1,4 +1,8 @@
 <!-- BEGIN form -->
+<style type="text/css">
+select { width: 300px; }
+</style>
+
 <script language="JavaScript" type="text/javascript">
        var tos;
 
@@ -20,6 +24,17 @@
        }
 </script>
 
+{css}
+
+<script type="text/javascript">
+<!--
+       var strBaseURL = '{str_base_url}';
+       {win_on_events}
+//-->
+</script>
+{javascript}
+
+
 <center>{errors}</center>
 <form action="{form_action}" method="POST">
  <table border="0" width="75%" align="center">




reply via email to

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