From 024f6e82e68b9e862387ec541dd4ab4328d9df9c Mon Sep 17 00:00:00 2001 From: 藍挺瑋 Date: Fri, 21 Dec 2012 09:52:09 +0800 Subject: NTU CEIBA 解析支援,但網頁部份尚未實作(仍在測試中,可能修改 API) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 繳交日期之後會改成字串,因為其實只有期限比較重要而已...... --- access/imnc.py | 28 ++++++++++++ jinhtml/import.html | 46 ++++++++++++++++++-- js/imnc.js | 40 +++++++++++++++++ ntuceiba/__init__.py | 17 ++++++++ ntuceiba/parse.py | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++ ntuceiba/toxml.py | 70 ++++++++++++++++++++++++++++++ 6 files changed, 317 insertions(+), 3 deletions(-) create mode 100644 access/imnc.py create mode 100644 ntuceiba/__init__.py create mode 100644 ntuceiba/parse.py create mode 100644 ntuceiba/toxml.py diff --git a/access/imnc.py b/access/imnc.py new file mode 100644 index 0000000..2451bd7 --- /dev/null +++ b/access/imnc.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python +# -*- coding: UTF-8 -*- + +import webapp2 +from StringIO import StringIO + +from ntuceiba import NtuCeibaEvent +from ntuceiba.parse import ntuceiba_parser +from ntuceiba.toxml import ntuceiba_toxml + +from google.appengine.api import users +from google.appengine.ext import db + +class NtuCeibaImport(webapp2.RedirectHandler): + def get(self): + return + def post(self): + viewonly = self.request.get('viewonly') + htmlfile = self.request.get('file') + if viewonly != "": + htmlfile = StringIO(htmlfile) + htmlfile.readline() + cblist = ntuceiba_parser(htmlfile) + self.response.headers['Content-Type'] = 'text/xml; charset=UTF-8' + self.response.out.write(ntuceiba_toxml(cblist)) + + +app = webapp2.WSGIApplication([('/access/imnc', NtuCeibaImport)]) diff --git a/jinhtml/import.html b/jinhtml/import.html index 7af9a77..25e928b 100644 --- a/jinhtml/import.html +++ b/jinhtml/import.html @@ -5,9 +5,23 @@ margin-top: 20px; margin-left: 20px; } + div.indented{ + padding-left: 35px; + } p.question{ font-size: xx-large; } + input.loginfield{ + width: 300px; + } + ul.nolistsymbol{ + list-style-type: none; + margin-left: 20px; + margin-right: 0px; + margin-top: 0px; + margin-bottom: 0px; + padding: 0px; + } {% endblock %} @@ -18,6 +32,7 @@ {% endblock %} {% block headjs %} +