Editing of network type handler partialy finished
authorRoland Häder <roland@mxchange.org>
Thu, 26 Nov 2009 18:25:54 +0000 (18:25 +0000)
committerRoland Häder <roland@mxchange.org>
Thu, 26 Nov 2009 18:25:54 +0000 (18:25 +0000)
.gitattributes
inc/language/network_de.php
inc/libs/network_functions.php
inc/modules/admin/what-list_network_types.php
inc/modules/admin/what-list_networks.php
templates/de/html/admin/admin_edit_network_types.tpl [new file with mode: 0644]
templates/de/html/admin/admin_edit_network_types_row.tpl [new file with mode: 0644]
templates/de/html/admin/admin_list_network_types.tpl

index 064b372..f359a01 100644 (file)
@@ -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
index 00572c1..b84fc4f 100644 (file)
@@ -50,17 +50,19 @@ addMessages(array(
        '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.",
        'ADMIN_NETWORK_NOTHING_REMOVED' => "Es wurden keine allgemeinen Daten gel&ouml;scht.",
-       'ADMIN_NETWORK_TYPES_404' => "Es wurden keine Werbearten zum Werbenetzwerk <span class=\"data\">%s</span> gefunden.",
        'ADMIN_NETWORK_ALREADY_ADDED' => "Ein Werbenetzwerk mit dem Kurznamen <span class=\"data\">%s</span> existiert bereits.",
-       'ADMIN_NETWORK_TYPE_HANDLE_ALREADY_ADDED' => "Ein Werbeart-Handler <span class=\"data\">%s</span> existiert bereits.",
        'ADMIN_NETWORK_DATA_NOT_ADDED' => "Das Werbenetzwerk mit dem Kurznamen <span class=\"data\">%s</span> wurde nicht hinzugef&uuml;gt.",
+       'ADMIN_NETWORK_TYPES_404' => "Es wurden keine Werbearten zum Werbenetzwerk <span class=\"data\">%s</span> gefunden.",
+       'ADMIN_NETWORK_TYPE_HANDLE_ALREADY_ADDED' => "Ein Werbeart-Handler <span class=\"data\">%s</span> existiert bereits.",
        'ADMIN_NETWORK_TYPE_NOT_ADDED' => "Der Werbeart-Handler <span class=\"data\">%s</span> wurde nicht hinzugef&uuml;gt.",
+       'ADMIN_NETWORK_TYPE_NOTHING_FOUND' => "Es wurden keine Werbart-Handler zum Editieren oder L&ouml;schen gefunden.",
        // - 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",
        'ADMIN_NETWORK_SELECT_TITLE' => "Werbenetzwerk ausw&auml;hlen",
        'ADMIN_NETWORK_TYPE_ADD_TITLE' => "Werbenetzwerk verwalten - Neue Werbeart hinzuf&uuml;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&uuml;gen",
        'ADMIN_NETWORK_TYPE_EDIT' => "Editieren",
        'ADMIN_NETWORK_TYPE_DELETE' => "L&ouml;schen",
+       'ADMIN_NETWORK_TYPE_CHANGE' => "Handler &auml;ndern",
        // - Success nots
        'ADMIN_NETWORK_UPDATED' => "Es wurden <span class=\"data\">%s</span> Eintr&auml;ge in den allgemeinen Daten aktualisiert.",
        'ADMIN_NETWORK_REMOVED' => "Es wurden <span class=\"data\">%s</span> Eintr&auml;ge aus den allgemeinen Dateen gel&ouml;scht.",
index 7b982e3..b19a5ed 100644 (file)
@@ -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?
index 14b05c6..cf204b7 100644 (file)
@@ -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'],
                );
index f10de48..35cb4f9 100644 (file)
@@ -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 (file)
index 0000000..023d068
--- /dev/null
@@ -0,0 +1,27 @@
+<div align="center">
+<form accept-charset="utf-8" action="{%url=modules.php?module=admin&amp;what=list_networks&amp;network=$content[network_data][network_id]&amp;do=changenetworktype%}" method="post">
+<table border="0" cellspacing="0" cellpadding="0" class="admin_table dashed">
+       <tr>
+               <td align="center" class="admin_title bottom" height="25" colspan="2">
+                       <div>
+                               <strong>{--ADMIN_NETWORK_TYPE_EDIT_TITLE--}</strong>
+                       </div>
+                       <div class="tiny">
+                               (<a href="$content[network_data][network_reflink]" title="$content[network_data][network_title]" target="_blank">$content[network_data][network_title]</a>)
+                       </div>
+               </td>
+       </tr>
+       $content[rows]
+       <tr>
+               <td colspan="2" class="admin_footer">
+                       <input type="reset" class="admin_reset" value="{--CLEAR_FORM--}" />
+                       <input type="submit" name="change" class="admin_submit" value="{--ADMIN_NETWORK_TYPE_CHANGE--}" />
+               </td>
+       </tr>
+</table>
+</form>
+
+<div class="admin_note">
+       {--ADMIN_NETWORK_TYPE_LIST_NOTE--}
+</div>
+</div>
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 (file)
index 0000000..c7d71a7
--- /dev/null
@@ -0,0 +1,25 @@
+<tr>
+       <td class="switch_sw$content[sw]" style="padding-left:5px">{--ADMIN_NETWORK_TYPE_HANDLE--}:</td>
+       <td class="switch_sw$content[sw]">
+               <input type="hidden" name="sel[$content[network_id]]" value="1" />
+               <input type="text" name="network_type_handle[$content[network_type_id]]" class="admin_normal" size="20" maxlength="255" value="$content[network_type_handle]" />
+       </td>
+</tr>
+<tr>
+       <td class="switch_sw$content[sw]" style="padding-left:5px">{--ADMIN_NETWORK_TYPE_API_URL--}:</td>
+       <td class="switch_sw$content[sw]">
+               <input type="text" name="network_type_api_url[$content[network_type_id]]" class="admin_normal" size="50" maxlength="255" value="$content[network_type_api_url]" />
+       </td>
+</tr>
+<tr>
+       <td class="switch_sw$content[sw]" style="padding-left:5px">{--ADMIN_NETWORK_TYPE_CLICK_URL--}:</td>
+       <td class="switch_sw$content[sw]">
+               <input type="text" name="network_type_click_url[$content[network_type_id]]" class="admin_normal" size="50" maxlength="255" value="$content[network_type_click_url]" />
+       </td>
+</tr>
+<tr>
+       <td class="switch_sw$content[sw] bottom" style="padding-left:5px">{--ADMIN_NETWORK_TYPE_BANNER_URL--}:</td>
+       <td class="switch_sw$content[sw] bottom">
+               <input type="text" name="network_type_banner_url[$content[network_type_id]]" class="admin_normal" size="50" maxlength="255" value="$content[network_type_banner_url]" />
+       </td>
+</tr>
index 410fb23..b99da7a 100644 (file)
@@ -1,5 +1,5 @@
 <div align="center">
-<form accept-charset="utf-8" action="{%url=modules.php?module=admin&amp;what=list_network_types&amp;&amp;network=$content[network_id]&amp;do=handlenetworktype%}" method="post">
+<form accept-charset="utf-8" action="{%url=modules.php?module=admin&amp;what=list_network_types&amp;network=$content[network_id]&amp;do=handlenetworktype%}" method="post">
 <table border="0" cellspacing="0" cellpadding="0" class="admin_table dashed">
        <tr>
                <td colspan="5" align="center" class="admin_title bottom">