├── .gitignore ├── LICENSE ├── Procfile ├── README.md ├── config.py ├── requirements.txt ├── run.py ├── setup.cfg ├── setup.py ├── static ├── css │ ├── aiglos.css │ ├── grids-min.css │ └── reset-min.css ├── images │ ├── close.png │ ├── comment-active.png │ ├── comment-hover.png │ ├── comments1.png │ ├── comments2.png │ ├── comments3.png │ ├── comments4.png │ ├── e-handle-dark.gif │ ├── loading.gif │ ├── s-handle-dark.gif │ └── se-handle-dark.gif └── js │ └── aiglos.js ├── templates ├── base.html ├── comment.html ├── index.html └── page.html └── tests ├── __init__.py └── pytest_test.py /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | env/ 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | downloads/ 16 | eggs/ 17 | .eggs/ 18 | lib/ 19 | lib64/ 20 | parts/ 21 | sdist/ 22 | var/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | 27 | # PyInstaller 28 | # Usually these files are written by a python script from a template 29 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 30 | *.manifest 31 | *.spec 32 | 33 | # Installer logs 34 | pip-log.txt 35 | pip-delete-this-directory.txt 36 | 37 | # Unit test / coverage reports 38 | htmlcov/ 39 | .tox/ 40 | .coverage 41 | .coverage.* 42 | .cache 43 | nosetests.xml 44 | coverage.xml 45 | *,cover 46 | .hypothesis/ 47 | 48 | # Translations 49 | *.mo 50 | *.pot 51 | 52 | # Django stuff: 53 | *.log 54 | 55 | # Sphinx documentation 56 | docs/_build/ 57 | 58 | # PyBuilder 59 | target/ 60 | 61 | #Ipython Notebook 62 | .ipynb_checkpoints 63 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 小明 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: gunicorn run.app --log-file - -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Aiglos 2 | 3 | ### ☤ Feature 4 | 5 | 1. 在线浏览渲染的本地Markdown文件。 6 | 2. 提供 http://djangobook.py3k.cn/2.0/ 那样的评注系统。 7 | 3. 评注支持Markdown语法。 8 | 9 | ### ☤ Demo 10 | 11 | [Demo](https://dry-castle-71587.herokuapp.com/) 12 | 13 | ### ☤ Quick start 14 | 15 | ``` 16 | ❯ git clone https://github.com/dongweiming/aiglos 17 | ❯ cd aiglos 18 | ❯ virtualenv-2.7 venv 19 | ❯ source venv/bin/activate 20 | ❯ pip install -r requirements.txt 21 | ❯ touch local_settings.py # 增加BOOK_DIR (Markdown文件存放目录), SQLALCHEMY_DATABASE_URI等配置 22 | ❯ gunicorn -w 3 run:app -b 0.0.0.0:8000 23 | ``` 24 | -------------------------------------------------------------------------------- /config.py: -------------------------------------------------------------------------------- 1 | # coding=utf-8 2 | SQLALCHEMY_DATABASE_URI = 'sqlite://' 3 | SQLALCHEMY_TRACK_MODIFICATIONS = False 4 | MAKO_TRANSLATE_EXCEPTIONS = False 5 | BOOK_DIR = None 6 | HOST = '0.0.0.0' 7 | PORT = 8080 8 | DEBUG = False 9 | 10 | try: 11 | from local_settings import * # noqa 12 | except ImportError: 13 | pass 14 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | Cython==0.23.4 2 | Flask==0.10.1 3 | Flask-Mako==0.4 4 | Flask-SQLAlchemy==2.1 5 | Jinja2==2.8 6 | Mako==1.0.3 7 | MarkupSafe==0.23 8 | SQLAlchemy==1.0.12 9 | Werkzeug==0.11.4 10 | appnope==0.1.0 11 | decorator==4.0.9 12 | gnureadline==6.3.3 13 | gunicorn==19.4.5 14 | ipython==4.1.1 15 | ipython-genutils==0.1.0 16 | itsdangerous==0.24 17 | mistune==0.7.1 18 | path.py==8.1.2 19 | pexpect==4.0.1 20 | pickleshare==0.6 21 | ptyprocess==0.5.1 22 | simplegeneric==0.8.1 23 | traitlets==4.1.0 24 | wsgiref==0.1.2 25 | -------------------------------------------------------------------------------- /run.py: -------------------------------------------------------------------------------- 1 | # coding=utf-8 2 | import os 3 | import codecs 4 | from datetime import datetime 5 | from json import dumps 6 | 7 | from flask import Flask, Markup, request 8 | from werkzeug.utils import secure_filename 9 | from flask_mako import render_template, MakoTemplates, render_template_def 10 | from flask_sqlalchemy import SQLAlchemy 11 | from sqlalchemy import distinct, func 12 | import mistune 13 | 14 | app = Flask(__name__) 15 | mako = MakoTemplates(app) 16 | app.config.from_object('config') 17 | db = SQLAlchemy(app) 18 | 19 | BOOK_DIR = app.config['BOOK_DIR'] 20 | markdown = None 21 | 22 | if BOOK_DIR is None: 23 | print 'You must specify `BOOK` in local_settings.py' 24 | exit(1) 25 | 26 | 27 | def get_summary_content(): 28 | path = os.path.join(BOOK_DIR, 'SUMMARY.md') 29 | if os.path.exists(path): 30 | with codecs.open(path, 'r', 'utf-8') as f: 31 | content = f.read() 32 | else: 33 | content = ('Aiglos uses a SUMMARY.md file to define the structure ' 34 | 'of chapters and subchapters of the book. See ' 35 | 'https://help.gitbook.com/format/chapters.html ' 36 | 'for more details.') 37 | return Markup(markdown(content)) 38 | 39 | 40 | class Comments(db.Model): 41 | id = db.Column(db.Integer, primary_key=True) 42 | content = db.Column(db.String(10000)) 43 | nodenum = db.Column(db.Integer) 44 | chapter = db.Column(db.String(100)) 45 | section = db.Column(db.String(100)) 46 | pub_date = db.Column(db.DateTime) 47 | 48 | def __init__(self, chapter, section, nodenum, content, pub_date=None): 49 | self.chapter = chapter 50 | self.section = section 51 | self.nodenum = nodenum 52 | self.content = content 53 | if pub_date is None: 54 | pub_date = datetime.utcnow() 55 | self.pub_date = pub_date 56 | 57 | def __repr__(self): 58 | return ''.format(self.id, self.chapter, 59 | self.section, self.nodenum) 60 | 61 | 62 | db.create_all() 63 | 64 | 65 | class Renderer(mistune.Renderer): 66 | def __init__(self, **kwargs): 67 | super(Renderer, self).__init__(**kwargs) 68 | self.c = 0 69 | self.cn = 0 70 | 71 | def header(self, text, level, raw=None): 72 | res = '%s\n' % ( 73 | level, self.cn, text, level) 74 | self.cn += 1 75 | return res 76 | 77 | def paragraph(self, text): 78 | res = '

%s

\n' % ( 79 | self.cn, text.strip(' ')) 80 | self.cn += 1 81 | return res 82 | 83 | def block_code(self, code, lang=None): 84 | code = code.rstrip('\n') 85 | code = mistune.escape(code, smart_amp=False) 86 | res = '
%s\n
\n' % ( 87 | self.cn, code) 88 | self.cn += 1 89 | return res 90 | 91 | def list_item(self, text): 92 | res = '
  • %s

  • \n' % ( # noqa 93 | self.cn, self.cn, text) 94 | self.cn += 1 95 | return res 96 | 97 | 98 | @app.before_request 99 | def before_request(): 100 | renderer = Renderer() 101 | global markdown 102 | markdown = mistune.Markdown(renderer=renderer) 103 | 104 | 105 | def patch_comments(comments): 106 | for comment in comments: 107 | comment.content = Markup(markdown(comment.content)) 108 | yield comment 109 | 110 | 111 | @app.route('/') 112 | def index(): 113 | content = get_summary_content() 114 | return render_template('index.html', content=content) 115 | 116 | 117 | @app.route('//
    /') 118 | def section(chapter, section): 119 | chapter = secure_filename(chapter) 120 | section = secure_filename(section) 121 | path = os.path.join(BOOK_DIR, chapter, section) 122 | with codecs.open(path, 'r', 'utf-8') as f: 123 | content = f.read() 124 | content = Markup(markdown(content)) 125 | return render_template('page.html', **locals()) 126 | 127 | 128 | @app.route('//
    /comments//') 129 | @app.route('//
    /comments/', methods=['GET', 'POST']) 130 | def comment(chapter, section, comment_id=None): 131 | if comment_id is None and request.method == 'POST': 132 | nodenum = request.form.get('nodenum') 133 | comment = request.form.get('comment') 134 | if not (nodenum and comment) or not nodenum.isdigit(): 135 | return 'Wrong!' 136 | nodenum = int(nodenum) 137 | c = Comments(chapter, section, nodenum, comment) 138 | db.session.add(c) 139 | db.session.commit() 140 | return '
  • ' 141 | 142 | cond = {'chapter': chapter, 'section': section} 143 | if comment_id is not None: 144 | cond.update({'nodenum': comment_id}) 145 | comments = Comments.query.filter_by(**cond).order_by(Comments.id.desc()) 146 | comments = patch_comments(comments) 147 | return render_template_def('comment.html', 'main', comments=comments) 148 | 149 | 150 | @app.route('//
    /comments/counts/') 151 | def counts(chapter, section): 152 | counts = db.session.query(Comments.nodenum, func.count( 153 | distinct(Comments.id))).filter_by( 154 | chapter=chapter, section=section).group_by( 155 | Comments.nodenum).all() 156 | return dumps(counts) 157 | 158 | 159 | if __name__ == '__main__': 160 | app.run(host=app.config['HOST'], port=app.config['PORT'], debug=app.debug) 161 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [pytest] 2 | norecursedirs=venv -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import find_packages, setup 2 | from setuptools.command.test import test as TestCommand 3 | 4 | 5 | class PyTest(TestCommand): 6 | 7 | def run_tests(self): 8 | import pytest 9 | errno = pytest.main([]) 10 | exit(errno) 11 | 12 | 13 | setup( 14 | name='Aiglos', 15 | version=0.1, 16 | url='http://www.dongwm.com/', 17 | author='Dong Weiming', 18 | license='BSD', 19 | packages=find_packages( 20 | exclude=["*.tests", "*.tests.*", "tests.*", "tests"]), 21 | zip_safe=False, 22 | test_suite="tests", 23 | tests_require=['pytest'], 24 | cmdclass={'test': PyTest}, 25 | classifiers=[ 26 | 'Development Status :: 2 - Pre-Alpha', 27 | 'Environment :: Web Environment', 28 | 'Framework :: Flask', 29 | 'Intended Audience :: Developers', 30 | 'License :: OSI Approved :: BSD License', 31 | 'Operating System :: OS Independent', 32 | 'Programming Language :: Python', 33 | 'Programming Language :: Python :: 2', 34 | 'Programming Language :: Python :: 2.7', 35 | 'Topic :: Software Development :: Libraries :: Application Frameworks', 36 | 'Topic :: Software Development :: Libraries :: Python Modules', 37 | ], 38 | ) 39 | -------------------------------------------------------------------------------- /static/css/aiglos.css: -------------------------------------------------------------------------------- 1 | /*** setup ***/ 2 | body { font:75%/1.5 "Microsoft YaHei","Lucida Grande",Verdana !important; background:#092e20; color: white;} 3 | 4 | #bd { background:#487858; } 5 | #doc { padding-top:16px; } 6 | 7 | /*** links ***/ 8 | a img {border: none;} 9 | a {text-decoration: none;} 10 | a:hover { color:#ffe761; } 11 | a:link, a:visited { color:#ffc757; } 12 | h2 a, h3 a, h4 a { text-decoration:none !important; } 13 | #bd a:hover { background-color:#E0FFB8; color:#234f32; text-decoration:none; } 14 | #bd a:link, #bd a:visited { color:#ab5603; } 15 | 16 | /*** nav ***/ 17 | div.nav { margin: 0; font-size: 11px; text-align: right; color: #487858;} 18 | #hd div.nav { margin-top: -27px; } 19 | #ft div.nav { margin-bottom: -18px; } 20 | 21 | #hd h1 a { color: white; } 22 | 23 | #global-nav { position:absolute; top:5px; padding:7px 0; color:#263E2B;} 24 | #global-nav a:link, #global-nav a:visited {color:#487858;} 25 | #global-nav a {padding:0 4px;} 26 | #global-nav a.about {padding-left:0;} 27 | #global-nav:hover {color:#fff;} 28 | #global-nav:hover a:link, #global-nav:hover a:visited { color:#ffc757; } 29 | 30 | 31 | /*** content ***/ 32 | #chapter-body { position: relative; } 33 | #yui-main div.yui-b { margin: 0 20px 0 20px; background: white; color: black; padding: 0.3em 2em 1em 2em; } 34 | dd { margin-left:15px; } 35 | h1 { font-size:218%; margin-top:0.6em; margin-bottom:.4em; line-height:1.1em; } 36 | h1,h2,h3,h4 { margin-top:1.4em; font-family:"Trebuchet MS",sans-serif; font-weight:normal; } 37 | h2 { font-size: 140%; color:#487858; } 38 | h2#chapter-title { font-size: 218%; line-height:1.2em; margin-bottom: 0.8em; } 39 | h2#chapter-subtitle { font-size: 140%; margin-top:-1.2em !important; margin-bottom:1.6em; margin-left:.2em; color:#487858; } 40 | h3 { font-size:150%; margin-bottom:.6em; line-height:1.2em; color:#092e20; } 41 | h4 { font-size:125%; font-weight:bold; margin-bottom:.2em; color:#487858; } 42 | h5 { font-size:1em; font-weight:bold; margin-top:1.5em; margin-bottom:3px; } 43 | div.figure { text-align: center; } 44 | div.figure p.caption { font-size:1em; margin-top:0; margin-bottom:1.5em; color: #555;} 45 | hr { color:#ccc; background-color:#ccc; height:1px; border:0; } 46 | p, ul, dl { margin-top:.6em; margin-bottom:1em; padding-bottom: 0.1em;} 47 | #chapter-body img { max-width: 50em; margin-left: auto; margin-right: auto; display: block; } 48 | table { color:#000; margin-bottom: 1em; width: 100%; } 49 | table.docutils td p { margin-top:0; margin-bottom:.5em; } 50 | table.docutils td, table.docutils th { border-bottom:1px solid #dfdfdf; padding:4px 2px;} 51 | table.docutils thead th { border-bottom:2px solid #dfdfdf; text-align:left; font-weight: bold; white-space: nowrap; } 52 | table.docutils thead th p { margin: 0; padding: 0; } 53 | table.docutils { border-collapse:collapse; } 54 | caption { font-size:1em; font-weight:bold; margin-top:0.5em; margin-bottom:0.5em; margin-left: 2px; text-align: center; } 55 | blockquote { padding: 0 1em; margin: 1em 0; font:125%/1.2em "Trebuchet MS", sans-serif; color:#234f32; border-left:2px solid #94da3a; } 56 | strong { font-weight: bold; } 57 | em { font-style: italic; } 58 | 59 | /*** one-off for chapter 7 ***/ 60 | #chapter-body #cn0 strong { font-size:150%; margin-bottom:.6em; line-height:1.2em; color:#092e20; } 61 | 62 | /*** messages ***/ 63 | div.newer-version, div.message {color:#092e20; background: #FAFBD1 url(../images/error.png) no-repeat 10px 50%; padding:3px 2px 5px 35px; font-size:13px; margin-top:1.5em;} 64 | 65 | /*** lists ***/ 66 | ul { padding-left:30px; } 67 | ol { padding-left:30px; } 68 | ol.arabic { list-style-type: decimal; } 69 | ul li, ol li { list-style-type:square; margin-bottom:.4em; } 70 | ul ul { padding-left:1.2em; } 71 | ul ul ul { padding-left:1em; } 72 | ul.linklist, ul.toc { padding-left:0; } 73 | ul.toc ul { margin-left:.6em; } 74 | ul.toc ul li { list-style-type:square; } 75 | ul.toc ul ul li { list-style-type:disc; } 76 | ul.linklist li, ul.toc li { list-style-type:none; } 77 | dt { font-weight:bold; margin-top:.5em; font-size:1.1em; } 78 | dd { margin-bottom:.8em; } 79 | ol.toc { margin-bottom: 2em; } 80 | ol.toc li { font-size:125%; padding: .5em; line-height:1.2em; clear: right; } 81 | ol.toc li.b { background-color: #E0FFB8; } 82 | ol.toc li a:hover { background-color: transparent !important; text-decoration: underline !important; } 83 | ol.toc span.release-date { color:#487858; float: right; font-size: 85%; padding-right: .5em; } 84 | ol.toc span.comment-count { font-size: 75%; color: #999; } 85 | /*** code blocks ***/ 86 | .literal { white-space:nowrap; } 87 | .literal, .literal-block { color:#234f32; } 88 | .sidebar .literal { color:white; background:transparent; font-size:11px; } 89 | h4 .literal { color: #234f32; font-size: 13px; } 90 | pre, .literal-block { font-size:medium; background:#E0FFB8; border:1px solid #94da3a; border-width:1px 0; margin: 1em 0; padding: .3em .4em; overflow: hidden; } 91 | dt .literal, table .literal { background:none; } 92 | 93 | /*** notes & admonitions ***/ 94 | .note, .admonition { padding:.8em 1em .8em; margin: 1em 0; border:1px solid #94da3a; } 95 | .admonition-title { font-weight:bold; margin-top:0 !important; margin-bottom:0 !important;} 96 | .admonition .last { margin-bottom:0 !important; } 97 | .admonition-philosophy { padding-left:65px; background:url(http://media.djangoproject.com/img/doc/icons/docicons-philosophy.gif) .8em .8em no-repeat;} 98 | .note, .admonition { padding-left:65px; background:url(http://media.djangoproject.com/img/doc/icons/docicons-note.gif) .8em .8em no-repeat;} 99 | .admonition-behind-the-scenes { padding-left:65px; background:url(http://media.djangoproject.com/img/doc/icons/docicons-behindscenes.gif) .8em .8em no-repeat;} 100 | 101 | /*** comment stuff ***/ 102 | .cn { position: relative; } 103 | #bookcomments { padding: 0; border: 1px #092e20 solid; left: 300; top:0; position: absolute; z-index: 10; background-color: #E0FFB8; width: 600px; height: 400px; color: black; overflow: hidden; display: none; text-align: left; } 104 | #comment-tabs { padding: 6px; } 105 | #bookcomments .ft { height:50px; overflow:hidden; padding: 6px; } 106 | #bookcomments .tabset .hd li a { background-color: #487858; color:white; } 107 | #bookcomments .tabset .hd li.on em { color: #092e20; } 108 | #bookcomments .yui-ext-tabbody { font-size: 90%; background-color: white; border: 1px #999 solid; border-top: none; height: 285px; overflow: auto; padding: 1em; } 109 | #bookcomments div.tab input { width: 100%; } 110 | #bookcomments div.tab input#id_name { width: 70%; } 111 | #bookcomments div.tab input#id_remember_me { width: auto; } 112 | #bookcomments div.tab label { font-weight: bold; display: block; color: #487858; } 113 | #bookcomments div.tab textarea { width: 100%; height: 100px; } 114 | #bookcomments div.tab p { margin-bottom: 0; } 115 | #bookcomments div.tab span.actions { float: right; margin-top: -15px; } 116 | #bookcomments div.tab span.thanks { color: black; font-weight: bold; color: #F7C754; position: relative;} 117 | #bookcomments-close { margin-left:5px;margin-right:15px; } 118 | #bookcomments-head .close { position: absolute; top: 3px; right: 4px; height: 13px; width: 17px; margin:0; padding: 0; overflow: hidden; text-indent:-999px; background: url(../images/close.png) no-repeat top left;} 119 | #bookcomments-head { background-color: #487858; color: white; padding: 2px 4px; font-weight: bold; margin: 0 0 6px 0; position: relative;} 120 | #bookcomments-message { font-size: 90%; padding-left: 20px; float:left; clear:none; width:270px; } 121 | #bookcomments-message.loading { background: url(../images/loading.gif) no-repeat center left; } 122 | #bookcomments-message.error { background: url(../images/error.png) no-repeat center left; color: red; font-weight: bold; } 123 | #comments-submit-wrapper { float:right; clear:none;white-space:nowrap; width: 150px; text-align: right;} 124 | #comments-submit-wrapper input { font-size: 11px; } 125 | #highlight-floater { position: absolute; z-index: 5; background: #487858; top:0; left:0; width:100%; height: 10px; visibility: hidden; border-top: 1px black solid; border-bottom: 1px black solid; border-left: 20px black solid;} 126 | 127 | /*** comment box resizer ***/ 128 | #bookcomments .yresizable-handle-east { background-image: url(../images/e-handle-dark.gif); border: 0px; } 129 | #bookcomments .yresizable-handle-south { background-image: url(../images/s-handle-dark.gif); border: 0px; } 130 | #bookcomments .yresizable-handle-southeast { background-image: url(../images/se-handle-dark.gif); border: 0px; } 131 | 132 | /*** comment list tab ***/ 133 | #comment-tabs div.tab ol { padding: 0; margin: 0; font-size: 90%; } 134 | #comment-tabs div.tab dl { margin-bottom: 0; } 135 | #comment-tabs div.tab li { border-bottom: 1px #E0FFB8 solid; } 136 | #comment-tabs div.tab li span.meta { font-weight:normal; color: #487858; font-size: 90%; } 137 | #comment-tabs div.tab a:hover { background-color:#E0FFB8; color:#234f32; text-decoration:none; } 138 | #comment-tabs div.tab a:link, #comment-tabs div.tab a:visited { color:#ab5603; } 139 | 140 | /*** comment indicator ***/ 141 | /*div.comment-indicator { position: absolute; width: 20px; z-index: 999; text-align: center; color: black; font-size: 11px; left: -44px; top: 0; } 142 | */ 143 | div.comment-indicator { position: absolute; width: 20px; z-index: 999; text-align: center; color:black; font-size: 11px; left: -44px; top: 0; } 144 | li.cn div.comment-indicator { left: -74px; } 145 | 146 | pre div.comment-indicator { left: -44px; width: 64px} 147 | pre div.comment-indicator span { position: absolute; top: 0px; left: 700px; width: 25px; height: 25px; } 148 | pre div.comment-indicator:hover span { background-image: url(../images/translation-hover.png); } 149 | pre div.has-comments > span, div.has-comments:hover > span { background-image: url(../images/translation-active.png); } 150 | 151 | div.admonition div.comment-indicator { left: -45px; } 152 | blockquote div.comment-indicator { left: -46px; } 153 | ul ul li.cn div.comment-indicator { left: -88px; } 154 | div.comment-indicator:hover { background-color: #406b4e; } 155 | div.comment-indicator span { position: absolute; top: -10px; left: -10px; width: 25px; height: 25px; } 156 | div.comment-indicator:hover span { background-image: url(../images/comment-hover.png); } 157 | div.has-comments > span, div.has-comments:hover > span { background-image: url(../images/comment-active.png); } 158 | 159 | /*** transaltion ***/ 160 | #translations { padding: 0; border: 1px #092e20 solid; left: 300; top:0; position: absolute; z-index: 10; background-color: #E0FFB8; width: 600px; height: 400px; color: black; overflow: hidden; display: none; text-align: left; } 161 | #translation-tabs { padding: 6px; } 162 | #translations .ft { height:50px; overflow:hidden; padding: 6px; } 163 | #translations .tabset .hd li a { background-color: #487858; color:white; } 164 | #translations .tabset .hd li.on em { color: #092e20; } 165 | #translations .yui-ext-tabbody { font-size: 90%; background-color: white; border: 1px #999 solid; border-top: none; height: 285px; overflow: auto; padding: 1em; } 166 | #translations div.tab input { width: 100%; } 167 | #translations div.tab input#id_name { width: 70%; } 168 | #translations div.tab input#id_remember_me { width: auto; } 169 | #translations div.tab label { font-weight: bold; display: block; color: #487858; } 170 | #translations div.tab textarea { width: 100%; height: 100px; } 171 | #translations div.tab p { margin-bottom: 0; } 172 | #translations div.tab span.actions { float: right; margin-top: -15px; } 173 | #translations div.tab span.thanks { color: black; font-weight: bold; color: #F7C754; position: relative;} 174 | #translations-close { margin-left:5px;margin-right:15px; } 175 | #translations-head .close { position: absolute; top: 3px; right: 4px; height: 13px; width: 17px; margin:0; padding: 0; overflow: hidden; text-indent:-999px; background: url(../images/close.png) no-repeat top left;} 176 | #translations-head { background-color: #487858; color: white; padding: 2px 4px; font-weight: bold; margin: 0 0 6px 0; position: relative;} 177 | #translations-message { font-size: 90%; padding-left: 20px; float:left; clear:none; width:270px; } 178 | #translations-message.loading { background: url(../images/loading.gif) no-repeat center left; } 179 | #translations-message.error { background: url(../images/error.png) no-repeat center left; color: red; font-weight: bold; } 180 | #translations-submit-wrapper { float:right; clear:none;white-space:nowrap; width: 250px; text-align: right;} 181 | #translations-submit-wrapper input { font-size: 11px; } 182 | 183 | /*** translation box resizer ***/ 184 | #translations .yresizable-handle-east { background-image: url(../images/e-handle-dark.gif); border: 0px; } 185 | #translations .yresizable-handle-south { background-image: url(../images/s-handle-dark.gif); border: 0px; } 186 | #translations .yresizable-handle-southeast { background-image: url(../images/se-handle-dark.gif); border: 0px; } 187 | 188 | /*** translation list tab ***/ 189 | #translation-tabs div.tab ol { padding: 0; margin: 0; font-size: 90%; } 190 | #translation-tabs div.tab dl { margin-bottom: 0; } 191 | #translation-tabs div.tab li { border-bottom: 1px #E0FFB8 solid; } 192 | #translation-tabs div.tab li span.meta { font-weight:normal; color: #487858; font-size: 90%; } 193 | #translation-tabs div.tab a:hover { background-color:#E0FFB8; color:#234f32; text-decoration:none; } 194 | #translation-tabs div.tab a:link, #translation-tabs div.tab a:visited { color:#ab5603; } 195 | 196 | 197 | 198 | /*** translate indicator ***/ 199 | div.translation-indicator { position: absolute; width: 20px; z-index: 999; text-align: center; color: black; background-color: #406b4e; font-size: 11px; right: -44px; top: 0; } 200 | div.translation-indicator:hover { background-color: #406b4e; } 201 | div.translation-indicator span { position: absolute; top: -10px; left: 10px; width: 25px; height: 25px; } 202 | div.translation-indicator:hover span { background-image: url(../images/translation-hover.png); } 203 | div.has-translation > span, div.has-translation:hover > span { background-image: url(../images/translation-active.png); } 204 | 205 | blockquote div.translation-indicator { right:-59px;} 206 | table div.translation-indicator { right:-44px;} 207 | 208 | /*** help tab ***/ 209 | #comment-tabs-help h4 { margin-top: 0; } 210 | #comment-tabs-help p.image { text-align: center; } 211 | #comment-tabs-help img { padding: 4px; border: 1px #999 solid; } 212 | 213 | /*** forms ***/ 214 | #chapter-body form label { display: block; font-weight: bold; margin-top: 1.5em; margin-bottom: 0;} 215 | #chapter-body form label span { font-weight: normal; color: #555; } 216 | #chapter-body form input, #chapter-body form textarea, #chapter-body form select { width: 100%; padding: 1px; } 217 | #chapter-body form p { margin: 0; } 218 | #chapter-body form p.submit { text-align: right; } 219 | #chapter-body form p.submit input { width: 10em; font-size: 1.5em; } 220 | #chapter-body form p.errors { margin: 0; padding: 0; font-weight: bold; color: red; } 221 | 222 | /*** errata pages ***/ 223 | div.errata p.reported-by { font-size: 90%; color: #555; } 224 | div.errata p { margin-bottom: 0; } 225 | div.errata { border-bottom:1px solid #dfdfdf; padding-bottom: 0.5em; } 226 | div.last { border-bottom: 0px none; } 227 | #chapter-title span { font-size: 70%; } 228 | 229 | /*** footer ***/ 230 | #ft { color:#487858; font-size:90%; padding-bottom: 2em; } 231 | 232 | /* history diff tables */ 233 | table.diff td.diff_next {background-color:#eeeeee} 234 | table.diff span.diff_add {background-color:#aaffaa} 235 | table.diff span.diff_chg {background-color:#ffff77} 236 | table.diff span.diff_sub {background-color:#ffaaaa} 237 | table.diff td { padding-top: 0px; padding-bottom: 0px; white-space: normal;} 238 | table.diff td.diff_header { text-align: right; vertical-align: top;} 239 | 240 | /*** IE hacks ***/ 241 | * pre { width: 100%; } 242 | * div.has-comments span { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="/static/images/comment-active.png", sizingMethod="scale"); } 243 | * #comments div.tab input { width: 95%; } 244 | 245 | h1,h2,h3,h4,h5,h6{ 246 | 247 | font-family: "Microsoft YaHei","Lucida Grande",Verdana !important;} 248 | 249 | p{ 250 | 251 | font-size:115% !important ; 252 | 253 | line-height:1.8 !important; 254 | 255 | color:#333 !important;} 256 | 257 | pre{ 258 | 259 | font-family:Anonymous,Consolas,"Courier New" !important; 260 | 261 | font-size:12px !important;} 262 | 263 | .pre{ 264 | 265 | font:800 12px Consolas,"Courier New" !important;} 266 | 267 | blockquote{ font-size:12px !important; 268 | 269 | color:#333 !important;} 270 | 271 | blockquote div.translation-indicator { 272 | 273 | right:-56px !important;} 274 | 275 | blockquote div.comment-indicator {left:-58px !important;} 276 | 277 | blockquote blockquote{border:none !important;} 278 | 279 | blockquote blockquote div.comment-indicator{left:-70px !important;} 280 | 281 | blockquote blockquote div.translation-indicator{right:-68px !important;} 282 | 283 | .vLargeTextField{font-family:"Microsoft YaHei","Lucida Grande",Verdana !important;font-size:12px !important;color:#333 !important;} 284 | 285 | .tabset li{font-size:12px !important;} 286 | 287 | 288 | 289 | #comments{z-index:1000 !important;} 290 | #translations{z-index:1000 !important;}/* 291 | The CSS for the tabs comes from the Yahoo! design patterns 292 | See http://developer.yahoo.com/ypatterns/examples/tabs.html for more details 293 | */ 294 | .tabset {border-bottom:1px solid #999;} 295 | .tabset h3, .tabset h4 {position:absolute;left:-1000em;margin:0;} 296 | .tabset .hd li em {font-weight:bold;} 297 | .tabset .hd li a {color:#666;} 298 | .tabset .hd li a:hover {text-decoration:none;} 299 | .tabset .hd li.on em, .tabset .hd li.on strong a {color:#3366cc;} /* selected tab */ 300 | .tabset .hd li.on strong {background-color:white;border-bottom:1px solid white;} /* border-color should match selected color */ 301 | .tabset .hd li.orphan, .tabset .hd li.orphan a {color:#999;} 302 | 303 | /* bg images, defaults to #999 border-color on white bg */ 304 | .tabset .hd li a, .tabset .hd li strong {background:#ccc url(http://us.i1.yimg.com/us.yimg.com/i/us/nt/el/tb/tr_999.gif) no-repeat top right;} 305 | .tabset .hd li em {background:transparent url(http://us.i1.yimg.com/us.yimg.com/i/us/nt/el/tb/tl_999.gif) no-repeat;} 306 | 307 | .tabset {width:100%;} /* IE: width */ 308 | .tabset a {text-decoration:none;} 309 | .tabset ul, .tabset li {margin:0;padding:0;list-style:none;} 310 | .tabset li {float:left;display:inline;cursor:pointer;} 311 | .tabset li.on {cursor:default;} 312 | .tabset li.disabled {cursor:default;color:#cccccc;} 313 | .tabset li.disabled em {color:#aaa;} 314 | .tabset li a:hover {text-decoration:underline;} 315 | .tabset ul:after {clear:both;content:'.';display:block;height:0;visibility:hidden;} /* clear non-IE */ 316 | .tabset ul {zoom:1;} /* clear IE */ 317 | 318 | .tabset .hd ul {font:bold 78%/1.2em verdana;margin-bottom:-1px;padding-left:.3em;position:relative;} /* IE quirks mode: relative */ 319 | .tabset .hd li {margin-right:.33em;padding:0;} 320 | .tabset .hd li.on strong a {cursor:default;} 321 | .tabset .hd li a, .tabset .hd li strong, .tabset .hd li em {display:block;} 322 | .tabset .hd li a, .tabset .hd li strong {*display:inline-block;} /* IE: 100% clickable */ 323 | .tabset .hd li em {font-style:normal;padding:.5em .6em;} 324 | .tabset .hd li.orphan, .tabset .hd li.orphan a, .tabset .hd li.orphan em {background:transparent none;border-width:0;margin:0;} 325 | 326 | .yresizable-handle { 327 | position:absolute; 328 | z-index:100; 329 | /* ie needs these */ 330 | font-size:1px; 331 | line-height:1px; 332 | overflow:hidden; 333 | background:white; 334 | filter:alpha(opacity=0); 335 | opacity:0; 336 | } 337 | .yresizable-handle-east{ 338 | width:5px; 339 | cursor:e-resize; 340 | right:0px; 341 | top:0px; 342 | height:100%; 343 | } 344 | .yresizable-handle-south{ 345 | width:100%; 346 | cursor:s-resize; 347 | left:0px; 348 | bottom:0px; 349 | height:5px; 350 | } 351 | .yresizable-handle-west{ 352 | width:5px; 353 | cursor:w-resize; 354 | left:0px; 355 | top:0px; 356 | height:100%; 357 | } 358 | .yresizable-handle-north{ 359 | width:100%; 360 | cursor:n-resize; 361 | left:0px; 362 | top:0px; 363 | height:5px; 364 | } 365 | .yresizable-handle-southeast{ 366 | width:6px; 367 | cursor:se-resize; 368 | right:0px; 369 | bottom:0px; 370 | height:6px; 371 | z-index:101; 372 | } 373 | .yresizable-over .yresizable-handle, .yresizable-pinned .yresizable-handle{ 374 | filter:alpha(opacity=100); 375 | opacity:1; 376 | } 377 | .yresizable-over .yresizable-handle-east, .yresizable-pinned .yresizable-handle-east{ 378 | background:url(../images/sizer/e-handle.gif); 379 | background-position: left; 380 | border-left:1px solid #98c0f4; 381 | } 382 | .yresizable-over .yresizable-handle-east, .yresizable-pinned .yresizable-handle-west{ 383 | background:url(../images/sizer/e-handle.gif); 384 | background-position: left; 385 | border-right:1px solid #98c0f4; 386 | } 387 | .yresizable-over .yresizable-handle-south, .yresizable-pinned .yresizable-handle-south{ 388 | background:url(../images/sizer/s-handle.gif); 389 | background-position: top; 390 | border-top:1px solid #98c0f4; 391 | } 392 | .yresizable-over .yresizable-handle-south, .yresizable-pinned .yresizable-handle-north{ 393 | background:url(../images/sizer/s-handle.gif); 394 | background-position: top; 395 | border-bottom:1px solid #98c0f4; 396 | } 397 | .yresizable-over .yresizable-handle-southeast, .yresizable-pinned .yresizable-handle-southeast{ 398 | background-position: top left; 399 | background:url(../images/sizer/se-handle.gif); 400 | } 401 | .yresizable-proxy{ 402 | border: 1px dashed #6593cf; 403 | position:absolute; 404 | overflow:hidden; 405 | visibility:hidden; 406 | z-index:1001; 407 | } 408 | -------------------------------------------------------------------------------- /static/css/grids-min.css: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt Version: 0.11.3 */ 2 | body{text-align:center;} 3 | #doc{width:57.69em;*width:56.3em;min-width:770px;margin:auto;text-align:left;} 4 | #hd,#bd{margin-bottom:1em;text-align:left;} 5 | #ft{font-size:77%;font-family:verdana;clear:both;} 6 | .yui-t1 #yui-main .yui-b, .yui-t2 #yui-main .yui-b, .yui-t3 #yui-main .yui-b, .yui-t4 .yui-b, .yui-t5 .yui-b, .yui-t6 .yui-b{float:right;}.yui-t1 .yui-b, .yui-t2 .yui-b, .yui-t3 .yui-b, .yui-t4 #yui-main .yui-b, .yui-t5 #yui-main .yui-b, .yui-t6 #yui-main .yui-b{float:left;}.yui-t1 #yui-main .yui-b{width:76%;min-width:570px;}.yui-t1 .yui-b{width:21.33%;min-width:160px;}.yui-t2 #yui-main .yui-b, .yui-t4 #yui-main .yui-b{width:73.4%;min-width:550px;}.yui-t2 .yui-b, .yui-t4 .yui-b{width:24%;min-width:180px;}.yui-t3 #yui-main .yui-b, .yui-t6 #yui-main .yui-b{width:57.6%;min-width:430px;}.yui-t3 .yui-b, .yui-t6 .yui-b{width:40%;min-width:300px;}.yui-t5 #yui-main .yui-b{width:65.4%;min-width:490px;}.yui-t5 .yui-b{width:32%;min-width:240px;}.yui-g .yui-u, .yui-g .yui-g, .yui-ge .yui-u, .yui-gf .yui-u{float:right;display:inline;}.yui-g .first, .yui-gd .first, .yui-ge .first, .yui-gf .first{float:left;}.yui-g .yui-u, .yui-g .yui-g{width:49.1%;}.yui-g .yui-g .yui-u{width:48.1%;}.yui-gb .yui-u, .yui-gc .yui-u, .yui-gd .yui-u{float:left;margin-left:2%;*margin-left:1.895%;width:32%;}.yui-gb .first, .yui-gc .first, .yui-gd .first{margin-left:0;}.yui-gc .first, .yui-gd .yui-u{width:66%;}.yui-gd .first{width:32%;}.yui-ge .yui-u{width:24%;}.yui-ge .first, .yui-gf .yui-u{width:74.2%;}.yui-gf .first{width:24%;}.yui-ge .first{width:74.2%;}#bd:after, .yui-g:after, .yui-gb:after, .yui-gc:after, .yui-gd:after, .yui-ge:after, .yui-gf:after{content:".";display:block;height:0;clear:both;visibility:hidden;}#bd, .yui-g, .yui-gb, .yui-gc, .yui-gd, .yui-ge, .yui-gf{zoom:1;} -------------------------------------------------------------------------------- /static/css/reset-min.css: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License:http://developer.yahoo.net/yui/license.txt Version: 0.11.3 */ 2 | body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}ol,ul {list-style:none;}caption,th {text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;}q:before,q:after{content:'';} -------------------------------------------------------------------------------- /static/images/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dongweiming/aiglos/2f80490cf434019b7037b53fe0daba949bd7087f/static/images/close.png -------------------------------------------------------------------------------- /static/images/comment-active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dongweiming/aiglos/2f80490cf434019b7037b53fe0daba949bd7087f/static/images/comment-active.png -------------------------------------------------------------------------------- /static/images/comment-hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dongweiming/aiglos/2f80490cf434019b7037b53fe0daba949bd7087f/static/images/comment-hover.png -------------------------------------------------------------------------------- /static/images/comments1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dongweiming/aiglos/2f80490cf434019b7037b53fe0daba949bd7087f/static/images/comments1.png -------------------------------------------------------------------------------- /static/images/comments2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dongweiming/aiglos/2f80490cf434019b7037b53fe0daba949bd7087f/static/images/comments2.png -------------------------------------------------------------------------------- /static/images/comments3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dongweiming/aiglos/2f80490cf434019b7037b53fe0daba949bd7087f/static/images/comments3.png -------------------------------------------------------------------------------- /static/images/comments4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dongweiming/aiglos/2f80490cf434019b7037b53fe0daba949bd7087f/static/images/comments4.png -------------------------------------------------------------------------------- /static/images/e-handle-dark.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dongweiming/aiglos/2f80490cf434019b7037b53fe0daba949bd7087f/static/images/e-handle-dark.gif -------------------------------------------------------------------------------- /static/images/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dongweiming/aiglos/2f80490cf434019b7037b53fe0daba949bd7087f/static/images/loading.gif -------------------------------------------------------------------------------- /static/images/s-handle-dark.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dongweiming/aiglos/2f80490cf434019b7037b53fe0daba949bd7087f/static/images/s-handle-dark.gif -------------------------------------------------------------------------------- /static/images/se-handle-dark.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dongweiming/aiglos/2f80490cf434019b7037b53fe0daba949bd7087f/static/images/se-handle-dark.gif -------------------------------------------------------------------------------- /static/js/aiglos.js: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2006, Yahoo! Inc. All rights reserved.Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt Version: 0.11.4*/ if(typeof YAHOO=="undefined"){YAHOO={};}YAHOO.namespace=function(ns){if(!ns||!ns.length){return null;}var _2=ns.split(".");var _3=YAHOO;for(var i=(_2[0]=="YAHOO")?1:0;i<_2.length;++i){_3[_2[i]]=_3[_2[i]]||{};_3=_3[_2[i]];}return _3;};YAHOO.log=function(_5,_6,_7){var l=YAHOO.widget.Logger;if(l&&l.log){return l.log(_5,_6,_7);}else{return false;}};YAHOO.extend=function(_9,_10){var f=function(){};f.prototype=_10.prototype;_9.prototype=new f();_9.prototype.constructor=_9;_9.superclass=_10.prototype;if(_10.prototype.constructor==Object.prototype.constructor){_10.prototype.constructor=_10;}};YAHOO.namespace("util");YAHOO.namespace("widget");YAHOO.namespace("example"); 2 | 3 | /* Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt Version: 0.11.3 */ YAHOO.util.Dom=function(){var ua=navigator.userAgent.toLowerCase();var isOpera=(ua.indexOf('opera')>-1);var isSafari=(ua.indexOf('safari')>-1);var isIE=(window.ActiveXObject);var id_counter=0;var util=YAHOO.util;var property_cache={};var toCamel=function(property){var convert=function(prop){var test=/(-[a-z])/i.exec(prop);return prop.replace(RegExp.$1,RegExp.$1.substr(1).toUpperCase());};while(property.indexOf('-')>-1){property=convert(property);}return property;};var toHyphen=function(property){if(property.indexOf('-')>-1){return property;}var converted='';for(var i=0,len=property.length;i=this.left&®ion.right<=this.right&®ion.top>=this.top&®ion.bottom<=this.bottom);};YAHOO.util.Region.prototype.getArea=function(){return((this.bottom-this.top)*(this.right-this.left));};YAHOO.util.Region.prototype.intersect=function(region){var t=Math.max(this.top,region.top);var r=Math.min(this.right,region.right);var b=Math.min(this.bottom,region.bottom);var l=Math.max(this.left,region.left);if(b>=t&&r>=l){return new YAHOO.util.Region(t,r,b,l);}else{return null;}};YAHOO.util.Region.prototype.union=function(region){var t=Math.min(this.top,region.top);var r=Math.max(this.right,region.right);var b=Math.max(this.bottom,region.bottom);var l=Math.min(this.left,region.left);return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Region.prototype.toString=function(){return("Region {"+"top: "+this.top+", right: "+this.right+", bottom: "+this.bottom+", left: "+this.left+"}");};YAHOO.util.Region.getRegion=function(el){var p=YAHOO.util.Dom.getXY(el);var t=p[1];var r=p[0]+el.offsetWidth;var b=p[1]+el.offsetHeight;var l=p[0];return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Point=function(x,y){if(x instanceof Array){y=x[1];x=x[0];}this.x=this.right=this.left=this[0]=x;this.y=this.top=this.bottom=this[1]=y;};YAHOO.util.Point.prototype=new YAHOO.util.Region(); 4 | 5 | /* Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License:http://developer.yahoo.net/yui/license.txt Version: 0.11.4*/ YAHOO.util.CustomEvent=function(_1,_2,_3){this.type=_1;this.scope=_2||window;this.silent=_3;this.subscribers=[];if(!this.silent){}};YAHOO.util.CustomEvent.prototype={subscribe:function(fn,_5,_6){this.subscribers.push(new YAHOO.util.Subscriber(fn,_5,_6));},unsubscribe:function(fn,_7){var _8=false;for(var i=0,len=this.subscribers.length;i=0){_58=_18[_57];}if(!el||!_58){return false;}if(this.useLegacyEvent(el,_56)){var _59=this.getLegacyIndex(el,_56);var _60=_22[_59];if(_60){for(i=0,len=_60.length;i0);}var _73=[];for(var i=0,len=_19.length;i0){for(var i=0,len=_18.length;i0){var j=_18.length;while(j){var _86=j-1;l=_18[_86];if(l){EU.removeListener(l[EU.EL],l[EU.TYPE],l[EU.FN],_86);}l=null;j=j-1;}EU.clearCache();}for(i=0,len=_21.length;i1){return;}if(this.isLocked()){return;}this.DDM.refreshCache(this.groups);var pt=new YAHOO.util.Point(EU.getPageX(e),EU.getPageY(e));if(!this.DDM.isOverTarget(pt,this)){}else{var _28=EU.getTarget(e);if(this.isValidHandleChild(_28)&&(this.id==this.handleElId||this.DDM.handleWasClicked(_28,this.id))){this.setStartPosition();this.b4MouseDown(e);this.onMouseDown(e);this.DDM.handleMouseDown(e,this);this.DDM.stopEvent(e);}}},addInvalidHandleType:function(_29){var _30=_29.toUpperCase();this.invalidHandleTypes[_30]=_30;},addInvalidHandleId:function(id){this.invalidHandleIds[id]=id;},addInvalidHandleClass:function(_31){this.invalidHandleClasses.push(_31);},removeInvalidHandleType:function(_32){var _33=_32.toUpperCase();delete this.invalidHandleTypes[_33];},removeInvalidHandleId:function(id){delete this.invalidHandleIds[id];},removeInvalidHandleClass:function(_34){for(var i=0,len=this.invalidHandleClasses.length;i=this.minX;i=i-_40){if(!_41[i]){this.xTicks[this.xTicks.length]=i;_41[i]=true;}}for(i=this.initPageX;i<=this.maxX;i=i+_40){if(!_41[i]){this.xTicks[this.xTicks.length]=i;_41[i]=true;}}this.xTicks.sort(this.DDM.numericSort);},setYTicks:function(_42,_43){this.yTicks=[];this.yTickSize=_43;var _44={};for(var i=this.initPageY;i>=this.minY;i=i-_43){if(!_44[i]){this.yTicks[this.yTicks.length]=i;_44[i]=true;}}for(i=this.initPageY;i<=this.maxY;i=i+_43){if(!_44[i]){this.yTicks[this.yTicks.length]=i;_44[i]=true;}}this.yTicks.sort(this.DDM.numericSort);},setXConstraint:function(_45,_46,_47){this.leftConstraint=_45;this.rightConstraint=_46;this.minX=this.initPageX-_45;this.maxX=this.initPageX+_46;if(_47){this.setXTicks(this.initPageX,_47);}this.constrainX=true;},clearConstraints:function(){this.constrainX=false;this.constrainY=false;this.clearTicks();},clearTicks:function(){this.xTicks=null;this.yTicks=null;this.xTickSize=0;this.yTickSize=0;},setYConstraint:function(iUp,_49,_50){this.topConstraint=iUp;this.bottomConstraint=_49;this.minY=this.initPageY-iUp;this.maxY=this.initPageY+_49;if(_50){this.setYTicks(this.initPageY,_50);}this.constrainY=true;},resetConstraints:function(){if(this.initPageX||this.initPageX===0){var dx=(this.maintainOffset)?this.lastPageX-this.initPageX:0;var dy=(this.maintainOffset)?this.lastPageY-this.initPageY:0;this.setInitPosition(dx,dy);}else{this.setInitPosition();}if(this.constrainX){this.setXConstraint(this.leftConstraint,this.rightConstraint,this.xTickSize);}if(this.constrainY){this.setYConstraint(this.topConstraint,this.bottomConstraint,this.yTickSize);}},getTick:function(val,_52){if(!_52){return val;}else{if(_52[0]>=val){return _52[0];}else{for(var i=0,len=_52.length;i=val){var _54=val-_52[i];var _55=_52[_53]-val;return (_55>_54)?_52[i]:_52[_53];}}return _52[_52.length-1];}}},toString:function(){return ("DragDrop "+this.id);}};if(!YAHOO.util.DragDropMgr){YAHOO.util.DragDropMgr=new function(){this.ids={};this.handleIds={};this.dragCurrent=null;this.dragOvers={};this.deltaX=0;this.deltaY=0;this.preventDefault=true;this.stopPropagation=true;this.initalized=false;this.locked=false;this.init=function(){this.initialized=true;};this.POINT=0;this.INTERSECT=1;this.mode=this.POINT;this._execOnAll=function(_56,_57){for(var i in this.ids){for(var j in this.ids[i]){var oDD=this.ids[i][j];if(!this.isTypeOfDD(oDD)){continue;}oDD[_56].apply(oDD,_57);}}};this._onLoad=function(){this.init();var EU=YAHOO.util.Event;EU.on(document,"mouseup",this.handleMouseUp,this,true);EU.on(document,"mousemove",this.handleMouseMove,this,true);EU.on(window,"unload",this._onUnload,this,true);EU.on(window,"resize",this._onResize,this,true);};this._onResize=function(e){this._execOnAll("resetConstraints",[]);};this.lock=function(){this.locked=true;};this.unlock=function(){this.locked=false;};this.isLocked=function(){return this.locked;};this.locationCache={};this.useCache=true;this.clickPixelThresh=3;this.clickTimeThresh=1000;this.dragThreshMet=false;this.clickTimeout=null;this.startX=0;this.startY=0;this.regDragDrop=function(oDD,_59){if(!this.initialized){this.init();}if(!this.ids[_59]){this.ids[_59]={};}this.ids[_59][oDD.id]=oDD;};this.removeDDFromGroup=function(oDD,_60){if(!this.ids[_60]){this.ids[_60]={};}var obj=this.ids[_60];if(obj&&obj[oDD.id]){delete obj[oDD.id];}};this._remove=function(oDD){for(var g in oDD.groups){if(g&&this.ids[g][oDD.id]){delete this.ids[g][oDD.id];}}delete this.handleIds[oDD.id];};this.regHandle=function(_63,_64){if(!this.handleIds[_63]){this.handleIds[_63]={};}this.handleIds[_63][_64]=_64;};this.isDragDrop=function(id){return (this.getDDById(id))?true:false;};this.getRelated=function(_65,_66){var _67=[];for(var i in _65.groups){for(j in this.ids[i]){var dd=this.ids[i][j];if(!this.isTypeOfDD(dd)){continue;}if(!_66||dd.isTarget){_67[_67.length]=dd;}}}return _67;};this.isLegalTarget=function(oDD,_69){var _70=this.getRelated(oDD,true);for(var i=0,len=_70.length;ithis.clickPixelThresh||_75>this.clickPixelThresh){this.startDrag(this.startX,this.startY);}}if(this.dragThreshMet){this.dragCurrent.b4Drag(e);this.dragCurrent.onDrag(e);this.fireEvents(e,false);}this.stopEvent(e);return true;};this.fireEvents=function(e,_76){var dc=this.dragCurrent;if(!dc||dc.isLocked()){return;}var x=YAHOO.util.Event.getPageX(e);var y=YAHOO.util.Event.getPageY(e);var pt=new YAHOO.util.Point(x,y);var _78=[];var _79=[];var _80=[];var _81=[];var _82=[];for(var i in this.dragOvers){var ddo=this.dragOvers[i];if(!this.isTypeOfDD(ddo)){continue;}if(!this.isOverTarget(pt,ddo,this.mode)){_79.push(ddo);}_78[i]=true;delete this.dragOvers[i];}for(var _84 in dc.groups){if("string"!=typeof _84){continue;}for(i in this.ids[_84]){var oDD=this.ids[_84][i];if(!this.isTypeOfDD(oDD)){continue;}if(oDD.isTarget&&!oDD.isLocked()&&oDD!=dc){if(this.isOverTarget(pt,oDD,this.mode)){if(_76){_81.push(oDD);}else{if(!_78[oDD.id]){_82.push(oDD);}else{_80.push(oDD);}this.dragOvers[oDD.id]=oDD;}}}}}if(this.mode){if(_79.length){dc.b4DragOut(e,_79);dc.onDragOut(e,_79);}if(_82.length){dc.onDragEnter(e,_82);}if(_80.length){dc.b4DragOver(e,_80);dc.onDragOver(e,_80);}if(_81.length){dc.b4DragDrop(e,_81);dc.onDragDrop(e,_81);}}else{var len=0;for(i=0,len=_79.length;i2000){}else{setTimeout(DDM._addListeners,10);if(document&&document.body){DDM._timeoutCount+=1;}}}};this.handleWasClicked=function(node,id){if(this.isHandle(id,node.id)){return true;}else{var p=node.parentNode;while(p){if(this.isHandle(id,p.id)){return true;}else{p=p.parentNode;}}}return false;};}();YAHOO.util.DDM=YAHOO.util.DragDropMgr;YAHOO.util.DDM._addListeners();}YAHOO.util.DD=function(id,_109,_110){if(id){this.init(id,_109,_110);}};YAHOO.extend(YAHOO.util.DD,YAHOO.util.DragDrop);YAHOO.util.DD.prototype.scroll=true;YAHOO.util.DD.prototype.autoOffset=function(_111,_112){var x=_111-this.startPageX;var y=_112-this.startPageY;this.setDelta(x,y);};YAHOO.util.DD.prototype.setDelta=function(_113,_114){this.deltaX=_113;this.deltaY=_114;};YAHOO.util.DD.prototype.setDragElPos=function(_115,_116){var el=this.getDragEl();this.alignElWithMouse(el,_115,_116);};YAHOO.util.DD.prototype.alignElWithMouse=function(el,_117,_118){var _119=this.getTargetCoord(_117,_118);if(!this.deltaSetXY){var _120=[_119.x,_119.y];YAHOO.util.Dom.setXY(el,_120);var _121=parseInt(YAHOO.util.Dom.getStyle(el,"left"),10);var _122=parseInt(YAHOO.util.Dom.getStyle(el,"top"),10);this.deltaSetXY=[_121-_119.x,_122-_119.y];}else{YAHOO.util.Dom.setStyle(el,"left",(_119.x+this.deltaSetXY[0])+"px");YAHOO.util.Dom.setStyle(el,"top",(_119.y+this.deltaSetXY[1])+"px");}this.cachePosition(_119.x,_119.y);this.autoScroll(_119.x,_119.y,el.offsetHeight,el.offsetWidth);};YAHOO.util.DD.prototype.cachePosition=function(_123,_124){if(_123){this.lastPageX=_123;this.lastPageY=_124;}else{var _125=YAHOO.util.Dom.getXY(this.getEl());this.lastPageX=_125[0];this.lastPageY=_125[1];}};YAHOO.util.DD.prototype.autoScroll=function(x,y,h,w){if(this.scroll){var _128=this.DDM.getClientHeight();var _129=this.DDM.getClientWidth();var st=this.DDM.getScrollTop();var sl=this.DDM.getScrollLeft();var bot=h+y;var _133=w+x;var _134=(_128+st-y-this.deltaY);var _135=(_129+sl-x-this.deltaX);var _136=40;var _137=(document.all)?80:30;if(bot>_128&&_134<_136){window.scrollTo(sl,st+_137);}if(y0&&y-st<_136){window.scrollTo(sl,st-_137);}if(_133>_129&&_135<_136){window.scrollTo(sl+_137,st);}if(x0&&x-sl<_136){window.scrollTo(sl-_137,st);}}};YAHOO.util.DD.prototype.getTargetCoord=function(_138,_139){var x=_138-this.deltaX;var y=_139-this.deltaY;if(this.constrainX){if(xthis.maxX){x=this.maxX;}}if(this.constrainY){if(ythis.maxY){y=this.maxY;}}x=this.getTick(x,this.xTicks);y=this.getTick(y,this.yTicks);return {x:x,y:y};};YAHOO.util.DD.prototype.applyConfig=function(){YAHOO.util.DD.superclass.applyConfig.call(this);this.scroll=(this.config.scroll!==false);};YAHOO.util.DD.prototype.b4MouseDown=function(e){this.autoOffset(YAHOO.util.Event.getPageX(e),YAHOO.util.Event.getPageY(e));};YAHOO.util.DD.prototype.b4Drag=function(e){this.setDragElPos(YAHOO.util.Event.getPageX(e),YAHOO.util.Event.getPageY(e));};YAHOO.util.DD.prototype.toString=function(){return ("DD "+this.id);};YAHOO.util.DDProxy=function(id,_140,_141){if(id){this.init(id,_140,_141);this.initFrame();}};YAHOO.extend(YAHOO.util.DDProxy,YAHOO.util.DD);YAHOO.util.DDProxy.dragElId="ygddfdiv";YAHOO.util.DDProxy.prototype.resizeFrame=true;YAHOO.util.DDProxy.prototype.centerFrame=false;YAHOO.util.DDProxy.prototype.createFrame=function(){var self=this;var body=document.body;if(!body||!body.firstChild){setTimeout(function(){self.createFrame();},50);return;}var div=this.getDragEl();if(!div){div=document.createElement("div");div.id=this.dragElId;var s=div.style;s.position="absolute";s.visibility="hidden";s.cursor="move";s.border="2px solid #aaa";s.zIndex=999;body.insertBefore(div,body.firstChild);}};YAHOO.util.DDProxy.prototype.initFrame=function(){this.createFrame();};YAHOO.util.DDProxy.prototype.applyConfig=function(){YAHOO.util.DDProxy.superclass.applyConfig.call(this);this.resizeFrame=(this.config.resizeFrame!==false);this.centerFrame=(this.config.centerFrame);this.setDragElId(this.config.dragElId||YAHOO.util.DDProxy.dragElId);};YAHOO.util.DDProxy.prototype.showFrame=function(_145,_146){var el=this.getEl();var _147=this.getDragEl();var s=_147.style;this._resizeProxy();if(this.centerFrame){this.setDelta(Math.round(parseInt(s.width,10)/2),Math.round(parseInt(s.height,10)/2));}this.setDragElPos(_145,_146);YAHOO.util.Dom.setStyle(_147,"visibility","visible");};YAHOO.util.DDProxy.prototype._resizeProxy=function(){if(this.resizeFrame){var DOM=YAHOO.util.Dom;var el=this.getEl();var _149=this.getDragEl();var bt=parseInt(DOM.getStyle(_149,"borderTopWidth"),10);var br=parseInt(DOM.getStyle(_149,"borderRightWidth"),10);var bb=parseInt(DOM.getStyle(_149,"borderBottomWidth"),10);var bl=parseInt(DOM.getStyle(_149,"borderLeftWidth"),10);if(isNaN(bt)){bt=0;}if(isNaN(br)){br=0;}if(isNaN(bb)){bb=0;}if(isNaN(bl)){bl=0;}var _154=Math.max(0,el.offsetWidth-br-bl);var _155=Math.max(0,el.offsetHeight-bt-bb);DOM.setStyle(_149,"width",_154+"px");DOM.setStyle(_149,"height",_155+"px");}};YAHOO.util.DDProxy.prototype.b4MouseDown=function(e){var x=YAHOO.util.Event.getPageX(e);var y=YAHOO.util.Event.getPageY(e);this.autoOffset(x,y);this.setDragElPos(x,y);};YAHOO.util.DDProxy.prototype.b4StartDrag=function(x,y){this.showFrame(x,y);};YAHOO.util.DDProxy.prototype.b4EndDrag=function(e){YAHOO.util.Dom.setStyle(this.getDragEl(),"visibility","hidden");};YAHOO.util.DDProxy.prototype.endDrag=function(e){var DOM=YAHOO.util.Dom;var lel=this.getEl();var del=this.getDragEl();DOM.setStyle(del,"visibility","");DOM.setStyle(lel,"visibility","hidden");YAHOO.util.DDM.moveToEl(lel,del);DOM.setStyle(del,"visibility","hidden");DOM.setStyle(lel,"visibility","");};YAHOO.util.DDProxy.prototype.toString=function(){return ("DDProxy "+this.id);};YAHOO.util.DDTarget=function(id,_158,_159){if(id){this.initTarget(id,_158,_159);}};YAHOO.extend(YAHOO.util.DDTarget,YAHOO.util.DragDrop);YAHOO.util.DDTarget.prototype.toString=function(){return ("DDTarget "+this.id);}; 9 | 10 | /* Copyright (c) 2006, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt Version: 0.11.3 */ 11 | YAHOO.util.Connect={_msxml_progid:['MSXML2.XMLHTTP.3.0','MSXML2.XMLHTTP','Microsoft.XMLHTTP'],_http_header:{},_has_http_headers:false,_use_default_post_header:true,_default_post_header:'application/x-www-form-urlencoded',_isFormSubmit:false,_isFileUpload:false,_formNode:null,_sFormData:null,_poll:{},_timeOut:{},_polling_interval:50,_transaction_id:0,setProgId:function(id) 12 | {this._msxml_progid.unshift(id);},setDefaultPostHeader:function(b) 13 | {this._use_default_post_header=b;},setPollingInterval:function(i) 14 | {if(typeof i=='number'&&isFinite(i)){this._polling_interval=i;}},createXhrObject:function(transactionId) 15 | {var obj,http;try 16 | {http=new XMLHttpRequest();obj={conn:http,tId:transactionId};} 17 | catch(e) 18 | {for(var i=0;i=200&&httpStatus<300){try 45 | {responseObject=this.createResponseObject(o,callback.argument);if(callback.success){if(!callback.scope){callback.success(responseObject);} 46 | else{callback.success.apply(callback.scope,[responseObject]);}}} 47 | catch(e){}} 48 | else{try 49 | {switch(httpStatus){case 12002:case 12029:case 12030:case 12031:case 12152:case 13030:responseObject=this.createExceptionObject(o.tId,callback.argument,(isAbort?isAbort:false));if(callback.failure){if(!callback.scope){callback.failure(responseObject);} 50 | else{callback.failure.apply(callback.scope,[responseObject]);}} 51 | break;default:responseObject=this.createResponseObject(o,callback.argument);if(callback.failure){if(!callback.scope){callback.failure(responseObject);} 52 | else{callback.failure.apply(callback.scope,[responseObject]);}}}} 53 | catch(e){}} 54 | this.releaseObject(o);responseObject=null;},createResponseObject:function(o,callbackArg) 55 | {var obj={};var headerObj={};try 56 | {var headerStr=o.conn.getAllResponseHeaders();var header=headerStr.split('\n');for(var i=0;i');if(typeof secureUri=='boolean'){io.src='javascript:false';} 81 | else{io.src=secureUri;}} 82 | else{var io=document.createElement('IFRAME');io.id=frameId;io.name=frameId;} 83 | io.style.position='absolute';io.style.top='-1000px';io.style.left='-1000px';document.body.appendChild(io);},uploadFile:function(id,callback,uri){var frameId='yuiIO'+id;var io=document.getElementById(frameId);this._formNode.action=uri;this._formNode.enctype='multipart/form-data';this._formNode.method='POST';this._formNode.target=frameId;this._formNode.submit();this._formNode=null;this._isFileUpload=false;this._isFormSubmit=false;var uploadCallback=function() 84 | {var obj={};obj.tId=id;obj.responseText=io.contentWindow.document.body?io.contentWindow.document.body.innerHTML:null;obj.responseXML=io.contentWindow.document.XMLDocument?io.contentWindow.document.XMLDocument:io.contentWindow.document;obj.argument=callback.argument;if(callback.upload){if(!callback.scope){callback.upload(obj);} 85 | else{callback.upload.apply(callback.scope,[obj]);}} 86 | if(YAHOO.util.Event){YAHOO.util.Event.removeListener(io,"load",uploadCallback);} 87 | else if(window.ActiveXObject){io.detachEvent('onload',uploadCallback);} 88 | else{io.removeEventListener('load',uploadCallback,false);} 89 | setTimeout(function(){document.body.removeChild(io);},100);};if(YAHOO.util.Event){YAHOO.util.Event.addListener(io,"load",uploadCallback);} 90 | else if(window.ActiveXObject){io.attachEvent('onload',uploadCallback);} 91 | else{io.addEventListener('load',uploadCallback,false);}},abort:function(o,callback,isTimeout) 92 | {if(this.isCallInProgress(o)){o.conn.abort();window.clearInterval(this._poll[o.tId]);delete this._poll[o.tId];if(isTimeout){delete this._timeOut[o.tId];} 93 | this.handleTransactionResponse(o,callback,true);return true;} 94 | else{return false;}},isCallInProgress:function(o) 95 | {if(o.conn){return o.conn.readyState!=4&&o.conn.readyState!=0;} 96 | else{return false;}},releaseObject:function(o) 97 | {o.conn=null;o=null;}}; 98 | 99 | 100 | /* 101 | * YUI Extensions 102 | * Copyright(c) 2006, Jack Slocum. 103 | * 104 | * This code is licensed under BSD license. 105 | * http://www.opensource.org/licenses/bsd-license.php 106 | */ 107 | 108 | 109 | YAHOO.namespace('ext');YAHOO.namespace('ext.util');YAHOO.ext.Strict=(document.compatMode=='CSS1Compat');Function.prototype.createCallback=function(){var args=arguments;var method=this;return function(){return method.apply(window,args);}};Function.prototype.createDelegate=function(obj,args,appendArgs){var method=this;return function(){var callargs=args||arguments;if(appendArgs){callargs=Array.prototype.concat.apply(arguments,args);} 110 | return method.apply(obj||window,callargs);}};Function.prototype.createSequence=function(fcn,scope){if(typeof fcn!='function'){return this;} 111 | var method=this;return function(){var retval=method.apply(this||window,arguments);fcn.apply(scope||this||window,arguments);return retval;}};Function.prototype.createInterceptor=function(fcn,scope){if(typeof fcn!='function'){return this;} 112 | var method=this;return function(){fcn.target=this;fcn.method=method;if(fcn.apply(scope||this||window,arguments)===false) 113 | return;return method.apply(this||window,arguments);;}};YAHOO.ext.util.Browser=new function(){var ua=navigator.userAgent.toLowerCase();this.isOpera=(ua.indexOf('opera')>-1);this.isSafari=(ua.indexOf('webkit')>-1);this.isIE=(window.ActiveXObject);this.isIE7=(ua.indexOf('msie 7')>-1);this.isGecko=!this.isSafari&&(ua.indexOf('gecko')>-1);}();YAHOO.util.CustomEvent.prototype.fireDirect=function(){var len=this.subscribers.length;for(var i=0;i');} 116 | return results;},show:function(){alert(this.toString());}};YAHOO.ext.util.DelayedTask=function(fn,scope,args){var timeoutId=null;this.delay=function(delay,newFn,newScope,newArgs){if(timeoutId){clearTimeout(timeoutId);} 117 | fn=newFn||fn;scope=newScope||scope;args=newArgs||args;timeoutId=setTimeout(fn.createDelegate(scope,args),delay);};this.cancel=function(){if(timeoutId){clearTimeout(timeoutId);timeoutId=null;}};};YAHOO.ext.util.Observable=function(){};YAHOO.ext.util.Observable.prototype={fireEvent:function(){var ce=this.events[arguments[0].toLowerCase()];ce.fireDirect.apply(ce,Array.prototype.slice.call(arguments,1));},addListener:function(eventName,fn,scope,override){eventName=eventName.toLowerCase();if(!this.events[eventName]){throw'You are trying to listen for an event that does not exist: "'+eventName+'".';} 118 | this.events[eventName].subscribe(fn,scope,override);},delayedListener:function(eventName,fn,scope,delay){var newFn=function(){setTimeout(fn.createDelegate(scope,arguments),delay||1);} 119 | this.addListener(eventName,newFn);return newFn;},removeListener:function(eventName,fn,scope){this.events[eventName.toLowerCase()].unsubscribe(fn,scope);}};YAHOO.ext.util.Observable.prototype.on=YAHOO.ext.util.Observable.prototype.addListener;YAHOO.ext.util.Config={apply:function(obj,config){if(config){for(var prop in config){obj[prop]=config[prop];}}}};YAHOO.ext.util.CSS=new function(){var rules=null;var toCamel=function(property){var convert=function(prop){var test=/(-[a-z])/i.exec(prop);return prop.replace(RegExp.$1,RegExp.$1.substr(1).toUpperCase());};while(property.indexOf('-')>-1){property=convert(property);} 120 | return property;};this.getRules=function(refreshCache){if(rules==null||refreshCache){rules={};var ds=document.styleSheets;for(var i=0,len=ds.length;i=0;--j){rules[ssRules[j].selectorText]=ssRules[j];}}catch(e){}}} 121 | return rules;};this.getRule=function(selector,refreshCache){var rs=this.getRules(refreshCache);if(!(selector instanceof Array)){return rs[selector];} 122 | for(var i=0;i 0) {" 141 | var regex="";var special=false;var ch='';for(var i=0;i 0 && m >= 0 && d > 0 && h >= 0 && i >= 0)\n" 147 | +"{return new Date(y, m, d, h, i);}\n" 148 | +"else if (y > 0 && m >= 0 && d > 0 && h >= 0)\n" 149 | +"{return new Date(y, m, d, h);}\n" 150 | +"else if (y > 0 && m >= 0 && d > 0)\n" 151 | +"{return new Date(y, m, d);}\n" 152 | +"else if (y > 0 && m >= 0)\n" 153 | +"{return new Date(y, m);}\n" 154 | +"else if (y > 0)\n" 155 | +"{return new Date(y);}\n" 156 | +"}return null;}";Date.parseRegexes[regexNum]=new RegExp("^"+regex+"$");eval(code);};Date.formatCodeToRegex=function(character,currentGroup){switch(character){case"D":return{g:0,c:null,s:"(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)"};case"j":case"d":return{g:1,c:"d = parseInt(results["+currentGroup+"], 10);\n",s:"(\\d{1,2})"};case"l":return{g:0,c:null,s:"(?:"+Date.dayNames.join("|")+")"};case"S":return{g:0,c:null,s:"(?:st|nd|rd|th)"};case"w":return{g:0,c:null,s:"\\d"};case"z":return{g:0,c:null,s:"(?:\\d{1,3})"};case"W":return{g:0,c:null,s:"(?:\\d{2})"};case"F":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+currentGroup+"].substring(0, 3)], 10);\n",s:"("+Date.monthNames.join("|")+")"};case"M":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+currentGroup+"]], 10);\n",s:"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)"};case"n":case"m":return{g:1,c:"m = parseInt(results["+currentGroup+"], 10) - 1;\n",s:"(\\d{1,2})"};case"t":return{g:0,c:null,s:"\\d{1,2}"};case"L":return{g:0,c:null,s:"(?:1|0)"};case"Y":return{g:1,c:"y = parseInt(results["+currentGroup+"], 10);\n",s:"(\\d{4})"};case"y":return{g:1,c:"var ty = parseInt(results["+currentGroup+"], 10);\n" 157 | +"y = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n",s:"(\\d{1,2})"};case"a":return{g:1,c:"if (results["+currentGroup+"] == 'am') {\n" 158 | +"if (h == 12) { h = 0; }\n" 159 | +"} else { if (h < 12) { h += 12; }}",s:"(am|pm)"};case"A":return{g:1,c:"if (results["+currentGroup+"] == 'AM') {\n" 160 | +"if (h == 12) { h = 0; }\n" 161 | +"} else { if (h < 12) { h += 12; }}",s:"(AM|PM)"};case"g":case"G":case"h":case"H":return{g:1,c:"h = parseInt(results["+currentGroup+"], 10);\n",s:"(\\d{1,2})"};case"i":return{g:1,c:"i = parseInt(results["+currentGroup+"], 10);\n",s:"(\\d{2})"};case"s":return{g:1,c:"s = parseInt(results["+currentGroup+"], 10);\n",s:"(\\d{2})"};case"O":return{g:0,c:null,s:"[+-]\\d{4}"};case"T":return{g:0,c:null,s:"[A-Z]{3}"};case"Z":return{g:0,c:null,s:"[+-]\\d{1,5}"};default:return{g:0,c:null,s:String.escape(character)};}};Date.prototype.getTimezone=function(){return this.toString().replace(/^.*? ([A-Z]{3}) [0-9]{4}.*$/,"$1").replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/,"$1$2$3");};Date.prototype.getGMTOffset=function(){return(this.getTimezoneOffset()>0?"-":"+") 162 | +String.leftPad(Math.floor(this.getTimezoneOffset()/60),2,"0") 163 | +String.leftPad(this.getTimezoneOffset()%60,2,"0");};Date.prototype.getDayOfYear=function(){var num=0;Date.daysInMonth[1]=this.isLeapYear()?29:28;for(var i=0;i3){s=s.substring(0,s.length-1);} 168 | s+="\n}";return s;}} 169 | Date.daysInMonth=[31,28,31,30,31,30,31,31,30,31,30,31];Date.monthNames=["January","February","March","April","May","June","July","August","September","October","November","December"];Date.dayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];Date.y2kYear=50;Date.monthNumbers={Jan:0,Feb:1,Mar:2,Apr:3,May:4,Jun:5,Jul:6,Aug:7,Sep:8,Oct:9,Nov:10,Dec:11}; 170 | 171 | YAHOO.ext.DomHelper=new function(){var d=document;this.useDom=false;function applyStyles(el,styles){if(styles){var D=YAHOO.util.Dom;var re=/\s?(.*?)\:(.*?);/g;var matches;while((matches=re.exec(styles))!=null){D.setStyle(el,matches[1],matches[2]);}}} 172 | function createHtml(o){var b='';b+='<'+o.tag;for(var attr in o){if(attr=='tag'||attr=='children'||attr=='html'||typeof o[attr]=='function')continue;if(attr=='cls'){b+=' class="'+o['cls']+'"';}else{b+=' '+attr+'="'+o[attr]+'"';}} 173 | b+='>';if(o.children){for(var i=0,len=o.children.length;i';return b;} 176 | function createDom(o,parentNode){var el=d.createElement(o.tag);var useSet=el.setAttribute?true:false;for(var attr in o){if(attr=='tag'||attr=='children'||attr=='html'||attr=='style'||typeof o[attr]=='function')continue;if(attr=='cls'){el.className=o['cls'];}else{if(useSet)el.setAttribute(attr,o[attr]);else el[attr]=o[attr];}} 177 | applyStyles(el,o.style);if(o.children){for(var i=0,len=o.children.length;i "'+where+'"';} 183 | var range=el.ownerDocument.createRange();var frag;if(where=='beforeBegin'){range.setStartBefore(el);frag=range.createContextualFragment(html);el.parentNode.insertBefore(frag,el);return el.previousSibling;}else if(where=='afterBegin'){range.selectNodeContents(el);range.collapse(true);frag=range.createContextualFragment(html);el.insertBefore(frag,el.firstChild);return el.firstChild;}else if(where=='beforeEnd'){range.selectNodeContents(el);range.collapse(false);frag=range.createContextualFragment(html);el.appendChild(frag);return el.lastChild;}else if(where=='afterEnd'){range.setStartAfter(el);frag=range.createContextualFragment(html);el.parentNode.insertBefore(frag,el.nextSibling);return el.nextSibling;}else{throw'Illegal insertion point -> "'+where+'"';}};this.insertBefore=function(el,o,returnElement){el=YAHOO.util.Dom.get(el);var newNode;if(this.useDom){newNode=createDom(o,null);el.parentNode.insertBefore(newNode,el);}else{var html=createHtml(o);newNode=this.insertHtml('beforeBegin',el,html);} 184 | return returnElement?YAHOO.ext.Element.get(newNode,true):newNode;};this.insertAfter=function(el,o,returnElement){el=YAHOO.util.Dom.get(el);var newNode;if(this.useDom){newNode=createDom(o,null);el.parentNode.insertBefore(newNode,el.nextSibling);}else{var html=createHtml(o);newNode=this.insertHtml('afterEnd',el,html);} 185 | return returnElement?YAHOO.ext.Element.get(newNode,true):newNode;};this.append=function(el,o,returnElement){el=YAHOO.util.Dom.get(el);var newNode;if(this.useDom){newNode=createDom(o,null);el.appendChild(newNode);}else{var html=createHtml(o);newNode=this.insertHtml('beforeEnd',el,html);} 186 | return returnElement?YAHOO.ext.Element.get(newNode,true):newNode;};this.overwrite=function(el,o,returnElement){el=YAHOO.util.Dom.get(el);el.innerHTML=createHtml(o);return returnElement?YAHOO.ext.Element.get(el.firstChild,true):el.firstChild;};this.createTemplate=function(o){var html=createHtml(o);return new YAHOO.ext.DomHelper.Template(html);};}();YAHOO.ext.DomHelper.Template=function(html){this.html=html;this.re=/\{(\w+)\}/g;};YAHOO.ext.DomHelper.Template.prototype={applyTemplate:function(values){if(this.compiled){return this.compiled(values);} 187 | var empty='';var fn=function(match,index){if(typeof values[index]!='undefined'){return values[index];}else{return empty;}} 188 | return this.html.replace(this.re,fn);},compile:function(){var html=this.html;var re=/\{(\w+)\}/g;var body=[];body.push("this.compiled = function(values){ return ");var result;var lastMatchEnd=0;while((result=re.exec(html))!=null){body.push("'",html.substring(lastMatchEnd,result.index),"' + ");body.push("values[",html.substring(result.index+1,re.lastIndex-1),"] + ");lastMatchEnd=re.lastIndex;} 189 | body.push("'",html.substr(lastMatchEnd),"';};");eval(body.join(''));},insertBefore:function(el,values,returnElement){el=YAHOO.util.Dom.get(el);var newNode=YAHOO.ext.DomHelper.insertHtml('beforeBegin',el,this.applyTemplate(values));return returnElement?YAHOO.ext.Element.get(newNode,true):newNode;},insertAfter:function(el,values,returnElement){el=YAHOO.util.Dom.get(el);var newNode=YAHOO.ext.DomHelper.insertHtml('afterEnd',el,this.applyTemplate(values));return returnElement?YAHOO.ext.Element.get(newNode,true):newNode;},append:function(el,values,returnElement){el=YAHOO.util.Dom.get(el);var newNode=YAHOO.ext.DomHelper.insertHtml('beforeEnd',el,this.applyTemplate(values));return returnElement?YAHOO.ext.Element.get(newNode,true):newNode;},overwrite:function(el,values,returnElement){el=YAHOO.util.Dom.get(el);el.innerHTML='';var newNode=YAHOO.ext.DomHelper.insertHtml('beforeEnd',el,this.applyTemplate(values));return returnElement?YAHOO.ext.Element.get(newNode,true):newNode;}}; 190 | 191 | YAHOO.ext.Element=function(elementId,forceNew){var dom=YAHOO.util.Dom.get(elementId);if(!dom){return;} 192 | if(!forceNew&&YAHOO.ext.Element.cache[dom.id]){return YAHOO.ext.Element.cache[dom.id];} 193 | this.dom=dom;this.id=this.dom.id;this.visibilityMode=YAHOO.ext.Element.VISIBILITY;this.originalDisplay=YAHOO.util.Dom.getStyle(this.dom,'display');if(!this.originalDisplay||this.originalDisplay=='none'){this.originalDisplay='';} 194 | this.defaultUnit='px';this.originalClip=YAHOO.util.Dom.getStyle(this.dom,'overflow');this.onVisibilityChanged=new YAHOO.util.CustomEvent('visibilityChanged');this.onMoved=new YAHOO.util.CustomEvent('moved');this.onResized=new YAHOO.util.CustomEvent('resized');this.visibilityDelegate=this.fireVisibilityChanged.createDelegate(this);this.resizedDelegate=this.fireResized.createDelegate(this);this.movedDelegate=this.fireMoved.createDelegate(this);} 195 | YAHOO.ext.Element.prototype={fireMoved:function(){this.onMoved.fireDirect(this,this.getX(),this.getY());},fireVisibilityChanged:function(){this.onVisibilityChanged.fireDirect(this,this.isVisible());},fireResized:function(){this.onResized.fireDirect(this,this.getWidth(),this.getHeight());},setVisibilityMode:function(visMode){this.visibilityMode=visMode;},enableDisplayMode:function(){this.setVisibilityMode(YAHOO.ext.Element.DISPLAY)},animate:function(args,duration,onComplete,easing,animType){this.anim(args,duration,onComplete,easing,animType);},anim:function(args,duration,onComplete,easing,animType){animType=animType||YAHOO.util.Anim;var anim=new animType(this.dom,args,duration||.35,easing||YAHOO.util.Easing.easeBoth);if(onComplete){if(!(onComplete instanceof Array)){anim.onComplete.subscribe(onComplete);}else{for(var i=0;ithis.getWidth()?YAHOO.util.Easing.easeOut:YAHOO.util.Easing.easeIn));}},setHeight:function(height,animate,duration,onComplete,easing){height=this.adjustHeight(height);if(!animate||!YAHOO.util.Anim){YAHOO.util.Dom.setStyle(this.dom,'height',this.addUnits(height));this.fireResized();}else{this.anim({height:{to:height}},duration,[onComplete,this.resizedDelegate],easing||(height>this.getHeight()?YAHOO.util.Easing.easeOut:YAHOO.util.Easing.easeIn));}},setSize:function(width,height,animate,duration,onComplete,easing){if(!animate||!YAHOO.util.Anim){this.setWidth(width);this.setHeight(height);this.fireResized();}else{width=this.adjustWidth(width);height=this.adjustHeight(height);this.anim({width:{to:width},height:{to:height}},duration,[onComplete,this.resizedDelegate],easing);}},setBounds:function(x,y,width,height,animate,duration,onComplete,easing){if(!animate||!YAHOO.util.Anim){this.setWidth(width);this.setHeight(height);this.setLocation(x,y);this.fireResized();this.fireMoved();}else{width=this.adjustWidth(width);height=this.adjustHeight(height);this.anim({points:{to:[x,y]},width:{to:width},height:{to:height}},duration,[onComplete,this.movedDelegate],easing,YAHOO.util.Motion);}},setRegion:function(region,animate,duration,onComplete,easing){this.setBounds(region.left,region.top,region.right-region.left,region.bottom-region.top,animate,duration,onComplete,easing);},addListener:function(eventName,handler,scope,override){YAHOO.util.Event.addListener(this.dom,eventName,handler,scope,override);},addHandler:function(eventName,stopPropagation,handler,scope,override){var fn=YAHOO.ext.Element.createStopHandler(stopPropagation,handler,scope,override);YAHOO.util.Event.addListener(this.dom,eventName,fn);},on:function(eventName,handler,scope,override){YAHOO.util.Event.addListener(this.dom,eventName,handler,scope,override);},addManagedListener:function(eventName,fn,scope,override){return YAHOO.ext.EventManager.on(this.dom,eventName,fn,scope,override);},mon:function(eventName,fn,scope,override){return YAHOO.ext.EventManager.on(this.dom,eventName,fn,scope,override);},removeListener:function(eventName,handler){YAHOO.util.Event.removeListener(this.dom,eventName,handler);},removeAllListeners:function(){YAHOO.util.Event.purgeElement(this.dom);},setOpacity:function(opacity,animate,duration,onComplete,easing){if(!animate||!YAHOO.util.Anim){YAHOO.util.Dom.setStyle(this.dom,'opacity',opacity);}else{this.anim({opacity:{to:opacity}},duration,onComplete,easing);}},getLeft:function(){return this.getX();},getRight:function(){return this.getX()+this.getWidth();},getTop:function(){return this.getY();},getBottom:function(){return this.getY()+this.getHeight();},setAbsolutePositioned:function(zIndex){this.setStyle('position','absolute');if(zIndex){this.setStyle('z-index',zIndex);}},setRelativePositioned:function(zIndex){this.setStyle('position','relative');if(zIndex){this.setStyle('z-index',zIndex);}},clearPositioning:function(){this.setStyle('position','');this.setStyle('left','');this.setStyle('right','');this.setStyle('top','');this.setStyle('bottom','');},getPositioning:function(){return{'position':this.getStyle('position'),'left':this.getStyle('left'),'right':this.getStyle('right'),'top':this.getStyle('top'),'bottom':this.getStyle('bottom')};},getBorderWidth:function(side){var width=0;var b=YAHOO.ext.Element.borders;for(var s in b){if(typeof b[s]!='function'){if(side.indexOf(s)!==-1){var w=parseInt(this.getStyle(b[s]),10);if(!isNaN(w))width+=w;}}} 207 | return width;},getPadding:function(side){var pad=0;var b=YAHOO.ext.Element.paddings;for(var s in b){if(typeof s[b]!='function'){if(side.indexOf(s)!==-1){var w=parseInt(this.getStyle(b[s]),10);if(!isNaN(w))pad+=w;}}} 208 | return pad;},setPositioning:function(positionCfg){this.setStyle('position',positionCfg.position);this.setStyle('left',positionCfg.left);this.setStyle('right',positionCfg.right);this.setStyle('top',positionCfg.top);this.setStyle('bottom',positionCfg.bottom);},move:function(direction,distance,animate,duration,onComplete,easing){var xy=this.getXY();direction=direction.toLowerCase();switch(direction){case'left':this.moveTo(xy[0]-distance,xy[1],animate,duration,onComplete,easing);return;case'right':this.moveTo(xy[0]+distance,xy[1],animate,duration,onComplete,easing);return;case'up':this.moveTo(xy[0],xy[1]-distance,animate,duration,onComplete,easing);return;case'down':this.moveTo(xy[0],xy[1]+distance,animate,duration,onComplete,easing);return;}},clip:function(){this.setStyle('overflow','hidden');},unclip:function(){this.setStyle('overflow',this.originalClip);},alignTo:function(element,position,offsets,animate,duration,onComplete,easing){var otherEl=getEl(element);if(!otherEl){return;} 209 | offsets=offsets||[0,0];var r=otherEl.getRegion();position=position.toLowerCase();switch(position){case'bl':this.moveTo(r.left+offsets[0],r.bottom+offsets[1],animate,duration,onComplete,easing);return;case'br':this.moveTo(r.right+offsets[0],r.bottom+offsets[1],animate,duration,onComplete,easing);return;case'tl':this.moveTo(r.left+offsets[0],r.top+offsets[1],animate,duration,onComplete,easing);return;case'tr':this.moveTo(r.right+offsets[0],r.top+offsets[1],animate,duration,onComplete,easing);return;}},clearOpacity:function(){if(window.ActiveXObject){this.dom.style.filter='';}else{this.dom.style.opacity='';this.dom.style['-moz-opacity']='';this.dom.style['-khtml-opacity']='';}},hide:function(animate,duration,onComplete,easing){this.setVisible(false,animate,duration,onComplete,easing);},show:function(animate,duration,onComplete,easing){this.setVisible(true,animate,duration,onComplete,easing);},addUnits:function(size){if(typeof size=='number'||!YAHOO.ext.Element.unitPattern.test(size)){return size+this.defaultUnit;} 210 | return size;},beginMeasure:function(){var p=this.dom;if(p.offsetWidth||p.offsetHeight){return;} 211 | var changed=[];var p=this.dom;while(p&&p.tagName.toLowerCase()!='body'){if(YAHOO.util.Dom.getStyle(p,'display')=='none'){changed.push({el:p,visibility:YAHOO.util.Dom.getStyle(p,'visibility')});p.style.visibility='hidden';p.style.display='block';} 212 | p=p.parentNode;} 213 | this._measureChanged=changed;},endMeasure:function(){var changed=this._measureChanged;if(changed){for(var i=0,len=changed.length;i.*<\/script>)|(?:([\S\s]*?)<\/script>)/ig;var match;while(match=re.exec(html)){var s0=document.createElement("script");if(match[1]) 215 | s0.src=match[1];else if(match[2]) 216 | s0.text=match[2];else 217 | continue;docHead.appendChild(s0);}}else{for(var i=0;i');YAHOO.util.Event.on('ie-deferred-loader','readystatechange',function(){if(this.readyState=='complete'){fireDocReady();}});}else if(YAHOO.ext.util.Browser.isSafari){docReadyProcId=setInterval(function(){var rs=document.readyState;if(rs=='loaded'||rs=='complete'){fireDocReady();}},10);} 234 | YAHOO.util.Event.on(window,'load',fireDocReady);};this.wrap=function(fn,scope,override){var wrappedFn=function(e){YAHOO.ext.EventObject.setEvent(e);fn.call(override?scope||window:window,YAHOO.ext.EventObject,scope);};return wrappedFn;};this.addListener=function(element,eventName,fn,scope,override){var wrappedFn=this.wrap(fn,scope,override);YAHOO.util.Event.addListener(element,eventName,wrappedFn);return wrappedFn;};this.removeListener=function(element,eventName,wrappedFn){return YAHOO.util.Event.removeListener(element,eventName,wrappedFn);};this.on=function(element,eventName,fn,scope,override){var wrappedFn=this.wrap(fn,scope,override);YAHOO.util.Event.addListener(element,eventName,wrappedFn);return wrappedFn;};this.onDocumentReady=function(fn,scope,override){if(!docReadyEvent){initDocReady();} 235 | docReadyEvent.subscribe(fn,scope,override);}};YAHOO.ext.EventObject=new function(){this.browserEvent=null;this.button=-1;this.shiftKey=false;this.ctrlKey=false;this.altKey=false;this.BACKSPACE=8;this.TAB=9;this.RETURN=13;this.ESC=27;this.SPACE=32;this.PAGEUP=33;this.PAGEDOWN=34;this.END=35;this.HOME=36;this.LEFT=37;this.UP=38;this.RIGHT=39;this.DOWN=40;this.DELETE=46;this.F5=116;this.setEvent=function(e){this.browserEvent=e;if(e){this.button=e.button;this.shiftKey=e.shiftKey;this.ctrlKey=e.ctrlKey;this.altKey=e.altKey;}else{this.button=-1;this.shiftKey=false;this.ctrlKey=false;this.altKey=false;}};this.stopEvent=function(){if(this.browserEvent){YAHOO.util.Event.stopEvent(this.browserEvent);}};this.preventDefault=function(){if(this.browserEvent){YAHOO.util.Event.preventDefault(this.browserEvent);}};this.isNavKeyPress=function(){return(this.browserEvent.keyCode&&this.browserEvent.keyCode>=33&&this.browserEvent.keyCode<=40);};this.stopPropagation=function(){if(this.browserEvent){YAHOO.util.Event.stopPropagation(this.browserEvent);}};this.getCharCode=function(){if(this.browserEvent){return YAHOO.util.Event.getCharCode(this.browserEvent);} 236 | return null;};this.getPageX=function(){if(this.browserEvent){return YAHOO.util.Event.getPageX(this.browserEvent);} 237 | return null;};this.getPageY=function(){if(this.browserEvent){return YAHOO.util.Event.getPageY(this.browserEvent);} 238 | return null;};this.getTime=function(){if(this.browserEvent){return YAHOO.util.Event.getTime(this.browserEvent);} 239 | return null;};this.getXY=function(){if(this.browserEvent){return YAHOO.util.Event.getXY(this.browserEvent);} 240 | return[];};this.getTarget=function(){if(this.browserEvent){return YAHOO.util.Event.getTarget(this.browserEvent);} 241 | return null;};this.findTarget=function(className,tagName){if(tagName)tagName=tagName.toLowerCase();if(this.browserEvent){function isMatch(el){if(!el){return false;} 242 | if(className&&!YAHOO.util.Dom.hasClass(el,className)){return false;} 243 | if(tagName&&el.tagName.toLowerCase()!=tagName){return false;} 244 | return true;};var t=this.getTarget();if(!t||isMatch(t)){return t;} 245 | var p=t.parentNode;while(p&&p.tagName.toUpperCase()!='BODY'){if(isMatch(p)){return p;} 246 | p=p.parentNode;}} 247 | return null;};this.getRelatedTarget=function(){if(this.browserEvent){return YAHOO.util.Event.getRelatedTarget(this.browserEvent);} 248 | return null;};this.getWheelDelta=function(){var e=this.browserEvent;var delta=0;if(e.wheelDelta){delta=e.wheelDelta/120;if(window.opera)delta=-delta;}else if(e.detail){delta=-e.detail/3;} 249 | return delta;};this.hasModifier=function(){return this.ctrlKey||this.altKey||this.shiftKey;};}(); 250 | 251 | YAHOO.ext.UpdateManager=function(el,forceNew){el=YAHOO.ext.Element.get(el);if(!forceNew&&el.updateManager){return el.updateManager;} 252 | this.el=el;this.defaultUrl=null;this.beforeUpdate=new YAHOO.util.CustomEvent('UpdateManager.beforeUpdate');this.onUpdate=new YAHOO.util.CustomEvent('UpdateManager.onUpdate');this.onFailure=new YAHOO.util.CustomEvent('UpdateManager.onFailure');this.sslBlankUrl=YAHOO.ext.UpdateManager.defaults.sslBlankUrl;this.disableCaching=YAHOO.ext.UpdateManager.defaults.disableCaching;this.indicatorText=YAHOO.ext.UpdateManager.defaults.indicatorText;this.showLoadIndicator=YAHOO.ext.UpdateManager.defaults.showLoadIndicator;this.timeout=YAHOO.ext.UpdateManager.defaults.timeout;this.loadScripts=YAHOO.ext.UpdateManager.defaults.loadScripts;this.transaction=null;this.autoRefreshProcId=null;this.refreshDelegate=this.refresh.createDelegate(this);this.updateDelegate=this.update.createDelegate(this);this.formUpdateDelegate=this.formUpdate.createDelegate(this);this.successDelegate=this.processSuccess.createDelegate(this);this.failureDelegate=this.processFailure.createDelegate(this);this.renderer=new YAHOO.ext.UpdateManager.BasicRenderer();};YAHOO.ext.UpdateManager.prototype={getEl:function(){return this.el;},update:function(url,params,callback,discardUrl){if(this.beforeUpdate.fireDirect(this.el,url,params)!==false){this.showLoading();if(!discardUrl){this.defaultUrl=url;} 253 | if(typeof url=='function'){url=url();} 254 | if(params&&typeof params!='string'){var buf=[];for(var key in params){if(typeof params[key]!='function'){buf.push(encodeURIComponent(key),'=',encodeURIComponent(params[key]),'&');}} 255 | delete buf[buf.length-1];params=buf.join('');} 256 | var callback={success:this.successDelegate,failure:this.failureDelegate,timeout:(this.timeout*1000),argument:{'url':url,'form':null,'callback':callback,'params':params}};var method=params?'POST':'GET';if(method=='GET'){url=this.prepareUrl(url);} 257 | this.transaction=YAHOO.util.Connect.asyncRequest(method,url,callback,params);}},formUpdate:function(form,url,reset,callback){if(this.beforeUpdate.fireDirect(this.el,form,url)!==false){this.showLoading();formEl=YAHOO.util.Dom.get(form);if(typeof url=='function'){url=url();} 258 | url=url||formEl.action;var callback={success:this.successDelegate,failure:this.failureDelegate,timeout:(this.timeout*1000),argument:{'url':url,'form':form,'callback':callback,'reset':reset}};var isUpload=false;var enctype=formEl.getAttribute('enctype');if(enctype&&enctype.toLowerCase()=='multipart/form-data'){isUpload=true;} 259 | YAHOO.util.Connect.setForm(form,isUpload,this.sslBlankUrl);this.transaction=YAHOO.util.Connect.asyncRequest('POST',url,callback);}},refresh:function(callback){if(this.defaultUrl==null){return;} 260 | this.update(this.defaultUrl,null,callback,true);},startAutoRefresh:function(interval,url,params,callback,refreshNow){if(refreshNow){this.update(url||this.defaultUrl,params,callback,true);} 261 | if(this.autoRefreshProcId){clearInterval(this.autoRefreshProcId);} 262 | this.autoRefreshProcId=setInterval(this.update.createDelegate(this,[url||this.defaultUrl,params,callback,true]),interval*1000);},stopAutoRefresh:function(){if(this.autoRefreshProcId){clearInterval(this.autoRefreshProcId);}},showLoading:function(){if(this.showLoadIndicator){this.el.update(this.indicatorText);}},prepareUrl:function(url){if(this.disableCaching){var append='_dc='+(new Date().getTime());if(url.indexOf('?')!==-1){url+='&'+append;}else{url+='?'+append;}} 263 | return url;},processSuccess:function(response){this.transaction=null;this.renderer.render(this.el,response,this);if(response.argument.form&&response.argument.reset){try{response.argument.form.reset();}catch(e){}} 264 | this.onUpdate.fireDirect(this.el,response);if(typeof response.argument.callback=='function'){response.argument.callback(this.el,true);}},processFailure:function(response){this.transaction=null;this.onFailure.fireDirect(this.el,response);if(typeof response.argument.callback=='function'){response.argument.callback(this.el,false);}},setRenderer:function(renderer){this.renderer=renderer;},getRenderer:function(){return this.renderer;},setDefaultUrl:function(defaultUrl){this.defaultUrl=defaultUrl;},abort:function(){if(this.transaction){YAHOO.util.Connect.abort(this.transaction);}},isUpdating:function(){if(this.transaction){return YAHOO.util.Connect.isCallInProgress(this.transaction);} 265 | return false;}};YAHOO.ext.UpdateManager.update=function(el,url,params,options){var um=getEl(el,true).getUpdateManager();YAHOO.ext.util.Config.apply(um,options);um.update(url,params,options.callback);} 266 | YAHOO.ext.UpdateManager.BasicRenderer=function(){};YAHOO.ext.UpdateManager.BasicRenderer.prototype={render:function(el,response,updateManager){el.update(response.responseText,updateManager.loadScripts);}};YAHOO.ext.UpdateManager.defaults={};YAHOO.ext.UpdateManager.defaults.timeout=30;YAHOO.ext.UpdateManager.defaults.loadScripts=false;YAHOO.ext.UpdateManager.defaults.sslBlankUrl='about:blank';YAHOO.ext.UpdateManager.defaults.disableCaching=false;YAHOO.ext.UpdateManager.defaults.showLoadIndicator=true;YAHOO.ext.UpdateManager.defaults.indicatorText='
    Loading...
    '; 267 | 268 | YAHOO.namespace('ext.state');YAHOO.ext.state.Provider=function(){YAHOO.ext.state.Provider.superclass.constructor.call(this);this.events={'statechange':new YAHOO.util.CustomEvent('statechange')};this.state={};};YAHOO.extendX(YAHOO.ext.state.Provider,YAHOO.ext.util.Observable,{get:function(name){return this.state[name];},clear:function(name){delete this.state[name];this.fireEvent('statechange',this,name,null);},set:function(name,value){this.state[name]=value;this.fireEvent('statechange',this,name,value);}});YAHOO.ext.state.Manager=new function(){var provider=new YAHOO.ext.state.Provider();return{setProvider:function(stateProvider){provider=stateProvider;},get:function(key){return provider.get(key);},set:function(key,value){provider.set(key,value);},clear:function(key){provider.clear(key);},getProvider:function(){return provider;}};}();YAHOO.ext.state.CookieProvider=function(config){YAHOO.ext.state.CookieProvider.superclass.constructor.call(this);this.path='/';this.expires=new Date(new Date().getTime()+(1000*60*60*24*7));this.domain=null;this.secure=false;YAHOO.ext.util.Config.apply(this,config);this.state=this.readCookies();};YAHOO.extendX(YAHOO.ext.state.CookieProvider,YAHOO.ext.state.Provider,{set:function(name,value){if(typeof value=='undefined'||value===null){this.clear(name);return;} 269 | this.setCookie(name,value);YAHOO.ext.state.CookieProvider.superclass.set.call(this,name,value);},clear:function(name){this.clearCookie(name);YAHOO.ext.state.CookieProvider.superclass.clear.call(this,name);},readCookies:function(){var cookies={};var c=document.cookie+';';var re=/\s?(.*?)=(.*?);/g;var matches;while((matches=re.exec(c))!=null){var name=matches[1];var value=matches[2];if(name&&name.substring(0,3)=='ys-'){cookies[name.substr(3)]=this.decodeValue(value);}} 270 | return cookies;},decodeValue:function(cookie){var re=/^(a|n|d|b|s|o)\:(.*)$/;var matches=re.exec(unescape(cookie));if(!matches||!matches[1])return;var type=matches[1];var v=matches[2];switch(type){case'n':return parseFloat(v);case'd':return new Date(Date.parse(v));case'b':return(v=='1');case'a':var all=[];var values=v.split('^');for(var i=0,len=values.length;i=this.minWidth){this.proxy.setX(x);this.proxy.setWidth(w);}else if(this.dir=='north'&&h<=this.maxHeight&&h>=this.minHeight){this.proxy.setY(y);this.proxy.setHeight(h);}} 320 | if(this.dynamic){this.resizeElement();}}},onMouseOver:function(){if(this.enabled)this.el.addClass('yresizable-over');},onMouseOut:function(){this.el.removeClass('yresizable-over');}}); 321 | 322 | 323 | var get_cnid_by_id = function (s) { 324 | return parseInt(s.substr(2),10) 325 | }; 326 | var Comments=function (){ 327 | var COMMENT_BAR_WIDTH=20; 328 | var blocks,chapterBody,chapterWrapper,highlightFloater,currentBlock,allCommentsList,commentTabs,submittranslationButton,currentCommentsList,commentDialog,commentForm; 329 | var allCommentsLoaded=false; 330 | var postingComment=false; 331 | var commentBarClick=function (e){ 332 | setCurrentBlock(getEventTargetBlock(e)); 333 | 334 | }; 335 | var getEventTargetBlock=function (e){ 336 | var t=e.getTarget(); 337 | if(t.nodeName=="SPAN"){ 338 | t=t.parentNode; 339 | 340 | } 341 | return blocks[parseInt(t.id.substr(1),10)]; 342 | 343 | }; 344 | var setCurrentBlock=function (block){ 345 | currentBlock=block; 346 | highlightFloater.setXY([chapterWrapper.getX(),block.el.getY()]); 347 | highlightFloater.setHeight(block.height); 348 | highlightFloater.show(); 349 | commentDialog.show(block); 350 | if(block.indicator.hasClass("has-comments")){ 351 | commentTabs.activate("comment-tabs-current"); 352 | 353 | }else { 354 | commentTabs.activate("comment-tabs-form"); 355 | 356 | } 357 | }; 358 | var onTabChange=function (tp,tabItem){ 359 | if(tabItem.id=="comment-tabs-form"){ 360 | submitCommentButton.show(); 361 | 362 | }else if(tabItem.id=="comment-tabs-current"){ 363 | if(currentBlock){ 364 | loadComments(currentBlock); 365 | 366 | } 367 | submitCommentButton.hide(); 368 | 369 | }else if(tabItem.id=="comment-tabs-all"){ 370 | loadComments(); 371 | submitCommentButton.hide(); 372 | 373 | } 374 | }; 375 | var loadComments=function (block){ 376 | commentDialog.showLoading("正在装载注释..."); 377 | var url=document.location.pathname+"comments/"; 378 | var cl=allCommentsList; 379 | if(block){ 380 | cl=currentCommentsList; 381 | url+=+block.nodenum+"/"; 382 | 383 | } 384 | YAHOO.util.Connect.asyncRequest("GET",url,{ 385 | success:function (res){ 386 | cl.dom.innerHTML=res.responseText; 387 | commentDialog.hideMessage(); 388 | 389 | },failure:XHRFailure 390 | }); 391 | 392 | }; 393 | var XHRFailure=function (res){ 394 | commentDialog.showError(res.statusText); 395 | 396 | }; 397 | var onResize=function (){ 398 | if(highlightFloater.isVisible()&¤tBlock){ 399 | highlightFloater.setXY([chapterWrapper.getX(),currentBlock.top]); 400 | highlightFloater.setHeight(currentBlock.height); 401 | 402 | } 403 | }; 404 | var loadCommentCounts=function (callback){ 405 | var url=document.location.pathname+"comments/counts/"; 406 | YAHOO.util.Connect.asyncRequest("GET",url,{ 407 | success:function (res){ 408 | var cc=eval(res.responseText); 409 | for(var i=0,l=cc.length;i"; 419 | } 420 | } 421 | if(callback){ 422 | callback(); 423 | 424 | } 425 | } 426 | }); 427 | 428 | }; 429 | var commentSuccess=function (res){ 430 | postingComment=false; 431 | commentDialog.hideMessage(); 432 | if(res.responseText.substr(0,3)=="this.viewInfo.pageYOffset+this.viewInfo.innerHeight-20){ 597 | this.xy[1]=this.viewInfo.pageYOffset+this.viewInfo.innerHeight-this.el.getHeight()-20; 598 | this.el.setXY(this.xy); 599 | 600 | } 601 | if(this.xy[1]document.body.offsetHeight){ 688 | pageWidth=document.body.scrollWidth; 689 | pageHeight=document.body.scrollHeight; 690 | 691 | }else { 692 | pageWidth=document.body.offsetWidth; 693 | pageHeight=document.body.offsetHeight; 694 | 695 | } 696 | return { 697 | innerWidth:innerWidth,innerHeight:innerHeight,pageXOffset:pageXOffset,pageYOffset:pageYOffset,pageWidth:pageWidth,pageHeight:pageHeight 698 | }; 699 | 700 | }; 701 | YAHOO.ext.EventManager.onDocumentReady(Comments.init,Comments,true); 702 | -------------------------------------------------------------------------------- /templates/base.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Aiglos 6 | 7 | 8 | 9 | 10 | 11 | 12 | ${ self.proxy() } 13 |
    14 |
    15 |

    Book

    16 | 19 | ${ self.nav() } 20 |
    21 |
    22 |
    23 |
    24 | ${ self.chapter_main() } 25 |
    26 |
    27 |
    28 | ${ self.chapter_ft() } 29 |
    30 | 31 | ${ self.comment() } 32 |
    33 | Copyright 2016 Dongweiming.
    This 34 | work is licensed under the GNU Free Document 35 | License. 36 |
    37 |
    38 | 39 | 40 | 41 | 42 | <%def name="nav()"> 43 | 44 | 45 | <%def name="chapter_main()"> 46 | 47 | 48 | <%def name="proxy()"> 49 | 50 | 51 | <%def name="chapter_ft()"> 52 | 53 | 54 | <%def name="comment()"> 55 | 56 | -------------------------------------------------------------------------------- /templates/comment.html: -------------------------------------------------------------------------------- 1 | <%def name="main(comments)"> 2 | % for comment in comments: 3 |
  • 4 | 5 | ${ comment.pub_date }
    6 |

    ${ comment.content }

    7 |
  • 8 | % endfor 9 | 10 | -------------------------------------------------------------------------------- /templates/index.html: -------------------------------------------------------------------------------- 1 | <%inherit file="base.html"/> 2 | 3 | <%def name="chapter_main()"> 4 |

    Table of contents

    5 | ${ content } 6 | 7 | -------------------------------------------------------------------------------- /templates/page.html: -------------------------------------------------------------------------------- 1 | <%inherit file="base.html"/> 2 | 3 | <%def name="chapter_main()"> 4 |
    5 |
    6 | ${ content } 7 |
    8 |
    9 | 10 | 11 | <%def name="proxy()"> 12 |
    13 |
    14 | 15 | 16 | <%def name="nav()"> 17 | 20 | 21 | 22 | <%def name="chapter_ft()"> 23 |
    24 | ${ self.nav() } 25 |
    26 | 27 | 28 | <%def name="comment()"> 29 | 30 | 103 | 104 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dongweiming/aiglos/2f80490cf434019b7037b53fe0daba949bd7087f/tests/__init__.py -------------------------------------------------------------------------------- /tests/pytest_test.py: -------------------------------------------------------------------------------- 1 | # coding=utf-8 2 | import pytest 3 | 4 | 5 | @pytest.fixture # 创建测试环境, 可以做setUp和tearDown的工作 6 | def setup_math(): 7 | import math 8 | return math 9 | 10 | 11 | @pytest.fixture(scope='function') 12 | def setup_function(request): 13 | def teardown_function(): 14 | print("teardown_function called.") 15 | request.addfinalizer(teardown_function) # 这个内嵌的函数去做收尾工作 16 | print('setup_function called.') 17 | 18 | 19 | # Py.test不需要Unittest的那种模板, 只要函数或者类以test开头即可 20 | def test_func(setup_function): 21 | print('Test_Func called.') 22 | 23 | 24 | def test_setup_math(setup_math): 25 | # Py.test不需要使用self.assertXXX这样的方法, 直接使用Python内置的断言语句即可assert 26 | import time 27 | time.sleep(4) 28 | assert setup_math.pow(2, 3) == 8.0 29 | 30 | 31 | class TestClass(object): 32 | def test_in(self): 33 | assert 'h' in 'hello' 34 | 35 | def test_two(self, setup_math): 36 | assert setup_math.ceil(10) == 10.0 37 | 38 | 39 | def raise_exit(): 40 | raise SystemExit(1) 41 | 42 | 43 | def test_mytest(): 44 | with pytest.raises(SystemExit): # 用来测试抛出来的异常 45 | raise_exit() 46 | 47 | 48 | @pytest.mark.parametrize('test_input,expected', [ 49 | ('1+3', 4), 50 | ('2*4', 8), 51 | ('1 == 2', False), 52 | ]) # parametrize可以用装饰器的方式集成多组测试样例 53 | def test_eval(test_input, expected): 54 | assert eval(test_input) == expected 55 | --------------------------------------------------------------------------------