From: Roland Häder Date: Thu, 26 Nov 2009 18:25:54 +0000 (+0000) Subject: Editing of network type handler partialy finished X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=225103a2af4ebe180823d48913eac14825381134;p=mailer.git Editing of network type handler partialy finished --- diff --git a/.gitattributes b/.gitattributes index 064b372f13..f359a01835 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1000,6 +1000,8 @@ templates/de/html/admin/admin_edit_cats_row.tpl -text templates/de/html/admin/admin_edit_email.tpl -text templates/de/html/admin/admin_edit_email_row.tpl -text templates/de/html/admin/admin_edit_email_select.tpl -text +templates/de/html/admin/admin_edit_network_types.tpl -text +templates/de/html/admin/admin_edit_network_types_row.tpl -text templates/de/html/admin/admin_edit_networks.tpl -text templates/de/html/admin/admin_edit_networks_row.tpl -text templates/de/html/admin/admin_edit_payments.tpl -text diff --git a/inc/language/network_de.php b/inc/language/network_de.php index 00572c1b44..b84fc4f72e 100644 --- a/inc/language/network_de.php +++ b/inc/language/network_de.php @@ -50,17 +50,19 @@ addMessages(array( 'ADMIN_NETWORK_NOTHING_FOUND' => "Es wurden keine Daten zum Editieren oder Löschen gefunden.", 'ADMIN_NETWORK_NOTHING_CHANGED' => "Es wurden keine Änderungen an den allgemeinen Daten ausgeführt.", 'ADMIN_NETWORK_NOTHING_REMOVED' => "Es wurden keine allgemeinen Daten gelöscht.", - 'ADMIN_NETWORK_TYPES_404' => "Es wurden keine Werbearten zum Werbenetzwerk %s gefunden.", 'ADMIN_NETWORK_ALREADY_ADDED' => "Ein Werbenetzwerk mit dem Kurznamen %s existiert bereits.", - 'ADMIN_NETWORK_TYPE_HANDLE_ALREADY_ADDED' => "Ein Werbeart-Handler %s existiert bereits.", 'ADMIN_NETWORK_DATA_NOT_ADDED' => "Das Werbenetzwerk mit dem Kurznamen %s wurde nicht hinzugefügt.", + 'ADMIN_NETWORK_TYPES_404' => "Es wurden keine Werbearten zum Werbenetzwerk %s gefunden.", + 'ADMIN_NETWORK_TYPE_HANDLE_ALREADY_ADDED' => "Ein Werbeart-Handler %s existiert bereits.", 'ADMIN_NETWORK_TYPE_NOT_ADDED' => "Der Werbeart-Handler %s wurde nicht hinzugefügt.", + 'ADMIN_NETWORK_TYPE_NOTHING_FOUND' => "Es wurden keine Werbart-Handler zum Editieren oder Löschen gefunden.", // - Form titles 'ADMIN_NETWORK_ADD_TITLE' => "Neues Werbenetzwerk hinzufügen - Allgemeine Daten", 'ADMIN_NETWORK_EDIT_TITLE' => "Werbenetzwerk editieren - Allgemeine Daten", 'ADMIN_NETWORK_DELETE_TITLE' => "Werbenetzwerk löschen - Allgemeine Daten", 'ADMIN_NETWORK_SELECT_TITLE' => "Werbenetzwerk auswählen", 'ADMIN_NETWORK_TYPE_ADD_TITLE' => "Werbenetzwerk verwalten - Neue Werbeart hinzufügen", + 'ADMIN_NETWORK_TYPE_EDIT_TITLE' => "Werbeart-Handler editieren", // - Link titles 'ADMIN_NETWORK_LIST_TYPES_LINK_TITLE' => "Weiter zu den Werbearten", 'ADMIN_NETWORK_LIST_PARAMS_LINK_TITLE' => "Weiter zu den Abfrageparametern", @@ -79,6 +81,7 @@ addMessages(array( 'ADMIN_NETWORK_TYPE_ADD' => "Werbeart hinzufügen", 'ADMIN_NETWORK_TYPE_EDIT' => "Editieren", 'ADMIN_NETWORK_TYPE_DELETE' => "Löschen", + 'ADMIN_NETWORK_TYPE_CHANGE' => "Handler ändern", // - Success nots 'ADMIN_NETWORK_UPDATED' => "Es wurden %s Einträge in den allgemeinen Daten aktualisiert.", 'ADMIN_NETWORK_REMOVED' => "Es wurden %s Einträge aus den allgemeinen Dateen gelöscht.", diff --git a/inc/libs/network_functions.php b/inc/libs/network_functions.php index 7b982e3ab7..b19a5ede3d 100644 --- a/inc/libs/network_functions.php +++ b/inc/libs/network_functions.php @@ -148,6 +148,40 @@ LIMIT 1", return $networkData; } +// "Getter" for a network type data by provided id number +function getNetworkTypeDataById ($id) { + // Ids lower one are not accepted + if ($id < 1) { + // Not good, should be fixed + debug_report_bug('Network type id ' . $id . ' is smaller than 1.'); + } // END - if + + // By default we have no data + $networkTypeData = array(); + + // Query for the network data + $result = SQL_QUERY_ESC("SELECT + `network_type_id`, `network_id`, `network_type_handle`, `network_type_api_url`, `network_type_click_url`, `network_type_banner_url` +FROM + `{?_MYSQL_PREFIX?}_network_types` +WHERE + `network_type_id`=%s +LIMIT 1", + array(bigintval($id)), __FUNCTION__, __LINE__); + + // Do we have an entry? + if (SQL_NUMROWS($result) == 1) { + // Then get it + $networkTypeData = SQL_FETCHARRAY($result); + } // END - if + + // Free result + SQL_FREERESULT($result); + + // Return result + return $networkTypeData; +} + // Updates given network (id) with data from array function doNetworkUpdateDataByArray ($id, $networkData) { // Ids lower one are not accepted @@ -313,6 +347,70 @@ function doAdminNetworkProcessHandlenetworkForm () { } // END - if } +// Handle network type form +function doAdminNetworkProcessHandlenetworktypeForm () { + // Do we have selections? + if (countPostSelection() > 0) { + // Load network data + $networkData = getNetworkDataById(getRequestElement('network')); + + // Something has been selected, so start displaying one by one + $SW = 2; $OUT = ''; + foreach (postRequestElement('sel') as $id => $sel) { + // Is this selected? + if ($sel == 1) { + // Load this network's data + $networkTypeData = getNetworkTypeDataById($id); + + // Do we have found the network? + if (count($networkTypeData) > 0) { + // Add color + $networkTypeData['sw'] = $SW; + + if (isPostRequestElementSet('edit')) { + // Add row template for deleting + $OUT .= loadTemplate('admin_edit_network_types_row', true, $networkTypeData); + } elseif (isPostRequestElementSet('del')) { + // Add row template for deleting + $OUT .= loadTemplate('admin_del_network_types_row', true, $networkTypeData); + } else { + // Problem! + debug_report_bug('Cannot detect edit/del.'); + } + + // Switch colors + $SW = 3 - $SW; + } // END - if + } // END - if + } // END - foreach + + // If we have no rows, we don't need to display the edit form + if (!empty($OUT)) { + // Prepare content for template + $content = array( + 'rows' => $OUT, + 'network_data' => getNetworkDataById(getRequestElement('network')) + ); + + // Output main template + if (isPostRequestElementSet('edit')) { + loadTemplate('admin_edit_network_types', false, $content); + } elseif (isPostRequestElementSet('del')) { + loadTemplate('admin_del_network_types', false, $content); + } else { + // Problem! + debug_report_bug('Cannot detect edit/del.'); + } + + // Don't display the list/add new form + $GLOBALS['network_display'] = false; + } else { + // Nothing selected/found + loadTemplate('admin_settings_saved', false, getMessage('ADMIN_NETWORK_TYPE_NOTHING_FOUND')); + } + } // END - if +} + // Changes given networks function doAdminNetworkProcessChangenetworkForm () { // Do we have selections? diff --git a/inc/modules/admin/what-list_network_types.php b/inc/modules/admin/what-list_network_types.php index 14b05c6c6d..cf204b7f7f 100644 --- a/inc/modules/admin/what-list_network_types.php +++ b/inc/modules/admin/what-list_network_types.php @@ -50,9 +50,18 @@ if (doVerifyExpertSettings() != 'agreed') { return; } // END - if +// By default we should display list/add new forms +$GLOBALS['network_display'] = true; + // Handle form here doNetworkHandleForm(); +// Display forms? +if ($GLOBALS['network_display'] === false) { + // Abort here + return; +} // END - if + // Do we have a network selected? if (isGetRequestElementSet('network')) { // Get its data for template @@ -86,7 +95,7 @@ ORDER BY // Prepare data for template $content = array( 'rows' => $OUT, - 'network_id' => getRequestElement('network_id'), + 'network_id' => getRequestElement('network'), 'network_title' => $networkData['network_title'], 'network_reflink' => $networkData['network_reflink'], ); diff --git a/inc/modules/admin/what-list_networks.php b/inc/modules/admin/what-list_networks.php index f10de48b85..35cb4f9b07 100644 --- a/inc/modules/admin/what-list_networks.php +++ b/inc/modules/admin/what-list_networks.php @@ -50,12 +50,12 @@ if (doVerifyExpertSettings() != 'agreed') { return; } // END - if -// Handle form here -doNetworkHandleForm(); - // By default we should display list/add new forms $GLOBALS['network_display'] = true; +// Handle form here +doNetworkHandleForm(); + // Display forms? if ($GLOBALS['network_display'] === false) { // Abort here diff --git a/templates/de/html/admin/admin_edit_network_types.tpl b/templates/de/html/admin/admin_edit_network_types.tpl new file mode 100644 index 0000000000..023d068c52 --- /dev/null +++ b/templates/de/html/admin/admin_edit_network_types.tpl @@ -0,0 +1,27 @@ +
+
+ + + + + $content[rows] + + + +
+
+ {--ADMIN_NETWORK_TYPE_EDIT_TITLE--} +
+ +
+
+ +
+ {--ADMIN_NETWORK_TYPE_LIST_NOTE--} +
+
diff --git a/templates/de/html/admin/admin_edit_network_types_row.tpl b/templates/de/html/admin/admin_edit_network_types_row.tpl new file mode 100644 index 0000000000..c7d71a7372 --- /dev/null +++ b/templates/de/html/admin/admin_edit_network_types_row.tpl @@ -0,0 +1,25 @@ + + {--ADMIN_NETWORK_TYPE_HANDLE--}: + + + + + + + {--ADMIN_NETWORK_TYPE_API_URL--}: + + + + + + {--ADMIN_NETWORK_TYPE_CLICK_URL--}: + + + + + + {--ADMIN_NETWORK_TYPE_BANNER_URL--}: + + + + diff --git a/templates/de/html/admin/admin_list_network_types.tpl b/templates/de/html/admin/admin_list_network_types.tpl index 410fb236f6..b99da7a114 100644 --- a/templates/de/html/admin/admin_list_network_types.tpl +++ b/templates/de/html/admin/admin_list_network_types.tpl @@ -1,5 +1,5 @@
-
+