]> git.mxchange.org Git - mailer.git/commitdiff
Generic function accepts eights (!) but optional parameter $callback, ext-network...
authorRoland Häder <roland@mxchange.org>
Thu, 29 Jul 2010 23:20:57 +0000 (23:20 +0000)
committerRoland Häder <roland@mxchange.org>
Thu, 29 Jul 2010 23:20:57 +0000 (23:20 +0000)
- The generic function generateOptionList() does now accept an optional eights
  parameter $callback. This is already used in ext-network to 'translate' values
  from column translation_name and can be any valid call-back function passed to
  call_user_func_array().
- Extension ext-network does now have very basic API array index translations
- TODOs.txt updated

DOCS/TODOs.txt
inc/extensions/ext-network.php
inc/language/network_de.php
inc/libs/network_functions.php
inc/modules/admin/what-list_network_api_translation.php
inc/mysql-manager.php
templates/de/html/admin/admin_add_network_type.tpl

index 0a0fe07f243b9e5078f16268f536d77323cf636c..87b0400e2e784509ad90ccf9c6a5c62a996919c5 100644 (file)
 ./inc/modules/order.php:76:            // @TODO Unused: 2,4
 ./inc/monthly/monthly_bonus.php:69:    // @TODO Rewrite this to a filter
 ./inc/mysql-manager.php:1173:  // @TODO Rewrite this to a filter
-./inc/mysql-manager.php:1420:                  // @TODO Try to rewrite this to $content = SQL_FETCHARRAY()
-./inc/mysql-manager.php:1518:  // @TODO Rewrite this to a filter
-./inc/mysql-manager.php:1885:                  // @TODO Rewrite this to a filter
-./inc/mysql-manager.php:1929:// @TODO Fix inconsistency between last_module and getWhat()
+./inc/mysql-manager.php:1428:                  // @TODO Try to rewrite this to $content = SQL_FETCHARRAY()
+./inc/mysql-manager.php:1536:  // @TODO Rewrite this to a filter
+./inc/mysql-manager.php:1903:                  // @TODO Rewrite this to a filter
+./inc/mysql-manager.php:1947:// @TODO Fix inconsistency between last_module and getWhat()
 ./inc/mysql-manager.php:370:   // @TODO Try to rewrite this to one or more functions
 ./inc/mysql-manager.php:46:// @TODO Can we cache this?
 ./inc/reset/reset_beg.php:51:// @TODO This should be converted in a daily beg rallye
 ### ### DEPRECATION FOLLOWS: ### ###
 ./inc/modules/admin/admin-inc.php:439:// @DEPRECATED
 ./inc/modules/admin/what-list_network_array_translation.php:2:// @DEPRECATED
+./inc/modules/admin/what-list_network_translations.php:2:// @DEPRECATED
 ./templates/de/html/admin/admin_add_banner.tpl:1:<!-- @DEPRECATED //-->
 ./templates/de/html/admin/admin_add_network_array_translation.tpl:1:<!-- @DEPRECATED //-->
 ./templates/de/html/admin/admin_admin_add.tpl:1:<!-- @DEPRECATED //-->
index 76cade97fa5ece978039238c29ba744c1ad9a290..34929498f932b1ba54daf6e4bf497e395dadd35c 100644 (file)
@@ -213,6 +213,16 @@ PRIMARY KEY (`network_reload_id`)
 ) TYPE={?_TABLE_TYPE?} COMMENT='Reload locks'");
 
                // Insert API response array translations, these will be used for calling the right filter function
+               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_translations` (`network_translation_name`) VALUES ('id')");
+               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_translations` (`network_translation_name`) VALUES ('name')");
+               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_translations` (`network_translation_name`) VALUES ('alternate_text')");
+               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_translations` (`network_translation_name`) VALUES ('reload')");
+               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_translations` (`network_translation_name`) VALUES ('remain')");
+               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_translations` (`network_translation_name`) VALUES ('reward')");
+               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_translations` (`network_translation_name`) VALUES ('banner_id')");
+               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_translations` (`network_translation_name`) VALUES ('size')");
+               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_translations` (`network_translation_name`) VALUES ('text')");
+               addExtensionSql("INSERT INTO `{?_MYSQL_PREFIX?}_network_translations` (`network_translation_name`) VALUES ('minimum_stay')");
 
                // Insert error code types
                // - Affiliate id or interface password wrong
index ed5faca2154176b4ae06ed8324641c0341ba5a33..28ea78c5a1da8a9b74d3b573c86d8f9233352257 100644 (file)
@@ -206,6 +206,17 @@ addMessages(array(
        'ADMIN_NETWORK_REQUESTS_DEPLETED_ERROR_CODE' => "API-Abfragen ersch&ouml;pft",
        'ADMIN_NETWORK_REQUEST_PARAMETER_INCOMPLETE_ERROR_CODE' => "API-Abfrageparameter nicht komplett",
        'ADMIN_NETWORK_SITE_ID_NOT_ALLOWED_TYPE_ERROR_CODE' => "Seiten-Id nicht freigegeben",
+       // Text-represations of column translate_name
+       'ADMIN_NETWORK_TRANSLATE_ALTERNATE_TEXT_NAME' => "Alternativer Bildtext",
+       'ADMIN_NETWORK_TRANSLATE_BANNER_ID_NAME' => "Banner-Id",
+       'ADMIN_NETWORK_TRANSLATE_ID_NAME' => "Kampagnen-Id",
+       'ADMIN_NETWORK_TRANSLATE_MINIMUM_STAY_NAME' => "Mindestauffenthalt",
+       'ADMIN_NETWORK_TRANSLATE_NAME_NAME' => "Kampagnen-Name",
+       'ADMIN_NETWORK_TRANSLATE_RELOAD_NAME' => "Reloadzeit",
+       'ADMIN_NETWORK_TRANSLATE_REMAIN_NAME' => "Mindestanzahl restlicher Klicks",
+       'ADMIN_NETWORK_TRANSLATE_REWARD_NAME' => "Mindestverg&uuml;tung",
+       'ADMIN_NETWORK_TRANSLATE_SIZE_NAME' => "Bannerformat",
+       'ADMIN_NETWORK_TRANSLATE_TEXT_NAME' => "Werbetext",
 ));
 
 // [EOF]
index de034d1382d0ddb8151a874fa9c2aa11ff1233cc..228fb839826657e48159b76685fd78dec0ecf5ae 100644 (file)
@@ -567,7 +567,7 @@ function generateNetworkTranslationOptions ($default = '') {
                        '',
                        '',
                        $GLOBALS['network_translation_disabled'],
-                       'ADMIN_NETWORK_TRANSLATION_'
+                       'translateNetworkTranslationName'
                );
        } // END - if
 
@@ -575,6 +575,12 @@ function generateNetworkTranslationOptions ($default = '') {
        return $GLOBALS['network_translation'][$default];
 }
 
+// Translates 'translate_name' for e.g. templates
+function translateNetworkTranslationName ($name) {
+       // Get the message id
+       return getMessage('ADMIN_NETWORK_TRANSLATE_' . strtoupper($name) . '_NAME');
+}
+
 //------------------------------------------------------------------------------
 //                             Call-back functions
 //------------------------------------------------------------------------------
@@ -1126,7 +1132,6 @@ function doExpressionNetwork ($data) {
        // Return it
        return $code;
 }
-
 // [EOF]
 ?>
 
index 4a338dfcafac7dbfb1a2d29a9303212b5e86dd18..3f3fa689a4b2a4048bf51fafb8886bb75edbc5da 100644 (file)
@@ -124,7 +124,6 @@ ORDER BY
 
        // Add options list for network type
        $networkData['translation_index'] = (SQL_NUMROWS($result) + 1);
-       $networkData['type_options']      = generateNetworkTypeOptions(getRequestParameter('network_type_id'));
 
        // Free result
        SQL_FREERESULT($result);
index 33bbd3fd13af8fa5cd3d58d1d4c7fa5b96341bfc..665dc6946b87365f678c02b00e268dc8aa003d75 100644 (file)
@@ -1379,7 +1379,7 @@ function getAdminDefaultAcl ($adminId) {
 }
 
 // Generates an option list from various parameters
-function generateOptionList ($table, $id, $name, $default='', $special='', $where='', $disabled=array()) {
+function generateOptionList ($table, $id, $name, $default = '', $special = '', $where = '', $disabled = array(), $callback = '') {
        $ret = '';
        if ($table == '/ARRAY/') {
                // Selection from array
@@ -1394,6 +1394,14 @@ function generateOptionList ($table, $id, $name, $default='', $special='', $wher
                                        // Disabled!
                                        $ret .= ' disabled="disabled"';
                                }
+
+                               // Is the call-back function set?
+                               if (!empty($callback)) {
+                                       // Call it
+                                       $name[$idx] = call_user_func_array($callback, array($name[$idx]));
+                               } // END - if
+
+                               // Finish option tag
                                $ret .= '>' . $name[$idx] . '</option>';
                        } // END - foreach
                } else {
@@ -1428,7 +1436,17 @@ function generateOptionList ($table, $id, $name, $default='', $special='', $wher
                                        // Disabled!
                                        $ret .= ' disabled="disabled"';
                                }
+
+                               // Add it, if set
                                if (!empty($add)) $add = ' ('.$add.')';
+
+                               // Is the call-back function set?
+                               if (!empty($callback)) {
+                                       // Call it
+                                       $title = call_user_func_array($callback, array($title));
+                               } // END - if
+
+                               // Finish option list
                                $ret .= '>' . $title . $add . '</option>';
                        } // END - while
                } else {
index 7464c028bd52bb1fddd75ad6d3d72bb9bcb1bc0f..7c01cd3ccdf2199f32eab34ca43f9ba3b4f42157 100644 (file)
@@ -13,7 +13,7 @@
                <td align="right" width="250">{--ADMIN_NETWORK_TYPES_HANDLE--}:</td>
                <td>
                        <select name="network_type_handle" class="admin_select" size="1">
-                               $content[type_options]
+                               {%pipe,generateNetworkTypeOptions={%pipe,getRequestParameter=network_type_id%}%}
                        </select>
                </td>
        </tr>