Autostart/manual-start added to surfbar
authorRoland Häder <roland@mxchange.org>
Sat, 6 Sep 2008 21:39:47 +0000 (21:39 +0000)
committerRoland Häder <roland@mxchange.org>
Sat, 6 Sep 2008 21:39:47 +0000 (21:39 +0000)
inc/extensions/ext-surfbar.php
inc/language/surfbar_de.php
inc/modules/admin/what-config_surfbar.php
surfbar.php
templates/de/html/admin/admin_config_surfbar.tpl
templates/de/html/surfbar/surfbar_stopped.tpl

index 862fd14..7a09fee 100644 (file)
@@ -114,6 +114,7 @@ PRIMARY KEY(`id`)
        $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_dynamic_percent` FLOAT(10,5) UNSIGNED NOT NULL DEFAULT '10.00000'";
        $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_max_order` INT(7) UNSIGNED NOT NULL DEFAULT '10'";
        $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_restart_time` BIGINT(20) UNSIGNED NOT NULL DEFAULT '".(60*6)."'";
+       $SQLs[] = "ALTER TABLE `"._MYSQL_PREFIX."_config` ADD `surfbar_autostart` ENUM('Y','N') NOT NULL DEFAULT 'Y'";
 
        // Member menus
        $SQLs[] = "INSERT INTO `"._MYSQL_PREFIX."_member_menu` (`action`,`what`,`title`,`visible`,`locked`,`sort`) VALUES ('surfbar',NULL,'Surfbar','Y','Y',5)";
index efd481e..a49c8dc 100644 (file)
@@ -50,6 +50,7 @@ define('ADMIN_CONFIG_SURFBAR_NOTIFY_ADMIN_UNLOCK', "Admin bei Freigabe von Mailb
 define('ADMIN_CONFIG_SURFBAR_DYNAMIC_PERCENT', "Prozent auf dynamische Verg&uuml;tung:");
 define('ADMIN_CONFIG_SURFBAR_MAX_ORDER', "Maximal durch Mitglied in Surfbar buchbare URLs:(*)");
 define('ADMIN_CONFIG_SURFBAR_RESTART_TIME', "Ruhezeit der Surfbar, wenn alle URLs in Reload-Lock sind:");
+define('ADMIN_CONFIG_SURFBAR_AUTOSTART', "Surfbar soll nach Ruhezeit automatisch starten?");
 define('ADMIN_SURFBAR_NOTIFY_UNLOCK_YES', "Ja, Admin(s) informieren.");
 define('ADMIN_SURFBAR_NOTIFY_UNLOCK_NO', "Nein, nicht informieren.");
 define('ADMIN_SURFBAR_NO_REF_LEVELS_FOUND', "Zur Zeit sind keine Referal-Ebenen f&uuml;r die Surfbar eingestellt.<br />\nBitte installieren Sie die Erweiterung <strong>surfbar</strong> neu.");
index 6ad36f9..c986d65 100644 (file)
@@ -84,6 +84,17 @@ if (isset($_POST['ok'])) {
                define('__CONFIG_SURFBAR_NOTIFY_ADMIN_UNLOCK_N', " checked=\"checked\"");
        }
 
+       // Prepare auto-sart
+       if ($_CONFIG['surfbar_autostart'] == "Y") {
+               // Yes selected
+               define('__CONFIG_SURFBAR_AUTOSTART_Y' , " checked=\"checked\"");
+               define('__CONFIG_SURFBAR_AUTOSTART_N', "");
+       } else {
+               // No selected
+               define('__CONFIG_SURFBAR_AUTOSTART_Y' , "");
+               define('__CONFIG_SURFBAR_AUTOSTART_N', " checked=\"checked\"");
+       }
+
        // Load template
        LOAD_TEMPLATE("admin_config_surfbar", false, $content);
 }
index 677c2c1..cc01a06 100644 (file)
@@ -77,8 +77,9 @@ if (defined('mxchange_installed') && (isBooleanConstantAndTrue('mxchange_install
                } else {
                        // Prepare content
                        $content = array(
-                               'restart' => $_CONFIG['surfbar_restart_time'],
-                               'start'   => str_repeat("X", strlen($_CONFIG['surfbar_restart_time']))
+                               'restart'   => $_CONFIG['surfbar_restart_time'],
+                               'start'     => str_repeat("X", strlen($_CONFIG['surfbar_restart_time'])),
+                               'autostart' => ($_CONFIG['surfbar_autostart'] == "Y") ? "true" : "false"
                        );
 
                        // Load template for stopped surfbar
@@ -136,10 +137,7 @@ if (defined('mxchange_installed') && (isBooleanConstantAndTrue('mxchange_install
 
                                // Update salt (double-call lock!)
                                SURFBAR_UPDATE_SALT();
-                       } else {
-                               // Change template name
-                               $templateName = "surfbar_stopped";
-                       }
+                       } // END - if
                } else {
                        // Load header in frameset mode
                        $isFrameset = true;
index ec4b622..bb9ffa5 100644 (file)
                        <INPUT type="radio" name="surfbar_notify_admin_unlock" value="N"{--__CONFIG_SURFBAR_NOTIFY_ADMIN_UNLOCK_N--} /> {--ADMIN_SURFBAR_NOTIFY_UNLOCK_NO--}
                </TD>
        </TR>
+       <TR><TD height="8" colspan="2" class="seperator">&nbsp;</TD></TR>
+       <TR><TD height="3" colspan="2" class="seperator bottom2">&nbsp;</TD></TR>
+       <TR>
+               <TD height="30" align="center" colspan="2" class="admin_footer bottom2">
+                       {--ADMIN_CONFIG_SURFBAR_AUTOSTART--}
+               </TD>
+       </TR>
+       <TR><TD height="8" colspan="2" class="seperator">&nbsp;</TD></TR>
+       <TR>
+               <TD align="center" colspan="2">
+                       <INPUT type="radio" name="surfbar_autostart" value="Y"{--__CONFIG_SURFBAR_AUTOSTART_Y--} /> {--YES--}
+                       <INPUT type="radio" name="surfbar_autostart" value="N"{--__CONFIG_SURFBAR_AUTOSTART_N--} /> {--NO--}
+               </TD>
+       </TR>
        <TR><TD height="8" colspan="2" class="seperator bottom2">&nbsp;</TD></TR>
        <TR>
                <TD colspan="2" align="center" class="admin_footer">
index 9e39f07..d08da48 100644 (file)
@@ -1,26 +1,39 @@
 <div align="center">
-       <div class="member_table dashed" style="width:500px">
+       <div class="member_table dashed" style="width:500px;height:50px">
                <div class="member_title2 bottom2">
                        <strong>Surfbar angehalten!</strong>
                </div>
 
-               Keine URLs mehr verf&uuml;rgbar oder Datenbankfehler liegt vor.<br />
-               Neustart in <span id="surfbar_restart">$content[start]</span> Sekunden
+               <div id="surfbar_button">
+                       Keine URLs mehr verf&uuml;rgbar oder Datenbankfehler liegt vor.<br />
+                       Neustart in <span id="surfbar_counter">$content[start]</span> Sekunden
+               </div>
        </div>
 </div>
 
 <script language="JavaScript" type="text/javascript">
 <!--
-var counter = "$content[restart]";
-var timer   = document.getElementById("surfbar_restart");
+var interval  = null;
+var counter   = "$content[restart]";
+var timer     = document.getElementById("surfbar_counter");
+var buttonDiv = document.getElementById("surfbar_button");
 
-function Restart() {
+function Restart () {
        this.location.reload();
 }
 
+function ShowButton () {
+       buttonDiv.innerHTML = "<form action='{!URL!}/surfbar.php' target='_parent' method='GET'><input type='submit' class='member_submit' value='Surfbar erneut starten' /></form>";
+}
+
 function Counter () {
        if (counter == 0) {
-               Restart();
+               if ($content[autostart] == true) {
+                       Restart();
+               } else {
+                       ShowButton();
+               }
+               window.clearInterval(interval);
        } else {
                counter--;
                timer.innerHTML = counter;
@@ -28,11 +41,10 @@ function Counter () {
 }
 
 function Init () {
-       window.setInterval("Counter()", 1000);
+       interval = window.setInterval("Counter()", 1000);
        timer.innerHTML = "$content[restart]";
 }
 
 window.setTimeout("Init()", 500);
-
 //-->
-</script>
\ No newline at end of file
+</script>