]> git.mxchange.org Git - mailer.git/commitdiff
Some fixes,re-orders and ext-surfbar actions are now XML-enabled
authorRoland Häder <roland@mxchange.org>
Mon, 11 Jul 2011 13:06:40 +0000 (13:06 +0000)
committerRoland Häder <roland@mxchange.org>
Mon, 11 Jul 2011 13:06:40 +0000 (13:06 +0000)
inc/language/surfbar_de.php
inc/libs/surfbar_functions.php
inc/modules/admin/admin-inc.php
inc/modules/admin/what-list_surfbar_actions.php
templates/de/html/admin/admin_list_surfbar_actions_row.tpl
templates/xml/admin/admin_list_surfbar_actions.xml [new file with mode: 0644]
templates/xml/admin/admin_list_surfbar_urls.xml
templates/xml/admin_list_data_template.xml

index 27471898807f9c22bbf69e1f356070d6b581338e..8ee9be6d9e46f69b55df1c614a99a8ad23197375 100644 (file)
@@ -81,7 +81,8 @@ addMessages(array(
        'ADMIN_LIST_SURFBAR_ACTIONS_TITLE' => "Mitglieder-Aktionen der Surfbar auflisten",
 
        // General admin text
-       'ADMIN_SURFBAR_NO_URLS_FOUND' => "Es konnten keine URLs in der Surfbar gefunden werden.",
+       'ADMIN_SURFBAR_URLS_404' => "Es konnten keine URLs in der Surfbar gefunden werden.",
+       'ADMIN_SURFBAR_ACTIONS_404' => "Es konnten keine Mitgliederaktionen in der Surfbar gefunden werden.",
        'ADMIN_SURFBAR_REWARD' => "Verg&uuml;tung",
        'ADMIN_SURFBAR_COSTS' => "Kosten",
        'ADMIN_SURFBAR_PAYMENT' => "Payment",
index b3aea55d4382ebc70019faf281ad5f2f46f02e9f..739465d07dc436319b0b174fb41042cdf99be7ae 100644 (file)
@@ -733,7 +733,7 @@ function translateSurfbarLimit ($limit) {
 // Translate the URL status
 function translateSurfbarUrlStatus ($status) {
        // NULL must be handled carfefully
-       if (is_null($status)) {
+       if ((is_null($status)) || (trim($status) == '')) {
                // Is NULL, so return other language string
                return '{--SURFBAR_URL_STATUS_NONE--}';
        } else {
index db9353b4efa08d18adf77b7624a476eb3f2d164c..5a23e398d0a2ef1943ec66597a0cbf6f4dd47464 100644 (file)
@@ -1116,7 +1116,7 @@ function adminUndeleteEntriesConfirm ($IDs, $table, $columns=array(), $filterFun
 }
 
 // List all given rows (callback function from XML)
-function adminListEntries ($tableTemplate, $rowTemplate, $tableName, $columns, $whereColumns, $orderByColumns, $callbackColumns, $extraParameters, $noEntryMessageId) {
+function adminListEntries ($tableTemplate, $rowTemplate, $noEntryMessageId, $tableName, $columns, $whereColumns, $orderByColumns, $callbackColumns, $extraParameters = array()) {
        // Verify that tableName and columns are not empty
        if (count($tableName) != 1) {
                // No tableName specified
@@ -1184,11 +1184,11 @@ function adminListEntries ($tableTemplate, $rowTemplate, $tableName, $columns, $
        } // END - if
 
        // Now handle all over to the inner function which will execute the listing
-       doAdminListEntries($SQL, $tableTemplate, $rowTemplate, $callbackColumns, $extraParameters, $noEntryMessageId);
+       doAdminListEntries($SQL, $tableTemplate, $noEntryMessageId, $rowTemplate, $callbackColumns, $extraParameters = array());
 }
 
 // Do the listing of entries
-function doAdminListEntries($SQL, $tableTemplate, $rowTemplate, $callbackColumns, $extraParameters, $noEntryMessageId) {
+function doAdminListEntries($SQL, $tableTemplate, $noEntryMessageId, $rowTemplate, $callbackColumns, $extraParameters = array()) {
        // Run the SQL query
        $result = SQL_QUERY($SQL, __FUNCTION__, __LINE__);
 
index ff95f1c49410c664abee80bcf0313f5fedb2b390..c85ae51be8b14adec9100ac2d2c874c686f339fd 100644 (file)
@@ -43,39 +43,56 @@ if ((!defined('__SECURITY')) || (!isAdmin())) {
 // Add description as navigation point
 addYouAreHereLink('admin', __FILE__);
 
-// Load all actions
-$result = SQL_QUERY("SELECT
-       `actions_id`,
-       `actions_status`,
-       `actions_action`,
-       `actions_new_status`
-FROM
-       `{?_MYSQL_PREFIX?}_surfbar_actions`
-ORDER BY
-       `actions_status` ASC,
-       `actions_action` ASC", __FILE__, __LINE__);
+// By default show the list...
+$show = true;
 
-// Entries found?
-if (!SQL_HASZERONUMS($result)) {
-       // List all entries
-       $OUT = '';
-       while ($content = SQL_FETCHARRAY($result)) {
-               // "Translate" some data
-               $content['actions_action'] = '{--MEMBER_SURFBAR_ACTION_' . strtoupper($content['actions_action']) . '_SUBMIT--}', ;
+// Edit or delete button hit?
+if (isFormSent('edit')) {
+       // Show entries for editing
+       showEntriesByXmlCallback('admin_edit_show_surfbar_actions');
 
-               // Load row template
-               $OUT .= loadTemplate('admin_list_surfbar_actions_row', true, $content);
-       } // END - while
+       // Do not show the list of URLs after this template
+       $show = false;
+} elseif (isFormSent('do_edit')) {
+       // Change data of entries
+       showEntriesByXmlCallback('admin_edit_do_surfbar_actions');
+} elseif (isFormSent('delete')) {
+       // Show entries for deletion
+       showEntriesByXmlCallback('admin_delete_show_surfbar_actions');
 
-       // Load main template
-       loadTemplate('admin_list_surfbar_actions', false, $OUT);
-} else {
-       // No entries found, very bad!
-       displayMessage('{--ADMIN_SURFBAR_NO_ACTIONS--}');
+       // Do not show the list of URLs after this template
+       $show = false;
+} elseif (isFormSent('do_delete')) {
+       // Remove entries from database
+       showEntriesByXmlCallback('admin_delete_do_surfbar_actions');
+} elseif (isFormSent('lock')) {
+       // Un-/lock selected URLs. This does not work for pending URLs
+       showEntriesByXmlCallback('admin_lock_show_surfbar_actions');
+
+       // 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_surfbar_actions');
+} elseif (isFormSent('undelete')) {
+       // Undelete selected URLs. This does only work for deleted URLs... ;-)
+       showEntriesByXmlCallback('admin_undelete_show_surfbar_actions');
+
+       // 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_surfbar_actions');
 }
 
-// Free result
-SQL_FREERESULT($result);
+// Show entries?
+if ($show === false) {
+       // No, a form has already been show
+       return false;
+} // END - if
+
+// List all URLs
+showEntriesByXmlCallback('admin_list_surfbar_actions');
 
 // [EOF]
 ?>
index cf9d4659c12f584987a53ea81df2bff22f3cf86f..d08d4d1c1165c2cebda58dd4f4feba3bcc08e0c7 100644 (file)
@@ -6,7 +6,7 @@
                {%pipe,translateSurfbarUrlStatus=$content[actions_status]%}
        </td>
        <td align="center" class="bottom right {%template,ColorSwitch%}">
-               $content[actions_action]
+               {%pipe,translateMemberSurfbarActionToSubmit=$content[actions_action]%}
        </td>
        <td align="center" class="bottom {%template,ColorSwitch%}">
                {%pipe,translateSurfbarUrlStatus=$content[actions_new_status]%}
diff --git a/templates/xml/admin/admin_list_surfbar_actions.xml b/templates/xml/admin/admin_list_surfbar_actions.xml
new file mode 100644 (file)
index 0000000..7e231e1
--- /dev/null
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+This template provides meta data for listing actions of the surfbar in the
+admin area.
+
+@author                Roland Haeder <webmaster@mxchange.org>
+@version       0.2.1-FINAL
+@copyright     (c) 2003 - 2009 by Roland Haeder
+@copyright     (c) 2009 - 2011 by Mailer Developer Team
+@license       GNU GPL 2.0 or any newer version
+@link          http://www.mxchange.org
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+MA  02110-1301  USA
+//-->
+<admin-list-data>
+       <!--
+       Call-back function, the extracted data from this XML will then be re-read
+       from that function. The most common function this XML uses is
+       adminListEntries() so mostly you can leave this alone unless you have JOINs.
+       //-->
+       <callback-function type="string" value="adminListEntries" />
+       <!--
+       Now we need information which template should be loaded and which functions
+       shall be called back. So lets start with the main list template. This mostly
+       requires no call-back function.
+       //-->
+       <list-template type="string" value="admin_list_surfbar_actions" />
+       <!--
+       The template for all rows, mostly this name has a '_row' suffix and again,
+       no call-back function is usually required.
+       //-->
+       <list-row-template type="string" value="admin_list_surfbar_actions_row" />
+       <!--
+       Message id to display if no entry could be found
+       //-->
+       <no-entry-found-message type="string" value="ADMIN_SURFBAR_ACTIONS_404" />
+       <!--
+       The table(s) we shall grab the data from, all as list.
+       //-->
+       <data-tables>
+               <!--
+               A single table entry, with alias and without the configurable
+               _MYSQL_PREFIX. You can specify the table's name or alias later on.
+               //-->
+               <data-table type="string" alias="" value="surfbar_actions" />
+               <!--
+               Columns to perform the SELECT statement on, with alias and name plus which table.
+               //-->
+               <select-data-from-list>
+                       <!--
+                       A single entry with table name (can be left empty), value (must
+                       always be set), alias (again can be left empty) and SQL function
+                       (can also be left empty) which shall be applied on the column.
+                       //-->
+                       <select-data-from-list-entry type="string" table="" value="actions_id" alias="" function="" />
+                       <select-data-from-list-entry type="string" table="" value="actions_status" alias="" function="" />
+                       <select-data-from-list-entry type="string" table="" value="actions_action" alias="" function="" />
+                       <select-data-from-list-entry type="string" table="" value="actions_new_status" alias="" function="" />
+               </select-data-from-list>
+               <!--
+               And the column list to perform the WHERE statement on.
+               //-->
+               <where-select-from-list>
+               </where-select-from-list>
+               <!--
+               Columns to perform the ORDER BY statement (GROUP BY is not yet supported)
+               //-->
+               <order-by-list>
+                       <!--
+                       A single entry to perform the ORDER BY statement on, see above WHERE entry for details.
+                       //-->
+                       <order-by-list-entry type="string" table="" order="actions_status" value="ASC" />
+                       <order-by-list-entry type="string" table="" order="actions_action" value="ASC" />
+               </order-by-list>
+       </data-tables>
+       <!--
+       List all column names from the 'select-data-from-list' node here, but now
+       with call-back informations. The list must only contain those entries where
+       a call-back function shall be called for.
+       //-->
+       <column-callback-list>
+       </column-callback-list>
+</admin-list-data>
index 03391becf73e1a70021de9069e72da2072e15c80..dfe1d9050cb0cf32b2385d83411b773befc436a3 100644 (file)
@@ -44,6 +44,10 @@ MA  02110-1301  USA
        //-->
        <list-row-template type="string" value="admin_list_surfbar_urls_row" />
        <!--
+       Message id to display if no entry could be found
+       //-->
+       <no-entry-found-message type="string" value="ADMIN_SURFBAR_URLS_404" />
+       <!--
        The table(s) we shall grab the data from, all as list.
        //-->
        <data-tables>
@@ -123,8 +127,4 @@ MA  02110-1301  USA
                        </callback-extra-parameter-list>
                </column-callback-list-entry>
        </column-callback-list>
-       <!--
-       Message id to display if no entry could be found
-       //-->
-       <no-entry-found-message type="string" value="ADMIN_SURFBAR_NO_URLS_FOUND" />
 </admin-list-data>
index e47c537c8f7ce7cac877f6b8b286118a0ba6d834..8fc22d2a10191bb0dc168ae533c140e8bffe3d7b 100644 (file)
@@ -47,6 +47,10 @@ MA  02110-1301  USA
        //-->
        <list-row-template type="string" value="admin_list_foo_data_row" />
        <!--
+       Message id to display if no entry could be found
+       //-->
+       <no-entry-found-message type="string" value="ADMIN_FOO_404" />
+       <!--
        The table(s) we shall grab the data from, all as list.
        //-->
        <data-tables>
@@ -176,8 +180,4 @@ MA  02110-1301  USA
                        </callback-extra-parameter-list>
                </column-callback-list-entry>
        </column-callback-list>
-       <!--
-       Message id to display if no entry could be found
-       //-->
-       <no-entry-found-message type="string" value="ADMIN_SURFBAR_NO_URLS_FOUND" />
 </admin-list-data>