Commits

gao shuai committed 79dab05

api avialible,header include

Comments (0)

Files changed (17)

+# -*- coding: utf-8 -*-
+#post to "/(.*)/new name:"content""
+#import urllib2,urllib
+#
+#liValue=uillib.uelencode({"content" : liData})
+#urllib2.urlopen("http://fy.gongda.tk/li/new",liValue)
+#swapValue=uillib.uelencode({"content" : swapData})
+#urllib2.urlopen("http://fy.gongda.tk/swap/new",swapValue)
+
+#get json source
+#swap=urllib2.urlopen("http://fy.gongda.tk/api/swap.json").read().replace('\n',r'/n/').replace('\r',r'/r/').replace('\t',r'/t/').replace('\0',r'/0/').replace('\\n',r'///n/').replace('\\r',r'///r/').replace('\\t',r'///t/').replace('\\0',r'///0/')
+#
+#import json
+#json.loads(swap)
+#li=urllib2.urlopen("http://fy.gongda.tk/api/li.json").read()
+#json.loads(li)
+
+from settings import  *
+import datetime
+import os
+import time
+from datetime import  timedelta, date
+
+def getCNnow():
+	return datetime.datetime.utcnow() + timedelta(hours=+8)
+
+NowDay=getCNnow().isoweekday()
+
+
+from main import words,swap,li,wiki
+import os
+from google.appengine.ext.webapp import template
+from google.appengine.ext import db
+import cgi
+from google.appengine.api import users
+from google.appengine.ext import webapp
+from google.appengine.ext.webapp.util import run_wsgi_app
+
+# class kcb(db.Model):
+	# term = db.ReferenceProperty(kcbterm)
+	# name = db.StringProperty(multiline=True)
+	# day = db.IntegerProperty()
+	# time = db.IntegerProperty()
+	# week = db.ListProperty(long)
+	# place = db.StringProperty(multiline=True)
+	# starttime = db.TimeProperty(auto_now=True)
+	# msg=db.ListProperty(long)
+class ShowHandler(webapp.RequestHandler):
+  def get(self,flag=None):
+		try:
+			WORDS=words.all().order("-time").fetch(limit=WORDS_LIMIT)
+			WIKIS=wiki.all().order("-time").fetch(limit=WIKI_LIMIT)
+			SWAPS=swap.all().order("-time").fetch(limit=SWAP_LIMIT,offset=0)
+			LASTSWAP=swap.all().order("-time").fetch(limit=1)[0].content
+			LIS=li.all().order("-time").fetch(limit=LI_LIMIT,offset=0)
+			LASTLI=li.all().order("-time").fetch(limit=1)[0].content
+		except IndexError:
+			WORDS=None
+			WIKIS=None
+			SWAPS=None
+			LASTSWAP=None
+			LIS=None
+			LASTLI=None
+		callback=self.request.get("callback")
+		template_values = {
+		'WORDSS':WORDS,
+		'WIKIS':WIKIS,
+		'SWAPS':SWAPS,
+		'LASTSWAP':LASTSWAP,
+		'LIS':LIS,
+		'LASTLI':LASTLI,
+		'callback':callback,
+		}
+		
+		if flag.endswith('.json'):
+			if callback:
+				self.response.headers['Content-type'] = 'text/javascript; charset=UTF-8'
+			else:
+				self.response.headers['Content-type'] = 'application/json; charset=UTF-8'
+			path = os.path.join(os.path.dirname(__file__), 'tpl','api',flag)
+		# else:
+			# path = os.path.join(os.path.dirname(__file__), 'tpl','bingo.html')
+		self.response.out.write(template.render(path, template_values))
+
+
+class SiteInfoHandler(webapp.RequestHandler):
+    def get(self):
+        site = GetSite()
+        template_values = {}
+        template_values['site'] = site
+        path = os.path.join(os.path.dirname(__file__), 'tpl', 'api', 'site_info.json')
+        output = template.render(path, template_values)
+        self.response.headers['Content-type'] = 'application/json'
+        self.response.out.write(output)
+
+# Nodes
+# /api/nodes/all.json
+application = webapp.WSGIApplication(
+                                     [
+									 # ('/', MainPage),
+
+									  ('/api/(.*)', ShowHandler),
+									  ],
+                                     debug=True)
+
+def main():
+  run_wsgi_app(application)
+
+if __name__ == "__main__":
+  main()
 
 - url: /_ah/info/.*
   script: $PYTHON_LIB/google/appengine/tools/dev_appserver_info
-
+- url: /api/.*
+  script: api.py
 - url: /.*
   script: main.py
 # -*- coding: utf-8 -*-
-PAGE_SIZE=10
-LI_LIMIT=8
-SWAP_LIMIT=3
-WORDS_LIMIT=3
-WIKI_LIMIT=8
+from settings import  *
 import math
 import urllib
 import os
 	content=db.TextProperty()
 class li(db.Model):
 	time = db.DateTimeProperty()
-	content=db.StringProperty()
+	content=db.StringProperty(multiline=False)
 def en2c(text):
 	httplib.HTTPConnection.debuglevel = 1
 	url_t = "http://ajax.googleapis.com/ajax/services/language/translate"
 class Mainpage(yui.HtmlRequestHandler):
 	def get(self,flag):
 		try:
+			TIME=getCNnow()
 			WORDS=words.all().order("-time").fetch(limit=WORDS_LIMIT)
 			WIKIS=wiki.all().order("-time").fetch(limit=WIKI_LIMIT)
 			SWAPS=swap.all().order("-time").fetch(limit=SWAP_LIMIT,offset=0)
 			LIS=li.all().order("-time").fetch(limit=LI_LIMIT,offset=0)
 			LASTLI=li.all().order("-time").fetch(limit=1)[0].content
 		except IndexError:
+			TIME=getCNnow()
 			WORDS=None
 			WIKIS=None
 			SWAPS=None
 		'LASTSWAP':LASTSWAP,
 		'LIS':LIS,
 		'LASTLI':LASTLI,
+		"TIME":TIME,
 		}
 		# self.before()
 		if flag=='':
 		self.write(template.render(path, template_values))
 class ShowAll(yui.HtmlRequestHandler):
 	def get(self,flag):
+		TIME=getCNnow()
 		page_current=int(self.request.get('p') or '1')
 		exec('''LIS=%s.all().order("-time")'''%flag)
 		pages=math.floor(LIS.count()/PAGE_SIZE)+1
 		'pages': pages,
 		'ps': ps,
 		'page_current': page_current,
+		"TIME":TIME,
 		}
 		path = os.path.join(os.path.dirname(__file__), 'tpl','%s.html'%flag)
 		self.write(template.render(path, template_values))
 class LiHandler(yui.HtmlRequestHandler):
 	def post(self,flag):
 		if flag == 'new':
-			contents=self.request.get('content').split('\n')
+			contents=self.request.get('content').strip().split('\n')
 			for content in contents:
 				LI=li()
-				LI.content=content
+				LI.content=content.strip()
 				LI.time=getCNnow()
 				LI.put()
 			self.redirect('/li')
+PAGE_SIZE=10
+LI_LIMIT=8
+SWAP_LIMIT=3
+WORDS_LIMIT=3
+WIKI_LIMIT=8
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf8" />
+    <title>
+      后台
+    </title>
+    <link href="/static/main.css" rel="stylesheet" type="text/css" media="all" />
+  </head>
+  <body>
+    {% include 'seo.html' %} {% include 'header.html' %} <script language="javascript" type=
+    "text/javascript">
+//<![CDATA[
 
-<html>
-<head>
-
-
-<meta http-equiv="Content-Type" content="text/html; charset=utf8">
-<title>后台</title>
-<link href="/static/main.css" rel="stylesheet" type="text/css" media="all" />
-
-
-    {% include 'seo.html' %}
-</head>
-
-  <body>
-     {% include 'header.html' %}
-<script language=javascript>
-
-//转载请保留出处 http://www.dwww.cn
-function unselectall(){
-if(document.myform.chkAll.checked){
-document.myform.chkAll.checked = document.myform.chkAll.checked&0;
-}
-}
-function CheckAll(form){
-for (var i=0;i<form.elements.length;i++){
-var e = form.elements[i];
-if (e.Name != 'chkAll'&&e.disabled==false)
-e.checked = form.chkAll.checked;
-}
-}
-</script>
-<div >
-<fieldset>
-
-	<legend>↓删除↓</legend>
-
-
-<form action="/del" method="post">
-<input name='chkAll' type='checkbox' id='chkAll' onclick='CheckAll(this.form)' value='checkbox'>
-全选<br />
-{% for KCB in QUOTES %}
-
-<input type="checkbox" onclick='unselectall()' name='delitem' value='{{KCB.key}}'  />
-{{KCB.EN}} || {{ KCB.time }}||{{KCB.CN}}
-<br />
-    {% endfor %}
-
-
-<p><input type="Submit" id="submit_btn" value="提交" class="btn blue" /></p>
-		</fieldset>
-	</form>
-	<br />
-	<br />
-	</div>
-
-
-
-
-		<br />
-
-
-   {% include 'footer.html' %}
-
-	  </body>
-</html>
+    //转载请保留出处 http://www.dwww.cn
+    function unselectall(){
+    if(document.myform.chkAll.checked){
+    document.myform.chkAll.checked = document.myform.chkAll.checked&0;
+    }
+    }
+    function CheckAll(form){
+    for (var i=0;i<form.elements.length;i++){
+    var e = form.elements[i];
+    if (e.Name != 'chkAll'&&e.disabled==false)
+    e.checked = form.chkAll.checked;
+    }
+    }
+    //]]>
+    </script>
+    <div>
+      <fieldset>
+        <legend>↓删除↓</legend>
+        <form action="/del" method="post">
+          <input name='chkAll' type='checkbox' id='chkAll' onclick='CheckAll(this.form)' value=
+          'checkbox' /> 全选<br />
+          {% for KCB in QUOTES %} <input type="checkbox" onclick='unselectall()' name='delitem'
+          value='{{KCB.key}}' /> {{KCB.EN}} || {{ KCB.time }}||{{KCB.CN}}<br />
+          {% endfor %}
+          <p>
+            <input type="submit" id="submit_btn" value="提交" class="btn blue" />
+          </p>
+        </form>
+      </fieldset><br />
+      <br />
+    </div><br />
+    {% include 'footer.html' %}
+  </body>
+</html>
+{% if callback %}{{callback}}({% endif %}[{% for KCB in LIS%}{% ifequal forloop.counter 1 %}{% else %},{% endifequal %}{"content" : "{{KCB.content}}","time" : "{{KCB.time}}"}{% endfor %}]{% if callback %});{% endif %}

tpl/api/swap.json

+{% if callback %}{{callback}}({% endif %}[{% for KCB in SWAPS%}{% ifequal forloop.counter 1 %}{% else %},{% endifequal %}{"content" : "{{KCB.content|escape}}","time" : "{{KCB.time}}"}{% endfor %}]{% if callback %});{% endif %}

tpl/api/wiki.json

+{% if callback %}{{callback}}({% endif %}[
+{% for KCB in WIKIS%}{% ifequal forloop.counter 1 %}{% else %},{% endifequal %}
+{"name" : "{{KCB.name}}" , "day" : "{{KCB.day}}" , "time" : "{{KCB.time}}" , "week" : "{{KCB.week}}" , "place" : "{{KCB.place}}" }
+{% endfor %}
+]{% if callback %});{% endif %}

tpl/api/words.json

+{% if callback %}{{callback}}({% endif %}[{% for KCB in WORDSS%}{% ifequal forloop.counter 1 %}{% else %},{% endifequal %}{"CN" : "{{KCB.CN}}","EN" : "{{KCB.EN}}","time" : "{{KCB.time}}"}{% endfor %}]{% if callback %});{% endif %}
 <div class="inner" align="center" style="font-size:24px;">
-                    {% for p in ps %}{% ifequal p page_current %}<span class="page_current">第{{ p }}页</span>{% else %}<a href="?p={{ p }}" class="page_normal">第{{ p }}页</a>{% endifequal %}{% endfor %}
-</div>
+{% for p in ps %}{% ifequal p page_current %}<span class="page_current">第{{ p }}页</span>{% else %}<a href="?p={{ p }}" class="page_normal">第{{ p }}页</a>{% endifequal %}{% endfor %}
+<div id="header" style="text-align:center;float:top;"> 
+ <hr />
+
+{% if  TIME%}
+<h2>当前时间{{TIME}}</h2>
+{% endif %}
+<a href='/'>home</a>
+  <hr />
+</div>
+
+
+
+
+
+
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-
-<html>
-<head>
-<title>wdfanyi</title>
-<meta http-equiv="Content-Type" content="text/html; charset=utf8">
-<link href="../static/main.css" rel="stylesheet" type="text/css" media="all" />
-    {% include 'seo.html' %}
-</head>
-  <body>
-<a href='/show/li'>LI</a>
-
-<div style="float:auto;width:auto;margin-right: auto; margin-left: auto;">
-	{% for LI in LIS %}
-	<fieldset>
-
-		<legend>{{LI.time|date:"Y年m月d日 H时i分"}}</legend>
-
-	<pre>{{LI.content|escape}}</pre>
-
-	<div style="font-size:12px;color:#630;float:left;"></div>
-
-	<div style="font-size:12px;color:#000;float:right;"></div>
-
-	</fieldset>
-	{% endfor %}
-			<form action="/li/new" method="post">
-		<fieldset>
-		<legend>LI</legend>
-		<div>	<textarea name='content'>{{LASTLI|escape}}</textarea></div>
-		<input type="submit" class="btn3" value="提交" >
-		</fieldset>
-		</form>
-</div>
-
-
-
-    {% include 'header.html' %}
-  {% include 'footer.html' %}
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <title>
+      wdfanyi
+    </title>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf8" />
+    <link href="../static/main.css" rel="stylesheet" type="text/css" media="all" />
+    <style type="text/css">
+/*<![CDATA[*/
+    div.c3 {float:auto;width:auto;margin-right: auto; margin-left: auto;}
+    div.c2 {font-size:12px;color:#000;float:right;}
+    div.c1 {font-size:12px;color:#630;float:left;}
+    /*]]>*/
+    </style>
+  </head>
+  <body>{% include 'header.html' %} 
+    {% include 'seo.html' %} <a href='/show/li'>LI</a>
+    <div class="c3">
+      <form action="/li/new" method="post">
+        <fieldset>
+          <legend>LI</legend>
+          <div>
+            <textarea name='content'>
+{{LASTLI|escape}}
+</textarea>
+          </div><input type="submit" class="btn3" value="提交" />
+        </fieldset>
+      </form>{% for LI in LIS %}
+      <fieldset>
+        <legend>{{LI.time|date:"Y年m月d日 H时i分"}}</legend>
+        <pre>
+{{LI.content|escape}}
+</pre>
+        <div class="c1"></div>
+        <div class="c2"></div>
+      </fieldset>{% endfor %}
+    </div>{% include 'footer.html' %}
   </body>
-</html>
+</html>

tpl/mainpage.html

-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-
-<html>
-<head>
-<title>wdfanyi</title>
-<meta http-equiv="Content-Type" content="text/html; charset=utf8">
-<link href="../static/main.css" rel="stylesheet" type="text/css" media="all" />
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+  <head>
+    <title>
+      wdfanyi
+    </title>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf8" />
+    <link href="../static/main.css" rel="stylesheet" type="text/css" media="all" />
+    <style type="text/css">
+/*<![CDATA[*/
+    div.c3 {float:left;width:25%}
+    div.c2 {float:left;width:20%}
+    div.c1 {text-align:center;float:left;width:30%;}
+    /*]]>*/
+    </style>
+  </head>
+  <body>{% include 'header.html' %}
     {% include 'seo.html' %}
-</head>
-  <body>
-
-
-
-<div style="text-align:center;float:left;width:30%;">
-<fieldset>
-<legend><a href='/show/words'>WORDS</a></legend>
-	{% for WORD in WORDSS %}
-	<fieldset>
-
-		<legend>{{WORD.time|date:"Y年m月d日 H时i分"}}</legend>
-
-<div class="word"><object data="http://www.google.com/dictionary/flash/SpeakerApp16.swf" type="application/x-shockwave-flash" id="pronunciation" height="36" width=" 36">
-    <param name="movie" value="http://www.google.com/dictionary/flash/SpeakerApp16.swf">
-    <param name="flashvars" value="sound_name=http://www.gstatic.com/dictionary/static/sounds/de/0/{{WORD.EN}}.mp3">
-    <param name="wmode" value="transparent">
-    <a href="http://www.gstatic.com/dictionary/static/sounds/de/0/{{WORD.EN}}.mp3"><img src="http://www.google.com/dictionary/flash/SpeakerOffA16.png" alt="发音" height="16" width="16" border="0"></a>
-    </object></div>
-	<p>{{WORD.EN|escape}}</p>
-
-		<hr class="l" />
-	<p>{{WORD.CN|escape}}</p>
-
-	</fieldset>
-
-	{% endfor %}
-
-
-	<form action="/translate" method="post">
-
-		<div>	<textarea rows="5" cols="40" name='word'></textarea></div>
-		<input type="submit" class="btn3" value="提交" >
-		</fieldset>
-		</form>
-</div>
-<!--
+    <div class="c1">
+      <fieldset>
+        <legend><a href='/show/words'>WORDS</a></legend> {% for WORD in WORDSS %}
+        <fieldset>
+          <legend>{{WORD.time|date:"Y年m月d日 H时i分"}}</legend>
+          <div class="word">
+            <object data="http://www.google.com/dictionary/flash/SpeakerApp16.swf" type=
+            "application/x-shockwave-flash" id="pronunciation" height="36" width=" 36">
+              <param name="movie" value=
+              "http://www.google.com/dictionary/flash/SpeakerApp16.swf" />
+              <param name="flashvars" value=
+              "sound_name=http://www.gstatic.com/dictionary/static/sounds/de/0/{{WORD.EN}}.mp3" />
+              <param name="wmode" value="transparent" />
+              <a href=
+              "http://www.gstatic.com/dictionary/static/sounds/de/0/{{WORD.EN}}.mp3"><img src=
+              "http://www.google.com/dictionary/flash/SpeakerOffA16.png" alt="发音" height="16"
+              width="16" border="0" /></a>
+            </object>
+          </div>
+          <p>
+            {{WORD.EN|escape}}
+          </p>
+          <hr class="l" />
+          <p>
+            {{WORD.CN|escape}}
+          </p>
+        </fieldset>{% endfor %}
+        <form action="/translate" method="post">
+          <div>
+            <textarea rows="5" cols="40" name='word'>
+</textarea>
+          </div><input type="submit" class="btn3" value="提交" />
+        </form>
+      </fieldset>
+    </div><!--
 <div style="text-align:center;float:left;width:30%;">
 <fieldset>
 <legend><a href='/show/wiki'>WIKI</a></legend>
-	{% for WIKI in WIKIS %}
-	<fieldset>
+        {% for WIKI in WIKIS %}
+        <fieldset>
 
-		<legend>{{WIKI.time|date:"Y年m月d日 H时i分"}}</legend>
+                <legend>{{WIKI.time|date:"Y年m月d日 H时i分"}}</legend>
 
 
-	<p><a href="http://gg.eeload.com/search?hl=zh-CN&source=hp&biw=&bih=&q={{WIKI.EN}}&btnG=Google+%E6%90%9C%E7%B4%A2">GOOGLE</a>
-		<a href="http://en.wikipedia.org/wiki/{{WIKI.EN}}">wikipedia</a>
-	{{WIKI.EN|escape}}</p>
-		<hr class="l" />
-	<p><a href="http://gg.eeload.com/search?hl=zh-CN&source=hp&biw=&bih=&q={{WIKI.CN}}&btnG=Google+%E6%90%9C%E7%B4%A2">GOOGLE</a>
-		<a href="http://CN.wikipedia.org/wiki/{{WIKI.CN}}">wikipedia</a>
-	{{WIKI.CN|escape}}</p>
+        <p><a href="http://gg.eeload.com/search?hl=zh-CN&source=hp&biw=&bih=&q={{WIKI.EN}}&btnG=Google+%E6%90%9C%E7%B4%A2">GOOGLE</a>
+                <a href="http://en.wikipedia.org/wiki/{{WIKI.EN}}">wikipedia</a>
+        {{WIKI.EN|escape}}</p>
+                <hr class="l" />
+        <p><a href="http://gg.eeload.com/search?hl=zh-CN&source=hp&biw=&bih=&q={{WIKI.CN}}&btnG=Google+%E6%90%9C%E7%B4%A2">GOOGLE</a>
+                <a href="http://CN.wikipedia.org/wiki/{{WIKI.CN}}">wikipedia</a>
+        {{WIKI.CN|escape}}</p>
 
-	<hr class="l" />
-	<p>{{WIKI.tip|escape}}</p>
-	</fieldset>
+        <hr class="l" />
+        <p>{{WIKI.tip|escape}}</p>
+        </fieldset>
 
-	{% endfor %}
+        {% endfor %}
 
 
-		<form action="/wiki/new" method="post">
+                <form action="/wiki/new" method="post">
 
-		<div>	<input type="text" name='name' /></div>
-		<div>	<textarea rows="4" cols="30" name='tip'></textarea></div>
-		<input type="submit" class="btn3" value="提交" >
-		</fieldset>
-		</form>
+                <div>   <input type="text" name='name' /></div>
+                <div>   <textarea rows="4" cols="30" name='tip'></textarea></div>
+                <input type="submit" class="btn3" value="提交" >
+                </fieldset>
+                </form>
 </div>
 -->
-<div style="float:left;width:20%">
-		<form action="/li/new" method="post">
-		<fieldset>
-		<legend><a href='/show/li'>LI</a></legend>
-		<div>	<textarea  name='content'>{{LASTLI|escape}}</textarea></div>
-		<input type="submit" class="btn3" value="提交" >
-
-		</form>
-{% for LI in LIS %}
-	<fieldset>
-
-		<legend>{{LI.time|date:"Y年m月d日 H时i分"}}</legend>
-
-	<pre>{{LI.content|escape}}</pre>
-
-
-
-	</fieldset>
-	{% endfor %}
-</fieldset>
-</div>
-
-<div style="float:left;width:25%">
-		<form action="/swap/new" method="post">
-		<fieldset>
-		<legend><a href='/show/swap'>SWAP</a></legend>
-		<div>	<textarea rows="20" cols="55" name='content'>{{LASTSWAP|escape}}</textarea></div>
-		<input type="submit" class="btn3" value="提交" >
-
-		</form>
-{% for SWAP in SWAPS %}
-	<fieldset>
-
-		<legend>{{SWAP.time|date:"Y年m月d日 H时i分"}}</legend>
-
-	<pre>{{SWAP.content|escape}}</pre>
-
-
-
-	</fieldset>
-	{% endfor %}
-</fieldset>
-</div>
-
-
-
-    {% include 'header.html' %}
-  {% include 'footer.html' %}
+    <div class="c2">
+      <form action="/li/new" method="post">
+        <fieldset>
+          <legend><a href='/show/li'>LI</a></legend>
+          <div>
+            <textarea name='content'>
+{{LASTLI|escape}}
+</textarea>
+          </div><input type="submit" class="btn3" value="提交" />
+        </fieldset>
+      </form>{% for LI in LIS %}
+      <fieldset>
+        <legend>{{LI.time|date:"Y年m月d日 H时i分"}}</legend>
+        <pre>
+{{LI.content|escape}}
+</pre>
+      </fieldset>{% endfor %}
+    </div>
+    <div class="c3">
+      <form action="/swap/new" method="post">
+        <fieldset>
+          <legend><a href='/show/swap'>SWAP</a></legend>
+          <div>
+            <textarea rows="20" cols="55" name='content'>
+{{LASTSWAP|escape}}
+</textarea>
+          </div><input type="submit" class="btn3" value="提交" />
+        </fieldset>
+      </form>{% for SWAP in SWAPS %}
+      <fieldset>
+        <legend>{{SWAP.time|date:"Y年m月d日 H时i分"}}</legend>
+        <pre>
+{{SWAP.content|escape}}
+</pre>
+      </fieldset>{% endfor %}
+    </div> {% include 'footer.html' %}
   </body>
-</html>
+</html>
     {% include 'seo.html' %}
 </head>
   <body>
+      {% include 'header.html' %}
 <a href='/show/swap'>SWAP</a>
 
 <div style="float:auto;width:auto;margin-right: auto; margin-left: auto;">
+				<form action="/swap/new" method="post">
+		<fieldset>
+		<legend>SWAP</legend>
+		<div>	<textarea rows="20" cols="60" name='content'>{{LASTSWAP|escape}}</textarea></div>
+		<input type="submit" class="btn3" value="提交" >
+		</fieldset>
+		</form>
 	{% for SWAP in SWAPS %}
 	<fieldset>
 
 
 	</fieldset>
 	{% endfor %}
-			<form action="/swap/new" method="post">
-		<fieldset>
-		<legend>SWAP</legend>
-		<div>	<textarea rows="20" cols="60" name='content'>{{LASTSWAP|escape}}</textarea></div>
-		<input type="submit" class="btn3" value="提交" >
-		</fieldset>
-		</form>
+
 </div>
 
 
 
-    {% include 'header.html' %}
+
   {% include 'footer.html' %}
   </body>
 </html>
     {% include 'seo.html' %}
 </head>
   <body>
+  
+    {% include 'header.html' %}
 <a href='/show/wiki'>WIKI</a>
 <div style="text-align:center;float:center;width:auto;margin-right: auto; margin-left: auto;">
 
+	<form action="/wiki/new" method="post">
+		<fieldset>
+		<legend>WIKI</legend>
+		<div>	<input type="text" name='name' /></div>
+		<div>	<textarea rows="5" cols="40" name='tip'></textarea></div>
+		<input type="submit" class="btn3" value="提交" >
+		</fieldset>
+		</form>
 	{% for WIKI in WIKIS %}
 	<fieldset>
 
 	{% endfor %}
 
 
-	<form action="/wiki/new" method="post">
-		<fieldset>
-		<legend>WIKI</legend>
-		<div>	<input type="text" name='name' /></div>
-		<div>	<textarea rows="5" cols="40" name='tip'></textarea></div>
-		<input type="submit" class="btn3" value="提交" >
-		</fieldset>
-		</form>
 </div>
 
 
 
-    {% include 'header.html' %}
   {% include 'footer.html' %}
   </body>
 </html>
 </head>
   <body>
 
+    {% include 'header.html' %}
 <a href='/show/words'>WORDS</a>
 
 <div style="text-align:center;float:center;width:auto;margin-right: auto; margin-left: auto;">
+	<form action="/translate" method="post">
+		<fieldset>
+		<legend>翻译</legend>
+		<div>	<textarea rows="5" cols="40" name='word'></textarea></div>
+		<input type="submit" class="btn3" value="提交" >
+		</fieldset>
+		</form>
 
 	{% for WORD in WORDSS %}
 	<fieldset>
 
 	{% endfor %}
 
-	<form action="/translate" method="post">
-		<fieldset>
-		<legend>翻译</legend>
-		<div>	<textarea rows="5" cols="40" name='word'></textarea></div>
-		<input type="submit" class="btn3" value="提交" >
-		</fieldset>
-		</form>
 
 </div>
 
 
 
-    {% include 'header.html' %}
   {% include 'footer.html' %}
   </body>
 </html>

yui.pyc

Binary file removed.