+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<style type="text/css">
@import "./dojo/dojo/resources/dojo.css";
@import "./dojo/dijit/themes/tundra/tundra.css";
-
-
</style>
<script type="text/javascript">
-
dojo.require("dojo.parser");
// ※ ここで、使用するウィジェットの読み込みを行う
dojo.require("dijit.form.Button");
dojo.require("dijit.form.TextBox");
dojo.require("dijit.form.Form");
+ dojo.require("dijit.form.ValidationTextBox");
+ dojo.require("dijit.form.FilteringSelect");
</script>
</head>
<body class="tundra">
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+ <meta http-equiv="Content-Style-Type" content="text/css">
+ <meta http-equiv="Content-Script-Type" content="text/javascript">
<title>Rec10 Simple Web Interface ver.0.7.0 iEPGデータ表示</title>
<script src="./dojo/dojo/dojo.js" djConfig="parseOnLoad:true">
</script>
<style type="text/css">
@import "./dojo/dojo/resources/dojo.css";
@import "./dojo/dijit/themes/tundra/tundra.css";
-
-
+ @import "./dojo/dojox/grid/resources/Grid.css";
+ @import "./dojo/dojox/grid/resources/tundraGrid.css";
</style>
<script type="text/javascript">
-
dojo.require("dojo.parser");
// ※ ここで、使用するウィジェットの読み込みを行う
+ dojo.require('dojox.grid.DataGrid');
+ dojo.require("dijit.form.Form");
dojo.require("dijit.form.Button");
dojo.require("dijit.form.TextBox");
- dojo.require("dijit.form.Form");
- var iepgStore = new dojo.data.ItemFileWriteStore({data:{items:[
- <!--text_for_replace_iepg//-->
- ]}});
+ dojo.require("dojo.data.ItemFileWriteStore");
+ dojo.require("dijit.form.ValidationTextBox");
+ dojo.require("dojox.data.CsvStore");
+ dojo.require("dijit.form.TextBox");
+ dojo.require("dojox.grid.cells.dijit")
+ var iepgstore = new dojox.data.CsvStore({url:'./iepgdatum.csv'});
+ //var iepgStructure=[
+ // {name:"ID",field:"id",width:"30px"},
+ // {name:"チャンネル",field:"name",width:"200px"},
+ // {name:"chtxt",field:"chtxt",width:"100px"}
+ //]
+ function changeGrid(grid){
+ var s=dijit.byId("iepgGrid").store.getValue(dijit.byId("iepgGrid").getItem(grid.rowIndex),"id");
+ var str=dijit.byId("iepg_delnum").value;
+ str=str+","+s;
+ dijit.byId("iepg_delnum").setValue(str);
+ };
+ dojo.addOnLoad(function(){
+ dojo.connect(dijit.byId("iepgGrid"),"onRowClick",changeGrid);
+ dojo.connect(dijit.byId("del"),"onClick",function(e){
+ dijit.byId("MainForm").submit();
+ });
+ });
</script>
</head>
<body class="tundra">
- <div dojoType="dijit.form.Form" action="rec10web.py" onExecute="this.submit()">
+ <div dojoType="dijit.form.Form" action="rec10web.py" onExecute="this.submit()" id="MainForm">
<h1>Rec10 Simple Web Interface ver.0.7.0 iEPGデータ表示</h1><br>
- <table dojoType="dojox.grid.DataGrid" id="iepggrid" store="iepgStore">
+ <table dojoType="dojox.grid.DataGrid"
+ id="iepgGrid"
+ jsid="iepgGrid"
+ store="iepgstore"
+ query="{id:'*'}"
+ autoHeight="true"
+ width="100%"
+ autoHeight="true"
+ autoWidth="true"
+ clientSort="true"
+ onRowClick="changeGrid"
+ >
<thead>
<tr>
- <th field="name" width="auto">放送局名</th>
- <th field="chtxt" width="auto">内部放送局コード(chtxt)</th>
+ <th field="id" width="30px">ID</th>
+ <th field="name" width="200px">チャンネル</th>
+ <th field="chtxt" width="100px">chtxt</th>
</tr>
</thead>
</table>
+ </div>
+ <div dojoType="dijit.form.Button" type="submit" id="del">DEL</div>
+ <div name="exec"
+ dojoType="dijit.form.ValidationTextBox"
+ value="iepg-del"
+ style="display:none">
+ </div>
+ <div name="iepg_delnum:"
+ id="iepg_delnum"
+ dojoType="dijit.form.TextBox"
+ value=""
+ style="display:none">
+ </div>
</div>
</body>
</html>
f=open(path+"/recdatum.csv","w")
f.write(recdata)
f.close()
+def getiEPGDate():
+ dl=database.select_all_iepg()
+ recdata="id,name,chtxt\n"
+ #print dl
+ s=""
+ for d in dl:
+ s=s+d[0]+","+d[1]+","+d[2]+"\n"
+ recdata=recdata+s
+ f=open(path+"/iepgdatum.csv","w")
+ f.write(recdata)
+ f.close()
def getchtxt():
dl=database.select_all_chdata()
chopt=""
return rett
def station2chtxt(station):
ret=""
- sta=database.select_by_station_iepg(station):
+ #try:
+ database.new_iepg()
+ #except:
+ # ""
+ sta=database.select_by_station_iepg(station)
if len(sta)>0:
ret=sta[0][1]
else:
return htmdate
def mode_iepg_show():
htmdate=readiEPGshow()
- lsts=database.select_all_iepg()
- s=""
- for lst in lsts:
- s=s+"{name:\""+lst[0]+"\",chtxt:\""+lst[1]+"\"},\n"
return htmdate
def mode_schedule():
htmdate=readRecSchedule()
bt=""
station_name=""
mode=""
-getRecDate()
-if f.getfirst('mode')=="schedule":
- getRecDate()
###ここからiEPG用の読み出し
if f.getfirst('station_name'):
station=f.getfirst('station_name')
exect=f.getfirst('exec',"")
if exect=="schedule":
mode="schedule"
+ getRecDate()
elif re.search('edit:',exect):
mode="edit"
elif exect=="iepg-add":
mode="iepg-add"
elif exect=="iepg-show":
mode="iepg-show"
-elif exect=="iepg-add_yes"
+elif exect=="iepg-add_yes":
mode="iepg-add-yes"
+elif exect=="iepg-del":
+ mode="iepg-del"
htmdate= readHtmlSrcSimple()
htmdate=htmdate.replace("<!--text_for_replace_chtxt_input//-->",getchtxt())
htmdate=htmdate.replace("<!--btime-value//-->",btime)
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(id, type, keyword, chtxt, btime, etime, deltatime, opt, deltaday)
restxt=change_reserv(editnum,type, title, chtxt, btime, etime, deltahour, opts, deltaday)
if restxt=="":
htmdate=readRecFinisSimple()
elif mode=="edit":
htmdate=mode_edit()
elif mode=="iepg-add":
- htmdate=mode_iepg_add(f.getfirst('iepg_station'))
+ htmdate=mode_iepg_add(station_name)
elif mode=="iepg-add-yes":
+ try:
+ database.new_iepg()
+ except:
+ ""
if f.getfirst('iepg_station') and f.getfirst('iepg_chtxt'):
database.add_iepg(f.getfirst('iepg_station'),f.getfirst('iepg_chtxt'))
htmdate=mode_iepg_fin()
elif mode=="iepg-show":
+ getiEPGDate()
htmdate=mode_iepg_show()
-print "Content-Type: text/html\n"
+elif mode=="iepg-del":
+ print f
+print "Content-Type: text/html"
print htmdate
-
+#print exect
+#print mode
self.close_db(db)
def new_iepg(self):
db=self.connect_db()
- db[1].execute("\
- CREATE TABLE iepg \
+ try:
+ db[1].execute("CREATE TABLE iepg \
(\
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,\
station VARCHAR(200) NOT NULL,\
- chtxt VARCHAR(30) NOT NULL,\
- UNIQUE uniepg(type,chtxt)\
+ chtxt VARCHAR(30) NOT NULL\
)")
+ except:
+ ""
self.close_db(db)
def add_iepg(self,station,chtxt):
db=self.connect_db()
- db[1].execute('INSERT IGNORE INTO iepg VALUES (%s,%s)', (station,chtxt))
+ db[1].execute('INSERT IGNORE INTO iepg (station,chtxt) VALUES (%s,%s)', (station,chtxt))
self.close_db(db)
def select_by_chtxt_iepg(self,chtxt):
db=self.connect_db()
db[1].execute("\
SELECT \
- station,chtxt \
+ id,station,chtxt \
FROM iepg \
WHERE chtxt=%s "\
,(chtxt,))
retall=db[1].fetchall()
self.close_db(db)
- return retall
+ rets=[]
+ if len(retall)>0:
+ for ret in retall:
+ a=list(ret)
+ a[0]=str(ret[0])
+ rets.append(a)
+ return rets
def select_by_station_iepg(self,station):
db=self.connect_db()
db[1].execute("\
SELECT \
- station,chtxt \
+ id,station,chtxt \
FROM iepg \
WHERE station=%s "\
,(station,))
retall=db[1].fetchall()
self.close_db(db)
- return retall
+ rets=[]
+ if len(retall)>0:
+ for ret in retall:
+ a=list(ret)
+ a[0]=str(ret[0])
+ rets.append(a)
+ return rets
def select_all_iepg(self):
db=self.connect_db()
db[1].execute("\
SELECT \
- station,chtxt \
+ id,station,chtxt \
FROM iepg "\
- ,(station,))
+ )
retall=db[1].fetchall()
self.close_db(db)
- return retall
\ No newline at end of file
+ rets=[]
+ if len(retall)>0:
+ for ret in retall:
+ a=list(ret)
+ a[0]=str(ret[0])
+ rets.append(a)
+ return rets
\ No newline at end of file
<style type="text/css">
@import "./dojo/dojo/resources/dojo.css";
@import "./dojo/dijit/themes/tundra/tundra.css";
-
-
</style>
<script type="text/javascript">
-
dojo.require("dojo.parser");
// ※ ここで、使用するウィジェットの読み込みを行う
-
dojo.require("dijit.form.Button");
dojo.require("dijit.form.FilteringSelect");
dojo.require("dijit.form.ValidationTextBox");
+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
dojo.require('dojo.data.ItemFileReadStore');
dojo.require('dojox.data.CsvStore');
dojo.require('dojo.parser');
-
-
// グリッドに表示する元データをロード
var store = new dojox.data.CsvStore({url:'./recdatum.csv'});
-->