'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ütung",
'ADMIN_SURFBAR_COSTS' => "Kosten",
'ADMIN_SURFBAR_PAYMENT' => "Payment",
// 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 {
}
// 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
} // 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__);
// 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]
?>
{%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]%}
--- /dev/null
+<?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>
//-->
<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>
</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>
//-->
<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>
</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>