aboutsummaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--admin/include/add_core_tabs.inc.php4
-rw-r--r--admin/themes/default/template/user_list.tpl118
-rw-r--r--admin/user_list.php14
3 files changed, 123 insertions, 13 deletions
diff --git a/admin/include/add_core_tabs.inc.php b/admin/include/add_core_tabs.inc.php
index 443775d38..9769cb32c 100644
--- a/admin/include/add_core_tabs.inc.php
+++ b/admin/include/add_core_tabs.inc.php
@@ -61,6 +61,10 @@ function add_core_tabs($sheets, $tab_id)
case 'comments':
$sheets[''] = array('caption' => l10n('User comments'), 'url' => '');
break;
+
+ case 'users':
+ $sheets[''] = array('caption' => '<span class="icon-users"> </span>'.l10n('User list'), 'url' => '');
+ break;
case 'configuration':
global $conf_link;
diff --git a/admin/themes/default/template/user_list.tpl b/admin/themes/default/template/user_list.tpl
index 11a97c29d..6cd7de900 100644
--- a/admin/themes/default/template/user_list.tpl
+++ b/admin/themes/default/template/user_list.tpl
@@ -8,7 +8,9 @@ var selectedMessage_pattern = "{'%d of %d photos selected'|@translate}";
var selectedMessage_none = "{'No photo selected, %d photos in current set'|@translate}";
var selectedMessage_all = "{'All %d photos are selected'|@translate}";
var applyOnDetails_pattern = "{'on the %d selected users'|@translate}";
+var newUser_pattern = "&#x2714; {'User %s added'|translate}";
var missingConfirm = "{'You need to confirm deletion'|translate}";
+var missingUsername = "{'Please, enter a login'|translate}";
var allUsers = [{$all_users}];
var selection = [{$selection}];
@@ -16,6 +18,67 @@ var selection = [{$selection}];
{footer_script}{literal}
jQuery(document).ready(function() {
+ /**
+ * Add user
+ */
+ jQuery("#addUser").click(function() {
+ jQuery("#addUserForm").toggle();
+ jQuery("#showAddUser .infos").hide();
+ jQuery("input[name=username]").focus();
+ return false;
+ });
+
+ jQuery("#addUserClose").click(function() {
+ jQuery("#addUserForm").hide();
+ return false;
+ });
+
+ jQuery("#addUserForm").submit(function() {
+ jQuery.ajax({
+ url: "ws.php?format=json&method=pwg.users.add",
+ type:"POST",
+ data: jQuery(this).serialize(),
+ beforeSend: function() {
+ jQuery("#addUserForm .errors").hide();
+
+ if (jQuery("input[name=username]").val() == "") {
+ jQuery("#addUserForm .errors").html('&#x2718; '+missingUsername).show();
+ return false;
+ }
+
+ jQuery("#addUserForm .loading").show();
+ },
+ success:function(data) {
+ oTable.fnDraw();
+ jQuery("#addUserForm .loading").hide();
+
+ var data = jQuery.parseJSON(data);
+ if (data.stat == 'ok') {
+ jQuery("#addUserForm input[type=text], #addUserForm input[type=password]").val("");
+
+ var new_user = data.result.users[0];
+ allUsers.push(parseInt(new_user.id));
+ jQuery("#showAddUser .infos").html(sprintf(newUser_pattern, new_user.username)).show();
+ checkSelection();
+
+ jQuery("#addUserForm").hide();
+ }
+ else {
+ jQuery("#addUserForm .errors").html('&#x2718; '+data.message).show();
+ }
+ },
+ error:function(XMLHttpRequest, textStatus, errorThrows) {
+ jQuery("#addUserForm .loading").hide();
+ }
+ });
+
+ return false;
+ });
+
+ /**
+ * Table with users
+ */
+
/* first column must be prefixed with the open/close icon */
var aoColumns = [
{
@@ -264,8 +327,9 @@ jQuery(document).ready(function() {
.dataTables_wrapper, .dataTables_info {clear:none;}
table.dataTable {clear:right;padding-top:10px;}
.bulkAction {margin-top:10px;}
-.actionButtons {margin-left:0;}
-#applyActionBlock .infos {background-image:none; padding:2px 5px; margin:0;border-radius:5px;}
+#addUserForm p {margin-left:0;}
+#applyActionBlock .actionButtons {margin-left:0;}
+span.infos, span.errors {background-image:none; padding:2px 5px; margin:0;border-radius:5px;}
</style>
{/literal}
@@ -273,19 +337,47 @@ table.dataTable {clear:right;padding-top:10px;}
<h2>{'User list'|@translate}</h2>
</div>
-<form style="display:none" class="filter" method="post" name="add_user" action="{$F_ADD_ACTION}">
+<p class="showCreateAlbum" id="showAddUser">
+ <a href="#" id="addUser">{'Add a user'|translate}</a>
+ <span class="infos" style="display:none"></span>
+</p>
+
+<form id="addUserForm" style="display:none" method="post" name="add_user" action="{$F_ADD_ACTION}">
<fieldset>
<legend>{'Add a user'|@translate}</legend>
- <label>{'Username'|@translate} <input type="text" name="login" maxlength="50" size="20"></label>
- {if $Double_Password}
- <label>{'Password'|@translate} <input type="password" name="password"></label>
- <label>{'Confirm Password'|@translate} <input type="password" name="password_conf" id="password_conf"></label>
- {else}
- <label>{'Password'|@translate} <input type="text" name="password"></label>
- {/if}
- <label>{'Email address'|@translate} <input type="text" name="email"></label>
- <label>{'Send connection settings by email'|@translate} <input type="checkbox" name="send_password_by_mail" value="1" checked="checked"></label>
- <label>&nbsp; <input class="submit" type="submit" name="submit_add" value="{'Submit'|@translate}"></label>
+
+ <p>
+ <strong>{'Username'|translate}</strong><br>
+ <input type="text" name="username" maxlength="50" size="20">
+ </p>
+
+ <p>
+ <strong>{'Password'|translate}</strong><br>
+ <input type="{if $Double_Password}password{else}text{/if}" name="password">
+ </p>
+
+{if $Double_Password}
+ <p>
+ <strong>{'Confirm Password'|@translate}</strong><br>
+ <input type="password" name="password_confirm">
+ </p>
+{/if}
+
+ <p>
+ <strong>{'Email address'|@translate}</strong><br>
+ <input type="text" name="email">
+ </p>
+
+ <p>
+ <label><input type="checkbox" name="send_password_by_mail"> <strong>{'Send connection settings by email'|@translate}</strong></label>
+ </p>
+
+ <p class="actionButtons">
+ <input class="submit" name="submit_add" type="submit" value="{'Submit'|@translate}">
+ <a href="#" id="addUserClose">{'Cancel'|@translate}</a>
+ <span class="loading" style="display:none"><img src="themes/default/images/ajax-loader-small.gif"></span>
+ <span class="errors" style="display:none"></span>
+ </p>
</fieldset>
</form>
diff --git a/admin/user_list.php b/admin/user_list.php
index a9744a0d2..3c0b6488d 100644
--- a/admin/user_list.php
+++ b/admin/user_list.php
@@ -26,6 +26,19 @@
*/
// +-----------------------------------------------------------------------+
+// | tabs |
+// +-----------------------------------------------------------------------+
+
+include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
+
+$my_base_url = get_root_url().'admin.php?page=';
+
+$tabsheet = new tabsheet();
+$tabsheet->set_id('users');
+$tabsheet->select('user_list');
+$tabsheet->assign();
+
+// +-----------------------------------------------------------------------+
// | groups list |
// +-----------------------------------------------------------------------+
@@ -73,6 +86,7 @@ $template->assign(
array(
'users' => $users,
'all_users' => join(',', $user_ids),
+ 'Double_Password' => $conf['double_password_type_in_admin']
)
);