[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [9132] registration: location datatype
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [9132] registration: location datatype |
Date: |
Thu, 12 Apr 2012 13:23:49 +0000 |
Revision: 9132
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9132
Author: sigurdne
Date: 2012-04-12 13:23:47 +0000 (Thu, 12 Apr 2012)
Log Message:
-----------
registration: location datatype
Modified Paths:
--------------
trunk/registration/inc/class.bomanagefields.inc.php
trunk/registration/inc/class.boreg.inc.php
trunk/registration/inc/class.soreg.inc.php
trunk/registration/inc/class.uimanagefields.inc.php
trunk/registration/inc/class.uireg.inc.php
trunk/registration/js/portico/ajax.js
trunk/registration/templates/base/fields.tpl
trunk/registration/templates/base/personal_info.tpl
Modified: trunk/registration/inc/class.bomanagefields.inc.php
===================================================================
--- trunk/registration/inc/class.bomanagefields.inc.php 2012-04-12 11:55:33 UTC
(rev 9131)
+++ trunk/registration/inc/class.bomanagefields.inc.php 2012-04-12 13:23:47 UTC
(rev 9132)
@@ -33,6 +33,7 @@
function save_fields ($fields)
{
+
$current_fields = $this->get_field_list();
$name_transforms = array (
@@ -46,7 +47,8 @@
'country' => 'adr_one_countryname',
'gender' => 'gender',
'phone' => 'tel_work',
- 'birthday' => 'bday'
+ 'birthday' => 'bday',
+ 'location' => 'loc1'
);
reset ($fields);
@@ -61,11 +63,30 @@
}
reset ($name_transforms);
- while (list ($type, $transform_name) = each
($name_transforms))
+ foreach ($name_transforms as $type =>
$transform_name)
{
if ($field_info['field_type'] == $type)
{
- $field_info['field_name'] =
$transform_name;
+ reset($this->fields);
+ $suffix = 0;
+ foreach($this->fields as
$current_field)
+ {
+
if($current_field['field_type'] == 'location')
+ {
+ $suffix++;
+ }
+ }
+
+ unset($current_field);
+
+ if($suffix &&
$field_info['field_type'] == 'location')
+ {
+
$field_info['field_name'] = rtrim($transform_name,'1') . $suffix;
+ }
+ else
+ {
+
$field_info['field_name'] = $transform_name;
+ }
$changed = 1;
break;
}
@@ -215,4 +236,3 @@
}
}
}
-?>
Modified: trunk/registration/inc/class.boreg.inc.php
===================================================================
--- trunk/registration/inc/class.boreg.inc.php 2012-04-12 11:55:33 UTC (rev
9131)
+++ trunk/registration/inc/class.boreg.inc.php 2012-04-12 13:23:47 UTC (rev
9132)
@@ -57,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');
@@ -231,7 +231,7 @@
else
{
// Redirect them so they don't hit refresh and
make a mess
-
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/registration/main.php',array('menuaction'
=> 'registration.uireg.ready_to_activate', 'reg_id' => $reg_id, 'logindomain'
=> $_REQUEST['logindomain'])));
+
$GLOBALS['phpgw']->redirect_link('/registration/main.php',array('menuaction' =>
'registration.uireg.ready_to_activate', 'reg_id' => $reg_id, 'logindomain' =>
$_REQUEST['logindomain']));
}
}
@@ -305,7 +305,7 @@
else
{
// Redirect them so they don't hit refresh and
make a mess
-
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/registration/main.php',
array('menuaction' => 'registration.uireg.email_sent_lostpw','logindomain' =>
$_REQUEST['logindomain'])));
+
$GLOBALS['phpgw']->redirect_link('/registration/main.php', array('menuaction'
=> 'registration.uireg.email_sent_lostpw','logindomain' =>
$_REQUEST['logindomain']));
}
}
@@ -401,7 +401,7 @@
}
else
{
- $GLOBALS['phpgw']->redirect
($GLOBALS['phpgw']->link ('/registration/main.php', array('menuaction' =>
'registration.boreg.step1', 'r_reg[loginid]'=> $_SERVER['PHP_AUTH_USER'],
'logindomain' => $_REQUEST['logindomain'])));
+
$GLOBALS['phpgw']->redirect_link('/registration/main.php', array('menuaction'
=> 'registration.boreg.step1', 'r_reg[loginid]'=> $_SERVER['PHP_AUTH_USER'],
'logindomain' => $_REQUEST['logindomain']));
}
}
@@ -431,6 +431,15 @@
function get_locations()
{
- return execMethod('property.solocation.get_children',
phpgw::get_var('location_code'));
+ $location_code = phpgw::get_var('location_code');
+
+ $locations =
execMethod('property.solocation.get_children', $location_code);
+
+ if(!$location_code)
+ {
+ array_push($locations, array('id' => '', 'name'
=> lang('select')));
+ }
+
+ return $locations;
}
}
Modified: trunk/registration/inc/class.soreg.inc.php
===================================================================
--- trunk/registration/inc/class.soreg.inc.php 2012-04-12 11:55:33 UTC (rev
9131)
+++ trunk/registration/inc/class.soreg.inc.php 2012-04-12 13:23:47 UTC (rev
9132)
@@ -60,12 +60,26 @@
$this->reg_id = md5(time() . $account_lid .
$GLOBALS['phpgw']->common->randomstring(32));
$account_lid =
$GLOBALS['phpgw']->session->appsession('loginid','registration');
+ $location = array();
+
+ for ($i=1; $i<=6; $i++)
+ {
+ if (isset($fields["loc{$i}"]) &&
$fields["loc{$i}"])
+ {
+ $location[] = $fields["loc{$i}"];
+ }
+ }
+
+ if($location)
+ {
+ $fields['location_code'] = implode('-',
$location);
+ }
+
$this->db->query("UPDATE phpgw_reg_accounts SET
reg_id='" . $this->reg_id . "', reg_dla='"
. time() . "', reg_info='" .
base64_encode(serialize($fields))
. "' WHERE
reg_lid='$account_lid'",__LINE__,__FILE__);
-
- if ($this->config['activate_account'] ==
'pending_approval')
+ if ($this->config['activate_account'] ==
'pending_approval' || $this->config['activate_account'] =='immediately')
{
return $this->reg_id;
}
Modified: trunk/registration/inc/class.uimanagefields.inc.php
===================================================================
--- trunk/registration/inc/class.uimanagefields.inc.php 2012-04-12 11:55:33 UTC
(rev 9131)
+++ trunk/registration/inc/class.uimanagefields.inc.php 2012-04-12 13:23:47 UTC
(rev 9132)
@@ -75,6 +75,7 @@
'lang_gender' => lang ('Gender'),
'lang_phone' => lang ('Phone'),
'lang_birthday' => lang ('Birthday'),
+ 'lang_location' => lang ('location'),
'lang_cancel' => lang ('Cancel'),
'lang_update_add' => lang ('Update/Add')
);
@@ -95,7 +96,7 @@
$p->set_block ('fields', 'info', 'info_list');
$fields = $this->bo->fields;
- while (list ($num, $field_info) = each ($fields))
+ foreach ($fields as $num => $field_info)
{
unset ($field_required);
@@ -124,6 +125,7 @@
'field_type_selected_gender' => '',
'field_type_selected_phone' => '',
'field_type_selected_birthday' => '',
+ 'field_type_selected_location' => '',
'field_type_selected_' .
$field_info['field_type'] => 'selected',
'field_values' =>
$field_info['field_values'],
'field_required' => $field_required,
@@ -155,6 +157,7 @@
'field_type_selected_gender' => '',
'field_type_selected_phone' => '',
'field_type_selected_birthday' => '',
+ 'field_type_selected_location' => '',
'field_values' => '',
'field_required' => '',
'field_remove' => '',
Modified: trunk/registration/inc/class.uireg.inc.php
===================================================================
--- trunk/registration/inc/class.uireg.inc.php 2012-04-12 11:55:33 UTC (rev
9131)
+++ trunk/registration/inc/class.uireg.inc.php 2012-04-12 13:23:47 UTC (rev
9132)
@@ -223,7 +223,7 @@
$this->template->set_block ('form',
'other_fields_proto', 'other_fields_list');
reset ($this->fields);
-
+/*
$this->fields['loc1'] = array
(
'field_name' => 'loc1',
@@ -240,7 +240,7 @@
'field_text' => 'Bygning',
'field_type' => 'location',
'field_values' => '',
- 'field_required' => 'Y',
+ 'field_required' => 'N',
'field_order' => 0
);
@@ -250,7 +250,7 @@
'field_text' => 'Etasje',
'field_type' => 'location',
'field_values' => '',
- 'field_required' => 'Y',
+ 'field_required' => 'N',
'field_order' => 0
);
@@ -260,7 +260,7 @@
'field_text' => 'Sone',
'field_type' => 'location',
'field_values' => '',
- 'field_required' => 'Y',
+ 'field_required' => 'N',
'field_order' => 0
);
@@ -270,10 +270,10 @@
'field_text' => 'Rom',
'field_type' => 'location',
'field_values' => '',
- 'field_required' => 'Y',
+ 'field_required' => 'N',
'field_order' => 0
);
-
+*/
//_debug_array($this->fields);
foreach ($this->fields as $num => $field_info)
{
@@ -296,11 +296,11 @@
{
$this->template->set_var('tos_link',$GLOBALS['phpgw']->link('/registration/main.php',
array('menuaction' => 'registration.uireg.tos','logindomain' =>
$_REQUEST['logindomain'])));
$this->template->set_var('lang_tos_agree',lang('I have
read the terms and conditions and agree by them.'));
- if ($r_reg['tos_agree'])
- {
-
$this->template->set_var('value_tos_agree', 'checked');
- }
+ if ($r_reg['tos_agree'])
+ {
+ $this->template->set_var('value_tos_agree',
'checked');
}
+ }
else
{
$this->template->set_block ('form', 'tos',
'blank');
@@ -430,7 +430,7 @@
}
else
{
- $rstring = '<select name="' . $a . '['
. $name . ']"><option value=""> </option>';
+ $rstring = "<select id=\"{$name}\"
name=\"{$a}[{$name}]\"><option value=\"\"> </option>";
foreach ($values as $value)
{
$value = trim ($value);
@@ -470,6 +470,8 @@
if ($type == 'country')
{
$rstring = $sbox->country_select($post_value,
$a . '[' . $name . ']');
+
+ $rstring = str_replace('<select', '<select id =
"country"', $rstring);
}
if ($type == 'birthday')
@@ -481,12 +483,21 @@
if ($type == 'location')
{
+ if($post_value)
+ {
+ $rstring = "<input id=\"{$name}\"
type=\"text\" name=\"{$a}[{$name}]\" value=\"{$post_value}\">";
+ }
+ else
+ {
+
$rstring = <<<HTML
<select id="{$name}" name="{$a}[{$name}]">
HTML;
if($name == 'loc1')
{
$locations =
execMethod('property.solocation.get_children');
+ array_unshift($locations, array('id' =>
'', 'name' => lang('select')));
+
foreach ($locations as $location)
{
$selected = $location['id'] ==
$post_value ? ' selected = "selected"' : '';
@@ -499,7 +510,7 @@
$rstring .= <<<HTML
</select>
HTML;
-
+ }
}
return $rstring;
@@ -537,7 +548,7 @@
else
{
/* ($this->config['activate_account'] ==
'immediately') */
-
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/registration/main.php',array('menuaction'=>'registration.boreg.step4',
'reg_id' => $reg_id,'logindomain' => $_REQUEST['logindomain'])));
+
$GLOBALS['phpgw']->redirect_link('/registration/main.php',array('menuaction'=>'registration.boreg.step4',
'reg_id' => $reg_id,'logindomain' => $_REQUEST['logindomain']));
}
}
Modified: trunk/registration/js/portico/ajax.js
===================================================================
--- trunk/registration/js/portico/ajax.js 2012-04-12 11:55:33 UTC (rev
9131)
+++ trunk/registration/js/portico/ajax.js 2012-04-12 13:23:47 UTC (rev
9132)
@@ -2,8 +2,16 @@
$("#loc1").change(function () {
var loc1 = $(this).val();
+ if(!loc1)
+ {
+ $("#loc2").html( "<option></option>" );
+ $("#loc3").html( "<option></option>" );
+ $("#loc4").html( "<option></option>" );
+ $("#loc5").html( "<option></option>" );
+ return false;
+ }
var oArgs = {menuaction:'registration.boreg.get_locations',
location_code:loc1};
- var requestUrl = phpGWLink('index.php', oArgs, true);
+ var requestUrl = phpGWLink('registration/main.php', oArgs,
true);
var htmlString = "";
@@ -14,7 +22,7 @@
success: function(data) {
if( data != null)
{
- htmlString = "<option>" + data.length
+ " lokasjone(r) funnet</option>"
+ htmlString = "<option value = ''>" +
data.length + " lokasjone(r) funnet</option>"
var obj = data;
$.each(obj, function(i) {
@@ -35,8 +43,16 @@
$("#loc2").change(function () {
var loc1 = $("#loc1").val();
var loc2 = $(this).val();
+ if(!loc2)
+ {
+ $("#loc3").html( "<option></option>" );
+ $("#loc4").html( "<option></option>" );
+ $("#loc5").html( "<option></option>" );
+ return false;
+ }
+
var oArgs = {menuaction:'registration.boreg.get_locations',
location_code:loc1 + "-" + loc2};
- var requestUrl = phpGWLink('index.php', oArgs, true);
+ var requestUrl = phpGWLink('registration/main.php', oArgs,
true);
var htmlString = "";
@@ -47,7 +63,7 @@
success: function(data) {
if( data != null)
{
- htmlString = "<option>" + data.length
+ " lokasjone(r) funnet</option>"
+ htmlString = "<option value = ''>" +
data.length + " lokasjone(r) funnet</option>"
var obj = data;
$.each(obj, function(i) {
htmlString += "<option
value='" + obj[i].id + "'>"+ obj[i].name + "</option>";
@@ -68,8 +84,17 @@
var loc1 = $("#loc1").val();
var loc2 = $("#loc2").val();
var loc3 = $(this).val();
+
+ if(!loc3)
+ {
+ $("#loc4").html( "<option></option>" );
+ $("#loc5").html( "<option></option>" );
+ return false;
+ }
+
+
var oArgs = {menuaction:'registration.boreg.get_locations',
location_code:loc1 + "-" + loc2 + "-" + loc3};
- var requestUrl = phpGWLink('index.php', oArgs, true);
+ var requestUrl = phpGWLink('registration/main.php', oArgs,
true);
var htmlString = "";
@@ -80,7 +105,7 @@
success: function(data) {
if( data != null)
{
- htmlString = "<option>" + data.length
+ " lokasjone(r) funnet</option>"
+ htmlString = "<option value = ''>" +
data.length + " lokasjone(r) funnet</option>"
var obj = data;
$.each(obj, function(i) {
htmlString += "<option
value='" + obj[i].id + "'>"+ obj[i].name + "</option>";
@@ -102,8 +127,14 @@
var loc2 = $("#loc2").val();
var loc3 = $("#loc3").val();
var loc4 = $(this).val();
+ if(!loc4)
+ {
+ $("#loc5").html( "<option></option>" );
+ return false;
+ }
+
var oArgs = {menuaction:'registration.boreg.get_locations',
location_code:loc1 + "-" + loc2 + "-" + loc3 + "-" + loc4};
- var requestUrl = phpGWLink('index.php', oArgs, true);
+ var requestUrl = phpGWLink('registration/main.php', oArgs,
true);
var htmlString = "";
@@ -114,7 +145,7 @@
success: function(data) {
if( data != null)
{
- htmlString = "<option>" + data.length
+ " lokasjone(r) funnet</option>"
+ htmlString = "<option value = ''>" +
data.length + " lokasjone(r) funnet</option>"
var obj = data;
$.each(obj, function(i) {
htmlString += "<option
value='" + obj[i].id + "'>"+ obj[i].name + "</option>";
Modified: trunk/registration/templates/base/fields.tpl
===================================================================
--- trunk/registration/templates/base/fields.tpl 2012-04-12 11:55:33 UTC
(rev 9131)
+++ trunk/registration/templates/base/fields.tpl 2012-04-12 13:23:47 UTC
(rev 9132)
@@ -24,21 +24,22 @@
<td><input type="text" name="{field_short_name}_name" size="10"
value="{field_name}"></td>
<td><input type="text" name="{field_short_name}_text"
value="{field_text}"></td>
<td><select name="{field_short_name}_type">
- <option {field_type_selected_text} value=text>{lang_text}</option>
- <option {field_type_selected_textarea}
value=textarea>{lang_textarea}</option>
- <option {field_type_selected_dropdown}
value=dropdown>{lang_dropdown}</option>
- <option {field_type_selected_checkbox}
value=checkbox>{lang_checkbox}</option>
- <option {field_type_selected_email} value=email>{lang_email}</option>
- <option {field_type_selected_first_name}
value=first_name>{lang_first_name}</option>
- <option {field_type_selected_last_name}
value=last_name>{lang_last_name}</option>
- <option {field_type_selected_address}
value=address>{lang_address}</option>
- <option {field_type_selected_city} value=city>{lang_city}</option>
- <option {field_type_selected_state} value=state>{lang_state}</option>
- <option {field_type_selected_zip} value=zip>{lang_zip}</option>
- <option {field_type_selected_country}
value=country>{lang_country}</option>
- <option {field_type_selected_gender} value=gender>{lang_gender}</option>
- <option {field_type_selected_phone} value=phone>{lang_phone}</option>
- <option {field_type_selected_birthday}
value=birthday>{lang_birthday}</option>
+ <option {field_type_selected_text} value="text">{lang_text}</option>
+ <option {field_type_selected_textarea}
value="textarea">{lang_textarea}</option>
+ <option {field_type_selected_dropdown}
value="dropdown">{lang_dropdown}</option>
+ <option {field_type_selected_checkbox}
value="checkbox">{lang_checkbox}</option>
+ <option {field_type_selected_email} value="email">{lang_email}</option>
+ <option {field_type_selected_first_name}
value="first_name">{lang_first_name}</option>
+ <option {field_type_selected_last_name}
value="last_name">{lang_last_name}</option>
+ <option {field_type_selected_address}
value="address">{lang_address}</option>
+ <option {field_type_selected_city} value="city">{lang_city}</option>
+ <option {field_type_selected_state} value="state">{lang_state}</option>
+ <option {field_type_selected_zip} value="zip">{lang_zip}</option>
+ <option {field_type_selected_country}
value="country">{lang_country}</option>
+ <option {field_type_selected_gender}
value="gender">{lang_gender}</option>
+ <option {field_type_selected_phone} value="phone">{lang_phone}</option>
+ <option {field_type_selected_birthday}
value="birthday">{lang_birthday}</option>
+ <option {field_type_selected_location}
value="location">{lang_location}</option>
</select></td>
<td><input type="text" name="{field_short_name}_values"
value="{field_values}" size="15"></td>
<td><input type="checkbox" name="{field_short_name}_required"
{field_required}></td>
Modified: trunk/registration/templates/base/personal_info.tpl
===================================================================
--- trunk/registration/templates/base/personal_info.tpl 2012-04-12 11:55:33 UTC
(rev 9131)
+++ trunk/registration/templates/base/personal_info.tpl 2012-04-12 13:23:47 UTC
(rev 9132)
@@ -1,6 +1,13 @@
<!-- BEGIN form -->
<style type="text/css">
-select { width: 300px; }
+#country { width: 300px; }
+#gender { width: 300px; }
+#loc1 { width: 300px; }
+#loc2 { width: 300px; }
+#loc3 { width: 300px; }
+#loc4 { width: 300px; }
+#loc5 { width: 300px; }
+#loc6 { width: 300px; }
</style>
<script language="JavaScript" type="text/javascript">
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [9132] registration: location datatype,
Sigurd Nes <=