Add settings dialogue - Only allows to enable/disable debug for now.
authorStephan Reichholf <sreichholf@users.schwerkraft.elitedvb.net>
Sun, 8 Nov 2009 09:06:03 +0000 (09:06 +0000)
committerStephan Reichholf <sreichholf@users.schwerkraft.elitedvb.net>
Sun, 8 Nov 2009 09:06:03 +0000 (09:06 +0000)
Minor changes to debug-Window behaviour.

webinterface/src/web-data/manifest.json
webinterface/src/web-data/tools.js
webinterface/src/web-data/tpl/default/tplNavExtras.htm
webinterface/src/web-data/tpl/default/tplSettings.htm [new file with mode: 0644]

index 6f152cf..eb75d72 100644 (file)
@@ -1,6 +1,6 @@
 {
   "betaManifestVersion": 1,
-  "version": "v34",
+  "version": "v36",
   "entries": [
                { "url": "IEFixes.htc" },               
                { "url": "img/arrow_down.png" },
@@ -51,6 +51,7 @@
                { "url": "tpl/default/tplSendMessage.htm" },
                { "url": "tpl/default/tplServiceList.htm" },
                { "url": "tpl/default/tplServiceListEPGItem.htm" },
+               { "url": "tpl/default/tplSettings.htm" },
                { "url": "tpl/default/tplSignalPanel.htm" },
                { "url": "tpl/default/tplSubServices.htm" },
                { "url": "tpl/default/tplTimerEdit.htm" },
index a4138da..79adfed 100644 (file)
@@ -1,7 +1,4 @@
 //$Header$
-var DBG = true;
-DBG = false;
-
 var templates = {};
 var loadedChannellist = {};
 
@@ -307,19 +304,45 @@ function openPopupPage(title, uri, width, height, x, y){
 }
 
 function debug(text){
+       var DBG = userprefs.data.debug || false;
+       
        if(DBG){
                try{
                        if(!debugWin.closed && debugWin.location){
                                var inner = debugWin.document.getElementById('debugContent').innerHTML;
                                debugWin.document.getElementById('debugContent').innerHTML = new Date().toLocaleString() + ": "+text+"<br>" + inner;
+                       } else {                        
+                               openDebug();
+                               
+                               setTimeout(     function(){
+                                                                       var inner = debugWin.document.getElementById('debugContent').innerHTML;
+                                                                       debugWin.document.getElementById('debugContent').innerHTML = new Date().toLocaleString() + ": "+text+"<br>" + inner;
+                                                               }, 
+                                                               1000
+                                                       );
                        }
-               } catch (Exception) {
-                       popUpBlockerHint();
-               }
-
+               } catch (Exception) {}
        }
 }
 
+function saveSettings(){
+       userprefs.load();
+       
+       var debug = $('enableDebug').checked;
+       if(typeof(debug) != undefined){
+               if( userprefs.data.debug != debug ){
+                       userprefs.data.debug = debug;
+                       userprefs.save();
+                       
+                       if(debug){
+                               openDebug();
+                       }
+               }
+               
+               
+       }
+       
+}
 
 //Template Helpers
 function saveTpl(request, tplName){
@@ -1155,7 +1178,18 @@ function showGears(){
        data = { 'useGears' : enabled };
        processTpl('tplGears', data, 'contentMain');
 }
+
+function showSettings(){
+       var debug = userprefs.data.debug;
+       var debugChecked = "";
+       if(debug){
+               debugChecked = 'checked';
+       }
+
+       data = { 'debug' : debugChecked };
+       processTpl('tplSettings', data, 'contentMain');
+}
+
  
 // Spezial functions, mostly for testing purpose
 function openHiddenFunctions(){
@@ -1487,6 +1521,10 @@ function loadAbout(){
        loadContentStatic('tplAbout', 'About');
 }
 
+function loadSettings(){
+       loadContentDynamic(showSettings, 'Settings');
+}
+
 function loadGearsInfo(){
        loadContentDynamic(showGears, 'Google Gears');
 }
@@ -1565,6 +1603,7 @@ function updateItemsLazy(bouquet){
  */
 
 function init(){
+       var DBG = userprefs.data.debug || false;
        if(DBG){
                openDebug();
        }
index f2cc233..8091afd 100644 (file)
@@ -13,6 +13,9 @@
                <td><a href="#" onclick="loadGearsInfo();">Google Gears</a></td>
        </tr>
        <tr>
+               <td><a href="#" onclick="loadSettings();">Settings</a><td>
+       </tr>   
+       <tr>
                <td><a href="#" onclick="loadAbout();">About</a><td>
        </tr>
 </table>
diff --git a/webinterface/src/web-data/tpl/default/tplSettings.htm b/webinterface/src/web-data/tpl/default/tplSettings.htm
new file mode 100644 (file)
index 0000000..d81f079
--- /dev/null
@@ -0,0 +1,18 @@
+
+<!-- tplSettings -->
+                                               <table id="contentTable">
+                                                       <tr>
+                                                               <td>                                                                    
+                                                                       <table style="width: 100%;">
+                                                                               <tr>
+                                                                                       <td>
+                                                                                               <form><input type="checkbox" id="enableDebug" ${debug}/>Enable Debug</form>                                                                                             
+                                                                                       </td>                                                                                   
+                                                                               </tr>
+                                                                               <tr><td><button onClick="saveSettings()">Save</button></td></tr>
+                                                                       </table>
+                                                                       
+                                                               </td>
+                                                       </tr>
+                                               </table>
+<!-- /tplSettings -->