From a2c7de83aee38352745f21273b04dc43963da9b7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Thu, 4 Oct 2012 20:36:59 +0000 Subject: [PATCH] Mailer project continued: - Extension ext-grade continued: + Language file added + XML template for listing grade_data entries added + First script to list entries in grade_data added - Generic admin "list" template added (you may use this for own XML-based scripts) - Other minor improvements - TODOs.txt updated --- .gitattributes | 3 + DOCS/TODOs.txt | 16 ++- inc/db/lib-mysql3.php | 14 +-- inc/db/lib.php | 3 +- inc/extensions/ext-grade.php | 34 ++--- inc/language/grade_de.php | 51 ++++++++ inc/modules/admin/what-list_ | 107 ++++++++++++++++ inc/modules/admin/what-list_grade_data.php | 92 ++++++++++++++ templates/xml/admin/admin_list_grade_data.xml | 116 ++++++++++++++++++ 9 files changed, 402 insertions(+), 34 deletions(-) create mode 100644 inc/language/grade_de.php create mode 100644 inc/modules/admin/what-list_ create mode 100644 inc/modules/admin/what-list_grade_data.php create mode 100644 templates/xml/admin/admin_list_grade_data.xml diff --git a/.gitattributes b/.gitattributes index 81b0cd72bf..bb41fca686 100644 --- a/.gitattributes +++ b/.gitattributes @@ -312,6 +312,7 @@ inc/language/earning_de.php svneol=native#text/plain inc/language/en.php svneol=native#text/plain inc/language/forced_de.php svneol=native#text/plain inc/language/funcoins_de.php svneol=native#text/plain +inc/language/grade_de.php svneol=native#text/plain inc/language/holiday_de.php svneol=native#text/plain inc/language/html_mail_de.php svneol=native#text/plain inc/language/imprint_de.php svneol=native#text/plain @@ -561,6 +562,7 @@ inc/modules/admin/what-guest_add.php svneol=native#text/plain inc/modules/admin/what-guestedit.php svneol=native#text/plain inc/modules/admin/what-holiday_list.php svneol=native#text/plain inc/modules/admin/what-holiday_remove.php svneol=native#text/plain +inc/modules/admin/what-list_ svneol=native#text/plain inc/modules/admin/what-list_admins_acls.php svneol=native#text/plain inc/modules/admin/what-list_autopurge.php svneol=native#text/plain inc/modules/admin/what-list_bank_package.php svneol=native#text/plain @@ -574,6 +576,7 @@ inc/modules/admin/what-list_email_max_rec.php svneol=native#text/plain inc/modules/admin/what-list_forced_ads.php svneol=native#text/plain inc/modules/admin/what-list_forced_campaigns.php svneol=native#text/plain inc/modules/admin/what-list_forced_costs.php svneol=native#text/plain +inc/modules/admin/what-list_grade_data.php svneol=native#text/plain inc/modules/admin/what-list_holiday.php svneol=native#text/plain inc/modules/admin/what-list_links.php svneol=native#text/plain inc/modules/admin/what-list_network_api_translation.php svneol=native#text/plain diff --git a/DOCS/TODOs.txt b/DOCS/TODOs.txt index 1fae91354a..ed9e13227c 100644 --- a/DOCS/TODOs.txt +++ b/DOCS/TODOs.txt @@ -69,7 +69,7 @@ ./inc/language/order_de.php:70: // @TODO Find better text ./inc/language/rallye_de.php:13: * @TODO Naming convention not applied for language strings * ./inc/language/refback_de.php:51: // @TODO Rewrite these constants to one -./inc/libs/admins_functions.php:521: // @TODO This can be, somehow, rewritten +./inc/libs/admins_functions.php:525: // @TODO This can be, somehow, rewritten ./inc/libs/bonus_functions.php:194: // @TODO Move this HTML to a template ./inc/libs/doubler_functions.php:44:// @TODO Lame description ./inc/libs/doubler_functions.php:93: // @TODO Can't this be moved into EL? @@ -114,8 +114,7 @@ ./inc/modules/admin/what-admins_mails.php:58: // @TODO Can this be rewritten to an API function? ./inc/modules/admin/what-bonus.php:46:// @TODO Unused at the moment ./inc/modules/admin/what-config_mods.php:55: // @TODO This can be moved into mysql-function.php, see checkModulePermissions() function -./inc/modules/admin/what-config_points.php:110: // @TODO Rewrite this to a filter -./inc/modules/admin/what-config_points.php:133: // @TODO Rewrite these two lines for new user_points columns (e.g. locked_order_points) with a filter +./inc/modules/admin/what-config_points.php:130: // @TODO Rewrite these two lines for new user_points columns (e.g. locked_order_points) with a filter ./inc/modules/admin/what-config_rallye_prices.php:222: // @TODO Rewrite these two constants ./inc/modules/admin/what-config_register.php:75: // @TODO Move this HTML code into a template ./inc/modules/admin/what-del_email.php:61: // @TODO Unused: cat_id, payment_id @@ -126,8 +125,7 @@ ./inc/modules/admin/what-guest_add.php:67: // @TODO Cant this be rewritten? ./inc/modules/admin/what-guest_add.php:80: // @TODO This can be somehow rewritten to a function ./inc/modules/admin/what-holiday_list.php:46:// @TODO Unused at the moment -./inc/modules/admin/what-list_admins_acls.php:101: // @TODO Rewrite this to a filter -./inc/modules/admin/what-list_admins_acls.php:129: // @TODO Rewrite this to filter 'run_sqls' +./inc/modules/admin/what-list_admins_acls.php:126: // @TODO Rewrite this to filter 'run_sqls' ./inc/modules/admin/what-list_autopurge.php:47:// @TODO Rewrite those lines to filter ./inc/modules/admin/what-list_bonus.php:137: // @TODO Can't this be moved into our expression language? ./inc/modules/admin/what-list_cats.php:54: // @TODO No longer needed? define('__CATEGORIES_BASE' , '' . getConfig('_DB_TYPE') . ' -> R.I.P.'); + reportBug(__FILE__, __LINE__, 'Cannot load database library ' . getConfig('_DB_TYPE') . ' -> R.I.P.'); } // END - if // Include abstraction layer diff --git a/inc/extensions/ext-grade.php b/inc/extensions/ext-grade.php index cedea5eb66..0ec4081d60 100644 --- a/inc/extensions/ext-grade.php +++ b/inc/extensions/ext-grade.php @@ -54,55 +54,55 @@ switch (getExtensionMode()) { // General and grade level data addDropTableSql('grade_data'); addCreateTableSql('grade_data', " -`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, +`grade_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, `grade_name` VARCHAR(255) NOT NULL DEFAULT '', `grade_description` TINYTEXT NOT NULL, `grade_parent_id` BIGINT(20) UNSIGNED NULL DEFAULT NULL, -PRIMARY KEY (`id`), UNIQUE (`grade_name`), -INDEX (`grade_parent_id`)", - 'Grade general data'); +INDEX (`grade_parent_id`), +PRIMARY KEY (`grade_id`)", + 'Grade data'); // Data for if a grade level has been reached addDropTableSql('grade_cash_data'); addCreateTableSql('grade_cash_data', " -`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, +`cash_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, `grade_cash_name` VARCHAR(255) NOT NULL DEFAULT '', `grade_cash_type` ENUM('DISCOUNT','BONUS') NOT NULL DEFAULT 'DISCOUNT', `reached_points` FLOAT(20,5) UNSIGNED NULL DEFAULT NULL, `reached_mails` BIGINT(20) UNSIGNED NULL DEFAULT NULL, `time_valid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, -PRIMARY KEY (`id`), -UNIQUE (`grade_cash_name`)", - 'Grade data if the grade have been "cashed"'); +UNIQUE (`grade_cash_name`), +PRIMARY KEY (`cash_id`)", + 'Data for "cashed" grades'); // Connection grade<->cash data addDropTableSql('grade_cash_connect'); addCreateTableSql('grade_cash_connect', " -`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, +`connect_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, `grade_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, `grade_cash_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, -PRIMARY KEY (`id`), UNIQUE INDEX `grade_cash` (`grade_id`,`grade_cash_id`), -INDEX (`grade_cash_id`)", +INDEX (`grade_cash_id`), +PRIMARY KEY (`connect_id`)", 'Grade<->cash data connection'); // Connection grade<->user data addDropTableSql('grade_user_connect'); addCreateTableSql('grade_user_connect', " -`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, +`connect_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT, `userid` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, `grade_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0, `grade_expired` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00', -PRIMARY KEY (`id`), UNIQUE (`userid`,`grade_id`), -INDEX (`grade_id`)", +INDEX (`grade_id`), +PRIMARY KEY (`connect_id`)", 'Grade<->user connection'); // Admin menu entries - addAdminMenuSql('grade', NULL, 'Einstufungen', 'Stufen Sie Ihre Mitglieder ein, die sie ab einer einstellbaren Anzahl an {?POINTS?} oder bestätigten Mails usw. erhalten und durch die Einstufung Ermäßigungen oder Sonderboni erhalten können.', 6); - addAdminMenuSql('grade', 'list_grades', 'Auflisten...', 'Listet alle Einstufungen auf, auch sind diese hier editierbar, neue hinzufügbar und löschbar.', 1); - addAdminMenuSql('grade', 'list_cash_grade', 'Ermäßigungen/Sonderboni', 'Listet alle Ermäßigungen/Sonderbi auf, auch sind diese hier editierbar, neue hinzufügbar und löschbar.', 2); + addAdminMenuSql('grade', NULL, 'Einstufungen', 'Stufen Sie Ihre Mitglieder ein, die sie ab einer einstellbaren Anzahl an {OPEN_CONFIG}POINTS{CLOSE_CONFIG} oder bestätigten Mails usw. erhalten und durch die Einstufung Ermäßigungen oder Sonderboni erhalten können.', 6); + addAdminMenuSql('grade', 'list_grade_data', 'Auflisten...', 'Listet alle Einstufungen auf, auch sind diese hier editierbar, neue hinzufügbar und löschbar.', 1); + addAdminMenuSql('grade', 'list_cash_grade', 'Ermäßigungen/Sonderboni', 'Listet alle Ermäßigungen/Sonderboni auf, auch sind diese hier editierbar, neue hinzufügbar und löschbar.', 2); addAdminMenuSql('grade', 'list_current_grades', 'Mitglieder-Einstufungen', 'Liste alle durch die Mitglieder aktuell erreichten Einstungen auf. Diese sind nicht editierbar (wir wollen ja nicht schummeln und bestimmten Mitgliedern bessere Einstufungen geben, oder? ;-) ).', 3); addAdminMenuSql('grade', 'config_grade', 'Einstellungen ...', 'Diverse Einstellungen zu den Einstufungen.', 4); diff --git a/inc/language/grade_de.php b/inc/language/grade_de.php new file mode 100644 index 0000000000..c92cb654b5 --- /dev/null +++ b/inc/language/grade_de.php @@ -0,0 +1,51 @@ + "Es wurde keine Auswahl getroffen, bitte wählen Sie mindestens eine Abstufung aus.", + 'ADMIN_GRADE_DATA_404' => "Es wurden keine Abstufungen gefunden.", +)); + +// [EOF] +?> diff --git a/inc/modules/admin/what-list_ b/inc/modules/admin/what-list_ new file mode 100644 index 0000000000..e190b12960 --- /dev/null +++ b/inc/modules/admin/what-list_ @@ -0,0 +1,107 @@ + 0) && (!ifPostContainsSelections('???_id'))) { + // Not found so output message + displayMessage('{--ADMIN_|||_NO_SELECTIONS--}'); + + // Abort here + return; +} // END - if + +// Edit or delete button hit? +if (isFormSent('edit')) { + // Show entries for editing + showEntriesByXmlCallback('admin_edit_show_!!!s'); + + // Do not show the list of URLs after this template + $show = false; +} elseif (isFormSent('do_edit')) { + // Change data of entries + showEntriesByXmlCallback('admin_edit_do_!!!s'); +} elseif (isFormSent('delete')) { + // Show entries for deletion + showEntriesByXmlCallback('admin_delete_show_!!!s'); + + // Do not show the list of URLs after this template + $show = false; +} elseif (isFormSent('do_delete')) { + // Remove entries from database + showEntriesByXmlCallback('admin_delete_do_!!!s'); +} elseif (isFormSent('lock')) { + // Un-/lock selected URLs. This does not work for pending URLs + showEntriesByXmlCallback('admin_lock_show_!!!s'); + + // Do not show the list of URLs after this template + $show = false; +} elseif (isFormSent('do_lock')) { + // Un-/lock selected URLs. This does not work for pending URLs + showEntriesByXmlCallback('admin_lock_do_!!!s'); +} elseif (isFormSent('undelete')) { + // Undelete selected URLs. This does only work for deleted URLs... ;-) + showEntriesByXmlCallback('admin_undelete_show_!!!s'); + + // Do not show the list of URLs after this template + $show = false; +} elseif (isFormSent('do_undelete')) { + // Undelete selected URLs. This does only work for deleted URLs... ;-) + showEntriesByXmlCallback('admin_undelete_do_!!!s'); +} + +// Show entries? +if ($show === false) { + // No, a form has already been show + return false; +} // END - if + +// List all URLs +showEntriesByXmlCallback('admin_list_!!!s'); + +// [EOF] +?> diff --git a/inc/modules/admin/what-list_grade_data.php b/inc/modules/admin/what-list_grade_data.php new file mode 100644 index 0000000000..173bcbe72f --- /dev/null +++ b/inc/modules/admin/what-list_grade_data.php @@ -0,0 +1,92 @@ + 0) && (!ifPostContainsSelections('grade_id'))) { + // Not found so output message + displayMessage('{--ADMIN_GRADE_DATA_NO_SELECTIONS--}'); + + // Abort here + return; +} // END - if + +// Edit or delete button hit? +if (isFormSent('edit')) { + // Show entries for editing + showEntriesByXmlCallback('admin_edit_show_grade_data'); + + // Do not show the list of URLs after this template + $show = false; +} elseif (isFormSent('do_edit')) { + // Change data of entries + showEntriesByXmlCallback('admin_edit_do_grade_data'); +} elseif (isFormSent('delete')) { + // Show entries for deletion + showEntriesByXmlCallback('admin_delete_show_grade_data'); + + // Do not show the list of URLs after this template + $show = false; +} elseif (isFormSent('do_delete')) { + // Remove entries from database + showEntriesByXmlCallback('admin_delete_do_grade_data'); +} + +// Show entries? +if ($show === false) { + // No, a form has already been show + return false; +} // END - if + +// List all URLs +showEntriesByXmlCallback('admin_list_grade_data'); + +// Add form for adding new entry +loadTemplate('admin_add_grade_data'); + +// [EOF] +?> diff --git a/templates/xml/admin/admin_list_grade_data.xml b/templates/xml/admin/admin_list_grade_data.xml new file mode 100644 index 0000000000..fa5afb10b4 --- /dev/null +++ b/templates/xml/admin/admin_list_grade_data.xml @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- 2.39.2