rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
<td align="right"><input type="hidden" name="referer" value="%(referer)s"><strong>%(username)s:</strong>
<td align="right"> <input type="hidden" name="ln" value="%(ln)s"> <input type="hidden" name="referer" value="%(referer)s"> <strong>%(username)s:</strong>
def tmpl_login_form(self, ln, referer, internal, register_available, methods, selected_method, supportemail): """ Displays a login form
'referer' : cgi.escape(referer), 'username' : _("Username"), 'password' : _("Password"), 'login' : _("login"), }
'ln': ln, 'referer' : cgi.escape(referer), 'username' : _("Username"), 'password' : _("Password"), 'login' : _("login"), }
def tmpl_login_form(self, ln, referer, internal, register_available, methods, selected_method, supportemail): """ Displays a login form
out += """&nbsp;&nbsp;&nbsp;(<a href="./lost">%(lost_pass)s</a>)""" % {
out += """&nbsp;&nbsp;&nbsp;(<a href="./lost?ln=%(ln)s">%(lost_pass)s</a>)""" % { 'ln' : ln,
def tmpl_login_form(self, ln, referer, internal, register_available, methods, selected_method, supportemail): """ Displays a login form
return _("""You seem to be the guest user. You have to <a href="../youraccount.py/login">login</a> first.""")
return _("""You seem to be the guest user. You have to <a href="../youraccount.py/login?ln=%s">login</a> first.""") % ln
def tmpl_account_adminactivities(self, ln, weburl, uid, guest, roles, activities): """ Displays the admin activities block for this user
out += """<br>&nbsp;&nbsp;&nbsp; <a href="%s/admin/bibformat/">%s</a>""" % (weburl, _("Configure BibFormat"))
out += """<br>&nbsp;&nbsp;&nbsp; <a href="%s/admin/bibformat/?ln=%s">%s</a>""" % (weburl, ln, _("Configure BibFormat"))
def tmpl_account_adminactivities(self, ln, weburl, uid, guest, roles, activities): """ Displays the admin activities block for this user
out += """<br>&nbsp;&nbsp;&nbsp; <a href="%s/admin/bibharvest/bibharvestadmin.py">%s</a>""" % (weburl, _("Configure BibHarvest"))
out += """<br>&nbsp;&nbsp;&nbsp; <a href="%s/admin/bibharvest/bibharvestadmin.py?ln=%s">%s</a>""" % (weburl, ln, _("Configure BibHarvest"))
def tmpl_account_adminactivities(self, ln, weburl, uid, guest, roles, activities): """ Displays the admin activities block for this user
out += """<br>&nbsp;&nbsp;&nbsp; <a href="%s/admin/bibindex/bibindexadmin.py">%s</a>""" % (weburl, _("Configure BibIndex"))
out += """<br>&nbsp;&nbsp;&nbsp; <a href="%s/admin/bibindex/bibindexadmin.py?ln=%s">%s</a>""" % (weburl, ln, _("Configure BibIndex"))
def tmpl_account_adminactivities(self, ln, weburl, uid, guest, roles, activities): """ Displays the admin activities block for this user
out += """<br>&nbsp;&nbsp;&nbsp; <a href="%s/admin/bibrank/bibrankadmin.py">%s</a>""" % (weburl, _("Configure BibRank"))
out += """<br>&nbsp;&nbsp;&nbsp; <a href="%s/admin/bibrank/bibrankadmin.py?ln=%s">%s</a>""" % (weburl, ln, _("Configure BibRank"))
def tmpl_account_adminactivities(self, ln, weburl, uid, guest, roles, activities): """ Displays the admin activities block for this user
out += """<br>&nbsp;&nbsp;&nbsp; <a href="%s/admin/webaccess/">%s</a>""" % (weburl, _("Configure WebAccess"))
out += """<br>&nbsp;&nbsp;&nbsp; <a href="%s/admin/webaccess/?ln=%s">%s</a>""" % (weburl, ln, _("Configure WebAccess"))
def tmpl_account_adminactivities(self, ln, weburl, uid, guest, roles, activities): """ Displays the admin activities block for this user
out += """<br>&nbsp;&nbsp;&nbsp; <a href="%s/admin/websearch/websearchadmin.py">%s</a>""" % (weburl, _("Configure WebSearch"))
out += """<br>&nbsp;&nbsp;&nbsp; <a href="%s/admin/websearch/websearchadmin.py?ln=%s">%s</a>""" % (weburl, ln, _("Configure WebSearch"))
def tmpl_account_adminactivities(self, ln, weburl, uid, guest, roles, activities): """ Displays the admin activities block for this user
out += """<br>&nbsp;&nbsp;&nbsp; <a href="%s/admin/websubmit/">%s</a>""" % (weburl, _("Configure WebSubmit"))
out += """<br>&nbsp;&nbsp;&nbsp; <a href="%s/admin/websubmit/?ln=%s">%s</a>""" % (weburl, ln, _("Configure WebSubmit"))
def tmpl_account_adminactivities(self, ln, weburl, uid, guest, roles, activities): """ Displays the admin activities block for this user
'admin_area' : """<a href="%s/admin/">%s</a>.""" % (weburl, _("Admin Area"))
'admin_area' : """<a href="%s/admin/index.%s.html">%s</a>.""" % (weburl, ln, _("Admin Area"))
def tmpl_account_adminactivities(self, ln, weburl, uid, guest, roles, activities): """ Displays the admin activities block for this user
citation_list = get_cited_by_dictionary()[record_id]
citation_list = None try: citation_list = get_cited_by_dictionary()[record_id] except TypeError: pass
def get_cited_by_list(record_id): """return citation list dictionary of record_id """ citation_list = get_cited_by_dictionary()[record_id] return citation_list
def tmpl_record_body(self, weburl, titles, authors, dates, rns, abstracts, urls_u, urls_z):
def tmpl_record_body(self, weburl, titles, authors, dates, rns, abstracts, urls_u, urls_z, ln):
def tmpl_record_body(self, weburl, titles, authors, dates, rns, abstracts, urls_u, urls_z): """ Displays the "HTML basic" format of a record
a_href(cgi.escape(authors[i]),
a_href(cgi.escape(author),
def tmpl_record_body(self, weburl, titles, authors, dates, rns, abstracts, urls_u, urls_z): """ Displays the "HTML basic" format of a record
)
ln=ln)
def tmpl_print_record_brief(self, ln, recID, weburl): """Displays a brief record on-the-fly
nav_h1 += ' &gt; <a class="navtrail" href="%s/admin/websubmit_new/websubmitadmin.py/">WebSubmit Admin</a>'
nav_h1 += ' &gt; <a class="navtrail" href="%s/admin/websubmit/websubmitadmin.py/">WebSubmit Admin</a>'
def tmpl_navtrail(self, ln=cdslang): """display the navtrail, e.g.: Home > Admin Area > WebSubmit Administration > Available WebSubmit Actions @param title: the last part of the navtrail. Is not a link @param ln: language return html formatted navtrail """ nav_h1 = '<a class="navtrail" href="%s/admin/">Admin Area</a>'...
self.assertEqual([(1, 71), (3, 100)], bibrank_record_sorter.sort_record_relevance({1: 50, 2:30, 3:70, 4:10}, 50, 0))
hitset = HitSet() hitset.addlist((1,2,5)) hitset2 = HitSet() hitset2.add(5) rec_termcount = {1: 1, 2: 1, 5: 1}
def test_record_sorter(self): """bibrank record sorter - sorting records""" self.assertEqual([(1, 71), (3, 100)], bibrank_record_sorter.sort_record_relevance({1: 50, 2:30, 3:70, 4:10}, 50, 0))
self.assertEqual(({1: 839, 2: 1193, 5: 350}, {1: 1, 2: 1, 5: 1}), bibrank_record_sorter.calculate_record_relevance(("testterm", 2.0), {"Gi":(0, 50.0), 1: (3, 4.0), 2: (4, 5.0), 5: (1, 3.5)}, hitset, {}, {}, 0, None))
self.assertEqual(({1: 7, 2: 7, 5: 5}, {1: 1, 2: 1, 5: 1}), bibrank_record_sorter.calculate_record_relevance(("testterm", 2.0), {"Gi":(0, 50.0), 1: (3, 4.0), 2: (4, 5.0), 5: (1, 3.5)}, hitset, {}, {}, 0, None))
def test_calculate_record_relevance(self): """bibrank record sorter - calculating relevances""" hitset = HitSet() hitset.addlist((1,2,5)) self.assertEqual(({1: 839, 2: 1193, 5: 350}, {1: 1, 2: 1, 5: 1}), bibrank_record_sorter.calculate_record_relevance(("testterm", 2.0), {"Gi":(0, 50.0), 1: (3, 4.0), 2: (4, 5.0), 5: (...
selected_bsk_id=old_id_basket,
selected_bskid=old_id_basket,
def perform_input_alert(action, id_query, alert_name, frequency, notification, id_basket,uid, old_id_basket=None, ln = cdslang): """get the alert settings input: action="add" for a new alert (blank form), action="modify" for an update (get old values) id_query id the identifier of the search to be alerted for the "mod...
def page_start(req, of, cc, as, ln, uid):
def page_start(req, of, cc, as, ln, uid, title_message=msg_search_results[cdslang]):
def page_start(req, of, cc, as, ln, uid): "Start page according to given output format." if of.startswith('x'): # we are doing XML output: req.content_type = "text/xml" req.send_http_header() req.write("""<?xml version="1.0" encoding="UTF-8"?>\n""") if of.startswith("xm"): req.write("""<collection xmlns="http://www.loc...
req.write(pageheaderonly(title=msg_search_results[ln],
req.write(pageheaderonly(title=title_message,
def page_start(req, of, cc, as, ln, uid): "Start page according to given output format." if of.startswith('x'): # we are doing XML output: req.content_type = "text/xml" req.send_http_header() req.write("""<?xml version="1.0" encoding="UTF-8"?>\n""") if of.startswith("xm"): req.write("""<collection xmlns="http://www.loc...
req.write(pagefooteronly(lastupdated=__lastupdated__, language=ln))
req.write(pagefooteronly(lastupdated=__lastupdated__, language=ln, urlargs=req.args))
def page_end(req, of="hb", ln=cdslang): "End page according to given output format: e.g. close XML tags, add HTML footer, etc." if of.startswith('h'): req.write("""</div>""") # pagebody end req.write(pagefooteronly(lastupdated=__lastupdated__, language=ln)) elif of.startswith('x'): req.write("""</collection>\n""") if o...
page_start(req, of, cc, as, ln, uid)
def perform_request_search(req=None, cc=cdsname, c=None, p="", f="", rg="10", sf="", so="d", sp="", rm="", of="id", ot="", as="0", p1="", f1="", m1="", op1="", p2="", f2="", m2="", op2="", p3="", f3="", m3="", sc="0", jrec="0", recid="-1", recidb="-1", sysno="", id="-1", idb="-1", sysnb="", action="", d1y="0", d1m="0",...
if 1 or split_colls == 0:
if split_colls == 0:
def wash_colls(cc, c, split_colls=0): """Wash collection list by checking whether user has deselected anything under 'Narrow search'. Checks also if cc is a list or not. Return list of cc, colls_to_display, colls_to_search since the list of collections to display is different from that to search in. This is because u...
def get_coll_sons(coll, type='r'): "Returns a list of sons (first-level descendants) of type 'type' for collection 'coll'."
def get_coll_sons(coll, type='r', public_only=1): """Return a list of sons (first-level descendants) of type 'type' for collection 'coll'. If public_only, then return only non-restricted son collections. """
def get_coll_sons(coll, type='r'): "Returns a list of sons (first-level descendants) of type 'type' for collection 'coll'." coll_sons = [] query = "SELECT c.name FROM collection AS c "\ "LEFT JOIN collection_collection AS cc ON c.id=cc.id_son "\ "LEFT JOIN collection AS ccc ON ccc.id=cc.id_dad "\ "WHERE cc.type='%s' AN...
"WHERE cc.type='%s' AND ccc.name='%s' ORDER BY cc.score DESC" \
"WHERE cc.type='%s' AND ccc.name='%s'" \
def get_coll_sons(coll, type='r'): "Returns a list of sons (first-level descendants) of type 'type' for collection 'coll'." coll_sons = [] query = "SELECT c.name FROM collection AS c "\ "LEFT JOIN collection_collection AS cc ON c.id=cc.id_son "\ "LEFT JOIN collection AS ccc ON ccc.id=cc.id_dad "\ "WHERE cc.type='%s' AN...
FROM usergroup g LEFT JOIN user_usergroup ug, usergroup_bskBASKET ugb
FROM usergroup g LEFT JOIN (user_usergroup ug, usergroup_bskBASKET ugb)
def get_group_infos(uid): """Get for each group a user is member of its uid, name and number of baskets.""" query = """SELECT g.id, g.name, count(ugb.id_bskBASKET) FROM usergroup g LEFT JOIN user_usergroup ug, usergroup_bskBASKET ugb ON (g.id=ug.id_usergroup AND g.id=ugb.id_usergroup) WHERE ug.id_user=%i AND NOT(ugb.sh...
""" % {'message': _("The record as soon deleted when the task queue is empty.You can now go back to"),
""" % {'message': _("The record will be deleted as soon as the task queue is empty. You can now go back to"),
def tmpl_deleted(self, ln, message='', recid='', temp='', format_tag=''): """ Return a deleted message of Bibedit. """
run_sql(q, (collection_id,))
run_sql(qstr, (collection_id,))
def delete_submission_collection_details(collection_id): """Delete the details of a submission-collection from the database. @param collection_id: (integer) - the ID of the submission-collection whose details are to be deleted from the WebSubmit database. @return: (integer) - error code: 0 on successful delete; 1 on fa...
numrows_submission_collection = get_number_rows_for_submission_collection(collection_id)
numrows_submission_collection = get_number_of_rows_for_submission_collection(collection_id)
def delete_submission_collection_details(collection_id): """Delete the details of a submission-collection from the database. @param collection_id: (integer) - the ID of the submission-collection whose details are to be deleted from the WebSubmit database. @return: (integer) - error code: 0 on successful delete; 1 on fa...
run_sql(q, (collection_id,))
run_sql(qstr, (collection_id,))
def delete_submission_collection_from_submission_tree(collection_id): """Delete a submission-collection from the submission tree. @param collection_id: (integer) - the ID of the submission-collection whose details are to be deleted from the WebSubmit database. @return: (integer) - error code: 0 on successful delete; 1 ...
run_sql(q, (collection_id,))
run_sql(qstr, (collection_id,))
def delete_doctype_children_from_submission_collection(collection_id): """Delete all doctype-children of a submission-collection. @param collection_id: (integer) - the ID of the submission-collection from which the doctype-children are to be deleted. @return: (integer) - error code: 0 on successful delete; 1 on failure...
def to_str(int_val): """ """ if int_val == 0: return '00' else: return str(int_val) _ = gettext_set_language(ln) format = "%Y-%m-%d %H:%M:%S" pythonic_date = (0,0,0,0,0,0,0,0,-1)
_ = gettext_set_language(ln) input_format = "%Y-%m-%d %H:%M:%S"
def to_str(int_val): """ """ if int_val == 0: return '00' else: return str(int_val)
pythonic_date = strptime(db_date, format)
pythonic_date = strptime(db_date, input_format) month = get_i18n_month_name(pythonic_date[1], ln=ln) output_format = "%02d " + month + " %04Y, %02H:%02M" return strftime(output_format, pythonic_date)
def to_str(int_val): """ """ if int_val == 0: return '00' else: return str(int_val)
pass (y, m, d, h, mm, junk, junk, junk, junk) = map(to_str, pythonic_date) return ("%s %s %s, %s:%s") %\ (d, get_i18n_month_name(month_nb=int(m),ln=ln),y, h, mm) def date_convert_to_MySQL(year, month, day): """ convert a given date to mySQL notation @param year: year as an int @param month: month as an int @param day:...
return _("N/A")
def to_str(int_val): """ """ if int_val == 0: return '00' else: return str(int_val)
return ("%s %s %s, %s:%s") %\ (d, get_i18n_month_name(month_nb=int(m),ln=ln),y, h, mm)
def get_i18n_pythondatetext(pythonic_date, ln=cdslang): """ Convert a given date (formatted in python's time struct) to a textual representation """ _ = gettext_set_language(ln) try: month = get_i18n_month_name(pythonic_date[1], ln=ln) output_format = "%02d " + month + " %04Y, %02H:%02M" return strftime(output_format, ...
def to_str(int_val): """ """ if int_val == 0: return '00' else: return str(int_val)
1: _("jan"), 2: _("feb"), 3: _("mar"), 4: _("apr"), 5: _("may"), 6: _("jun"), 7: _("jul"), 8: _("aug"), 9: _("sep"), 10: _("oct"), 11: _("nov"), 12: _("dec")}
1: _("Jan"), 2: _("Feb"), 3: _("Mar"), 4: _("Apr"), 5: _("May"), 6: _("Jun"), 7: _("Jul"), 8: _("Aug"), 9: _("Sep"), 10: _("Oct"), 11: _("Nov"), 12: _("Dec")}
def get_i18n_month_name(month_nb, display='short', ln=cdslang): """ get a non-numeric representation of a month, internationalized. @param month_nb: number of month, (1 based!) =>1=jan,..,12=dec @param ln: language for output @return the string representation of month """ _ = gettext_set_language(ln) if display == 'sho...
Get the value of a field by it's name.
Get the value of a field by its name.
def ctl_field(self, node, out_file): ''' Get the value of a field by it's name. ''' #test mode if not self.flags['exec']: return None #exec mode attrs = get_node_attributes(node) if not attrs.has_key('name'): print CFG_BIBFORMAT_BFX_ERROR_MESSAGES['ERR_BFX_FIELD_NO_NAME'] return None display = '' if attrs.has_key('disp...
uid=uid,
uid=auid,
def comments(req, ln=cdslang, uid="", comid="", reviews=0): """ View reported comments, filter by either user or a specific comment (only one given at a time) @param ln: language @param uid: user id @param comid: comment id @param reviews: boolean enabled for reviews, disabled for comments """ navtrail_previous_links =...
subject)
cgi.escape(subject))
def tmpl_display_inbox(self, messages, infos=[], warnings=[], nb_messages=0, no_quota=0, ln=cdslang): """ Displays a list of messages, with the appropriate links and buttons @param messages: a list of tuples: [(message_id, user_from_id, user_from_nickname, subject, sent_date, status=] @param infos: a list of informatio...
sent_to_link += '%s</a>%s '% (to_display, CFG_WEBMESSAGE_SEPARATOR)
sent_to_link += '%s</a>%s '% (cgi.escape(to_display), CFG_WEBMESSAGE_SEPARATOR)
def tmpl_display_msg(self, msg_id="", msg_from_id="", msg_from_nickname="", msg_sent_to="", msg_sent_to_group="", msg_subject="", msg_body="", msg_sent_date="", msg_received_date=datetext_default, ln=cdslang): """ Displays a given message @param msg_id: id of the message @param msg_from_id: id of user who sent the mess...
sent_to_link += '<a href="write?msg_to=%s&amp;ln=%s">%s</a>'% (to, ln, to_display)
sent_to_link += '<a href="write?msg_to=%s&amp;ln=%s">%s</a>'% (to, ln, cgi.escape(to_display))
def tmpl_display_msg(self, msg_id="", msg_from_id="", msg_from_nickname="", msg_sent_to="", msg_sent_to_group="", msg_subject="", msg_body="", msg_sent_date="", msg_received_date=datetext_default, ln=cdslang): """ Displays a given message @param msg_id: id of the message @param msg_from_id: id of user who sent the mess...
group_to_link += '%s</a>%s '% (group, CFG_WEBMESSAGE_SEPARATOR)
group_to_link += '%s</a>%s '% (cgi.escape(group), CFG_WEBMESSAGE_SEPARATOR)
def tmpl_display_msg(self, msg_id="", msg_from_id="", msg_from_nickname="", msg_sent_to="", msg_sent_to_group="", msg_subject="", msg_body="", msg_sent_date="", msg_received_date=datetext_default, ln=cdslang): """ Displays a given message @param msg_id: id of the message @param msg_from_id: id of user who sent the mess...
'subject' : msg_subject, 'body' : final_body,
'subject' : cgi.escape(msg_subject), 'body' : cgi.escape(final_body),
def tmpl_display_msg(self, msg_id="", msg_from_id="", msg_from_nickname="", msg_sent_to="", msg_sent_to_group="", msg_subject="", msg_body="", msg_sent_date="", msg_received_date=datetext_default, ln=cdslang): """ Displays a given message @param msg_id: id of the message @param msg_from_id: id of user who sent the mess...
def compare_on_val(first, second):
def compare_on_val(second, first):
def compare_on_val(first, second): return cmp(second[1], first[1])
filename = "%s/%s" % (logdir, arg['resumptionToken'])
filename = "%s/RTdata/%s" % (logdir, arg['resumptionToken'])
def OAIListRecords(args): "Generates response to OAIListRecords verb."
filename = "%s/%s" % (logdir, arg['resumptionToken'])
filename = "%s/RTdata/%s" % (logdir, arg['resumptionToken'])
def OAIListIdentifiers(args): "Prints OAI response to the ListIdentifiers verb."
filename = "%s/%s" % (logdir, resumptionToken)
filename = "%s/RTdata/%s" % (logdir, resumptionToken)
def OAICacheIn(resumptionToken, sysnos): "Stores or adds sysnos in cache. Input is a string of sysnos separated by commas."
filename = "%s/%s" % (logdir, resumptionToken)
filename = "%s/RTdata/%s" % (logdir, resumptionToken)
def OAICacheOut(resumptionToken): "Restores string of comma-separated system numbers from cache." sysnos = []
directory = "%s" % logdir
directory = "%s/RTdata" % logdir
def OAICacheClean(): "Removes cached resumptionTokens older than specified"
filename = "%s/%s" % (logdir, resumptionToken)
filename = "%s/RTdata/%s" % (logdir, resumptionToken)
def OAICacheStatus(resumptionToken): "Checks cache status. Returns 0 for empty, 1 for full."
out += """You own following shelves:"""
out += """You own following alerts: """
def account_list_alerts(uid, action="", id_alert=0, id_basket=0,newname=""): # set variables out = "" id_user = uid # XXX SQL_query = "SELECT distinct a.alert_name FROM query q, user_query_basket a, basket b "\ "WHERE a.id_user='%s' "\ "AND a.id_query=q.id "\ "ORDER BY a.alert_name ASC " % id_user query_result = run_...
output = """ <dl> <dt>Rank method:</dt> <dd>A method responsible for creating the necessary data to rank a result.</dd> <dt>Translations:</dt> <dd>Each rank method may have many names in many languages.</dd> <dt>Collections:</dt> <dd>Which collections the rank method should be visible in.</dd> </dl> """
output = """ <a href="%s/admin/bibrank/bibrankadmin.py/addrankarea?ln=%s">Add new rank method</a><br><br> """ % (weburl, ln)
def perform_index(ln=cdslang): """create the bibrank main area menu page.""" header = ['Name', 'Translations', 'Collections', 'Rank method'] rnk_list = get_current_name('', ln, get_rnk_nametypes()[0][0], "rnkMETHOD") actions = [] for (rnkID, name) in rnk_list: actions.append([name]) for col in [(('Modify', 'modifytr...
extra = """ <dl> <dt><a href="%s/admin/bibrank/bibrankadmin.py/addrankarea?ln=%s">Add new rank method</a> <dd>Go here to add a new rank method. </dl> """ % (weburl, ln) return addadminbox("""Explanation of concepts&nbsp;&nbsp&nbsp;<small>[<a href="%s/admin/bibrank/guide.html
return addadminbox("""Overview of rank methodss&nbsp;&nbsp&nbsp;<small>[<a title="See guide" href="%s/admin/bibrank/guide.html
def perform_index(ln=cdslang): """create the bibrank main area menu page.""" header = ['Name', 'Translations', 'Collections', 'Rank method'] rnk_list = get_current_name('', ln, get_rnk_nametypes()[0][0], "rnkMETHOD") actions = [] for (rnkID, name) in rnk_list: actions.append([name]) for col in [(('Modify', 'modifytr...
<dt>Enable for:</dt> <dd>To make the rank method visible in the search interface for a collection, choose the wanted collection and press the "Enable" button.</dd> <dt>Disable for:</dt> <dd>To hide the rank method from the search interface for a collection, choose the wanted collection and press the "Disable" button.</...
<dt>The rank method is currently enabled for these collections:</dt>
def perform_modifycollection(rnkID='', ln=cdslang, func='', colID='', confirm=0): """Modify which collections the rank method is visible to""" output = "" subtitle = "" if rnkID: rnkNAME = get_current_name(rnkID, ln, get_rnk_nametypes()[0][0], "rnkMETHOD")[0][1] if func in ["0", 0] and confirm in ["1", 1]: finresult...
""" % rnkNAME
"""
def perform_modifycollection(rnkID='', ln=cdslang, func='', colID='', confirm=0): """Modify which collections the rank method is visible to""" output = "" subtitle = "" if rnkID: rnkNAME = get_current_name(rnkID, ln, get_rnk_nametypes()[0][0], "rnkMETHOD")[0][1] if func in ["0", 0] and confirm in ["1", 1]: finresult...
return addadminbox(subtitle + """&nbsp;&nbsp&nbsp;<small>[<a href="%s/admin/bibrank/guide.html
return addadminbox(subtitle + """&nbsp;&nbsp&nbsp;<small>[<a title="See guide" href="%s/admin/bibrank/guide.html
def perform_modifycollection(rnkID='', ln=cdslang, func='', colID='', confirm=0): """Modify which collections the rank method is visible to""" output = "" subtitle = "" if rnkID: rnkNAME = get_current_name(rnkID, ln, get_rnk_nametypes()[0][0], "rnkMETHOD")[0][1] if func in ["0", 0] and confirm in ["1", 1]: finresult...
return addadminbox(subtitle + """&nbsp;&nbsp&nbsp;<small>[<a href="%s/admin/bibrank/guide.html
return addadminbox(subtitle + """&nbsp;&nbsp&nbsp;<small>[<a title="See guide" href="%s/admin/bibrank/guide.html
def perform_modifytranslations(rnkID, ln, sel_type, trans, confirm, callback='yes'): """Modify the translations of a rank method""" output = '' subtitle = '' cdslangs = get_languages() cdslangs.sort() if confirm in ["2", 2] and rnkID: finresult = modify_translations(rnkID, cdslangs, sel_type, trans, "rnkMETHOD") rnk...
<br>For more information, please go to the <a href="%s/admin/bibrank/guide.html">BibRank guide</a> and read the section about adding a rank method</dd>
<br>For more information, please go to the <a title="See guide" href="%s/admin/bibrank/guide.html">BibRank guide</a> and read the section about adding a rank method</dd>
def perform_addrankarea(rnkcode='', ln=cdslang, template='', confirm=-1): """form to add a new rank method with these values: """ subtitle = 'Step 1 - Create new rank method' output = """ <dl> <dt>BibRank code:</dt> <dd>A unique code that identifies a rank method, is used when running the bibrank daemon and used to n...
return addadminbox(subtitle + """&nbsp;&nbsp&nbsp;<small>[<a href="%s/admin/bibrank/guide.html
return addadminbox(subtitle + """&nbsp;&nbsp&nbsp;<small>[<a title="See guide" href="%s/admin/bibrank/guide.html
def perform_addrankarea(rnkcode='', ln=cdslang, template='', confirm=-1): """form to add a new rank method with these values: """ subtitle = 'Step 1 - Create new rank method' output = """ <dl> <dt>BibRank code:</dt> <dd>A unique code that identifies a rank method, is used when running the bibrank daemon and used to n...
<br>For more information, please go to the <a href="%s/admin/bibrank/guide.html">BibRank guide</a> and read the section about modifying a rank method's BibRank code.</dd>
<br>For more information, please go to the <a title="See guide" href="%s/admin/bibrank/guide.html">BibRank guide</a> and read the section about modifying a rank method's BibRank code.</dd>
def perform_modifyrank(rnkID, rnkcode='', ln=cdslang, template='', cfgfile='', confirm=0): """form to modify a rank method rnkID - id of the rank method """ subtitle = 'Step 1 - Please modify the wanted values below' if not rnkcode: oldcode = get_rnk_code(rnkID)[0] else: oldcode = rnkcode output = """ <dl> <dd>When...
finoutput = addadminbox(subtitle + """&nbsp;&nbsp&nbsp;<small>[<a href="%s/admin/bibrank/guide.html
finoutput = addadminbox(subtitle + """&nbsp;&nbsp&nbsp;<small>[<a title="See guide" href="%s/admin/bibrank/guide.html
def perform_modifyrank(rnkID, rnkcode='', ln=cdslang, template='', cfgfile='', confirm=0): """form to modify a rank method rnkID - id of the rank method """ subtitle = 'Step 1 - Please modify the wanted values below' if not rnkcode: oldcode = get_rnk_code(rnkID)[0] else: oldcode = rnkcode output = """ <dl> <dd>When...
<br><br>For more information, please go to the <a href="%s/admin/bibrank/guide.html">BibRank guide</a> and read the section regarding deleting a rank method.</dd>
<br><br>For more information, please go to the <a title="See guide" href="%s/admin/bibrank/guide.html">BibRank guide</a> and read the section regarding deleting a rank method.</dd>
def perform_deleterank(rnkID, ln=cdslang, confirm=0): """form to delete a rank method """ subtitle ='' output = """ <span class="warning"> <strong> <dl> <dt>WARNING:</dt> <dd>When deleting a rank method, you also deletes all data related to the rank method, like translations, which collections it was attached to and t...
return addadminbox(subtitle + """&nbsp;&nbsp&nbsp;<small>[<a href="%s/admin/bibrank/guide.html
return addadminbox(subtitle + """&nbsp;&nbsp&nbsp;<small>[<a title="See guide" href="%s/admin/bibrank/guide.html
def perform_deleterank(rnkID, ln=cdslang, confirm=0): """form to delete a rank method """ subtitle ='' output = """ <span class="warning"> <strong> <dl> <dt>WARNING:</dt> <dd>When deleting a rank method, you also deletes all data related to the rank method, like translations, which collections it was attached to and t...
if var == fld or (var == True and fld) or (fld == True and var):
if var == fld:
def tmpl_is_selected(self, var, fld): """ Checks if *var* and *fld* are equal, and if yes, returns ' selected'. Useful for select boxes.
cell_6_a = self.tmpl_inputdate_box("d1", d1y, d1m, d1d, ln=ln) cell_6_b = create_inputdate_box("d2", d2y, d2m, d2d, ln=ln)
cell_6_a = self.tmpl_inputdate("d1", ln, d1y, d1m, d1d) cell_6_b = self.tmpl_inputdate("d2", ln, d2y, d2m, d2d)
def tmpl_search_box(self, ln, weburl, as, cc, cc_intl, ot, sp, action, fieldslist, f1, f2, f3, m1, m2, m3, p1, p2, p3, op1, op2, rm, p, f, coll_selects, d1y, d2y, d1m, d2m, d1d, d2d, sort_formats, sf, so, ranks, sc, rg, formats, of): """ Displays the *Nearest search terms* box
'until' : _("Until"), 'date1' : self.tmpl_inputdate_box("d1", d1y, d1m, d1d, ln=ln), 'date2' : self.tmpl_inputdate_box("d2", d2y, d2m, d2d, ln=ln),
'until' : _("until:"), 'date1' : self.tmpl_inputdate("d1", ln, d1y, d1m, d1d), 'date2' : self.tmpl_inputdate("d2", ln, d2y, d2m, d2d),
def tmpl_search_box(self, ln, weburl, as, cc, cc_intl, ot, sp, action, fieldslist, f1, f2, f3, m1, m2, m3, p1, p2, p3, op1, op2, rm, p, f, coll_selects, d1y, d2y, d1m, d2m, d1d, d2d, sort_formats, sf, so, ranks, sc, rg, formats, of): """ Displays the *Nearest search terms* box
import datetime import time tabletime = time.strptime(collection_table_update_time, "%Y-%m-%d %H:%M:%S")
try: tabletime = time.strptime(collection_table_update_time, "%Y-%m-%d %H:%M:%S") except StandardError, e: tabletime = time.strptime(collection_table_update_time, "%Y-%m-%d %H:%M")
def perform_runwebcoll(colID, ln, confirm=0, callback='yes'): """form to delete an output format not in use. colID - the collection id of the current collection. fmtID - the format id to delete.""" subtitle = """<a name="11"></a>Webcoll Status""" output = "" colID = int(colID) col_dict = dict(get_def_name('', "colle...
actions.append([id, proc, runtime, status, progress])
actions.append([id, proc, runtime, (status !="" and status or ''), (progress !="" and progress or '')])
def perform_runwebcoll(colID, ln, confirm=0, callback='yes'): """form to delete an output format not in use. colID - the collection id of the current collection. fmtID - the format id to delete.""" subtitle = """<a name="11"></a>Webcoll Status""" output = "" colID = int(colID) col_dict = dict(get_def_name('', "colle...
_ = gettext_set_language(ln) if alert_name.strip() == "":
if alert_name == "":
def perform_add_alert(alert_name, frequency, notification, id_basket, id_query, uid, ln = cdslang): """add an alert to the database input: the name of the new alert; alert frequency: 'month', 'week' or 'day'; setting for e-mail notification: 'y' for yes, 'n' for no; basket identifier: 'no' for no basket; new basket na...
if (None in (alert_name, id_user, id_query, id_basket, uid)): return out
def perform_remove_alert(alert_name, id_user, id_query, id_basket, uid, ln=cdslang): """perform_remove_alert: remove an alert from the database input: identifier of the user; identifier of the query; identifier of the basket output: confirmation message + the list of alerts Web page""" # set variables out = "" # remo...
out = ""
out = '' if (None in (alert_name, frequency, notification, id_basket, id_query, old_id_basket, uid)): return out
def perform_update_alert(alert_name, frequency, notification, id_basket, id_query, old_id_basket,uid, ln = cdslang): """update alert settings into the database input: the name of the new alert; alert frequency: 'month', 'week' or 'day'; setting for e-mail notification: 'y' for yes, 'n' for no; new basket identifier: '...
bibclassify -t file.txt -K ontology.rdf -m SLOW
bibclassify -s -t file.txt -K ontology.rdf -m SLOW
def usage(code, msg=''): "Prints usage for this module." if msg: sys.stderr.write("Error: %s.\n" % msg) usagetext = """ Usage: bibclassify [options] Examples: bibclassify -f file.pdf -k thesaurus.txt -o TEXT bibclassify -t file.txt -K ontology.rdf -m SLOW Specific options: -f, --pdffile=FILENAME name of the p...
-K, --ontology=FILENAME name of the RDF ontology
-K, --ontology=FILENAME name of the RDF ontology (a local file or URL)
def usage(code, msg=''): "Prints usage for this module." if msg: sys.stderr.write("Error: %s.\n" % msg) usagetext = """ Usage: bibclassify [options] Examples: bibclassify -f file.pdf -k thesaurus.txt -o TEXT bibclassify -t file.txt -K ontology.rdf -m SLOW Specific options: -f, --pdffile=FILENAME name of the p...
-n, --nkeywords=NUMBER max number of keywords to be found
-n, --nkeywords=NUMBER number of keywords that will be processed to generate results (the higher the n, the higher the number of generated composite keywords) -N, --Nkeywords=NUMBER number of output keywords that will be generated (the higher the N, the higher the number of generated main keywords)
def usage(code, msg=''): "Prints usage for this module." if msg: sys.stderr.write("Error: %s.\n" % msg) usagetext = """ Usage: bibclassify [options] Examples: bibclassify -f file.pdf -k thesaurus.txt -o TEXT bibclassify -t file.txt -K ontology.rdf -m SLOW Specific options: -f, --pdffile=FILENAME name of the p...
def generate_keywords_rdf(textfile, dictfile, output, outwords, mode): """ A method that generates keywords from an rdf thesaurus. """
def generate_keywords_rdf(textfile, dictfile, output, nkeywords, Nkeywords, mode): """ A method that generates a sorted list of keywords (text or html output) based on a RDF thesaurus. """ import rdflib
def generate_keywords_rdf(textfile, dictfile, output, outwords, mode): """ A method that generates keywords from an rdf thesaurus. """ keylist = [] keyws = [] counts = {} entries = [] ns_skos = rdflib.Namespace("http://www.w3.org/2004/02/skos/core#") ns_dc=rdflib.Namespace("http://purl.org/dc/elements/1.1/") ns_rdf=r...
keyws = []
outlist = [] compositesOf = [] compositesList = [] compositesOUT = [] keys2drop = [] composites = {} compositesIDX = {}
def generate_keywords_rdf(textfile, dictfile, output, outwords, mode): """ A method that generates keywords from an rdf thesaurus. """ keylist = [] keyws = [] counts = {} entries = [] ns_skos = rdflib.Namespace("http://www.w3.org/2004/02/skos/core#") ns_dc=rdflib.Namespace("http://purl.org/dc/elements/1.1/") ns_rdf=r...
ns_concept=rdflib.Namespace("http://cain.nbii.org/thesauri/CERESTheme.rdf")
def generate_keywords_rdf(textfile, dictfile, output, outwords, mode): """ A method that generates keywords from an rdf thesaurus. """ keylist = [] keyws = [] counts = {} entries = [] ns_skos = rdflib.Namespace("http://www.w3.org/2004/02/skos/core#") ns_dc=rdflib.Namespace("http://purl.org/dc/elements/1.1/") ns_rdf=r...
store.load(dictfile)
store.parse(dictfile)
def generate_keywords_rdf(textfile, dictfile, output, outwords, mode): """ A method that generates keywords from an rdf thesaurus. """ keylist = [] keyws = [] counts = {} entries = [] ns_skos = rdflib.Namespace("http://www.w3.org/2004/02/skos/core#") ns_dc=rdflib.Namespace("http://purl.org/dc/elements/1.1/") ns_rdf=r...
text_string = str(rtmp.read(int(size*0.2)))
text_string = " " + str(rtmp.read(int(size*0.2)))
def generate_keywords_rdf(textfile, dictfile, output, outwords, mode): """ A method that generates keywords from an rdf thesaurus. """ keylist = [] keyws = [] counts = {} entries = [] ns_skos = rdflib.Namespace("http://www.w3.org/2004/02/skos/core#") ns_dc=rdflib.Namespace("http://purl.org/dc/elements/1.1/") ns_rdf=r...
text_string = str(rtmp.read())
text_string = " " + str(rtmp.read()) + " "
def generate_keywords_rdf(textfile, dictfile, output, outwords, mode): """ A method that generates keywords from an rdf thesaurus. """ keylist = [] keyws = [] counts = {} entries = [] ns_skos = rdflib.Namespace("http://www.w3.org/2004/02/skos/core#") ns_dc=rdflib.Namespace("http://purl.org/dc/elements/1.1/") ns_rdf=r...
atmp.close()
def generate_keywords_rdf(textfile, dictfile, output, outwords, mode): """ A method that generates keywords from an rdf thesaurus. """ keylist = [] keyws = [] counts = {} entries = [] ns_skos = rdflib.Namespace("http://www.w3.org/2004/02/skos/core#") ns_dc=rdflib.Namespace("http://purl.org/dc/elements/1.1/") ns_rdf=r...
dictOUT_alt = 0
def generate_keywords_rdf(textfile, dictfile, output, outwords, mode): """ A method that generates keywords from an rdf thesaurus. """ keylist = [] keyws = [] counts = {} entries = [] ns_skos = rdflib.Namespace("http://www.w3.org/2004/02/skos/core#") ns_dc=rdflib.Namespace("http://purl.org/dc/elements/1.1/") ns_rdf=r...
alternatives = " " broaders = " " narrowers = " " relateds = " " safekey = 0 if pref[:2].isupper(): pattern = sre.compile('\\b' + pref.strip() + '\\b') else: pattern = sre.compile('\\b' + pref.strip() + '\\b', sre.I) dictOUT = len(sre.findall(pattern,text_string)) safeOUT = len(sre.findall(pattern,safe_keys))
hideOUT = 0 candidates = [] wildcard = "" regex = False candidates.append(pref.strip())
def generate_keywords_rdf(textfile, dictfile, output, outwords, mode): """ A method that generates keywords from an rdf thesaurus. """ keylist = [] keyws = [] counts = {} entries = [] ns_skos = rdflib.Namespace("http://www.w3.org/2004/02/skos/core#") ns_dc=rdflib.Namespace("http://purl.org/dc/elements/1.1/") ns_rdf=r...
if alt[:2].isupper(): pattern_alt = sre.compile('\\b' + alt.strip() + '\\b')
candidates.append(alt.strip()) for hid in store.objects(s, ns_skos["hiddenLabel"]): candidates.append(hid.strip()) for candidate in candidates: if candidate.find("/", 0, 1) > -1: regex = True pattern = makePattern(candidate, 3) wildcard = pattern hideOUT += len(sre.findall(pattern,text_string)) for candidate i...
def generate_keywords_rdf(textfile, dictfile, output, outwords, mode): """ A method that generates keywords from an rdf thesaurus. """ keylist = [] keyws = [] counts = {} entries = [] ns_skos = rdflib.Namespace("http://www.w3.org/2004/02/skos/core#") ns_dc=rdflib.Namespace("http://purl.org/dc/elements/1.1/") ns_rdf=r...
pattern_alt = sre.compile('\\b' + alt.strip() + '\\b', sre.I) dictOUT_alt += len(sre.findall(pattern_alt,text_string)) safeOUT += len(sre.findall(pattern_alt,safe_keys)) alternatives += alt.strip() + ", " alternatives = alternatives[:-2] dictOUT_total = int(dictOUT) + int(dictOUT_alt) if dictOUT_total>1: if safeOUT...
pattern = makePattern(candidate, 0) if len(candidate) < 3: if len(sre.findall(pattern,abstract))> 0: dictOUT += len(sre.findall(pattern,text_string)) safeOUT += len(sre.findall(pattern,safe_keys)) else: dictOUT += len(sre.findall(pattern,text_string)) safeOUT += len(sre.findall(pattern,safe_keys)) dictOUT += hideO...
def generate_keywords_rdf(textfile, dictfile, output, outwords, mode): """ A method that generates keywords from an rdf thesaurus. """ keylist = [] keyws = [] counts = {} entries = [] ns_skos = rdflib.Namespace("http://www.w3.org/2004/02/skos/core#") ns_dc=rdflib.Namespace("http://purl.org/dc/elements/1.1/") ns_rdf=r...
details = "\n" for i in range(outwords): details += str(keylist[i][3]) + " ("+ str(keylist[i][0]) if int(keylist[i][8])>0: details += "*" details += ")\n" if len(str(keylist[i][4]))>1: details += " UF (" + str(keylist[i][2]) + "):" + str(keylist[i][4]) + "\n" if len(str(keylist[i][5]))>1: details += " RT:" + str(keylis...
print text_out
def generate_keywords_rdf(textfile, dictfile, output, outwords, mode): """ A method that generates keywords from an rdf thesaurus. """ keylist = [] keyws = [] counts = {} entries = [] ns_skos = rdflib.Namespace("http://www.w3.org/2004/02/skos/core#") ns_dc=rdflib.Namespace("http://purl.org/dc/elements/1.1/") ns_rdf=r...
makeTagCloud(keylist, outwords) return keyws def makeTagCloud(entries, outwords):
html_out.sort() html_out.reverse() makeTagCloud(html_out) return 0 def makeTagCloud(entries):
def generate_keywords_rdf(textfile, dictfile, output, outwords, mode): """ A method that generates keywords from an rdf thesaurus. """ keylist = [] keyws = [] counts = {} entries = [] ns_skos = rdflib.Namespace("http://www.w3.org/2004/02/skos/core#") ns_dc=rdflib.Namespace("http://purl.org/dc/elements/1.1/") ns_rdf=r...
print "{" if i < 1: print " color: elif i < 5: print " color: else: print " color:
print "{ color:
def makeTagCloud(entries, outwords): """Using the counts for each of the tags, write a simple HTML page to standard output containing a tag cloud representation. The CSS describes ten levels, each of which has differing font-size's, line-height's and font-weight's. """ max = int(entries[0][0]) print "<html>" print "<h...
cloud_size = 80 detail_size = outwords details = ""
def makeTagCloud(entries, outwords): """Using the counts for each of the tags, write a simple HTML page to standard output containing a tag cloud representation. The CSS describes ten levels, each of which has differing font-size's, line-height's and font-weight's. """ max = int(entries[0][0]) print "<html>" print "<h...
if cloud_size > len(entries): cloud_size = len(entries) if detail_size > len(entries): detail_size = len(entries) details += '<tr><div class="pagebox2" align="top"><small>' for i in range(0, detail_size): if detail_size > 0: detail_size -= 1 details += "<b>" + str(entries[i][3]) + " </b>("+ str(entries[i][0]) if int(e...
def makeTagCloud(entries, outwords): """Using the counts for each of the tags, write a simple HTML page to standard output containing a tag cloud representation. The CSS describes ten levels, each of which has differing font-size's, line-height's and font-weight's. """ max = int(entries[0][0]) print "<html>" print "<h...
if cloud_size > 0: cloud_size -= 1 tag = str(entries[i][3])
def makeTagCloud(entries, outwords): """Using the counts for each of the tags, write a simple HTML page to standard output containing a tag cloud representation. The CSS describes ten levels, each of which has differing font-size's, line-height's and font-weight's. """ max = int(entries[0][0]) print "<html>" print "<h...
color = int(entries[i][8])
tag = str(entries[i][1]) color = int(entries[i][2])
def makeTagCloud(entries, outwords): """Using the counts for each of the tags, write a simple HTML page to standard output containing a tag cloud representation. The CSS describes ten levels, each of which has differing font-size's, line-height's and font-weight's. """ max = int(entries[0][0]) print "<html>" print "<h...
else: continue
def makeTagCloud(entries, outwords): """Using the counts for each of the tags, write a simple HTML page to standard output containing a tag cloud representation. The CSS describes ten levels, each of which has differing font-size's, line-height's and font-weight's. """ max = int(entries[0][0]) print "<html>" print "<h...
cloud += '> %s </span>' % cloud_list[i][0]
cloud += '><a href=""> %s </a></span>' % cloud_list[i][0]
def makeTagCloud(entries, outwords): """Using the counts for each of the tags, write a simple HTML page to standard output containing a tag cloud representation. The CSS describes ten levels, each of which has differing font-size's, line-height's and font-weight's. """ max = int(entries[0][0]) print "<html>" print "<h...
key = '<tr><div class="pagebox1" align="top"><em>Key:</em><br><b>UF</b> Used For (alternative term)<br> <b>RT</b> Related Term<br><b>BT</b> Broader Term<br><b>NT</b> Narrower Term<br><b>(n*)</b> Denotes author keyword</div></tr>'
def makeTagCloud(entries, outwords): """Using the counts for each of the tags, write a simple HTML page to standard output containing a tag cloud representation. The CSS describes ten levels, each of which has differing font-size's, line-height's and font-weight's. """ max = int(entries[0][0]) print "<html>" print "<h...
print key print details
def makeTagCloud(entries, outwords): """Using the counts for each of the tags, write a simple HTML page to standard output containing a tag cloud representation. The CSS describes ten levels, each of which has differing font-size's, line-height's and font-weight's. """ max = int(entries[0][0]) print "<html>" print "<h...
long_flags =["pdffile=", "textfile="
long_flags =["standalone", "pdffile=", "textfile="
def main(): """Main function """ global options long_flags =["pdffile=", "textfile=" "thesaurus=","ontology=", "output=","nkeywords=", "mode=", "help", "version"] short_flags ="f:t:k:K:o:n:m:hV" format_string = "%Y-%m-%d %H:%M:%S" outwords = 15 input_file = "" dict_file = "" output = 1 mode = 1 temp_text = tmpdir + '/...
"output=","nkeywords=", "mode=",
"output=","nkeywords=", "Nkeywords=", "mode=",
def main(): """Main function """ global options long_flags =["pdffile=", "textfile=" "thesaurus=","ontology=", "output=","nkeywords=", "mode=", "help", "version"] short_flags ="f:t:k:K:o:n:m:hV" format_string = "%Y-%m-%d %H:%M:%S" outwords = 15 input_file = "" dict_file = "" output = 1 mode = 1 temp_text = tmpdir + '/...