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 b5f92fc..9f309b9 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 c0fc4ee..39aa0dc 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 5001a82..9df3819 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 aba8d88..dc82a68 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 77fb6bf..8f1a88c 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 d0c4dbf..b7d50bf 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 ba47505..5c4b8af 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 44d772e..7d981c2 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 da5f593..11f5d85 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 da74082..fcc88cf 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 d6f0729..543ddae 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]%}