issue 2079 added the name of extra variables in a member information modify page and a signup page.

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.3.2@11011 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
devjin 2012-08-09 06:35:40 +00:00
parent acbad1b6d9
commit e62403ab10
2 changed files with 60 additions and 0 deletions

View file

@ -548,6 +548,35 @@
return $this->join_form_list;
}
/**
* get used join form list.
*
* @return array $joinFormList
**/
function getUsedJoinFormList()
{
$args->sort_index = "list_order";
$output = executeQueryArray('member.getJoinFormList', $args);
if(!$output->toBool())
{
return array();
}
$joinFormList = array();
foreach($output->data as $val)
{
if($val->is_active != 'Y')
{
continue;
}
$joinFormList[] = $val;
}
return $joinFormList;
}
/**
* @brief Combine extend join form and member information (used to modify member information)
**/

View file

@ -106,6 +106,8 @@
$identifierForm->value = $member_info->{$member_config->identifier};
Context::set('identifierForm', $identifierForm);
$this->addExtraFormValidatorMessage();
// Set a template file
$this->setTemplateFile('signup_form');
}
@ -157,6 +159,9 @@
$identifierForm->name = $member_config->identifier;
$identifierForm->value = $member_info->{$member_config->identifier};
Context::set('identifierForm', $identifierForm);
$this->addExtraFormValidatorMessage();
// Set a template file
$this->setTemplateFile('modify_info');
}
@ -404,5 +409,31 @@
$this->setTemplateFile('modify_email_address');
}
/**
* Add javascript codes into the header by checking values of member join form, required and others
* @return void
*/
function addExtraFormValidatorMessage() {
$oMemberModel = &getModel('member');
$extraList = $oMemberModel->getUsedJoinFormList();
$js_code = array();
$js_code[] = '<script type="text/javascript">//<![CDATA[';
$js_code[] = '(function($){';
$js_code[] = 'var validator = xe.getApp("validator")[0];';
$js_code[] = 'if(!validator) return false;';
foreach($extraList as $val)
{
$js_code[] = sprintf('validator.cast("ADD_MESSAGE", ["%s","%s"]);', $val->column_name, $val->column_title);
}
$js_code[] = '})(jQuery);';
$js_code[] = '//]]></script>';
$js_code = implode("\n", $js_code);
Context::addHtmlHeader($js_code);
}
}
?>