Fix notification placement and coloring (was green when it should've been red).
authorStephan Reichholf <sreichholf@users.schwerkraft.elitedvb.net>
Fri, 5 Mar 2010 17:35:08 +0000 (17:35 +0000)
committerStephan Reichholf <sreichholf@users.schwerkraft.elitedvb.net>
Fri, 5 Mar 2010 17:35:08 +0000 (17:35 +0000)
Add (primitive but) proper handling of Timer conflicts

webinterface/src/WebComponents/Sources/Timer.py
webinterface/src/web-data/tools.js
webinterface/src/web-data/tpl/default/style.css

index 1858091..40f517b 100644 (file)
@@ -327,10 +327,20 @@ class Timer(Source):
                        timer = RecordTimerEntry(service_ref, begin, end, name, description, 0, disabled, justplay, afterEvent, dirname=dirname, tags=tags)
                        timer.repeated = repeated
                        #add the new timer
-                       self.recordtimer.record(timer)
-                       return ( True, "Timer added successfully!" )
-               except Exception:
+                       conflicts = self.recordtimer.record(timer)
+                       if conflicts is None:
+                               return ( True, 'Timer "%s" added successfully!' %(timer.name) )
+                       else:
+                               print "[WebComponents.Timer] editTimer conflicting Timers: %s" %(conflicts)
+                               msg = ""
+                               for timer in conflicts:
+                                       msg = "%s / %s" %(msg, timer.name)                              
+                                       
+                               return (False, "Conflicting Timer(s) detected! %s" %(msg)) 
+                               
+               except Exception, e:
                        #something went wrong, most possibly one of the given paramater-values was wrong
+                       print "[WebComponents.Timer] editTimer exception: %s" %(e)
                        return ( False, "Could not add timer '%s'!" % name )
 
                return ( False, "Unexpected Error" )
index a441a55..26872f5 100644 (file)
@@ -136,7 +136,7 @@ function notify(text, state){
 
 
 function simpleResultHandler(simpleResult){
-       notify(simpleResult.statetext, simpleResult.state);
+       notify(simpleResult.getStateText(), simpleResult.getState());
 }
 
 
index 7f3f864..3ed81a4 100644 (file)
 
        #notification{          
                color: #000;
-               width: 600px;
+               width: 50%;
                height: 32px;
                position: absolute;
                top: 0px;
-               left: 200px;            
+               left: 25%;              
                text-align: center;
                vertical-align: bottom;
                z-index: 2;