Merge lp:~vauxoo/tools-openerp-vauxoo/vauxoomin3 into lp:tools-openerp-vauxoo
- vauxoomin3
- Merge into trunk
Proposed by
Nhomar - Vauxoo
Status: | Needs review |
---|---|
Proposed branch: | lp:~vauxoo/tools-openerp-vauxoo/vauxoomin3 |
Merge into: | lp:tools-openerp-vauxoo |
Diff against target: |
4865 lines (+3785/-665) 43 files modified
list_db.py (+40/-40) scripts_openerp/backup_automatic/backup_pg.sh (+205/-0) scripts_openerp/backup_automatic/crontab (+6/-0) scripts_openerp/backup_automatic/pgpass (+18/-0) scripts_openerp/openerp-server.sh (+148/-0) scripts_openerp/openerp-web.sh (+135/-0) scripts_openerp/respaldo.sh (+30/-0) vauxoomin/main/action.py (+121/-12) vauxoomin/main/list_db.py (+72/-0) vauxoomin/main/manageopenerp.py (+33/-0) vauxoomin/main/markdown.py (+1877/-0) vauxoomin/main/server.py (+53/-4) vauxoomin/static/css/all.css (+11/-1) vauxoomin/templates/action.html (+11/-8) vauxoomin/templates/base.html (+0/-1) vauxoomin/templates/base_themed.html (+93/-0) vauxoomin/templates/home.html (+10/-7) vauxoomin/templates/home_profit.html (+15/-0) vauxoomin/templates/home_project.html (+18/-0) vauxoomin/templates/index.html (+33/-578) vauxoomin/templates/modules/left.html (+1/-1) vauxoomin/templates/notfound.html (+2/-2) vauxoomin/templates/widgets/acordion_menu.html (+37/-0) vauxoomin/templates/widgets/acordion_wrap.html (+31/-0) vauxoomin/templates/widgets/calendar.html (+4/-0) vauxoomin/templates/widgets/chart.html (+59/-0) vauxoomin/templates/widgets/code.html (+3/-0) vauxoomin/templates/widgets/crumbs.html (+8/-0) vauxoomin/templates/widgets/dash_blocks.html (+12/-0) vauxoomin/templates/widgets/dash_branches.html (+13/-0) vauxoomin/templates/widgets/form.html (+33/-0) vauxoomin/templates/widgets/image_gallery.html (+81/-0) vauxoomin/templates/widgets/img_logo.html (+1/-0) vauxoomin/templates/widgets/list_db.html (+46/-0) vauxoomin/templates/widgets/list_paged.html (+126/-0) vauxoomin/templates/widgets/main_menu.html (+52/-0) vauxoomin/templates/widgets/search_box.html (+19/-0) vauxoomin/templates/widgets/tabed_menu.html (+27/-0) vauxoomin/templates/widgets/top_menu.html (+5/-0) vauxoomin/templates/widgets/twitter.html (+30/-0) vauxoomin/templates/widgets/warning_message.html (+3/-0) vauxoomin/vauxomin.cfg (+5/-0) vauxoomin/vauxomin.py (+258/-11) |
To merge this branch: | bzr merge lp:~vauxoo/tools-openerp-vauxoo/vauxoomin3 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Vauxoo | approve | Pending | |
Review via email: mp+98547@code.launchpad.net |
Commit message
Description of the change
Agregado el concepto de Vauxoomin.
To post a comment you must log in.
Unmerged revisions
- 92. By Nhomar - Vauxoo
-
[add] Profit conect concept
- 91. By Vauxoo
-
[IMP] Frist part of fancy logs, added widget
- 90. By Vauxoo
-
[IMP] Frist part of fancy logs
- 89. By Vauxoo
-
[IMP] Improving widgetMessage to allow have several message from action at same time.
- 88. By Vauxoo
-
[IMP] Improving widgetMessage to allow have several message from action at same time.
- 87. By Vauxoo
-
[IMP] Starting openerp from vauxoomin ready, left some generic work, but it is working.
- 86. By Vauxoo
-
[IMP] Start server working
- 85. By Vauxoo
-
[INIT] Start Server action
- 84. By Vauxoo
-
[FIX] moving nohup to correct place
- 83. By Vauxoo
-
[FIX] Taking of some echo strings
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'list_db.py' |
2 | --- list_db.py 2012-02-19 18:35:01 +0000 |
3 | +++ list_db.py 2012-03-21 00:56:22 +0000 |
4 | @@ -1,38 +1,28 @@ |
5 | -import gtk |
6 | +#import gtk |
7 | import xmlrpclib |
8 | -import logging |
9 | +#import logging |
10 | import socket |
11 | import cPickle |
12 | import os |
13 | import re |
14 | import sys |
15 | import socket |
16 | -import ConfigParser |
17 | -import optparse |
18 | +#import ConfigParser |
19 | +#import optparse |
20 | |
21 | #socket://localhost:8070' |
22 | DNS_CACHE = {} |
23 | |
24 | |
25 | -sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
26 | + |
27 | |
28 | class list_db(object): |
29 | - |
30 | - if __name__=='__main__': |
31 | - url = 'socket://localhost:8070' |
32 | - resource = 'db' |
33 | - method = 'list' |
34 | - |
35 | - |
36 | - def __init__(self): |
37 | - print "Parametros \n" |
38 | - print "url = Ej: socket://localhost:8070" |
39 | - print "resource = db" |
40 | - print "method = list" |
41 | - print "Realizar llamado al metodo principal conect_to_port" |
42 | - |
43 | + |
44 | + |
45 | def conect_to_port(self,url, resource='db', method='list', *args): |
46 | + sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
47 | m = re.match('^(http[s]?://|socket://)([\w.\-]+):(\d{1,5})$', url or '') |
48 | + print dir(sock) |
49 | if m.group(1) == 'http://' or m.group(1) == 'https://': |
50 | sock = xmlrpclib.ServerProxy(url + '/xmlrpc/' + resource) |
51 | return getattr(sock, method)(*args) |
52 | @@ -42,6 +32,7 @@ |
53 | res = self.send_db() |
54 | return res |
55 | |
56 | + |
57 | def connect(self, host, port=False): |
58 | if not port: |
59 | protocol, buf = host.split('//') |
60 | @@ -50,28 +41,37 @@ |
61 | host = DNS_CACHE[host] |
62 | sock.connect((host, int(port))) |
63 | DNS_CACHE[host], port = sock.getpeername() |
64 | - |
65 | + |
66 | + |
67 | def mysend(self, msg, exception=False, traceback=None): |
68 | msg = cPickle.dumps([msg,traceback]) |
69 | sock.sendall('%8d%s%s' % (len(msg), exception and "1" or "0", msg)) |
70 | - |
71 | + |
72 | + |
73 | def send_db(self): |
74 | - def read(socket, size): |
75 | - buf='' |
76 | - while len(buf) < size: |
77 | - chunk = sock.recv(size - len(buf)) |
78 | - if chunk == '': |
79 | - raise RuntimeError, "socket connection broken" |
80 | - buf += chunk |
81 | - return buf |
82 | - |
83 | - size = int(read(sock, 8)) |
84 | - buf = read(sock, 1) |
85 | - exception = buf != '0' and buf or False |
86 | - res = cPickle.loads(read(sock, size)) |
87 | - if isinstance(res[0],Exception): |
88 | - if exception: |
89 | - raise Myexception(str(res[0]), str(res[1])) |
90 | - raise res[0] |
91 | - else: |
92 | - return res[0] |
93 | + def read(socket, size): |
94 | + buf='' |
95 | + while len(buf) < size: |
96 | + chunk = sock.recv(size - len(buf)) |
97 | + if chunk == '': |
98 | + raise RuntimeError, "socket connection broken" |
99 | + buf += chunk |
100 | + return buf |
101 | + size = int(read(sock, 8)) |
102 | + buf = read(sock, 1) |
103 | + exception = buf != '0' and buf or False |
104 | + res = cPickle.loads(read(sock, size)) |
105 | + if isinstance(res[0],Exception): |
106 | + if exception: |
107 | + raise Myexception(str(res[0]), str(res[1])) |
108 | + raise res[0] |
109 | + else: |
110 | + return res[0] |
111 | + |
112 | + |
113 | +if __name__=='__main__': |
114 | + url = 'socket://localhost:8070' |
115 | + resource = 'db' |
116 | + method = 'list' |
117 | + l=list_db() |
118 | + print l.conect_to_port(url) |
119 | |
120 | === added directory 'scripts_openerp' |
121 | === added directory 'scripts_openerp/backup_automatic' |
122 | === added file 'scripts_openerp/backup_automatic/backup_pg.sh' |
123 | --- scripts_openerp/backup_automatic/backup_pg.sh 1970-01-01 00:00:00 +0000 |
124 | +++ scripts_openerp/backup_automatic/backup_pg.sh 2012-03-21 00:56:22 +0000 |
125 | @@ -0,0 +1,205 @@ |
126 | +#! /bin/bash |
127 | +### SETTING PRIVILEGES TO ALLOW DUMPING WITH HASSLES |
128 | +# To avoid being asked for password when doing the dumping of the database and therefore make this script quite automatic |
129 | +# set the following in: |
130 | +# sudo nano /etc/postgresql/8.3/main/pg_hba.conf |
131 | +# host all all 127.0.0.1/32 trust |
132 | +# Stop and Start your postgres service |
133 | +# sudo /etc/init.d/postgresql-8.3 stop && sudo /etc/init.d/postgresql-8.3 start |
134 | + |
135 | +#SETTING AUTOMATIC AUTHENTICATION |
136 | +#create a file in the postgres home, usually, /var/lib/postgresql |
137 | +#this file must be named .pgpass |
138 | +#this file must have 0600 permission, in order to only postgres can read it. |
139 | +#chmod 0600 .pgpass |
140 | +#this file must contain this information: |
141 | +# dbhost:5432:dbname:username:password, (dbhost is your porstgresql server's IP, so in this program, |
142 | +# the .pgpass would look like this: 192.168.1.200:5432:dbname:username:password |
143 | +#192.168.1.200:5432:dbname:username:password |
144 | +#*:*:*:*:CLAVE_DEL_ROOT_USER_o_sudoer #please remove |
145 | + |
146 | +### SETTING PRIVILEGES TO THE FOLDER WHERE DUMPS WILL BE SAVED |
147 | +# To allow the user under which the cron is run create, read, write, and erase |
148 | +# set the following privileges to the folder where the dumps will be saved |
149 | +# sudo chown postgres:postgres /home/backup/ -R |
150 | + |
151 | +### ESTABLISHING LOCATION AND PRIVILEGES TO THIS SCRIPT |
152 | +# Put this file in /usr/local/bin |
153 | +# then set privileges to the user in the crontab |
154 | +# sudo chown postgres:postgres /usr/local/bin/backup_pg.sh |
155 | +# sudo chmod 755 /usr/local/bin/backup_pg.sh |
156 | + |
157 | +### SETTING CRONTAB TO RUN THE SCRIPT |
158 | +# AFAIK I am paranoic and this setting will reflect my paranoic behavoir toward backups |
159 | +# and so in the forecoming updates which in my wishlist spam through sending this to |
160 | +# backups to another server be it ftp, sftp, or a cloud storage like dropbox (c) or spideroak(c) |
161 | +# (marks and trademarks are copyrights of their owners). |
162 | +# |
163 | +# m h dom mon dow user command |
164 | +# 30 * * * * postgres backup_pg.sh |
165 | +# this command will be run at the thirty (30) min of each hour (paranoic mode) |
166 | + |
167 | +# TESTING SCRIPT WITH POSTGRES USER |
168 | +#sudo su postgres |
169 | +#sh /usr/local/bin/backup_pg.sh |
170 | +#if this command does not work please check again the privilegies "SETTING PRIVILEGES TO THE FOLDER WHERE DUMPS WILL BE SAVED" |
171 | + |
172 | +### FEATURES: |
173 | +# - Automatic backup of Postgresql database |
174 | +# - Daily, weekly, monthly |
175 | +# - Rotation of backup files |
176 | + |
177 | +# Credits: |
178 | +# The credit for this work goes to those who made it possible, this script (original one) |
179 | +# can be found at: |
180 | +# http://linux2.arinet.org/index.php?option=com_content&task=view&id=125&Itemid=35 |
181 | +# I just made some tweaks to adjust it to my needs, hope it be useful |
182 | + |
183 | +# This program is based on automatic MySQL backup script by Harley |
184 | +# (wipe_out at users.sourceforge.net). Thanks Harley, your script is really nice. |
185 | +# So, therefore, this program is also released under the GPL which can be obtain |
186 | +# from http://www.fsf.org |
187 | +# A little background: |
188 | +# This program is emerged from the need to have an automatic backup process for |
189 | +# postgresql database server. After some extensive searching on Google, I came |
190 | +# across Harley's script. It's for MySQL though. Well, I'm not a bash scriptter, |
191 | +# so, after some discussion in few lists and experimenting, I managed to get this |
192 | +# works. |
193 | + |
194 | +### THIS IS THE ORIGINAL DOCUMENTATION SO AVOID, |
195 | +# WITH PREVIOUS ESTABLISHED SETTING THIS SCRIPT SHOULD WORK |
196 | +# Note on postgresql settings: |
197 | +# By default, postgresql setting is not open, which means we must set the authentication |
198 | +# method for the client first. It is done in /var/lib/pgsql/data/pg_hba.conf file. |
199 | +# In order to use this program, we can set the method like this: |
200 | +# host all all 192.168.1.100/32 md5 |
201 | +# where 192.168.1.100 is your backup machine IP. |
202 | +# There is also one trick in order to be able to do automatic backup. |
203 | +# Postgresql use it's build-in tools to backup, that is: pg_dump and pg_dumpall. |
204 | +# Because of it's security measure, we cannot specify the password in the pg_dump option. |
205 | +# There is a way though, we can create a file called .pgpass in user directory who runs |
206 | +# this script, with this content: |
207 | +# dbhost:5432:dbname:username:password, (dbhost is your porstgresql server's IP, so in this program, |
208 | +# the .pgpass would look like this: 192.168.1.200:5432:dbname:username:password |
209 | +# Don't forget to chmod the file 600. |
210 | + |
211 | +#!/bin/bash |
212 | + |
213 | +USERNAME=practica2 # username for the connection. Avoid leaving spaces between the equal sign and databaseusername |
214 | +DBHOST=localhost # match your pgsql server IP. |
215 | +DBNAMES=islr # the database names to be backup the list must be separated by an "\n" character, <enter> keys |
216 | +BACKUPDIR="/backup/db" # the location to put the backup files. postgres debe tener permisos para escribir. |
217 | +COMP=gzip # razon de compresion |
218 | +OPT="all" |
219 | + |
220 | +# What do we want to backup. OPT |
221 | +# "all" = schema + data |
222 | +# "schema" = schema |
223 | +# "data" = data |
224 | + |
225 | +SEPDIR="yes" #Crear directorios separados para cada BD. |
226 | + |
227 | +DATE=`date +%Y-%m-%d_%Hh%Mm` # Datestamp 2006-03-21 #como se nombra el archivo |
228 | +DOW=`date +%A` # Day of the week, Sunday, Monday, ... # dia de la semana |
229 | + |
230 | + |
231 | +LOGFILE=$BACKUPDIR/$DBHOST-`date +%N`.log # logfile name |
232 | +LOGERR=$BACKUPDIR/ERRORS_$DBHOST-`date +%N`.log # error logfile name |
233 | +BACKUPFILES="" |
234 | +OPT="" |
235 | +if [ ! -e "$BACKUPDIR" ] # Chequea si el directorio existe |
236 | +then |
237 | +mkdir -p "$BACKUPDIR" |
238 | +fi |
239 | + |
240 | +if [ ! -e "$BACKUPDIR/daily" ] # Chequea si el directorio daily existe. |
241 | +then |
242 | +mkdir -p "$BACKUPDIR/daily" |
243 | +fi |
244 | + |
245 | +touch $LOGFILE #crea el archivo logfile |
246 | +exec 6>&1 |
247 | +exec > $LOGFILE # Link file descriptor #6 with stdout. |
248 | +# Saves stdout. |
249 | + |
250 | +touch $LOGERR |
251 | +exec 7>&2 # Link file descriptor #7 with stderr. |
252 | +# Saves stderr. |
253 | +exec 2> $LOGERR # stderr replaced with file $LOGERR. |
254 | + |
255 | + |
256 | +if [ "$OPT" = "all" ]; then |
257 | +OPT = "" |
258 | +elif [ "OPT" = "data" ]; then |
259 | +OPT = "-a" |
260 | +elif [ "OPT" = "schema" ]; then |
261 | +OPT = "-s" |
262 | +fi |
263 | + |
264 | +# Database dump function |
265 | +dbdump () { |
266 | +pg_dump $OPT -U $USERNAME -h $DBHOST $1 > $2 #comando de respaldo de sql |
267 | +return 0 |
268 | +} |
269 | + |
270 | +# Compression function plus latest copy |
271 | +SUFFIX="" |
272 | +compression () { |
273 | +if [ "$COMP" = "gzip" ]; then |
274 | +gzip -f "$1" #comando para comprimir el archivo |
275 | +echo |
276 | +echo Backup Information for "$1" |
277 | +gzip -l "$1.gz" |
278 | +SUFFIX=".gz" |
279 | +elif [ "$COMP" = "bzip2" ]; then |
280 | +echo Compression information for "$1.bz2" |
281 | +bzip2 -f -v $1 2>&1 |
282 | +SUFFIX=".bz2" |
283 | +else |
284 | +echo "No compression option set, check advanced settings" |
285 | +fi |
286 | +return 0 |
287 | +} |
288 | + |
289 | +# Hostname for LOG information |
290 | +if [ "$DBHOST" = "localhost" ]; then |
291 | +HOST=`hostname` |
292 | +if [ "$SOCKET" ]; then |
293 | +OPT="$OPT --socket=$SOCKET" |
294 | +fi |
295 | +else |
296 | +HOST=$DBHOST |
297 | +fi |
298 | + |
299 | + |
300 | +# Test if separate DB backups are required |
301 | +if [ "$SEPDIR" = "yes" ]; then #directorios separados para cada BD |
302 | +echo Backup Start Time `date` |
303 | +echo ====================================================================== |
304 | + |
305 | +for DB in $DBNAMES |
306 | +do |
307 | +# Prepare $DB for using |
308 | +DB="`echo $DB | sed 's/%/ /g'`" |
309 | + |
310 | + |
311 | +if [ ! -e "$BACKUPDIR/daily/$DB" ] # Check Daily DB Directory exists. |
312 | +then |
313 | +mkdir -p "$BACKUPDIR/daily/$DB" |
314 | +fi |
315 | +echo Daily Backup of Database \( $DB \) |
316 | +echo |
317 | +dbdump "$DB" "$BACKUPDIR/daily/$DB/${DB}_$DATE.$DOW.sql" |
318 | +compression "$BACKUPDIR/daily/$DB/${DB}_$DATE.$DOW.sql" |
319 | +BACKUPFILES="$BACKUPFILES $BACKUPDIR/daily/$DB/${DB}_$DATE.$DOW.sql$SUFFIX" #PENDIENTE BORRAR Y PROBAR |
320 | +echo ---------------------------------------------------------------------- |
321 | +done |
322 | + |
323 | +echo Backup End `date` |
324 | +echo ====================================================================== |
325 | +echo Total disk space used for backup storage.. |
326 | +echo Size - Location |
327 | +echo `du -hs "$BACKUPDIR"` |
328 | +echo |
329 | +fi |
330 | + |
331 | |
332 | === added file 'scripts_openerp/backup_automatic/crontab' |
333 | --- scripts_openerp/backup_automatic/crontab 1970-01-01 00:00:00 +0000 |
334 | +++ scripts_openerp/backup_automatic/crontab 2012-03-21 00:56:22 +0000 |
335 | @@ -0,0 +1,6 @@ |
336 | +# Paranoic backup |
337 | + |
338 | +00 * * * * postgres backup_pg.sh |
339 | +15 * * * * postgres backup_pg.sh |
340 | +30 * * * * postgres backup_pg.sh |
341 | +45 * * * * postgres backup_pg.sh |
342 | |
343 | === added file 'scripts_openerp/backup_automatic/pgpass' |
344 | --- scripts_openerp/backup_automatic/pgpass 1970-01-01 00:00:00 +0000 |
345 | +++ scripts_openerp/backup_automatic/pgpass 2012-03-21 00:56:22 +0000 |
346 | @@ -0,0 +1,18 @@ |
347 | +#Este archivo debe llamarse .pgpass, se ha nombrado sin el punto |
348 | +#para que vd. lo pueda ver, dado que todo archivo que comience con |
349 | +#un punto (.) en Unix/Linux es un archivo invisible. |
350 | +#Este archivo debe tener permisos 0600 luego de que ha puesto en |
351 | +#funcionamiento, para que nadie mas que postgres lo pueda leer, |
352 | + |
353 | +#chmod 0600 .pgpass |
354 | + |
355 | +#este archivo debe estar ubicado en el home del usuario postgres |
356 | +#/var/lib/postgresql |
357 | + |
358 | + |
359 | +# dbhost:5432:dbname:username:password, (dbhost is your porstgresql server's IP, so in this program, |
360 | +# the .pgpass would look like this: 192.168.1.200:5432:dbname:username:password |
361 | + |
362 | + |
363 | +#192.168.1.200:5432:dbname:username:password |
364 | +*:*:*:*:CLAVE_DEL_ROOT_USER_o_sudoer |
365 | |
366 | === added file 'scripts_openerp/openerp-server.sh' |
367 | --- scripts_openerp/openerp-server.sh 1970-01-01 00:00:00 +0000 |
368 | +++ scripts_openerp/openerp-server.sh 2012-03-21 00:56:22 +0000 |
369 | @@ -0,0 +1,148 @@ |
370 | +#!/bin/sh -e |
371 | +### BEGIN INIT INFO |
372 | +# Provides: openerp |
373 | +# Required-Start: $local_fs $remote_fs |
374 | +# Required-Stop: $local_fs $remote_fs |
375 | +# Should-Start: $syslog |
376 | +# Should-Stop: $syslog |
377 | +# Default-Start: 3 5 |
378 | +# Default-Stop: 0 1 6 |
379 | +# Short-Description: Start or stop OpenERP 5.0 |
380 | +# Made by Netquatro |
381 | +### END INIT INFO |
382 | + |
383 | +NAME="openerp" |
384 | +DESC="OpenERP" |
385 | +OPTIONS="" |
386 | +ENABLED=1 |
387 | +echo ">>>>>>>>>>>Running as "$USER |
388 | +PARAM="$4 $5 $6 $7 $8" |
389 | +USERTOLOAD=$3 |
390 | +CONTROL=$2 |
391 | +DIRCONFIG='/home/'$USERTOLOAD'/config' |
392 | +#Ensuring all minimal parameters are loaded. |
393 | +if [ "$USERTOLOAD" = "" ] ; then |
394 | + echo "You must provide instance(s) and user something like: ./openerp-server.sh start all user" |
395 | + exit |
396 | +fi |
397 | +#Ensuring you are loading YOUR instance, if you aren't root you just can run your instance. |
398 | +if [ "$USERTOLOAD" != "$USER" ] ; then |
399 | + if [ "$USER" != "root" ] ; then |
400 | + echo "Ensuring you are loading YOUR instance, if you aren't root you just can run your instance." |
401 | + exit |
402 | + fi |
403 | +fi |
404 | +#Function to evaluate if we will run all or just ona instance. |
405 | +startopenerp() { |
406 | + if [ "$CONTROL" = "all" ]; then |
407 | + while read line |
408 | + do |
409 | + SERVER="$line" |
410 | + if [ "$SERVER" = "" ]; then |
411 | + echo "I found and empty Line on servers.txt" |
412 | + else |
413 | + DIR='/home/'$USERTOLOAD'/instancias/'$SERVER'/server' |
414 | + CONFIGFILE=$DIRCONFIG/$SERVER'_oerp.conf' |
415 | + if [ -f $DIRCONFIG/$SERVER'_oerp.conf' ]; then |
416 | + if [ -d $DIR ]; then |
417 | + COMMAND="python $DIR/bin/openerp-server.py -c $CONFIGFILE &" |
418 | + if [ "$USER"="root" ]; then |
419 | + su -c nohup "$COMMAND" - $USERTOLOAD |
420 | + else |
421 | + nohup $COMMAND |
422 | + fi |
423 | + else |
424 | + echo "directorio $DIR no encontrado corrija el Script o verifique la ruta" |
425 | + fi |
426 | + else |
427 | + echo "fichero $DIRCONFIG/$SERVER_oerp.conf no encontrado" |
428 | + fi |
429 | + fi |
430 | + done < $DIRCONFIG/servers.txt |
431 | + else |
432 | + SERVER=$CONTROL |
433 | + DIR='/home/'$USERTOLOAD'/instancias/'$SERVER'/server' |
434 | + CONFIGFILE=$DIRCONFIG/$SERVER"_oerp.conf" |
435 | + if [ -f $DIRCONFIG/$SERVER'_oerp.conf' ]; then |
436 | + if [ -d $DIR ]; then |
437 | + COMMAND="python $DIR/bin/openerp-server.py -c $CONFIGFILE &" |
438 | + if [ "$USER" = "root" ]; then |
439 | + su -c nohup "$COMMAND" - $USERTOLOAD |
440 | + else |
441 | + echo "runing as Limited usertoload\n" |
442 | + echo "nohup $COMMAND" |
443 | + |
444 | + fi |
445 | + else |
446 | + echo "directorio $DIR no encontrado corrija el Script o verifique la ruta" |
447 | + fi |
448 | + else |
449 | + echo "fichero $DIRCONFIG/$SERVER_oerp.conf no encontrado" |
450 | + fi |
451 | + fi |
452 | +} |
453 | + |
454 | +killopenerp() |
455 | +{ |
456 | + if [ "$CONTROL" = "all" ]; then |
457 | + while read line |
458 | + do |
459 | + SERVER="$line" |
460 | + DIR="/home/$USERTOLOAD/instancias/$SERVER/server" |
461 | + CONFIGFILE=$DIRCONFIG/$SERVER'_oerp.conf' |
462 | + echo $CONFIGFILE |
463 | + for X in `ps xa|grep openerp-server.py|grep python|grep "$CONFIGFILE"|awk '{print $1}'`; do |
464 | + `kill -9 $X` |
465 | + done |
466 | + done < $DIRCONFIG/servers.txt |
467 | + else |
468 | + SERVER=$CONTROL |
469 | + DIR="/home/$USERTOLOAD/instancias/$SERVER/server" |
470 | + CONFIGFILE=$DIRCONFIG/$SERVER"_oerp.conf" |
471 | + for X in `ps xa|grep openerp-server.py|grep python|grep "$CONFIGFILE"|awk '{print $1}'`; do |
472 | + `kill -9 $X` |
473 | + done |
474 | + fi |
475 | +} |
476 | + |
477 | +statusopenerp() { |
478 | + ps xa|grep openerp-server.py|grep python |
479 | +} |
480 | + |
481 | + |
482 | +if [ "x$OPTIONS" != "x" ]; then |
483 | + OPTIONS="-- $OPTIONS" |
484 | +fi |
485 | + |
486 | +test "$ENABLED" != "0" || exit 0 |
487 | + |
488 | +set -e |
489 | + |
490 | +case "$1" in |
491 | + start) |
492 | + echo -n "Starting $DESC: " |
493 | + startopenerp |
494 | + ;; |
495 | + stop) |
496 | + echo -n "Stopping $DESC: " |
497 | + killopenerp |
498 | + echo "Done." |
499 | + ;; |
500 | + force-reload|restart) |
501 | + echo -n "Restarting $DESC: " |
502 | + killopenerp |
503 | + sleep 1 |
504 | + startopenerp |
505 | + ;; |
506 | + status) |
507 | + echo "Status $DESC: " |
508 | + statusopenerp |
509 | + ;; |
510 | + *) |
511 | + N=/etc/init.d/$NAME |
512 | + echo "Usage: $N {start|stop|force-reload|restart|status} [server] [usertoload] [openerp params...]" >&2 |
513 | + exit 1 |
514 | + ;; |
515 | +esac |
516 | + |
517 | +exit 0 |
518 | |
519 | === added file 'scripts_openerp/openerp-web.sh' |
520 | --- scripts_openerp/openerp-web.sh 1970-01-01 00:00:00 +0000 |
521 | +++ scripts_openerp/openerp-web.sh 2012-03-21 00:56:22 +0000 |
522 | @@ -0,0 +1,135 @@ |
523 | +#!/bin/sh -e |
524 | +### BEGIN INIT INFO |
525 | +# Provides: etiny |
526 | +# Required-Start: $local_fs $remote_fs |
527 | +# Required-Stop: $local_fs $remote_fs |
528 | +# Should-Start: $syslog |
529 | +# Should-Stop: $syslog |
530 | +# Default-Start: 3 5 |
531 | +# Default-Stop: 0 1 6 |
532 | +# Short-Description: Start or stop server-client web eTiny for OpenERP |
533 | +# Made by Netquatro |
534 | +### END INIT INFO |
535 | + |
536 | +NAME="openerpweb" |
537 | +DESC="OpenERP web client (eTiny)" |
538 | +OPTIONS="" |
539 | +ENABLED=1 |
540 | + |
541 | +PARAM="$3 $4 $5 $6 $7 $8" |
542 | + |
543 | +if [ "$2" = "" ]; then |
544 | + SERVER="produccion" |
545 | + CONTROL="todos" |
546 | + echo -e $CONTROL |
547 | +else |
548 | + SERVER="$2" |
549 | +fi |
550 | + |
551 | +##Defino el directorio de trabajo |
552 | +DIR='/home/openerp/instancias/'$SERVER'/client-web' |
553 | +DIRCONFIG="/home/openerp/config" |
554 | +CONFIGSERVERS="/home/openerp/config" |
555 | + |
556 | +startetiny() { |
557 | + if [ "$CONTROL" = "todos" ]; then |
558 | + while read line |
559 | + do |
560 | + SERVER="$line" |
561 | + echo "Abriendo "$SERVER |
562 | + DIR='/home/openerp/instancias/'$SERVER'/client-web' |
563 | + cd $DIR |
564 | + if [ -f $DIRCONFIG/$SERVER'-web.cfg' ]; then |
565 | + if [ -d $DIR ]; then |
566 | + echo iniciando con configuracion $DIRCONFIG/$SERVER'-web.cfg' |
567 | + cd $DIR |
568 | + echo en $DIR |
569 | + echo instancia $SERVER |
570 | + nohup ./openerp-web.py --config=$DIRCONFIG/$SERVER'-web.cfg' $SERVER > nohup-web.out & |
571 | + else |
572 | + echo directorio $DIR no encontrado corrija el Script o verifique la ruta |
573 | + fi |
574 | + else |
575 | + echo fichero $DIRCONFIG/openerp-web.cfg no encontrado |
576 | + fi |
577 | + done < $CONFIGSERVERS/servers.txt |
578 | + else |
579 | + cd $DIR |
580 | + if [ -f $DIRCONFIG/$SERVER'-web.cfg' ]; then |
581 | + if [ -d $DIR ]; then |
582 | + echo iniciando con configuracion $DIRCONFIG/$SERVER'-web.cfg' |
583 | + cd $DIR |
584 | + echo en $DIR |
585 | + echo instancia $SERVER |
586 | + nohup ./openerp-web.py --config=$DIRCONFIG/$SERVER'-web.cfg' $SERVER > nohup-web.out & |
587 | + else |
588 | + echo directorio $DIR no encontrado corrija el Script o verifique la ruta |
589 | + fi |
590 | + else |
591 | + echo fichero $DIRCONFIG/$SERVER'-web.cfg' no encontrado |
592 | + fi |
593 | + fi |
594 | +} |
595 | + |
596 | +killetiny() |
597 | +{ |
598 | + # Detiene servidor-client eTiny |
599 | + if [ "$CONTROL" = "todos" ]; then |
600 | + while read line |
601 | + do |
602 | + SERVER="$line" |
603 | + echo "Cerrando "$SERVER |
604 | + for X in `ps xa|grep openerp-web|grep python|grep "$SERVER"|awk '{print $1}'`; do |
605 | + echo "Killing "$X |
606 | + kill -9 $X |
607 | + done |
608 | + done < $CONFIGSERVERS/servers.txt |
609 | + else |
610 | + for X in `ps xa|grep openerp-web|grep python|grep "$SERVER"|awk '{print $1}'`; do |
611 | + echo "Killing "$X |
612 | + kill -9 $X |
613 | + done |
614 | + fi |
615 | +} |
616 | + |
617 | +statusetiny() { |
618 | + ps xa|grep start-openerp-web|grep python |
619 | +} |
620 | + |
621 | + |
622 | +if [ "x$OPTIONS" != "x" ]; then |
623 | + OPTIONS="-- $OPTIONS" |
624 | +fi |
625 | + |
626 | +test "$ENABLED" != "0" || exit 0 |
627 | + |
628 | +set -e |
629 | + |
630 | +case "$1" in |
631 | + start) |
632 | + echo -n "Starting $DESC: " |
633 | + startetiny |
634 | + ;; |
635 | + stop) |
636 | + echo -n "Stopping $DESC: " |
637 | + killetiny |
638 | + echo "Done." |
639 | + ;; |
640 | + force-reload|restart) |
641 | + echo -n "Restarting $DESC: " |
642 | + killetiny |
643 | + sleep 1 |
644 | + startetiny |
645 | + ;; |
646 | + status) |
647 | + echo "Status $DESC: " |
648 | + statusetiny |
649 | + ;; |
650 | + *) |
651 | + N=/etc/init.d/$NAME |
652 | + echo "Usage: $N {start|stop|force-reload|restart|status} [params]" >&2 |
653 | + exit 1 |
654 | + ;; |
655 | +esac |
656 | + |
657 | +exit 0 |
658 | |
659 | === added file 'scripts_openerp/respaldo.sh' |
660 | --- scripts_openerp/respaldo.sh 1970-01-01 00:00:00 +0000 |
661 | +++ scripts_openerp/respaldo.sh 2012-03-21 00:56:22 +0000 |
662 | @@ -0,0 +1,30 @@ |
663 | +### BEGIN INIT INFO |
664 | +# Provides: openerp |
665 | +# Required-Start: $local_fs $remote_fs |
666 | +# Required-Stop: $local_fs $remote_fs |
667 | +# Should-Start: $syslog |
668 | +# Should-Stop: $syslog |
669 | +# Default-Start: 3 5 |
670 | +# Default-Stop: 0 1 6 |
671 | +# Short-Description: BackUP of OpenERP |
672 | +# Made by Netquatro |
673 | +### END INIT INFO |
674 | +NAME="backup" |
675 | +DESC="BackUP" |
676 | +PARAM="$1 $2 $3" |
677 | +FECHA=`date +"%H%M%S--%m%d-%y"` |
678 | +TMP_PATH="/tmp/backup$FECHA.sql" |
679 | +BKP_PATH="/home/openerp/backups/backup$FECHA.sql" |
680 | +echo "Voy a exportar $1" |
681 | +PROD_BD=$1 |
682 | +PRUEBA_BD=$2 |
683 | +pg_dump $PROD_BD > $TMP_PATH |
684 | +echo "Creado el Respaldo" |
685 | +#####CAMBIAR EL USUARIO |
686 | +createdb -O openerp -E UTF8 -T template0 respaldo$FECHA |
687 | +echo "Creada la BD" |
688 | +cp $TMP_PATH $BKP_PATH |
689 | +echo "Creado el Respaldo" |
690 | +psql -f $BKP_PATH -d respaldo$FECHA |
691 | +echo "Subida la BD" |
692 | +echo "Estoy como postgres Y TODO BIEN $FECHA" |
693 | |
694 | === modified file 'vauxoomin/main/action.py' |
695 | --- vauxoomin/main/action.py 2012-02-13 13:34:37 +0000 |
696 | +++ vauxoomin/main/action.py 2012-03-21 00:56:22 +0000 |
697 | @@ -4,18 +4,127 @@ |
698 | from bzrlib.log import Logger |
699 | import ConfigParser as CP |
700 | import server |
701 | -from distutils.dir_util import copy_tree |
702 | - |
703 | - |
704 | -def copy_instance(instance,user,relative_path): |
705 | - orig=server.get_instance_path(instance,user,relative_path) |
706 | - if os.path.isdir(orig): |
707 | - return "This instance already exists" |
708 | - dest=server.get_instance_path(instance,user,relative_path)+"_cloned" |
709 | - res=copy_tree(orig,dest) |
710 | - return "Already copied %s files \n from %s to %s" % (len(res),orig,dest) |
711 | - |
712 | +from distutils.dir_util import copy_tree, mkpath |
713 | +import commands |
714 | +import subprocess |
715 | + |
716 | + |
717 | +SCRIPT_PATH="" |
718 | + |
719 | +class logger_action(object): |
720 | + def __init__(self,action): |
721 | + self.msg=action |
722 | + def __call__(self, *args): |
723 | + """ |
724 | + TODO: Create Logger write action. |
725 | + """ |
726 | + return self.msg(len(args)==1 and args[0] or args) |
727 | + |
728 | + |
729 | +@logger_action |
730 | +def copy_instance(instance_info): |
731 | + ''' |
732 | + :instance_info: Dict with 'instance' string 'user' and 'relative_path' to be able to use logger |
733 | + ''' |
734 | + #TODO Make generic |
735 | + if type(instance_info) is dict: |
736 | + orig=server.get_instance_path(instance_info.get('instance'), |
737 | + instance_info.get('user'), |
738 | + instance_info.get('relative_path')) |
739 | + else: |
740 | + return {'message':"Error on type sent to copy_instance", |
741 | + 'use':'errorBox'} |
742 | + res = {} |
743 | + if not os.path.isdir(orig): |
744 | + res={'message':"This instance already exists or you are trying to use some incorrect instance already copied", |
745 | + 'use':'errorBox'} |
746 | + return res |
747 | + dest=server.get_instance_path(instance_info.get('instance'), |
748 | + instance_info.get('user'), |
749 | + instance_info.get('relative_path'))+"_cloned" |
750 | + res_=copy_tree(orig,dest,preserve_symlinks=True) |
751 | + res={'message': "Already copied %s files \n from %s to %s" % (len(res_),orig,dest), |
752 | + 'use': 'successBox' } |
753 | + return res |
754 | + |
755 | + |
756 | +@logger_action |
757 | def clone_main_db(db_name): |
758 | + #TODO Make generic and document |
759 | os.popen("pg_dump %s > db.sql" % db_name) |
760 | - return "pg_dump %s > db.sql " % db_name |
761 | + return {'use':'successBox', |
762 | + 'message':"pg_dump %s > db.sql " % db_name} |
763 | + |
764 | + |
765 | +def create_log_folder(instance): |
766 | + path_to_log="/home/%s/%s" % (instance.get('user'),instance.get('path_to_log')) |
767 | + if os.path.isdir(path_to_log): |
768 | + return False |
769 | + else: |
770 | + return mkpath(path_to_log,verbose=1) |
771 | + |
772 | +@logger_action |
773 | +def create_log(instance): |
774 | + #TODO Make generic and document |
775 | + log_folder=create_log_folder(instance) |
776 | + path_to_log="/home/%s/%s/%s_oerp.log" % (instance.get('user'),instance.get('path_to_log'),instance.get('instance')) |
777 | + if os.path.isfile(path_to_log): |
778 | + return {'use':'infoBox', |
779 | + 'message':'Log file already exists, we can not overwrite it do it manually </br> %s' % path_to_log} |
780 | + else: |
781 | + os.popen('touch %s' % path_to_log) |
782 | + return {'use':'successBox', |
783 | + 'message':'Log file create succesfully </br> %s %s' % (path_to_log, log_folder and log_folder or '')} |
784 | + return {'use':'errorBox', |
785 | + 'message':'Houston we have a problem to make this action or the rocket is not already to be launched'} |
786 | + |
787 | + |
788 | +@logger_action |
789 | +def create_config(instance): |
790 | + #TODO Make generic and DOcument |
791 | + path_to_config="/home/nhomar/config/%s_oerp.conf" % instance |
792 | + path_to_instance = server.get_instance_path(instance,'nhomar','instancias') |
793 | + server_dir=os.path.isdir(path_to_instance+'/server') and path_to_instance+'/server' or path_to_instance+'/openobject-server' |
794 | + command='cd %s/bin && python openerp-server.py --stop-after-init -s --config=%s' % (server_dir, |
795 | + path_to_config) |
796 | + if os.path.isfile(path_to_config): |
797 | + return {'use':'infoBox', |
798 | + 'message':'Log file already exists, we can not overwrite it do it manually </br> %s' % path_to_log} |
799 | + else: |
800 | + if os.path.isdir(server_dir): |
801 | + os.popen(command) |
802 | + return {'use':'successBox', |
803 | + 'message':'Log file create succesfully </br> %s' % path_to_config} |
804 | + return {'use':'errorBox', |
805 | + 'message':'Houston we have a problem to make this action or the rocket is not already to be launched, you must to have a "server" or "openobject-server" already downloaded on %s to be able to create a config file for it' % command} |
806 | + |
807 | + |
808 | +def start_server(instance): |
809 | + ''' |
810 | + :instance: Dict with this information |
811 | + path_to_instance, path_to_config, instance, name_server_folder |
812 | + ''' |
813 | + wherepython="/usr/bin/python" |
814 | + wherescript="%s/main/manageopenerp.py" % os.getcwd() |
815 | + gip=server.get_instance_path(instance.get('instance'), |
816 | + instance.get('user'), |
817 | + instance.get('relative_path')) |
818 | + gcd=server.get_configdir(instance.get('user'), |
819 | + instance.get('base_config_path')) |
820 | + subprocess.Popen([wherepython, |
821 | + wherescript, |
822 | + gip, |
823 | + gcd, |
824 | + instance.get('instance'), |
825 | + instance.get('name_server')], |
826 | + stdout=subprocess.PIPE, |
827 | + stderr=subprocess.PIPE, |
828 | + stdin=subprocess.PIPE) |
829 | + return [{'use':'infoBox','message':"I ran: %s" % " ".join([wherepython, |
830 | + wherescript, |
831 | + gip, |
832 | + gcd, |
833 | + instance.get('instance'), |
834 | + instance.get('name_server')])}, |
835 | + server.get_status(instance.get('instance'))] |
836 | |
837 | |
838 | === added file 'vauxoomin/main/list_db.py' |
839 | --- vauxoomin/main/list_db.py 1970-01-01 00:00:00 +0000 |
840 | +++ vauxoomin/main/list_db.py 2012-03-21 00:56:22 +0000 |
841 | @@ -0,0 +1,72 @@ |
842 | +#import gtk |
843 | +import xmlrpclib |
844 | +#import logging |
845 | +import socket |
846 | +import cPickle |
847 | +import os |
848 | +import re |
849 | +import sys |
850 | +import socket |
851 | +#import ConfigParser |
852 | +#import optparse |
853 | + |
854 | +#socket://localhost:8070' |
855 | +DNS_CACHE = {} |
856 | + |
857 | + |
858 | +class list_db(object): |
859 | + def __init__(self): |
860 | + self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
861 | + super(list_db,self).__init__() |
862 | + def conect_to_port(self,url, resource='db', method='list', *args): |
863 | + m = re.match('^(http[s]?://|socket://)([\w.\-]+):(\d{1,5})$', url or '') |
864 | + if m.group(1) == 'http://' or m.group(1) == 'https://': |
865 | + self.sock = xmlrpclib.ServerProxy(url + '/xmlrpc/' + resource) |
866 | + return getattr(self.sock, method)(*args) |
867 | + else: |
868 | + self.connect(m.group(2), int(m.group(3))) |
869 | + self.mysend((resource, method)+args) |
870 | + res = self.send_db() |
871 | + return res |
872 | + |
873 | + def connect(self, host, port=False): |
874 | + if not port: |
875 | + protocol, buf = host.split('//') |
876 | + host, port = buf.split(':') |
877 | + if host in DNS_CACHE: |
878 | + host = DNS_CACHE[host] |
879 | + self.sock.connect((host, int(port))) |
880 | + DNS_CACHE[host], port = self.sock.getpeername() |
881 | + |
882 | + def mysend(self, msg, exception=False, traceback=None): |
883 | + msg = cPickle.dumps([msg,traceback]) |
884 | + self.sock.sendall('%8d%s%s' % (len(msg), exception and "1" or "0", msg)) |
885 | + |
886 | + def send_db(self): |
887 | + def read(socket, size): |
888 | + buf='' |
889 | + while len(buf) < size: |
890 | + chunk = self.sock.recv(size - len(buf)) |
891 | + if chunk == '': |
892 | + raise RuntimeError, "socket connection broken" |
893 | + buf += chunk |
894 | + return buf |
895 | + |
896 | + size = int(read(self.sock, 8)) |
897 | + buf = read(self.sock, 1) |
898 | + exception = buf != '0' and buf or False |
899 | + res = cPickle.loads(read(self.sock, size)) |
900 | + if isinstance(res[0],Exception): |
901 | + if exception: |
902 | + raise Myexception(str(res[0]), str(res[1])) |
903 | + raise res[0] |
904 | + else: |
905 | + return res[0] |
906 | + |
907 | + |
908 | +if __name__=='__main__': |
909 | + url = 'socket://localhost:8070' |
910 | + resource = 'db' |
911 | + method = 'list' |
912 | + l=list_db() |
913 | + print l.conect_to_port(url) |
914 | |
915 | === added file 'vauxoomin/main/manageopenerp.py' |
916 | --- vauxoomin/main/manageopenerp.py 1970-01-01 00:00:00 +0000 |
917 | +++ vauxoomin/main/manageopenerp.py 2012-03-21 00:56:22 +0000 |
918 | @@ -0,0 +1,33 @@ |
919 | +import subprocess |
920 | +import sys |
921 | +import time |
922 | +import os |
923 | + |
924 | + |
925 | +def start_server(path_to_instance, path_to_config, instance, name_server_folder): |
926 | + ''' |
927 | + :path_to_instance: |
928 | + :path_to_config: |
929 | + :instance: |
930 | + :name_server_folder: |
931 | + ''' |
932 | + outputshell=subprocess.Popen(["%s/%s/bin/openerp-server.py" % (path_to_instance, name_server_folder), |
933 | + "--config", |
934 | + "%s/%s_oerp.conf" % (path_to_config, instance)], |
935 | + stdout=subprocess.PIPE, |
936 | + stderr=subprocess.PIPE, |
937 | + stdin=subprocess.PIPE) |
938 | + |
939 | +if len(sys.argv)!=5: |
940 | + print "Usage: path_to_instance path_to_config instance name_server_folder Son 4" |
941 | + sys.exit(0) |
942 | +if os.fork()==0: |
943 | + os.setsid() |
944 | + sys.stdout=open("/dev/null", 'w') |
945 | + sys.stdin=open("/dev/null", 'r') |
946 | + if os.fork()==0: |
947 | + start_server(sys.argv[1], |
948 | + sys.argv[2], |
949 | + sys.argv[3], |
950 | + sys.argv[4]) |
951 | + sys.exit(0) |
952 | |
953 | === added file 'vauxoomin/main/markdown.py' |
954 | --- vauxoomin/main/markdown.py 1970-01-01 00:00:00 +0000 |
955 | +++ vauxoomin/main/markdown.py 2012-03-21 00:56:22 +0000 |
956 | @@ -0,0 +1,1877 @@ |
957 | +#!/usr/bin/env python |
958 | +# Copyright (c) 2007-2008 ActiveState Corp. |
959 | +# License: MIT (http://www.opensource.org/licenses/mit-license.php) |
960 | + |
961 | +r"""A fast and complete Python implementation of Markdown. |
962 | + |
963 | +[from http://daringfireball.net/projects/markdown/] |
964 | +> Markdown is a text-to-HTML filter; it translates an easy-to-read / |
965 | +> easy-to-write structured text format into HTML. Markdown's text |
966 | +> format is most similar to that of plain text email, and supports |
967 | +> features such as headers, *emphasis*, code blocks, blockquotes, and |
968 | +> links. |
969 | +> |
970 | +> Markdown's syntax is designed not as a generic markup language, but |
971 | +> specifically to serve as a front-end to (X)HTML. You can use span-level |
972 | +> HTML tags anywhere in a Markdown document, and you can use block level |
973 | +> HTML tags (like <div> and <table> as well). |
974 | + |
975 | +Module usage: |
976 | + |
977 | + >>> import markdown2 |
978 | + >>> markdown2.markdown("*boo!*") # or use `html = markdown_path(PATH)` |
979 | + u'<p><em>boo!</em></p>\n' |
980 | + |
981 | + >>> markdowner = Markdown() |
982 | + >>> markdowner.convert("*boo!*") |
983 | + u'<p><em>boo!</em></p>\n' |
984 | + >>> markdowner.convert("**boom!**") |
985 | + u'<p><strong>boom!</strong></p>\n' |
986 | + |
987 | +This implementation of Markdown implements the full "core" syntax plus a |
988 | +number of extras (e.g., code syntax coloring, footnotes) as described on |
989 | +<http://code.google.com/p/python-markdown2/wiki/Extras>. |
990 | +""" |
991 | + |
992 | +cmdln_desc = """A fast and complete Python implementation of Markdown, a |
993 | +text-to-HTML conversion tool for web writers. |
994 | +""" |
995 | + |
996 | +# Dev Notes: |
997 | +# - There is already a Python markdown processor |
998 | +# (http://www.freewisdom.org/projects/python-markdown/). |
999 | +# - Python's regex syntax doesn't have '\z', so I'm using '\Z'. I'm |
1000 | +# not yet sure if there implications with this. Compare 'pydoc sre' |
1001 | +# and 'perldoc perlre'. |
1002 | + |
1003 | +__version_info__ = (1, 0, 1, 14) # first three nums match Markdown.pl |
1004 | +__version__ = '1.0.1.14' |
1005 | +__author__ = "Trent Mick" |
1006 | + |
1007 | +import os |
1008 | +import sys |
1009 | +from pprint import pprint |
1010 | +import re |
1011 | +import logging |
1012 | +try: |
1013 | + from hashlib import md5 |
1014 | +except ImportError: |
1015 | + from md5 import md5 |
1016 | +import optparse |
1017 | +from random import random |
1018 | +import codecs |
1019 | + |
1020 | + |
1021 | + |
1022 | +#---- Python version compat |
1023 | + |
1024 | +if sys.version_info[:2] < (2,4): |
1025 | + from sets import Set as set |
1026 | + def reversed(sequence): |
1027 | + for i in sequence[::-1]: |
1028 | + yield i |
1029 | + def _unicode_decode(s, encoding, errors='xmlcharrefreplace'): |
1030 | + return unicode(s, encoding, errors) |
1031 | +else: |
1032 | + def _unicode_decode(s, encoding, errors='strict'): |
1033 | + return s.decode(encoding, errors) |
1034 | + |
1035 | + |
1036 | +#---- globals |
1037 | + |
1038 | +DEBUG = False |
1039 | +log = logging.getLogger("markdown") |
1040 | + |
1041 | +DEFAULT_TAB_WIDTH = 4 |
1042 | + |
1043 | +# Table of hash values for escaped characters: |
1044 | +def _escape_hash(s): |
1045 | + # Lame attempt to avoid possible collision with someone actually |
1046 | + # using the MD5 hexdigest of one of these chars in there text. |
1047 | + # Other ideas: random.random(), uuid.uuid() |
1048 | + #return md5(s).hexdigest() # Markdown.pl effectively does this. |
1049 | + return 'md5-'+md5(s).hexdigest() |
1050 | +g_escape_table = dict([(ch, _escape_hash(ch)) |
1051 | + for ch in '\\`*_{}[]()>#+-.!']) |
1052 | + |
1053 | + |
1054 | + |
1055 | +#---- exceptions |
1056 | + |
1057 | +class MarkdownError(Exception): |
1058 | + pass |
1059 | + |
1060 | + |
1061 | + |
1062 | +#---- public api |
1063 | + |
1064 | +def markdown_path(path, encoding="utf-8", |
1065 | + html4tags=False, tab_width=DEFAULT_TAB_WIDTH, |
1066 | + safe_mode=None, extras=None, link_patterns=None, |
1067 | + use_file_vars=False): |
1068 | + text = codecs.open(path, 'r', encoding).read() |
1069 | + return Markdown(html4tags=html4tags, tab_width=tab_width, |
1070 | + safe_mode=safe_mode, extras=extras, |
1071 | + link_patterns=link_patterns, |
1072 | + use_file_vars=use_file_vars).convert(text) |
1073 | + |
1074 | +def markdown(text, html4tags=False, tab_width=DEFAULT_TAB_WIDTH, |
1075 | + safe_mode=None, extras=None, link_patterns=None, |
1076 | + use_file_vars=False): |
1077 | + return Markdown(html4tags=html4tags, tab_width=tab_width, |
1078 | + safe_mode=safe_mode, extras=extras, |
1079 | + link_patterns=link_patterns, |
1080 | + use_file_vars=use_file_vars).convert(text) |
1081 | + |
1082 | +class Markdown(object): |
1083 | + # The dict of "extras" to enable in processing -- a mapping of |
1084 | + # extra name to argument for the extra. Most extras do not have an |
1085 | + # argument, in which case the value is None. |
1086 | + # |
1087 | + # This can be set via (a) subclassing and (b) the constructor |
1088 | + # "extras" argument. |
1089 | + extras = None |
1090 | + |
1091 | + urls = None |
1092 | + titles = None |
1093 | + html_blocks = None |
1094 | + html_spans = None |
1095 | + html_removed_text = "[HTML_REMOVED]" # for compat with markdown.py |
1096 | + |
1097 | + # Used to track when we're inside an ordered or unordered list |
1098 | + # (see _ProcessListItems() for details): |
1099 | + list_level = 0 |
1100 | + |
1101 | + _ws_only_line_re = re.compile(r"^[ \t]+$", re.M) |
1102 | + |
1103 | + def __init__(self, html4tags=False, tab_width=4, safe_mode=None, |
1104 | + extras=None, link_patterns=None, use_file_vars=False): |
1105 | + if html4tags: |
1106 | + self.empty_element_suffix = ">" |
1107 | + else: |
1108 | + self.empty_element_suffix = " />" |
1109 | + self.tab_width = tab_width |
1110 | + |
1111 | + # For compatibility with earlier markdown2.py and with |
1112 | + # markdown.py's safe_mode being a boolean, |
1113 | + # safe_mode == True -> "replace" |
1114 | + if safe_mode is True: |
1115 | + self.safe_mode = "replace" |
1116 | + else: |
1117 | + self.safe_mode = safe_mode |
1118 | + |
1119 | + if self.extras is None: |
1120 | + self.extras = {} |
1121 | + elif not isinstance(self.extras, dict): |
1122 | + self.extras = dict([(e, None) for e in self.extras]) |
1123 | + if extras: |
1124 | + if not isinstance(extras, dict): |
1125 | + extras = dict([(e, None) for e in extras]) |
1126 | + self.extras.update(extras) |
1127 | + assert isinstance(self.extras, dict) |
1128 | + self._instance_extras = self.extras.copy() |
1129 | + self.link_patterns = link_patterns |
1130 | + self.use_file_vars = use_file_vars |
1131 | + self._outdent_re = re.compile(r'^(\t|[ ]{1,%d})' % tab_width, re.M) |
1132 | + |
1133 | + def reset(self): |
1134 | + self.urls = {} |
1135 | + self.titles = {} |
1136 | + self.html_blocks = {} |
1137 | + self.html_spans = {} |
1138 | + self.list_level = 0 |
1139 | + self.extras = self._instance_extras.copy() |
1140 | + if "footnotes" in self.extras: |
1141 | + self.footnotes = {} |
1142 | + self.footnote_ids = [] |
1143 | + |
1144 | + def convert(self, text): |
1145 | + """Convert the given text.""" |
1146 | + # Main function. The order in which other subs are called here is |
1147 | + # essential. Link and image substitutions need to happen before |
1148 | + # _EscapeSpecialChars(), so that any *'s or _'s in the <a> |
1149 | + # and <img> tags get encoded. |
1150 | + |
1151 | + # Clear the global hashes. If we don't clear these, you get conflicts |
1152 | + # from other articles when generating a page which contains more than |
1153 | + # one article (e.g. an index page that shows the N most recent |
1154 | + # articles): |
1155 | + self.reset() |
1156 | + |
1157 | + if not isinstance(text, unicode): |
1158 | + #TODO: perhaps shouldn't presume UTF-8 for string input? |
1159 | + text = unicode(text, 'utf-8') |
1160 | + |
1161 | + if self.use_file_vars: |
1162 | + # Look for emacs-style file variable hints. |
1163 | + emacs_vars = self._get_emacs_vars(text) |
1164 | + if "markdown-extras" in emacs_vars: |
1165 | + splitter = re.compile("[ ,]+") |
1166 | + for e in splitter.split(emacs_vars["markdown-extras"]): |
1167 | + if '=' in e: |
1168 | + ename, earg = e.split('=', 1) |
1169 | + try: |
1170 | + earg = int(earg) |
1171 | + except ValueError: |
1172 | + pass |
1173 | + else: |
1174 | + ename, earg = e, None |
1175 | + self.extras[ename] = earg |
1176 | + |
1177 | + # Standardize line endings: |
1178 | + text = re.sub("\r\n|\r", "\n", text) |
1179 | + |
1180 | + # Make sure $text ends with a couple of newlines: |
1181 | + text += "\n\n" |
1182 | + |
1183 | + # Convert all tabs to spaces. |
1184 | + text = self._detab(text) |
1185 | + |
1186 | + # Strip any lines consisting only of spaces and tabs. |
1187 | + # This makes subsequent regexen easier to write, because we can |
1188 | + # match consecutive blank lines with /\n+/ instead of something |
1189 | + # contorted like /[ \t]*\n+/ . |
1190 | + text = self._ws_only_line_re.sub("", text) |
1191 | + |
1192 | + if self.safe_mode: |
1193 | + text = self._hash_html_spans(text) |
1194 | + |
1195 | + # Turn block-level HTML blocks into hash entries |
1196 | + text = self._hash_html_blocks(text, raw=True) |
1197 | + |
1198 | + # Strip link definitions, store in hashes. |
1199 | + if "footnotes" in self.extras: |
1200 | + # Must do footnotes first because an unlucky footnote defn |
1201 | + # looks like a link defn: |
1202 | + # [^4]: this "looks like a link defn" |
1203 | + text = self._strip_footnote_definitions(text) |
1204 | + text = self._strip_link_definitions(text) |
1205 | + |
1206 | + text = self._run_block_gamut(text) |
1207 | + |
1208 | + if "footnotes" in self.extras: |
1209 | + text = self._add_footnotes(text) |
1210 | + |
1211 | + text = self._unescape_special_chars(text) |
1212 | + |
1213 | + if self.safe_mode: |
1214 | + text = self._unhash_html_spans(text) |
1215 | + |
1216 | + text += "\n" |
1217 | + return text |
1218 | + |
1219 | + _emacs_oneliner_vars_pat = re.compile(r"-\*-\s*([^\r\n]*?)\s*-\*-", re.UNICODE) |
1220 | + # This regular expression is intended to match blocks like this: |
1221 | + # PREFIX Local Variables: SUFFIX |
1222 | + # PREFIX mode: Tcl SUFFIX |
1223 | + # PREFIX End: SUFFIX |
1224 | + # Some notes: |
1225 | + # - "[ \t]" is used instead of "\s" to specifically exclude newlines |
1226 | + # - "(\r\n|\n|\r)" is used instead of "$" because the sre engine does |
1227 | + # not like anything other than Unix-style line terminators. |
1228 | + _emacs_local_vars_pat = re.compile(r"""^ |
1229 | + (?P<prefix>(?:[^\r\n|\n|\r])*?) |
1230 | + [\ \t]*Local\ Variables:[\ \t]* |
1231 | + (?P<suffix>.*?)(?:\r\n|\n|\r) |
1232 | + (?P<content>.*?\1End:) |
1233 | + """, re.IGNORECASE | re.MULTILINE | re.DOTALL | re.VERBOSE) |
1234 | + |
1235 | + def _get_emacs_vars(self, text): |
1236 | + """Return a dictionary of emacs-style local variables. |
1237 | + |
1238 | + Parsing is done loosely according to this spec (and according to |
1239 | + some in-practice deviations from this): |
1240 | + http://www.gnu.org/software/emacs/manual/html_node/emacs/Specifying-File-Variables.html#Specifying-File-Variables |
1241 | + """ |
1242 | + emacs_vars = {} |
1243 | + SIZE = pow(2, 13) # 8kB |
1244 | + |
1245 | + # Search near the start for a '-*-'-style one-liner of variables. |
1246 | + head = text[:SIZE] |
1247 | + if "-*-" in head: |
1248 | + match = self._emacs_oneliner_vars_pat.search(head) |
1249 | + if match: |
1250 | + emacs_vars_str = match.group(1) |
1251 | + assert '\n' not in emacs_vars_str |
1252 | + emacs_var_strs = [s.strip() for s in emacs_vars_str.split(';') |
1253 | + if s.strip()] |
1254 | + if len(emacs_var_strs) == 1 and ':' not in emacs_var_strs[0]: |
1255 | + # While not in the spec, this form is allowed by emacs: |
1256 | + # -*- Tcl -*- |
1257 | + # where the implied "variable" is "mode". This form |
1258 | + # is only allowed if there are no other variables. |
1259 | + emacs_vars["mode"] = emacs_var_strs[0].strip() |
1260 | + else: |
1261 | + for emacs_var_str in emacs_var_strs: |
1262 | + try: |
1263 | + variable, value = emacs_var_str.strip().split(':', 1) |
1264 | + except ValueError: |
1265 | + log.debug("emacs variables error: malformed -*- " |
1266 | + "line: %r", emacs_var_str) |
1267 | + continue |
1268 | + # Lowercase the variable name because Emacs allows "Mode" |
1269 | + # or "mode" or "MoDe", etc. |
1270 | + emacs_vars[variable.lower()] = value.strip() |
1271 | + |
1272 | + tail = text[-SIZE:] |
1273 | + if "Local Variables" in tail: |
1274 | + match = self._emacs_local_vars_pat.search(tail) |
1275 | + if match: |
1276 | + prefix = match.group("prefix") |
1277 | + suffix = match.group("suffix") |
1278 | + lines = match.group("content").splitlines(0) |
1279 | + #print "prefix=%r, suffix=%r, content=%r, lines: %s"\ |
1280 | + # % (prefix, suffix, match.group("content"), lines) |
1281 | + |
1282 | + # Validate the Local Variables block: proper prefix and suffix |
1283 | + # usage. |
1284 | + for i, line in enumerate(lines): |
1285 | + if not line.startswith(prefix): |
1286 | + log.debug("emacs variables error: line '%s' " |
1287 | + "does not use proper prefix '%s'" |
1288 | + % (line, prefix)) |
1289 | + return {} |
1290 | + # Don't validate suffix on last line. Emacs doesn't care, |
1291 | + # neither should we. |
1292 | + if i != len(lines)-1 and not line.endswith(suffix): |
1293 | + log.debug("emacs variables error: line '%s' " |
1294 | + "does not use proper suffix '%s'" |
1295 | + % (line, suffix)) |
1296 | + return {} |
1297 | + |
1298 | + # Parse out one emacs var per line. |
1299 | + continued_for = None |
1300 | + for line in lines[:-1]: # no var on the last line ("PREFIX End:") |
1301 | + if prefix: line = line[len(prefix):] # strip prefix |
1302 | + if suffix: line = line[:-len(suffix)] # strip suffix |
1303 | + line = line.strip() |
1304 | + if continued_for: |
1305 | + variable = continued_for |
1306 | + if line.endswith('\\'): |
1307 | + line = line[:-1].rstrip() |
1308 | + else: |
1309 | + continued_for = None |
1310 | + emacs_vars[variable] += ' ' + line |
1311 | + else: |
1312 | + try: |
1313 | + variable, value = line.split(':', 1) |
1314 | + except ValueError: |
1315 | + log.debug("local variables error: missing colon " |
1316 | + "in local variables entry: '%s'" % line) |
1317 | + continue |
1318 | + # Do NOT lowercase the variable name, because Emacs only |
1319 | + # allows "mode" (and not "Mode", "MoDe", etc.) in this block. |
1320 | + value = value.strip() |
1321 | + if value.endswith('\\'): |
1322 | + value = value[:-1].rstrip() |
1323 | + continued_for = variable |
1324 | + else: |
1325 | + continued_for = None |
1326 | + emacs_vars[variable] = value |
1327 | + |
1328 | + # Unquote values. |
1329 | + for var, val in emacs_vars.items(): |
1330 | + if len(val) > 1 and (val.startswith('"') and val.endswith('"') |
1331 | + or val.startswith('"') and val.endswith('"')): |
1332 | + emacs_vars[var] = val[1:-1] |
1333 | + |
1334 | + return emacs_vars |
1335 | + |
1336 | + # Cribbed from a post by Bart Lateur: |
1337 | + # <http://www.nntp.perl.org/group/perl.macperl.anyperl/154> |
1338 | + _detab_re = re.compile(r'(.*?)\t', re.M) |
1339 | + def _detab_sub(self, match): |
1340 | + g1 = match.group(1) |
1341 | + return g1 + (' ' * (self.tab_width - len(g1) % self.tab_width)) |
1342 | + def _detab(self, text): |
1343 | + r"""Remove (leading?) tabs from a file. |
1344 | + |
1345 | + >>> m = Markdown() |
1346 | + >>> m._detab("\tfoo") |
1347 | + ' foo' |
1348 | + >>> m._detab(" \tfoo") |
1349 | + ' foo' |
1350 | + >>> m._detab("\t foo") |
1351 | + ' foo' |
1352 | + >>> m._detab(" foo") |
1353 | + ' foo' |
1354 | + >>> m._detab(" foo\n\tbar\tblam") |
1355 | + ' foo\n bar blam' |
1356 | + """ |
1357 | + if '\t' not in text: |
1358 | + return text |
1359 | + return self._detab_re.subn(self._detab_sub, text)[0] |
1360 | + |
1361 | + _block_tags_a = 'p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del' |
1362 | + _strict_tag_block_re = re.compile(r""" |
1363 | + ( # save in \1 |
1364 | + ^ # start of line (with re.M) |
1365 | + <(%s) # start tag = \2 |
1366 | + \b # word break |
1367 | + (.*\n)*? # any number of lines, minimally matching |
1368 | + </\2> # the matching end tag |
1369 | + [ \t]* # trailing spaces/tabs |
1370 | + (?=\n+|\Z) # followed by a newline or end of document |
1371 | + ) |
1372 | + """ % _block_tags_a, |
1373 | + re.X | re.M) |
1374 | + |
1375 | + _block_tags_b = 'p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math' |
1376 | + _liberal_tag_block_re = re.compile(r""" |
1377 | + ( # save in \1 |
1378 | + ^ # start of line (with re.M) |
1379 | + <(%s) # start tag = \2 |
1380 | + \b # word break |
1381 | + (.*\n)*? # any number of lines, minimally matching |
1382 | + .*</\2> # the matching end tag |
1383 | + [ \t]* # trailing spaces/tabs |
1384 | + (?=\n+|\Z) # followed by a newline or end of document |
1385 | + ) |
1386 | + """ % _block_tags_b, |
1387 | + re.X | re.M) |
1388 | + |
1389 | + def _hash_html_block_sub(self, match, raw=False): |
1390 | + html = match.group(1) |
1391 | + if raw and self.safe_mode: |
1392 | + html = self._sanitize_html(html) |
1393 | + key = _hash_text(html) |
1394 | + self.html_blocks[key] = html |
1395 | + return "\n\n" + key + "\n\n" |
1396 | + |
1397 | + def _hash_html_blocks(self, text, raw=False): |
1398 | + """Hashify HTML blocks |
1399 | + |
1400 | + We only want to do this for block-level HTML tags, such as headers, |
1401 | + lists, and tables. That's because we still want to wrap <p>s around |
1402 | + "paragraphs" that are wrapped in non-block-level tags, such as anchors, |
1403 | + phrase emphasis, and spans. The list of tags we're looking for is |
1404 | + hard-coded. |
1405 | + |
1406 | + @param raw {boolean} indicates if these are raw HTML blocks in |
1407 | + the original source. It makes a difference in "safe" mode. |
1408 | + """ |
1409 | + if '<' not in text: |
1410 | + return text |
1411 | + |
1412 | + # Pass `raw` value into our calls to self._hash_html_block_sub. |
1413 | + hash_html_block_sub = _curry(self._hash_html_block_sub, raw=raw) |
1414 | + |
1415 | + # First, look for nested blocks, e.g.: |
1416 | + # <div> |
1417 | + # <div> |
1418 | + # tags for inner block must be indented. |
1419 | + # </div> |
1420 | + # </div> |
1421 | + # |
1422 | + # The outermost tags must start at the left margin for this to match, and |
1423 | + # the inner nested divs must be indented. |
1424 | + # We need to do this before the next, more liberal match, because the next |
1425 | + # match will start at the first `<div>` and stop at the first `</div>`. |
1426 | + text = self._strict_tag_block_re.sub(hash_html_block_sub, text) |
1427 | + |
1428 | + # Now match more liberally, simply from `\n<tag>` to `</tag>\n` |
1429 | + text = self._liberal_tag_block_re.sub(hash_html_block_sub, text) |
1430 | + |
1431 | + # Special case just for <hr />. It was easier to make a special |
1432 | + # case than to make the other regex more complicated. |
1433 | + if "<hr" in text: |
1434 | + _hr_tag_re = _hr_tag_re_from_tab_width(self.tab_width) |
1435 | + text = _hr_tag_re.sub(hash_html_block_sub, text) |
1436 | + |
1437 | + # Special case for standalone HTML comments: |
1438 | + if "<!--" in text: |
1439 | + start = 0 |
1440 | + while True: |
1441 | + # Delimiters for next comment block. |
1442 | + try: |
1443 | + start_idx = text.index("<!--", start) |
1444 | + except ValueError, ex: |
1445 | + break |
1446 | + try: |
1447 | + end_idx = text.index("-->", start_idx) + 3 |
1448 | + except ValueError, ex: |
1449 | + break |
1450 | + |
1451 | + # Start position for next comment block search. |
1452 | + start = end_idx |
1453 | + |
1454 | + # Validate whitespace before comment. |
1455 | + if start_idx: |
1456 | + # - Up to `tab_width - 1` spaces before start_idx. |
1457 | + for i in range(self.tab_width - 1): |
1458 | + if text[start_idx - 1] != ' ': |
1459 | + break |
1460 | + start_idx -= 1 |
1461 | + if start_idx == 0: |
1462 | + break |
1463 | + # - Must be preceded by 2 newlines or hit the start of |
1464 | + # the document. |
1465 | + if start_idx == 0: |
1466 | + pass |
1467 | + elif start_idx == 1 and text[0] == '\n': |
1468 | + start_idx = 0 # to match minute detail of Markdown.pl regex |
1469 | + elif text[start_idx-2:start_idx] == '\n\n': |
1470 | + pass |
1471 | + else: |
1472 | + break |
1473 | + |
1474 | + # Validate whitespace after comment. |
1475 | + # - Any number of spaces and tabs. |
1476 | + while end_idx < len(text): |
1477 | + if text[end_idx] not in ' \t': |
1478 | + break |
1479 | + end_idx += 1 |
1480 | + # - Must be following by 2 newlines or hit end of text. |
1481 | + if text[end_idx:end_idx+2] not in ('', '\n', '\n\n'): |
1482 | + continue |
1483 | + |
1484 | + # Escape and hash (must match `_hash_html_block_sub`). |
1485 | + html = text[start_idx:end_idx] |
1486 | + if raw and self.safe_mode: |
1487 | + html = self._sanitize_html(html) |
1488 | + key = _hash_text(html) |
1489 | + self.html_blocks[key] = html |
1490 | + text = text[:start_idx] + "\n\n" + key + "\n\n" + text[end_idx:] |
1491 | + |
1492 | + if "xml" in self.extras: |
1493 | + # Treat XML processing instructions and namespaced one-liner |
1494 | + # tags as if they were block HTML tags. E.g., if standalone |
1495 | + # (i.e. are their own paragraph), the following do not get |
1496 | + # wrapped in a <p> tag: |
1497 | + # <?foo bar?> |
1498 | + # |
1499 | + # <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chapter_1.md"/> |
1500 | + _xml_oneliner_re = _xml_oneliner_re_from_tab_width(self.tab_width) |
1501 | + text = _xml_oneliner_re.sub(hash_html_block_sub, text) |
1502 | + |
1503 | + return text |
1504 | + |
1505 | + def _strip_link_definitions(self, text): |
1506 | + # Strips link definitions from text, stores the URLs and titles in |
1507 | + # hash references. |
1508 | + less_than_tab = self.tab_width - 1 |
1509 | + |
1510 | + # Link defs are in the form: |
1511 | + # [id]: url "optional title" |
1512 | + _link_def_re = re.compile(r""" |
1513 | + ^[ ]{0,%d}\[(.+)\]: # id = \1 |
1514 | + [ \t]* |
1515 | + \n? # maybe *one* newline |
1516 | + [ \t]* |
1517 | + <?(.+?)>? # url = \2 |
1518 | + [ \t]* |
1519 | + (?: |
1520 | + \n? # maybe one newline |
1521 | + [ \t]* |
1522 | + (?<=\s) # lookbehind for whitespace |
1523 | + ['"(] |
1524 | + ([^\n]*) # title = \3 |
1525 | + ['")] |
1526 | + [ \t]* |
1527 | + )? # title is optional |
1528 | + (?:\n+|\Z) |
1529 | + """ % less_than_tab, re.X | re.M | re.U) |
1530 | + return _link_def_re.sub(self._extract_link_def_sub, text) |
1531 | + |
1532 | + def _extract_link_def_sub(self, match): |
1533 | + id, url, title = match.groups() |
1534 | + key = id.lower() # Link IDs are case-insensitive |
1535 | + self.urls[key] = self._encode_amps_and_angles(url) |
1536 | + if title: |
1537 | + self.titles[key] = title.replace('"', '"') |
1538 | + return "" |
1539 | + |
1540 | + def _extract_footnote_def_sub(self, match): |
1541 | + id, text = match.groups() |
1542 | + text = _dedent(text, skip_first_line=not text.startswith('\n')).strip() |
1543 | + normed_id = re.sub(r'\W', '-', id) |
1544 | + # Ensure footnote text ends with a couple newlines (for some |
1545 | + # block gamut matches). |
1546 | + self.footnotes[normed_id] = text + "\n\n" |
1547 | + return "" |
1548 | + |
1549 | + def _strip_footnote_definitions(self, text): |
1550 | + """A footnote definition looks like this: |
1551 | + |
1552 | + [^note-id]: Text of the note. |
1553 | + |
1554 | + May include one or more indented paragraphs. |
1555 | + |
1556 | + Where, |
1557 | + - The 'note-id' can be pretty much anything, though typically it |
1558 | + is the number of the footnote. |
1559 | + - The first paragraph may start on the next line, like so: |
1560 | + |
1561 | + [^note-id]: |
1562 | + Text of the note. |
1563 | + """ |
1564 | + less_than_tab = self.tab_width - 1 |
1565 | + footnote_def_re = re.compile(r''' |
1566 | + ^[ ]{0,%d}\[\^(.+)\]: # id = \1 |
1567 | + [ \t]* |
1568 | + ( # footnote text = \2 |
1569 | + # First line need not start with the spaces. |
1570 | + (?:\s*.*\n+) |
1571 | + (?: |
1572 | + (?:[ ]{%d} | \t) # Subsequent lines must be indented. |
1573 | + .*\n+ |
1574 | + )* |
1575 | + ) |
1576 | + # Lookahead for non-space at line-start, or end of doc. |
1577 | + (?:(?=^[ ]{0,%d}\S)|\Z) |
1578 | + ''' % (less_than_tab, self.tab_width, self.tab_width), |
1579 | + re.X | re.M) |
1580 | + return footnote_def_re.sub(self._extract_footnote_def_sub, text) |
1581 | + |
1582 | + |
1583 | + _hr_res = [ |
1584 | + re.compile(r"^[ ]{0,2}([ ]?\*[ ]?){3,}[ \t]*$", re.M), |
1585 | + re.compile(r"^[ ]{0,2}([ ]?\-[ ]?){3,}[ \t]*$", re.M), |
1586 | + re.compile(r"^[ ]{0,2}([ ]?\_[ ]?){3,}[ \t]*$", re.M), |
1587 | + ] |
1588 | + |
1589 | + def _run_block_gamut(self, text): |
1590 | + # These are all the transformations that form block-level |
1591 | + # tags like paragraphs, headers, and list items. |
1592 | + |
1593 | + text = self._do_headers(text) |
1594 | + |
1595 | + # Do Horizontal Rules: |
1596 | + hr = "\n<hr"+self.empty_element_suffix+"\n" |
1597 | + for hr_re in self._hr_res: |
1598 | + text = hr_re.sub(hr, text) |
1599 | + |
1600 | + text = self._do_lists(text) |
1601 | + |
1602 | + if "pyshell" in self.extras: |
1603 | + text = self._prepare_pyshell_blocks(text) |
1604 | + |
1605 | + text = self._do_code_blocks(text) |
1606 | + |
1607 | + text = self._do_block_quotes(text) |
1608 | + |
1609 | + # We already ran _HashHTMLBlocks() before, in Markdown(), but that |
1610 | + # was to escape raw HTML in the original Markdown source. This time, |
1611 | + # we're escaping the markup we've just created, so that we don't wrap |
1612 | + # <p> tags around block-level tags. |
1613 | + text = self._hash_html_blocks(text) |
1614 | + |
1615 | + text = self._form_paragraphs(text) |
1616 | + |
1617 | + return text |
1618 | + |
1619 | + def _pyshell_block_sub(self, match): |
1620 | + lines = match.group(0).splitlines(0) |
1621 | + _dedentlines(lines) |
1622 | + indent = ' ' * self.tab_width |
1623 | + s = ('\n' # separate from possible cuddled paragraph |
1624 | + + indent + ('\n'+indent).join(lines) |
1625 | + + '\n\n') |
1626 | + return s |
1627 | + |
1628 | + def _prepare_pyshell_blocks(self, text): |
1629 | + """Ensure that Python interactive shell sessions are put in |
1630 | + code blocks -- even if not properly indented. |
1631 | + """ |
1632 | + if ">>>" not in text: |
1633 | + return text |
1634 | + |
1635 | + less_than_tab = self.tab_width - 1 |
1636 | + _pyshell_block_re = re.compile(r""" |
1637 | + ^([ ]{0,%d})>>>[ ].*\n # first line |
1638 | + ^(\1.*\S+.*\n)* # any number of subsequent lines |
1639 | + ^\n # ends with a blank line |
1640 | + """ % less_than_tab, re.M | re.X) |
1641 | + |
1642 | + return _pyshell_block_re.sub(self._pyshell_block_sub, text) |
1643 | + |
1644 | + def _run_span_gamut(self, text): |
1645 | + # These are all the transformations that occur *within* block-level |
1646 | + # tags like paragraphs, headers, and list items. |
1647 | + |
1648 | + text = self._do_code_spans(text) |
1649 | + |
1650 | + text = self._escape_special_chars(text) |
1651 | + |
1652 | + # Process anchor and image tags. |
1653 | + text = self._do_links(text) |
1654 | + |
1655 | + # Make links out of things like `<http://example.com/>` |
1656 | + # Must come after _do_links(), because you can use < and > |
1657 | + # delimiters in inline links like [this](<url>). |
1658 | + text = self._do_auto_links(text) |
1659 | + |
1660 | + if "link-patterns" in self.extras: |
1661 | + text = self._do_link_patterns(text) |
1662 | + |
1663 | + text = self._encode_amps_and_angles(text) |
1664 | + |
1665 | + text = self._do_italics_and_bold(text) |
1666 | + |
1667 | + # Do hard breaks: |
1668 | + text = re.sub(r" {2,}\n", " <br%s\n" % self.empty_element_suffix, text) |
1669 | + |
1670 | + return text |
1671 | + |
1672 | + # "Sorta" because auto-links are identified as "tag" tokens. |
1673 | + _sorta_html_tokenize_re = re.compile(r""" |
1674 | + ( |
1675 | + # tag |
1676 | + </? |
1677 | + (?:\w+) # tag name |
1678 | + (?:\s+(?:[\w-]+:)?[\w-]+=(?:".*?"|'.*?'))* # attributes |
1679 | + \s*/?> |
1680 | + | |
1681 | + # auto-link (e.g., <http://www.activestate.com/>) |
1682 | + <\w+[^>]*> |
1683 | + | |
1684 | + <!--.*?--> # comment |
1685 | + | |
1686 | + <\?.*?\?> # processing instruction |
1687 | + ) |
1688 | + """, re.X) |
1689 | + |
1690 | + def _escape_special_chars(self, text): |
1691 | + # Python markdown note: the HTML tokenization here differs from |
1692 | + # that in Markdown.pl, hence the behaviour for subtle cases can |
1693 | + # differ (I believe the tokenizer here does a better job because |
1694 | + # it isn't susceptible to unmatched '<' and '>' in HTML tags). |
1695 | + # Note, however, that '>' is not allowed in an auto-link URL |
1696 | + # here. |
1697 | + escaped = [] |
1698 | + is_html_markup = False |
1699 | + for token in self._sorta_html_tokenize_re.split(text): |
1700 | + if is_html_markup: |
1701 | + # Within tags/HTML-comments/auto-links, encode * and _ |
1702 | + # so they don't conflict with their use in Markdown for |
1703 | + # italics and strong. We're replacing each such |
1704 | + # character with its corresponding MD5 checksum value; |
1705 | + # this is likely overkill, but it should prevent us from |
1706 | + # colliding with the escape values by accident. |
1707 | + escaped.append(token.replace('*', g_escape_table['*']) |
1708 | + .replace('_', g_escape_table['_'])) |
1709 | + else: |
1710 | + escaped.append(self._encode_backslash_escapes(token)) |
1711 | + is_html_markup = not is_html_markup |
1712 | + return ''.join(escaped) |
1713 | + |
1714 | + def _hash_html_spans(self, text): |
1715 | + # Used for safe_mode. |
1716 | + |
1717 | + def _is_auto_link(s): |
1718 | + if ':' in s and self._auto_link_re.match(s): |
1719 | + return True |
1720 | + elif '@' in s and self._auto_email_link_re.match(s): |
1721 | + return True |
1722 | + return False |
1723 | + |
1724 | + tokens = [] |
1725 | + is_html_markup = False |
1726 | + for token in self._sorta_html_tokenize_re.split(text): |
1727 | + if is_html_markup and not _is_auto_link(token): |
1728 | + sanitized = self._sanitize_html(token) |
1729 | + key = _hash_text(sanitized) |
1730 | + self.html_spans[key] = sanitized |
1731 | + tokens.append(key) |
1732 | + else: |
1733 | + tokens.append(token) |
1734 | + is_html_markup = not is_html_markup |
1735 | + return ''.join(tokens) |
1736 | + |
1737 | + def _unhash_html_spans(self, text): |
1738 | + for key, sanitized in self.html_spans.items(): |
1739 | + text = text.replace(key, sanitized) |
1740 | + return text |
1741 | + |
1742 | + def _sanitize_html(self, s): |
1743 | + if self.safe_mode == "replace": |
1744 | + return self.html_removed_text |
1745 | + elif self.safe_mode == "escape": |
1746 | + replacements = [ |
1747 | + ('&', '&'), |
1748 | + ('<', '<'), |
1749 | + ('>', '>'), |
1750 | + ] |
1751 | + for before, after in replacements: |
1752 | + s = s.replace(before, after) |
1753 | + return s |
1754 | + else: |
1755 | + raise MarkdownError("invalid value for 'safe_mode': %r (must be " |
1756 | + "'escape' or 'replace')" % self.safe_mode) |
1757 | + |
1758 | + _tail_of_inline_link_re = re.compile(r''' |
1759 | + # Match tail of: [text](/url/) or [text](/url/ "title") |
1760 | + \( # literal paren |
1761 | + [ \t]* |
1762 | + (?P<url> # \1 |
1763 | + <.*?> |
1764 | + | |
1765 | + .*? |
1766 | + ) |
1767 | + [ \t]* |
1768 | + ( # \2 |
1769 | + (['"]) # quote char = \3 |
1770 | + (?P<title>.*?) |
1771 | + \3 # matching quote |
1772 | + )? # title is optional |
1773 | + \) |
1774 | + ''', re.X | re.S) |
1775 | + _tail_of_reference_link_re = re.compile(r''' |
1776 | + # Match tail of: [text][id] |
1777 | + [ ]? # one optional space |
1778 | + (?:\n[ ]*)? # one optional newline followed by spaces |
1779 | + \[ |
1780 | + (?P<id>.*?) |
1781 | + \] |
1782 | + ''', re.X | re.S) |
1783 | + |
1784 | + def _do_links(self, text): |
1785 | + """Turn Markdown link shortcuts into XHTML <a> and <img> tags. |
1786 | + |
1787 | + This is a combination of Markdown.pl's _DoAnchors() and |
1788 | + _DoImages(). They are done together because that simplified the |
1789 | + approach. It was necessary to use a different approach than |
1790 | + Markdown.pl because of the lack of atomic matching support in |
1791 | + Python's regex engine used in $g_nested_brackets. |
1792 | + """ |
1793 | + MAX_LINK_TEXT_SENTINEL = 3000 # markdown2 issue 24 |
1794 | + |
1795 | + # `anchor_allowed_pos` is used to support img links inside |
1796 | + # anchors, but not anchors inside anchors. An anchor's start |
1797 | + # pos must be `>= anchor_allowed_pos`. |
1798 | + anchor_allowed_pos = 0 |
1799 | + |
1800 | + curr_pos = 0 |
1801 | + while True: # Handle the next link. |
1802 | + # The next '[' is the start of: |
1803 | + # - an inline anchor: [text](url "title") |
1804 | + # - a reference anchor: [text][id] |
1805 | + # - an inline img: ![text](url "title") |
1806 | + # - a reference img: ![text][id] |
1807 | + # - a footnote ref: [^id] |
1808 | + # (Only if 'footnotes' extra enabled) |
1809 | + # - a footnote defn: [^id]: ... |
1810 | + # (Only if 'footnotes' extra enabled) These have already |
1811 | + # been stripped in _strip_footnote_definitions() so no |
1812 | + # need to watch for them. |
1813 | + # - a link definition: [id]: url "title" |
1814 | + # These have already been stripped in |
1815 | + # _strip_link_definitions() so no need to watch for them. |
1816 | + # - not markup: [...anything else... |
1817 | + try: |
1818 | + start_idx = text.index('[', curr_pos) |
1819 | + except ValueError: |
1820 | + break |
1821 | + text_length = len(text) |
1822 | + |
1823 | + # Find the matching closing ']'. |
1824 | + # Markdown.pl allows *matching* brackets in link text so we |
1825 | + # will here too. Markdown.pl *doesn't* currently allow |
1826 | + # matching brackets in img alt text -- we'll differ in that |
1827 | + # regard. |
1828 | + bracket_depth = 0 |
1829 | + for p in range(start_idx+1, min(start_idx+MAX_LINK_TEXT_SENTINEL, |
1830 | + text_length)): |
1831 | + ch = text[p] |
1832 | + if ch == ']': |
1833 | + bracket_depth -= 1 |
1834 | + if bracket_depth < 0: |
1835 | + break |
1836 | + elif ch == '[': |
1837 | + bracket_depth += 1 |
1838 | + else: |
1839 | + # Closing bracket not found within sentinel length. |
1840 | + # This isn't markup. |
1841 | + curr_pos = start_idx + 1 |
1842 | + continue |
1843 | + link_text = text[start_idx+1:p] |
1844 | + |
1845 | + # Possibly a footnote ref? |
1846 | + if "footnotes" in self.extras and link_text.startswith("^"): |
1847 | + normed_id = re.sub(r'\W', '-', link_text[1:]) |
1848 | + if normed_id in self.footnotes: |
1849 | + self.footnote_ids.append(normed_id) |
1850 | + result = '<sup class="footnote-ref" id="fnref-%s">' \ |
1851 | + '<a href="#fn-%s">%s</a></sup>' \ |
1852 | + % (normed_id, normed_id, len(self.footnote_ids)) |
1853 | + text = text[:start_idx] + result + text[p+1:] |
1854 | + else: |
1855 | + # This id isn't defined, leave the markup alone. |
1856 | + curr_pos = p+1 |
1857 | + continue |
1858 | + |
1859 | + # Now determine what this is by the remainder. |
1860 | + p += 1 |
1861 | + if p == text_length: |
1862 | + return text |
1863 | + |
1864 | + # Inline anchor or img? |
1865 | + if text[p] == '(': # attempt at perf improvement |
1866 | + match = self._tail_of_inline_link_re.match(text, p) |
1867 | + if match: |
1868 | + # Handle an inline anchor or img. |
1869 | + is_img = start_idx > 0 and text[start_idx-1] == "!" |
1870 | + if is_img: |
1871 | + start_idx -= 1 |
1872 | + |
1873 | + url, title = match.group("url"), match.group("title") |
1874 | + if url and url[0] == '<': |
1875 | + url = url[1:-1] # '<url>' -> 'url' |
1876 | + # We've got to encode these to avoid conflicting |
1877 | + # with italics/bold. |
1878 | + url = url.replace('*', g_escape_table['*']) \ |
1879 | + .replace('_', g_escape_table['_']) |
1880 | + if title: |
1881 | + title_str = ' title="%s"' \ |
1882 | + % title.replace('*', g_escape_table['*']) \ |
1883 | + .replace('_', g_escape_table['_']) \ |
1884 | + .replace('"', '"') |
1885 | + else: |
1886 | + title_str = '' |
1887 | + if is_img: |
1888 | + result = '<img src="%s" alt="%s"%s%s' \ |
1889 | + % (url, link_text.replace('"', '"'), |
1890 | + title_str, self.empty_element_suffix) |
1891 | + curr_pos = start_idx + len(result) |
1892 | + text = text[:start_idx] + result + text[match.end():] |
1893 | + elif start_idx >= anchor_allowed_pos: |
1894 | + result_head = '<a href="%s"%s>' % (url, title_str) |
1895 | + result = '%s%s</a>' % (result_head, link_text) |
1896 | + # <img> allowed from curr_pos on, <a> from |
1897 | + # anchor_allowed_pos on. |
1898 | + curr_pos = start_idx + len(result_head) |
1899 | + anchor_allowed_pos = start_idx + len(result) |
1900 | + text = text[:start_idx] + result + text[match.end():] |
1901 | + else: |
1902 | + # Anchor not allowed here. |
1903 | + curr_pos = start_idx + 1 |
1904 | + continue |
1905 | + |
1906 | + # Reference anchor or img? |
1907 | + else: |
1908 | + match = self._tail_of_reference_link_re.match(text, p) |
1909 | + if match: |
1910 | + # Handle a reference-style anchor or img. |
1911 | + is_img = start_idx > 0 and text[start_idx-1] == "!" |
1912 | + if is_img: |
1913 | + start_idx -= 1 |
1914 | + link_id = match.group("id").lower() |
1915 | + if not link_id: |
1916 | + link_id = link_text.lower() # for links like [this][] |
1917 | + if link_id in self.urls: |
1918 | + url = self.urls[link_id] |
1919 | + # We've got to encode these to avoid conflicting |
1920 | + # with italics/bold. |
1921 | + url = url.replace('*', g_escape_table['*']) \ |
1922 | + .replace('_', g_escape_table['_']) |
1923 | + title = self.titles.get(link_id) |
1924 | + if title: |
1925 | + title = title.replace('*', g_escape_table['*']) \ |
1926 | + .replace('_', g_escape_table['_']) |
1927 | + title_str = ' title="%s"' % title |
1928 | + else: |
1929 | + title_str = '' |
1930 | + if is_img: |
1931 | + result = '<img src="%s" alt="%s"%s%s' \ |
1932 | + % (url, link_text.replace('"', '"'), |
1933 | + title_str, self.empty_element_suffix) |
1934 | + curr_pos = start_idx + len(result) |
1935 | + text = text[:start_idx] + result + text[match.end():] |
1936 | + elif start_idx >= anchor_allowed_pos: |
1937 | + result = '<a href="%s"%s>%s</a>' \ |
1938 | + % (url, title_str, link_text) |
1939 | + result_head = '<a href="%s"%s>' % (url, title_str) |
1940 | + result = '%s%s</a>' % (result_head, link_text) |
1941 | + # <img> allowed from curr_pos on, <a> from |
1942 | + # anchor_allowed_pos on. |
1943 | + curr_pos = start_idx + len(result_head) |
1944 | + anchor_allowed_pos = start_idx + len(result) |
1945 | + text = text[:start_idx] + result + text[match.end():] |
1946 | + else: |
1947 | + # Anchor not allowed here. |
1948 | + curr_pos = start_idx + 1 |
1949 | + else: |
1950 | + # This id isn't defined, leave the markup alone. |
1951 | + curr_pos = match.end() |
1952 | + continue |
1953 | + |
1954 | + # Otherwise, it isn't markup. |
1955 | + curr_pos = start_idx + 1 |
1956 | + |
1957 | + return text |
1958 | + |
1959 | + |
1960 | + _setext_h_re = re.compile(r'^(.+)[ \t]*\n(=+|-+)[ \t]*\n+', re.M) |
1961 | + def _setext_h_sub(self, match): |
1962 | + n = {"=": 1, "-": 2}[match.group(2)[0]] |
1963 | + demote_headers = self.extras.get("demote-headers") |
1964 | + if demote_headers: |
1965 | + n = min(n + demote_headers, 6) |
1966 | + return "<h%d>%s</h%d>\n\n" \ |
1967 | + % (n, self._run_span_gamut(match.group(1)), n) |
1968 | + |
1969 | + _atx_h_re = re.compile(r''' |
1970 | + ^(\#{1,6}) # \1 = string of #'s |
1971 | + [ \t]* |
1972 | + (.+?) # \2 = Header text |
1973 | + [ \t]* |
1974 | + (?<!\\) # ensure not an escaped trailing '#' |
1975 | + \#* # optional closing #'s (not counted) |
1976 | + \n+ |
1977 | + ''', re.X | re.M) |
1978 | + def _atx_h_sub(self, match): |
1979 | + n = len(match.group(1)) |
1980 | + demote_headers = self.extras.get("demote-headers") |
1981 | + if demote_headers: |
1982 | + n = min(n + demote_headers, 6) |
1983 | + return "<h%d>%s</h%d>\n\n" \ |
1984 | + % (n, self._run_span_gamut(match.group(2)), n) |
1985 | + |
1986 | + def _do_headers(self, text): |
1987 | + # Setext-style headers: |
1988 | + # Header 1 |
1989 | + # ======== |
1990 | + # |
1991 | + # Header 2 |
1992 | + # -------- |
1993 | + text = self._setext_h_re.sub(self._setext_h_sub, text) |
1994 | + |
1995 | + # atx-style headers: |
1996 | + # # Header 1 |
1997 | + # ## Header 2 |
1998 | + # ## Header 2 with closing hashes ## |
1999 | + # ... |
2000 | + # ###### Header 6 |
2001 | + text = self._atx_h_re.sub(self._atx_h_sub, text) |
2002 | + |
2003 | + return text |
2004 | + |
2005 | + |
2006 | + _marker_ul_chars = '*+-' |
2007 | + _marker_any = r'(?:[%s]|\d+\.)' % _marker_ul_chars |
2008 | + _marker_ul = '(?:[%s])' % _marker_ul_chars |
2009 | + _marker_ol = r'(?:\d+\.)' |
2010 | + |
2011 | + def _list_sub(self, match): |
2012 | + lst = match.group(1) |
2013 | + lst_type = match.group(3) in self._marker_ul_chars and "ul" or "ol" |
2014 | + result = self._process_list_items(lst) |
2015 | + if self.list_level: |
2016 | + return "<%s>\n%s</%s>\n" % (lst_type, result, lst_type) |
2017 | + else: |
2018 | + return "<%s>\n%s</%s>\n\n" % (lst_type, result, lst_type) |
2019 | + |
2020 | + def _do_lists(self, text): |
2021 | + # Form HTML ordered (numbered) and unordered (bulleted) lists. |
2022 | + |
2023 | + for marker_pat in (self._marker_ul, self._marker_ol): |
2024 | + # Re-usable pattern to match any entire ul or ol list: |
2025 | + less_than_tab = self.tab_width - 1 |
2026 | + whole_list = r''' |
2027 | + ( # \1 = whole list |
2028 | + ( # \2 |
2029 | + [ ]{0,%d} |
2030 | + (%s) # \3 = first list item marker |
2031 | + [ \t]+ |
2032 | + ) |
2033 | + (?:.+?) |
2034 | + ( # \4 |
2035 | + \Z |
2036 | + | |
2037 | + \n{2,} |
2038 | + (?=\S) |
2039 | + (?! # Negative lookahead for another list item marker |
2040 | + [ \t]* |
2041 | + %s[ \t]+ |
2042 | + ) |
2043 | + ) |
2044 | + ) |
2045 | + ''' % (less_than_tab, marker_pat, marker_pat) |
2046 | + |
2047 | + # We use a different prefix before nested lists than top-level lists. |
2048 | + # See extended comment in _process_list_items(). |
2049 | + # |
2050 | + # Note: There's a bit of duplication here. My original implementation |
2051 | + # created a scalar regex pattern as the conditional result of the test on |
2052 | + # $g_list_level, and then only ran the $text =~ s{...}{...}egmx |
2053 | + # substitution once, using the scalar as the pattern. This worked, |
2054 | + # everywhere except when running under MT on my hosting account at Pair |
2055 | + # Networks. There, this caused all rebuilds to be killed by the reaper (or |
2056 | + # perhaps they crashed, but that seems incredibly unlikely given that the |
2057 | + # same script on the same server ran fine *except* under MT. I've spent |
2058 | + # more time trying to figure out why this is happening than I'd like to |
2059 | + # admit. My only guess, backed up by the fact that this workaround works, |
2060 | + # is that Perl optimizes the substition when it can figure out that the |
2061 | + # pattern will never change, and when this optimization isn't on, we run |
2062 | + # afoul of the reaper. Thus, the slightly redundant code to that uses two |
2063 | + # static s/// patterns rather than one conditional pattern. |
2064 | + |
2065 | + if self.list_level: |
2066 | + sub_list_re = re.compile("^"+whole_list, re.X | re.M | re.S) |
2067 | + text = sub_list_re.sub(self._list_sub, text) |
2068 | + else: |
2069 | + list_re = re.compile(r"(?:(?<=\n\n)|\A\n?)"+whole_list, |
2070 | + re.X | re.M | re.S) |
2071 | + text = list_re.sub(self._list_sub, text) |
2072 | + |
2073 | + return text |
2074 | + |
2075 | + _list_item_re = re.compile(r''' |
2076 | + (\n)? # leading line = \1 |
2077 | + (^[ \t]*) # leading whitespace = \2 |
2078 | + (%s) [ \t]+ # list marker = \3 |
2079 | + ((?:.+?) # list item text = \4 |
2080 | + (\n{1,2})) # eols = \5 |
2081 | + (?= \n* (\Z | \2 (%s) [ \t]+)) |
2082 | + ''' % (_marker_any, _marker_any), |
2083 | + re.M | re.X | re.S) |
2084 | + |
2085 | + _last_li_endswith_two_eols = False |
2086 | + def _list_item_sub(self, match): |
2087 | + item = match.group(4) |
2088 | + leading_line = match.group(1) |
2089 | + leading_space = match.group(2) |
2090 | + if leading_line or "\n\n" in item or self._last_li_endswith_two_eols: |
2091 | + item = self._run_block_gamut(self._outdent(item)) |
2092 | + else: |
2093 | + # Recursion for sub-lists: |
2094 | + item = self._do_lists(self._outdent(item)) |
2095 | + if item.endswith('\n'): |
2096 | + item = item[:-1] |
2097 | + item = self._run_span_gamut(item) |
2098 | + self._last_li_endswith_two_eols = (len(match.group(5)) == 2) |
2099 | + return "<li>%s</li>\n" % item |
2100 | + |
2101 | + def _process_list_items(self, list_str): |
2102 | + # Process the contents of a single ordered or unordered list, |
2103 | + # splitting it into individual list items. |
2104 | + |
2105 | + # The $g_list_level global keeps track of when we're inside a list. |
2106 | + # Each time we enter a list, we increment it; when we leave a list, |
2107 | + # we decrement. If it's zero, we're not in a list anymore. |
2108 | + # |
2109 | + # We do this because when we're not inside a list, we want to treat |
2110 | + # something like this: |
2111 | + # |
2112 | + # I recommend upgrading to version |
2113 | + # 8. Oops, now this line is treated |
2114 | + # as a sub-list. |
2115 | + # |
2116 | + # As a single paragraph, despite the fact that the second line starts |
2117 | + # with a digit-period-space sequence. |
2118 | + # |
2119 | + # Whereas when we're inside a list (or sub-list), that line will be |
2120 | + # treated as the start of a sub-list. What a kludge, huh? This is |
2121 | + # an aspect of Markdown's syntax that's hard to parse perfectly |
2122 | + # without resorting to mind-reading. Perhaps the solution is to |
2123 | + # change the syntax rules such that sub-lists must start with a |
2124 | + # starting cardinal number; e.g. "1." or "a.". |
2125 | + self.list_level += 1 |
2126 | + self._last_li_endswith_two_eols = False |
2127 | + list_str = list_str.rstrip('\n') + '\n' |
2128 | + list_str = self._list_item_re.sub(self._list_item_sub, list_str) |
2129 | + self.list_level -= 1 |
2130 | + return list_str |
2131 | + |
2132 | + def _get_pygments_lexer(self, lexer_name): |
2133 | + try: |
2134 | + from pygments import lexers, util |
2135 | + except ImportError: |
2136 | + return None |
2137 | + try: |
2138 | + return lexers.get_lexer_by_name(lexer_name) |
2139 | + except util.ClassNotFound: |
2140 | + return None |
2141 | + |
2142 | + def _color_with_pygments(self, codeblock, lexer, **formatter_opts): |
2143 | + import pygments |
2144 | + import pygments.formatters |
2145 | + |
2146 | + class HtmlCodeFormatter(pygments.formatters.HtmlFormatter): |
2147 | + def _wrap_code(self, inner): |
2148 | + """A function for use in a Pygments Formatter which |
2149 | + wraps in <code> tags. |
2150 | + """ |
2151 | + yield 0, "<code>" |
2152 | + for tup in inner: |
2153 | + yield tup |
2154 | + yield 0, "</code>" |
2155 | + |
2156 | + def wrap(self, source, outfile): |
2157 | + """Return the source with a code, pre, and div.""" |
2158 | + return self._wrap_div(self._wrap_pre(self._wrap_code(source))) |
2159 | + |
2160 | + formatter = HtmlCodeFormatter(cssclass="codehilite", **formatter_opts) |
2161 | + return pygments.highlight(codeblock, lexer, formatter) |
2162 | + |
2163 | + def _code_block_sub(self, match): |
2164 | + codeblock = match.group(1) |
2165 | + codeblock = self._outdent(codeblock) |
2166 | + codeblock = self._detab(codeblock) |
2167 | + codeblock = codeblock.lstrip('\n') # trim leading newlines |
2168 | + codeblock = codeblock.rstrip() # trim trailing whitespace |
2169 | + |
2170 | + if "code-color" in self.extras and codeblock.startswith(":::"): |
2171 | + lexer_name, rest = codeblock.split('\n', 1) |
2172 | + lexer_name = lexer_name[3:].strip() |
2173 | + lexer = self._get_pygments_lexer(lexer_name) |
2174 | + codeblock = rest.lstrip("\n") # Remove lexer declaration line. |
2175 | + if lexer: |
2176 | + formatter_opts = self.extras['code-color'] or {} |
2177 | + colored = self._color_with_pygments(codeblock, lexer, |
2178 | + **formatter_opts) |
2179 | + return "\n\n%s\n\n" % colored |
2180 | + |
2181 | + codeblock = self._encode_code(codeblock) |
2182 | + return "\n\n<pre><code>%s\n</code></pre>\n\n" % codeblock |
2183 | + |
2184 | + def _do_code_blocks(self, text): |
2185 | + """Process Markdown `<pre><code>` blocks.""" |
2186 | + code_block_re = re.compile(r''' |
2187 | + (?:\n\n|\A) |
2188 | + ( # $1 = the code block -- one or more lines, starting with a space/tab |
2189 | + (?: |
2190 | + (?:[ ]{%d} | \t) # Lines must start with a tab or a tab-width of spaces |
2191 | + .*\n+ |
2192 | + )+ |
2193 | + ) |
2194 | + ((?=^[ ]{0,%d}\S)|\Z) # Lookahead for non-space at line-start, or end of doc |
2195 | + ''' % (self.tab_width, self.tab_width), |
2196 | + re.M | re.X) |
2197 | + |
2198 | + return code_block_re.sub(self._code_block_sub, text) |
2199 | + |
2200 | + |
2201 | + # Rules for a code span: |
2202 | + # - backslash escapes are not interpreted in a code span |
2203 | + # - to include one or or a run of more backticks the delimiters must |
2204 | + # be a longer run of backticks |
2205 | + # - cannot start or end a code span with a backtick; pad with a |
2206 | + # space and that space will be removed in the emitted HTML |
2207 | + # See `test/tm-cases/escapes.text` for a number of edge-case |
2208 | + # examples. |
2209 | + _code_span_re = re.compile(r''' |
2210 | + (?<!\\) |
2211 | + (`+) # \1 = Opening run of ` |
2212 | + (?!`) # See Note A test/tm-cases/escapes.text |
2213 | + (.+?) # \2 = The code block |
2214 | + (?<!`) |
2215 | + \1 # Matching closer |
2216 | + (?!`) |
2217 | + ''', re.X | re.S) |
2218 | + |
2219 | + def _code_span_sub(self, match): |
2220 | + c = match.group(2).strip(" \t") |
2221 | + c = self._encode_code(c) |
2222 | + return "<code>%s</code>" % c |
2223 | + |
2224 | + def _do_code_spans(self, text): |
2225 | + # * Backtick quotes are used for <code></code> spans. |
2226 | + # |
2227 | + # * You can use multiple backticks as the delimiters if you want to |
2228 | + # include literal backticks in the code span. So, this input: |
2229 | + # |
2230 | + # Just type ``foo `bar` baz`` at the prompt. |
2231 | + # |
2232 | + # Will translate to: |
2233 | + # |
2234 | + # <p>Just type <code>foo `bar` baz</code> at the prompt.</p> |
2235 | + # |
2236 | + # There's no arbitrary limit to the number of backticks you |
2237 | + # can use as delimters. If you need three consecutive backticks |
2238 | + # in your code, use four for delimiters, etc. |
2239 | + # |
2240 | + # * You can use spaces to get literal backticks at the edges: |
2241 | + # |
2242 | + # ... type `` `bar` `` ... |
2243 | + # |
2244 | + # Turns to: |
2245 | + # |
2246 | + # ... type <code>`bar`</code> ... |
2247 | + return self._code_span_re.sub(self._code_span_sub, text) |
2248 | + |
2249 | + def _encode_code(self, text): |
2250 | + """Encode/escape certain characters inside Markdown code runs. |
2251 | + The point is that in code, these characters are literals, |
2252 | + and lose their special Markdown meanings. |
2253 | + """ |
2254 | + replacements = [ |
2255 | + # Encode all ampersands; HTML entities are not |
2256 | + # entities within a Markdown code span. |
2257 | + ('&', '&'), |
2258 | + # Do the angle bracket song and dance: |
2259 | + ('<', '<'), |
2260 | + ('>', '>'), |
2261 | + # Now, escape characters that are magic in Markdown: |
2262 | + ('*', g_escape_table['*']), |
2263 | + ('_', g_escape_table['_']), |
2264 | + ('{', g_escape_table['{']), |
2265 | + ('}', g_escape_table['}']), |
2266 | + ('[', g_escape_table['[']), |
2267 | + (']', g_escape_table[']']), |
2268 | + ('\\', g_escape_table['\\']), |
2269 | + ] |
2270 | + for before, after in replacements: |
2271 | + text = text.replace(before, after) |
2272 | + return text |
2273 | + |
2274 | + _strong_re = re.compile(r"(\*\*|__)(?=\S)(.+?[*_]*)(?<=\S)\1", re.S) |
2275 | + _em_re = re.compile(r"(\*|_)(?=\S)(.+?)(?<=\S)\1", re.S) |
2276 | + _code_friendly_strong_re = re.compile(r"\*\*(?=\S)(.+?[*_]*)(?<=\S)\*\*", re.S) |
2277 | + _code_friendly_em_re = re.compile(r"\*(?=\S)(.+?)(?<=\S)\*", re.S) |
2278 | + def _do_italics_and_bold(self, text): |
2279 | + # <strong> must go first: |
2280 | + if "code-friendly" in self.extras: |
2281 | + text = self._code_friendly_strong_re.sub(r"<strong>\1</strong>", text) |
2282 | + text = self._code_friendly_em_re.sub(r"<em>\1</em>", text) |
2283 | + else: |
2284 | + text = self._strong_re.sub(r"<strong>\2</strong>", text) |
2285 | + text = self._em_re.sub(r"<em>\2</em>", text) |
2286 | + return text |
2287 | + |
2288 | + |
2289 | + _block_quote_re = re.compile(r''' |
2290 | + ( # Wrap whole match in \1 |
2291 | + ( |
2292 | + ^[ \t]*>[ \t]? # '>' at the start of a line |
2293 | + .+\n # rest of the first line |
2294 | + (.+\n)* # subsequent consecutive lines |
2295 | + \n* # blanks |
2296 | + )+ |
2297 | + ) |
2298 | + ''', re.M | re.X) |
2299 | + _bq_one_level_re = re.compile('^[ \t]*>[ \t]?', re.M); |
2300 | + |
2301 | + _html_pre_block_re = re.compile(r'(\s*<pre>.+?</pre>)', re.S) |
2302 | + def _dedent_two_spaces_sub(self, match): |
2303 | + return re.sub(r'(?m)^ ', '', match.group(1)) |
2304 | + |
2305 | + def _block_quote_sub(self, match): |
2306 | + bq = match.group(1) |
2307 | + bq = self._bq_one_level_re.sub('', bq) # trim one level of quoting |
2308 | + bq = self._ws_only_line_re.sub('', bq) # trim whitespace-only lines |
2309 | + bq = self._run_block_gamut(bq) # recurse |
2310 | + |
2311 | + bq = re.sub('(?m)^', ' ', bq) |
2312 | + # These leading spaces screw with <pre> content, so we need to fix that: |
2313 | + bq = self._html_pre_block_re.sub(self._dedent_two_spaces_sub, bq) |
2314 | + |
2315 | + return "<blockquote>\n%s\n</blockquote>\n\n" % bq |
2316 | + |
2317 | + def _do_block_quotes(self, text): |
2318 | + if '>' not in text: |
2319 | + return text |
2320 | + return self._block_quote_re.sub(self._block_quote_sub, text) |
2321 | + |
2322 | + def _form_paragraphs(self, text): |
2323 | + # Strip leading and trailing lines: |
2324 | + text = text.strip('\n') |
2325 | + |
2326 | + # Wrap <p> tags. |
2327 | + grafs = re.split(r"\n{2,}", text) |
2328 | + for i, graf in enumerate(grafs): |
2329 | + if graf in self.html_blocks: |
2330 | + # Unhashify HTML blocks |
2331 | + grafs[i] = self.html_blocks[graf] |
2332 | + else: |
2333 | + # Wrap <p> tags. |
2334 | + graf = self._run_span_gamut(graf) |
2335 | + grafs[i] = "<p>" + graf.lstrip(" \t") + "</p>" |
2336 | + |
2337 | + return "\n\n".join(grafs) |
2338 | + |
2339 | + def _add_footnotes(self, text): |
2340 | + if self.footnotes: |
2341 | + footer = [ |
2342 | + '<div class="footnotes">', |
2343 | + '<hr' + self.empty_element_suffix, |
2344 | + '<ol>', |
2345 | + ] |
2346 | + for i, id in enumerate(self.footnote_ids): |
2347 | + if i != 0: |
2348 | + footer.append('') |
2349 | + footer.append('<li id="fn-%s">' % id) |
2350 | + footer.append(self._run_block_gamut(self.footnotes[id])) |
2351 | + backlink = ('<a href="#fnref-%s" ' |
2352 | + 'class="footnoteBackLink" ' |
2353 | + 'title="Jump back to footnote %d in the text.">' |
2354 | + '↩</a>' % (id, i+1)) |
2355 | + if footer[-1].endswith("</p>"): |
2356 | + footer[-1] = footer[-1][:-len("</p>")] \ |
2357 | + + ' ' + backlink + "</p>" |
2358 | + else: |
2359 | + footer.append("\n<p>%s</p>" % backlink) |
2360 | + footer.append('</li>') |
2361 | + footer.append('</ol>') |
2362 | + footer.append('</div>') |
2363 | + return text + '\n\n' + '\n'.join(footer) |
2364 | + else: |
2365 | + return text |
2366 | + |
2367 | + # Ampersand-encoding based entirely on Nat Irons's Amputator MT plugin: |
2368 | + # http://bumppo.net/projects/amputator/ |
2369 | + _ampersand_re = re.compile(r'&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)') |
2370 | + _naked_lt_re = re.compile(r'<(?![a-z/?\$!])', re.I) |
2371 | + _naked_gt_re = re.compile(r'''(?<![a-z?!/'"-])>''', re.I) |
2372 | + |
2373 | + def _encode_amps_and_angles(self, text): |
2374 | + # Smart processing for ampersands and angle brackets that need |
2375 | + # to be encoded. |
2376 | + text = self._ampersand_re.sub('&', text) |
2377 | + |
2378 | + # Encode naked <'s |
2379 | + text = self._naked_lt_re.sub('<', text) |
2380 | + |
2381 | + # Encode naked >'s |
2382 | + # Note: Other markdown implementations (e.g. Markdown.pl, PHP |
2383 | + # Markdown) don't do this. |
2384 | + text = self._naked_gt_re.sub('>', text) |
2385 | + return text |
2386 | + |
2387 | + def _encode_backslash_escapes(self, text): |
2388 | + for ch, escape in g_escape_table.items(): |
2389 | + text = text.replace("\\"+ch, escape) |
2390 | + return text |
2391 | + |
2392 | + _auto_link_re = re.compile(r'<((https?|ftp):[^\'">\s]+)>', re.I) |
2393 | + def _auto_link_sub(self, match): |
2394 | + g1 = match.group(1) |
2395 | + return '<a href="%s">%s</a>' % (g1, g1) |
2396 | + |
2397 | + _auto_email_link_re = re.compile(r""" |
2398 | + < |
2399 | + (?:mailto:)? |
2400 | + ( |
2401 | + [-.\w]+ |
2402 | + \@ |
2403 | + [-\w]+(\.[-\w]+)*\.[a-z]+ |
2404 | + ) |
2405 | + > |
2406 | + """, re.I | re.X | re.U) |
2407 | + def _auto_email_link_sub(self, match): |
2408 | + return self._encode_email_address( |
2409 | + self._unescape_special_chars(match.group(1))) |
2410 | + |
2411 | + def _do_auto_links(self, text): |
2412 | + text = self._auto_link_re.sub(self._auto_link_sub, text) |
2413 | + text = self._auto_email_link_re.sub(self._auto_email_link_sub, text) |
2414 | + return text |
2415 | + |
2416 | + def _encode_email_address(self, addr): |
2417 | + # Input: an email address, e.g. "foo@example.com" |
2418 | + # |
2419 | + # Output: the email address as a mailto link, with each character |
2420 | + # of the address encoded as either a decimal or hex entity, in |
2421 | + # the hopes of foiling most address harvesting spam bots. E.g.: |
2422 | + # |
2423 | + # <a href="mailto:foo@e |
2424 | + # xample.com">foo |
2425 | + # @example.com</a> |
2426 | + # |
2427 | + # Based on a filter by Matthew Wickline, posted to the BBEdit-Talk |
2428 | + # mailing list: <http://tinyurl.com/yu7ue> |
2429 | + chars = [_xml_encode_email_char_at_random(ch) |
2430 | + for ch in "mailto:" + addr] |
2431 | + # Strip the mailto: from the visible part. |
2432 | + addr = '<a href="%s">%s</a>' \ |
2433 | + % (''.join(chars), ''.join(chars[7:])) |
2434 | + return addr |
2435 | + |
2436 | + def _do_link_patterns(self, text): |
2437 | + """Caveat emptor: there isn't much guarding against link |
2438 | + patterns being formed inside other standard Markdown links, e.g. |
2439 | + inside a [link def][like this]. |
2440 | + |
2441 | + Dev Notes: *Could* consider prefixing regexes with a negative |
2442 | + lookbehind assertion to attempt to guard against this. |
2443 | + """ |
2444 | + link_from_hash = {} |
2445 | + for regex, repl in self.link_patterns: |
2446 | + replacements = [] |
2447 | + for match in regex.finditer(text): |
2448 | + if hasattr(repl, "__call__"): |
2449 | + href = repl(match) |
2450 | + else: |
2451 | + href = match.expand(repl) |
2452 | + replacements.append((match.span(), href)) |
2453 | + for (start, end), href in reversed(replacements): |
2454 | + escaped_href = ( |
2455 | + href.replace('"', '"') # b/c of attr quote |
2456 | + # To avoid markdown <em> and <strong>: |
2457 | + .replace('*', g_escape_table['*']) |
2458 | + .replace('_', g_escape_table['_'])) |
2459 | + link = '<a href="%s">%s</a>' % (escaped_href, text[start:end]) |
2460 | + hash = md5(link).hexdigest() |
2461 | + link_from_hash[hash] = link |
2462 | + text = text[:start] + hash + text[end:] |
2463 | + for hash, link in link_from_hash.items(): |
2464 | + text = text.replace(hash, link) |
2465 | + return text |
2466 | + |
2467 | + def _unescape_special_chars(self, text): |
2468 | + # Swap back in all the special characters we've hidden. |
2469 | + for ch, hash in g_escape_table.items(): |
2470 | + text = text.replace(hash, ch) |
2471 | + return text |
2472 | + |
2473 | + def _outdent(self, text): |
2474 | + # Remove one level of line-leading tabs or spaces |
2475 | + return self._outdent_re.sub('', text) |
2476 | + |
2477 | + |
2478 | +class MarkdownWithExtras(Markdown): |
2479 | + """A markdowner class that enables most extras: |
2480 | + |
2481 | + - footnotes |
2482 | + - code-color (only has effect if 'pygments' Python module on path) |
2483 | + |
2484 | + These are not included: |
2485 | + - pyshell (specific to Python-related documenting) |
2486 | + - code-friendly (because it *disables* part of the syntax) |
2487 | + - link-patterns (because you need to specify some actual |
2488 | + link-patterns anyway) |
2489 | + """ |
2490 | + extras = ["footnotes", "code-color"] |
2491 | + |
2492 | + |
2493 | +#---- internal support functions |
2494 | + |
2495 | +# From http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52549 |
2496 | +def _curry(*args, **kwargs): |
2497 | + function, args = args[0], args[1:] |
2498 | + def result(*rest, **kwrest): |
2499 | + combined = kwargs.copy() |
2500 | + combined.update(kwrest) |
2501 | + return function(*args + rest, **combined) |
2502 | + return result |
2503 | + |
2504 | +# Recipe: regex_from_encoded_pattern (1.0) |
2505 | +def _regex_from_encoded_pattern(s): |
2506 | + """'foo' -> re.compile(re.escape('foo')) |
2507 | + '/foo/' -> re.compile('foo') |
2508 | + '/foo/i' -> re.compile('foo', re.I) |
2509 | + """ |
2510 | + if s.startswith('/') and s.rfind('/') != 0: |
2511 | + # Parse it: /PATTERN/FLAGS |
2512 | + idx = s.rfind('/') |
2513 | + pattern, flags_str = s[1:idx], s[idx+1:] |
2514 | + flag_from_char = { |
2515 | + "i": re.IGNORECASE, |
2516 | + "l": re.LOCALE, |
2517 | + "s": re.DOTALL, |
2518 | + "m": re.MULTILINE, |
2519 | + "u": re.UNICODE, |
2520 | + } |
2521 | + flags = 0 |
2522 | + for char in flags_str: |
2523 | + try: |
2524 | + flags |= flag_from_char[char] |
2525 | + except KeyError: |
2526 | + raise ValueError("unsupported regex flag: '%s' in '%s' " |
2527 | + "(must be one of '%s')" |
2528 | + % (char, s, ''.join(flag_from_char.keys()))) |
2529 | + return re.compile(s[1:idx], flags) |
2530 | + else: # not an encoded regex |
2531 | + return re.compile(re.escape(s)) |
2532 | + |
2533 | +# Recipe: dedent (0.1.2) |
2534 | +def _dedentlines(lines, tabsize=8, skip_first_line=False): |
2535 | + """_dedentlines(lines, tabsize=8, skip_first_line=False) -> dedented lines |
2536 | + |
2537 | + "lines" is a list of lines to dedent. |
2538 | + "tabsize" is the tab width to use for indent width calculations. |
2539 | + "skip_first_line" is a boolean indicating if the first line should |
2540 | + be skipped for calculating the indent width and for dedenting. |
2541 | + This is sometimes useful for docstrings and similar. |
2542 | + |
2543 | + Same as dedent() except operates on a sequence of lines. Note: the |
2544 | + lines list is modified **in-place**. |
2545 | + """ |
2546 | + DEBUG = False |
2547 | + if DEBUG: |
2548 | + print "dedent: dedent(..., tabsize=%d, skip_first_line=%r)"\ |
2549 | + % (tabsize, skip_first_line) |
2550 | + indents = [] |
2551 | + margin = None |
2552 | + for i, line in enumerate(lines): |
2553 | + if i == 0 and skip_first_line: continue |
2554 | + indent = 0 |
2555 | + for ch in line: |
2556 | + if ch == ' ': |
2557 | + indent += 1 |
2558 | + elif ch == '\t': |
2559 | + indent += tabsize - (indent % tabsize) |
2560 | + elif ch in '\r\n': |
2561 | + continue # skip all-whitespace lines |
2562 | + else: |
2563 | + break |
2564 | + else: |
2565 | + continue # skip all-whitespace lines |
2566 | + if DEBUG: print "dedent: indent=%d: %r" % (indent, line) |
2567 | + if margin is None: |
2568 | + margin = indent |
2569 | + else: |
2570 | + margin = min(margin, indent) |
2571 | + if DEBUG: print "dedent: margin=%r" % margin |
2572 | + |
2573 | + if margin is not None and margin > 0: |
2574 | + for i, line in enumerate(lines): |
2575 | + if i == 0 and skip_first_line: continue |
2576 | + removed = 0 |
2577 | + for j, ch in enumerate(line): |
2578 | + if ch == ' ': |
2579 | + removed += 1 |
2580 | + elif ch == '\t': |
2581 | + removed += tabsize - (removed % tabsize) |
2582 | + elif ch in '\r\n': |
2583 | + if DEBUG: print "dedent: %r: EOL -> strip up to EOL" % line |
2584 | + lines[i] = lines[i][j:] |
2585 | + break |
2586 | + else: |
2587 | + raise ValueError("unexpected non-whitespace char %r in " |
2588 | + "line %r while removing %d-space margin" |
2589 | + % (ch, line, margin)) |
2590 | + if DEBUG: |
2591 | + print "dedent: %r: %r -> removed %d/%d"\ |
2592 | + % (line, ch, removed, margin) |
2593 | + if removed == margin: |
2594 | + lines[i] = lines[i][j+1:] |
2595 | + break |
2596 | + elif removed > margin: |
2597 | + lines[i] = ' '*(removed-margin) + lines[i][j+1:] |
2598 | + break |
2599 | + else: |
2600 | + if removed: |
2601 | + lines[i] = lines[i][removed:] |
2602 | + return lines |
2603 | + |
2604 | +def _dedent(text, tabsize=8, skip_first_line=False): |
2605 | + """_dedent(text, tabsize=8, skip_first_line=False) -> dedented text |
2606 | + |
2607 | + "text" is the text to dedent. |
2608 | + "tabsize" is the tab width to use for indent width calculations. |
2609 | + "skip_first_line" is a boolean indicating if the first line should |
2610 | + be skipped for calculating the indent width and for dedenting. |
2611 | + This is sometimes useful for docstrings and similar. |
2612 | + |
2613 | + textwrap.dedent(s), but don't expand tabs to spaces |
2614 | + """ |
2615 | + lines = text.splitlines(1) |
2616 | + _dedentlines(lines, tabsize=tabsize, skip_first_line=skip_first_line) |
2617 | + return ''.join(lines) |
2618 | + |
2619 | + |
2620 | +class _memoized(object): |
2621 | + """Decorator that caches a function's return value each time it is called. |
2622 | + If called later with the same arguments, the cached value is returned, and |
2623 | + not re-evaluated. |
2624 | + |
2625 | + http://wiki.python.org/moin/PythonDecoratorLibrary |
2626 | + """ |
2627 | + def __init__(self, func): |
2628 | + self.func = func |
2629 | + self.cache = {} |
2630 | + def __call__(self, *args): |
2631 | + try: |
2632 | + return self.cache[args] |
2633 | + except KeyError: |
2634 | + self.cache[args] = value = self.func(*args) |
2635 | + return value |
2636 | + except TypeError: |
2637 | + # uncachable -- for instance, passing a list as an argument. |
2638 | + # Better to not cache than to blow up entirely. |
2639 | + return self.func(*args) |
2640 | + def __repr__(self): |
2641 | + """Return the function's docstring.""" |
2642 | + return self.func.__doc__ |
2643 | + |
2644 | + |
2645 | +def _xml_oneliner_re_from_tab_width(tab_width): |
2646 | + """Standalone XML processing instruction regex.""" |
2647 | + return re.compile(r""" |
2648 | + (?: |
2649 | + (?<=\n\n) # Starting after a blank line |
2650 | + | # or |
2651 | + \A\n? # the beginning of the doc |
2652 | + ) |
2653 | + ( # save in $1 |
2654 | + [ ]{0,%d} |
2655 | + (?: |
2656 | + <\?\w+\b\s+.*?\?> # XML processing instruction |
2657 | + | |
2658 | + <\w+:\w+\b\s+.*?/> # namespaced single tag |
2659 | + ) |
2660 | + [ \t]* |
2661 | + (?=\n{2,}|\Z) # followed by a blank line or end of document |
2662 | + ) |
2663 | + """ % (tab_width - 1), re.X) |
2664 | +_xml_oneliner_re_from_tab_width = _memoized(_xml_oneliner_re_from_tab_width) |
2665 | + |
2666 | +def _hr_tag_re_from_tab_width(tab_width): |
2667 | + return re.compile(r""" |
2668 | + (?: |
2669 | + (?<=\n\n) # Starting after a blank line |
2670 | + | # or |
2671 | + \A\n? # the beginning of the doc |
2672 | + ) |
2673 | + ( # save in \1 |
2674 | + [ ]{0,%d} |
2675 | + <(hr) # start tag = \2 |
2676 | + \b # word break |
2677 | + ([^<>])*? # |
2678 | + /?> # the matching end tag |
2679 | + [ \t]* |
2680 | + (?=\n{2,}|\Z) # followed by a blank line or end of document |
2681 | + ) |
2682 | + """ % (tab_width - 1), re.X) |
2683 | +_hr_tag_re_from_tab_width = _memoized(_hr_tag_re_from_tab_width) |
2684 | + |
2685 | + |
2686 | +def _xml_encode_email_char_at_random(ch): |
2687 | + r = random() |
2688 | + # Roughly 10% raw, 45% hex, 45% dec. |
2689 | + # '@' *must* be encoded. I [John Gruber] insist. |
2690 | + # Issue 26: '_' must be encoded. |
2691 | + if r > 0.9 and ch not in "@_": |
2692 | + return ch |
2693 | + elif r < 0.45: |
2694 | + # The [1:] is to drop leading '0': 0x63 -> x63 |
2695 | + return '&#%s;' % hex(ord(ch))[1:] |
2696 | + else: |
2697 | + return '&#%s;' % ord(ch) |
2698 | + |
2699 | +def _hash_text(text): |
2700 | + return 'md5:'+md5(text.encode("utf-8")).hexdigest() |
2701 | + |
2702 | + |
2703 | +#---- mainline |
2704 | + |
2705 | +class _NoReflowFormatter(optparse.IndentedHelpFormatter): |
2706 | + """An optparse formatter that does NOT reflow the description.""" |
2707 | + def format_description(self, description): |
2708 | + return description or "" |
2709 | + |
2710 | +def _test(): |
2711 | + import doctest |
2712 | + doctest.testmod() |
2713 | + |
2714 | +def main(argv=None): |
2715 | + if argv is None: |
2716 | + argv = sys.argv |
2717 | + if not logging.root.handlers: |
2718 | + logging.basicConfig() |
2719 | + |
2720 | + usage = "usage: %prog [PATHS...]" |
2721 | + version = "%prog "+__version__ |
2722 | + parser = optparse.OptionParser(prog="markdown2", usage=usage, |
2723 | + version=version, description=cmdln_desc, |
2724 | + formatter=_NoReflowFormatter()) |
2725 | + parser.add_option("-v", "--verbose", dest="log_level", |
2726 | + action="store_const", const=logging.DEBUG, |
2727 | + help="more verbose output") |
2728 | + parser.add_option("--encoding", |
2729 | + help="specify encoding of text content") |
2730 | + parser.add_option("--html4tags", action="store_true", default=False, |
2731 | + help="use HTML 4 style for empty element tags") |
2732 | + parser.add_option("-s", "--safe", metavar="MODE", dest="safe_mode", |
2733 | + help="sanitize literal HTML: 'escape' escapes " |
2734 | + "HTML meta chars, 'replace' replaces with an " |
2735 | + "[HTML_REMOVED] note") |
2736 | + parser.add_option("-x", "--extras", action="append", |
2737 | + help="Turn on specific extra features (not part of " |
2738 | + "the core Markdown spec). Supported values: " |
2739 | + "'code-friendly' disables _/__ for emphasis; " |
2740 | + "'code-color' adds code-block syntax coloring; " |
2741 | + "'link-patterns' adds auto-linking based on patterns; " |
2742 | + "'footnotes' adds the footnotes syntax;" |
2743 | + "'xml' passes one-liner processing instructions and namespaced XML tags;" |
2744 | + "'pyshell' to put unindented Python interactive shell sessions in a <code> block.") |
2745 | + parser.add_option("--use-file-vars", |
2746 | + help="Look for and use Emacs-style 'markdown-extras' " |
2747 | + "file var to turn on extras. See " |
2748 | + "<http://code.google.com/p/python-markdown2/wiki/Extras>.") |
2749 | + parser.add_option("--link-patterns-file", |
2750 | + help="path to a link pattern file") |
2751 | + parser.add_option("--self-test", action="store_true", |
2752 | + help="run internal self-tests (some doctests)") |
2753 | + parser.add_option("--compare", action="store_true", |
2754 | + help="run against Markdown.pl as well (for testing)") |
2755 | + parser.set_defaults(log_level=logging.INFO, compare=False, |
2756 | + encoding="utf-8", safe_mode=None, use_file_vars=False) |
2757 | + opts, paths = parser.parse_args() |
2758 | + log.setLevel(opts.log_level) |
2759 | + |
2760 | + if opts.self_test: |
2761 | + return _test() |
2762 | + |
2763 | + if opts.extras: |
2764 | + extras = {} |
2765 | + for s in opts.extras: |
2766 | + splitter = re.compile("[,;: ]+") |
2767 | + for e in splitter.split(s): |
2768 | + if '=' in e: |
2769 | + ename, earg = e.split('=', 1) |
2770 | + try: |
2771 | + earg = int(earg) |
2772 | + except ValueError: |
2773 | + pass |
2774 | + else: |
2775 | + ename, earg = e, None |
2776 | + extras[ename] = earg |
2777 | + else: |
2778 | + extras = None |
2779 | + |
2780 | + if opts.link_patterns_file: |
2781 | + link_patterns = [] |
2782 | + f = open(opts.link_patterns_file) |
2783 | + try: |
2784 | + for i, line in enumerate(f.readlines()): |
2785 | + if not line.strip(): continue |
2786 | + if line.lstrip().startswith("#"): continue |
2787 | + try: |
2788 | + pat, href = line.rstrip().rsplit(None, 1) |
2789 | + except ValueError: |
2790 | + raise MarkdownError("%s:%d: invalid link pattern line: %r" |
2791 | + % (opts.link_patterns_file, i+1, line)) |
2792 | + link_patterns.append( |
2793 | + (_regex_from_encoded_pattern(pat), href)) |
2794 | + finally: |
2795 | + f.close() |
2796 | + else: |
2797 | + link_patterns = None |
2798 | + |
2799 | + from os.path import join, dirname, abspath, exists |
2800 | + markdown_pl = join(dirname(dirname(abspath(__file__))), "test", |
2801 | + "Markdown.pl") |
2802 | + for path in paths: |
2803 | + if opts.compare: |
2804 | + print "==== Markdown.pl ====" |
2805 | + perl_cmd = 'perl %s "%s"' % (markdown_pl, path) |
2806 | + o = os.popen(perl_cmd) |
2807 | + perl_html = o.read() |
2808 | + o.close() |
2809 | + sys.stdout.write(perl_html) |
2810 | + print "==== markdown2.py ====" |
2811 | + html = markdown_path(path, encoding=opts.encoding, |
2812 | + html4tags=opts.html4tags, |
2813 | + safe_mode=opts.safe_mode, |
2814 | + extras=extras, link_patterns=link_patterns, |
2815 | + use_file_vars=opts.use_file_vars) |
2816 | + sys.stdout.write( |
2817 | + html.encode(sys.stdout.encoding or "utf-8", 'xmlcharrefreplace')) |
2818 | + if opts.compare: |
2819 | + test_dir = join(dirname(dirname(abspath(__file__))), "test") |
2820 | + if exists(join(test_dir, "test_markdown2.py")): |
2821 | + sys.path.insert(0, test_dir) |
2822 | + from test_markdown2 import norm_html_from_html |
2823 | + norm_html = norm_html_from_html(html) |
2824 | + norm_perl_html = norm_html_from_html(perl_html) |
2825 | + else: |
2826 | + norm_html = html |
2827 | + norm_perl_html = perl_html |
2828 | + print "==== match? %r ====" % (norm_perl_html == norm_html) |
2829 | + |
2830 | + |
2831 | +if __name__ == "__main__": |
2832 | + sys.exit( main(sys.argv) ) |
2833 | + |
2834 | |
2835 | === modified file 'vauxoomin/main/server.py' |
2836 | --- vauxoomin/main/server.py 2012-02-12 18:28:58 +0000 |
2837 | +++ vauxoomin/main/server.py 2012-03-21 00:56:22 +0000 |
2838 | @@ -3,7 +3,8 @@ |
2839 | from bzrlib.branch import Branch |
2840 | from bzrlib.log import Logger |
2841 | import ConfigParser as CP |
2842 | - |
2843 | +from markdown import markdown |
2844 | +from list_db import list_db |
2845 | |
2846 | def get_dirs(project=None,user='nhomar',relative_path='instancias'): |
2847 | ''' |
2848 | @@ -49,13 +50,18 @@ |
2849 | try: |
2850 | res.append(parse_text(Branch.open(path+"/"+p))) |
2851 | except Exception as inst: |
2852 | - print "Error WIth branch" % inst |
2853 | + print "Error With branch" % inst |
2854 | res.append("Error WIth branch" % inst) |
2855 | return res |
2856 | |
2857 | |
2858 | def get_status(instance): |
2859 | - return "Running" |
2860 | + estatus=os.popen("ps aux | grep openerp-server | grep %s" % instance) |
2861 | + if len(estatus.readlines())>1: |
2862 | + return {'use':'successBox','message':'Server Is running normally for %s Press F5 if you want the las status.' % instance} |
2863 | + else: |
2864 | + return {'use':'errorBox','message':'Server Is down in this instance %s Press F5 if you want the las status.' % instance} |
2865 | + |
2866 | |
2867 | def get_config(instance,user='nhomar',relative_path='instancias',base_config_path='config'): |
2868 | oerp_config = CP.ConfigParser() |
2869 | @@ -71,5 +77,48 @@ |
2870 | r_opts[o]=oerp_config.get('options',o) |
2871 | return r_opts |
2872 | |
2873 | +def get_configdir(user='nhomar', base_config_path='config'): |
2874 | + return "/home/%s/%s/" % (user,base_config_path) |
2875 | + |
2876 | +def preprocess_logs(logs_): |
2877 | + if type(logs_) is dict: |
2878 | + return logs_ |
2879 | + else: |
2880 | + #TODO: Pre process with fancy html feature |
2881 | + return " ".join(logs_) |
2882 | + |
2883 | def get_logs(instance): |
2884 | - return "Tail -f 20 from log" |
2885 | + path_to_log="/home/nhomar/log_openerp/%s_oerp.log" % instance #TODO: Put this general |
2886 | + if os.path.isfile(path_to_log): |
2887 | + log_file=open(path_to_log,"r") |
2888 | + html=[l for l in log_file.readlines()] |
2889 | + return html |
2890 | + else: |
2891 | + return {'use': 'warningBox', |
2892 | + 'message': '''Log file doesn`t found for this instance, please verify your |
2893 | + config file on <b>logfile</b> entry</br><a href="/action/%s/create_log" title="Create a log file.">Click here</a> to try solve the problem''' % instance} |
2894 | + |
2895 | +def get_quality(instance): |
2896 | + return {'use': 'warningBox', |
2897 | + 'message': ''' Here we will link this this in a cool way with runbot.openerp.com |
2898 | + '''} |
2899 | + |
2900 | +def get_dblist(instance): |
2901 | + #TODO: Make this generic enought |
2902 | + url = 'socket://localhost:%s' % get_config(instance).get('netrpc_port') |
2903 | + try: |
2904 | + return tuple(list_db().conect_to_port(url)) |
2905 | + except: |
2906 | + return tuple([]) |
2907 | + |
2908 | + |
2909 | +def get_paranoic(instance): |
2910 | + ''' |
2911 | + Get all backups made by paranoic backups script on lp:TODO#Put here the branch |
2912 | + ''' |
2913 | + return ['bkp1','bkp2'] |
2914 | + |
2915 | + |
2916 | +def get_backups(instance): |
2917 | + return tuple(get_paranoic(instance)) |
2918 | + |
2919 | |
2920 | === modified file 'vauxoomin/static/css/all.css' |
2921 | --- vauxoomin/static/css/all.css 2012-02-16 01:42:34 +0000 |
2922 | +++ vauxoomin/static/css/all.css 2012-03-21 00:56:22 +0000 |
2923 | @@ -704,4 +704,14 @@ |
2924 | float:right; |
2925 | color:#fff; |
2926 | } |
2927 | -/*LOGIN END*/ |
2928 | \ No newline at end of file |
2929 | +/*LOGIN END*/ |
2930 | +/*CODE BEGIN*/ |
2931 | +pre { |
2932 | + padding: 1em; |
2933 | + border: 1px dashed #2F6FAB; |
2934 | + color: black; |
2935 | + background-color: #F9F9F9; |
2936 | + line-height: 1.05em; |
2937 | + font-family: monospace,"Courier New"; |
2938 | +} |
2939 | +/*CODE END*/ |
2940 | |
2941 | === added file 'vauxoomin/static/img/icons/browse_1.png' |
2942 | Binary files vauxoomin/static/img/icons/browse_1.png 1970-01-01 00:00:00 +0000 and vauxoomin/static/img/icons/browse_1.png 2012-03-21 00:56:22 +0000 differ |
2943 | === modified file 'vauxoomin/templates/action.html' |
2944 | --- vauxoomin/templates/action.html 2012-02-13 13:34:37 +0000 |
2945 | +++ vauxoomin/templates/action.html 2012-03-21 00:56:22 +0000 |
2946 | @@ -1,11 +1,14 @@ |
2947 | {% autoescape None %} |
2948 | -{% extends "main.html" %} |
2949 | +{% extends "base_themed.html" %} |
2950 | |
2951 | -{% block body %} |
2952 | - <p>I will {{ action }} from {{ instance }}</p> |
2953 | - copy {{ cp_msg }} |
2954 | - <ul class="green"> |
2955 | - <li><a class="current" href="/{{ instance }}"> |
2956 | - <span>Back to Instance</span></a> |
2957 | - </li> |
2958 | +{% block contentWrapMain %} |
2959 | +<div class="home"> |
2960 | +</div> |
2961 | + {% if type(cp_msg) is list %} |
2962 | + {% for c in cp_msg %} |
2963 | + {{ modules.WarningWidget(c.get('use'),c.get('message')) }} |
2964 | + {% end %} |
2965 | + {% else %} |
2966 | + {{ modules.WarningWidget(cp_msg.get('use'),cp_msg.get('message')) }} |
2967 | + {% end %} |
2968 | {% end %} |
2969 | |
2970 | === modified file 'vauxoomin/templates/base.html' |
2971 | --- vauxoomin/templates/base.html 2012-02-13 11:19:02 +0000 |
2972 | +++ vauxoomin/templates/base.html 2012-03-21 00:56:22 +0000 |
2973 | @@ -7,7 +7,6 @@ |
2974 | <link rel="stylesheet" href="{{ static_url("buttons.css") }}" type="text/css"/> |
2975 | <link rel="stylesheet" href="{{ static_url("sliding.css") }}" type="text/css"/> |
2976 | <link rel="alternate" href="/feed" type="application/atom+xml" title="{{ escape(handler.settings["title"]) }}"/> |
2977 | - {% block head %}{% end %} |
2978 | </head> |
2979 | <body> |
2980 | <div id="body"> |
2981 | |
2982 | === added file 'vauxoomin/templates/base_themed.html' |
2983 | --- vauxoomin/templates/base_themed.html 1970-01-01 00:00:00 +0000 |
2984 | +++ vauxoomin/templates/base_themed.html 2012-03-21 00:56:22 +0000 |
2985 | @@ -0,0 +1,93 @@ |
2986 | +{% autoescape None %} |
2987 | +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
2988 | +<html xmlns="http://www.w3.org/1999/xhtml"> |
2989 | +<head> |
2990 | +<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
2991 | +<title>{{ escape(handler.settings["title"]) }}</title> |
2992 | +<style media="all" type="text/css">@import "/static/css/all.css";</style> |
2993 | +<style media="all" type="text/css">@import "/static/css/custom-theme/jquery-ui-1.7.2.custom.css";</style> |
2994 | +<style media="all" type="text/css">@import "/static/css/jquery.wysiwyg.css";</style> |
2995 | +<style media="all" type="text/css">@import "/static/css/visualize.css";</style> |
2996 | +<style media="all" type="text/css">@import "/static/css/colorbox.css";</style> |
2997 | +<!--[if IE 6]> |
2998 | + <style media="all" type="text/static/css">@import "css/ie6.css";</style> |
2999 | + <style media="all" type="text/static/css">@import "css/colorbox-ie.csss";</style> |
3000 | +<![endif]--> |
3001 | +<script type="text/javascript" src="/static/js/jquery-1.4.2.min.js"></script> |
3002 | +<script type="text/javascript" src="/static/js/jquery-ui-1.7.2.custom.min.js"></script> |
3003 | +<script type="text/javascript" src="/static/js/jquery.wysiwyg.js"></script> |
3004 | +<script type="text/javascript" src="/static/js/excanvas.js"></script> |
3005 | +<script type="text/javascript" src="/static/js/visualize.jQuery.js"></script> |
3006 | +<script type="text/javascript" src="/static/js/jquery.colorbox-min.js"></script> |
3007 | +<script type="text/javascript" src="/static/js/custom.js"></script> |
3008 | +<!--[if lt IE 9]> |
3009 | + <script src="http://ie7-js.googlecode.com/svn/version/2.1(beta3)/IE9.js"> |
3010 | + IE7_PNG_SUFFIX=".png"; |
3011 | + </script> |
3012 | +<![endif]--> |
3013 | +</head> |
3014 | +<body id="loggedInBody"> |
3015 | + <div id="mainWrap"> |
3016 | + <div id="headerWrap"> |
3017 | + <div id="systemMenu"> |
3018 | + {{ modules.TopMenu("") }} |
3019 | + </div> |
3020 | + <div id="logo"> |
3021 | + {{ modules.Logo("") }} |
3022 | + </div> |
3023 | + <div id="topNavigationWrap"> |
3024 | + <ul class="dropdown"> |
3025 | + {% block topNavigation %}{% end %} |
3026 | +<!-- Here will be the main menu--> |
3027 | + </ul> |
3028 | + </div> |
3029 | + </div> |
3030 | + <!--Rounded Corners For The Top - START--> |
3031 | + <div id="contentWrapTop"> |
3032 | + <div id="contentWrapTopLeft"> |
3033 | + {% block contentWrapTopLeft %}{% end %} |
3034 | + </div> |
3035 | + <div id="contentWrapTopRight"> |
3036 | + {% block contentWrapTopRight %}{% end %} |
3037 | + </div> |
3038 | + </div> |
3039 | + <!--Rounded Corners For The Top - END--> |
3040 | + <!--contentWrap START--> |
3041 | + <div id="contentWrap"> |
3042 | + {% block contentWrap %}{% end %} |
3043 | + <!--contentWrapSidebar START--> |
3044 | + <div id="contentWrapSidebar"> |
3045 | + {% block contentWrapSidebar %}{% end %} |
3046 | + </div> |
3047 | + <!--contentWrapSidebar END--> |
3048 | + <!--contentWrapMain START--> |
3049 | + <div id="contentWrapMain"> |
3050 | + {% block contentWrapMain %}{% end %} |
3051 | + <div id="contentTitleWrap"> |
3052 | + {% block contentTitleWrap %}{% end %} |
3053 | + </div> |
3054 | + <div id="contentWrapMainBottomSpacer"> |
3055 | + {% block contentWrapMainBottomSpacer %}{% end %} |
3056 | + </div> |
3057 | + </div> |
3058 | + <!--contentWrapMain END--> |
3059 | + </div> |
3060 | + <!--contentWrap END--> |
3061 | + |
3062 | + <div id="contentWrapBottom"> |
3063 | + {% block contentWrapBottom %}{% end %} |
3064 | + <div id="contentWrapBottomLeft"> |
3065 | + {% block contentWrapBottomLeft %}{% end %} |
3066 | + </div> |
3067 | + <div id="contentWrapBottomRight"> |
3068 | + {% block contentWrapBottomRight %}{% end %} |
3069 | + </div> |
3070 | + </div> |
3071 | + |
3072 | + <div id="footerWrap"> |
3073 | + {% block footerWrap %}{% end %} |
3074 | + </div> |
3075 | + </div> |
3076 | + <!--mainWrap END--> |
3077 | +</body> |
3078 | +</html> |
3079 | |
3080 | === added directory 'vauxoomin/templates/controls' |
3081 | === modified file 'vauxoomin/templates/home.html' |
3082 | --- vauxoomin/templates/home.html 2012-02-13 13:34:37 +0000 |
3083 | +++ vauxoomin/templates/home.html 2012-03-21 00:56:22 +0000 |
3084 | @@ -1,13 +1,16 @@ |
3085 | {% autoescape None %} |
3086 | -{% extends "base.html" %} |
3087 | - |
3088 | -{% block body %} |
3089 | +{% extends "base_themed.html" %} |
3090 | + |
3091 | +{% block contentWrapSidebar %} |
3092 | + {{ modules.Twitter() }} |
3093 | +{% end %} |
3094 | + |
3095 | +{% block contentWrapMain %} |
3096 | <div class="home"> |
3097 | -<span>{{ _('Your instances availables.') }}</span> |
3098 | <ul class="red"> |
3099 | - {% for p in projects %} |
3100 | - {{ modules.Project(p) }} |
3101 | - {% end %} |
3102 | + {{ modules.DashBlock(projects,"Tus Projectos") }} |
3103 | </ul> |
3104 | </div> |
3105 | + {{ modules.WarningWidget('warningBox',"sented below is provided to assist you understand our licensing regime and the ways in which you may use the products which are available for sale on ThemeForest. This information does not form part of the license terms. In the event there is any inconsistency between the license terms and the following information then the license terms will prevail and will be what regulates your use of the product you buy.") }} |
3106 | + {{ modules.ImageGallery() }} |
3107 | {% end %} |
3108 | |
3109 | === added file 'vauxoomin/templates/home_profit.html' |
3110 | --- vauxoomin/templates/home_profit.html 1970-01-01 00:00:00 +0000 |
3111 | +++ vauxoomin/templates/home_profit.html 2012-03-21 00:56:22 +0000 |
3112 | @@ -0,0 +1,15 @@ |
3113 | +{% autoescape None %} |
3114 | +{% extends "base_themed.html" %} |
3115 | + |
3116 | +{% block contentWrapSidebar %} |
3117 | + {{ modules.Twitter() }} |
3118 | +{% end %} |
3119 | + |
3120 | +{% block contentWrapMain %} |
3121 | +<div class="home"> |
3122 | + <ul class="red"> |
3123 | + {{ modules.ListDbs(projects) }} |
3124 | + </ul> |
3125 | +</div> |
3126 | + {{ modules.ImageGallery() }} |
3127 | +{% end %} |
3128 | |
3129 | === added file 'vauxoomin/templates/home_project.html' |
3130 | --- vauxoomin/templates/home_project.html 1970-01-01 00:00:00 +0000 |
3131 | +++ vauxoomin/templates/home_project.html 2012-03-21 00:56:22 +0000 |
3132 | @@ -0,0 +1,18 @@ |
3133 | +{% autoescape None %} |
3134 | +{% extends "base_themed.html" %} |
3135 | +{% block contentWrapSidebar %} |
3136 | + {{ modules.Acordion(project) }} |
3137 | +{% end %} |
3138 | + |
3139 | +{% block contentWrapMain %} |
3140 | + {% if not config %} |
3141 | + {{ modules.WarningWidget('errorBox','Config file not found <a href="/action/%s/create_config">do you want create one?' % project) }} |
3142 | + {% end %} |
3143 | +<div class="home"> |
3144 | + <ul class="red"> |
3145 | + {{ modules.DashBranches(branches,"Tus Branches on: %s" % project) }} |
3146 | + </ul> |
3147 | +</div> |
3148 | +{% from main import server %} |
3149 | + {{ modules.TabedMenu('Log Information',[{'id':'log','title':'log','content':server.preprocess_logs(server.get_logs(project)) },{'id':'runing','title':'Services Running','content':server.get_status(project)},{'id':'quality','title':'Quality','content':server.get_quality(project)},{'id':'dblist','title':'DB List','content':server.get_dblist(project)},{'id':'backup','title':'Manage Backups','content':server.get_backups(project)}]) }} |
3150 | +{% end %} |
3151 | |
3152 | === modified file 'vauxoomin/templates/index.html' |
3153 | --- vauxoomin/templates/index.html 2012-02-16 12:15:10 +0000 |
3154 | +++ vauxoomin/templates/index.html 2012-03-21 00:56:22 +0000 |
3155 | @@ -1,3 +1,4 @@ |
3156 | +{% autoescape None %} |
3157 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
3158 | <html xmlns="http://www.w3.org/1999/xhtml"> |
3159 | <head> |
3160 | @@ -9,7 +10,7 @@ |
3161 | <style media="all" type="text/css">@import "/static/css/visualize.css";</style> |
3162 | <style media="all" type="text/css">@import "/static/css/colorbox.css";</style> |
3163 | <!--[if IE 6]> |
3164 | - <style media="all" type="text/static/css">@import "css/ie6.css";</style> |
3165 | + <style media="all" type="text/static/css">@import "css/ie6.css";</style> |
3166 | <style media="all" type="text/static/css">@import "css/colorbox-ie.csss";</style> |
3167 | <![endif]--> |
3168 | <script type="text/javascript" src="/static/js/jquery-1.4.2.min.js"></script> |
3169 | @@ -26,598 +27,52 @@ |
3170 | <![endif]--> |
3171 | </head> |
3172 | <body id="loggedInBody"> |
3173 | - <div id="mainWrap"> |
3174 | - <div id="headerWrap"> |
3175 | - <div id="systemMenu"> |
3176 | - <ul> |
3177 | - <li>Welcome John Doe</li> |
3178 | - <li class="seperator"><a href="#">My Account</a></li><!--seperator class is used for adding the seperator background between items--> |
3179 | - <li class="seperator"><a href="#">Logout</a></li> |
3180 | - </ul> |
3181 | - </div> |
3182 | - <div id="logo"> |
3183 | - <img src="/static/img/logo.png" alt="logo" /> |
3184 | - </div> |
3185 | - <div id="topNavigationWrap"> |
3186 | - <ul class="dropdown"> |
3187 | - <li class="current"> |
3188 | - <a href="#">Dashboard</a> |
3189 | - <ul class="sub_menu"> |
3190 | - <li><a href="#">Sub-Menu-1</a></li> |
3191 | - <li> |
3192 | - <a href="#">Sub-Menu-2</a> |
3193 | - <ul> |
3194 | - <li><a href="#">Sub-Menu-2-1</a></li> |
3195 | - |
3196 | - <li><a href="#">Sub-Menu-2-2</a></li> |
3197 | - </ul> |
3198 | - </li> |
3199 | - <li><a href="#">Sub-Menu-3</a></li> |
3200 | - <li><a href="#">Sub-Menu-4</a></li> |
3201 | - </ul> |
3202 | - </li> |
3203 | - |
3204 | - <li> |
3205 | - <a href="#">Products</a> |
3206 | - <ul class="sub_menu"> |
3207 | - <li><a href="#">Sub-Menu-1</a></li> |
3208 | - <li> |
3209 | - <a href="#">Sub-Menu-2</a> |
3210 | - <ul> |
3211 | - <li><a href="#">Sub-Menu-2-1</a></li> |
3212 | - |
3213 | - <li><a href="#">Sub-Menu-2-2</a></li> |
3214 | - </ul> |
3215 | - </li> |
3216 | - <li><a href="#">Sub-Menu-3</a></li> |
3217 | - <li><a href="#">Sub-Menu-4</a></li> |
3218 | - </ul> |
3219 | - </li> |
3220 | - |
3221 | - <li> |
3222 | - <a href="#">Orders</a> |
3223 | - <ul class="sub_menu"> |
3224 | - <li><a href="#">Sub-Menu-1</a></li> |
3225 | - <li> |
3226 | - <a href="#">Sub-Menu-2</a> |
3227 | - <ul> |
3228 | - <li><a href="#">Sub-Menu-2-1</a></li> |
3229 | - |
3230 | - <li><a href="#">Sub-Menu-2-2</a></li> |
3231 | - </ul> |
3232 | - </li> |
3233 | - <li><a href="#">Sub-Menu-3</a></li> |
3234 | - <li><a href="#">Sub-Menu-4</a></li> |
3235 | - </ul> |
3236 | - </li> |
3237 | - <li><a href="#">Members</a></li> |
3238 | - <li><a href="#">Settings</a></li> |
3239 | - </ul> |
3240 | - </div> |
3241 | - </div> |
3242 | - |
3243 | - <!--Rounded Corners For The Top - START--> |
3244 | - <div id="contentWrapTop"> |
3245 | - <div id="contentWrapTopLeft"></div> |
3246 | - <div id="contentWrapTopRight"></div> |
3247 | - </div> |
3248 | - <!--Rounded Corners For The Top - END--> |
3249 | - |
3250 | + <div id="mainWrap"> |
3251 | + <div id="headerWrap"> |
3252 | + <div id="systemMenu"> |
3253 | + {{ modules.TopMenu("") }} |
3254 | + </div> |
3255 | + <div id="logo"> |
3256 | + {{ modules.Logo("") }} |
3257 | + </div> |
3258 | + <div id="topNavigationWrap"> |
3259 | + <ul class="dropdown"> |
3260 | +<!-- Here will be the main menu--> |
3261 | + </ul> |
3262 | + </div> |
3263 | + </div> |
3264 | + |
3265 | + <!--Rounded Corners For The Top - START--> |
3266 | + <div id="contentWrapTop"> |
3267 | + <div id="contentWrapTopLeft"></div> |
3268 | + <div id="contentWrapTopRight"></div> |
3269 | + </div> |
3270 | + <!--Rounded Corners For The Top - END--> |
3271 | <!--contentWrap START--> |
3272 | - <div id="contentWrap"> |
3273 | - |
3274 | - <!--contentWrapSidebar START--> |
3275 | - <div id="contentWrapSidebar"> |
3276 | - |
3277 | - <div id="searchBox"> |
3278 | - <fieldset> |
3279 | - <legend>Search</legend> |
3280 | - <input size="15" class="formSmall" type="text" /> <input value="Go" class="button" type="submit" /> |
3281 | - <h6>(<a href="#" id="advancedSearchLink">advanced search options</a>)</h6> |
3282 | - <div id="advancedSearchWrap"> |
3283 | - <select name="listmenu"> |
3284 | - <option selected="selected">Select Category</option> |
3285 | - <option>Orders</option> |
3286 | - <option>Members</option> |
3287 | - </select> |
3288 | - <fieldset class="labelRadioCheckbox"> |
3289 | - <legend>Include Archives</legend> |
3290 | - <label for="yes" class="labelRadioCheckbox"><input name="gender" id="yes" value="Yes" type="radio" />Yes</label> |
3291 | - <label for="no" class="labelRadioCheckbox"><input name="gender" id="no" value="No" checked="checked" type="radio" />No</label> |
3292 | - </fieldset> |
3293 | - </div> |
3294 | - </fieldset> |
3295 | - </div> |
3296 | - |
3297 | - <fieldset> |
3298 | - <legend>Calendar</legend> |
3299 | - <div id="datepicker"></div> |
3300 | - </fieldset> |
3301 | - |
3302 | - |
3303 | - |
3304 | - <!--accordion START--> |
3305 | - <fieldset> |
3306 | - <legend>Accordion Menu</legend> |
3307 | - <div id="accordion"><!--The ID accordion is defined inside includes/static/js/custom.js. To create new accordion elements, a similar function inside "custom.js" must be added.--> |
3308 | - <h3><a href="#">Section 1</a></h3> |
3309 | - <div> |
3310 | - <ul> |
3311 | - <li>List item one</li> |
3312 | - <li>List item two</li> |
3313 | - <li>List item three</li> |
3314 | - </ul> |
3315 | - </div> |
3316 | - <h3><a href="#">Section 2</a></h3> |
3317 | - <div> |
3318 | - <p> |
3319 | - Sed non urna. |
3320 | - </p> |
3321 | - </div> |
3322 | - <h3><a href="#">Section 3</a></h3> |
3323 | - <div> |
3324 | - <ul> |
3325 | - <li>List item one</li> |
3326 | - <li>List item two</li> |
3327 | - <li>List item three</li> |
3328 | - </ul> |
3329 | - </div> |
3330 | - <h3><a href="#">Section 4</a></h3> |
3331 | - <div> |
3332 | - <p> |
3333 | - Cras dictum. |
3334 | - </p> |
3335 | - </div> |
3336 | - </div> |
3337 | - </fieldset> |
3338 | - <!--accordion END--> |
3339 | - </div> |
3340 | + <div id="contentWrap"> |
3341 | + <!--contentWrapSidebar START--> |
3342 | + <div id="contentWrapSidebar"> |
3343 | + </div> |
3344 | <!--contentWrapSidebar END--> |
3345 | - |
3346 | <!--contentWrapMain START--> |
3347 | - <div id="contentWrapMain"> |
3348 | - <div id="crumbsWrap"> |
3349 | - <ul id="crumbs"> |
3350 | - <li><a href="#">Home</a></li> |
3351 | - <li><a href="#">Orders</a></li> |
3352 | - <li><a href="#">List Orders</a></li> |
3353 | - <li class="bold">Approved Orders</li> |
3354 | - </ul> |
3355 | - </div> |
3356 | - |
3357 | - |
3358 | - <div class="warningBox">You have 1 unread messages.</div> |
3359 | - <h1>Dashboard</h1> |
3360 | - <div id="dashboardWrap"> |
3361 | - <ul> |
3362 | - <li> |
3363 | - <h3 class="noMargin">Users</h3> |
3364 | - <p>1316 approved, 23 un-approved users.</p> |
3365 | - </li> |
3366 | - <li> |
3367 | - <h3 class="noMargin">Orders</h3> |
3368 | - <p>18 approved, 5 un-approved and 3 un-sent orders.</p> |
3369 | - </li> |
3370 | - <li> |
3371 | - <h3 class="noMargin">Products</h3> |
3372 | - <p>121 active products and 3 passive products.</p> |
3373 | - </li> |
3374 | - <li> |
3375 | - <h3 class="noMargin">Categories</h3> |
3376 | - <p>8 main and 35 sub-categories.</p> |
3377 | - </li> |
3378 | - <li> |
3379 | - <h3 class="noMargin">Users</h3> |
3380 | - <p>1316 approved, 23 un-approved users.</p> |
3381 | - </li> |
3382 | - </ul> |
3383 | - </div> |
3384 | - |
3385 | - |
3386 | - <!--Charts START--> |
3387 | - <!--visualize and accessHide classes are required - visualize class is for styling the chart, accessHide is for hiding the original table - the id="chart" is defined in js/custom.js. For creating more charts a new similar function must be added to custom.js--> |
3388 | - <table id="chart" class="visualize accessHide"> |
3389 | - <caption>Sales Report</caption> |
3390 | - <thead> |
3391 | - <tr> |
3392 | - <td></td> |
3393 | - <th scope="col">Jan 2010</th> |
3394 | - <th scope="col">Feb 2010</th> |
3395 | - |
3396 | - <th scope="col">Mar 2010</th> |
3397 | - <th scope="col">Apr 2010</th> |
3398 | - <th scope="col">May 2010</th> |
3399 | - <th scope="col">June 2010</th> |
3400 | - </tr> |
3401 | - </thead> |
3402 | - <tbody> |
3403 | - <tr> |
3404 | - <th scope="row">Product 1</th> |
3405 | - <td>190</td> |
3406 | - <td>160</td> |
3407 | - <td>40</td> |
3408 | - <td>120</td> |
3409 | - |
3410 | - <td>30</td> |
3411 | - <td>70</td> |
3412 | - </tr> |
3413 | - <tr> |
3414 | - <th scope="row">Product 2</th> |
3415 | - <td>3</td> |
3416 | - <td>40</td> |
3417 | - |
3418 | - <td>30</td> |
3419 | - <td>45</td> |
3420 | - <td>35</td> |
3421 | - <td>49</td> |
3422 | - </tr> |
3423 | - <tr> |
3424 | - <th scope="row">Product 3</th> |
3425 | - |
3426 | - <td>10</td> |
3427 | - <td>180</td> |
3428 | - <td>10</td> |
3429 | - <td>85</td> |
3430 | - <td>25</td> |
3431 | - <td>79</td> |
3432 | - |
3433 | - </tr> |
3434 | - <tr> |
3435 | - <th scope="row">Product 4</th> |
3436 | - <td>40</td> |
3437 | - <td>80</td> |
3438 | - <td>90</td> |
3439 | - <td>25</td> |
3440 | - |
3441 | - <td>15</td> |
3442 | - <td>119</td> |
3443 | - </tr> |
3444 | - </tbody> |
3445 | - </table> |
3446 | - <!--Charts END--> |
3447 | - |
3448 | - |
3449 | - |
3450 | - |
3451 | - <div class="titleWrap"> |
3452 | - <h1>Approved Orders</h1> |
3453 | - <ul> |
3454 | - <li class="standardForm"> |
3455 | - <select name="listmenu"> |
3456 | - <option selected="selected">Bulk Actions</option> |
3457 | - <option>Delete Selected</option> |
3458 | - <option>Edit Selected</option> |
3459 | - </select> |
3460 | - </li> |
3461 | - <li class="seperator"><img src="/static/img/icons/add.png" alt="add" /> <a href="#">Add New</a></li> |
3462 | - </ul> |
3463 | - </div> |
3464 | - <table class="listing fluid" cellpadding="0" cellspacing="0"> |
3465 | - <tbody> |
3466 | - <tr> |
3467 | - <th class="left"><input type="checkbox" name="checkbox2" value="checkbox" /></th> |
3468 | - <th>Name Surname <img src="/static/img/icons/arrow_down.png" alt="down" /><img src="/static/img/icons/arrow_up.png" alt="up" /></th> |
3469 | - <th>City <img src="/static/img/icons/arrow_down.png" alt="down" /><img src="/static/img/icons/arrow_up.png" alt="up" /></th> |
3470 | - <th>Country <img src="/static/img/icons/arrow_down.png" alt="down" /><img src="/static/img/icons/arrow_up.png" alt="up" /></th> |
3471 | - <th>Age <img src="/static/img/icons/arrow_down.png" alt="down" /><img src="/static/img/icons/arrow_up.png" alt="up" /></th> |
3472 | - <th>Actions</th> |
3473 | - </tr> |
3474 | - <tr class="row1"> |
3475 | - <td><input type="checkbox" name="checkbox2" value="checkbox" /></td> |
3476 | - <td>- John Doe </td> |
3477 | - <td>Washington DC </td> |
3478 | - <td>USA</td> |
3479 | - <td>32</td> |
3480 | - <td><img src="/static/img/icons/page_edit.png" alt="edit" width="16" height="16" /> <img src="/static/img/icons/add.png" alt="add" width="16" height="16" /> <img src="/static/img/icons/delete.png" alt="delete" width="16" height="16" /></td> |
3481 | - </tr> |
3482 | - <tr class="row2"> |
3483 | - <td><input type="checkbox" name="checkbox2" value="checkbox" /></td> |
3484 | - <td>- Thierry Mugler </td> |
3485 | - <td>Paris</td> |
3486 | - <td>France</td> |
3487 | - <td>28</td> |
3488 | - <td><img src="/static/img/icons/page_edit.png" alt="edit" width="16" height="16" /> <img src="/static/img/icons/add.png" alt="add" width="16" height="16" /> <img src="/static/img/icons/delete.png" alt="delete" width="16" height="16" /></td> |
3489 | - </tr> |
3490 | - <tr class="row1"> |
3491 | - <td><input type="checkbox" name="checkbox3" value="checkbox" /></td> |
3492 | - <td>- Jose Manta </td> |
3493 | - <td>Madrid</td> |
3494 | - <td>Spain</td> |
3495 | - <td>21</td> |
3496 | - <td><img src="/static/img/icons/page_edit.png" alt="edit" width="16" height="16" /> <img src="/static/img/icons/add.png" alt="add" width="16" height="16" /> <img src="/static/img/icons/delete.png" alt="delete" width="16" height="16" /></td> |
3497 | - </tr> |
3498 | - <tr class="row2"> |
3499 | - <td><input type="checkbox" name="checkbox4" value="checkbox" /></td> |
3500 | - <td>- Michael Luvsum </td> |
3501 | - <td>Berlin</td> |
3502 | - <td>Germany</td> |
3503 | - <td>22</td> |
3504 | - <td><img src="/static/img/icons/page_edit.png" alt="edit" width="16" height="16" /> <img src="/static/img/icons/add.png" alt="add" width="16" height="16" /> <img src="/static/img/icons/delete.png" alt="delete" width="16" height="16" /></td> |
3505 | - </tr> |
3506 | - <tr class="row1"> |
3507 | - <td><input type="checkbox" name="checkbox4" value="checkbox" /></td> |
3508 | - <td>- Adrian Tamoe</td> |
3509 | - <td>Zurich</td> |
3510 | - <td>Switzerland</td> |
3511 | - <td>30</td> |
3512 | - <td><img src="/static/img/icons/page_edit.png" alt="edit" width="16" height="16" /> <img src="/static/img/icons/add.png" alt="add" width="16" height="16" /> <img src="/static/img/icons/delete.png" alt="delete" width="16" height="16" /></td> |
3513 | - </tr> |
3514 | - <tr class="row2"> |
3515 | - <td><input type="checkbox" name="checkbox4" value="checkbox" /></td> |
3516 | - <td>- George Rusen</td> |
3517 | - <td>Bucharest</td> |
3518 | - <td>Romania</td> |
3519 | - <td>26</td> |
3520 | - <td><img src="/static/img/icons/page_edit.png" alt="edit" width="16" height="16" /> <img src="/static/img/icons/add.png" alt="add" width="16" height="16" /> <img src="/static/img/icons/delete.png" alt="delete" width="16" height="16" /></td> |
3521 | - </tr> |
3522 | - <tr class="row1"> |
3523 | - <td><input type="checkbox" name="checkbox4" value="checkbox" /></td> |
3524 | - <td>- Rodney Mullen</td> |
3525 | - <td>San Francisco</td> |
3526 | - <td>USA</td> |
3527 | - <td>39</td> |
3528 | - <td><img src="/static/img/icons/page_edit.png" alt="edit" width="16" height="16" /> <img src="/static/img/icons/add.png" alt="add" width="16" height="16" /> <img src="/static/img/icons/delete.png" alt="delete" width="16" height="16" /></td> |
3529 | - </tr> |
3530 | - <tr class="row2"> |
3531 | - <td><input type="checkbox" name="checkbox4" value="checkbox" /></td> |
3532 | - <td>- Michael Luvsum </td> |
3533 | - <td>Berlin</td> |
3534 | - <td>Germany</td> |
3535 | - <td>22</td> |
3536 | - <td><img src="/static/img/icons/page_edit.png" alt="edit" width="16" height="16" /> <img src="/static/img/icons/add.png" alt="add" width="16" height="16" /> <img src="/static/img/icons/delete.png" alt="delete" width="16" height="16" /></td> |
3537 | - </tr> |
3538 | - <tr class="row1"> |
3539 | - <td><input type="checkbox" name="checkbox4" value="checkbox" /></td> |
3540 | - <td>- Adrian Tamoe</td> |
3541 | - <td>Zurich</td> |
3542 | - <td>Switzerland</td> |
3543 | - <td>30</td> |
3544 | - <td><img src="/static/img/icons/page_edit.png" alt="edit" width="16" height="16" /> <img src="/static/img/icons/add.png" alt="add" width="16" height="16" /> <img src="/static/img/icons/delete.png" alt="delete" width="16" height="16" /></td> |
3545 | - </tr> |
3546 | - <tr class="row2"> |
3547 | - <td><input type="checkbox" name="checkbox4" value="checkbox" /></td> |
3548 | - <td>- George Rusen</td> |
3549 | - <td>Bucharest</td> |
3550 | - <td>Romania</td> |
3551 | - <td>26</td> |
3552 | - <td><img src="/static/img/icons/page_edit.png" alt="edit" width="16" height="16" /> <img src="/static/img/icons/add.png" alt="add" width="16" height="16" /> <img src="/static/img/icons/delete.png" alt="delete" width="16" height="16" /></td> |
3553 | - </tr> |
3554 | - <tr class="row1"> |
3555 | - <td><input type="checkbox" name="checkbox4" value="checkbox" /></td> |
3556 | - <td>- Rodney Mullen</td> |
3557 | - <td>San Francisco</td> |
3558 | - <td>USA</td> |
3559 | - <td>39</td> |
3560 | - <td><img src="/static/img/icons/page_edit.png" alt="edit" width="16" height="16" /> <img src="/static/img/icons/add.png" alt="add" width="16" height="16" /> <img src="/static/img/icons/delete.png" alt="delete" width="16" height="16" /></td> |
3561 | - </tr> |
3562 | - </tbody> |
3563 | - </table> |
3564 | - <div class="paginationWrap"> |
3565 | - <ul> |
3566 | - <li class="previous-off">«Previous</li> |
3567 | - <li class="active">1</li> |
3568 | - <li><a href="?page=2">2</a></li> |
3569 | - <li><a href="?page=3">3</a></li> |
3570 | - <li><a href="?page=4">4</a></li> |
3571 | - <li><a href="?page=5">5</a></li> |
3572 | - <li><a href="?page=6">6</a></li> |
3573 | - <li><a href="?page=7">7</a></li> |
3574 | - <li class="next"><a href="?page=8">Next »</a></li> |
3575 | - </ul> |
3576 | - </div> |
3577 | - |
3578 | - |
3579 | - <!--Tabbed Menu - START--> |
3580 | - <h1>Tabbed Menu</h1> |
3581 | - <div id="tabs"><!--The ID tabs is defined inside includes/static/js/custom.js. To create new tabbed menus, a similar function inside "custom.js" must be added.--> |
3582 | - <ul> |
3583 | - <li><a href="#tabs-1">Nunc tincidunt</a></li> |
3584 | - <li><a href="#tabs-2">Proin dolor</a></li> |
3585 | - <li><a href="#tabs-3">Aenean lacinia</a></li> |
3586 | - </ul> |
3587 | - <div id="tabs-1"> |
3588 | - <p>Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.</p> |
3589 | - </div> |
3590 | - <div id="tabs-2"> |
3591 | - <p>Morbi tincidunt, dui sit amet facilisis feugiat, odio metus gravida ante, ut pharetra massa metus id nunc. Duis scelerisque molestie turpis. Sed fringilla, massa eget luctus malesuada, metus eros molestie lectus, ut tempus eros massa ut dolor. Aenean aliquet fringilla sem. Suspendisse sed ligula in ligula suscipit aliquam. Praesent in eros vestibulum mi adipiscing adipiscing. Morbi facilisis. Curabitur ornare consequat nunc. Aenean vel metus. Ut posuere viverra nulla. Aliquam erat volutpat. Pellentesque convallis. Maecenas feugiat, tellus pellentesque pretium posuere, felis lorem euismod felis, eu ornare leo nisi vel felis. Mauris consectetur tortor et purus.</p> |
3592 | - </div> |
3593 | - <div id="tabs-3"> |
3594 | - <p>Mauris eleifend est et turpis. Duis id erat. Suspendisse potenti. Aliquam vulputate, pede vel vehicula accumsan, mi neque rutrum erat, eu congue orci lorem eget lorem. Vestibulum non ante. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Fusce sodales. Quisque eu urna vel enim commodo pellentesque. Praesent eu risus hendrerit ligula tempus pretium. Curabitur lorem enim, pretium nec, feugiat nec, luctus a, lacus.</p> |
3595 | - <p>Duis cursus. Maecenas ligula eros, blandit nec, pharetra at, semper at, magna. Nullam ac lacus. Nulla facilisi. Praesent viverra justo vitae neque. Praesent blandit adipiscing velit. Suspendisse potenti. Donec mattis, pede vel pharetra blandit, magna ligula faucibus eros, id euismod lacus dolor eget odio. Nam scelerisque. Donec non libero sed nulla mattis commodo. Ut sagittis. Donec nisi lectus, feugiat porttitor, tempor ac, tempor vitae, pede. Aenean vehicula velit eu tellus interdum rutrum. Maecenas commodo. Pellentesque nec elit. Fusce in lacus. Vivamus a libero vitae lectus hendrerit hendrerit.</p> |
3596 | - </div> |
3597 | - </div> |
3598 | - <!--Tabbed Menu - END--> |
3599 | - |
3600 | - <!--Accordion - START--> |
3601 | - <h1>Accordion</h1> |
3602 | - <div class="accordionWrap"> |
3603 | - <div id="accordion2" class="acco"><!--The ID accordion2 is defined inside includes/static/js/custom.js. To create new accordion elements, a similar function inside "custom.js" must be added.--> |
3604 | - <h3><a href="#">Section 1</a></h3> |
3605 | - <div> |
3606 | - <p> |
3607 | - Mauris |
3608 | - </p> |
3609 | - </div> |
3610 | - <h3><a href="#">Section 2</a></h3> |
3611 | - <div> |
3612 | - <p> |
3613 | - Sed non urna. |
3614 | - </p> |
3615 | - </div> |
3616 | - <h3><a href="#">Section 3</a></h3> |
3617 | - <div> |
3618 | - <ul> |
3619 | - <li>List item one</li> |
3620 | - <li>List item two</li> |
3621 | - <li>List item three</li> |
3622 | - </ul> |
3623 | - </div> |
3624 | - <h3><a href="#">Section 4</a></h3> |
3625 | - <div> |
3626 | - <p> |
3627 | - Cras dictum. |
3628 | - </p> |
3629 | - </div> |
3630 | - </div> |
3631 | - </div> |
3632 | - <!--Accordion - END--> |
3633 | - |
3634 | - |
3635 | - <!--Form - START--> |
3636 | - <h1>New User</h1> |
3637 | - <div class="standardForm"> |
3638 | - <form action="index.html" method="post"> |
3639 | - <label for="name">Name</label> |
3640 | - <input id="name" type="text" /> |
3641 | - <label for="username">Username</label> |
3642 | - <input id="username" type="text" /> <span class="formError">Username can't be blank!</span> |
3643 | - <label for="shortInfo">Short Info</label> |
3644 | - <textarea rows="8" cols="1" class="formHuge" id="shortInfo"></textarea> |
3645 | - <div><!--We place fieldsets with display-inline inside div to better position them--> |
3646 | - <fieldset class="formHuge labelRadioCheckbox"> |
3647 | - <legend>Gender</legend> |
3648 | - <label for="male" class="labelRadioCheckbox"><input name="gender" id="male" value="Male" type="radio" />Male</label> |
3649 | - <label for="female" class="labelRadioCheckbox"><input name="gender" id="female" value="Female" checked="checked" type="radio" />Female</label> |
3650 | - </fieldset> <span class="formError">Gender must be selected!</span> |
3651 | - </div> |
3652 | - <label for="address">Address</label> |
3653 | - <input id="address" class="formHuge" type="text" /> |
3654 | - <div> <!--We place fieldsets with display-inline inside div to better position them--> |
3655 | - <fieldset class="formHuge labelRadioCheckbox"> |
3656 | - <legend>Age:</legend> |
3657 | - <label for="y18-25"><input name="18-25" id="y18-25" value="18-25" type="checkbox" />18-25</label> |
3658 | - <label for="y25-30"><input name="25-30" id="y25-30" value="25-30" type="checkbox" />25-30</label> |
3659 | - <label for="y30-40"><input name="30-40" id="y30-40" value="30-40" type="checkbox" />30-40 (if more, please select this)</label> |
3660 | - </fieldset> |
3661 | - </div> |
3662 | - <label for="password">Password</label> |
3663 | - <input id="password" type="password" /><br /> |
3664 | - <div><!--We need to use this div to keep the "submit button" and the "loader image" together.--> |
3665 | - <input type="submit" value="Submit" class="formButton" /> <img src="/static/img/ajax-loader.gif" alt="Ajax Loader" /> |
3666 | - </div> |
3667 | - </form> |
3668 | - </div> |
3669 | - <!--Form - END--> |
3670 | - |
3671 | - |
3672 | - <div class="infoBox">Info message</div> |
3673 | - <div class="successBox">Successful operation message</div> |
3674 | - <div class="warningBox">Warning message</div> |
3675 | - <div class="errorBox">Error message</div> |
3676 | - |
3677 | - |
3678 | - <!--Images - START--> |
3679 | - <div class="titleWrap"> |
3680 | - <h1>Images</h1> |
3681 | - <ul> |
3682 | - <li><img src="/static/img/icons/add.png" alt="add" /> <a href="#">Add New</a></li> |
3683 | - </ul> |
3684 | - </div> |
3685 | - <div class="imagesWrap"> |
3686 | - <div class="imagesListed"> |
3687 | - <ul> |
3688 | - <li> |
3689 | - <p class="imageInfo"> |
3690 | - textimage.png (18.4kb) |
3691 | - </p> |
3692 | - <!--In order to display images inside the Lightbox, simply add them the class "colorBoxElement" (can be customized from "inc/static/js/custom.js"), mention the original image inside the "href" and use the "title" information for displaying info about the image.--> |
3693 | - <a href="/static/img/image-placeholder-big.gif" title="Original Image" class="colorBoxElement"><img src="/static/img/image-placeholder.gif" alt="image" /></a> |
3694 | - <p class="imageActions"> |
3695 | - <img src="/static/img/icons/page_white_go.png" alt="details" width="16" height="16" /> Details <img src="/static/img/icons/page_edit.png" alt="edit" width="16" height="16" /> Edit <img src="/static/img/icons/delete.png" alt="delete" width="16" height="16" /> Delete |
3696 | - </p> |
3697 | - </li> |
3698 | - <li> |
3699 | - <p class="imageInfo"> |
3700 | - textimage.png (18.4kb) |
3701 | - </p> |
3702 | - <a href="/static/img/image-placeholder-big.gif" title="Original Image" class="colorBoxElement"><img src="/static/img/image-placeholder.gif" alt="image" /></a> |
3703 | - <p class="imageActions"> |
3704 | - <img src="/static/img/icons/page_white_go.png" alt="details" width="16" height="16" /> Details <img src="/static/img/icons/page_edit.png" alt="edit" width="16" height="16" /> Edit <img src="/static/img/icons/delete.png" alt="delete" width="16" height="16" /> Delete |
3705 | - </p> |
3706 | - </li> |
3707 | - <li> |
3708 | - <p class="imageInfo"> |
3709 | - textimage.png (18.4kb) |
3710 | - </p> |
3711 | - <a href="/static/img/image-placeholder-big.gif" title="Original Image" class="colorBoxElement"><img src="/static/img/image-placeholder.gif" alt="image" /></a> |
3712 | - <p class="imageActions"> |
3713 | - <img src="/static/img/icons/page_white_go.png" alt="details" width="16" height="16" /> Details <img src="/static/img/icons/page_edit.png" alt="edit" width="16" height="16" /> Edit <img src="/static/img/icons/delete.png" alt="delete" width="16" height="16" /> Delete |
3714 | - </p> |
3715 | - </li> |
3716 | - <li> |
3717 | - <p class="imageInfo"> |
3718 | - textimage.png (18.4kb) |
3719 | - </p> |
3720 | - <a href="/static/img/image-placeholder-big.gif" title="Original Image" class="colorBoxElement"><img src="/static/img/image-placeholder.gif" alt="image" /></a> |
3721 | - <p class="imageActions"> |
3722 | - <img src="/static/img/icons/page_white_go.png" alt="details" width="16" height="16" /> Details <img src="/static/img/icons/page_edit.png" alt="edit" width="16" height="16" /> Edit <img src="/static/img/icons/delete.png" alt="delete" width="16" height="16" /> Delete |
3723 | - </p> |
3724 | - </li> |
3725 | - <li> |
3726 | - <p class="imageInfo"> |
3727 | - textimage.png (18.4kb) |
3728 | - </p> |
3729 | - <a href="/static/img/image-placeholder-big.gif" title="Original Image" class="colorBoxElement"><img src="/static/img/image-placeholder.gif" alt="image" /></a> |
3730 | - <p class="imageActions"> |
3731 | - <img src="/static/img/icons/page_white_go.png" alt="details" width="16" height="16" /> Details <img src="/static/img/icons/page_edit.png" alt="edit" width="16" height="16" /> Edit <img src="/static/img/icons/delete.png" alt="delete" width="16" height="16" /> Delete |
3732 | - </p> |
3733 | - </li> |
3734 | - <li> |
3735 | - <p class="imageInfo"> |
3736 | - textimage.png (18.4kb) |
3737 | - </p> |
3738 | - <a href="/static/img/image-placeholder-big.gif" title="Original Image" class="colorBoxElement"><img src="/static/img/image-placeholder.gif" alt="image" /></a> |
3739 | - <p class="imageActions"> |
3740 | - <img src="/static/img/icons/page_white_go.png" alt="details" width="16" height="16" /> Details <img src="/static/img/icons/page_edit.png" alt="edit" width="16" height="16" /> Edit <img src="/static/img/icons/delete.png" alt="delete" width="16" height="16" /> Delete |
3741 | - </p> |
3742 | - </li> |
3743 | - |
3744 | - </ul> |
3745 | - </div> |
3746 | - <div class="paginationWrap"> |
3747 | - <ul class="pagination"> |
3748 | - <li class="previous-off">«Previous</li> |
3749 | - <li class="active">1</li> |
3750 | - <li><a href="?page=2">2</a></li> |
3751 | - <li><a href="?page=3">3</a></li> |
3752 | - <li><a href="?page=4">4</a></li> |
3753 | - <li><a href="?page=5">5</a></li> |
3754 | - <li><a href="?page=6">6</a></li> |
3755 | - <li><a href="?page=7">7</a></li> |
3756 | - <li class="next"><a href="?page=8">Next »</a></li> |
3757 | - </ul> |
3758 | - </div> |
3759 | - </div> |
3760 | - <!--Images - END--> |
3761 | - |
3762 | - |
3763 | + <div id="contentWrapMain"> |
3764 | <div id="contentTitleWrap"> |
3765 | - <h1>h1 - Hello There</h1> |
3766 | - <h2>h2 - Hello There</h2> |
3767 | - <h3>h3 - Hello There</h3> |
3768 | - <h4>h4 - Hello There</h4> |
3769 | - <h5>h5 - Hello There</h5> |
3770 | - <h6>h6 - Hello There</h6> |
3771 | - </div> |
3772 | - |
3773 | - |
3774 | + </div> |
3775 | <div id="contentWrapMainBottomSpacer"></div> |
3776 | </div> |
3777 | - <!--contentWrapMain END--> |
3778 | + <!--contentWrapMain END--> |
3779 | </div> |
3780 | - <!--contentWrap END--> |
3781 | + <!--contentWrap END--> |
3782 | |
3783 | <div id="contentWrapBottom"> |
3784 | <div id="contentWrapBottomLeft"></div> |
3785 | - <div id="contentWrapBottomRight"></div> |
3786 | + <div id="contentWrapBottomRight"></div> |
3787 | </div> |
3788 | |
3789 | <div id="footerWrap"> |
3790 | 2009-2010 Admin Templates |
3791 | </div> |
3792 | - |
3793 | - </div> |
3794 | + </div> |
3795 | <!--mainWrap END--> |
3796 | - |
3797 | </body> |
3798 | </html> |
3799 | |
3800 | === modified file 'vauxoomin/templates/modules/left.html' |
3801 | --- vauxoomin/templates/modules/left.html 2012-02-13 13:34:37 +0000 |
3802 | +++ vauxoomin/templates/modules/left.html 2012-03-21 00:56:22 +0000 |
3803 | @@ -1,4 +1,4 @@ |
3804 | - <li><a class="current"href="/action/{{ instance }}/copy_instance" title="Make a copy of the _main_ db 'produccion' by default"><span>Clone Instance</span></a></li> |
3805 | + <li></li> |
3806 | <li><a class="current"href="/action/{{ instance }}/clone_main_db" title="With this you will create an exact copy of this instance (Ports and modules will be configures automatically)"><span>Clone Main DB</span></a></li> |
3807 | <li><a class="current" href="" title="It will stop this server"><span>Stop Server</span></a></li> |
3808 | <li><a class="current" href="" title="It will restart this server"><span>ReStart Server</span></a></li> |
3809 | |
3810 | === modified file 'vauxoomin/templates/notfound.html' |
3811 | --- vauxoomin/templates/notfound.html 2012-02-12 16:53:59 +0000 |
3812 | +++ vauxoomin/templates/notfound.html 2012-03-21 00:56:22 +0000 |
3813 | @@ -1,4 +1,4 @@ |
3814 | -{% extends "base.html" %} |
3815 | -{% block body %} |
3816 | +{% extends "base_themed.html" %} |
3817 | +{% block contentWrapMain %} |
3818 | <div class="notfound"><a href="/"><img src="/static/images/404.png"></img></a></div> |
3819 | {% end %} |
3820 | |
3821 | === added file 'vauxoomin/templates/templateAreas.png' |
3822 | Binary files vauxoomin/templates/templateAreas.png 1970-01-01 00:00:00 +0000 and vauxoomin/templates/templateAreas.png 2012-03-21 00:56:22 +0000 differ |
3823 | === added directory 'vauxoomin/templates/widgets' |
3824 | === added file 'vauxoomin/templates/widgets/acordion_menu.html' |
3825 | --- vauxoomin/templates/widgets/acordion_menu.html 1970-01-01 00:00:00 +0000 |
3826 | +++ vauxoomin/templates/widgets/acordion_menu.html 2012-03-21 00:56:22 +0000 |
3827 | @@ -0,0 +1,37 @@ |
3828 | +<fieldset> |
3829 | + <legend>{{ menu }}</legend> |
3830 | + <div id="accordion"><!--The ID accordion is defined inside includes/static/js/custom.js. To create new accordion elements, a similar function inside "custom.js" must be added.--> |
3831 | +<!-- <h3><a href="#">Section 1</a></h3>--> |
3832 | +<!-- <div>--> |
3833 | +<!-- <ul>--> |
3834 | +<!-- <li>List item one</li>--> |
3835 | +<!-- <li>List item two</li>--> |
3836 | +<!-- <li>List item three</li>--> |
3837 | +<!-- </ul>--> |
3838 | +<!-- </div>--> |
3839 | + <h3><a href="#">Actions on Server</a></h3> |
3840 | + <div> |
3841 | + <ul> |
3842 | + <li><a href="/action/{{ menu }}/copy_instance" title="Make a copy of the _main_ db 'produccion' by default">Clone Instance</a></li> |
3843 | + <li><a href="" title="It will stop this server"><span>Stop</span></a></li> |
3844 | + <li><a href="" title="It will restart this server"><span>ReStart</span></a></li> |
3845 | + <li><a href="/action/{{ menu }}/start_server" title="It will start this server"><span>Start</span></a></li> |
3846 | + <li><a href="" title="It will start this server updating a module"><span>Start and Update</span></a></li> |
3847 | + </ul> |
3848 | + </div> |
3849 | + <h3><a href="#">Configs</a></h3> |
3850 | + <div> |
3851 | + {% for s in submenus %} |
3852 | + <p> |
3853 | + <b>{{ s }}</b>:{{ submenus[s] }} |
3854 | + </p> |
3855 | + {% end %} |
3856 | + </div> |
3857 | +<!-- <h3><a href="#">Section 4</a></h3>--> |
3858 | +<!-- <div>--> |
3859 | +<!-- <p>--> |
3860 | +<!-- Cras dictum.--> |
3861 | +<!-- </p>--> |
3862 | +<!-- </div>--> |
3863 | + </div> |
3864 | +</fieldset> |
3865 | |
3866 | === added file 'vauxoomin/templates/widgets/acordion_wrap.html' |
3867 | --- vauxoomin/templates/widgets/acordion_wrap.html 1970-01-01 00:00:00 +0000 |
3868 | +++ vauxoomin/templates/widgets/acordion_wrap.html 2012-03-21 00:56:22 +0000 |
3869 | @@ -0,0 +1,31 @@ |
3870 | + <h1>Accordion</h1> |
3871 | + <div class="accordionWrap"> |
3872 | + <div id="accordion2" class="acco"><!--The ID accordion2 is defined inside includes/static/js/custom.js. To create new accordion elements, a similar function inside "custom.js" must be added.--> |
3873 | + <h3><a href="#">Section 1</a></h3> |
3874 | + <div> |
3875 | + <p> |
3876 | + Mauris |
3877 | + </p> |
3878 | + </div> |
3879 | + <h3><a href="#">Section 2</a></h3> |
3880 | + <div> |
3881 | + <p> |
3882 | + Sed non urna. |
3883 | + </p> |
3884 | + </div> |
3885 | + <h3><a href="#">Section 3</a></h3> |
3886 | + <div> |
3887 | + <ul> |
3888 | + <li>List item one</li> |
3889 | + <li>List item two</li> |
3890 | + <li>List item three</li> |
3891 | + </ul> |
3892 | + </div> |
3893 | + <h3><a href="#">Section 4</a></h3> |
3894 | + <div> |
3895 | + <p> |
3896 | + Cras dictum. |
3897 | + </p> |
3898 | + </div> |
3899 | + </div> |
3900 | + </div> |
3901 | |
3902 | === added file 'vauxoomin/templates/widgets/calendar.html' |
3903 | --- vauxoomin/templates/widgets/calendar.html 1970-01-01 00:00:00 +0000 |
3904 | +++ vauxoomin/templates/widgets/calendar.html 2012-03-21 00:56:22 +0000 |
3905 | @@ -0,0 +1,4 @@ |
3906 | +<fieldset> |
3907 | + <legend>Calendar</legend> |
3908 | + <div id="datepicker"></div> |
3909 | +</fieldset> |
3910 | |
3911 | === added file 'vauxoomin/templates/widgets/chart.html' |
3912 | --- vauxoomin/templates/widgets/chart.html 1970-01-01 00:00:00 +0000 |
3913 | +++ vauxoomin/templates/widgets/chart.html 2012-03-21 00:56:22 +0000 |
3914 | @@ -0,0 +1,59 @@ |
3915 | +<!--visualize and accessHide classes are required - visualize class is for styling the chart, accessHide is for hiding the original table - the id="chart" is defined in js/custom.js. For creating more charts a new similar function must be added to custom.js--> |
3916 | +<table id="chart" class="visualize accessHide"> |
3917 | + <caption>Sales Report</caption> |
3918 | + <thead> |
3919 | + <tr> |
3920 | + <td></td> |
3921 | + <th scope="col">Jan 2010</th> |
3922 | + <th scope="col">Feb 2010</th> |
3923 | + |
3924 | + <th scope="col">Mar 2010</th> |
3925 | + <th scope="col">Apr 2010</th> |
3926 | + <th scope="col">May 2010</th> |
3927 | + <th scope="col">June 2010</th> |
3928 | + </tr> |
3929 | + </thead> |
3930 | + <tbody> |
3931 | + <tr> |
3932 | + <th scope="row">Product 1</th> |
3933 | + <td>190</td> |
3934 | + <td>160</td> |
3935 | + <td>40</td> |
3936 | + <td>120</td> |
3937 | + |
3938 | + <td>30</td> |
3939 | + <td>70</td> |
3940 | + </tr> |
3941 | + <tr> |
3942 | + <th scope="row">Product 2</th> |
3943 | + <td>3</td> |
3944 | + <td>40</td> |
3945 | + |
3946 | + <td>30</td> |
3947 | + <td>45</td> |
3948 | + <td>35</td> |
3949 | + <td>49</td> |
3950 | + </tr> |
3951 | + <tr> |
3952 | + <th scope="row">Product 3</th> |
3953 | + |
3954 | + <td>10</td> |
3955 | + <td>180</td> |
3956 | + <td>10</td> |
3957 | + <td>85</td> |
3958 | + <td>25</td> |
3959 | + <td>79</td> |
3960 | + |
3961 | + </tr> |
3962 | + <tr> |
3963 | + <th scope="row">Product 4</th> |
3964 | + <td>40</td> |
3965 | + <td>80</td> |
3966 | + <td>90</td> |
3967 | + <td>25</td> |
3968 | + |
3969 | + <td>15</td> |
3970 | + <td>119</td> |
3971 | + </tr> |
3972 | + </tbody> |
3973 | +</table> |
3974 | |
3975 | === added file 'vauxoomin/templates/widgets/code.html' |
3976 | --- vauxoomin/templates/widgets/code.html 1970-01-01 00:00:00 +0000 |
3977 | +++ vauxoomin/templates/widgets/code.html 2012-03-21 00:56:22 +0000 |
3978 | @@ -0,0 +1,3 @@ |
3979 | +{% autoescape None %} |
3980 | +<!--Use==> warningBox, infoBox, successBox, errorBox--> |
3981 | +<pre class="code">{{ message }}</pre> |
3982 | |
3983 | === added file 'vauxoomin/templates/widgets/crumbs.html' |
3984 | --- vauxoomin/templates/widgets/crumbs.html 1970-01-01 00:00:00 +0000 |
3985 | +++ vauxoomin/templates/widgets/crumbs.html 2012-03-21 00:56:22 +0000 |
3986 | @@ -0,0 +1,8 @@ |
3987 | +<div id="crumbsWrap"> |
3988 | + <ul id="crumbs"> |
3989 | + <li><a href="#">Home</a></li> |
3990 | + <li><a href="#">Orders</a></li> |
3991 | + <li><a href="#">List Orders</a></li> |
3992 | + <li class="bold">Approved Orders</li> |
3993 | + </ul> |
3994 | +</div> |
3995 | |
3996 | === added file 'vauxoomin/templates/widgets/dash_blocks.html' |
3997 | --- vauxoomin/templates/widgets/dash_blocks.html 1970-01-01 00:00:00 +0000 |
3998 | +++ vauxoomin/templates/widgets/dash_blocks.html 2012-03-21 00:56:22 +0000 |
3999 | @@ -0,0 +1,12 @@ |
4000 | +<h1>{{ context_message }}</h1> |
4001 | +<div id="dashboardWrap"> |
4002 | + <ul> |
4003 | + {% for p in elements %} |
4004 | + <li> |
4005 | + <h3 class="noMargin">{{ p }}</h3> |
4006 | + <p>{{ p }}</p> |
4007 | + <a href="/{{ p }}" title="Go to {{ p }} details"><img src="/static/img/icons/browse_1.png" alt="edit" width="16" height="16" /> </a> |
4008 | + </li> |
4009 | + {% end %} |
4010 | + </ul> |
4011 | +</div> |
4012 | |
4013 | === added file 'vauxoomin/templates/widgets/dash_branches.html' |
4014 | --- vauxoomin/templates/widgets/dash_branches.html 1970-01-01 00:00:00 +0000 |
4015 | +++ vauxoomin/templates/widgets/dash_branches.html 2012-03-21 00:56:22 +0000 |
4016 | @@ -0,0 +1,13 @@ |
4017 | +<h1>{{ context_message }}</h1> |
4018 | +<div id="dashboardWrap"> |
4019 | + <ul> |
4020 | + {% for p in elements %} |
4021 | + <li> |
4022 | + <h3 class="noMargin">{{ p[1] }}</h3> |
4023 | + <p>{{ p[0] }}</p> |
4024 | + <p>{{ p[2] }}</p> |
4025 | + <a href="{{ p[3] }}" title="Go to {{ p[0] }} details"><img src="/static/img/icons/browse_1.png" alt="edit" width="16" height="16" /> </a> |
4026 | + </li> |
4027 | + {% end %} |
4028 | + </ul> |
4029 | +</div> |
4030 | |
4031 | === added file 'vauxoomin/templates/widgets/form.html' |
4032 | --- vauxoomin/templates/widgets/form.html 1970-01-01 00:00:00 +0000 |
4033 | +++ vauxoomin/templates/widgets/form.html 2012-03-21 00:56:22 +0000 |
4034 | @@ -0,0 +1,33 @@ |
4035 | + <h1>New User</h1> |
4036 | + <div class="standardForm"> |
4037 | + <form action="index.html" method="post"> |
4038 | + <label for="name">Name</label> |
4039 | + <input id="name" type="text" /> |
4040 | + <label for="username">Username</label> |
4041 | + <input id="username" type="text" /> <span class="formError">Username can't be blank!</span> |
4042 | + <label for="shortInfo">Short Info</label> |
4043 | + <textarea rows="8" cols="1" class="formHuge" id="shortInfo"></textarea> |
4044 | + <div><!--We place fieldsets with display-inline inside div to better position them--> |
4045 | + <fieldset class="formHuge labelRadioCheckbox"> |
4046 | + <legend>Gender</legend> |
4047 | + <label for="male" class="labelRadioCheckbox"><input name="gender" id="male" value="Male" type="radio" />Male</label> |
4048 | + <label for="female" class="labelRadioCheckbox"><input name="gender" id="female" value="Female" checked="checked" type="radio" />Female</label> |
4049 | + </fieldset> <span class="formError">Gender must be selected!</span> |
4050 | + </div> |
4051 | + <label for="address">Address</label> |
4052 | + <input id="address" class="formHuge" type="text" /> |
4053 | + <div> <!--We place fieldsets with display-inline inside div to better position them--> |
4054 | + <fieldset class="formHuge labelRadioCheckbox"> |
4055 | + <legend>Age:</legend> |
4056 | + <label for="y18-25"><input name="18-25" id="y18-25" value="18-25" type="checkbox" />18-25</label> |
4057 | + <label for="y25-30"><input name="25-30" id="y25-30" value="25-30" type="checkbox" />25-30</label> |
4058 | + <label for="y30-40"><input name="30-40" id="y30-40" value="30-40" type="checkbox" />30-40 (if more, please select this)</label> |
4059 | + </fieldset> |
4060 | + </div> |
4061 | + <label for="password">Password</label> |
4062 | + <input id="password" type="password" /><br /> |
4063 | + <div><!--We need to use this div to keep the "submit button" and the "loader image" together.--> |
4064 | + <input type="submit" value="Submit" class="formButton" /> <img src="/static/img/ajax-loader.gif" alt="Ajax Loader" /> |
4065 | + </div> |
4066 | + </form> |
4067 | + </div> |
4068 | |
4069 | === added file 'vauxoomin/templates/widgets/image_gallery.html' |
4070 | --- vauxoomin/templates/widgets/image_gallery.html 1970-01-01 00:00:00 +0000 |
4071 | +++ vauxoomin/templates/widgets/image_gallery.html 2012-03-21 00:56:22 +0000 |
4072 | @@ -0,0 +1,81 @@ |
4073 | +<div class="titleWrap"> |
4074 | + <h1>Images</h1> |
4075 | + <ul> |
4076 | + <li><img src="/static/img/icons/add.png" alt="add" /> <a href="#">Add New</a></li> |
4077 | + </ul> |
4078 | +</div> |
4079 | +<div class="imagesWrap"> |
4080 | + <div class="imagesListed"> |
4081 | + <ul> |
4082 | + <li> |
4083 | + <p class="imageInfo"> |
4084 | + textimage.png (18.4kb) |
4085 | + </p> |
4086 | + <!--In order to display images inside the Lightbox, simply add them the class "colorBoxElement" (can be customized from "inc/static/js/custom.js"), mention the original image inside the "href" and use the "title" information for displaying info about the image.--> |
4087 | + <a href="/static/img/image-placeholder-big.gif" title="Original Image" class="colorBoxElement"><img src="/static/img/image-placeholder.gif" alt="image" /></a> |
4088 | + <p class="imageActions"> |
4089 | + <img src="/static/img/icons/page_white_go.png" alt="details" width="16" height="16" /> Details <img src="/static/img/icons/page_edit.png" alt="edit" width="16" height="16" /> Edit <img src="/static/img/icons/delete.png" alt="delete" width="16" height="16" /> Delete |
4090 | + </p> |
4091 | + </li> |
4092 | + <li> |
4093 | + <p class="imageInfo"> |
4094 | + textimage.png (18.4kb) |
4095 | + </p> |
4096 | + <a href="/static/img/image-placeholder-big.gif" title="Original Image" class="colorBoxElement"><img src="/static/img/image-placeholder.gif" alt="image" /></a> |
4097 | + <p class="imageActions"> |
4098 | + <img src="/static/img/icons/page_white_go.png" alt="details" width="16" height="16" /> Details <img src="/static/img/icons/page_edit.png" alt="edit" width="16" height="16" /> Edit <img src="/static/img/icons/delete.png" alt="delete" width="16" height="16" /> Delete |
4099 | + </p> |
4100 | + </li> |
4101 | + <li> |
4102 | + <p class="imageInfo"> |
4103 | + textimage.png (18.4kb) |
4104 | + </p> |
4105 | + <a href="/static/img/image-placeholder-big.gif" title="Original Image" class="colorBoxElement"><img src="/static/img/image-placeholder.gif" alt="image" /></a> |
4106 | + <p class="imageActions"> |
4107 | + <img src="/static/img/icons/page_white_go.png" alt="details" width="16" height="16" /> Details <img src="/static/img/icons/page_edit.png" alt="edit" width="16" height="16" /> Edit <img src="/static/img/icons/delete.png" alt="delete" width="16" height="16" /> Delete |
4108 | + </p> |
4109 | + </li> |
4110 | + <li> |
4111 | + <p class="imageInfo"> |
4112 | + textimage.png (18.4kb) |
4113 | + </p> |
4114 | + <a href="/static/img/image-placeholder-big.gif" title="Original Image" class="colorBoxElement"><img src="/static/img/image-placeholder.gif" alt="image" /></a> |
4115 | + <p class="imageActions"> |
4116 | + <img src="/static/img/icons/page_white_go.png" alt="details" width="16" height="16" /> Details <img src="/static/img/icons/page_edit.png" alt="edit" width="16" height="16" /> Edit <img src="/static/img/icons/delete.png" alt="delete" width="16" height="16" /> Delete |
4117 | + </p> |
4118 | + </li> |
4119 | + <li> |
4120 | + <p class="imageInfo"> |
4121 | + textimage.png (18.4kb) |
4122 | + </p> |
4123 | + <a href="/static/img/image-placeholder-big.gif" title="Original Image" class="colorBoxElement"><img src="/static/img/image-placeholder.gif" alt="image" /></a> |
4124 | + <p class="imageActions"> |
4125 | + <img src="/static/img/icons/page_white_go.png" alt="details" width="16" height="16" /> Details <img src="/static/img/icons/page_edit.png" alt="edit" width="16" height="16" /> Edit <img src="/static/img/icons/delete.png" alt="delete" width="16" height="16" /> Delete |
4126 | + </p> |
4127 | + </li> |
4128 | + <li> |
4129 | + <p class="imageInfo"> |
4130 | + textimage.png (18.4kb) |
4131 | + </p> |
4132 | + <a href="/static/img/image-placeholder-big.gif" title="Original Image" class="colorBoxElement"><img src="/static/img/image-placeholder.gif" alt="image" /></a> |
4133 | + <p class="imageActions"> |
4134 | + <img src="/static/img/icons/page_white_go.png" alt="details" width="16" height="16" /> Details <img src="/static/img/icons/page_edit.png" alt="edit" width="16" height="16" /> Edit <img src="/static/img/icons/delete.png" alt="delete" width="16" height="16" /> Delete |
4135 | + </p> |
4136 | + </li> |
4137 | + |
4138 | + </ul> |
4139 | + </div> |
4140 | + <div class="paginationWrap"> |
4141 | + <ul class="pagination"> |
4142 | + <li class="previous-off">«Previous</li> |
4143 | + <li class="active">1</li> |
4144 | + <li><a href="?page=2">2</a></li> |
4145 | + <li><a href="?page=3">3</a></li> |
4146 | + <li><a href="?page=4">4</a></li> |
4147 | + <li><a href="?page=5">5</a></li> |
4148 | + <li><a href="?page=6">6</a></li> |
4149 | + <li><a href="?page=7">7</a></li> |
4150 | + <li class="next"><a href="?page=8">Next »</a></li> |
4151 | + </ul> |
4152 | + </div> |
4153 | +</div> |
4154 | |
4155 | === added file 'vauxoomin/templates/widgets/img_logo.html' |
4156 | --- vauxoomin/templates/widgets/img_logo.html 1970-01-01 00:00:00 +0000 |
4157 | +++ vauxoomin/templates/widgets/img_logo.html 2012-03-21 00:56:22 +0000 |
4158 | @@ -0,0 +1,1 @@ |
4159 | +<img src="/static/img/logo.png" alt="logo" /> |
4160 | |
4161 | === added file 'vauxoomin/templates/widgets/list_db.html' |
4162 | --- vauxoomin/templates/widgets/list_db.html 1970-01-01 00:00:00 +0000 |
4163 | +++ vauxoomin/templates/widgets/list_db.html 2012-03-21 00:56:22 +0000 |
4164 | @@ -0,0 +1,46 @@ |
4165 | +{% autoescape None %} |
4166 | +{% if not len(databases) %} |
4167 | + {{ modules.WarningWidget('errorBox','there are problem to get data bases or you are not created anyone or we have socket problems, verify ports of your config file (For now we have implemented just netrpc protocol.)') }} |
4168 | +{% end %} |
4169 | +<div class="titleWrap"> |
4170 | + <h1>Data Base List for this instance</h1> |
4171 | + <ul> |
4172 | + <li class="standardForm"> |
4173 | + <select name="listmenu"> |
4174 | + <option selected="selected">Clone Selected</option> |
4175 | + <option>Delete Selected</option> |
4176 | + <option>Edit Selected</option> |
4177 | + </select> |
4178 | + </li> |
4179 | + <li class="seperator"><img src="/static/img/icons/add.png" alt="add" /> <a href="#">Add New</a></li> |
4180 | + </ul> |
4181 | +</div> |
4182 | +<table class="listing fluid" cellpadding="0" cellspacing="0"> |
4183 | + <tbody> |
4184 | + <tr> |
4185 | + <th class="left"><input type="checkbox" name="checkbox2" value="checkbox" /></th> |
4186 | + <th>Name<img src="/static/img/icons/arrow_down.png" alt="down" /><img src="/static/img/icons/arrow_up.png" alt="up" /></th> |
4187 | + <th>Actions</th> |
4188 | + </tr> |
4189 | + {% for d in databases %} |
4190 | + <tr class="{{ d }}"> |
4191 | + <td><input type="checkbox" name="checkbox2" value="checkbox" /></td> |
4192 | + <td>{{ d }}</td> |
4193 | + <td><img src="/static/img/icons/page_edit.png" alt="edit" width="16" height="16" /> <img src="/static/img/icons/add.png" alt="add" width="16" height="16" /> <img src="/static/img/icons/delete.png" alt="delete" width="16" height="16" /></td> |
4194 | + </tr> |
4195 | + {% end %} |
4196 | + </tbody> |
4197 | +</table> |
4198 | +<div class="paginationWrap"> |
4199 | + <ul> |
4200 | + <li class="previous-off">«Previous</li> |
4201 | + <li class="active">1</li> |
4202 | + <li><a href="?page=2">2</a></li> |
4203 | + <li><a href="?page=3">3</a></li> |
4204 | + <li><a href="?page=4">4</a></li> |
4205 | + <li><a href="?page=5">5</a></li> |
4206 | + <li><a href="?page=6">6</a></li> |
4207 | + <li><a href="?page=7">7</a></li> |
4208 | + <li class="next"><a href="?page=8">Next »</a></li> |
4209 | + </ul> |
4210 | +</div> |
4211 | |
4212 | === added file 'vauxoomin/templates/widgets/list_paged.html' |
4213 | --- vauxoomin/templates/widgets/list_paged.html 1970-01-01 00:00:00 +0000 |
4214 | +++ vauxoomin/templates/widgets/list_paged.html 2012-03-21 00:56:22 +0000 |
4215 | @@ -0,0 +1,126 @@ |
4216 | + <div class="titleWrap"> |
4217 | + <h1>Approved Orders</h1> |
4218 | + <ul> |
4219 | + <li class="standardForm"> |
4220 | + <select name="listmenu"> |
4221 | + <option selected="selected">Bulk Actions</option> |
4222 | + <option>Delete Selected</option> |
4223 | + <option>Edit Selected</option> |
4224 | + </select> |
4225 | + </li> |
4226 | + <li class="seperator"><img src="/static/img/icons/add.png" alt="add" /> <a href="#">Add New</a></li> |
4227 | + </ul> |
4228 | + </div> |
4229 | + <table class="listing fluid" cellpadding="0" cellspacing="0"> |
4230 | + <tbody> |
4231 | + <tr> |
4232 | + <th class="left"><input type="checkbox" name="checkbox2" value="checkbox" /></th> |
4233 | + <th>Name Surname <img src="/static/img/icons/arrow_down.png" alt="down" /><img src="/static/img/icons/arrow_up.png" alt="up" /></th> |
4234 | + <th>City <img src="/static/img/icons/arrow_down.png" alt="down" /><img src="/static/img/icons/arrow_up.png" alt="up" /></th> |
4235 | + <th>Country <img src="/static/img/icons/arrow_down.png" alt="down" /><img src="/static/img/icons/arrow_up.png" alt="up" /></th> |
4236 | + <th>Age <img src="/static/img/icons/arrow_down.png" alt="down" /><img src="/static/img/icons/arrow_up.png" alt="up" /></th> |
4237 | + <th>Actions</th> |
4238 | + </tr> |
4239 | + <tr class="row1"> |
4240 | + <td><input type="checkbox" name="checkbox2" value="checkbox" /></td> |
4241 | + <td>- John Doe </td> |
4242 | + <td>Washington DC </td> |
4243 | + <td>USA</td> |
4244 | + <td>32</td> |
4245 | + <td><img src="/static/img/icons/page_edit.png" alt="edit" width="16" height="16" /> <img src="/static/img/icons/add.png" alt="add" width="16" height="16" /> <img src="/static/img/icons/delete.png" alt="delete" width="16" height="16" /></td> |
4246 | + </tr> |
4247 | + <tr class="row2"> |
4248 | + <td><input type="checkbox" name="checkbox2" value="checkbox" /></td> |
4249 | + <td>- Thierry Mugler </td> |
4250 | + <td>Paris</td> |
4251 | + <td>France</td> |
4252 | + <td>28</td> |
4253 | + <td><img src="/static/img/icons/page_edit.png" alt="edit" width="16" height="16" /> <img src="/static/img/icons/add.png" alt="add" width="16" height="16" /> <img src="/static/img/icons/delete.png" alt="delete" width="16" height="16" /></td> |
4254 | + </tr> |
4255 | + <tr class="row1"> |
4256 | + <td><input type="checkbox" name="checkbox3" value="checkbox" /></td> |
4257 | + <td>- Jose Manta </td> |
4258 | + <td>Madrid</td> |
4259 | + <td>Spain</td> |
4260 | + <td>21</td> |
4261 | + <td><img src="/static/img/icons/page_edit.png" alt="edit" width="16" height="16" /> <img src="/static/img/icons/add.png" alt="add" width="16" height="16" /> <img src="/static/img/icons/delete.png" alt="delete" width="16" height="16" /></td> |
4262 | + </tr> |
4263 | + <tr class="row2"> |
4264 | + <td><input type="checkbox" name="checkbox4" value="checkbox" /></td> |
4265 | + <td>- Michael Luvsum </td> |
4266 | + <td>Berlin</td> |
4267 | + <td>Germany</td> |
4268 | + <td>22</td> |
4269 | + <td><img src="/static/img/icons/page_edit.png" alt="edit" width="16" height="16" /> <img src="/static/img/icons/add.png" alt="add" width="16" height="16" /> <img src="/static/img/icons/delete.png" alt="delete" width="16" height="16" /></td> |
4270 | + </tr> |
4271 | + <tr class="row1"> |
4272 | + <td><input type="checkbox" name="checkbox4" value="checkbox" /></td> |
4273 | + <td>- Adrian Tamoe</td> |
4274 | + <td>Zurich</td> |
4275 | + <td>Switzerland</td> |
4276 | + <td>30</td> |
4277 | + <td><img src="/static/img/icons/page_edit.png" alt="edit" width="16" height="16" /> <img src="/static/img/icons/add.png" alt="add" width="16" height="16" /> <img src="/static/img/icons/delete.png" alt="delete" width="16" height="16" /></td> |
4278 | + </tr> |
4279 | + <tr class="row2"> |
4280 | + <td><input type="checkbox" name="checkbox4" value="checkbox" /></td> |
4281 | + <td>- George Rusen</td> |
4282 | + <td>Bucharest</td> |
4283 | + <td>Romania</td> |
4284 | + <td>26</td> |
4285 | + <td><img src="/static/img/icons/page_edit.png" alt="edit" width="16" height="16" /> <img src="/static/img/icons/add.png" alt="add" width="16" height="16" /> <img src="/static/img/icons/delete.png" alt="delete" width="16" height="16" /></td> |
4286 | + </tr> |
4287 | + <tr class="row1"> |
4288 | + <td><input type="checkbox" name="checkbox4" value="checkbox" /></td> |
4289 | + <td>- Rodney Mullen</td> |
4290 | + <td>San Francisco</td> |
4291 | + <td>USA</td> |
4292 | + <td>39</td> |
4293 | + <td><img src="/static/img/icons/page_edit.png" alt="edit" width="16" height="16" /> <img src="/static/img/icons/add.png" alt="add" width="16" height="16" /> <img src="/static/img/icons/delete.png" alt="delete" width="16" height="16" /></td> |
4294 | + </tr> |
4295 | + <tr class="row2"> |
4296 | + <td><input type="checkbox" name="checkbox4" value="checkbox" /></td> |
4297 | + <td>- Michael Luvsum </td> |
4298 | + <td>Berlin</td> |
4299 | + <td>Germany</td> |
4300 | + <td>22</td> |
4301 | + <td><img src="/static/img/icons/page_edit.png" alt="edit" width="16" height="16" /> <img src="/static/img/icons/add.png" alt="add" width="16" height="16" /> <img src="/static/img/icons/delete.png" alt="delete" width="16" height="16" /></td> |
4302 | + </tr> |
4303 | + <tr class="row1"> |
4304 | + <td><input type="checkbox" name="checkbox4" value="checkbox" /></td> |
4305 | + <td>- Adrian Tamoe</td> |
4306 | + <td>Zurich</td> |
4307 | + <td>Switzerland</td> |
4308 | + <td>30</td> |
4309 | + <td><img src="/static/img/icons/page_edit.png" alt="edit" width="16" height="16" /> <img src="/static/img/icons/add.png" alt="add" width="16" height="16" /> <img src="/static/img/icons/delete.png" alt="delete" width="16" height="16" /></td> |
4310 | + </tr> |
4311 | + <tr class="row2"> |
4312 | + <td><input type="checkbox" name="checkbox4" value="checkbox" /></td> |
4313 | + <td>- George Rusen</td> |
4314 | + <td>Bucharest</td> |
4315 | + <td>Romania</td> |
4316 | + <td>26</td> |
4317 | + <td><img src="/static/img/icons/page_edit.png" alt="edit" width="16" height="16" /> <img src="/static/img/icons/add.png" alt="add" width="16" height="16" /> <img src="/static/img/icons/delete.png" alt="delete" width="16" height="16" /></td> |
4318 | + </tr> |
4319 | + <tr class="row1"> |
4320 | + <td><input type="checkbox" name="checkbox4" value="checkbox" /></td> |
4321 | + <td>- Rodney Mullen</td> |
4322 | + <td>San Francisco</td> |
4323 | + <td>USA</td> |
4324 | + <td>39</td> |
4325 | + <td><img src="/static/img/icons/page_edit.png" alt="edit" width="16" height="16" /> <img src="/static/img/icons/add.png" alt="add" width="16" height="16" /> <img src="/static/img/icons/delete.png" alt="delete" width="16" height="16" /></td> |
4326 | + </tr> |
4327 | + </tbody> |
4328 | + </table> |
4329 | + <div class="paginationWrap"> |
4330 | + <ul> |
4331 | + <li class="previous-off">«Previous</li> |
4332 | + <li class="active">1</li> |
4333 | + <li><a href="?page=2">2</a></li> |
4334 | + <li><a href="?page=3">3</a></li> |
4335 | + <li><a href="?page=4">4</a></li> |
4336 | + <li><a href="?page=5">5</a></li> |
4337 | + <li><a href="?page=6">6</a></li> |
4338 | + <li><a href="?page=7">7</a></li> |
4339 | + <li class="next"><a href="?page=8">Next »</a></li> |
4340 | + </ul> |
4341 | + </div> |
4342 | |
4343 | === added file 'vauxoomin/templates/widgets/main_menu.html' |
4344 | --- vauxoomin/templates/widgets/main_menu.html 1970-01-01 00:00:00 +0000 |
4345 | +++ vauxoomin/templates/widgets/main_menu.html 2012-03-21 00:56:22 +0000 |
4346 | @@ -0,0 +1,52 @@ |
4347 | + <li class="current"> |
4348 | + <a href="#">Dashboard</a> |
4349 | + <ul class="sub_menu"> |
4350 | + <li><a href="#">Sub-Menu-1</a></li> |
4351 | + <li> |
4352 | + <a href="#">Sub-Menu-2</a> |
4353 | + <ul> |
4354 | + <li><a href="#">Sub-Menu-2-1</a></li> |
4355 | + |
4356 | + <li><a href="#">Sub-Menu-2-2</a></li> |
4357 | + </ul> |
4358 | + </li> |
4359 | + <li><a href="#">Sub-Menu-3</a></li> |
4360 | + <li><a href="#">Sub-Menu-4</a></li> |
4361 | + </ul> |
4362 | + </li> |
4363 | + |
4364 | + <li> |
4365 | + <a href="#">Products</a> |
4366 | + <ul class="sub_menu"> |
4367 | + <li><a href="#">Sub-Menu-1</a></li> |
4368 | + <li> |
4369 | + <a href="#">Sub-Menu-2</a> |
4370 | + <ul> |
4371 | + <li><a href="#">Sub-Menu-2-1</a></li> |
4372 | + |
4373 | + <li><a href="#">Sub-Menu-2-2</a></li> |
4374 | + </ul> |
4375 | + </li> |
4376 | + <li><a href="#">Sub-Menu-3</a></li> |
4377 | + <li><a href="#">Sub-Menu-4</a></li> |
4378 | + </ul> |
4379 | + </li> |
4380 | + |
4381 | + <li> |
4382 | + <a href="#">Orders</a> |
4383 | + <ul class="sub_menu"> |
4384 | + <li><a href="#">Sub-Menu-1</a></li> |
4385 | + <li> |
4386 | + <a href="#">Sub-Menu-2</a> |
4387 | + <ul> |
4388 | + <li><a href="#">Sub-Menu-2-1</a></li> |
4389 | + |
4390 | + <li><a href="#">Sub-Menu-2-2</a></li> |
4391 | + </ul> |
4392 | + </li> |
4393 | + <li><a href="#">Sub-Menu-3</a></li> |
4394 | + <li><a href="#">Sub-Menu-4</a></li> |
4395 | + </ul> |
4396 | + </li> |
4397 | + <li><a href="#">Members</a></li> |
4398 | + <li><a href="#">Settings</a></li> |
4399 | |
4400 | === added file 'vauxoomin/templates/widgets/search_box.html' |
4401 | --- vauxoomin/templates/widgets/search_box.html 1970-01-01 00:00:00 +0000 |
4402 | +++ vauxoomin/templates/widgets/search_box.html 2012-03-21 00:56:22 +0000 |
4403 | @@ -0,0 +1,19 @@ |
4404 | +<div id="searchBox"> |
4405 | + <fieldset> |
4406 | + <legend>Search</legend> |
4407 | + <input size="15" class="formSmall" type="text" /> <input value="Go" class="button" type="submit" /> |
4408 | + <h6>(<a href="#" id="advancedSearchLink">advanced search options</a>)</h6> |
4409 | + <div id="advancedSearchWrap"> |
4410 | + <select name="listmenu"> |
4411 | + <option selected="selected">Select Category</option> |
4412 | + <option>Orders</option> |
4413 | + <option>Members</option> |
4414 | + </select> |
4415 | + <fieldset class="labelRadioCheckbox"> |
4416 | + <legend>Include Archives</legend> |
4417 | + <label for="yes" class="labelRadioCheckbox"><input name="gender" id="yes" value="Yes" type="radio" />Yes</label> |
4418 | + <label for="no" class="labelRadioCheckbox"><input name="gender" id="no" value="No" checked="checked" type="radio" />No</label> |
4419 | + </fieldset> |
4420 | + </div> |
4421 | + </fieldset> |
4422 | +</div> |
4423 | |
4424 | === added file 'vauxoomin/templates/widgets/tabed_menu.html' |
4425 | --- vauxoomin/templates/widgets/tabed_menu.html 1970-01-01 00:00:00 +0000 |
4426 | +++ vauxoomin/templates/widgets/tabed_menu.html 2012-03-21 00:56:22 +0000 |
4427 | @@ -0,0 +1,27 @@ |
4428 | +{% autoescape None %} |
4429 | + <h1>{{title}}</h1> |
4430 | + <div id="tabs"><!--The ID tabs is defined inside includes/static/js/custom.js. To create new tabbed menus, a similar function inside "custom.js" must be added.--> |
4431 | + <ul> |
4432 | + {% for t in tabs %} |
4433 | + <li><a href="#{{ t['id'] }}">{{ t['title'] }}</a></li> |
4434 | + {% end %} |
4435 | + </ul> |
4436 | + {% for t in tabs %} |
4437 | + <div id="{{ t['id'] }}"> |
4438 | + {% if type(t['content']) is list %} |
4439 | + {% for l in t['content'] %} |
4440 | + <p>{{ escape(l) }}</p> |
4441 | + {% end %} |
4442 | + {% end %} |
4443 | + {% if type(t['content']) is dict %} |
4444 | + <p>{{ modules.WarningWidget(t['content'].get('use','warningBox'),t['content'].get('message','Bad Format for Dict'))}}</p> |
4445 | + {% end %} |
4446 | + {% if type(t['content']) is str %} |
4447 | + <p>{{ modules.WarningCode(t['content']) }}</p> |
4448 | + {% end %} |
4449 | + {% if type(t['content']) is tuple %} |
4450 | + {{ modules.ListDbs(t['content'])}} |
4451 | + {% end %} |
4452 | + </div> |
4453 | + {% end %} |
4454 | + </div> |
4455 | |
4456 | === added file 'vauxoomin/templates/widgets/top_menu.html' |
4457 | --- vauxoomin/templates/widgets/top_menu.html 1970-01-01 00:00:00 +0000 |
4458 | +++ vauxoomin/templates/widgets/top_menu.html 2012-03-21 00:56:22 +0000 |
4459 | @@ -0,0 +1,5 @@ |
4460 | +<ul> |
4461 | + <li>Welcome John Doe</li> |
4462 | + <li class="seperator"><a href="#">My Account</a></li><!--seperator class is used for adding the seperator background between items--> |
4463 | + <li class="seperator"><a href="#">Logout</a></li> |
4464 | +</ul> |
4465 | |
4466 | === added file 'vauxoomin/templates/widgets/twitter.html' |
4467 | --- vauxoomin/templates/widgets/twitter.html 1970-01-01 00:00:00 +0000 |
4468 | +++ vauxoomin/templates/widgets/twitter.html 2012-03-21 00:56:22 +0000 |
4469 | @@ -0,0 +1,30 @@ |
4470 | +<script charset="utf-8" src="http://widgets.twimg.com/j/2/widget.js"></script> |
4471 | +<script> |
4472 | +new TWTR.Widget({ |
4473 | + version: 2, |
4474 | + type: 'search', |
4475 | + search: 'openerp', |
4476 | + interval: 30000, |
4477 | + title: 'OpenERP', |
4478 | + subject: 'Todo lo que se Habla', |
4479 | + width: 'auto', |
4480 | + height: 300, |
4481 | + theme: { |
4482 | + shell: { |
4483 | + background: '#677075', |
4484 | + color: '#ffffff' |
4485 | + }, |
4486 | + tweets: { |
4487 | + background: '#ffffff', |
4488 | + color: '#444444', |
4489 | + links: '#1985b5' |
4490 | + } |
4491 | + }, |
4492 | + features: { |
4493 | + scrollbar: false, |
4494 | + loop: true, |
4495 | + live: true, |
4496 | + behavior: 'default' |
4497 | + } |
4498 | +}).render().start(); |
4499 | +</script> |
4500 | |
4501 | === added file 'vauxoomin/templates/widgets/warning_message.html' |
4502 | --- vauxoomin/templates/widgets/warning_message.html 1970-01-01 00:00:00 +0000 |
4503 | +++ vauxoomin/templates/widgets/warning_message.html 2012-03-21 00:56:22 +0000 |
4504 | @@ -0,0 +1,3 @@ |
4505 | +{% autoescape None %} |
4506 | +<!--Use==> warningBox, infoBox, successBox, errorBox--> |
4507 | +<div class="{{ use }}">{{ message }}</div> |
4508 | |
4509 | === modified file 'vauxoomin/vauxomin.cfg' |
4510 | --- vauxoomin/vauxomin.cfg 2012-02-12 18:28:58 +0000 |
4511 | +++ vauxoomin/vauxomin.cfg 2012-03-21 00:56:22 +0000 |
4512 | @@ -1,2 +1,7 @@ |
4513 | +title="Vauxoo Info Admin Server" |
4514 | port=12222 |
4515 | user="nhomar" |
4516 | +name_server="server" |
4517 | +path_to_log="log_openerp" |
4518 | +relative_path="instancias" |
4519 | +config_path="config" |
4520 | |
4521 | === modified file 'vauxoomin/vauxomin.py' |
4522 | --- vauxoomin/vauxomin.py 2012-02-16 12:15:10 +0000 |
4523 | +++ vauxoomin/vauxomin.py 2012-03-21 00:56:22 +0000 |
4524 | @@ -5,7 +5,7 @@ |
4525 | # Licensed under the Afero GNU License, Version 3.0 (the "License"); you may |
4526 | # not use this file except in compliance with the License. You may obtain |
4527 | # a copy of the License at |
4528 | -# |
4529 | +# |
4530 | # Unless required by applicable law or agreed to in writing, software |
4531 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
4532 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
4533 | @@ -22,6 +22,7 @@ |
4534 | #Importing vauxoomin stuff |
4535 | from main import server |
4536 | from main import action |
4537 | +from main import markdown |
4538 | |
4539 | |
4540 | define("port", default=8888, help="run on the given port", type=int) |
4541 | @@ -32,7 +33,8 @@ |
4542 | define("user", default="openerp", help="Posix user wher you save all your work, and this user will run all instances") |
4543 | define("maindb", default="precision", help="Main db for this user, generally is produccion") |
4544 | define("demo", default=False, help="Just to load original demo info for template (for development purpose)") |
4545 | - |
4546 | +define("name_server", default='server', help="how you will call server on your instance") |
4547 | +define("path_to_log", default='log_openerp', help="where will be logs on openerp") |
4548 | class Application(tornado.web.Application): |
4549 | ''' |
4550 | Initial instanciation for TornadoWeb application |
4551 | @@ -43,6 +45,7 @@ |
4552 | ''' |
4553 | def __init__(self): |
4554 | handlers = [ |
4555 | + (r"/profit", ProfitHandler), |
4556 | (r"/", HomeHandler), |
4557 | (r"/([^/]+)", BranchHandler), |
4558 | (r"/action/([^/]+)/([^/]+)", ActionHandler), |
4559 | @@ -53,7 +56,27 @@ |
4560 | ui_modules={"Project": ProjectModule, |
4561 | "Branch": BranchModule, |
4562 | "Config": ConfigModule, |
4563 | - "Action": ActionModule}, |
4564 | + "Action": ActionModule, |
4565 | + #Widgets |
4566 | + "TopMenu": TopMenu, |
4567 | + "Logo": Logo, |
4568 | + "MainMenu": MainMenu, |
4569 | + "SearchBox": SearchBox, |
4570 | + "Calendar": Calendar, |
4571 | + "Acordion": Acordion, |
4572 | + "Crumbs": Crumbs, |
4573 | + "WarningWidget": WarningWidget, |
4574 | + "DashBlock": DashBlock, |
4575 | + "Chart": Chart, |
4576 | + "ListPaged": ListPaged, |
4577 | + "ListDbs": ListDbs, |
4578 | + "TabedMenu": TabedMenu, |
4579 | + "AcordionWrap": AcordionWrap, |
4580 | + "Form": Form, |
4581 | + "ImageGallery": ImageGallery, |
4582 | + "Twitter": Twitter, |
4583 | + "DashBranches": DashBranches, |
4584 | + "WarningCode": WarningCode}, |
4585 | static_path=os.path.join(os.path.dirname(__file__), "static"), |
4586 | title=options.title, |
4587 | ) |
4588 | @@ -66,10 +89,23 @@ |
4589 | ''' |
4590 | def get(self): |
4591 | if not options.demo: |
4592 | - self.render('index.html',projects=server.get_dirs()) |
4593 | - else: |
4594 | - self.render('demo_theme.html',projects=server.get_dirs()) |
4595 | - |
4596 | + self.render('home.html',projects=server.get_dirs()) |
4597 | + else: |
4598 | + self.render('demo_theme.html',projects=server.get_dirs()) |
4599 | + |
4600 | +class ProfitHandler(tornado.web.RequestHandler): |
4601 | + ''' |
4602 | + Manage preparation to show home with list of projects |
4603 | + ''' |
4604 | + def profit_get(self): |
4605 | + |
4606 | + return ['Hola','MUndo'] |
4607 | + |
4608 | + def get(self): |
4609 | + if not options.demo: |
4610 | + self.render('home_profit.html',projects=self.profit_get()) |
4611 | + else: |
4612 | + self.render('demo_theme.html',projects=server.get_dirs()) |
4613 | |
4614 | class BranchHandler(HomeHandler): |
4615 | ''' |
4616 | @@ -82,7 +118,7 @@ |
4617 | status=server.get_status(slug) |
4618 | config=server.get_config(slug) |
4619 | log_file=server.get_logs(slug) |
4620 | - self.render("main.html", branches=[s for s in show if type(s) is not str],project=slug,config=config,status=status,log=log_file) |
4621 | + self.render("home_project.html", branches=[s for s in show if type(s) is not str],project=slug,config=config,status=status,log=log_file) |
4622 | |
4623 | |
4624 | #All actions Handlers availables on Action Module |
4625 | @@ -94,10 +130,27 @@ |
4626 | status=server.get_status(instance) |
4627 | config=server.get_config(instance) |
4628 | log_file=server.get_logs(instance) |
4629 | + cp_msg={'use':'errorBox', |
4630 | + 'message':'Houston we have a problem to make this action or the rocket is not already to be launched'} |
4631 | if slug=='copy_instance': |
4632 | - cp_msg=action.copy_instance(instance,options.user,options.relative_path) |
4633 | + cp_msg=action.copy_instance({'instance':instance, |
4634 | + 'user':options.user, |
4635 | + 'relative_path':options.relative_path, |
4636 | + 'name_server':options.name_server}) |
4637 | if slug=='clone_main_db': |
4638 | cp_msg=action.clone_main_db(options.maindb) |
4639 | + if slug=='create_log': |
4640 | + cp_msg=action.create_log({'instance':instance, |
4641 | + 'path_to_log':options.path_to_log, |
4642 | + 'user':options.user}) |
4643 | + if slug=='create_config': |
4644 | + cp_msg=action.create_config(instance) |
4645 | + if slug=='start_server': |
4646 | + cp_msg=action.start_server({'instance':instance, |
4647 | + 'user':options.user, |
4648 | + 'relative_path':options.relative_path, |
4649 | + 'base_config_path':options.config_path, |
4650 | + 'name_server':options.name_server}) |
4651 | self.render('action.html',action=slug, project=instance, |
4652 | instance=instance, log=log_file, config=config,status=status, |
4653 | cp_msg=cp_msg) |
4654 | @@ -124,8 +177,9 @@ |
4655 | ''' |
4656 | Manage show list of configuration on your Project |
4657 | ''' |
4658 | - def render(self, config, value): |
4659 | - return self.render_string("modules/right.html", config=config, value=value) |
4660 | + def render(self, project): |
4661 | + configs=server.get_config(project) |
4662 | + return self.render_string("widgets/acordion_menu.html", configs=configs, description='HEllo', menu=project) |
4663 | |
4664 | |
4665 | class ActionModule(tornado.web.UIModule): |
4666 | @@ -135,6 +189,199 @@ |
4667 | def render(self, status, instance): |
4668 | return self.render_string("modules/left.html", status=status, instance=instance) |
4669 | |
4670 | + |
4671 | +class TopMenu(tornado.web.UIModule): |
4672 | + ''' |
4673 | + Manage show list of actions availables on your user |
4674 | + ''' |
4675 | + def render(self, status): |
4676 | + return self.render_string("widgets/top_menu.html", status=status) |
4677 | + |
4678 | + |
4679 | +class Logo(tornado.web.UIModule): |
4680 | + ''' |
4681 | + Manage show list of actions availables on your logo |
4682 | + ''' |
4683 | + def render(self, path_logo): |
4684 | + return self.render_string("widgets/img_logo.html", path_logo=path_logo) |
4685 | + |
4686 | + |
4687 | +class MainMenu(tornado.web.UIModule): |
4688 | + ''' |
4689 | + Manage show list of actions availables on your logo |
4690 | + ''' |
4691 | + def render(self, menus): |
4692 | + return self.render_string("widgets/main_menu.html", menus=menus) |
4693 | + |
4694 | + |
4695 | +class SearchBox(tornado.web.UIModule): |
4696 | + ''' |
4697 | + Manage show list of actions availables on your logo |
4698 | + ''' |
4699 | + def render(self): |
4700 | + return self.render_string("widgets/search_box.html") |
4701 | + |
4702 | + |
4703 | +class Calendar(tornado.web.UIModule): |
4704 | + ''' |
4705 | + Manage show list of actions availables on your logo |
4706 | + ''' |
4707 | + def render(self): |
4708 | + return self.render_string("widgets/calendar.html") |
4709 | + |
4710 | + |
4711 | +class Acordion(tornado.web.UIModule): |
4712 | + ''' |
4713 | + Manage show list of actions availables on your logo |
4714 | + ''' |
4715 | + def render(self, project): |
4716 | + configs=server.get_config(project) |
4717 | + return self.render_string("widgets/acordion_menu.html", submenus=configs, description='HEllo', menu=project) |
4718 | + |
4719 | +class Crumbs(tornado.web.UIModule): |
4720 | + ''' |
4721 | + Manage show list of actions availables on your logo |
4722 | + ''' |
4723 | + def render(self): |
4724 | + return self.render_string("widgets/crumbs.html") |
4725 | + |
4726 | + |
4727 | +class WarningWidget(tornado.web.UIModule): |
4728 | + ''' |
4729 | + Manage show list of actions availables on your logo |
4730 | + ''' |
4731 | + def render(self,use="warningBox",message="Be Carefull Something goes wrong"): |
4732 | + ''' |
4733 | + use: warningBox, infoBox, successBox, errorBox--> |
4734 | + message: Message to render |
4735 | + ''' |
4736 | + return self.render_string("widgets/warning_message.html",use=use,message=message) |
4737 | + |
4738 | + |
4739 | +class DashBlock(tornado.web.UIModule): |
4740 | + ''' |
4741 | + Manage show list of actions availables on your logo |
4742 | + ''' |
4743 | + def render(self,elements,context_message): |
4744 | + ''' |
4745 | + use: warningBox, infoBox, successBox, errorBox--> |
4746 | + message: Message to render |
4747 | + ''' |
4748 | + return self.render_string("widgets/dash_blocks.html", elements=elements,context_message=context_message) |
4749 | + |
4750 | + |
4751 | +class DashBranches(tornado.web.UIModule): |
4752 | + ''' |
4753 | + Manage show list of actions availables on your logo |
4754 | + ''' |
4755 | + def render(self,elements,context_message): |
4756 | + ''' |
4757 | + use: warningBox, infoBox, successBox, errorBox--> |
4758 | + message: Message to render |
4759 | + ''' |
4760 | + return self.render_string("widgets/dash_branches.html", elements=elements,context_message=context_message) |
4761 | + |
4762 | +class Chart(tornado.web.UIModule): |
4763 | + ''' |
4764 | + TODO: See what we will do with it |
4765 | + ''' |
4766 | + def render(self): |
4767 | + ''' |
4768 | + use: warningBox, infoBox, successBox, errorBox--> |
4769 | + message: Message to render |
4770 | + ''' |
4771 | + return self.render_string("widgets/chart.html") |
4772 | + |
4773 | + |
4774 | +class ListPaged(tornado.web.UIModule): |
4775 | + ''' |
4776 | + Manage show list of actions availables on your logo |
4777 | + ''' |
4778 | + def render(self): |
4779 | + ''' |
4780 | + TODO: Standarize the use of this widget |
4781 | + ''' |
4782 | + return self.render_string("widgets/list_paged.html") |
4783 | + |
4784 | + |
4785 | +class ListDbs(tornado.web.UIModule): |
4786 | + ''' |
4787 | + Manage show list of actions availables on your logo |
4788 | + ''' |
4789 | + def render(self,databases): |
4790 | + ''' |
4791 | + TODO: Standarize the use of this widget |
4792 | + ''' |
4793 | + return self.render_string("widgets/list_db.html",databases=databases) |
4794 | + |
4795 | +class TabedMenu(tornado.web.UIModule): |
4796 | + ''' |
4797 | + Manage show list of actions availables on your logo |
4798 | + ''' |
4799 | + def render(self,title,tabs): |
4800 | + ''' |
4801 | + Standarized the use of this widget |
4802 | + :title: title on tabs groups |
4803 | + :tabs: List of dictionaries, [{'id':'String','content':'html string','title':'string with title'}] |
4804 | + ''' |
4805 | + return self.render_string("widgets/tabed_menu.html",title=title,tabs=tabs,server=server) |
4806 | + |
4807 | + |
4808 | +class AcordionWrap(tornado.web.UIModule): |
4809 | + ''' |
4810 | + Manage show list of actions availables on your logo |
4811 | + ''' |
4812 | + def render(self): |
4813 | + ''' |
4814 | + TODO: Standarize the use of this widget |
4815 | + ''' |
4816 | + return self.render_string("widgets/acordion_wrap.html") |
4817 | + |
4818 | + |
4819 | +class Form(tornado.web.UIModule): |
4820 | + ''' |
4821 | + Manage show list of actions availables on your logo |
4822 | + ''' |
4823 | + def render(self): |
4824 | + ''' |
4825 | + TODO: Standarize the use of this widget |
4826 | + ''' |
4827 | + return self.render_string("widgets/form.html") |
4828 | + |
4829 | + |
4830 | +class ImageGallery(tornado.web.UIModule): |
4831 | + ''' |
4832 | + Manage show list of actions availables on your logo |
4833 | + ''' |
4834 | + def render(self): |
4835 | + ''' |
4836 | + TODO: Standarize the use of this widget |
4837 | + ''' |
4838 | + return self.render_string("widgets/image_gallery.html") |
4839 | + |
4840 | + |
4841 | +class Twitter(tornado.web.UIModule): |
4842 | + ''' |
4843 | + Manage show list of actions availables on your logo |
4844 | + ''' |
4845 | + def render(self): |
4846 | + ''' |
4847 | + TODO: Standarize the use of this widget |
4848 | + ''' |
4849 | + return self.render_string("widgets/twitter.html") |
4850 | + |
4851 | + |
4852 | +class WarningCode(tornado.web.UIModule): |
4853 | + ''' |
4854 | + Manage show list of actions availables on your logo |
4855 | + ''' |
4856 | + def render(self,html): |
4857 | + ''' |
4858 | + TODO: Standarize the use of this widget |
4859 | + ''' |
4860 | + return self.render_string("widgets/code.html",message=html) |
4861 | + |
4862 | + |
4863 | #HandleErrors |
4864 | class NotFoundHandler(HomeHandler): |
4865 | def prepare(self): |