diff --git a/LDP/lampadas/database/tables/block/EN.m4 b/LDP/lampadas/database/tables/block/EN.m4
index 742286f0..13a387d2 100644
--- a/LDP/lampadas/database/tables/block/EN.m4
+++ b/LDP/lampadas/database/tables/block/EN.m4
@@ -63,3 +63,12 @@ insert([blknotfound], [
|strnotfound|
])
+
+insert([blkdocument_nav_bar], [
+
+
+ |tabdocument_icon_box|
+ |tabdocument_tabs|
+
+
])
+
diff --git a/LDP/lampadas/database/tables/page_i18n/DE.m4 b/LDP/lampadas/database/tables/page_i18n/DE.m4
index 382e77d0..ae967ee7 100644
--- a/LDP/lampadas/database/tables/page_i18n/DE.m4
+++ b/LDP/lampadas/database/tables/page_i18n/DE.m4
@@ -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|
|tabdoc_error_stats|
+
|tablint_time_stats|
|tabmirror_time_stats|
|tabpub_time_stats|
|tabdoc_format_stats|
diff --git a/LDP/lampadas/database/tables/page_i18n/EN.m4 b/LDP/lampadas/database/tables/page_i18n/EN.m4
index eec5d9a8..e047d92e 100644
--- a/LDP/lampadas/database/tables/page_i18n/EN.m4
+++ b/LDP/lampadas/database/tables/page_i18n/EN.m4
@@ -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|
-
|tabdoc_error_stats|
+
+
Publishing Statistics
+
+ These statistics show the state of the document publication
+ system.
+
+
The first table indicates when Lintadas (the Lampadas error
+ checker) was run on each document:
+
+
|tablint_time_stats|
+
+
This table indicates when documents were successfully mirrored:
+
|tabmirror_time_stats|
+
+
This table indicates when documents were successfully published:
+
|tabpub_time_stats|
+
+
This table indicates what document errors have been identified by
+ Lintadas, or during mirroring or publication:
+
+
|tabdoc_error_stats|
+
+
Published Document Statistics
+
+ The rest of these statistics only report on documents that
+ have been successfully published.
+
+
The following tables give statistics on various document
+ meta-data:
+
|tabdoc_format_stats|
|tabdoc_dtd_stats|
], 1)
@@ -415,7 +444,7 @@ insert([topic], [View Topic], [],
insert([document], [|doc.title|], [],
[
- |tabdocument_tabs|
+ |blkdocument_nav_bar|
|tabeditdoc|
|tabdocerrors|
|tabdocfiles|
@@ -429,45 +458,45 @@ insert([document], [|doc.title|], [],
insert([document_main], [|doc.title|], [],
[
- |tabdocument_tabs|
+ |blkdocument_nav_bar|
|tabeditdoc|
|tabdocerrors|
])
insert([document_files], [|doc.title|], [],
[
- |tabdocument_tabs|
+ |blkdocument_nav_bar|
|tabdocfiles|
|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|
])
diff --git a/LDP/lampadas/database/tables/page_i18n/FR.m4 b/LDP/lampadas/database/tables/page_i18n/FR.m4
index 6e81614a..b51ed882 100644
--- a/LDP/lampadas/database/tables/page_i18n/FR.m4
+++ b/LDP/lampadas/database/tables/page_i18n/FR.m4
@@ -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|
|tabdoc_error_stats|
+
|tablint_time_stats|
|tabmirror_time_stats|
|tabpub_time_stats|
|tabdoc_format_stats|
diff --git a/LDP/lampadas/database/tables/string/EN.m4 b/LDP/lampadas/database/tables/string/EN.m4
index 3c4d4bf6..85e6c7fb 100644
--- a/LDP/lampadas/database/tables/string/EN.m4
+++ b/LDP/lampadas/database/tables/string/EN.m4
@@ -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)
diff --git a/LDP/lampadas/database/tables/string_i18n/DE.m4 b/LDP/lampadas/database/tables/string_i18n/DE.m4
index bd17b499..86cd08a6 100644
--- a/LDP/lampadas/database/tables/string_i18n/DE.m4
+++ b/LDP/lampadas/database/tables/string_i18n/DE.m4
@@ -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])
diff --git a/LDP/lampadas/database/tables/string_i18n/EN.m4 b/LDP/lampadas/database/tables/string_i18n/EN.m4
index c159ab75..44255858 100644
--- a/LDP/lampadas/database/tables/string_i18n/EN.m4
+++ b/LDP/lampadas/database/tables/string_i18n/EN.m4
@@ -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])
diff --git a/LDP/lampadas/database/tables/string_i18n/FR.m4 b/LDP/lampadas/database/tables/string_i18n/FR.m4
index 7deadf22..eacdb78a 100644
--- a/LDP/lampadas/database/tables/string_i18n/FR.m4
+++ b/LDP/lampadas/database/tables/string_i18n/FR.m4
@@ -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])
diff --git a/LDP/lampadas/pylib/DataLayer.py b/LDP/lampadas/pylib/DataLayer.py
index 1fbdb30b..897dfaac 100755
--- a/LDP/lampadas/pylib/DataLayer.py
+++ b/LDP/lampadas/pylib/DataLayer.py
@@ -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
diff --git a/LDP/lampadas/pylib/HTML.py b/LDP/lampadas/pylib/HTML.py
index 45fa591b..83da91cb 100755
--- a/LDP/lampadas/pylib/HTML.py
+++ b/LDP/lampadas/pylib/HTML.py
@@ -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:
diff --git a/LDP/lampadas/pylib/Stats.py b/LDP/lampadas/pylib/Stats.py
index b60697cf..c16f30a1 100755
--- a/LDP/lampadas/pylib/Stats.py
+++ b/LDP/lampadas/pylib/Stats.py
@@ -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):
diff --git a/LDP/lampadas/pylib/Tables.py b/LDP/lampadas/pylib/Tables.py
index 55c2c7d0..a0b975e3 100644
--- a/LDP/lampadas/pylib/Tables.py
+++ b/LDP/lampadas/pylib/Tables.py
@@ -87,8 +87,9 @@ class Tables(LampadasCollection):
elif sessions.session.user.can_edit(doc_id=uri.id)==0:
return '|blknopermission|'
- box = WOStringIO('
')
- box.write('|strdocdetails| ')
+ box = WOStringIO('' \
+ '|strdocdetails| ')
+
if uri.id > 0:
lintadas.check_doc(uri.id)
lintadas.import_doc_metadata(uri.id)
@@ -120,8 +121,7 @@ class Tables(LampadasCollection):
|strabstract|
- ''' % (doc.short_desc,
- doc.abstract))
+ ''' % (doc.short_desc, doc.abstract))
box.write('')
box.write('|strstatus| ' + widgets.pub_status_code(doc.pub_status_code, uri.lang) + ' \n')
box.write('|strtype| ' + widgets.type_code(doc.type_code, uri.lang) + ' \n')
@@ -522,7 +522,7 @@ class Tables(LampadasCollection):
box = box + '' + errtype.name[uri.lang] + ' \n'
box = box + '' + error.name[uri.lang]
if docerror.notes > '':
- box = box + '' + html_encode(docerror.notes) + ' '
+ box = box + '' + docerror.notes + ' '
box = box + ' \n'
box = box + ' \n'
box = box + '
\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('%s' % column)
box.write('\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(' \n' % odd_even.get_next())
- # Link to the online output
- if doc.pub_time > '':
- box.write('%s \n'
- % (str(doc.id), HTML_ICON_SM))
- else:
- box.write(' \n')
-
- # Folder icon
- if (sessions.session and sessions.session.user.can_edit(doc_id=doc.id)==1) or doc.pub_time > '':
- box.write('%s \n' % (str(doc.id), FOLDER_ICON_SM))
- else:
- box.write(' ')
-
- # Edit icon
- if sessions.session and sessions.session.user.can_edit(doc_id=doc.id)==1:
- box.write('%s \n'
- % (str(doc.id), EDIT_ICON_SM))
- else:
- box.write(' ')
+ 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(' \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 = ' '
# 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 = '' + FOLDER_ICON + ' '
else:
- box.write(' ')
+ block_dllink = (' ')
# 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('
\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(''
+ % (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>%s %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>%s %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>%s %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('\n\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):
'''
- % (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('\n' \
+ '|strlint_time_stats| \n' \
+ '|strlint_time| \n' \
+ '|strcount| \n' \
+ '|strpct| \n' \
+ ' \n')
+ stattable = stats['lint_time']
+ odd_even = OddEven()
+ for key in stattable.sort_by('label'):
+ stat = stattable[key]
+ box.write('%s \n' \
+ '%s \n' \
+ '%s \n' \
+ ' \n'
+ % (odd_even.get_next(), stat.label, stat.value, fpformat.fix(stats['lint_time'].pct(key) * 100, 2)))
+ box.write('|strtotal| \n' \
+ '%s \n' \
+ '
'
+ % (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('\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()
diff --git a/LDP/lampadas/pylib/URLParse.py b/LDP/lampadas/pylib/URLParse.py
index f3eb49ec..98ba2f98 100755
--- a/LDP/lampadas/pylib/URLParse.py
+++ b/LDP/lampadas/pylib/URLParse.py
@@ -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:
diff --git a/LDP/lampadas/pylib/Widgets.py b/LDP/lampadas/pylib/Widgets.py
index 6b440a5f..3ef2700b 100755
--- a/LDP/lampadas/pylib/Widgets.py
+++ b/LDP/lampadas/pylib/Widgets.py
@@ -51,6 +51,9 @@ class Widgets:
text = string.join(parts, ' + ')
return text
+ def short_title(self, value):
+ return WOStringIO(' ' % value).get_value()
+
def abstract(self, value):
return ' '
@@ -84,11 +87,28 @@ class Widgets:
v1, v2 = '', ''
return WOStringIO('\n' \
' \n' \
- '|stryes| \n' \
- '|strno| \n' \
+ '|stryes| \n' \
+ '|strno| \n' \
' \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('\n' \
+ '|strcompact_layout| \n' \
+ '|strexpanded_layout| \n' \
+ ' \n'
+ % ('layout', compact, expanded)).get_value()
+
+
+ def username(self, value):
+ return ' '
+
def stylesheet(self, value):
return '\n \n'
@@ -106,6 +126,21 @@ class Widgets:
combo.write("")
return combo.get_value()
+ def collection_code(self, value, lang):
+ combo = WOStringIO("\n" \
+ " \n")
+ keys = lampadas.collections.sort_by('sort_order')
+ for key in keys:
+ collection = lampadas.collections[key]
+ assert not collection==None
+ combo.write("%s \n"
+ % (collection.code, collection.name[lang]))
+ combo.write(" ")
+ return combo.get_value()
+
def type_code(self, value, lang):
combo = WOStringIO("\n" \
" \n")
diff --git a/LDP/lampadas/pylib/data/globals.py b/LDP/lampadas/pylib/data/globals.py
index 44680869..3729d13d 100644
--- a/LDP/lampadas/pylib/data/globals.py
+++ b/LDP/lampadas/pylib/data/globals.py
@@ -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
diff --git a/LDP/lampadas/pylib/data/save.py b/LDP/lampadas/pylib/data/save.py
index 49dcd368..729e0d8f 100644
--- a/LDP/lampadas/pylib/data/save.py
+++ b/LDP/lampadas/pylib/data/save.py
@@ -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
diff --git a/LDP/lampadas/pylib/data/search.py b/LDP/lampadas/pylib/data/search.py
index 2f57ed13..a12da3b4 100644
--- a/LDP/lampadas/pylib/data/search.py
+++ b/LDP/lampadas/pylib/data/search.py
@@ -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)
-