[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [9405] registration: alternative reg
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [9405] registration: alternative reg |
Date: |
Tue, 15 May 2012 13:09:41 +0000 |
Revision: 9405
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9405
Author: sigurdne
Date: 2012-05-15 13:09:40 +0000 (Tue, 15 May 2012)
Log Message:
-----------
registration: alternative reg
Modified Paths:
--------------
trunk/registration/inc/class.boreg.inc.php
trunk/registration/inc/class.menu.inc.php
trunk/registration/inc/class.uireg.inc.php
trunk/registration/main.php
trunk/registration/templates/base/config.tpl
trunk/registration/templates/base/loginid_select.tpl
trunk/registration/templates/base/personal_info.tpl
Modified: trunk/registration/inc/class.boreg.inc.php
===================================================================
--- trunk/registration/inc/class.boreg.inc.php 2012-05-15 11:47:15 UTC (rev
9404)
+++ trunk/registration/inc/class.boreg.inc.php 2012-05-15 13:09:40 UTC (rev
9405)
@@ -50,12 +50,12 @@
$so = createobject('registration.soreg');
- if (! $r_reg['loginid'])
+ if (! $r_reg['loginid'] &&
!$this->config['username_is'] == 'email')
{
$errors[] = lang('You must enter a username');
}
- if (! is_array($errors) &&
$so->account_exists($r_reg['loginid']))
+ if (! is_array($errors) && $r_reg['loginid'] &&
$so->account_exists($r_reg['loginid']))
{
$errors[] = lang('Sorry, that username is
already taken.');
}
@@ -67,13 +67,31 @@
}
else
{
-
$GLOBALS['phpgw']->session->appsession('loginid','registration',$r_reg['loginid']);
+ if(!$this->config['username_is'] == 'email')
+ {
+
$GLOBALS['phpgw']->session->appsession('loginid','registration',$r_reg['loginid']);
+ }
$ui->step2();
}
}
function step2()
{
+
+ if($this->config['username_is'] == 'email')
+ {
+ $this->fields['loginid'] = array
+ (
+ 'field_name' => 'loginid',
+ 'field_text' => lang('username'),
+ 'field_type' => 'email',
+ 'field_values' =>'',
+ 'field_required' => 'Y',
+ 'field_order' => 1
+ );
+ }
+
+ $ui = createobject('registration.uireg');
if(!$r_reg = phpgw::get_var('r_reg'))
{
$r_reg = array();
@@ -223,7 +241,7 @@
$reg_id = $so->step2($fields);
}
- $ui = createobject('registration.uireg');
+
if (is_array($errors))
{
$ui->step2($errors,$r_reg,$o_reg,$missing_fields);
Modified: trunk/registration/inc/class.menu.inc.php
===================================================================
--- trunk/registration/inc/class.menu.inc.php 2012-05-15 11:47:15 UTC (rev
9404)
+++ trunk/registration/inc/class.menu.inc.php 2012-05-15 13:09:40 UTC (rev
9405)
@@ -40,7 +40,7 @@
'url' =>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'registration.uipending.index')),
'text' => lang('registration'),
'image' => array('admin',
'navbar'),
- 'order' => -6,
+ 'order' => -4,
'group' => 'systools'
),
);
Modified: trunk/registration/inc/class.uireg.inc.php
===================================================================
--- trunk/registration/inc/class.uireg.inc.php 2012-05-15 11:47:15 UTC (rev
9404)
+++ trunk/registration/inc/class.uireg.inc.php 2012-05-15 13:09:40 UTC (rev
9405)
@@ -99,19 +99,37 @@
$this->template->set_var('lang_username',lang('Username'));
$this->template->set_var('lang_submit',lang('Submit'));
+ $var = $this->get_username_fields();
+ $this->template->set_var($var);
+ $this->template->pfp('out','form');
+
+ $this->footer();
+ }
+
+
+ function get_username_fields()
+ {
+ $values = array();
if(
$GLOBALS['phpgw_info']['server']['domain_from_host']
&&
!$GLOBALS['phpgw_info']['server']['show_domain_selectbox'] )
{
- $this->template->set_var(
- array(
- 'domain_selects'
=> '',
- 'logindomain'
=> $_SERVER['SERVER_NAME']
- )
- );
- $this->template->parse('domain_from_hosts',
'domain_from_host');
+ $values = array
+ (
+ 'domain_select' => '',
+ 'domain_from_host' => "<input type
= 'hidden' name='logindomain' id='logindomain' value
='{$_SERVER['SERVER_NAME']}' />"
+ );
}
elseif(
$GLOBALS['phpgw_info']['server']['show_domain_selectbox'] )
{
+
+ $lang_domain = lang('domain');
+ $domain_select = <<<HTML
+ <td>{$lang_domain}</td>
+ <td>
+ <select name="logindomain" id="logindomain"
class="inputbox">
+HTML;
+
+
$options = '';
foreach($GLOBALS['_phpgw_domain'] as
$domain_name => $domain_vars)
{
@@ -127,32 +145,30 @@
HTML;
}
- $this->template->set_var('domain_options',
$options);
+ $domain_select .= <<<HTML
+ {$options}
+ </select>
+ </td>
+HTML;
- $this->template->set_var(
- array(
- 'domain_from_hosts'
=> '',
- 'lang_domain'
=> lang('domain')
- )
- );
+ $values = array
+ (
+ 'domain_select' => $domain_select,
+ 'domain_from_host' => ''
+ );
}
else
{
- $this->template->set_var(
- array(
- 'domain_selects'
=> '',
- 'domain_from_hosts'
=> ''
- )
- );
-
+ $values = array
+ (
+ 'domain_select' => '',
+ 'domain_from_host' => ''
+ );
}
-
- $this->template->pfp('out','form');
-
- $this->footer();
+ return $values;
}
- function step2($errors = '',$r_reg = '',$o_reg =
'',$missing_fields='')
+ function step2($errors = array(),$r_reg = '',$o_reg =
'',$missing_fields='')
{
phpgwapi_jquery::load_widget('core');
$GLOBALS['phpgw']->js->validate_file('portico', 'ajax',
'registration');
@@ -174,11 +190,6 @@
));
$this->template->set_block('_personal_info','form');
- if ($errors)
- {
-
$this->template->set_var('errors',$GLOBALS['phpgw']->common->error_list($errors));
- }
-
$tpl_vars = array
(
'css' =>
$GLOBALS['phpgw']->common->get_css(),
@@ -215,11 +226,40 @@
}
}
+//----
+ if($this->config['username_is'] == 'email')
+ {
+
+ $username_fields = $this->get_username_fields();
+ $username_fields['lang_username'] = '<b>' .
lang('username') . '</b>';
+ $username_fields['value_username'] =
'test';//$loginid;
+
+// $missing['loginid'] = true;
+// $username_fields['missing_loginid'] =
'<font color="#CC0000">*</font>';
+// $username_fields['value_username'] =
'test';//$loginid;
+// $errors[] = lang('you must enter a
username');
+
+ $this->template->set_var($username_fields);
+ }
+ else
+ {
+ $this->template->set_block ('form', 'username',
'empty');
+ }
+//-------
+
+ if ($errors)
+ {
+
$this->template->set_var('errors',$GLOBALS['phpgw']->common->error_list($errors));
+ }
+
$this->template->set_var('form_action',$GLOBALS['phpgw']->link('/registration/main.php',array('menuaction'=>'registration.boreg.step2','logindomain'
=> $_REQUEST['logindomain'])));
$this->template->set_var('lang_password',lang('Password'));
$this->template->set_var('lang_reenter_password',lang('Re-enter password'));
$this->template->set_var('lang_submit',lang('Submit'));
+
+
+
if (!$show_password_prompt)
{
$this->template->set_block ('form', 'password',
'empty');
Modified: trunk/registration/main.php
===================================================================
--- trunk/registration/main.php 2012-05-15 11:47:15 UTC (rev 9404)
+++ trunk/registration/main.php 2012-05-15 13:09:40 UTC (rev 9405)
@@ -84,13 +84,14 @@
include(PHPGW_API_INC.'/functions.inc.php');
+ $c = createobject('phpgwapi.config','registration');
+ $c->read();
+ $config = $c->config_data;
+
// Make sure we're always logged in
if (!phpgw::get_var(session_name()) ||
!$GLOBALS['phpgw']->session->verify())
{
- $c = createobject('phpgwapi.config','registration');
- $c->read();
- $config = $c->config_data;
//_debug_array($config);die();
$login = $c->config_data['anonymous_user'];
@@ -229,8 +230,16 @@
else
{
$app = 'registration';
- $class = 'uireg';
- $method = 'step1';
+ if($config['username_is'] != 'email')
+ {
+ $class = 'uireg';
+ $method = 'step1';
+ }
+ else
+ {
+ $class = 'boreg';
+ $method = 'step1';
+ }
}
$GLOBALS[$class] = CreateObject("{$app}.{$class}");
Modified: trunk/registration/templates/base/config.tpl
===================================================================
--- trunk/registration/templates/base/config.tpl 2012-05-15 11:47:15 UTC
(rev 9404)
+++ trunk/registration/templates/base/config.tpl 2012-05-15 13:09:40 UTC
(rev 9405)
@@ -60,6 +60,7 @@
<td>
<select name="newsettings[username_is]">
<option
value="choice"{selected_username_is_choice}>{lang_Users_Choice}</option>
+ <option
value="email"{selected_username_is_email}>{lang_email_address}</option>
<option
value="http"{selected_username_is_http}>{lang_HTTP_Username}</option>
</select>
</td>
Modified: trunk/registration/templates/base/loginid_select.tpl
===================================================================
--- trunk/registration/templates/base/loginid_select.tpl 2012-05-15
11:47:15 UTC (rev 9404)
+++ trunk/registration/templates/base/loginid_select.tpl 2012-05-15
13:09:40 UTC (rev 9405)
@@ -4,17 +4,13 @@
<!-- BEGIN input -->
<form action="{form_action}" method="POST">
<table border="0" width="40%" align="center">
- <tr >
- <td>{lang_domain}</td>
- <td>
- <select name="logindomain" id="logindomain"
class="inputbox">
- {domain_options}
- </select>
- </td>
- </tr>
+
<tr>
+ {domain_select}
+ </tr>
+ <tr>
<td>{lang_username}</td>
- <td><input name="r_reg[loginid]" value="{value_username}"></td>
+ <td>{domain_from_host}<input name="r_reg[loginid]"
value="{value_username}"></td>
</tr>
<tr>
Modified: trunk/registration/templates/base/personal_info.tpl
===================================================================
--- trunk/registration/templates/base/personal_info.tpl 2012-05-15 11:47:15 UTC
(rev 9404)
+++ trunk/registration/templates/base/personal_info.tpl 2012-05-15 13:09:40 UTC
(rev 9405)
@@ -45,6 +45,20 @@
<center>{errors}</center>
<form action="{form_action}" method="POST">
<table border="0" width="75%" align="center">
+
+<!-- BEGIN username -->
+ <tr>
+ <td width="1%"></td>
+ {domain_select}
+ </tr>
+ <tr>
+ <td width="1%">{missing_loginid}</td>
+ <td>{lang_username}</td>
+ <td>{domain_from_host}<input name="r_reg[loginid]"
value="{value_username}"></td>
+ </tr>
+<!-- END username -->
+
+
<!-- BEGIN password -->
<tr>
<td width="1%">{missing_passwd}</td>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [9405] registration: alternative reg,
Sigurd Nes <=