From c165f0825acb52c6ee68ff7628d8c0af259d9e6a Mon Sep 17 00:00:00 2001 From: Go Frendi Gunawan Date: Mon, 24 Oct 2016 08:20:09 +0700 Subject: [PATCH] fix up things --- application/helpers/cms_helper.php | 47 ++++++ modules/installer/models/Install_model.php | 2 +- modules/main/views/main_change_profile.php | 173 ++++++++------------- modules/main/views/main_register.php | 59 ++----- modules/multisite/views/register.php | 150 +++++------------- readme.md | 2 +- 6 files changed, 166 insertions(+), 267 deletions(-) diff --git a/application/helpers/cms_helper.php b/application/helpers/cms_helper.php index 7fea7f09..6202de7b 100755 --- a/application/helpers/cms_helper.php +++ b/application/helpers/cms_helper.php @@ -605,3 +605,50 @@ function parse_record($record, $config=array()){ $replace[] = $backend_urls; return str_replace($search, $replace, $record_template); } + +function create_labeled_form_input($id, $label, $input_html){ + $input_html = str_replace('{{ id }}', $id, $input_html); + $html = ''; + $html .= '
'; + $html .= form_label($label, $id, array('class' => 'control-label col-sm-4')); + $html .= '
'; + $html .= $input_html; + $html .= '
'; + $html .= '
'; + return $html; +} + +function build_register_input($secret_code, $user_name, $email, $real_name){ + $html = ''; + + $id = $secret_code.'user_name'; + $input_html = form_input($id, $user_name, + 'id="{{ id }}" placeholder="User Name" class="form-control"'); + $html .= create_labeled_form_input($id, '{{ language:User Name }}', $input_html); + + $id = $secret_code.'real_name'; + $input_html = form_input($id, $real_name, + 'id="{{ id }}" placeholder="Real Name" class="form-control"'); + $html .= create_labeled_form_input($id, '{{ language:Real Name }}', $input_html); + + $id = $secret_code.'email'; + $input_html = form_input($id, $email, + 'id="{{ id }}" placeholder="Email" class="form-control"'); + $html .= create_labeled_form_input($id, '{{ language:Email }}', $input_html); + + + $id = $secret_code.'password'; + $input_html = form_password($id, '', + 'id="{{ id }}" placeholder="Password" class="form-control"'); + $html .= create_labeled_form_input($id, '{{ language:Password }}', $input_html); + + // spacer + $html .= '
 
'; + + $id = $secret_code.'confirm_password'; + $input_html = form_password($id, '', + 'id="{{ id }}" placeholder="Password (again)" class="form-control"'); + $html .= create_labeled_form_input($id, '{{ language:Confirm Password }}', $input_html); + + return $html; +} diff --git a/modules/installer/models/Install_model.php b/modules/installer/models/Install_model.php index a72ecdb2..d462dc99 100755 --- a/modules/installer/models/Install_model.php +++ b/modules/installer/models/Install_model.php @@ -1043,7 +1043,7 @@ protected function insert_all_data($config=NULL){ array('main_register', NULL, 'Register', 'Register', NULL, 'New User Registration', 'main/register', 2, 7, 1, 0, NULL, 0, NULL, NULL, 'default-one-column'), array('main_change_profile', NULL, 'Change Profile', 'Change Profile', NULL, 'Change Current Profile', 'main/change_profile', - 3, 8, 1, 0, NULL, 0), + 3, 8, 1, 0, NULL, 0, NULL, NULL, 'default-one-column'), array('main_group_management', 4, 'Group Management', 'Group Management', NULL, 'Group Management', 'main/manage_group', 4, 0, 1, 0, NULL, 0, NULL, NULL, 'default-one-column'), array('main_user_management', 4, 'User Management', 'User Management', NULL, 'Manage User', 'main/manage_user', diff --git a/modules/main/views/main_change_profile.php b/modules/main/views/main_change_profile.php index c58a9d41..591f47e4 100755 --- a/modules/main/views/main_change_profile.php +++ b/modules/main/views/main_change_profile.php @@ -6,9 +6,9 @@ echo $asset->compile_css(); ?>

{{ language:Change Profile }}

'; - echo form_label('{{ language:Profile Picture }}', ' for="" class="control-label col-sm-4'); - echo '
'; + $input = ''; if(trim($profile_picture) != ''){ - echo ''; + $input .= ''; } - echo ''; - echo '
'; - echo ''; + $input .= ''; + echo create_labeled_form_input('profile_picture', '{{ language:Profile Picture }}', $input); - echo '
'; - echo form_label('{{ language:User Name }}', ' for="" class="control-label col-sm-4'); - echo '
'; - echo $user_name; - echo '
'; - echo '
'; + echo create_labeled_form_input('user_name', '{{ language:User Name }}', $user_name); - echo '
'; - echo form_label('{{ language:Email }}', ' for="" class="control-label col-sm-4'); - echo '
'; - echo form_input('email', $email, + $input = form_input('email', $email, 'id="email" placeholder="Email" class="form-control"'); - echo '
'; - echo '
'; + echo create_labeled_form_input('email', '{{ language:Email }}', $input); - echo '
'; - echo form_label('{{ language:Real Name }}', ' for="" class="control-label col-sm-4'); - echo '
'; - echo form_input('real_name', $real_name, + $input = form_input('real_name', $real_name, 'id="real_name" placeholder="Real Name" class="form-control"'); - echo '
'; - echo '
'; + echo create_labeled_form_input('real_name', '{{ language:Real Name }}', $input); - echo '
'; - echo form_label('{{ language:Birthdate }}', ' for="" class="control-label col-sm-4'); - echo '
'; - echo form_input('birthdate', $birthdate, + $input = form_input('birthdate', $birthdate, 'id="birthdate" placeholder="Birthdate" class="form-control datepicker-input"'); - echo '
'; - echo '
'; + echo create_labeled_form_input('birthdate', '{{ language:Birthdate }}', $input); - echo '
'; - echo form_label('{{ language:Sex }}', ' for="" class="control-label col-sm-4'); - echo '
'; $options = array('' => '{{ language:Not Set }}', 'male' => '{{ language:Male }}', 'female' => '{{ language:Female }}'); - echo ''; foreach($options as $key=>$val){ $selected = ''; if($key == $sex){ $selected = 'selected'; } - echo ''; + $input .= ''; } - echo ''; - echo '
'; - echo '
'; + $input .= ''; + echo create_labeled_form_input('sex', '{{ language:Sex }}', $input); - echo '
'; - echo form_label('{{ language:Language }}', ' for="" class="control-label col-sm-4'); - echo '
'; - echo ''; + $input .= ''; foreach($language_list as $language_option){ $selected = ''; if($language_option->code == $language){ $selected = 'selected'; } - echo ''; + $input .= ''; } - echo ''; - echo '
'; - echo '
'; + $input .= ''; + echo create_labeled_form_input('language', '{{ language:Language }}', $input); - echo '
'; - echo form_label('{{ language:Theme }}', ' for="" class="control-label col-sm-4'); - echo '
'; - echo ''; + $input .= ''; foreach($theme_list as $theme_option){ $selected = ''; if($theme_option['path'] == $theme){ $selected = 'selected'; } - echo ''; + $input .= ''; } - echo ''; - echo '
'; - echo '
'; + $input .= ''; + echo create_labeled_form_input('theme', '{{ language:Theme }}', $input); - echo '
'; - echo form_label('{{ language:Self Description }}', ' for="" class="control-label col-sm-4'); - echo '
'; - echo form_textarea('self_description', $self_description, + $input = form_textarea('self_description', $self_description, 'id="self_description" placeholder="Self Description" class="form-control"'); - echo '
'; - echo '
'; + echo create_labeled_form_input('self_description', '{{ language:Self Description }}', $input); echo $additional_input; - echo '
'; - echo '
'; - echo form_checkbox('change_password','True',FALSE); - echo form_label('{{ language:Change Password }}', ' for="" class="control-label'); - echo '
'; - echo '
'; + $input = form_checkbox('change_password','True',FALSE, 'id="change_password"'); + $input .= form_label('{{ language:Change Password }}', 'change_password', 'class="control-label'); + echo create_labeled_form_input('change_password', '', $input); - echo '
'; - echo form_label('{{ language:Password }}', ' for="" class="control-label col-sm-4'); - echo '
'; - echo form_password('password', '', - 'id="password" placeholder="Password" class="form-control"'); - echo '
'; - echo '
'; + echo '
'; + $input = form_password('password', '', + 'id="password" placeholder="Password" class="form-control"'); + echo create_labeled_form_input('password', '{{ language:Password }}', $input); - echo '
'; - echo form_label('{{ language:Confirm Password }}', ' for="" class="control-label col-sm-4'); - echo '
'; - echo form_password('confirm_password', '', - 'id="confirm_password" placeholder="Password (again)" class="form-control"'); - echo '
'; + $input = form_password('confirm_password', '', + 'id="confirm_password" placeholder="Password (again)" class="form-control"'); + echo create_labeled_form_input('confirm_password', '{{ language:Confirm Password }}', $input); echo '
'; echo '
'; diff --git a/modules/main/views/main_register.php b/modules/main/views/main_register.php index 06f03117..5e053231 100755 --- a/modules/main/views/main_register.php +++ b/modules/main/views/main_register.php @@ -8,8 +8,8 @@ }