From 305ad0593fb7abd5051045615c5cc5f00fecd823 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 29 Jul 2011 04:40:38 +0000 Subject: [PATCH] Listing of coupons rewritten to more clear --- .gitattributes | 3 + inc/extensions/ext-nickname.php | 8 +- inc/language/sponsor_de.php | 2 +- inc/libs/sponsor_functions.php | 2 +- inc/modules/admin/what-list_coupon.php | 92 ++++++++++++++----- inc/modules/admin/what-list_nickname.php | 56 +++++++++++ inc/modules/sponsor/account.php | 3 +- inc/modules/sponsor/settings.php | 3 +- .../de/html/admin/admin_edit_rallyes.tpl | 2 + templates/de/html/admin/admin_list_coupon.tpl | 10 +- .../de/html/admin/admin_list_coupon_row.tpl | 8 +- .../de/html/admin/admin_list_coupon_usr.tpl | 44 +++++++++ .../html/admin/admin_list_coupon_usr_row.tpl | 29 ++++++ .../html/admin/admin_list_sponsor_details.tpl | 2 +- .../de/html/admin/admin_list_sponsor_row.tpl | 2 +- 15 files changed, 216 insertions(+), 50 deletions(-) create mode 100644 inc/modules/admin/what-list_nickname.php create mode 100644 templates/de/html/admin/admin_list_coupon_usr.tpl create mode 100644 templates/de/html/admin/admin_list_coupon_usr_row.tpl diff --git a/.gitattributes b/.gitattributes index 40a522f9cf..3421fd6faf 100644 --- a/.gitattributes +++ b/.gitattributes @@ -533,6 +533,7 @@ inc/modules/admin/what-list_network_api_translation.php svneol=native#text/plain inc/modules/admin/what-list_network_params.php svneol=native#text/plain inc/modules/admin/what-list_network_types.php svneol=native#text/plain inc/modules/admin/what-list_networks.php svneol=native#text/plain +inc/modules/admin/what-list_nickname.php svneol=native#text/plain inc/modules/admin/what-list_notifications.php svneol=native#text/plain inc/modules/admin/what-list_payouts.php svneol=native#text/plain inc/modules/admin/what-list_point_accounts.php svneol=native#text/plain @@ -1264,6 +1265,8 @@ templates/de/html/admin/admin_list_country_no_row.tpl svneol=native#text/plain templates/de/html/admin/admin_list_country_row.tpl svneol=native#text/plain templates/de/html/admin/admin_list_coupon.tpl svneol=native#text/plain templates/de/html/admin/admin_list_coupon_row.tpl svneol=native#text/plain +templates/de/html/admin/admin_list_coupon_usr.tpl svneol=native#text/plain +templates/de/html/admin/admin_list_coupon_usr_row.tpl svneol=native#text/plain templates/de/html/admin/admin_list_doubler_already.tpl svneol=native#text/plain templates/de/html/admin/admin_list_doubler_overview.tpl svneol=native#text/plain templates/de/html/admin/admin_list_doubler_waiting.tpl svneol=native#text/plain diff --git a/inc/extensions/ext-nickname.php b/inc/extensions/ext-nickname.php index 473be77472..137d4f8f7b 100644 --- a/inc/extensions/ext-nickname.php +++ b/inc/extensions/ext-nickname.php @@ -49,15 +49,15 @@ setExtensionVersionHistory(array('0.0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0 switch (getExtensionMode()) { case 'register': // Do stuff when installation is running // SQL commands to run - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD nickname VARCHAR(255) NOT NULL DEFAULT ''"); - addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD nick_userid ENUM ('nick','userid') NOT NULL DEFAULT 'userid'"); + addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `nickname` VARCHAR(255) NOT NULL DEFAULT ''"); + addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `nick_userid` ENUM ('nick','userid') NOT NULL DEFAULT 'userid'"); addMemberMenuSql('main','nickname','Nicknamen',5); break; case 'remove': // Do stuff when removing extension // SQL commands to run - addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what`='nickname'"); - addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what` IN ('config_nickname','list_nickname')"); + addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `what`='nickname' LIMIT 1"); + addExtensionSql("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admin_menu` WHERE `what` IN ('config_nickname','list_nickname') LIMIT 2"); addDropTableSql('nickname_history'); break; diff --git a/inc/language/sponsor_de.php b/inc/language/sponsor_de.php index 7712838556..65148a610b 100644 --- a/inc/language/sponsor_de.php +++ b/inc/language/sponsor_de.php @@ -248,7 +248,7 @@ addMessages(array( 'SPONSOR_EMAIL_404' => "Bei der Anmeldung ist uns ein Fehler unterlaufen: Ihr Sponsor-Account mit der EMail-Adresse %s wurde nicht gefunden.", 'SPONSOR_ACCOUNT_PENDING_FAILED' => "Bei der Umschaltung Ihres Sponorenaccounts auf Wartend trat ein unerwarteter Fehler auf.", 'SPONSOR_ACCOUNT_404' => "Das von Ihnen angegebene Sponsorenaccount %s konnte nicht gefunden werden.", - 'SPONSOR_ACCOUNT_FAILED' => "Sponsorenaccount konnte nicht geladen werden: %s", + 'SPONSOR_ACCOUNT_FAILED' => "Sponsorenaccount konnte nicht geladen werden: {%%pipe,translateSponsorStatus=%s%%}", 'SPONSOR_ACCOUNT_EMAIL_FAILED' => "Konnten Sponsorenaccount nicht freigeben! Bitte benachrichtigen Sie den Support.", // Login form diff --git a/inc/libs/sponsor_functions.php b/inc/libs/sponsor_functions.php index eb9aad248e..77e0654db9 100644 --- a/inc/libs/sponsor_functions.php +++ b/inc/libs/sponsor_functions.php @@ -217,7 +217,7 @@ function handleSponsorRequest ($postData, $update=false, $messageArray = array() } // Translate the account status -function sponsorTranslateUserStatus ($status) { +function translateSponsorStatus ($status) { // Construct constant name $constantName = sprintf("ACCOUNT_STATUS_%s", $status); diff --git a/inc/modules/admin/what-list_coupon.php b/inc/modules/admin/what-list_coupon.php index 0069ce021d..2f6f89c79a 100644 --- a/inc/modules/admin/what-list_coupon.php +++ b/inc/modules/admin/what-list_coupon.php @@ -43,8 +43,9 @@ if ((!defined('__SECURITY')) || (!isAdmin())) { // Add description as navigation point addYouAreHereLink('admin', __FILE__); -// Check if the user has cashed coupons -$result = SQL_QUERY('SELECT +if (isGetRequestParameterSet('coupon_id')) { + // List userids for given coupon + $result = SQL_QUERY_ESC('SELECT u.`coupon_id`, u.`userid`, UNIX_TIMESTAMP(u.`cashed_on`) AS `cashed_on`, @@ -57,34 +58,79 @@ INNER JOIN `{?_MYSQL_PREFIX?}_coupon_data` AS d ON u.`coupon_id`=d.`id` +WHERE + u.`coupon_id`=%s ORDER BY - u.`cashed_on` DESC', __FILE__, __LINE__); + u.`cashed_on` DESC', + array( + bigintval(getRequestParameter('coupon_id')) + ), __FILE__, __LINE__); -// Do we have entries? -if (SQL_NUMROWS($result) > 0) { - // Init variable - $OUT = ''; + // Do we have entries? + if (SQL_NUMROWS($result) > 0) { + // Init variable + $OUT = ''; - // Load all rows - while ($content = SQL_FETCHARRAY($result)) { - // Translate all timestamps - $content['cashed_on'] = generateDateTime($content['cashed_on'] , '2'); - $content['coupon_created'] = generateDateTime($content['coupon_created'], '2'); - $content['coupon_expired'] = generateDateTime($content['coupon_expired'], '2'); + // Load all rows + while ($content = SQL_FETCHARRAY($result)) { + // Translate all timestamps + $content['cashed_on'] = generateDateTime($content['cashed_on'] , '2'); + $content['coupon_created'] = generateDateTime($content['coupon_created'], '2'); + $content['coupon_expired'] = generateDateTime($content['coupon_expired'], '2'); - // Add the row template - $OUT .= loadTemplate('admin_list_coupon_row', true, $content); - } // END - while + // Add the row template + $OUT .= loadTemplate('admin_list_coupon_usr_row', true, $content); + } // END - while - // Load main template - loadTemplate('admin_list_coupon', false, $OUT); + // Load main template + loadTemplate('admin_list_coupon_usr', false, $OUT); + } else { + // No cashed coupons found + displayMessage('{--ADMIN_LIST_COUPON_404--}'); + } + + // Free result + SQL_FREERESULT($result); } else { - // No cashed coupons found - displayMessage('{--ADMIN_LIST_COUPON_404--}'); -} + // Check if the user has cashed coupons + $result = SQL_QUERY('SELECT + d.`id` AS `coupon_id`, + UNIX_TIMESTAMP(d.`coupon_created`) AS `coupon_created`, + UNIX_TIMESTAMP(d.`coupon_expired`) AS `coupon_expired`, + d.`points`, + d.`total_created`, + d.`total_cashed`, + d.`coupon_description` +FROM + `{?_MYSQL_PREFIX?}_coupon_data` AS d +ORDER BY + d.`id` ASC', __FILE__, __LINE__); + + // Do we have entries? + if (SQL_NUMROWS($result) > 0) { + // Init variable + $OUT = ''; + + // Load all rows + while ($content = SQL_FETCHARRAY($result)) { + // Translate all timestamps + $content['coupon_created'] = generateDateTime($content['coupon_created'], '2'); + $content['coupon_expired'] = generateDateTime($content['coupon_expired'], '2'); -// Free result -SQL_FREERESULT($result); + // Add the row template + $OUT .= loadTemplate('admin_list_coupon_row', true, $content); + } // END - while + + // Load main template + loadTemplate('admin_list_coupon', false, $OUT); + } else { + // No cashed coupons found + displayMessage('{--ADMIN_LIST_COUPON_404--}'); + } + + // Free result + SQL_FREERESULT($result); +} // [EOF] ?> diff --git a/inc/modules/admin/what-list_nickname.php b/inc/modules/admin/what-list_nickname.php new file mode 100644 index 0000000000..bc3e13d8e5 --- /dev/null +++ b/inc/modules/admin/what-list_nickname.php @@ -0,0 +1,56 @@ + diff --git a/inc/modules/sponsor/account.php b/inc/modules/sponsor/account.php index 88e358cf2d..bfe20c20ce 100644 --- a/inc/modules/sponsor/account.php +++ b/inc/modules/sponsor/account.php @@ -129,8 +129,7 @@ if (SQL_NUMROWS($result) == 1) { } } else { // Locked or so? - $STATUS = sponsorTranslateUserStatus($content['status']); - $GLOBALS['sponsor_output'] = displayMessage('{%message,SPONSOR_ACCOUNT_FAILED=' . $STATUS . '%}', true); + $GLOBALS['sponsor_output'] = displayMessage('{%message,SPONSOR_ACCOUNT_FAILED=' . $content['status'] . '%}', true); } } else { // Sponsor account not found diff --git a/inc/modules/sponsor/settings.php b/inc/modules/sponsor/settings.php index f65f420153..cee56805ac 100644 --- a/inc/modules/sponsor/settings.php +++ b/inc/modules/sponsor/settings.php @@ -115,8 +115,7 @@ if (SQL_NUMROWS($result) == 1) { } } else { // Locked or so? - $STATUS = sponsorTranslateUserStatus($content['status']); - $GLOBALS['sponsor_output'] = displayMessage('{%message,SPONSOR_ACCOUNT_FAILED=' . $STATUS . '%}', true); + $GLOBALS['sponsor_output'] = displayMessage('{%message,SPONSOR_ACCOUNT_FAILED=' . $content['status'] . '%}', true); } } else { // Sponsor account not found diff --git a/templates/de/html/admin/admin_edit_rallyes.tpl b/templates/de/html/admin/admin_edit_rallyes.tpl index 2d18ef7c88..eb35f5b9f9 100644 --- a/templates/de/html/admin/admin_edit_rallyes.tpl +++ b/templates/de/html/admin/admin_edit_rallyes.tpl @@ -1,3 +1,4 @@ +
@@ -13,3 +14,4 @@
+
diff --git a/templates/de/html/admin/admin_list_coupon.tpl b/templates/de/html/admin/admin_list_coupon.tpl index f383293dd7..c1e6868689 100644 --- a/templates/de/html/admin/admin_list_coupon.tpl +++ b/templates/de/html/admin/admin_list_coupon.tpl @@ -1,7 +1,7 @@
- @@ -9,15 +9,9 @@ - - @@ -36,7 +30,7 @@ $content - diff --git a/templates/de/html/admin/admin_list_coupon_row.tpl b/templates/de/html/admin/admin_list_coupon_row.tpl index 66b92ad8d5..adb7fb08e5 100644 --- a/templates/de/html/admin/admin_list_coupon_row.tpl +++ b/templates/de/html/admin/admin_list_coupon_row.tpl @@ -1,16 +1,10 @@ - - diff --git a/templates/de/html/admin/admin_list_coupon_usr.tpl b/templates/de/html/admin/admin_list_coupon_usr.tpl new file mode 100644 index 0000000000..f383293dd7 --- /dev/null +++ b/templates/de/html/admin/admin_list_coupon_usr.tpl @@ -0,0 +1,44 @@ +
+
+ {--ADMIN_LIST_CASHED_COUPONS_TITLE--}
{--COUPON_ID--} - {--_USERID--} - {?POINTS?} - {--COUPON_CASHED_ON--} - {--COUPON_CREATED_ON--}
- $content[coupon_id] - - {%pipe,generateUserProfileLink=$content[userid]%} + [$content[coupon_id]] {%pipe,translateComma=$content[points]%} - $content[cashed_on] - $content[coupon_created]
+ + + + + + + + + + + + + + +$content + + + +
+ {--ADMIN_LIST_CASHED_COUPONS_TITLE--} +
+ {--COUPON_ID--} + + {--_USERID--} + + {?POINTS?} + + {--COUPON_CASHED_ON--} + + {--COUPON_CREATED_ON--} + + {--COUPON_EXPIRED_ON--} + + {--COUPON_TOTAL_CREATED--} + + {--COUPON_TOTAL_CASHED--} + + {--COUPON_DESCRIPTION--} +
+
diff --git a/templates/de/html/admin/admin_list_coupon_usr_row.tpl b/templates/de/html/admin/admin_list_coupon_usr_row.tpl new file mode 100644 index 0000000000..66b92ad8d5 --- /dev/null +++ b/templates/de/html/admin/admin_list_coupon_usr_row.tpl @@ -0,0 +1,29 @@ + + + $content[coupon_id] + + + {%pipe,generateUserProfileLink=$content[userid]%} + + + {%pipe,translateComma=$content[points]%} + + + $content[cashed_on] + + + $content[coupon_created] + + + $content[coupon_expired] + + + {%pipe,translateComma=$content[total_created]%} + + + {%pipe,translateComma=$content[total_cashed]%} + + + $content[coupon_description] + + diff --git a/templates/de/html/admin/admin_list_sponsor_details.tpl b/templates/de/html/admin/admin_list_sponsor_details.tpl index d0e736f2b6..27d3d0ba42 100644 --- a/templates/de/html/admin/admin_list_sponsor_details.tpl +++ b/templates/de/html/admin/admin_list_sponsor_details.tpl @@ -7,7 +7,7 @@ {--SPONSOR_ID--}:  - $content[id] [{%pipe,sponsorTranslateUserStatus=$content[status]%}] + $content[id] [{%pipe,translateSponsorStatus=$content[status]%}] diff --git a/templates/de/html/admin/admin_list_sponsor_row.tpl b/templates/de/html/admin/admin_list_sponsor_row.tpl index be611a320f..e411602eb9 100644 --- a/templates/de/html/admin/admin_list_sponsor_row.tpl +++ b/templates/de/html/admin/admin_list_sponsor_row.tpl @@ -25,7 +25,7 @@ - [{%pipe,sponsorTranslateUserStatus=$content[status]%}] + [{%pipe,translateSponsorStatus=$content[status]%}] $content[sponsor_created] -- 2.30.2