Fix Date conversion for Timerlist.
authorStephan Reichholf <sreichholf@users.schwerkraft.elitedvb.net>
Wed, 31 Dec 2008 08:45:28 +0000 (08:45 +0000)
committerStephan Reichholf <sreichholf@users.schwerkraft.elitedvb.net>
Wed, 31 Dec 2008 08:45:28 +0000 (08:45 +0000)
small Cleanup.

webinterface/src/WebComponents/Sources/SubServices.py
webinterface/src/web-data/tools.js

index 6934ce8..af87641 100644 (file)
@@ -8,15 +8,6 @@ class SubServices(Source):
         Source.__init__(self)        
         self.session = session
         
-#        self.session.nav.event.append(self.checkSubservicesAvail) # we like to get service events
-#
-#    def checkSubservicesAvail(self, ev):
-#        if ev == iPlayableService.evUpdatedEventInfo:
-#            service = self.session.nav.getCurrentService()
-#            subservices = service and service.subServices()
-#            if subservices or subservices.getNumberOfSubservices() == 0:
-#                self["SubserviceQuickzapAction"].setEnabled(False)
-        
     def command(self):
         print "SubServices was called"
         list = []
@@ -36,7 +27,7 @@ class SubServices(Source):
                 n = subservices and subservices.getNumberOfSubservices()
                 for x in range(n):
                     sub = subservices.getSubservice(x)                    
-                    list.append([sub.toString() , sub.getName()])
+                    list.append([sub.toString(), sub.getName()])
                 
         else:
             list.append(["N/A", "N/A"])
index c631c40..7f695d3 100644 (file)
@@ -59,27 +59,23 @@ function quotes2html(txt) {
        return txt.replace(/'/g, "\\'").replace(/"/g, '&quot;');
 }
 
+function addLeadingZero(nr){
+       if(nr < 10){
+               return '0' + nr;
+       }
+       return nr;
+}
 
 function dateToString(date){
 
        var dateString = "";
        
        dateString += date.getFullYear();
-       dateString += "-" + date.getMonth();
-       dateString += "-" + date.getDate();
-       
-       var hours = date.getHours();
-       if(hours < 10){
-               hours = '0' + hours;
-       }
-       dateString += " " + hours;
-       
-       var minutes = date.getMinutes();
-       if(minutes < 10){
-               minutes = '0' + minutes;
-       }
-       dateString += ":" + minutes;
-       
+       dateString += "-" + addLeadingZero(date.getMonth()+1);
+       dateString += "-" + addLeadingZero(date.getDate());
+       dateString += " " + addLeadingZero(date.getHours());
+       dateString += ":" + addLeadingZero(date.getMinutes());
+               
        return dateString;
 }