]> git.mxchange.org Git - mailer.git/commitdiff
Editing of network data completed
authorRoland Häder <roland@mxchange.org>
Mon, 9 Nov 2009 19:14:53 +0000 (19:14 +0000)
committerRoland Häder <roland@mxchange.org>
Mon, 9 Nov 2009 19:14:53 +0000 (19:14 +0000)
.gitattributes
inc/language/network_de.php
inc/libs/network_functions.php
inc/modules/admin/admin-inc.php
templates/de/html/admin/admin_del_networks.tpl [new file with mode: 0644]
templates/de/html/admin/admin_del_networks_row.tpl [new file with mode: 0644]
templates/de/html/admin/admin_edit_networks.tpl
templates/de/html/admin/admin_edit_networks_row.tpl

index 2db984e69aaeba201616bc5bbc76ff352c52f7c7..1f2d2a92cb2a59ac4b2f21ab95527961b1fcf22c 100644 (file)
@@ -976,6 +976,8 @@ templates/de/html/admin/admin_del_cats_row.tpl -text
 templates/de/html/admin/admin_del_email_bonus.tpl -text
 templates/de/html/admin/admin_del_email_normal.tpl -text
 templates/de/html/admin/admin_del_email_notify.tpl -text
+templates/de/html/admin/admin_del_networks.tpl -text
+templates/de/html/admin/admin_del_networks_row.tpl -text
 templates/de/html/admin/admin_del_payments.tpl -text
 templates/de/html/admin/admin_del_payments_row.tpl -text
 templates/de/html/admin/admin_del_sponsor.tpl -text
index 106fe359bef16b69f122a9f6d4473375684fc442..1c21386df2a788ce1532dc965a979f99d1aa14fb 100644 (file)
@@ -48,9 +48,11 @@ addMessages(array(
        'ADMIN_NETWORK_DO_404' => "Es wurde der Parameter &#39;do&#39; nicht &uuml;bermittelt.",
        'ADMIN_NETWORK_FORM_NOT_SENT' => "Es wurde kein bekanntes Formular versendet.",
        'ADMIN_NETWORK_NOTHING_FOUND' => "Es wurden keine Daten zum Editieren oder L&ouml;schen gefunden.",
+       'ADMIN_NETWORK_NOTHING_CHANGED' => "Es wurden keine &Auml;nderungen an den allgemeinen Daten ausgef&uuml;hrt.",
        // - Form titles
        'ADMIN_NETWORK_ADD_TITLE' => "Neues Werbenetzwerk hinzuf&uuml;gen - Allgemeine Daten",
        'ADMIN_NETWORK_EDIT_TITLE' => "Werbenetzwerk editieren - Allgemeine Daten",
+       'ADMIN_NETWORK_DELETE_TITLE' => "Werbenetzwerk l&ouml;schen - Allgemeine Daten",
        // - Link titles
        'ADMIN_NETWORK_LIST_TYPES_LINK_TITLE' => "Weiter zu den Werbearten",
        'ADMIN_NETWORK_LIST_PARAMS_LINK_TITLE' => "Weiter zu den Abfrageparametern",
@@ -61,6 +63,9 @@ addMessages(array(
        'ADMIN_NETWORK_EDIT' => "Editieren",
        'ADMIN_NETWORK_CHANGE' => "Daten &auml;ndern",
        'ADMIN_NETWORK_DELETE' => "L&ouml;schen",
+       'ADMIN_NETWORK_REMOVE' => "Daten entfernen",
+       // - Success nots
+       'ADMIN_NETWORK_UPDATED' => "Es wurden <span class=\"data\">%s</span> Eintr&auml;ge in den allgemeinen Daten aktualisiert.",
        // - Sponsor networks
        'ADMIN_NETWORK_NONE_SUPPORTED' => "Es sind noch keine Werbenetzwerke eingerichtet.",
        'ADMIN_NETWORK_SHORT_NAME' => "Kurzname",
index 998dbd42ed75b23ec2d62049130cf9de7f4e9146..6c186eac852e989ddb905d84b9fe7dfc797a6d26 100644 (file)
@@ -117,6 +117,18 @@ LIMIT 1",
        return $networkData;
 }
 
+// Updates given network (id) with data from array
+function doNetworkUpdateDataByArray ($id, $networkData) {
+       // Ids lower one are not accepted
+       if ($id < 1) {
+               // Not good, should be fixed
+               debug_report_bug('Network id ' . $id . ' is smaller than 1.');
+       } // END - if
+
+       // Just call our inner method
+       return adminSaveSettings($networkData, '_network_data', sprintf("`network_id`=%s", bigintval($id)), array(), false, false);
+}
+
 //------------------------------------------------------------------------------
 //                             Call-back functions
 //------------------------------------------------------------------------------
@@ -172,16 +184,27 @@ function doAdminNetworkProcessHandlenetworkForm () {
                                        // Add color
                                        $networkData['sw'] = $SW;
 
-                                       // Make selection box for network_request_type
-                                       $networkData['network_request_type'] = generateOptionList(
-                                               '/ARRAY/',
-                                               array('GET','POST'),
-                                               array(getMessage('ADMIN_NETWORK_REQUEST_TYPE_GET'), getMessage('ADMIN_NETWORK_REQUEST_TYPE_POST')),
-                                               $networkData['network_request_type']
-                                       );
+                                       if (isPostRequestElementSet('edit')) {
+                                               // Make selection box for network_request_type
+                                               $networkData['network_request_type'] = generateOptionList(
+                                                       '/ARRAY/',
+                                                       array('GET','POST'),
+                                                       array(getMessage('ADMIN_NETWORK_REQUEST_TYPE_GET'), getMessage('ADMIN_NETWORK_REQUEST_TYPE_POST')),
+                                                       $networkData['network_request_type']
+                                               );
+
+                                               // Add row template and switch color
+                                               $OUT .= loadTemplate('admin_edit_networks_row', true, $networkData);
+                                       } elseif (isPostRequestElementSet('del')) {
+                                               // Translate the request type
+                                               $networkData['network_request_type'] = getMessage('ADMIN_NETWORK_REQUEST_TYPE_' . $networkData['network_request_type']);
 
-                                       // Add row template and switch color
-                                       $OUT .= loadTemplate('admin_edit_networks_row', true, $networkData);
+                                               // Add row template and switch color
+                                               $OUT .= loadTemplate('admin_del_networks_row', true, $networkData);
+                                       } else {
+                                               // Problem!
+                                               debug_report_bug('Cannot detect edit/del.');
+                                       }
                                        $SW = 3 - $SW;
                                } // END - if
                        } // END - if
@@ -190,7 +213,14 @@ function doAdminNetworkProcessHandlenetworkForm () {
                // If we have no rows, we don't need to display the edit form
                if (!empty($OUT)) {
                        // Output main template
-                       loadTemplate('admin_edit_networks', false, $OUT);
+                       if (isPostRequestElementSet('edit')) {
+                               loadTemplate('admin_edit_networks', false, $OUT);
+                       } elseif (isPostRequestElementSet('del')) {
+                               loadTemplate('admin_del_networks', false, $OUT);
+                       } else {
+                               // Problem!
+                               debug_report_bug('Cannot detect edit/del.');
+                       }
 
                        // Don't display the list/add new form
                        $GLOBALS['network_display'] = false;
@@ -201,5 +231,50 @@ function doAdminNetworkProcessHandlenetworkForm () {
        } // END - if
 }
 
+// Changes given networks
+function doAdminNetworkProcessChangenetworkForm () {
+       // Do we have selections?
+       if (countPostSelection() > 0) {
+               // By default nothing is updated
+               $updated = 0;
+
+               // Something has been selected, so start updating them
+               foreach (postRequestElement('sel') as $id => $sel) {
+                       // Update this entry?
+                       if ($sel == 1) {
+                               // Init data array
+                               $networkData = array();
+
+                               // Transfer whole array, except 'sel'
+                               foreach (postRequestArray() as $key=>$entry) {
+                                       // Skip 'sel' and submit button
+                                       if (in_array($key, array('sel', 'change'))) continue;
+
+                                       // Do we have this enty?
+                                       if (!isset($entry[$id])) {
+                                               // Not found, needs fixing
+                                               debug_report_bug('No entry in key=' . $key . ', id=' . $id . ' found.');
+                                       } // END - if
+
+                                       // Add this entry
+                                       $networkData[$key] = $entry[$id];
+                               } // END - foreach
+
+                               // Update the network data
+                               $updated += doNetworkUpdateDataByArray($id, $networkData);
+                       } // END - if
+               } // END - foreach
+
+               // Do we have updates?
+               if ($updated > 0) {
+                       // Updates done
+                       loadTemplate('admin_settings_saved', false, sprintf(getMessage('ADMIN_NETWORK_UPDATED'), $updated));
+               } else {
+                       // Nothing changed
+                       loadTemplate('admin_settings_saved', false, getMessage('ADMIN_NETWORK_NOTHING_CHANGED'));
+               }
+       } // END - if
+}
+
 // [EOF]
 ?>
index c962ea20bf9a25003b127e37257c50944bf7bf06..7d38f8fa16b9719549f716baacd2003db3def04a 100644 (file)
@@ -561,16 +561,16 @@ function adminMenuSelectionBox_DEPRECATED ($mode, $default = '', $defid = '') {
 }
 
 // Wrapper for $_POST and adminSaveSettings
-function adminSaveSettingsFromPostData ($tableName = '_config', $whereStatement = '`config`=0', $translateComma = array(), $alwaysAdd = false) {
+function adminSaveSettingsFromPostData ($tableName = '_config', $whereStatement = '`config`=0', $translateComma = array(), $alwaysAdd = false, $displayMessage = true) {
        // Get the array
        $postData = postRequestArray();
 
        // Call the lower function
-       adminSaveSettings($postData, $tableName, $whereStatement, $translateComma, $alwaysAdd);
+       adminSaveSettings($postData, $tableName, $whereStatement, $translateComma, $alwaysAdd, $displayMessage);
 }
 
 // Save settings to the database
-function adminSaveSettings (&$postData, $tableName = '_config', $whereStatement = '`config`=0', $translateComma = array(), $alwaysAdd = false) {
+function adminSaveSettings (&$postData, $tableName = '_config', $whereStatement = '`config`=0', $translateComma = array(), $alwaysAdd = false, $displayMessage = true) {
        // Prepare all arrays, variables
        $DATA = array();
        $skip = false;
@@ -656,11 +656,17 @@ function adminSaveSettings (&$postData, $tableName = '_config', $whereStatement
        // Simply run generated SQL string
        SQL_QUERY($sql, __FUNCTION__, __LINE__);
 
+       // Remember affected rows
+       $affected = SQL_AFFECTEDROWS();
+
        // Rebuild cache
        rebuildCacheFile('config', 'config');
 
-       // Settings saved
-       loadTemplate('admin_settings_saved', false, getMessage('SETTINGS_SAVED'));
+       // Settings saved, so display message?
+       if ($displayMessage === true) loadTemplate('admin_settings_saved', false, getMessage('SETTINGS_SAVED'));
+
+       // Return affected rows
+       return $affected;
 }
 
 // Generate a selection box
diff --git a/templates/de/html/admin/admin_del_networks.tpl b/templates/de/html/admin/admin_del_networks.tpl
new file mode 100644 (file)
index 0000000..d9f2427
--- /dev/null
@@ -0,0 +1,22 @@
+<div align="center">
+<form accept-charset="utf-8" action="{?URL?}/modules.php?module=admin&amp;what=list_networks&amp;do=removenetwork" method="post">
+<table border="0" cellspacing="0" cellpadding="0" class="admin_table dashed">
+       <tr>
+               <td align="center" class="admin_title bottom" height="25" colspan="4">
+                       <strong>{--ADMIN_NETWORK_DELETE_TITLE--}</strong>
+               </td>
+       </tr>
+       $content
+       <tr>
+               <td colspan="4" class="admin_footer">
+                       <input type="reset" class="admin_reset" value="{--CLEAR_FORM--}" />
+                       <input type="submit" name="remove" class="admin_delete" value="{--ADMIN_NETWORK_REMOVE--}" />
+               </td>
+       </tr>
+</table>
+</form>
+
+<div class="admin_note">
+       {--ADMIN_NETWORK_LIST_NOTE--}
+</div>
+</div>
diff --git a/templates/de/html/admin/admin_del_networks_row.tpl b/templates/de/html/admin/admin_del_networks_row.tpl
new file mode 100644 (file)
index 0000000..a456914
--- /dev/null
@@ -0,0 +1,43 @@
+<tr><td colspan="4" class="switch_sw$content[sw] seperator" height="5">&nbsp;</td></tr>
+<tr>
+       <td class="switch_sw$content[sw]" style="padding-left:5px">{--ADMIN_NETWORK_TITLE--}:</td>
+       <td class="switch_sw$content[sw]">
+               <input type="hidden" name="sel[$content[network_id]]" value="1" />
+               $content[network_title]
+       </td>
+       <td class="switch_sw$content[sw]" style="padding-left:5px">{--ADMIN_NETWORK_SHORT_NAME--}:</td>
+       <td class="switch_sw$content[sw]">
+               $content[network_short_name]
+       </td>
+</tr>
+<tr><td colspan="4" class="switch_sw$content[sw] seperator" height="5">&nbsp;</td></tr>
+<tr>
+       <td class="switch_sw$content[sw]" style="padding-left:5px">{--ADMIN_NETWORK_REFLINK--}:</td>
+       <td class="switch_sw$content[sw]">
+               $content[network_reflink]
+       </td>
+       <td class="switch_sw$content[sw]" style="padding-left:5px">{--ADMIN_NETWORK_DATA_SEPERATOR--}:</td>
+       <td class="switch_sw$content[sw]">
+               $content[network_data_seperator]
+       </td>
+</tr>
+<tr><td colspan="4" class="switch_sw$content[sw] seperator" height="5">&nbsp;</td></tr>
+<tr>
+       <td class="switch_sw$content[sw]" style="padding-left:5px">{--ADMIN_NETWORK_REQUEST_TYPE--}:</td>
+       <td class="switch_sw$content[sw]">
+               $content[network_request_type]
+       </td>
+       <td class="switch_sw$content[sw]" style="padding-left:5px">{--ADMIN_NETWORK_ROW_SEPERATOR--}:</td>
+       <td class="switch_sw$content[sw]">
+               $content[network_row_seperator]
+       </td>
+</tr>
+<tr><td colspan="4" class="switch_sw$content[sw] seperator" height="5">&nbsp;</td></tr>
+<tr>
+       <td class="switch_sw$content[sw]" style="padding-left:5px">{--ADMIN_NETWORK_CHARSET--}:</td>
+       <td class="switch_sw$content[sw]">
+               $content[network_charset]
+       </td>
+       <td class="switch_sw$content[sw] seperator" colspan="2">&nbsp;</td>
+</tr>
+<tr><td colspan="4" class="bottom switch_sw$content[sw] seperator" height="6">&nbsp;</td></tr>
index b92fc35f1b650569b39be17cd40009e6c4ca55bc..b11db6156730e20f653d3acb24f86c3289ad881c 100644 (file)
@@ -15,4 +15,8 @@
        </tr>
 </table>
 </form>
+
+<div class="admin_note">
+       {--ADMIN_NETWORK_LIST_NOTE--}
+</div>
 </div>
index 131a5daf0aef9590b3f5945d2ed02ff5eb56eb0b..cf4da8d96274fe6df2e57351d566ced85da8f050 100644 (file)
@@ -2,6 +2,7 @@
 <tr>
        <td class="switch_sw$content[sw]" style="padding-left:5px">{--ADMIN_NETWORK_TITLE--}:</td>
        <td class="switch_sw$content[sw]">
+               <input type="hidden" name="sel[$content[network_id]]" value="1" />
                <input type="text" name="network_title[$content[network_id]]" class="admin_normal" size="20" maxlength="255" value="$content[network_title]" />
        </td>
        <td class="switch_sw$content[sw]" style="padding-left:5px">{--ADMIN_NETWORK_SHORT_NAME--}:</td>
@@ -24,7 +25,7 @@
 <tr>
        <td class="switch_sw$content[sw]" style="padding-left:5px">{--ADMIN_NETWORK_REQUEST_TYPE--}:</td>
        <td class="switch_sw$content[sw]">
-               <select name="network_request_type" class="admin_select" size="1">
+               <select name="network_request_type[$content[network_id]]" class="admin_select" size="1">
                        $content[network_request_type]
                </select>
        </td>