Add new navigation bar for document pages, made up of icon box + tabs.

Integrated search screen with doctable, for incremental searching.
You can now go back and forth between compact and expanded doctables.
New statistics on lintadas run times.
Only error-checked docs can be mirrored.
URLParse now defaults to EN if the url doesn't say.
Publisher accepts URLParse's EN if there's no referer. Closes #91082.
Add collection, layout, short_title to search form.
This commit is contained in:
david 2002-08-28 16:40:34 +00:00
parent 7e8238dbf1
commit 337e67859a
17 changed files with 373 additions and 172 deletions

View File

@ -63,3 +63,12 @@ insert([blknotfound], [
<td>|strnotfound|</td>
</tr>
</table>])
insert([blkdocument_nav_bar], [
<table class="layout">
<tr>
<td>|tabdocument_icon_box|</td>
<td>|tabdocument_tabs|</td>
</tr>
</table>])

View File

@ -72,7 +72,7 @@ insert([doctable], [Dokumente durchsehen], [],
insert([document_list], [Liste der Dokumente], [],
[
|tabdocs_block|
|tabdocs_expanded|
], 0)
insert([search], [Suche], [],
@ -89,6 +89,7 @@ insert([stats], [Current Statistics], [],
[
|tabpub_status_stats|
<p>|tabdoc_error_stats|
<p>|tablint_time_stats|
<p>|tabmirror_time_stats|
<p>|tabpub_time_stats|
<p>|tabdoc_format_stats|

View File

@ -55,7 +55,7 @@ insert([doctable], [Document Table], [],
insert([document_list], [Detailed Document Table], [],
[
|tabdocs_block|
|tabdocs_expanded|
], 1)
insert([search], [Search], [],
@ -71,9 +71,38 @@ insert([news], [Recent News], [],
insert([stats], [Current Statistics], [],
[
|tabpub_status_stats|
<p>|tabdoc_error_stats|
<h1>Publishing Statistics</h1>
<p>These statistics show the state of the document publication
system.
<p>The first table indicates when Lintadas (the Lampadas error
checker) was run on each document:
<p>|tablint_time_stats|
<p>This table indicates when documents were successfully mirrored:
<p>|tabmirror_time_stats|
<p>This table indicates when documents were successfully published:
<p>|tabpub_time_stats|
<p>This table indicates what document errors have been identified by
Lintadas, or during mirroring or publication:
<p>|tabdoc_error_stats|
<h1>Published Document Statistics</h1>
<p>The rest of these statistics only report on documents that
have been successfully published.
<p>The following tables give statistics on various document
meta-data:
<p>|tabdoc_format_stats|
<p>|tabdoc_dtd_stats|
], 1)
@ -415,7 +444,7 @@ insert([topic], [View Topic], [],
insert([document], [|doc.title|], [],
[
|tabdocument_tabs|
|blkdocument_nav_bar|
|tabeditdoc|
<p>|tabdocerrors|
<p>|tabdocfiles|
@ -429,45 +458,45 @@ insert([document], [|doc.title|], [],
insert([document_main], [|doc.title|], [],
[
|tabdocument_tabs|
|blkdocument_nav_bar|
|tabeditdoc|
<p>|tabdocerrors|
])
insert([document_files], [|doc.title|], [],
[
|tabdocument_tabs|
|blkdocument_nav_bar|
|tabdocfiles|
<p>|tabdocfileerrors|
])
insert([document_users], [|doc.title|], [],
[
|tabdocument_tabs|
|blkdocument_nav_bar|
|tabdocusers|
])
insert([document_revs], [|doc.title|], [],
[
|tabdocument_tabs|
|blkdocument_nav_bar|
|tabdocversions|
])
insert([document_topics], [|doc.title|], [],
[
|tabdocument_tabs|
|blkdocument_nav_bar|
|tabdoctopics|
])
insert([document_notes], [|doc.title|], [],
[
|tabdocument_tabs|
|blkdocument_nav_bar|
|tabdocnotes|
])
insert([document_translation], [|doc.title|], [],
[
|tabdocument_tabs|
|blkdocument_nav_bar|
|tabdoctranslations|
])

View File

@ -63,7 +63,7 @@ insert([doctable], [Browse Documents], [],
insert([document_list], [Document List], [],
[
|tabdocs_block|
|tabdocs_expanded|
], 0)
insert([search], [Search], [],
@ -80,6 +80,7 @@ insert([stats], [Current Statistics], [],
[
|tabpub_status_stats|
<p>|tabdoc_error_stats|
<p>|tablint_time_stats|
<p>|tabmirror_time_stats|
<p>|tabpub_time_stats|
<p>|tabdoc_format_stats|

View File

@ -114,6 +114,7 @@ insert(strnone)
insert(strstatistic)
insert(strcount)
insert(strpct)
insert(strlint_time_stats)
insert(strmirror_time_stats)
insert(strpub_time_stats)
insert(strpub_status_stats)
@ -121,4 +122,8 @@ insert(strdoc_error_stats)
insert(strdoc_format_stats)
insert(strdoc_dtd_stats)
insert(strtotal)
insert(strcollection)
insert(strcollections)
insert(strlayout)
insert(strcompact_layout)
insert(strexpanded_layout)

View File

@ -114,6 +114,7 @@ insert(strnone, [None])
insert(strstatistic, [Statistic])
insert(strcount, [Count])
insert(strpct, [Percent])
insert(strlint_time_stats, [Lintadas Time Statistics])
insert(strmirror_time_stats, [Mirror Time Statistics])
insert(strpub_time_stats, [Publication Time Statistics])
insert(strpub_status_stats, [Publication Status Statistics])
@ -121,4 +122,8 @@ insert(strdoc_error_stats, [Document Error Statistics])
insert(strdoc_format_stats, [Document Format Statistics])
insert(strdoc_dtd_stats, [Document DTD Statistics])
insert(strtotal, [Total])
insert(strcollection, [Collection])
insert(strcollections, [Collections])
insert(strlayout, [Layout])
insert(strcompact_layout, [Compact Layout])
insert(strexpanded_layout, [Expanded Layout])

View File

@ -114,6 +114,7 @@ insert(strnone, [None])
insert(strstatistic, [Statistic])
insert(strcount, [Count])
insert(strpct, [Percent])
insert(strlint_time_stats, [Lintadas Time Statistics])
insert(strmirror_time_stats, [Mirror Time Statistics])
insert(strpub_time_stats, [Publication Time Statistics])
insert(strpub_status_stats, [Publication Status Statistics])
@ -121,4 +122,8 @@ insert(strdoc_error_stats, [Document Error Statistics])
insert(strdoc_format_stats, [Document Format Statistics])
insert(strdoc_dtd_stats, [Document DTD Statistics])
insert(strtotal, [Total])
insert(strcollection, [Collection])
insert(strcollections, [Collections])
insert(strlayout, [Layout])
insert(strcompact_layout, [Compact Layout])
insert(strexpanded_layout, [Expanded Layout])

View File

@ -114,6 +114,7 @@ insert(strnone, [None])
insert(strstatistic, [Statistic])
insert(strcount, [Count])
insert(strpct, [Percent])
insert(strlint_time_stats, [Lintadas Time Statistics])
insert(strmirror_time_stats, [Mirror Time Statistics])
insert(strpub_time_stats, [Publication Time Statistics])
insert(strpub_status_stats, [Publication Status Statistics])
@ -121,4 +122,8 @@ insert(strdoc_error_stats, [Document Error Statistics])
insert(strdoc_format_stats, [Document Format Statistics])
insert(strdoc_dtd_stats, [Document DTD Statistics])
insert(strtotal, [Total])
insert(strcollection, [Collection])
insert(strcollections, [Collections])
insert(strlayout, [Layout])
insert(strcompact_layout, [Compact Layout])
insert(strexpanded_layout, [Expanded Layout])

View File

@ -500,6 +500,7 @@ class Doc:
self.lint_time = time2str(row[26])
self.pub_time = time2str(row[27])
self.mirror_time = time2str(row[28])
def save(self):
"""
FIXME: use cursor.execute(sql,params) instead! --nico

View File

@ -265,14 +265,10 @@ class PageFactory:
newstring = tables.tabtopics(uri)
elif token=='tabtopic':
newstring = tables.tabtopic(uri)
# elif token=='tabdocs':
# newstring = tables.doctable(uri, lang=uri.lang, layout='compact')
# elif token=='tabdocs_block':
# newstring = tables.doctable(uri, lang=uri.lang, layout='block')
elif token=='tabmaint_wanted':
newstring = tables.doctable(uri, maintainer_wanted=1, lang=uri.lang)
newstring = tables.doctable(uri, maintainer_wanted='1', lang=uri.lang)
elif token=='tabunmaintained':
newstring = tables.doctable(uri, maintained=0, lang=uri.lang)
newstring = tables.doctable(uri, maintained='0', lang=uri.lang)
elif token=='tabpending':
newstring = tables.doctable(uri, pub_status_code='P', lang=uri.lang)
elif token=='tabwishlist':
@ -322,9 +318,11 @@ class PageFactory:
elif token=='taberrors':
newstring = tables.errors(uri)
elif token=='tabsearch':
newstring = tables.tabsearch(uri)
newstring = tables.tabsearch(uri, lang=uri.lang)
elif token=='tabsplashlanguages':
newstring = tables.tabsplashlanguages(uri)
elif token=='tablint_time_stats':
newstring = tables.tablint_time_stats(uri)
elif token=='tabmirror_time_stats':
newstring = tables.tabmirror_time_stats(uri)
elif token=='tabpub_time_stats':
@ -339,6 +337,8 @@ class PageFactory:
newstring = tables.tabdoc_dtd_stats(uri)
elif token=='tabdocument_tabs':
newstring = tables.tabdocument_tabs(uri)
elif token=='tabdocument_icon_box':
newstring = tables.tabdocument_icon_box(uri)
# Tables, Blocks and Strings
if newstring==None:

View File

@ -40,6 +40,7 @@ class Stats(LampadasCollection):
self.data = {}
self['general'] = StatTable(['doc_count'])
self['pub_status'] = StatTable()
self['lint_time'] = StatTable()
self['mirror_time'] = StatTable()
self['pub_time'] = StatTable()
self['doc_error'] = StatTable()
@ -61,19 +62,26 @@ class Stats(LampadasCollection):
for key in doc.errors.sort_by('err_id'):
self['doc_error'].inc(key)
# Only track mirroring stats for publishable docs
# Only track stats for publishable docs
if doc.pub_status_code=='N':
mirror_time = date2str(doc.mirror_time)
self['mirror_time'].inc(mirror_time)
# Only track publishing stats for mirrored docs
if doc.mirror_time > '':
pub_time = date2str(doc.pub_time)
self['pub_time'].inc(pub_time)
if doc.pub_time > '':
self['doc_format'].inc(doc.format_code)
self['doc_dtd'].inc(doc.dtd_code)
# Track when errors were checked.
lint_time = date2str(doc.lint_time)
self['lint_time'].inc(lint_time)
# Must be error-checked before mirroring.
if doc.lint_time > '':
mirror_time = date2str(doc.mirror_time)
self['mirror_time'].inc(mirror_time)
# Only track publishing stats for mirrored docs
if doc.mirror_time > '':
pub_time = date2str(doc.pub_time)
self['pub_time'].inc(pub_time)
if doc.pub_time > '':
self['doc_format'].inc(doc.format_code)
self['doc_dtd'].inc(doc.dtd_code)
class StatTable(LampadasCollection):

View File

@ -87,8 +87,9 @@ class Tables(LampadasCollection):
elif sessions.session.user.can_edit(doc_id=uri.id)==0:
return '|blknopermission|'
box = WOStringIO('<table class="box" width="100%">')
box.write('<tr><th colspan="6">|strdocdetails|</th></tr>')
box = WOStringIO('<table class="box" width="100%">' \
'<tr><th colspan="6">|strdocdetails|</th></tr>')
if uri.id > 0:
lintadas.check_doc(uri.id)
lintadas.import_doc_metadata(uri.id)
@ -120,8 +121,7 @@ class Tables(LampadasCollection):
<tr>
<td class="label">|strabstract|</td>
<td colspan="5"><textarea name="abstract" rows="6" cols="40" style="width:100%%" wrap>%s</textarea></td>
</tr>''' % (doc.short_desc,
doc.abstract))
</tr>''' % (doc.short_desc, doc.abstract))
box.write('<tr>')
box.write('<td class="label">|strstatus|</td><td>' + widgets.pub_status_code(doc.pub_status_code, uri.lang) + '</td>\n')
box.write('<td class="label">|strtype|</td><td>' + widgets.type_code(doc.type_code, uri.lang) + '</td>\n')
@ -522,7 +522,7 @@ class Tables(LampadasCollection):
box = box + '<td>' + errtype.name[uri.lang] + '</td>\n'
box = box + '<td>' + error.name[uri.lang]
if docerror.notes > '':
box = box + '<br><pre>' + html_encode(docerror.notes) + '</pre>'
box = box + '<br><pre>' + docerror.notes + '</pre>'
box = box + '</td>\n'
box = box + '</tr>\n'
box = box + '</table>\n'
@ -722,39 +722,44 @@ class Tables(LampadasCollection):
return box
def doctable(self, uri,
title=None,
pub_status_code=None,
type_code=None,
topic_code=None,
username=None,
maintained=None,
maintainer_wanted=None,
lang=None,
review_status_code=None,
tech_review_status_code=None,
pub_date=None,
last_update=None,
tickle_date=None,
isbn=None,
rating=None,
format_code=None,
dtd_code=None,
license_code=None,
copyright_holder=None,
sk_seriesid=None,
abstract=None,
short_desc=None,
collection_code=None,
title='',
short_title='',
pub_status_code='',
type_code='',
topic_code='',
username='',
maintained='',
maintainer_wanted='',
lang='',
review_status_code='',
tech_review_status_code='',
pub_date='',
last_update='',
tickle_date='',
isbn='',
rating='',
format_code='',
dtd_code='',
license_code='',
copyright_holder='',
sk_seriesid='',
abstract='',
short_desc='',
collection_code='',
columns={},
layout='compact',
show_search=0
):
"""
Creates a listing of all documents which fit the parameters passed in.
You can select a layout from "compact" or "block". Compact is onel line
per document; block is a table per document. The block layout does
You can select a layout from "compact" or "expanded". Compact is one line
per document; expanded is a table per document. The expanded layout does
not accept additional columns to be requested, and ignores the columns{}
parameter.
The DocTable includes its own search form, although the search form
can also stand alone.
"""
log(3, "Creating doctable")
@ -768,7 +773,7 @@ class Tables(LampadasCollection):
for column in columns.keys():
box.write('<th class="collabel">%s</td>' % column)
box.write('</tr>\n')
elif layout=='block':
elif layout=='expanded':
box = WOStringIO('')
keys = lampadas.docs.sort_by("title")
@ -783,80 +788,83 @@ class Tables(LampadasCollection):
# Filter documents according to parameters passed in
# by the calling routine.
if not username==None:
if username > '':
if doc.users[username]==None:
continue
if not lang==None:
if lang > '':
if doc.lang <> lang:
continue
if not pub_status_code==None:
if pub_status_code > '':
if doc.pub_status_code <> pub_status_code:
continue
# If any other parameters were specified, limit the documents
# to those which match the requirements.
if not type_code==None:
if type_code > '':
if doc.type_code <> type_code:
continue
if not topic_code==None:
if topic_code > '':
topic = lampadas.topics[topic_code]
if topic.docs[doc.id]==None:
continue
if not maintained==None:
if doc.maintained <> maintained:
if maintained > '':
if doc.maintained <> int(maintained):
continue
if not maintainer_wanted==None:
if doc.maintainer_wanted <> maintainer_wanted:
if maintainer_wanted > '':
if doc.maintainer_wanted <> int(maintainer_wanted):
continue
if not title==None:
if title > '':
if doc.title.upper().find(title.upper())==-1:
continue
if not review_status_code==None:
if short_desc > '':
if doc.short_title.upper().find(short_title.upper())==-1:
continue
if review_status_code > '':
if doc.review_status_code <> review_status_code:
continue
if not review_status_code==None:
if review_status_code > '':
if doc.review_status_code <> review_status_code:
continue
if not tech_review_status_code==None:
if tech_review_status_code > '':
if doc.tech_review_status_code <> tech_review_status_code:
continue
if not pub_date==None:
if pub_date > '':
if doc.pub_date <> pub_date:
continue
if not last_update==None:
if last_update > '':
if doc.last_update <> last_update:
continue
if not tickle_date==None:
if tickle_date > '':
if doc.tickle_date <> tickle_date:
continue
if not isbn==None:
if isbn > '':
if doc.isbn <> isbn:
continue
if not rating==None:
if doc.rating <> rating:
if rating > '':
if doc.rating <> int(rating):
continue
if not format_code==None:
if format_code > '':
if doc.format_code <> format_code:
continue
if not dtd_code==None:
if dtd_code > '':
if doc.dtd_code <> dtd_code:
continue
if not license_code==None:
if license_code > '':
if doc.license_code <> license_code:
continue
if not copyright_holder==None:
if copyright_holder > '':
if doc.copyright_holder.upper().find(copyright_holder.upper())==-1:
continue
if not sk_seriesid==None:
if sk_seriesid > '':
if doc.sk_seriesid.find(sk_seriesid)==-1:
continue
if not abstract==None:
if abstract > '':
if doc.abstract.upper().find(abstract.upper())==-1:
continue
if not short_desc==None:
if short_desc > '':
if doc.short_desc.upper().find(short_desc.upper())==-1:
continue
if not collection_code==None:
if collection_code > '':
if collection_code not in doc.collections.keys():
continue
@ -871,25 +879,7 @@ class Tables(LampadasCollection):
if layout=='compact':
box.write('<tr class="%s">\n' % odd_even.get_next())
# Link to the online output
if doc.pub_time > '':
box.write('<td width=22><a href="|uri.base|doc/%s/index.html">%s</a></td>\n'
% (str(doc.id), HTML_ICON_SM))
else:
box.write('<td></td>\n')
# Folder icon
if (sessions.session and sessions.session.user.can_edit(doc_id=doc.id)==1) or doc.pub_time > '':
box.write('<td width=22><a href="|uri.base|docdownloads/%s/">%s</a></td>\n' % (str(doc.id), FOLDER_ICON_SM))
else:
box.write('<td></td>')
# Edit icon
if sessions.session and sessions.session.user.can_edit(doc_id=doc.id)==1:
box.write('<td width=22><a href="|uri.base|document_main/%s|uri.lang_ext|">%s</a></td>\n'
% (str(doc.id), EDIT_ICON_SM))
else:
box.write('<td></td>')
box.write(self.document_icon_cells(doc.id, 'td'))
# Format the title differently to flag its status
if doc.pub_time > '':
@ -907,7 +897,7 @@ class Tables(LampadasCollection):
box.write('</tr>\n')
# This is a blocky extended listing, complete with abstracts.
elif layout=='block':
elif layout=='expanded':
# Link to the online output.
if doc.pub_time > '':
@ -916,10 +906,10 @@ class Tables(LampadasCollection):
block_indexlink = '<td width=32></td>'
# Folder icon
if (sessions.session and sessions.session.user.can_edit(doc_id=doc.id)==1) or doc.pub_time > '':
if doc.pub_time > '':
block_dllink = '<td width=32><a href="|uri.base|docdownloads/' + str(doc.id) + '/">' + FOLDER_ICON + '</a></td>'
else:
box.write('<td width=32></td>')
block_dllink = ('<td width=32></td>')
# Edit icon
if sessions.session and sessions.session.user.can_edit(doc_id=doc.id)==1:
@ -949,6 +939,70 @@ class Tables(LampadasCollection):
if layout=='compact':
box.write('</table>\n')
# The DocTable can carry along its own search form that stays in sync
# for filtering the data. Insert it here if show_search was passed in.
if show_search==1:
box.write(self.tabsearch(uri, title=title,
short_title=short_title,
pub_status_code=pub_status_code,
type_code=type_code,
topic_code=topic_code,
username=username,
maintained=maintained,
maintainer_wanted=maintainer_wanted,
lang=lang,
review_status_code=review_status_code,
tech_review_status_code=tech_review_status_code,
pub_date=pub_date,
last_update=last_update,
tickle_date=tickle_date,
isbn=isbn,
rating=rating,
format_code=format_code,
dtd_code=dtd_code,
license_code=license_code,
copyright_holder=copyright_holder,
sk_seriesid=sk_seriesid,
abstract=abstract,
short_desc=short_desc,
collection_code=collection_code,
layout=layout))
return box.get_value()
def tabdocument_icon_box(self, uri):
"""Returns a navigation box of document icons."""
box = WOStringIO('<table><tr>%s</tr></table>'
% (self.document_icon_cells(uri.id)))
return box.get_value()
def document_icon_cells(self, doc_id, cell_type='td'):
"""Returns a series of three cells populated with icons for the document."""
doc = lampadas.docs[doc_id]
# Link to the online output
if doc.pub_time > '':
box = WOStringIO('<%s width=22><a href="|uri.base|doc/%s/index.html">%s</a></%s>\n'
% (cell_type,str(doc.id), HTML_ICON_SM, cell_type))
else:
box = WOStringIO('<%s></%s>\n' % (cell_type, cell_type))
# Folder icon
if doc.mirror_time > '':
box.write('<%s width=22><a href="|uri.base|docdownloads/%s/">%s</a></%s>\n'
% (cell_type, str(doc.id), FOLDER_ICON_SM, cell_type))
else:
box.write('<%s></%s>\n' % (cell_type, cell_type))
# Edit icon
if sessions.session and sessions.session.user.can_edit(doc_id=doc.id)==1:
box.write('<%s width=22><a href="|uri.base|document_main/%s|uri.lang_ext|">%s</a></%s>\n'
% (cell_type, str(doc.id), EDIT_ICON_SM, cell_type))
else:
box.write('<%s></%s>\n' % (cell_type, cell_type))
return box.get_value()
def userdocs(self, uri, username=''):
@ -1270,7 +1324,12 @@ class Tables(LampadasCollection):
box.write('</td></tr>\n</table>\n')
return box.get_value()
def tabsearch(self, uri):
def tabsearch(self, uri, title='', short_title='', pub_status_code='', type_code='', topic_code='',
username='', maintained='', maintainer_wanted='', lang='', review_status_code='',
tech_review_status_code='', pub_date='', last_update='', tickle_date='',
isbn='', rating='', format_code='', dtd_code='', license_code='',
copyright_holder='', sk_seriesid='', abstract='', short_desc='', collection_code='',
layout='compact'):
log(3, 'Creating tabsearch table')
box = WOStringIO()
box.write('''
@ -1278,9 +1337,11 @@ class Tables(LampadasCollection):
<form name="search" action="/data/search/document">
<tr><th colspan="2">|strsearch|</th></tr>\n
<tr><td class="label">|strtitle|</td><td>%s</td></tr>
<tr><td class="label">|strshort_title|</td><td>%s</td></tr>
<tr><td class="label">|strstatus|</td><td>%s</td></tr>
<tr><td class="label">|strtype|</td><td>%s</td></tr>
<tr><td class="label">|strtopic|</td><td>%s</td></tr>
<tr><td class="label">|strusername|</td><td>%s</td></tr>
<tr><td class="label">|strmaintained|</td><td>%s</td></tr>
<tr><td class="label">|strmaint_wanted|</td><td>%s</td></tr>
<tr><td class="label">|strlanguage|</td><td>%s</td></tr>
@ -1298,34 +1359,63 @@ class Tables(LampadasCollection):
<tr><td class="label">|strtrans_master|</td><td>%s</td></tr>
<tr><td class="label">|strabstract|</td><td>%s</td></tr>
<tr><td class="label">|strshort_desc|</td><td>%s</td></tr>
<tr><td class="label">|strcollection|</td><td>%s</td></tr>
<tr><td class="label">|strlayout|</td><td>%s</td></tr>
<tr><td></td><td><input type="submit" value="|strsearch|"></td></tr>
</form>
</table>
'''
% (widgets.title(''),
widgets.pub_status_code('', uri.lang),
widgets.type_code('', uri.lang),
widgets.topic_code('', uri.lang),
widgets.tf('maintained', '', uri.lang),
widgets.tf('maintainer_wanted', '', uri.lang),
widgets.doc_lang(uri.lang, uri.lang),
widgets.review_status_code('', uri.lang),
widgets.tech_review_status_code('', uri.lang),
widgets.pub_date(''),
widgets.last_update(''),
widgets.tickle_date(''),
widgets.isbn(''),
widgets.rating(''),
widgets.format_code('', uri.lang),
widgets.dtd_code(''),
widgets.license_code('', uri.lang),
widgets.copyright_holder(''),
widgets.sk_seriesid(''),
widgets.abstract(''),
widgets.short_desc('')
% (widgets.title(title),
widgets.short_title(short_title),
widgets.pub_status_code(pub_status_code, uri.lang),
widgets.type_code(type_code, uri.lang),
widgets.topic_code(topic_code, uri.lang),
widgets.username(username),
widgets.tf('maintained', maintained, uri.lang),
widgets.tf('maintainer_wanted', maintainer_wanted, uri.lang),
widgets.doc_lang(lang, uri.lang),
widgets.review_status_code(review_status_code, uri.lang),
widgets.tech_review_status_code(tech_review_status_code, uri.lang),
widgets.pub_date(pub_date),
widgets.last_update(last_update),
widgets.tickle_date(tickle_date),
widgets.isbn(isbn),
widgets.rating(rating),
widgets.format_code(format_code, uri.lang),
widgets.dtd_code(dtd_code),
widgets.license_code(license_code, uri.lang),
widgets.copyright_holder(copyright_holder),
widgets.sk_seriesid(sk_seriesid),
widgets.abstract(abstract),
widgets.short_desc(short_desc),
widgets.collection_code(collection_code, uri.lang),
widgets.doctable_layout(layout)
))
return box.get_value()
def tablint_time_stats(self, uri):
log(3, 'Creating lint_time_stats table')
box = WOStringIO('<table class="box">\n' \
'<tr><th colspan="3">|strlint_time_stats|</th></tr>\n' \
'<tr><th class="collabel">|strlint_time|</th>\n' \
'<th class="collabel" align="right">|strcount|</th>\n' \
'<th class="collabel" align="right">|strpct|</th>\n' \
'</tr>\n')
stattable = stats['lint_time']
odd_even = OddEven()
for key in stattable.sort_by('label'):
stat = stattable[key]
box.write('<tr class="%s"><td class="label">%s</td>\n' \
'<td align="right">%s</td>\n' \
'<td align="right">%s</td>\n' \
'</tr>\n'
% (odd_even.get_next(), stat.label, stat.value, fpformat.fix(stats['lint_time'].pct(key) * 100, 2)))
box.write('<tr class="%s"><td class="label">|strtotal|</td>\n' \
'<td align="right">%s</td><td></td>\n' \
'</tr></table>'
% (odd_even.get_next(), stattable.sum()))
return box.get_value()
def tabmirror_time_stats(self, uri):
log(3, 'Creating mirror_time_stats table')
box = WOStringIO('<table class="box">\n' \
@ -1584,15 +1674,15 @@ class DocTable(Table):
Table.__init__(self, 'doctable', self.method)
def method(self, uri):
return tables.doctable(uri, lang=uri.lang, layout='compact')
return tables.doctable(uri, lang=uri.lang, layout='compact', show_search=0)
class DocTableBlock(Table):
class DocTableExpanded(Table):
def __init__(self):
Table.__init__(self, 'doctableblock', self.method)
Table.__init__(self, 'doctableexpanded', self.method)
def method(self, uri):
return tables.doctable(uri, lang=uri.lang, layout='block')
return tables.doctable(uri, lang=uri.lang, layout='expanded', show_search=0)
class TableMap(LampadasCollection):
@ -1600,7 +1690,7 @@ class TableMap(LampadasCollection):
def __init__(self):
self.data = {}
self['tabdocs'] = DocTable()
self['tabdocs_block'] = DocTableBlock()
self['tabdocs_expanded'] = DocTableExpanded()
tables = Tables()
tablemap = TableMap()

View File

@ -112,6 +112,10 @@ class URI:
self.lang = lang.upper()
self.lang_ext = '.' + lang.lower() + '.html'
path = path[:-3]
else:
self.lang_ext = '.' + 'en.html'
else:
self.lang_ext = '.' + 'en.html'
# Split up the path
if path.count('/')==0:

View File

@ -51,6 +51,9 @@ class Widgets:
text = string.join(parts, ' + ')
return text
def short_title(self, value):
return WOStringIO('<input type=text name="short_title" style="width:100%%" value="%s">' % value).get_value()
def abstract(self, value):
return '<input type=text name="abstract" style="width:100%" value="' + value + '">'
@ -84,11 +87,28 @@ class Widgets:
v1, v2 = '', ''
return WOStringIO('<select name="%s">\n' \
'<option></option>\n' \
'<option value="1"%s>|stryes|</option>\n' \
'<option value="0"%s>|strno|</option>\n' \
'<option value="compact"%s>|stryes|</option>\n' \
'<option value="expanded"%s>|strno|</option>\n' \
'</select>\n'
% (name, v1, v2)).get_value()
def doctable_layout(self, value='compact'):
if value=='compact':
compact, expanded = ' selected', ''
elif value=='expanded':
compact, expanded = '', ' selected'
else:
compact, expanded = 'compact', ''
return WOStringIO('<select name="%s">\n' \
'<option value="compact"%s>|strcompact_layout|</option>\n' \
'<option value="expanded"%s>|strexpanded_layout|</option>\n' \
'</select>\n'
% ('layout', compact, expanded)).get_value()
def username(self, value):
return '<input type=text name="username" width="15" maxlength="40" value="' + value + '">'
def stylesheet(self, value):
return '<select name="stylesheet">\n</select>\n'
@ -106,6 +126,21 @@ class Widgets:
combo.write("</select>")
return combo.get_value()
def collection_code(self, value, lang):
combo = WOStringIO("<select name='collection_code'>\n" \
"<option></option>\n")
keys = lampadas.collections.sort_by('sort_order')
for key in keys:
collection = lampadas.collections[key]
assert not collection==None
combo.write("<option ")
if collection.code==value:
combo.write("selected ")
combo.write("value='%s'>%s</option>\n"
% (collection.code, collection.name[lang]))
combo.write("</select>")
return combo.get_value()
def type_code(self, value, lang):
combo = WOStringIO("<select name='type_code'>\n" \
"<option></option>\n")

View File

@ -25,7 +25,10 @@ from mod_python import apache
import smtplib
def referer_lang_ext(req):
url = req.headers_in['referer']
try:
url = req.headers_in['referer']
except KeyError:
url = ''
uri = URI(url)
return uri.lang_ext

View File

@ -75,6 +75,7 @@ def document(req, username, doc_id,
if doc==None:
return error("Cannot find document " + str(doc_id))
# Save all data to the document.
doc.title = title
doc.short_title = short_title
doc.pub_status_code = pub_status_code

View File

@ -34,9 +34,11 @@ import os
def document(req,
title='',
short_title='',
pub_status_code='',
type_code='',
topic_code='',
username='',
maintained='',
maintainer_wanted='',
lang='',
@ -54,6 +56,9 @@ def document(req,
sk_seriesid='',
abstract='',
short_desc='',
collection_code='',
columns={},
layout='compact'
):
"""
Returns the results of a document search.
@ -74,27 +79,32 @@ def document(req,
# be rather expensive. -- DCM
save_page = page.page[uri.lang]
table = tables.doctable(uri,
title = empty2None_str(title),
pub_status_code = empty2None_str(pub_status_code),
type_code = empty2None_str(type_code),
topic_code = empty2None_str(topic_code),
maintained = empty2None_int(maintained),
maintainer_wanted = empty2None_int(maintainer_wanted),
lang = empty2None_str(lang),
review_status_code = empty2None_str(review_status_code),
tech_review_status_code = empty2None_str(tech_review_status_code),
pub_date = empty2None_str(pub_date),
last_update = empty2None_str(last_update),
tickle_date = empty2None_str(tickle_date),
isbn = empty2None_str(isbn),
rating = empty2None_str(rating),
format_code = empty2None_str(format_code),
dtd_code = empty2None_str(dtd_code),
license_code = empty2None_str(license_code),
copyright_holder = empty2None_str(copyright_holder),
sk_seriesid = empty2None_str(sk_seriesid),
abstract = empty2None_str(abstract),
short_desc = empty2None_str(short_desc))
title = title,
short_title = short_title,
pub_status_code = pub_status_code,
type_code = type_code,
topic_code = topic_code,
username = username,
maintained = maintained,
maintainer_wanted = maintainer_wanted,
lang = lang,
review_status_code = review_status_code,
tech_review_status_code = tech_review_status_code,
pub_date = pub_date,
last_update = last_update,
tickle_date = tickle_date,
isbn = isbn,
rating = rating,
format_code = format_code,
dtd_code = dtd_code,
license_code = license_code,
copyright_holder = copyright_holder,
sk_seriesid = sk_seriesid,
abstract = abstract,
short_desc = short_desc,
collection_code = collection_code,
layout = layout,
show_search = 1)
page.page[uri.lang] = page.page[uri.lang].replace('|tabdocs|', table)
uri = URI('doctable' + referer_lang_ext(req))
@ -104,14 +114,3 @@ def document(req,
# Restore the original page
page.page[uri.lang] = save_page
return html
def empty2None_str(astring):
if astring=='':
return None
return astring
def empty2None_int(astring):
if astring=='':
return None
return int(astring)