diff --git a/admin/themes/default/icon/details_close.png b/admin/themes/default/icon/details_close.png
new file mode 100644
index 000000000..fcc23c63e
Binary files /dev/null and b/admin/themes/default/icon/details_close.png differ
diff --git a/admin/themes/default/icon/details_open.png b/admin/themes/default/icon/details_open.png
new file mode 100644
index 000000000..6f034d0f2
Binary files /dev/null and b/admin/themes/default/icon/details_open.png differ
diff --git a/admin/themes/default/template/user_list.tpl b/admin/themes/default/template/user_list.tpl
index 380ca6f20..6efd63daf 100644
--- a/admin/themes/default/template/user_list.tpl
+++ b/admin/themes/default/template/user_list.tpl
@@ -15,6 +15,11 @@ var missingUsername = "{'Please, enter a login'|translate}";
var allUsers = [{$all_users}];
var selection = [{$selection}];
var pwg_token = "{$PWG_TOKEN}";
+
+var truefalse = {
+ true:"{'Yes'|translate}",
+ false:"{'No'|translate}",
+};
{/footer_script}
{footer_script}{literal}
@@ -79,6 +84,201 @@ jQuery(document).ready(function() {
/**
* Table with users
*/
+ /* Formating function for row details */
+ function fnFormatDetails(oTable, nTr) {
+ var userId = oTable.fnGetData(nTr)[0];
+ console.log("userId = "+userId);
+ var sOut = null;
+
+ jQuery.ajax({
+ url: "ws.php?format=json&method=pwg.users.getList",
+ type:"POST",
+ data: {
+ user_id: userId,
+ display: "all",
+ },
+ success:function(data) {
+ jQuery("#user"+userId+" .loading").hide();
+
+ var data = jQuery.parseJSON(data);
+ if (data.stat == 'ok') {
+ var user = data.result.users[0];
+
+ var userDetails = '';
+ userDetails += '
';
+
+ userDetails += '';
+ userDetails += '
'
+
+ jQuery("#user"+userId).append(userDetails);
+ }
+ else {
+ console.log('error loading user details');
+ }
+ },
+ error:function(XMLHttpRequest, textStatus, errorThrows) {
+ console.log('technical error loading user details');
+ }
+ });
+
+ return '
';
+ }
+
+ jQuery(document).on('click', '.userProperties input[type=submit]', function() {
+ var userId = jQuery(this).data('user_id');
+
+ jQuery.ajax({
+ url: "ws.php?format=json&method=pwg.users.setInfo",
+ type:"POST",
+ data: jQuery('#user'+userId).find('select, input').serialize(),
+ beforeSend: function() {
+ jQuery('#user'+userId+' .submitWait').show();
+ },
+ success:function(data) {
+ jQuery('#user'+userId+' .submitWait').hide();
+ },
+ error:function(XMLHttpRequest, textStatus, errorThrows) {
+ jQuery('#user'+userId+' .submitWait').hide();
+ }
+ });
+
+ return false;
+ });
+
+ /* Add event listener for opening and closing details
+ * Note that the indicator for showing which row is open is not controlled by DataTables,
+ * rather it is done here
+ */
+ jQuery(document).on('click', '#userList tbody td img', function() {
+ var nTr = this.parentNode.parentNode;
+ if ( this.src.match('details_close') ) {
+ /* This row is already open - close it */
+ this.src = "admin/themes/default/icon/details_open.png";
+ oTable.fnClose( nTr );
+ }
+ else {
+ /* Open this row */
+ this.src = "admin/themes/default/icon/details_close.png";
+ oTable.fnOpen( nTr, fnFormatDetails(oTable, nTr), 'details' );
+ }
+ });
+
/* first column must be prefixed with the open/close icon */
var aoColumns = [
@@ -87,7 +287,7 @@ jQuery(document).ready(function() {
},
{
"mRender": function(data, type, full) {
- return '';
+ return '
';
}
}
];
@@ -328,10 +528,16 @@ jQuery(document).ready(function() {
{/literal}