OSDN Git Service

implement iepg adding on web function(beta).
authorgn64_jp <gn64_jp@4e526526-5e11-4fc0-8910-f8fd03428081>
Tue, 1 Sep 2009 12:18:26 +0000 (12:18 +0000)
committergn64_jp <gn64_jp@4e526526-5e11-4fc0-8910-f8fd03428081>
Tue, 1 Sep 2009 12:18:26 +0000 (12:18 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/rec10@144 4e526526-5e11-4fc0-8910-f8fd03428081

Rec10WEB/trunk/src/rec10web.py
Rec10WEB/trunk/src/schedule.htm

index 7f672b1..7bd124c 100644 (file)
@@ -144,6 +144,7 @@ def reserv(type,keyword,chtxt,btime,etime,deltatime,opt,deltaday):
             MaxT=MaxT-1
     if MaxS>-1 and MaxT>-1:
         database.add_rectime(type=type,chtxt=chtxt,title=keyword,btime=btime,etime=etime,deltatime=deltatime,deltaday=deltaday,opt=opt)
+        rett=""
     else:
         rett="over"
     return rett
@@ -163,7 +164,6 @@ def count_schedule(btime,etime):
         else:
             return 1
     dls=database.schedule_rectime(btime,etime)
-    print dls
     times=[]
     btd=datetime.datetime(*time.strptime(btime,"%Y-%m-%d %H:%M:%S")[:-3])
     etd=datetime.datetime(*time.strptime(etime,"%Y-%m-%d %H:%M:%S")[:-3])
@@ -176,12 +176,9 @@ def count_schedule(btime,etime):
             dd2=etd
         times.append(dd1)
         times.append(dd2)
-    print times
     times=list(set(times))
-    print times
     times.sort(cmpare)
     times.reverse()
-    print times
     retcount=[0,0]
     for i in xrange(0, len(times)-2, 1):
         bt1=times[i]
@@ -228,7 +225,7 @@ def station2chtxt(station):
     #    ""
     sta=database.select_by_station_iepg(station)
     if len(sta)>0:
-        ret=sta[0][1]
+        ret=sta[0][2]
     else:
         ret="n\/a"
     return ret
@@ -298,6 +295,25 @@ def mode_normal():
     htmdate=readHtmlSrcSimple()
     htmdate=htmdate.replace("<!--exec-value//-->","yes")
     return htmdate
+def mode_del():
+    s="最大予約可能数を超えています"
+    u="rec10web.py?exec=schedule"
+    return get_fin(s,u)
+def mode_edit_rec10web(tasknum):
+    #editnum=exect.replace("edit:","")
+    htmdate= readHtmlSrcSimple()
+    iddata=edit_date(tasknum)
+    htmdate=htmdate.replace("<!--text_for_replace_chtxt_input//-->",getchtxt())
+    htmdate=htmdate.replace("<!--ch-value//-->",iddata['chtxt'])
+    htmdate=htmdate.replace("<!--btime-value//-->",iddata['btime'])
+    htmdate=htmdate.replace("<!--etime-value//-->",iddata['etime'])
+    htmdate=htmdate.replace("<!--type-value//-->",iddata['type'])
+    htmdate=htmdate.replace("<!--ch-value//-->",iddata['chtxt'])
+    htmdate=htmdate.replace("<!--title-value//-->",iddata['title'])
+    htmdate=htmdate.replace("<!--size-value//-->",size)
+    htmdate=htmdate.replace("<!--opts-value//-->",iddata["opt"])
+    htmdate=htmdate.replace("<!--exec-value//-->","edit-exec:"+tasknum)
+    return htmdate
 def mode_edit():
     editnum=exect.replace("edit:","")
     htmdate= readHtmlSrcSimple()
@@ -382,8 +398,16 @@ if f.getfirst('exec',""):
 if exect=="schedule":
     mode="schedule"
     getRecDate()
+elif exect=="yes":
+    mode="yes"
 elif re.search('edit:',exect):
     mode="edit"
+elif re.search('edit-exec:',exect):
+    mode="edit-exec"
+elif exect=="change":
+    mode="edit-rec10"
+elif exect=="del":
+    mode="del"
 elif exect=="iepg-add":
     mode="iepg-add"
 elif exect=="iepg-show":
@@ -431,21 +455,8 @@ if f.getfirst('type')=="keyday":
         htmdate=mode_recover()
     chtxt=""
     exect=""
-if (chtxt != "")and(title != "")and(btime!="")and(etime!="")and(opts!="")and(exect=="yes"):
-    restxt=reserv(type, title, chtxt, btime, etime, deltahour, opts, deltaday)
-    if restxt=="":
-        htmdate=mode_recfin()
-    elif restxt=="over":
-        htmdate=mode_recover()
-    exect=""
-if (chtxt != "")and(title != "")and(btime!="")and(etime!="")and(opts!="")and(re.search('edit-exec:',exect)):
-    editnum=exect.replace("edit-exec:","")
-    restxt=change_reserv(editnum,type, title, chtxt, btime, etime, deltahour, opts, deltaday)
-    if restxt=="":
-        htmdate=mode_recfin()
-    elif restxt=="over":
-        htmdate=mode_recover()
-    exect=""
+
+
 if mode=="schedule":
     htmdate=mode_schedule()
 elif mode=="edit":
@@ -473,8 +484,37 @@ elif mode=="iepg-del":
     htmdate=mode_iepg_del()
     #except:
     #    htmdate=mode_iepg_del_miss()
+elif mode=="edit-rec10":
+    s=f.getfirst('tasknum')
+    s.replace(" ","")
+    htmdate=mode_edit_rec10web(s.split(",")[0])
+elif mode=="del":
+    s=f.getfirst('tasknum')
+    s.replace(" ","")
+    ss=s.split(",")
+    for st in ss:
+        if st!="":
+            database.del_by_id_rectime(st)
+    htmdate=mode_del()
+elif mode=="edit-exec":
+    if (chtxt != "")and(title != "")and(btime!="")and(etime!="")and(opts!=""):
+        editnum=exect.replace("edit-exec:","")
+        restxt=change_reserv(editnum,type, title, chtxt, btime, etime, deltahour, opts, deltaday)
+        if restxt=="":
+            htmdate=mode_recfin()
+        elif restxt=="over":
+            htmdate=mode_recover()
+        else:
+            htmdate=mode_recfin()
+    exect=""
+elif mode=="yes":
+    if (chtxt != "")and(title != "")and(btime!="")and(etime!="")and(opts!=""):
+        restxt=reserv(type, title, chtxt, btime, etime, deltahour, opts, deltaday)
+        if restxt=="":
+            htmdate=mode_recfin()
+        elif restxt=="over":
+            htmdate=mode_recover()
+        else:
+            htmdate=mode_recfin()
 print "Content-Type: text/html"
 print htmdate
-#print exect
-#print mode
-
index f45989d..424c4bf 100644 (file)
         </style>
         <script type="text/javascript">
             <!--
+            dojo.require('dojo.parser');
             dojo.require('dojox.grid.DataGrid');
             dojo.require('dojo.data.ItemFileReadStore');
             dojo.require('dojox.data.CsvStore');
-            dojo.require('dojo.parser');
+            dojo.require("dijit.form.Form");
             dojo.require('dijit.form.FilteringSelect');
             dojo.require('dijit.form.Button');
             // グリッドに表示する元データをロード
     </head>
 
     <!-- テーマの読み込み -->
-    <body class="tundra">  
-        <table
-            id="grid"
-            name="grid"
-            dojoType="dojox.grid.DataGrid"
-            store="store"
-            query="{id:'*'}"
-            autoHeight="true"
-            width="100%"
-            autoWidth="true"
-            clientSort="true"
-            onClick="click">
-            <thead>
-                <tr>
-                    <th width="30px" field="id">ID</th>
-                    <th width="90px" field="type">タイプ</th>
-                    <th width="50px" field="chtxt">チャンネル</th>
-                    <th width="150px" field="title">タイトル</th>
-                    <th width="100px" field="btime">開始</th>
-                    <th width="100px" field="etime">終了</th>
-                    <th width="30px" field="opt">オプション</th>
-                    <th width="50px" field="deltaday">周期</th>
-                </tr>
-            </thead>
-        </table>
-        <select name="exec"
-                dojoType="dijit.form.FilteringSelect"
-                autocomplete="false"
-                value="del"
-                onChange="setType">
-            <option value="del">削除(複数同時可能)</option>
-            <option value="change">変更(最後に選択したもの)</option>
-        </select>
-        <div dojoType="dijit.form.Button" type="submit">実行</div>
-        <div dojoType="dijit.form.TextBox"
-             name="tasknum"
-             id="tasknum"
-             value=""
-             style="display:none">
+    <body class="tundra">
+        <div dojoType="dijit.form.Form" action="rec10web.py" onExecute="this.submit()">
+            <table
+                id="grid"
+                name="grid"
+                dojoType="dojox.grid.DataGrid"
+                store="store"
+                query="{id:'*'}"
+                autoHeight="true"
+                width="100%"
+                autoWidth="true"
+                clientSort="true"
+                onClick="click">
+                <thead>
+                    <tr>
+                        <th width="30px" field="id">ID</th>
+                        <th width="90px" field="type">タイプ</th>
+                        <th width="50px" field="chtxt">チャンネル</th>
+                        <th width="150px" field="title">タイトル</th>
+                        <th width="100px" field="btime">開始</th>
+                        <th width="100px" field="etime">終了</th>
+                        <th width="30px" field="opt">オプション</th>
+                        <th width="50px" field="deltaday">周期</th>
+                    </tr>
+                </thead>
+            </table>
+            <select name="exec"
+                    dojoType="dijit.form.FilteringSelect"
+                    autocomplete="false"
+                    value="del"
+                    onChange="setType">
+                <option value="del">削除(複数同時可能)</option>
+                <option value="change">変更(最後に選択したもの)</option>
+            </select>
+            <div dojoType="dijit.form.Button" type="submit">実行</div>
+            <div dojoType="dijit.form.TextBox"
+                 name="tasknum"
+                 id="tasknum"
+                 value=""
+                 style="display:none">
+            </div>
         </div>
     </body>
 </html>