New template helper function doTemplateExtensionRegistrationLink() introduced
authorRoland Häder <roland@mxchange.org>
Wed, 21 Jul 2010 00:21:38 +0000 (00:21 +0000)
committerRoland Häder <roland@mxchange.org>
Wed, 21 Jul 2010 00:21:38 +0000 (00:21 +0000)
inc/expression-functions.php
inc/modules/admin/overview-inc.php
inc/modules/admin/what-extensions.php
inc/modules/admin/what-list_task.php
inc/template-functions.php
mailid.php
mailid_top.php
templates/de/html/admin/admin_extension_reg_form.tpl
templates/de/html/admin/admin_list_task_ext2_rows.tpl
templates/de/html/admin/admin_list_task_ext_rows.tpl
templates/de/html/admin/admin_overview_list_ext_rows.tpl

index b5f92fc07d316dc7501709d4595ecc50fa0b2d00..9f309b9d86ab1308b8d190cb315e1aedf82e828d 100644 (file)
@@ -303,7 +303,16 @@ function doExpressionMessage ($data) {
 function doExpressionTemplate ($data) {
        // Do the replacement
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'template='.$GLOBALS['current_template']);
-       $replacer = '{DQUOTE} . doTemplate' . $data['callback'] . "('" . $GLOBALS['current_template'] . "', true) . {DQUOTE}";
+       $replacer = '{DQUOTE} . doTemplate' . $data['callback'] . "('" . $GLOBALS['current_template'] . "', true";
+
+       // Is 'value' set?
+       if (!empty($data['value'])) {
+               // Then include it as well
+               $replacer .= ", '" . $data['value'] . "'";
+       } // END - if
+
+       // Replacer is ready
+       $replacer .= ') . {DQUOTE}';
 
        // Replace the code
        $code = replaceExpressionCode($data, $replacer);
index c0fc4eef7058cd99b1b25a6f370a106566596153..39aa0dcc48677c9123770d2ccc1f86edf5fe57f7 100644 (file)
@@ -447,12 +447,9 @@ LIMIT 1",
                        $content['task_created'] = generateDateTime($content['task_created'], 2);
 
                        // Do we have extension task?
-                       if ((isExtensionTask($content)) && (isExtensionProductive($content['infos']))) {
+                       if (isExtensionTask($content)) {
                                // Load extension row template
                                $OUT .= loadTemplate('admin_overview_list_ext_rows', true, $content);
-                       } elseif ((isExtensionTask($content)) && (!isExtensionProductive($content['infos']))) {
-                               // Load extension row template
-                               $OUT .= loadTemplate('admin_overview_list_ext2_rows', true, $content);
                        } else {
                                // Load default row template
                                $OUT .= loadTemplate('admin_overview_list_rows', true, $content);
index 5001a82579e489b003a930fa0dc29edb615ecdc9..9df38198aba19058e89800318697653ba9342cc3 100644 (file)
@@ -50,7 +50,9 @@ $do = 'overview';
 
 if (isGetRequestParameterSet('reg_ext')) {
        // We are about to register a new extension
-       $do = 'register'; $taskId = bigintval(getRequestParameter('reg_ext'));
+       $do = 'register';
+       $taskId = determineExtensionTaskId(getRequestParameter('reg_ext'));
+
        // The id comes from task management and it is - of course - *not* the extension's name!
 } elseif ((isFormSent('change')) && (ifPostContainsSelections()) && (!isDemoModeActive())) {
        // De-/activate extensions
index aba8d887a8d86d5c911e854a4b31f6d076400876..dc82a683bdebb227b239cec405d98944df7f5956 100644 (file)
@@ -176,12 +176,9 @@ ORDER BY
                        ));
 
                        // Do we have an extension task?
-                       if ((isExtensionTask($content)) && (isExtensionProductive($content['infos']))) {
+                       if (isExtensionTask($content)) {
                                // Load extension row template
                                $OUT .= loadTemplate('admin_list_task_ext_rows', true, $content);
-                       } elseif ((isExtensionTask($content)) && (!isExtensionProductive($content['infos']))) {
-                               // Load extension row template
-                               $OUT .= loadTemplate('admin_list_task_ext2_rows', true, $content);
                        } else {
                                // Load default row template
                                $OUT .= loadTemplate('admin_list_task_rows', true, $content);
index 77fb6bf78bc63c109768aa342147cb5d52b8df1c..8f1a88c2dc4a520cc5ce0eb3fd79eaf6336db5ca 100644 (file)
@@ -101,6 +101,21 @@ function doTemplateColorSwitch ($template, $clear = false, $return = true) {
        } // END - if
 }
 
+// Helper function for extension registration link
+function doTemplateExtensionRegistrationLink ($template, $dummy, $ext_name) {
+       // Default is all productive
+       $OUT = '<a title="{--ADMIN_REGISTER_EXTENSION_TITLE--}" href="{%url=modules.php?module=admin&amp;what=extensions&amp;reg_ext=' . $ext_name . '%}">{--ADMIN_REGISTER_EXTENSION--}</a>';
+
+       // Is the given extension non-productive?
+       if (!isExtensionProductive($ext_name)) {
+               // Non-productive code
+               $OUT = '<em style="cursor:help" class="admin_note" title="{%message,ADMIN_EXTENSION_IS_NON_PRODUCTIVE_LINK_TITLE=' . $ext_name . '%}">{--ADMIN_EXTENSION_IS_NON_PRODUCTIVE_LINK--}</em>';
+       } // END - if
+
+       // Return code
+       return $OUT;
+}
+
 // Init color switch
 function initTemplateColorSwitch ($template) {
        //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'INIT:' . $template);
index d0c4dbf7d7483c0516780422793a2734eb05d4a9..b7d50bf0b4c0c6fa23916fea16f0917480952b39 100644 (file)
@@ -77,12 +77,14 @@ if ((isValidUserId($url_userid)) && (($url_mid > 0) || ($url_bid > 0)) && (!ifFa
                // Normal-Mails
                $result_link = SQL_QUERY_ESC("SELECT `link_type` FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `stats_id`=%s AND `userid`=%s LIMIT 1",
                        array($url_mid, $url_userid), __FILE__, __LINE__);
-               $type = 'mailid'; $urlId = $url_mid;
+               $type = 'mailid';
+               $urlId = $url_mid;
        } elseif ($url_bid > 0) {
                // Bonus-Mail
                $result_link = SQL_QUERY_ESC("SELECT `link_type` FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `bonus_id`=%s AND `userid`=%s LIMIT 1",
                        array($url_bid, $url_userid), __FILE__, __LINE__);
-               $type = 'bonusid'; $urlId = $url_bid;
+               $type = 'bonusid';
+               $urlId = $url_bid;
        } else {
                // Problem: No id entered
                redirectToUrl('modules.php?module=index');
@@ -175,7 +177,11 @@ if ((isValidUserId($url_userid)) && (($url_mid > 0) || ($url_bid > 0)) && (!ifFa
                                        // Was that mail a valid one?
                                        if ($isValid === true) {
                                                // If time is zero seconds we have a sponsor mail. 1 Second shall be set to avoid problems
-                                               if (($time == '0') && ($payment > 0)) { $URL = getUrl(); $time = 1; }
+                                               if (($time == '0') && ($payment > 0)) { 
+                                                       $URL = getUrl();
+                                                       $time = 1; 
+                                               } // END - if
+
                                                if (($time > 0) && (($payment > 0) || ($points > 0))) {
                                                        // Export data into constants for the template
                                                        $content = array(
index ba47505ab9043fd61461c75d9d6bdbfa163d822d..5c4b8afecbe7608cd75dcd47e12e6069bcc9146a 100644 (file)
@@ -82,11 +82,13 @@ if ((isValidUserId($url_userid)) && (($url_mid > 0) || ($url_bid > 0)) && (!ifFa
        if ($url_mid > 0) {
                $result_main = SQL_QUERY_ESC("SELECT `id`, `link_type` FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `stats_id`=%s AND `userid`=%s LIMIT 1",
                        array($url_mid, $url_userid), __FILE__, __LINE__);
-               $type = 'mailid'; $urlId = $url_mid;
+               $type = 'mailid';
+               $urlId = $url_mid;
        } elseif ($url_bid > 0) {
                $result_main = SQL_QUERY_ESC("SELECT `id`, `link_type` FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `bonus_id`=%s AND `userid`=%s LIMIT 1",
                        array($url_bid, $url_userid), __FILE__, __LINE__);
-               $type = 'bonusid'; $urlId = $url_bid;
+               $type = 'bonusid';
+               $urlId = $url_bid;
        }
 
        if (SQL_NUMROWS($result_main) == 1) {
index 44d772e387cba89d24044dbb057da682f6e5b573..7d981c27589c6865396f1b55b4b544fc7d0bc59c 100644 (file)
@@ -1,4 +1,4 @@
 <a name="ext_$content[ext_name]"></a>
-<form accept-charset="utf-8" action="{%url=modules.php?module=admin&amp;what=extensions&amp;reg_ext=$content[id]%}" method="post">
+<form accept-charset="utf-8" action="{%url=modules.php?module=admin&amp;what=extensions&amp;reg_ext=$content[ext_name]%}" method="post">
        <input type="submit" name="ok" class="admin_submit" value="{--ADMIN_REGISTER_EXTENSION--}" />
 </form>
index da5f5936c82816af1f0323f9abb8f1fee45eed80..11f5d85d80b1ca4d16cf4c19e14af24e5ec2a60f 100644 (file)
@@ -1,23 +1 @@
-<tr>
-       <td class="{%template,ColorSwitch%} bottom right" align="center">
-               <input type="checkbox" class="admin_normal" title="{--ID_SELECT--} $content[id]" name="sel[$content[id]]" value="1" />
-       </td>
-       <td class="{%template,ColorSwitch%} bottom right" align="center">
-               {%pipe,generateAdminLink=$content[assigned_admin]%}
-       </td>
-       <td class="{%template,ColorSwitch%} bottom right" align="center">
-               <em style="cursor:help" class="admin_note" title="{%message,ADMIN_EXTENSION_IS_NON_PRODUCTIVE_LINK_TITLE=$content[infos]%}">{--ADMIN_EXTENSION_IS_NON_PRODUCTIVE_LINK--}</em>
-       </td>
-       <td class="{%template,ColorSwitch%} bottom right" align="center">
-               {%pipe,fixEmptyContentToDashes=$content[infos]%}
-       </td>
-       <td class="{%template,ColorSwitch%} bottom right" align="center">
-               $content[userid]
-       </td>
-       <td class="{%template,ColorSwitch%} bottom right" align="center">
-               $content[task_type_msg]
-       </td>
-       <td class="{%template,ColorSwitch%} bottom" align="center">
-               $content[task_created]
-       </td>
-</tr>
+<!-- @DEPRECATED //-->
index da740827c650d2e19581ea649389f0d5a1dc1ea9..fcc88cf5a6a6763f46e763c34f2872df0cdf1923 100644 (file)
@@ -6,7 +6,7 @@
                {%pipe,generateAdminLink=$content[assigned_admin]%}
        </td>
        <td class="{%template,ColorSwitch%} bottom right" align="center">
-               <a title="{--ADMIN_REGISTER_EXTENSION_TITLE--}" href="{%url=modules.php?module=admin&amp;what=extensions&amp;reg_ext=$content[id]%}">{--ADMIN_REGISTER_EXTENSION--}</a>
+               {%template,ExtensionRegistrationLink=$content[infos]%}
        </td>
        <td class="{%template,ColorSwitch%} bottom right" align="center">
                {%pipe,fixEmptyContentToDashes=$content[infos]%}
index d6f07292b667043f1bc8521f7ba547a656518b64..543ddae0be643688764ecd1c62c52d08a31589fa 100644 (file)
@@ -6,7 +6,7 @@
                {%pipe,generateAdminLink=$content[assigned_admin]%}
        </td>
        <td class="{%template,ColorSwitch%} bottom right" align="center">
-               <a title="{--ADMIN_REGISTER_EXTENSION_TITLE--}" href="{%url=modules.php?module=admin&amp;what=extensions&amp;reg_ext=$content[id]%}">{--ADMIN_REGISTER_EXTENSION--}</a>
+               {%template,ExtensionRegistrationLink=$content[infos]%}
        </td>
        <td class="{%template,ColorSwitch%} bottom right" align="center">
                {%pipe,fixEmptyContentToDashes=$content[infos]%}