10 $serviceShowInfo =
true;
11 $serviceLoadMenu =
true;
12 $serviceShowMenu =
true;
15 require_once(dirname(__FILE__) .
'/../library/hcuService.i');
21 PermCheckFeatureScreen($dbh, $HB_ENV, $MC, FEATURE_BASIC);
25 $HB_ENV[
"HCUPOST"]= array(
"action" =>
"");
26 HCU_ImportVars($HB_ENV,
'HCUPOST', array(
"action" =>
"string"));
28 if ($HB_ENV[
"HCUPOST"][
"action"] ==
"test_alias" ) {
29 header(
'Content-Type: application/json');
32 $userAlias = trim($_POST[
"alias"]);
35 $aryReply = array(
"result" => FALSE,
"message" => $MC->msg(
"Error" , HCU_DISPLAY_AS_JS) );
38 if ( strlen( $userAlias ) >= 0 && strlen( $userAlias ) < 6 ) {
39 $aryReply = array(
"result" => FALSE,
"message" => $MC->msg(
'Username too short', HCU_DISPLAY_AS_JS) );
40 }
else if ( strlen( $userAlias ) > 5 && !check_alias_format( $userAlias ) ) {
42 $aryReply = array(
"result" => FALSE,
"message" => $MC->msg(
'Username appears invalid', HCU_DISPLAY_AS_JS) );
43 }
else if ( check_alias_available( $dbh, $HB_ENV, $userAlias ) ) {
44 $aryReply = array(
"result" => TRUE,
"message" => $MC->msg(
"Available", HCU_DISPLAY_AS_JS) );
46 $aryReply = array(
"result" => FALSE,
"message" => $MC->msg(
"Username not available" , HCU_DISPLAY_AS_JS) );
49 print HCU_JsonEncode($aryReply);
60 require_once(dirname(__FILE__) .
'/../includes/hcuPreContent.i');
66 $maymust=(($HB_ENV[
"Fset2"] & $CU2_ALIAS_REQ) == $CU2_ALIAS_REQ ? $MC->msg(
'must', HCU_DISPLAY_AS_HTML) : $MC->msg(
'may', HCU_DISPLAY_AS_HTML));
72 <script type=
"text/javascript">
74 $(document).ready(
function() {
75 dsProfileAlias =
new kendo.data.DataSource({
81 url:
"hcuProfile.data?cu=<?php echo $HB_ENV["cu
"] ?>",
83 contentType:
"application/x-www-form-urlencoded",
93 parse:
function(response) {
99 requestStart:
function(e) {
101 kendo.ui.progress($(
"#profile"),
true);
103 requestEnd:
function(e) {
109 kendo.ui.progress($(
"#profile"),
false);
112 if ( e.response && e.response.homecuErrors )
113 error = e.response.homecuErrors;
115 if ( error && error.length > 0 ) {
118 this.cancelChanges();
120 $.homecuValidator.displayMessage(error, $.homecuValidator.settings.statusError);
122 if ( e.response && e.response.homecuInfo && (e.response.homecuInfo.message.length > 0) ) {
123 ShowStatus( e.response.homecuInfo.message );
127 if ( e.response.homecuData &&
128 e.response.homecuData.homecuKey &&
129 (e.response.homecuData.homecuKey.length > 0) ) {
130 var appInfo = JSON.stringify( { deviceKey: e.response.homecuData.homecuKey,
131 newUsername: $(
"#profileAlias1").val() } );
133 <?php
if ( $HB_ENV[
"platform"] ==
"ADA" ) : ?>
134 AndroidController.notifyCommand(
"NEW_DEVICE_KEY", appInfo);
135 <?php elseif ( $HB_ENV[
"platform"] ==
"APP" ) : ?>
138 cmd:
"NEW_DEVICE_KEY",
142 window.webkit.messageHandlers.interOp.postMessage(postObject);
147 $(
"#profilePasswordCurr").val(
"");
148 $(
"#profileAlias2").val(
"");
155 function ShowStatus( statusMessage ) {
156 $.homecuValidator.settings.formStatusField =
"formStatus";
157 $.homecuValidator.settings.formInfoTitle =
"";
158 $.homecuValidator.displayMessage(statusMessage);
161 function ClearStatus( ) {
162 $.homecuValidator.settings.formStatusField =
"formStatus";
163 $.homecuValidator.settings.formInfoTitle =
"";
164 $.homecuValidator.displayMessage(
null);
167 $(
"#btnUpdate").click(
function() {
168 if ( $.homecuValidator.validate() ) {
171 old: $(
"#profilePasswordCurr").val(),
172 user_alias: $.trim($(
"#profileAlias1").val()),
173 user_alias2: $.trim($(
"#profileAlias2").val())
177 dsProfileAlias.data([{id: 0}]);
178 dsProfileAlias.data()[0].dirty =
true;
181 dsProfileAlias.transport.options.update.data = request;
182 dsProfileAlias.sync();
187 $.homecuValidator.setup({
188 formValidate:
"formProfile",
189 formErrorTitle:
"<?php echo $MC->msg("Error Occurred
", HCU_DISPLAY_AS_JS) ?>"});
192 reenterTip:
"<?php echo $MC->msg("Tip Re-enter Password
", HCU_DISPLAY_AS_JS); ?>",
193 aliasTip1:
"<?php echo $MC->combo_msg('Username Set',HCU_DISPLAY_AS_JS,'#MAYMUST#',"$maymust
"); ?>",
194 aliasTip2:
"<?php echo $MC->msg("Username again to confirm
", HCU_DISPLAY_AS_JS); ?>" 197 $(
'#testAlias').click(
function() {
198 var userAlias = $.trim($(
"#profileAlias1").val());
201 $(
this).prop(
"disabled",
"disabled");
202 $(
"#testAliasResult").html(
"" );
203 $(
"#testAliasResult").css(
"display",
"inline" );
206 var parameters = {
"action":
"test_alias",
207 "alias": userAlias };
209 url:
"<?php echo $HB_ENV['loginpath'] . "/
" . $HB_ENV['currentscript'] . "?
" . $HB_ENV['cuquery']; ?>",
213 .done(
function( data, textStatus, jqXHR ) {
217 message =
"<i class='fa fa-check-circle fa-2x' style='color:green;'></i>";
218 $.homecuValidator.hideMessage();
220 message =
"<i class='fa fa-ban fa-2x' style='color:red;'></i>";
221 $.homecuValidator.displayMessage(data.message, $.homecuValidator.settings.statusError);
224 $(
"#testAliasResult").html( message );
226 .fail(
function(jqXHR, textStatus, errorThrown) {
227 $(
"#testAliasResult").html(
"<?php echo $MC->msg( "Error
" , HCU_DISPLAY_AS_HTML); ?>" );
228 $(
"#testAliasResult").css(
"color",
"red");
230 .always(
function(jqXHR, textStatus, errorThrown) {
231 $(
"#testAlias").removeProp(
"disabled");
232 $(
"#testAliasResult").delay(5000).fadeOut(100);
241 <!-- STYLE CONTENT -->
242 <style type=
"text/css">
243 .hcuProfileAliasDiv {
250 .k-block > .k-header {
255 .hcu-info-margin, .hcu-error-margin {
259 .hcu-info-padding, .hcu-error-padding {
268 .hcu-container-margin {
276 <!-- HTML CONTENT -->
277 <div
class=
"container-fluid hcuProfileAliasDiv">
278 <div
class=
"well well-sm">
282 <h3><?php echo $MC->msg(
'Username', HCU_DISPLAY_AS_HTML); ?></h3>
285 <!-- FORM CONTENT -->
286 <form
id=
'formProfile' name=
'formProfile'>
288 <div
class=
"col-xs-12 col-sm-6 hcu-container-margin">
289 <label
for=
"profilePasswordCurr">
290 <span><?php echo $MC->msg(
'Re-enter Password', HCU_DISPLAY_AS_HTML); ?>: </span>
291 <span
class=
"fa fa-question-circle-o" id=
"reenterTip"></span>
294 <input type=
"password" name=
"profilePasswordCurr" 295 id=
"profilePasswordCurr" 296 class=
"k-textbox hcu-full-width" 297 placeholder=
"<?php echo $MC->msg('Re-enter Password', HCU_DISPLAY_AS_HTML); ?>" 298 data-required-msg=
"<?php echo $MC->msg('Invalid login or password', HCU_DISPLAY_AS_HTML) ?>" 304 <div
class=
"col-xs-12 col-sm-6 hcu-container-margin">
305 <label
for=
"profileAlias1">
306 <span><?php echo $MC->msg(
'Username', HCU_DISPLAY_AS_HTML); ?>: </span>
307 <span
class=
"fa fa-question-circle-o" id=
"aliasTip1"></span>
310 <input type=
"text" name=
"profileAlias1" 312 class=
"k-textbox hcu-full-width must_equal" 313 placeholder=
"<?php echo $MC->msg('Username', HCU_DISPLAY_AS_HTML); ?>" 314 value=
"<?php echo $Cn; ?>" 316 data-required-msg=
"<?php echo $MC->msg('Username Required', HCU_DISPLAY_AS_HTML) ?>" 317 data-homecuCustomMinLen-msg=
"<?php echo $MC->msg('Username too short', HCU_DISPLAY_AS_HTML) ?>" 321 <div
class=
"col-xs-12 col-sm-6 hcu-container-margin">
322 <label
for=
"profileAlias2">
323 <span><?php echo $MC->msg(
'Confirm Username', HCU_DISPLAY_AS_HTML); ?>: </span>
324 <span
class=
"fa fa-question-circle-o" id=
"aliasTip2"></span>
327 <input type=
"text" name=
"profileAlias2" 329 class=
"k-textbox hcu-full-width must_equal" 331 homecu-equals=
"must_equal" 332 placeholder=
"<?php echo $MC->msg('Confirm Username', HCU_DISPLAY_AS_HTML); ?>" 333 data-required-msg=
"<?php echo $MC->msg('Username Required', HCU_DISPLAY_AS_HTML) ?>" 334 data-homecuCustomMinLen-msg=
"<?php echo $MC->msg('Username too short', HCU_DISPLAY_AS_HTML) ?>" 340 <div
class=
"col-xs-12 col-sm-6 hcu-container-margin">
341 <div
class=
"col-xs-10 hcu-no-padding"><a
id=
'testAlias' class=
'k-button'><?php echo $MC->msg(
"Test Username", HCU_DISPLAY_AS_HTML); ?></a></div>
342 <div
class=
"col-xs-2 hcu-no-padding"><span
id=
'testAliasResult'> </span></div>
348 <div
class=
"hcu-template">
349 <div
class=
"hcu-edit-buttons k-state-default">
351 <a href=
"##" id=
"btnUpdate" class=
"k-button k-primary">
352 <i
class=
"fa fa-check fa-lg"></i><?php echo $MC->msg(
"Update", HCU_DISPLAY_AS_HTML); ?>
365 require_once(dirname(__FILE__) .
'/../includes/hcuPostContent.i');