alarmclock.qsrc 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. # alarmclock
  2. if $ARGS[0] = 'start':
  3. menu_off = 1
  4. gs 'stat'
  5. '<center><img <<$set_imgh>> src="images/shared/home/bedroom/bed2.jpg"></center>'
  6. '<center><h4>Enter the time using the number pad and click on set to change alarm times, don''t forget to turn your alarm on.</h></center>'
  7. *nl
  8. gs 'alarmclock', 'build_table'
  9. act 'Finish':
  10. bud1 = 0
  11. bud2 = 0
  12. bud3 = 0
  13. bud4 = 0
  14. numbud = 0
  15. gt 'alarmclock', 'fin'
  16. end
  17. act 'Clear time display':
  18. bud1 = 0
  19. bud2 = 0
  20. bud3 = 0
  21. bud4 = 0
  22. numbud = 0
  23. gt 'alarmclock', 'start'
  24. end
  25. end
  26. if $ARGS[0] = 'alarm_display':
  27. !! func('alarmclock', 'alarm_display', hour, minutes)
  28. $result = '<b><<func(''time'', ''get_time_string'', ARGS[1], ARGS[2])>></b>'
  29. end
  30. if $ARGS[0] = 'get_week_display':
  31. $result = '<b><<func(''time'', ''get_time_string'', alarmVars[''timerH''], alarmVars[''timerM''])>></b>'
  32. end
  33. if $ARGS[0] = 'get_weekend_display':
  34. $result = '<b><<func(''time'', ''get_time_string'', alarmVars[''timerEndH''], alarmVars[''timerEndM''])>></b>'
  35. end
  36. if $ARGS[0] = 'base_alarmclock_text':
  37. $result = 'Your <a href="exec:gt ''alarmclock'', ''start''">alarm clock</a> is set to <<func(''alarmclock'', ''get_week_display'')>> during the week and <<func(''alarmclock'', ''get_weekend_display'')>> during the weekend. It is currently turned ' + iif(alarmVars['alarmOn'] = 0, '<a href="exec: alarmVars[''alarmOn''] = 1 & gt $loc, $loc_arg">OFF</a>.', '<a href="exec: alarmVars[''alarmOn''] = 0 & gt $loc, $loc_arg">ON</a>.')
  38. end
  39. if $ARGS[0] = 'clear':
  40. cla
  41. bud1 = 0
  42. bud2 = 0
  43. bud3 = 0
  44. bud4 = 0
  45. numbud = 0
  46. gt 'alarmclock', 'start'
  47. end
  48. if $ARGS[0] = 'Time':
  49. alarmVars['alarmOn'] = 1
  50. if bud_weekend = 1:
  51. alarmVars['timerEndH'] = bud1 * 10 + bud2
  52. alarmVars['timerEndM'] = bud3 * 10 + bud4
  53. if alarmVars['timerEndH'] > 23: alarmVars['timerEndH'] = 0
  54. if alarmVars['timerEndM'] > 60: alarmVars['timerEndM'] = 0
  55. else
  56. alarmVars['timerH'] = bud1 * 10 + bud2
  57. alarmVars['timerM'] = bud3 * 10 + bud4
  58. if alarmVars['timerH'] > 23: alarmVars['timerH'] = 0
  59. if alarmVars['timerM'] > 60: alarmVars['timerM'] = 0
  60. end
  61. gt 'alarmclock', 'start'
  62. end
  63. if $ARGS[0] = '1':
  64. !!if numbud = 4:end
  65. if numbud = 3: bud4 = 1 & numbud = 4
  66. if numbud = 2: bud3 = 1 & numbud = 3
  67. if numbud = 1: bud2 = 1 & numbud = 2
  68. if numbud = 0: bud1 = 1 & numbud = 1
  69. gt 'alarmclock', 'start'
  70. end
  71. if $ARGS[0] = '2':
  72. !!if numbud = 4:end
  73. if numbud = 3: bud4 = 2 & numbud = 4
  74. if numbud = 2: bud3 = 2 & numbud = 3
  75. if numbud = 1: bud2 = 2 & numbud = 2
  76. if numbud = 0: bud1 = 2 & numbud = 1
  77. gt 'alarmclock', 'start'
  78. end
  79. if $ARGS[0] = '3':
  80. !!if numbud = 4:end
  81. if numbud = 3: bud4 = 3 & numbud = 4
  82. if numbud = 2: bud3 = 3 & numbud = 3
  83. if numbud = 1: bud2 = 3 & numbud = 2
  84. if numbud = 0: bud1 = 3 & numbud = 1
  85. gt 'alarmclock', 'start'
  86. end
  87. if $ARGS[0] = '4':
  88. !!if numbud = 4:end
  89. if numbud = 3: bud4 = 4 & numbud = 4
  90. if numbud = 2: bud3 = 4 & numbud = 3
  91. if numbud = 1: bud2 = 4 & numbud = 2
  92. if numbud = 0: bud1 = 4 & numbud = 1
  93. gt 'alarmclock', 'start'
  94. end
  95. if $ARGS[0] = '5':
  96. !!if numbud = 4:end
  97. if numbud = 3: bud4 = 5 & numbud = 4
  98. if numbud = 2: bud3 = 5 & numbud = 3
  99. if numbud = 1: bud2 = 5 & numbud = 2
  100. if numbud = 0: bud1 = 5 & numbud = 1
  101. gt 'alarmclock', 'start'
  102. end
  103. if $ARGS[0] = '6':
  104. !!if numbud = 4:end
  105. if numbud = 3: bud4 = 6 & numbud = 4
  106. if numbud = 2: bud3 = 6 & numbud = 3
  107. if numbud = 1: bud2 = 6 & numbud = 2
  108. if numbud = 0: bud1 = 6 & numbud = 1
  109. gt 'alarmclock', 'start'
  110. end
  111. if $ARGS[0] = '7':
  112. !!if numbud = 4:end
  113. if numbud = 3: bud4 = 7 & numbud = 4
  114. if numbud = 2: bud3 = 7 & numbud = 3
  115. if numbud = 1: bud2 = 7 & numbud = 2
  116. if numbud = 0: bud1 = 7 & numbud = 1
  117. gt 'alarmclock', 'start'
  118. end
  119. if $ARGS[0] = '8':
  120. !!if numbud = 4:end
  121. if numbud = 3: bud4 = 8 & numbud = 4
  122. if numbud = 2: bud3 = 8 & numbud = 3
  123. if numbud = 1: bud2 = 8 & numbud = 2
  124. if numbud = 0: bud1 = 8 & numbud = 1
  125. gt 'alarmclock', 'start'
  126. end
  127. if $ARGS[0] = '9':
  128. !!if numbud = 4:end
  129. if numbud = 3: bud4 = 9 & numbud = 4
  130. if numbud = 2: bud3 = 9 & numbud = 3
  131. if numbud = 1: bud2 = 9 & numbud = 2
  132. if numbud = 0: bud1 = 9 & numbud = 1
  133. gt 'alarmclock', 'start'
  134. end
  135. if $ARGS[0] = '0':
  136. !!if numbud = 4:end
  137. if numbud = 3: bud4 = 0 & numbud = 4
  138. if numbud = 2: bud3 = 0 & numbud = 3
  139. if numbud = 1: bud2 = 0 & numbud = 2
  140. if numbud = 0: bud1 = 0 & numbud = 1
  141. gt 'alarmclock', 'start'
  142. end
  143. if $ARGS[0] = 'Reset':
  144. if bud_weekend = 1:
  145. alarmVars['timerEndH'] = 0
  146. alarmVars['timerEndM'] = 0
  147. else
  148. alarmVars['timerH'] = 0
  149. alarmVars['timerM'] = 0
  150. end
  151. bud1 = 0
  152. bud2 = 0
  153. bud3 = 0
  154. bud4 = 0
  155. numbud = 0
  156. gt 'alarmclock', 'start'
  157. end
  158. if $ARGS[0] = 'fin':gt $menu_loc, $menu_arg
  159. if $ARGS[0] = 'build_table':
  160. $num_html = '<td align="center"><b><font size="+2">'
  161. $html_num = '</a></font></b></td>'
  162. $more_html = '<center><table width="20%" cellspacing=0 cellpadding=3 align="center" border=1><tr align="center"><th COLSPAN=3 align="center"><font size="+3">'
  163. $even_more_html = '</font></th></tr>'
  164. if numbud = 4:$alarm_html = '<<bud1>><<bud2>> : <<bud3>><<bud4>>'
  165. if numbud = 3:$alarm_html = '<<bud1>><<bud2>> : <<bud3>><U><<bud4>></U>'
  166. if numbud = 2:$alarm_html = '<<bud1>><<bud2>> : <U><<bud3>></U><<bud4>>'
  167. if numbud = 1:$alarm_html = '<<bud1>><U><<bud2>></U> : <<bud3>><<bud4>>'
  168. if numbud = 0:$alarm_html = '<U><<bud1>></U><<bud2>> : <<bud3>><<bud4>>'
  169. $numbud_table='<tr><td colspan=3 align="center"><b><font size="+2"><a href="exec:gt ''alarmclock'', ''clear''">Clear</a></font></b></td></tr>'
  170. $numbud_table+='<tr><<$num_html>><a href="exec:gt ''alarmclock'', ''1''">1<<$html_num>>'
  171. $numbud_table+='<<$num_html>><a href="exec:gt ''alarmclock'', ''2''">2<<$html_num>>'
  172. $numbud_table+='<<$num_html>><a href="exec:gt ''alarmclock'', ''3''">3<<$html_num>></tr>'
  173. $numbud_table+='<tr><<$num_html>><a href="exec:gt ''alarmclock'', ''4''">4<<$html_num>>'
  174. $numbud_table+='<<$num_html>><a href="exec:gt ''alarmclock'', ''5''">5<<$html_num>>'
  175. $numbud_table+='<<$num_html>><a href="exec:gt ''alarmclock'', ''6''">6<<$html_num>></tr>'
  176. $numbud_table+='<tr><<$num_html>><a href="exec:gt ''alarmclock'', ''7''">7<<$html_num>>'
  177. $numbud_table+='<<$num_html>><a href="exec:gt ''alarmclock'', ''8''">8<<$html_num>>'
  178. $numbud_table+='<<$num_html>><a href="exec:gt ''alarmclock'', ''9''">9<<$html_num>></tr>'
  179. $numbud_table+='<tr><td colspan=3 align="center"><b><font size="+2"><a href="exec:gt ''alarmclock'', ''0''">0</a></font></b></td></tr></table></center>'
  180. $alarmVars_table='<center><table border=0 cellpadding=0 cellspacing=5><font size="+1"<b>'
  181. $alarmVars_table+='<tr><td><b><a href="exec: bud_weekend = 0 & gt ''alarmclock'', ''Reset''">Reset weekday alarm</a></b></td>'
  182. $alarmVars_table+='<td><b><a href="exec: bud_weekend = 0 & gt ''alarmclock'', ''Time''">Set weekday alarm</a></b></td>'
  183. $alarmVars_table+='<td><b>Currently set for <<func(''time'', ''get_time_string'', alarmVars[''timerH''], alarmVars[''timerM''])>></b></td></tr>'
  184. $alarmVars_table+='<tr><td><b><a href="exec: bud_weekend = 1 & gt ''alarmclock'', ''Reset''">Reset weekend alarm</a></b></td>'
  185. $alarmVars_table+='<td><b><a href="exec: bud_weekend = 1 & gt ''alarmclock'', ''Time''">Set weekend alarm</a></b></td>'
  186. $alarmVars_table+='<td><b>Currently set for <<func(''time'', ''get_time_string'', alarmVars[''timerEndH''], alarmVars[''timerEndM''])>></b></td></tr>'
  187. if mid($start_type,1,2) = 'sg':
  188. $alarmVars_table+='<tr><td colspan="3"><b>Use weekend alarm for holidays - ' + iif(alarmVars['alarm_holiday'] = 0, '<a href="exec: alarmVars[''alarm_holiday''] = 1 & gt ''alarmclock'', ''start''">OFF</a>', '<a href="exec: alarmVars[''alarm_holiday''] = 0 & gt ''alarmclock'', ''start''">ON</a>') + '</b></td></tr>'
  189. end
  190. $alarmVars_table+='<tr><td colspan="3"><b>Your alarm is currently turned ' + iif(alarmVars['alarmOn'] = 0, '<a href="exec: alarmVars[''alarmOn''] = 1 & gt ''alarmclock'', ''start''">OFF</a>', '<a href="exec: alarmVars[''alarmOn''] = 0 & gt ''alarmclock'', ''start''">ON</a>') + '.</b></td></tr>'
  191. if alarmVars['alarmOn'] = 1:
  192. $alarmVars_table+='</table></center><center><table border=0 cellpadding=0 cellspacing=10><tr><td><b>Your Alarm is ' + iif(alarmVars['timerH'] <= 0 and alarmVars['timerM'] <= 0, 'not set', 'set to ' + func('time', 'get_time_string', alarmVars['timerH'], alarmVars['timerM'])) + ' for the weekdays ' + iif(alarmVars['timerEndH'] <= 0 and alarmVars['timerEndM'] <= 0, 'and not set', 'and set to ' + func('time', 'get_time_string', alarmVars['timerEndH'], alarmVars['timerEndM'])) + ' for the weekend' + iif(alarmVars['alarm_holiday'] = 1, ' and holidays', '') + '.</b></td></tr>'
  193. end
  194. $alarmVars_table+='</b></font></table></center>'
  195. '<<$more_html>><<$alarm_html>><<$even_more_html>><<$numbud_table>>'
  196. '<<$alarmVars_table>>'
  197. killvar '$num_html'
  198. killvar '$html_num'
  199. killvar '$alarm_html'
  200. killvar '$numbud_table'
  201. killvar '$more_html'
  202. killvar '$even_more_html'
  203. killvar '$alarmVars_table'
  204. end
  205. --- alarmclock ---------------------------------