New UI for edit the user profile
This commit is contained in:
parent
3b33d20cf6
commit
3510fa6e30
|
@ -15,3 +15,5 @@ bl-themes/mediumish
|
||||||
bl-themes/clean-blog
|
bl-themes/clean-blog
|
||||||
bl-themes/grayscale
|
bl-themes/grayscale
|
||||||
bl-themes/massively
|
bl-themes/massively
|
||||||
|
bl-themes/hyperspace
|
||||||
|
bl-themes/striped
|
||||||
|
|
|
@ -0,0 +1,277 @@
|
||||||
|
<?php defined('BLUDIT') or die('Bludit CMS.');
|
||||||
|
|
||||||
|
echo Bootstrap::formOpen(array());
|
||||||
|
|
||||||
|
echo '
|
||||||
|
<div>
|
||||||
|
<div class="float-right">
|
||||||
|
<button type="submit" class="btn btn-primary btn-sm" name="save">'.$L->g('Save').'</button>
|
||||||
|
<a class="btn btn-secondary btn-sm" href="'.HTML_PATH_ADMIN_ROOT.'users" role="button">'.$L->g('Cancel').'</a>
|
||||||
|
</div>
|
||||||
|
<h2 class="mt-0 mb-3">
|
||||||
|
<span class="oi oi-person" style="font-size: 0.7em;"></span> '.$L->g('Edit user').'
|
||||||
|
</h2>
|
||||||
|
</div>
|
||||||
|
';
|
||||||
|
|
||||||
|
echo Bootstrap::formInputHidden(array(
|
||||||
|
'name'=>'tokenCSRF',
|
||||||
|
'value'=>$security->getTokenCSRF()
|
||||||
|
));
|
||||||
|
|
||||||
|
echo Bootstrap::formInputHidden(array(
|
||||||
|
'name'=>'username',
|
||||||
|
'value'=>$user->username()
|
||||||
|
));
|
||||||
|
|
||||||
|
echo Bootstrap::formInputText(array(
|
||||||
|
'name'=>'usernameDisabled',
|
||||||
|
'label'=>$L->g('Username'),
|
||||||
|
'value'=>$user->username(),
|
||||||
|
'class'=>'',
|
||||||
|
'placeholder'=>'',
|
||||||
|
'disabled'=>true,
|
||||||
|
'tip'=>''
|
||||||
|
));
|
||||||
|
|
||||||
|
if ($login->role()==='admin') {
|
||||||
|
echo Bootstrap::formSelect(array(
|
||||||
|
'name'=>'role',
|
||||||
|
'label'=>$L->g('Role'),
|
||||||
|
'options'=>array('editor'=>$L->g('Editor'), 'admin'=>$L->g('Administrator')),
|
||||||
|
'selected'=>$user->role(),
|
||||||
|
'class'=>'',
|
||||||
|
'tip'=>''
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
echo Bootstrap::formInputText(array(
|
||||||
|
'name'=>'email',
|
||||||
|
'label'=>$L->g('Email'),
|
||||||
|
'value'=>$user->email(),
|
||||||
|
'class'=>'',
|
||||||
|
'placeholder'=>'',
|
||||||
|
'tip'=>''
|
||||||
|
));
|
||||||
|
|
||||||
|
echo Bootstrap::formTitle(array('title'=>$L->g('Profile')));
|
||||||
|
|
||||||
|
echo Bootstrap::formInputText(array(
|
||||||
|
'name'=>'nickname',
|
||||||
|
'label'=>$L->g('Nickname'),
|
||||||
|
'value'=>$user->nickname(),
|
||||||
|
'class'=>'',
|
||||||
|
'placeholder'=>'',
|
||||||
|
'tip'=>$L->g('The nickname is almost used in the themes to display the author of the content')
|
||||||
|
));
|
||||||
|
|
||||||
|
echo Bootstrap::formInputText(array(
|
||||||
|
'name'=>'firstName',
|
||||||
|
'label'=>$L->g('First Name'),
|
||||||
|
'value'=>$user->firstName(),
|
||||||
|
'class'=>'',
|
||||||
|
'placeholder'=>'',
|
||||||
|
'tip'=>''
|
||||||
|
));
|
||||||
|
|
||||||
|
echo Bootstrap::formInputText(array(
|
||||||
|
'name'=>'lastName',
|
||||||
|
'label'=>$L->g('Last Name'),
|
||||||
|
'value'=>$user->lastName(),
|
||||||
|
'class'=>'',
|
||||||
|
'placeholder'=>'',
|
||||||
|
'tip'=>''
|
||||||
|
));
|
||||||
|
|
||||||
|
echo Bootstrap::formTitle(array('title'=>$L->g('Password')));
|
||||||
|
|
||||||
|
echo '
|
||||||
|
<div class="form-group row">
|
||||||
|
<div class="col-sm-2"></div>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<a href="'.HTML_PATH_ADMIN_ROOT.'user-password/'.$user->username().'" class="btn btn-primary mr-2">'.$L->g('Change password').'</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
';
|
||||||
|
|
||||||
|
echo Bootstrap::formTitle(array('title'=>$L->g('Authentication Token')));
|
||||||
|
|
||||||
|
echo Bootstrap::formInputText(array(
|
||||||
|
'name'=>'tokenAuth',
|
||||||
|
'label'=>$L->g('Token'),
|
||||||
|
'value'=>$user->tokenAuth(),
|
||||||
|
'class'=>'',
|
||||||
|
'tip'=>$L->g('this-token-is-similar-to-a-password-it-should-not-be-shared')
|
||||||
|
));
|
||||||
|
|
||||||
|
echo Bootstrap::formTitle(array('title'=>$L->g('Status')));
|
||||||
|
|
||||||
|
echo Bootstrap::formInputText(array(
|
||||||
|
'name'=>'status',
|
||||||
|
'label'=>$L->g('Current status'),
|
||||||
|
'value'=>$user->enabled()?$L->g('Enabled'):$L->g('Disabled'),
|
||||||
|
'class'=>'',
|
||||||
|
'disabled'=>true,
|
||||||
|
'tip'=>$user->enabled()?'':$L->g('To enable the user you must set a new password')
|
||||||
|
));
|
||||||
|
|
||||||
|
if ($user->enabled()) {
|
||||||
|
echo '
|
||||||
|
<div class="form-group row">
|
||||||
|
<div class="col-sm-2"></div>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<button type="submit" class="btn btn-primary mr-2" id="jsdisableUser" name="disableUser">'.$L->g('Disable user').'</button>
|
||||||
|
<button type="submit" class="btn btn-danger mr-2" id="jsdeleteUserAndKeepContent" name="deleteUserAndKeepContent">'.$L->g('Delete user and keep content').'</button>
|
||||||
|
<button type="submit" class="btn btn-danger mr-2" id="jsdeleteUserAndDeleteContent" name="deleteUserAndDeleteContent">'.$L->g('Delete user and delete content').'</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo Bootstrap::formTitle(array('title'=>$L->g('Social Networks')));
|
||||||
|
|
||||||
|
echo Bootstrap::formInputText(array(
|
||||||
|
'name'=>'twitter',
|
||||||
|
'label'=>'Twitter',
|
||||||
|
'value'=>$user->twitter(),
|
||||||
|
'class'=>'',
|
||||||
|
'tip'=>''
|
||||||
|
));
|
||||||
|
|
||||||
|
echo Bootstrap::formInputText(array(
|
||||||
|
'name'=>'facebook',
|
||||||
|
'label'=>'Facebook',
|
||||||
|
'value'=>$user->facebook(),
|
||||||
|
'class'=>'',
|
||||||
|
'tip'=>''
|
||||||
|
));
|
||||||
|
|
||||||
|
echo Bootstrap::formInputText(array(
|
||||||
|
'name'=>'googlePlus',
|
||||||
|
'label'=>'Google+',
|
||||||
|
'value'=>$user->googlePlus(),
|
||||||
|
'class'=>'',
|
||||||
|
'tip'=>''
|
||||||
|
));
|
||||||
|
|
||||||
|
echo Bootstrap::formInputText(array(
|
||||||
|
'name'=>'instagram',
|
||||||
|
'label'=>'Instagram',
|
||||||
|
'value'=>$user->instagram(),
|
||||||
|
'class'=>'',
|
||||||
|
'tip'=>''
|
||||||
|
));
|
||||||
|
|
||||||
|
echo Bootstrap::formInputText(array(
|
||||||
|
'name'=>'codepen',
|
||||||
|
'label'=>'Codepen',
|
||||||
|
'value'=>$user->codepen(),
|
||||||
|
'class'=>'',
|
||||||
|
'tip'=>''
|
||||||
|
));
|
||||||
|
|
||||||
|
echo Bootstrap::formInputText(array(
|
||||||
|
'name'=>'linkedin',
|
||||||
|
'label'=>'Linkedin',
|
||||||
|
'value'=>$user->linkedin(),
|
||||||
|
'class'=>'',
|
||||||
|
'tip'=>''
|
||||||
|
));
|
||||||
|
|
||||||
|
echo Bootstrap::formInputText(array(
|
||||||
|
'name'=>'github',
|
||||||
|
'label'=>'Github',
|
||||||
|
'value'=>$user->github(),
|
||||||
|
'class'=>'',
|
||||||
|
'tip'=>''
|
||||||
|
));
|
||||||
|
|
||||||
|
echo Bootstrap::formInputText(array(
|
||||||
|
'name'=>'gitlab',
|
||||||
|
'label'=>'Gitlab',
|
||||||
|
'value'=>$user->gitlab(),
|
||||||
|
'class'=>'',
|
||||||
|
'tip'=>''
|
||||||
|
));
|
||||||
|
|
||||||
|
echo '
|
||||||
|
<div class="form-group mt-4">
|
||||||
|
<button type="submit" class="btn btn-primary mr-2" name="save">'.$L->g('Save').'</button>
|
||||||
|
<a class="btn btn-secondary" href="'.HTML_PATH_ADMIN_ROOT.'users" role="button">'.$L->g('Cancel').'</a>
|
||||||
|
</div>
|
||||||
|
';
|
||||||
|
|
||||||
|
echo Bootstrap::formClose();
|
||||||
|
|
||||||
|
echo Bootstrap::formTitle(array('title'=>$L->g('Profile picture')));
|
||||||
|
|
||||||
|
$src = (Sanitize::pathFile(PATH_UPLOADS_PROFILES.$user->username().'.png')?DOMAIN_UPLOADS_PROFILES.$user->username().'.png':HTML_PATH_ADMIN_THEME_IMG.'default.svg');
|
||||||
|
echo '
|
||||||
|
<div class="form-group row">
|
||||||
|
<div class="col-sm-2"></div>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<img id="jsprofilePictureImg" style="width: 350px; height: 200px;" class="img-thumbnail mb-2" alt="Profile Picture" src="'.$src.'" />
|
||||||
|
|
||||||
|
<form id="jsprofilePictureForm" name="profilePictureForm" enctype="multipart/form-data">
|
||||||
|
<input type="hidden" name="tokenCSRF" value="'.$security->getTokenCSRF().'">
|
||||||
|
<div class="custom-file">
|
||||||
|
<input type="file" class="custom-file-input" id="jsprofilePictureInputFile" name="profilePictureInputFile">
|
||||||
|
<label class="custom-file-label" for="jsprofilePictureInputFile"></label>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
';
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
$("#jsdeleteUserAndDeleteContent").click(function() {
|
||||||
|
if(confirm("<?php $L->p('Confirm delete this action cannot be undone') ?>")==false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#jsdeleteUserAndKeepContent").click(function() {
|
||||||
|
if(confirm("<?php $L->p('Confirm delete this action cannot be undone') ?>")==false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#jsprofilePictureInputFile").on("change", function() {
|
||||||
|
|
||||||
|
// Data to send via AJAX
|
||||||
|
var username = $("#jsusername").val();
|
||||||
|
var formData = new FormData($("#jsprofilePictureForm")[0]);
|
||||||
|
formData.append('username', username);
|
||||||
|
formData.append('tokenCSRF', tokenCSRF);
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: HTML_PATH_ADMIN_ROOT+"ajax/profile-picture",
|
||||||
|
type: "POST",
|
||||||
|
data: formData,
|
||||||
|
cache: false,
|
||||||
|
contentType: false,
|
||||||
|
processData: false,
|
||||||
|
xhr: function() {
|
||||||
|
var xhr = $.ajaxSettings.xhr();
|
||||||
|
if (xhr.upload) {
|
||||||
|
xhr.upload.addEventListener("progress", function(e) {
|
||||||
|
if (e.lengthComputable) {
|
||||||
|
var percentComplete = (e.loaded / e.total)*100;
|
||||||
|
console.log("Uploading profile picture: "+percentComplete);
|
||||||
|
}
|
||||||
|
}, false);
|
||||||
|
}
|
||||||
|
return xhr;
|
||||||
|
}
|
||||||
|
}).done(function(e) {
|
||||||
|
$("#jsprofilePictureImg").attr('src',e.absoluteURL+"?time="+Math.random());
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
|
@ -1,277 +1,246 @@
|
||||||
<?php defined('BLUDIT') or die('Bludit CMS.');
|
<?php defined('BLUDIT') or die('Bludit CMS.'); ?>
|
||||||
|
|
||||||
echo Bootstrap::formOpen(array());
|
<?php echo Bootstrap::pageTitle(array('title'=>$L->g('Edit user'), 'icon'=>'person')); ?>
|
||||||
|
|
||||||
echo '
|
<nav class="mb-3">
|
||||||
<div>
|
<div class="nav nav-tabs" id="nav-tab" role="tablist">
|
||||||
<div class="float-right">
|
<a class="nav-item nav-link active" id="nav-profile-tab" data-toggle="tab" href="#profile" role="tab" aria-controls="nav-profile" aria-selected="false">Profile</a>
|
||||||
<button type="submit" class="btn btn-primary btn-sm" name="save">'.$L->g('Save').'</button>
|
<a class="nav-item nav-link" id="nav-picture-tab" data-toggle="tab" href="#picture" role="tab" aria-controls="nav-picture" aria-selected="false">Profile picture</a>
|
||||||
<a class="btn btn-secondary btn-sm" href="'.HTML_PATH_ADMIN_ROOT.'users" role="button">'.$L->g('Cancel').'</a>
|
<a class="nav-item nav-link" id="nav-security-tab" data-toggle="tab" href="#security" role="tab" aria-controls="nav-security" aria-selected="false">Security</a>
|
||||||
</div>
|
<a class="nav-item nav-link" id="nav-social-tab" data-toggle="tab" href="#social" role="tab" aria-controls="nav-social" aria-selected="false">Social Networks</a>
|
||||||
<h2 class="mt-0 mb-3">
|
</div>
|
||||||
<span class="oi oi-person" style="font-size: 0.7em;"></span> '.$L->g('Edit user').'
|
</nav>
|
||||||
</h2>
|
|
||||||
</div>
|
|
||||||
';
|
|
||||||
|
|
||||||
|
<?php
|
||||||
|
// Start form
|
||||||
|
echo Bootstrap::formOpen(array(
|
||||||
|
'id'=>'jsform',
|
||||||
|
'class'=>''
|
||||||
|
));
|
||||||
|
|
||||||
|
// Token CSRF
|
||||||
echo Bootstrap::formInputHidden(array(
|
echo Bootstrap::formInputHidden(array(
|
||||||
'name'=>'tokenCSRF',
|
'name'=>'tokenCSRF',
|
||||||
'value'=>$security->getTokenCSRF()
|
'value'=>$security->getTokenCSRF()
|
||||||
));
|
));
|
||||||
|
|
||||||
|
// Username
|
||||||
echo Bootstrap::formInputHidden(array(
|
echo Bootstrap::formInputHidden(array(
|
||||||
'name'=>'username',
|
'name'=>'username',
|
||||||
'value'=>$user->username()
|
'value'=>$user->username()
|
||||||
));
|
));
|
||||||
|
?>
|
||||||
|
|
||||||
echo Bootstrap::formInputText(array(
|
<div class="tab-content" id="nav-tabContent">
|
||||||
'name'=>'usernameDisabled',
|
<!-- Profile tab -->
|
||||||
'label'=>$L->g('Username'),
|
<div class="tab-pane fade show active" id="profile" role="tabpanel" aria-labelledby="nav-profile-tab">
|
||||||
'value'=>$user->username(),
|
<?php
|
||||||
'class'=>'',
|
// Display username but disable the field
|
||||||
'placeholder'=>'',
|
echo Bootstrap::formInputText(array(
|
||||||
'disabled'=>true,
|
'name'=>'usernameDisabled',
|
||||||
'tip'=>''
|
'label'=>$L->g('Username'),
|
||||||
));
|
'value'=>$user->username(),
|
||||||
|
'class'=>'',
|
||||||
|
'placeholder'=>'',
|
||||||
|
'disabled'=>true,
|
||||||
|
'tip'=>''
|
||||||
|
));
|
||||||
|
|
||||||
if ($login->role()==='admin') {
|
if ($login->role()==='admin') {
|
||||||
echo Bootstrap::formSelect(array(
|
echo Bootstrap::formSelect(array(
|
||||||
'name'=>'role',
|
'name'=>'role',
|
||||||
'label'=>$L->g('Role'),
|
'label'=>$L->g('Role'),
|
||||||
'options'=>array('editor'=>$L->g('Editor'), 'admin'=>$L->g('Administrator')),
|
'options'=>array('editor'=>$L->g('Editor'), 'admin'=>$L->g('Administrator')),
|
||||||
'selected'=>$user->role(),
|
'selected'=>$user->role(),
|
||||||
|
'class'=>'',
|
||||||
|
'tip'=>''
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
echo Bootstrap::formInputText(array(
|
||||||
|
'name'=>'email',
|
||||||
|
'label'=>$L->g('Email'),
|
||||||
|
'value'=>$user->email(),
|
||||||
|
'class'=>'',
|
||||||
|
'placeholder'=>'',
|
||||||
|
'tip'=>''
|
||||||
|
));
|
||||||
|
|
||||||
|
echo Bootstrap::formInputText(array(
|
||||||
|
'name'=>'nickname',
|
||||||
|
'label'=>$L->g('Nickname'),
|
||||||
|
'value'=>$user->nickname(),
|
||||||
|
'class'=>'',
|
||||||
|
'placeholder'=>'',
|
||||||
|
'tip'=>$L->g('The nickname is almost used in the themes to display the author of the content')
|
||||||
|
));
|
||||||
|
|
||||||
|
echo Bootstrap::formInputText(array(
|
||||||
|
'name'=>'firstName',
|
||||||
|
'label'=>$L->g('First Name'),
|
||||||
|
'value'=>$user->firstName(),
|
||||||
|
'class'=>'',
|
||||||
|
'placeholder'=>'',
|
||||||
|
'tip'=>''
|
||||||
|
));
|
||||||
|
|
||||||
|
echo Bootstrap::formInputText(array(
|
||||||
|
'name'=>'lastName',
|
||||||
|
'label'=>$L->g('Last Name'),
|
||||||
|
'value'=>$user->lastName(),
|
||||||
|
'class'=>'',
|
||||||
|
'placeholder'=>'',
|
||||||
|
'tip'=>''
|
||||||
|
));
|
||||||
|
|
||||||
|
echo '
|
||||||
|
<div class="form-group mt-4">
|
||||||
|
<button type="submit" class="btn btn-primary mr-2" name="save">'.$L->g('Save').'</button>
|
||||||
|
<a class="btn btn-secondary" href="'.HTML_PATH_ADMIN_ROOT.'dashboard" role="button">'.$L->g('Cancel').'</a>
|
||||||
|
</div>
|
||||||
|
';
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Profile picture tab -->
|
||||||
|
<div class="tab-pane fade" id="picture" role="tabpanel" aria-labelledby="nav-picture-tab">
|
||||||
|
<div>
|
||||||
|
<img id="jscoverImagePreview" class="d-block w-50" alt="Profile picture preview" src="<?php echo HTML_PATH_ADMIN_THEME_IMG ?>default.svg" />
|
||||||
|
</div>
|
||||||
|
<div class="mt-2">
|
||||||
|
<button type="button" id="jsbuttonSelectCoverImage" class="btn btn-primary btn-sm"><?php echo $L->g('Select cover image') ?></button>
|
||||||
|
<button type="button" id="jsbuttonRemoveCoverImage" class="btn btn-secondary btn-sm"><?php echo $L->g('Remove cover image') ?></button>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
$("#jscoverImagePreview").on("click", function() {
|
||||||
|
openMediaManager();
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#jsbuttonSelectCoverImage").on("click", function() {
|
||||||
|
openMediaManager();
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#jsbuttonRemoveCoverImage").on("click", function() {
|
||||||
|
$("#jscoverImage").val('');
|
||||||
|
$("#jscoverImagePreview").attr('src', HTML_PATH_ADMIN_THEME_IMG+'default.svg');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Security tab -->
|
||||||
|
<div class="tab-pane fade" id="security" role="tabpanel" aria-labelledby="nav-security-tab">
|
||||||
|
<?php
|
||||||
|
echo Bootstrap::formTitle(array('title'=>$L->g('Password')));
|
||||||
|
|
||||||
|
echo '
|
||||||
|
<div class="form-group">
|
||||||
|
<a href="'.HTML_PATH_ADMIN_ROOT.'user-password/'.$user->username().'" class="btn btn-primary mr-2">'.$L->g('Change password').'</a>
|
||||||
|
</div>
|
||||||
|
';
|
||||||
|
|
||||||
|
echo Bootstrap::formTitle(array('title'=>$L->g('Authentication Token')));
|
||||||
|
|
||||||
|
echo Bootstrap::formInputText(array(
|
||||||
|
'name'=>'tokenAuth',
|
||||||
|
'label'=>$L->g('Token'),
|
||||||
|
'value'=>$user->tokenAuth(),
|
||||||
|
'class'=>'',
|
||||||
|
'tip'=>$L->g('this-token-is-similar-to-a-password-it-should-not-be-shared')
|
||||||
|
));
|
||||||
|
|
||||||
|
echo Bootstrap::formTitle(array('title'=>$L->g('Status')));
|
||||||
|
|
||||||
|
echo Bootstrap::formInputText(array(
|
||||||
|
'name'=>'status',
|
||||||
|
'label'=>$L->g('Current status'),
|
||||||
|
'value'=>$user->enabled()?$L->g('Enabled'):$L->g('Disabled'),
|
||||||
|
'class'=>'',
|
||||||
|
'disabled'=>true,
|
||||||
|
'tip'=>$user->enabled()?'':$L->g('To enable the user you must set a new password')
|
||||||
|
));
|
||||||
|
|
||||||
|
if ($user->enabled()) {
|
||||||
|
echo '
|
||||||
|
<div class="form-group row">
|
||||||
|
<div class="col-sm-2"></div>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<button type="submit" class="btn btn-warning mr-2" id="jsdisableUser" name="disableUser">'.$L->g('Disable user').'</button>
|
||||||
|
<button type="submit" class="btn btn-danger mr-2" id="jsdeleteUserAndKeepContent" name="deleteUserAndKeepContent">'.$L->g('Delete user and keep content').'</button>
|
||||||
|
<button type="submit" class="btn btn-danger mr-2" id="jsdeleteUserAndDeleteContent" name="deleteUserAndDeleteContent">'.$L->g('Delete user and delete content').'</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Social Networks tab -->
|
||||||
|
<div class="tab-pane fade" id="social" role="tabpanel" aria-labelledby="nav-social-tab">
|
||||||
|
<?php
|
||||||
|
echo Bootstrap::formInputText(array(
|
||||||
|
'name'=>'twitter',
|
||||||
|
'label'=>'Twitter',
|
||||||
|
'value'=>$user->twitter(),
|
||||||
'class'=>'',
|
'class'=>'',
|
||||||
'tip'=>''
|
'tip'=>''
|
||||||
));
|
));
|
||||||
}
|
|
||||||
|
|
||||||
echo Bootstrap::formInputText(array(
|
echo Bootstrap::formInputText(array(
|
||||||
'name'=>'email',
|
'name'=>'facebook',
|
||||||
'label'=>$L->g('Email'),
|
'label'=>'Facebook',
|
||||||
'value'=>$user->email(),
|
'value'=>$user->facebook(),
|
||||||
'class'=>'',
|
'class'=>'',
|
||||||
'placeholder'=>'',
|
'tip'=>''
|
||||||
'tip'=>''
|
));
|
||||||
));
|
|
||||||
|
|
||||||
echo Bootstrap::formTitle(array('title'=>$L->g('Profile')));
|
echo Bootstrap::formInputText(array(
|
||||||
|
'name'=>'instagram',
|
||||||
|
'label'=>'Instagram',
|
||||||
|
'value'=>$user->instagram(),
|
||||||
|
'class'=>'',
|
||||||
|
'tip'=>''
|
||||||
|
));
|
||||||
|
|
||||||
echo Bootstrap::formInputText(array(
|
echo Bootstrap::formInputText(array(
|
||||||
'name'=>'nickname',
|
'name'=>'codepen',
|
||||||
'label'=>$L->g('Nickname'),
|
'label'=>'Codepen',
|
||||||
'value'=>$user->nickname(),
|
'value'=>$user->codepen(),
|
||||||
'class'=>'',
|
'class'=>'',
|
||||||
'placeholder'=>'',
|
'tip'=>''
|
||||||
'tip'=>$L->g('The nickname is almost used in the themes to display the author of the content')
|
));
|
||||||
));
|
|
||||||
|
|
||||||
echo Bootstrap::formInputText(array(
|
echo Bootstrap::formInputText(array(
|
||||||
'name'=>'firstName',
|
'name'=>'linkedin',
|
||||||
'label'=>$L->g('First Name'),
|
'label'=>'Linkedin',
|
||||||
'value'=>$user->firstName(),
|
'value'=>$user->linkedin(),
|
||||||
'class'=>'',
|
'class'=>'',
|
||||||
'placeholder'=>'',
|
'tip'=>''
|
||||||
'tip'=>''
|
));
|
||||||
));
|
|
||||||
|
|
||||||
echo Bootstrap::formInputText(array(
|
echo Bootstrap::formInputText(array(
|
||||||
'name'=>'lastName',
|
'name'=>'github',
|
||||||
'label'=>$L->g('Last Name'),
|
'label'=>'Github',
|
||||||
'value'=>$user->lastName(),
|
'value'=>$user->github(),
|
||||||
'class'=>'',
|
'class'=>'',
|
||||||
'placeholder'=>'',
|
'tip'=>''
|
||||||
'tip'=>''
|
));
|
||||||
));
|
|
||||||
|
|
||||||
echo Bootstrap::formTitle(array('title'=>$L->g('Password')));
|
echo Bootstrap::formInputText(array(
|
||||||
|
'name'=>'gitlab',
|
||||||
|
'label'=>'Gitlab',
|
||||||
|
'value'=>$user->gitlab(),
|
||||||
|
'class'=>'',
|
||||||
|
'tip'=>''
|
||||||
|
));
|
||||||
|
|
||||||
echo '
|
|
||||||
<div class="form-group row">
|
|
||||||
<div class="col-sm-2"></div>
|
|
||||||
<div class="col-sm-10">
|
|
||||||
<a href="'.HTML_PATH_ADMIN_ROOT.'user-password/'.$user->username().'" class="btn btn-primary mr-2">'.$L->g('Change password').'</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
';
|
|
||||||
|
|
||||||
echo Bootstrap::formTitle(array('title'=>$L->g('Authentication Token')));
|
|
||||||
|
|
||||||
echo Bootstrap::formInputText(array(
|
|
||||||
'name'=>'tokenAuth',
|
|
||||||
'label'=>$L->g('Token'),
|
|
||||||
'value'=>$user->tokenAuth(),
|
|
||||||
'class'=>'',
|
|
||||||
'tip'=>$L->g('this-token-is-similar-to-a-password-it-should-not-be-shared')
|
|
||||||
));
|
|
||||||
|
|
||||||
echo Bootstrap::formTitle(array('title'=>$L->g('Status')));
|
|
||||||
|
|
||||||
echo Bootstrap::formInputText(array(
|
|
||||||
'name'=>'status',
|
|
||||||
'label'=>$L->g('Current status'),
|
|
||||||
'value'=>$user->enabled()?$L->g('Enabled'):$L->g('Disabled'),
|
|
||||||
'class'=>'',
|
|
||||||
'disabled'=>true,
|
|
||||||
'tip'=>$user->enabled()?'':$L->g('To enable the user you must set a new password')
|
|
||||||
));
|
|
||||||
|
|
||||||
if ($user->enabled()) {
|
|
||||||
echo '
|
echo '
|
||||||
<div class="form-group row">
|
<div class="form-group mt-4">
|
||||||
<div class="col-sm-2"></div>
|
<button type="submit" class="btn btn-primary mr-2" name="save">'.$L->g('Save').'</button>
|
||||||
<div class="col-sm-10">
|
<a class="btn btn-secondary" href="'.HTML_PATH_ADMIN_ROOT.'dashboard" role="button">'.$L->g('Cancel').'</a>
|
||||||
<button type="submit" class="btn btn-primary mr-2" id="jsdisableUser" name="disableUser">'.$L->g('Disable user').'</button>
|
|
||||||
<button type="submit" class="btn btn-danger mr-2" id="jsdeleteUserAndKeepContent" name="deleteUserAndKeepContent">'.$L->g('Delete user and keep content').'</button>
|
|
||||||
<button type="submit" class="btn btn-danger mr-2" id="jsdeleteUserAndDeleteContent" name="deleteUserAndDeleteContent">'.$L->g('Delete user and delete content').'</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
';
|
';
|
||||||
}
|
?>
|
||||||
|
|
||||||
echo Bootstrap::formTitle(array('title'=>$L->g('Social Networks')));
|
|
||||||
|
|
||||||
echo Bootstrap::formInputText(array(
|
|
||||||
'name'=>'twitter',
|
|
||||||
'label'=>'Twitter',
|
|
||||||
'value'=>$user->twitter(),
|
|
||||||
'class'=>'',
|
|
||||||
'tip'=>''
|
|
||||||
));
|
|
||||||
|
|
||||||
echo Bootstrap::formInputText(array(
|
|
||||||
'name'=>'facebook',
|
|
||||||
'label'=>'Facebook',
|
|
||||||
'value'=>$user->facebook(),
|
|
||||||
'class'=>'',
|
|
||||||
'tip'=>''
|
|
||||||
));
|
|
||||||
|
|
||||||
echo Bootstrap::formInputText(array(
|
|
||||||
'name'=>'googlePlus',
|
|
||||||
'label'=>'Google+',
|
|
||||||
'value'=>$user->googlePlus(),
|
|
||||||
'class'=>'',
|
|
||||||
'tip'=>''
|
|
||||||
));
|
|
||||||
|
|
||||||
echo Bootstrap::formInputText(array(
|
|
||||||
'name'=>'instagram',
|
|
||||||
'label'=>'Instagram',
|
|
||||||
'value'=>$user->instagram(),
|
|
||||||
'class'=>'',
|
|
||||||
'tip'=>''
|
|
||||||
));
|
|
||||||
|
|
||||||
echo Bootstrap::formInputText(array(
|
|
||||||
'name'=>'codepen',
|
|
||||||
'label'=>'Codepen',
|
|
||||||
'value'=>$user->codepen(),
|
|
||||||
'class'=>'',
|
|
||||||
'tip'=>''
|
|
||||||
));
|
|
||||||
|
|
||||||
echo Bootstrap::formInputText(array(
|
|
||||||
'name'=>'linkedin',
|
|
||||||
'label'=>'Linkedin',
|
|
||||||
'value'=>$user->linkedin(),
|
|
||||||
'class'=>'',
|
|
||||||
'tip'=>''
|
|
||||||
));
|
|
||||||
|
|
||||||
echo Bootstrap::formInputText(array(
|
|
||||||
'name'=>'github',
|
|
||||||
'label'=>'Github',
|
|
||||||
'value'=>$user->github(),
|
|
||||||
'class'=>'',
|
|
||||||
'tip'=>''
|
|
||||||
));
|
|
||||||
|
|
||||||
echo Bootstrap::formInputText(array(
|
|
||||||
'name'=>'gitlab',
|
|
||||||
'label'=>'Gitlab',
|
|
||||||
'value'=>$user->gitlab(),
|
|
||||||
'class'=>'',
|
|
||||||
'tip'=>''
|
|
||||||
));
|
|
||||||
|
|
||||||
echo '
|
|
||||||
<div class="form-group mt-4">
|
|
||||||
<button type="submit" class="btn btn-primary mr-2" name="save">'.$L->g('Save').'</button>
|
|
||||||
<a class="btn btn-secondary" href="'.HTML_PATH_ADMIN_ROOT.'users" role="button">'.$L->g('Cancel').'</a>
|
|
||||||
</div>
|
</div>
|
||||||
';
|
|
||||||
|
|
||||||
echo Bootstrap::formClose();
|
|
||||||
|
|
||||||
echo Bootstrap::formTitle(array('title'=>$L->g('Profile picture')));
|
|
||||||
|
|
||||||
$src = (Sanitize::pathFile(PATH_UPLOADS_PROFILES.$user->username().'.png')?DOMAIN_UPLOADS_PROFILES.$user->username().'.png':HTML_PATH_ADMIN_THEME_IMG.'default.svg');
|
|
||||||
echo '
|
|
||||||
<div class="form-group row">
|
|
||||||
<div class="col-sm-2"></div>
|
|
||||||
<div class="col-sm-10">
|
|
||||||
<img id="jsprofilePictureImg" style="width: 350px; height: 200px;" class="img-thumbnail mb-2" alt="Profile Picture" src="'.$src.'" />
|
|
||||||
|
|
||||||
<form id="jsprofilePictureForm" name="profilePictureForm" enctype="multipart/form-data">
|
|
||||||
<input type="hidden" name="tokenCSRF" value="'.$security->getTokenCSRF().'">
|
|
||||||
<div class="custom-file">
|
|
||||||
<input type="file" class="custom-file-input" id="jsprofilePictureInputFile" name="profilePictureInputFile">
|
|
||||||
<label class="custom-file-label" for="jsprofilePictureInputFile"></label>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
';
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
$(document).ready(function() {
|
|
||||||
|
|
||||||
$("#jsdeleteUserAndDeleteContent").click(function() {
|
|
||||||
if(confirm("<?php $L->p('Confirm delete this action cannot be undone') ?>")==false) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#jsdeleteUserAndKeepContent").click(function() {
|
|
||||||
if(confirm("<?php $L->p('Confirm delete this action cannot be undone') ?>")==false) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$("#jsprofilePictureInputFile").on("change", function() {
|
|
||||||
|
|
||||||
// Data to send via AJAX
|
|
||||||
var username = $("#jsusername").val();
|
|
||||||
var formData = new FormData($("#jsprofilePictureForm")[0]);
|
|
||||||
formData.append('username', username);
|
|
||||||
formData.append('tokenCSRF', tokenCSRF);
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
url: HTML_PATH_ADMIN_ROOT+"ajax/profile-picture",
|
|
||||||
type: "POST",
|
|
||||||
data: formData,
|
|
||||||
cache: false,
|
|
||||||
contentType: false,
|
|
||||||
processData: false,
|
|
||||||
xhr: function() {
|
|
||||||
var xhr = $.ajaxSettings.xhr();
|
|
||||||
if (xhr.upload) {
|
|
||||||
xhr.upload.addEventListener("progress", function(e) {
|
|
||||||
if (e.lengthComputable) {
|
|
||||||
var percentComplete = (e.loaded / e.total)*100;
|
|
||||||
console.log("Uploading profile picture: "+percentComplete);
|
|
||||||
}
|
|
||||||
}, false);
|
|
||||||
}
|
|
||||||
return xhr;
|
|
||||||
}
|
|
||||||
}).done(function(e) {
|
|
||||||
$("#jsprofilePictureImg").attr('src',e.absoluteURL+"?time="+Math.random());
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
// FORM START
|
// Start form
|
||||||
echo Bootstrap::formOpen(array(
|
echo Bootstrap::formOpen(array(
|
||||||
'id'=>'jsform',
|
'id'=>'jsform',
|
||||||
'class'=>'d-flex flex-column h-100'
|
'class'=>'d-flex flex-column h-100'
|
||||||
|
|
|
@ -47,7 +47,7 @@ echo Bootstrap::formOpen(array());
|
||||||
echo '
|
echo '
|
||||||
<div class="form-group mt-4">
|
<div class="form-group mt-4">
|
||||||
<button type="submit" class="btn btn-primary mr-2" name="save">'.$L->g('Save').'</button>
|
<button type="submit" class="btn btn-primary mr-2" name="save">'.$L->g('Save').'</button>
|
||||||
<a class="btn btn-secondary" href="'.HTML_PATH_ADMIN_ROOT.'edit-user/'.$user->username().'" role="button">'.$L->g('Cancel').'</a>
|
<a class="btn btn-secondary" href="'.HTML_PATH_ADMIN_ROOT.'edit-user/'.$user->username().'#security" role="button">'.$L->g('Cancel').'</a>
|
||||||
</div>
|
</div>
|
||||||
';
|
';
|
||||||
|
|
||||||
|
|
|
@ -365,5 +365,6 @@
|
||||||
"there-are-no-images-for-the-page": "There are no images for the page.",
|
"there-are-no-images-for-the-page": "There are no images for the page.",
|
||||||
"select-cover-image": "Select cover image",
|
"select-cover-image": "Select cover image",
|
||||||
"this-plugin-depends-on-the-following-plugins": "This plugin depends on the following plugins.",
|
"this-plugin-depends-on-the-following-plugins": "This plugin depends on the following plugins.",
|
||||||
"no-pages-found": "No pages found"
|
"no-pages-found": "No pages found",
|
||||||
|
"system-updated": "System updated"
|
||||||
}
|
}
|
Loading…
Reference in New Issue