rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
return perform_index(colID, ln, "perform_validateconf", addadminbox(subtitle, body))
return perform_index(colID, ln, "perform_checkcollectionstatus", addadminbox(subtitle, body))
def perform_validateconf(colID, ln, confirm=0, callback='yes'): """Validation of the configuration of the collections""" subtitle = """<a name="11"></a>Collections Status""" output = "" colID = int(colID) col_dict = dict(get_def_name('', "collection")) collections = run_sql("SELECT id, name, dbquery, restricted FROM...
command = '%s/bibupload -ri %s ' % (bindir, convertpath)
command = '%s/bibupload -r -i %s ' % (bindir, convertpath)
def call_bibupload(convertpath): """ A method that uploads a file to the database - calls bibUpload """ command = '%s/bibupload -ri %s ' % (bindir, convertpath) p=os.system(command) return p
for original, refs in db.items():
def extract_from_filelist(dirname, filelistfilename): """Extract strings from the list of files read from filelistfilename relative to dirname. Print results on stdout. """
def quote (text): """Normalize and quote a string for inclusion in the po file.""" return text.\ replace('\\', '\\\\').\ replace('\n', '\\\\n').\ replace('\t', '\\\\t').\ replace('"', '\\"')
for ref in refs: print "
db = {} for f in [ f.strip() for f in open(filelistfilename) ]: if not f or f.startswith(' continue
def quote (text): """Normalize and quote a string for inclusion in the po file.""" return text.\ replace('\\', '\\\\').\ replace('\n', '\\\\n').\ replace('\t', '\\\\t').\ replace('"', '\\"')
print 'msgid "%s"' % quote(original) print 'msgstr ""' print
f = f.rstrip(' \\') data = open(dirname + "/" + f).read()
def quote (text): """Normalize and quote a string for inclusion in the po file.""" return text.\ replace('\\', '\\\\').\ replace('\n', '\\\\n').\ replace('\t', '\\\\t').\ replace('"', '\\"')
ery:
try:
def send_email(fromaddr, toaddr, body, attempt=0): if attempt > 2: log('error sending email to %s: SMTP error; gave up after 3 attempts' % toaddr) return ery: server = smtplib.SMTP('localhost') if DEBUGLEVEL > 2: server.set_debuglevel(1) else: server.set_debuglevel(0) server.sendmail(fromaddr, toaddr, body) server.q...
c_nickname = 0 c_date_creation = 1 c_body = 2 c_nb_votes_yes = 3 c_nb_votes_total = 4 c_star_score = 5 c_title = 6 c_id = 7
c_star_score = 6
def calculate_avg_score(res): """ private function Calculate the avg score of reviews present in res @param res: tuple of tuple returned from query_retrieve_comments_or_remarks @return a float of the average score rounded to the closest 0.5 """ c_nickname = 0 c_date_creation = 1 c_body = 2 c_nb_votes_yes = 3 c_nb_vote...
return '<img src="%(weburl)s/img/%(gif)s.gif" alt="%(txt)s">' % {
return '<img src="%(weburl)s/img/%(gif)s.gif" alt="%(txt)s" border="0">' % {
def img(gif, txt): return '<img src="%(weburl)s/img/%(gif)s.gif" alt="%(txt)s">' % { 'txt': txt, 'gif': gif, 'weburl': weburl}
def get_alphabetically_ordered_collection_list(level=0):
def get_alphabetically_ordered_collection_list(level=0, ln=cdslang):
def get_alphabetically_ordered_collection_list(level=0): """Returns nicely ordered (score respected) list of collections, more exactly list of tuples (collection name, printable collection name). Suitable for create_search_box().""" out = [] query = "SELECT id,name FROM collection ORDER BY name ASC" res = run_sql(query...
if len(c_name)>30: c_printable = c_name[:30] + "..." else: c_printable = c_name
c_printable = get_coll_i18nname(c_name, ln) if len(c_printable)>30: c_printable = c_printable[:30] + "..."
def get_alphabetically_ordered_collection_list(level=0): """Returns nicely ordered (score respected) list of collections, more exactly list of tuples (collection name, printable collection name). Suitable for create_search_box().""" out = [] query = "SELECT id,name FROM collection ORDER BY name ASC" res = run_sql(query...
def get_nicely_ordered_collection_list(collid=1, level=0):
def get_nicely_ordered_collection_list(collid=1, level=0, ln=cdslang):
def get_nicely_ordered_collection_list(collid=1, level=0): """Returns nicely ordered (score respected) list of collections, more exactly list of tuples (collection name, printable collection name). Suitable for create_search_box().""" colls_nicely_ordered = [] query = "SELECT c.name,cc.id_son FROM collection_collection...
if len(c)>30: c_printable = c[:30] + "..." else: c_printable = c
c_printable = get_coll_i18nname(c, ln) if len(c_printable)>30: c_printable = c_printable[:30] + "..."
def get_nicely_ordered_collection_list(collid=1, level=0): """Returns nicely ordered (score respected) list of collections, more exactly list of tuples (collection name, printable collection name). Suitable for create_search_box().""" colls_nicely_ordered = [] query = "SELECT c.name,cc.id_son FROM collection_collection...
colls_nicely_ordered = colls_nicely_ordered + get_nicely_ordered_collection_list(cid, level+1)
colls_nicely_ordered = colls_nicely_ordered + get_nicely_ordered_collection_list(cid, level+1, ln=ln)
def get_nicely_ordered_collection_list(collid=1, level=0): """Returns nicely ordered (score respected) list of collections, more exactly list of tuples (collection name, printable collection name). Suitable for create_search_box().""" colls_nicely_ordered = [] query = "SELECT c.name,cc.id_son FROM collection_collection...
colls_nicely_ordered = get_nicely_ordered_collection_list()
colls_nicely_ordered = get_nicely_ordered_collection_list(ln=ln)
def create_search_box(cc, colls, p, f, rg, sf, so, sp, rm, of, ot, as, ln, p1, f1, m1, op1, p2, f2, m2, op2, p3, f3, m3, sc, pl, d1y, d1m, d1d, d2y, d2m, d2d, jrec, ec, action=""): "Create search box for 'search again in the results page' functionality." # load the right message language _ = gettext_set_language(ln) ...
colls_nicely_ordered = get_alphabetically_ordered_collection_list()
colls_nicely_ordered = get_alphabetically_ordered_collection_list(ln=ln)
def create_search_box(cc, colls, p, f, rg, sf, so, sp, rm, of, ot, as, ln, p1, f1, m1, op1, p2, f2, m2, op2, p3, f3, m3, sc, pl, d1y, d1m, d1d, d2y, d2m, d2d, jrec, ec, action=""): "Create search box for 'search again in the results page' functionality." # load the right message language _ = gettext_set_language(ln) ...
name_1 = run_sql("SELECT name from fieldvalue where id=%s" % id_fldvalue_1) name_2 = run_sql("SELECT name from fieldvalue where id=%s" % id_fldvalue_2)
name_1 = run_sql("SELECT name from fieldvalue where id=%s" % id_fldvalue_1)[0][0] name_2 = run_sql("SELECT name from fieldvalue where id=%s" % id_fldvalue_2)[0][0]
def perform_switchfldvaluescore(colID, id_1, id_fldvalue_1, id_fldvalue_2, ln=cdslang): """Switch the score of id_1 and id_2 in collection_field_fieldvalue. colID - the current collection id_1/id_2 - the id's to change the score for.""" name_1 = run_sql("SELECT name from fieldvalue where id=%s" % id_fldvalue_1) name_2...
""" % (name_1[0][0], name_2[0][0])
""" % (name_1, name_2)
def perform_switchfldvaluescore(colID, id_1, id_fldvalue_1, id_fldvalue_2, ln=cdslang): """Switch the score of id_1 and id_2 in collection_field_fieldvalue. colID - the current collection id_1/id_2 - the id's to change the score for.""" name_1 = run_sql("SELECT name from fieldvalue where id=%s" % id_fldvalue_1) name_2...
return perform_showsearchoptions(colID, ln, content=output)
return perform_modifyfield(colID, fldID=id_1, ln=ln, content=output) def perform_addnewfieldvalue(colID, fldID, ln=cdslang, name='', value='', callback="yes", confirm=-1): """form to add a new fieldvalue. name - the name of the new fieldvalue value - the value of the new fieldvalue """ output = "" subtitle = """<a na...
def perform_switchfldvaluescore(colID, id_1, id_fldvalue_1, id_fldvalue_2, ln=cdslang): """Switch the score of id_1 and id_2 in collection_field_fieldvalue. colID - the current collection id_1/id_2 - the id's to change the score for.""" name_1 = run_sql("SELECT name from fieldvalue where id=%s" % id_fldvalue_1) name_2...
if fldvID:
if fldvID and fldvID != "None":
def perform_removefield(colID, ln=cdslang, fldID='', fldvID='', fmeth='', callback='yes', confirm=0): """form to remove a field from a collection. colID - the current collection, remove the field from this collection. sel_ln - remove the field with this language fldID - remove the field with this id""" subtitle = """...
text = """Do you want to remove the field '%s' %s from the collection '%s'.""" % (fld_dict[fldID], (fldvID !="" and "with fieldvalue '%s'" % fldv_dict[fldvID] or ''), col_dict[colID])
text = """Do you want to remove the field '%s' %s from the collection '%s'.""" % (fld_dict[fldID], (fldvID not in["", "None"] and "with value '%s'" % fldv_dict[fldvID] or ''), col_dict[colID])
def perform_removefield(colID, ln=cdslang, fldID='', fldvID='', fmeth='', callback='yes', confirm=0): """form to remove a field from a collection. colID - the current collection, remove the field from this collection. sel_ln - remove the field with this language fldID - remove the field with this id""" subtitle = """...
""" % (fld_dict[fldID], (fldvID !="" and "with fieldvalue '%s'" % fldv_dict[fldvID] or ''), col_dict[colID])
""" % (fld_dict[fldID], (fldvID not in ["", "None"] and "with fieldvalue '%s'" % fldv_dict[fldvID] or ''), col_dict[colID])
def perform_removefield(colID, ln=cdslang, fldID='', fldvID='', fmeth='', callback='yes', confirm=0): """form to remove a field from a collection. colID - the current collection, remove the field from this collection. sel_ln - remove the field with this language fldID - remove the field with this id""" subtitle = """...
""" % (fldID, col_dict[colID])
""" % col_dict[colID]
def perform_removefield(colID, ln=cdslang, fldID='', fldvID='', fmeth='', callback='yes', confirm=0): """form to remove a field from a collection. colID - the current collection, remove the field from this collection. sel_ln - remove the field with this language fldID - remove the field with this id""" subtitle = """...
score - the importance of the field. position - the position of the field on the page
def perform_addexistingfield(colID, ln=cdslang, fldID=-1, fldvID=-1, fmeth='', callback='yes', confirm=-1): """form to add an existing field to a collection. colID - the collection to add the field to fldID - the field to add score - the importance of the field. position - the position of the field on the page sel_ln -...
if fmeth == 'seo': text += """ <span class="adminlabel">Fieldvalue</span> <select name="fldvID" class="admin_w200"> <option value="-1">- Select fieldvalue -</option> """ res = run_sql("SELECT id,name,value FROM fieldvalue ORDER BY name") for (id, name, value) in res: text += """<option value="%s" %s>%s</option> """ % ...
def perform_addexistingfield(colID, ln=cdslang, fldID=-1, fldvID=-1, fmeth='', callback='yes', confirm=-1): """form to add an existing field to a collection. colID - the collection to add the field to fldID - the field to add score - the importance of the field. position - the position of the field on the page sel_ln -...
<dd>Go to the BibIndex interface to modify</dd>
<dd>Go to the BibIndex interface to modify the available sort options</dd>
def perform_showsortoptions(colID, ln=cdslang, callback='yes', content='', confirm=-1): """show the sort fields of this collection..""" colID = int(colID) col_dict = dict(get_def_name('', "collection")) fld_dict = dict(get_def_name('', "field")) fld_type = get_sort_nametypes() subtitle = """<a name="8">8. Modify sort...
header = ['', 'Fieldname', 'Actions']
header = ['', 'Sort option', 'Actions']
def perform_showsortoptions(colID, ln=cdslang, callback='yes', content='', confirm=-1): """show the sort fields of this collection..""" colID = int(colID) col_dict = dict(get_def_name('', "collection")) fld_dict = dict(get_def_name('', "field")) fld_type = get_sort_nametypes() subtitle = """<a name="8">8. Modify sort...
move += "&nbsp;&nbsp;&nbsp;"
move += "&nbsp;&nbsp;&nbsp;&nbsp;"
def perform_showsortoptions(colID, ln=cdslang, callback='yes', content='', confirm=-1): """show the sort fields of this collection..""" colID = int(colID) col_dict = dict(get_def_name('', "collection")) fld_dict = dict(get_def_name('', "field")) fld_type = get_sort_nametypes() subtitle = """<a name="8">8. Modify sort...
for col in [(('Remove', 'removefield'),)]:
for col in [(('Remove sort option', 'removefield'),)]:
def perform_showsortoptions(colID, ln=cdslang, callback='yes', content='', confirm=-1): """show the sort fields of this collection..""" colID = int(colID) col_dict = dict(get_def_name('', "collection")) fld_dict = dict(get_def_name('', "field")) fld_type = get_sort_nametypes() subtitle = """<a name="8">8. Modify sort...
<dd>Go to the BibIndex interface to modify</dd>
<dd>Go to the BibIndex interface to modify the available search fields</dd>
def perform_showsearchfields(colID, ln=cdslang, callback='yes', content='', confirm=-1): """show the search fields of this collection..""" colID = int(colID) col_dict = dict(get_def_name('', "collection")) fld_dict = dict(get_def_name('', "field")) fld_type = get_sort_nametypes() subtitle = """<a name="6">6. Modify s...
header = ['', 'Fieldname', 'Actions']
header = ['', 'Search field', 'Actions']
def perform_showsearchfields(colID, ln=cdslang, callback='yes', content='', confirm=-1): """show the search fields of this collection..""" colID = int(colID) col_dict = dict(get_def_name('', "collection")) fld_dict = dict(get_def_name('', "field")) fld_type = get_sort_nametypes() subtitle = """<a name="6">6. Modify s...
for col in [(('Remove', 'removefield'),)]:
for col in [(('Remove search field', 'removefield'),)]:
def perform_showsearchfields(colID, ln=cdslang, callback='yes', content='', confirm=-1): """show the search fields of this collection..""" colID = int(colID) col_dict = dict(get_def_name('', "collection")) fld_dict = dict(get_def_name('', "field")) fld_type = get_sort_nametypes() subtitle = """<a name="6">6. Modify s...
<dd>Go to the BibIndex interface to modify</dd>
<dd>Go to the BibIndex interface to modify the available search options</dd>
def perform_showsearchoptions(colID, ln=cdslang, callback='yes', content='', confirm=-1): """show the sort and search options of this collection..""" colID = int(colID) col_dict = dict(get_def_name('', "collection")) fld_dict = dict(get_def_name('', "field")) fld_type = get_sort_nametypes() subtitle = """<a name="7">...
header = ['', 'Fieldname', '', 'Fieldvalue', 'Actions']
header = ['', 'Search option', 'Actions']
def perform_showsearchoptions(colID, ln=cdslang, callback='yes', content='', confirm=-1): """show the sort and search options of this collection..""" colID = int(colID) col_dict = dict(get_def_name('', "collection")) fld_dict = dict(get_def_name('', "field")) fld_type = get_sort_nametypes() subtitle = """<a name="7">...
col_fld = get_col_fld(colID, 'seo', id)
fldID = id[0] col_fld = get_col_fld(colID, 'seo', fldID)
def perform_showsearchoptions(colID, ln=cdslang, callback='yes', content='', confirm=-1): """show the sort and search options of this collection..""" colID = int(colID) col_dict = dict(get_def_name('', "collection")) fld_dict = dict(get_def_name('', "field")) fld_type = get_sort_nametypes() subtitle = """<a name="7">...
move += '<a href="%s/admin/websearch/websearchadmin.py/switchfldscore?colID=%s&amp;ln=%s&amp;id_1=%s&amp;id_2=%s&amp;fmeth=seo&amp;rand=%s j = 0 for (fldID, fldvID, stype, score, score_fieldvalue) in col_fld: fieldvalue = get_fld_value(fldvID) move2 = "" if j != 0: move2 += """<a href="%s/admin/websearch/websearcha...
move += '<a href="%s/admin/websearch/websearchadmin.py/switchfldscore?colID=%s&amp;ln=%s&amp;id_1=%s&amp;id_2=%s&amp;fmeth=seo&amp;rand=%s actions.append([move, "%s" % fld_dict[fldID]]) for col in [(('Modify values', 'modifyfield'), ('Remove search option', 'removefield'),)]: actions[-1].append('<a href="%s/admin/webs...
def perform_showsearchoptions(colID, ln=cdslang, callback='yes', content='', confirm=-1): """show the sort and search options of this collection..""" colID = int(colID) col_dict = dict(get_def_name('', "collection")) fld_dict = dict(get_def_name('', "field")) fld_type = get_sort_nametypes() subtitle = """<a name="7">...
sql += " AND id_fieldvalue=%s" % fldvID
if fldvID != "None": sql += " AND id_fieldvalue=%s" % fldvID else: sql += " AND id_fieldvalue is NULL"
def remove_fld(colID,fldID, fldvID=''): """Removes a field from the collection given. colID - the collection the format is connected to fldID - the field which should be removed from the collection.""" try: sql = "DELETE FROM collection_field_fieldvalue WHERE id_collection=%s AND id_field=%s" % (colID, fldID) if fldvI...
def delete_fldv(fldvID): """Deletes all data for the given fieldvalue fldvID - delete all data in the tables associated with fieldvalue and this id""" try: res = run_sql("DELETE FROM collection_field_fieldvalue WHERE id_fieldvalue=%s" % fldvID) res = run_sql("DELETE FROM fieldvalue WHERE id=%s" % fldvID) return "true"...
def remove_fld(colID,fldID, fldvID=''): """Removes a field from the collection given. colID - the collection the format is connected to fldID - the field which should be removed from the collection.""" try: sql = "DELETE FROM collection_field_fieldvalue WHERE id_collection=%s AND id_field=%s" % (colID, fldID) if fldvI...
def update_fldv(fldvID, name, value): """Modify existing fieldvalue fldvID - id of fieldvalue to modify value - the value of the fieldvalue name - the name of the fieldvalue.""" try: res = run_sql("UPDATE fieldvalue set name='%s' where id=%s" % (MySQLdb.escape_string(name), fldvID)) res = run_sql("UPDATE fieldvalue se...
def add_fmt(code, name, rtype): """Add a new output format. Returns the id of the format. code - the code for the format, max 6 chars. name - the default name for the default language of the format. rtype - the default nametype""" try: res = run_sql("INSERT INTO format (code, name) values ('%s','%s')" % (MySQLdb.escap...
fmtID - the id of the format.
fldID - the id of the field. fldvID - the id of the fieldvalue. type - which type, seo, sew...
def add_col_fld(colID, fldID, type, fldvID=''): """Add a sort/search/field to the collection. colID - the id of the collection involved fmtID - the id of the format. score - the score of the format, decides sorting, if not given, place the format on top""" try: if fldvID and fldvID not in [-1, "-1"]: res = run_sql("SE...
res = run_sql("SELECT score, score_fieldvalue FROM collection_field_fieldvalue WHERE id_collection=%s AND id_field=%s ORDER BY score desc, score_fieldvalue desc" % (colID, fldID))
run_sql("DELETE FROM collection_field_fieldvalue WHERE id_collection=%s AND id_field=%s and type='%s' and id_fieldvalue is NULL" % (colID, fldID, type)) res = run_sql("SELECT score FROM collection_field_fieldvalue WHERE id_collection=%s AND id_field=%s and type='%s' ORDER BY score desc" % (colID, fldID, type))
def add_col_fld(colID, fldID, type, fldvID=''): """Add a sort/search/field to the collection. colID - the id of the collection involved fmtID - the id of the format. score - the score of the format, decides sorting, if not given, place the format on top""" try: if fldvID and fldvID not in [-1, "-1"]: res = run_sql("SE...
v_score = int(res[0][1])
res = run_sql("SELECT score_fieldvalue FROM collection_field_fieldvalue WHERE id_collection=%s AND id_field=%s and type='%s' ORDER BY score_fieldvalue desc" % (colID, fldID, type)) if res: v_score = int(res[0][0]) else: v_score = 0
def add_col_fld(colID, fldID, type, fldvID=''): """Add a sort/search/field to the collection. colID - the id of the collection involved fmtID - the id of the format. score - the score of the format, decides sorting, if not given, place the format on top""" try: if fldvID and fldvID not in [-1, "-1"]: res = run_sql("SE...
score = 0
res = run_sql("SELECT score FROM collection_field_fieldvalue WHERE id_collection=%s and type='%s' ORDER BY score desc" % (colID, type)) if res: score = int(res[0][0]) + 1 else: score = 1
def add_col_fld(colID, fldID, type, fldvID=''): """Add a sort/search/field to the collection. colID - the id of the collection involved fmtID - the id of the format. score - the score of the format, decides sorting, if not given, place the format on top""" try: if fldvID and fldvID not in [-1, "-1"]: res = run_sql("SE...
res = run_sql("SELECT score FROM collection_field_fieldvalue WHERE id_collection=%s AND id_field=%s ORDER BY score desc" % (colID, fldID))
res = run_sql("SELECT * FROM collection_field_fieldvalue WHERE id_collection=%s AND type='%s' and id_field=%s and id_fieldvalue is NULL" % (colID, type, fldID)) if res: raise StandardError res = run_sql("SELECT score FROM collection_field_fieldvalue WHERE id_collection=%s AND type='%s' ORDER BY score desc" % (colID, ty...
def add_col_fld(colID, fldID, type, fldvID=''): """Add a sort/search/field to the collection. colID - the id of the collection involved fmtID - the id of the format. score - the score of the format, decides sorting, if not given, place the format on top""" try: if fldvID and fldvID not in [-1, "-1"]: res = run_sql("SE...
res = run_sql("INSERT INTO collection_field_fieldvalue(id_field, id_collection, type, score) values (%s,%s,'%s',%s)" % (fldID, colID, type, (score + 1)))
res = run_sql("INSERT INTO collection_field_fieldvalue(id_field, id_collection, type, score,score_fieldvalue) values (%s,%s,'%s',%s, 0)" % (fldID, colID, type, (score + 1)))
def add_col_fld(colID, fldID, type, fldvID=''): """Add a sort/search/field to the collection. colID - the id of the collection involved fmtID - the id of the format. score - the score of the format, decides sorting, if not given, place the format on top""" try: if fldvID and fldvID not in [-1, "-1"]: res = run_sql("SE...
out += warning_list_alerts(uid)
out += perform_list_alerts(uid)
def perform_update_alert(alert_name, frequency, notification, id_basket, new_basket_name, id_query, old_id_basket,uid): #set variables out = "" id_user = uid # XXX #check the alert name is not empty if alert_name.strip() == "": raise AlertError( "The alert name cannot be <b>empty</b>." ) #check if the alert can be c...
subtitle = """<a name="9">9. Modify rank options for collection '%s'</a>&nbsp;&nbsp&nbsp;<small>[<a href="%s/admin/websearch/guide.html
subtitle = """<a name="9">9. Modify rank options for collection '%s'</a>&nbsp;&nbsp&nbsp;<small>[<a title="See guide" href="%s/admin/websearch/guide.html
def perform_modifyrankmethods(colID, ln=cdslang, func='', rnkID='', confirm=0, callback='yes'): """Modify which rank methods is visible to the collection func - remove or add rank method rnkID - the id of the rank method.""" output = "" subtitle = "" col_dict = dict(get_current_name('', ln, get_col_nametypes()[0][0],...
<dt>Enable:</dt> <dd>To make a rank method visible in the search interface for a collection, choose the wanted rank method and press the "Enable" button.</dd> <dt>Disable:</dt> <dd>To hide a rank method from the search interface for a collection, choose the wanted rank method and press the "Disable" button.</dd>
def perform_modifyrankmethods(colID, ln=cdslang, func='', rnkID='', confirm=0, callback='yes'): """Modify which rank methods is visible to the collection func - remove or add rank method rnkID - the id of the rank method.""" output = "" subtitle = "" col_dict = dict(get_current_name('', ln, get_col_nametypes()[0][0],...
subtitle = """Attach collection to tree&nbsp;&nbsp&nbsp;<small>[<a href="%s/admin/websearch/guide.html
subtitle = """Attach collection to tree&nbsp;&nbsp&nbsp;<small>[<a title="See guide" href="%s/admin/websearch/guide.html
def perform_addcollectiontotree(colID, ln=cdslang, add_dad='', add_son='', rtype='', mtype='', callback='yes', confirm=-1): """Form to add a collection to the tree. add_dad - the dad to add the collection to add_son - the collection to add rtype - add it as a regular or virtual mtype - add it to the regular or virtual ...
subtitle = """Create new collection&nbsp;&nbsp;&nbsp;<small>[<a href="%s/admin/websearch/guide.html
subtitle = """Create new collection&nbsp;&nbsp;&nbsp;<small>[<a title="See guide" href="%s/admin/websearch/guide.html
def perform_addcollection(colID, ln=cdslang, colNAME='', dbquery='', rest='', callback="yes", confirm=-1): """form to add a new collection. colNAME - the name of the new collection dbquery - the dbquery of the new collection rest - the group allowed to access the new collection""" output = "" subtitle = """Create new ...
<input class="admin_wvar" type="text" name="colNAME" value="%s" /><br>
<input class="admin_w200" type="text" name="colNAME" value="%s" /><br>
def perform_addcollection(colID, ln=cdslang, colNAME='', dbquery='', rest='', callback="yes", confirm=-1): """form to add a new collection. colNAME - the name of the new collection dbquery - the dbquery of the new collection rest - the group allowed to access the new collection""" output = "" subtitle = """Create new ...
subtitle = """<a name="1">1. Modify collection query for collection '%s'</a>&nbsp;&nbsp&nbsp;<small>[<a href="%s/admin/websearch/guide.html
subtitle = """<a name="1">1. Modify collection query for collection '%s'</a>&nbsp;&nbsp&nbsp;<small>[<a title="See guide" href="%s/admin/websearch/guide.html
def perform_modifydbquery(colID, ln=cdslang, dbquery='', callback='yes', confirm=-1): """form to modify the dbquery of the collection. dbquery - the dbquery of the collection.""" subtitle = '' output = "" col_dict = dict(get_current_name('', ln, get_col_nametypes()[0][0], "collection")) if colID and col_dict.has_key...
<input class="admin_wvar" type="text" name="dbquery" value="%s" /><br>
<input class="admin_w200" type="text" name="dbquery" value="%s" /><br>
def perform_modifydbquery(colID, ln=cdslang, dbquery='', callback='yes', confirm=-1): """form to modify the dbquery of the collection. dbquery - the dbquery of the collection.""" subtitle = '' output = "" col_dict = dict(get_current_name('', ln, get_col_nametypes()[0][0], "collection")) if colID and col_dict.has_key...
output = """ <dl> <dt>Restricted to:</dt> <dd>The apache group allowed to access this collection.</dd> </dl> """
output = ""
def perform_modifyrestricted(colID, ln=cdslang, rest='', callback='yes', confirm=-1): """modify which apache group is allowed to access the collection. rest - the groupname""" subtitle = '' output = """ <dl> <dt>Restricted to:</dt> <dd>The apache group allowed to access this collection.</dd> </dl> """ col_dict = dic...
subtitle = """<a name="2">2. Modify access restrictions for collection '%s'</a>&nbsp;&nbsp&nbsp;<small>[<a href="%s/admin/websearch/guide.html
subtitle = """<a name="2">2. Modify access restrictions for collection '%s'</a>&nbsp;&nbsp&nbsp;<small>[<a title="See guide" href="%s/admin/websearch/guide.html
def perform_modifyrestricted(colID, ln=cdslang, rest='', callback='yes', confirm=-1): """modify which apache group is allowed to access the collection. rest - the groupname""" subtitle = '' output = """ <dl> <dt>Restricted to:</dt> <dd>The apache group allowed to access this collection.</dd> </dl> """ col_dict = dic...
<input class="admin_wvar" type="text" name="rest" value="%s" /><br>
<input class="admin_w200" type="text" name="rest" value="%s" /><br>
def perform_modifyrestricted(colID, ln=cdslang, rest='', callback='yes', confirm=-1): """modify which apache group is allowed to access the collection. rest - the groupname""" subtitle = '' output = """ <dl> <dt>Restricted to:</dt> <dd>The apache group allowed to access this collection.</dd> </dl> """ col_dict = dic...
subtitle = """Modify collection tree: %s&nbsp;&nbsp;&nbsp;<small>[<a href="%s/admin/websearch/guide.html
subtitle = """Modify collection tree: %s&nbsp;&nbsp;&nbsp;<small>[<a title="See guide" href="%s/admin/websearch/guide.html
def perform_modifycollectiontree(colID, ln=cdslang, move_up='', move_down='', move_from='', move_to='', delete='', rtype='', callback='yes', confirm=0): """to modify the collection tree: move a collection up and down, delete a collection, or change the father of the collection. colID - the main collection of the tree, ...
<input class="admin_wvar" type="text" name="title" value="%s" /><br>
<input class="admin_w200" type="text" name="title" value="%s" /><br>
def perform_addportalbox(colID, ln=cdslang, title='', body='', callback='yes', confirm=-1): """form to add a new portalbox title - the title of the portalbox body - the body of the portalbox""" col_dict = dict(get_current_name('', ln, get_col_nametypes()[0][0], "collection")) colID = int(colID) subtitle = """<a name="...
""" % (id, id == int(pbxID) and 'selected="selected"' or '', t_title, cgi.escape(t_body[0:10]))
""" % (id, id == int(pbxID) and 'selected="selected"' or '', t_title, cgi.escape(t_body[0:25 - len(t_title)]))
def perform_addexistingportalbox(colID, ln=cdslang, pbxID=-1, score=0, position='', sel_ln='', callback='yes', confirm=-1): """form to add an existing portalbox to a collection. colID - the collection to add the portalbox to pbxID - the portalbox to add score - the importance of the portalbox. position - the position o...
<input class="admin_wvar" type="text" name="title" value="%s" /><br>
<input class="admin_w200" type="text" name="title" value="%s" /><br>
def perform_modifyportalbox(colID, ln=cdslang, pbxID=-1, score='', position='', sel_ln='', title='', body='', callback='yes', confirm=-1): """form to modify a portalbox in a collection, or change the portalbox itself. colID - the id of the collection. pbxID - the portalbox to change score - the score of the portalbox c...
subtitle = """<a name="5">5. Modify portalboxes for collection '%s'</a>&nbsp;&nbsp&nbsp;<small>[<a href="%s/admin/websearch/guide.html
subtitle = """<a name="5">5. Modify portalboxes for collection '%s'</a>&nbsp;&nbsp&nbsp;<small>[<a title="See guide" href="%s/admin/websearch/guide.html
def perform_showportalboxes(colID, ln=cdslang, callback='yes', content='', confirm=-1): """show the portalboxes of this collection. colID - the portalboxes to show the collection for.""" colID = int(colID) col_dict = dict(get_current_name('', ln, get_col_nametypes()[0][0], "collection")) subtitle = """<a name="5">5. ...
<dt>Portal actions (not related to this collection)
<dt>Portalbox actions (not related to this collection)
def perform_showportalboxes(colID, ln=cdslang, callback='yes', content='', confirm=-1): """show the portalboxes of this collection. colID - the portalboxes to show the collection for.""" colID = int(colID) col_dict = dict(get_current_name('', ln, get_col_nametypes()[0][0], "collection")) subtitle = """<a name="5">5. ...
""" % (fld_dict[fldID], (fldvID !="" and "with fieldvalue '%s'" % fldv_dict[fldvID] or ''), col_dict[colID])
""" % (fld_dict[fldID], (fldvID != -1 and "with fieldvalue '%s'" % fldv_dict[fldvID] or ''), col_dict[colID])
def perform_addexistingfield(colID, ln=cdslang, fldID=-1, fldvID=-1, fmeth='', callback='yes', confirm=-1): """form to add an existing field to a collection. colID - the collection to add the field to fldID - the field to add score - the importance of the field. position - the position of the field on the page sel_ln -...
res = add_col_fld(colID, fldID, fmeth, fldvID) if res:
if ares:
def perform_addexistingfield(colID, ln=cdslang, fldID=-1, fldvID=-1, fmeth='', callback='yes', confirm=-1): """form to add an existing field to a collection. colID - the collection to add the field to fldID - the field to add score - the importance of the field. position - the position of the field on the page sel_ln -...
subtitle = """<a name="8">8. Modify sort options for collection '%s'</a>&nbsp;&nbsp&nbsp;<small>[<a href="%s/admin/websearch/guide.html
subtitle = """<a name="8">8. Modify sort options for collection '%s'</a>&nbsp;&nbsp&nbsp;<small>[<a title="See guide" href="%s/admin/websearch/guide.html
def perform_showsortoptions(colID, ln=cdslang, callback='yes', content='', confirm=-1): """show the sort fields of this collection..""" colID = int(colID) col_dict = dict(get_current_name('', ln, get_col_nametypes()[0][0], "collection")) fld_dict = dict(get_current_name('', ln, get_fld_nametypes()[0][0], "field")) fld...
subtitle = """<a name="6">6. Modify search fields for collection '%s'</a>&nbsp;&nbsp&nbsp;<small>[<a href="%s/admin/websearch/guide.html
subtitle = """<a name="6">6. Modify search fields for collection '%s'</a>&nbsp;&nbsp&nbsp;<small>[<a title="See guide" href="%s/admin/websearch/guide.html
def perform_showsearchfields(colID, ln=cdslang, callback='yes', content='', confirm=-1): """show the search fields of this collection..""" colID = int(colID) col_dict = dict(get_current_name('', ln, get_col_nametypes()[0][0], "collection")) fld_dict = dict(get_current_name('', ln, get_fld_nametypes()[0][0], "field")) ...
subtitle = """<a name="7">7. Modify search options for collection '%s'</a>&nbsp;&nbsp&nbsp;<small>[<a href="%s/admin/websearch/guide.html
subtitle = """<a name="7">7. Modify search options for collection '%s'</a>&nbsp;&nbsp&nbsp;<small>[<a title="See guide" href="%s/admin/websearch/guide.html
def perform_showsearchoptions(colID, ln=cdslang, callback='yes', content='', confirm=-1): """show the sort and search options of this collection..""" colID = int(colID) col_dict = dict(get_current_name('', ln, get_col_nametypes()[0][0], "collection")) fld_dict = dict(get_current_name('', ln, get_fld_nametypes()[0][0],...
subtitle = """<a name="10">10. Modify output formats for collection '%s'</a>&nbsp;&nbsp&nbsp;<small>[<a href="%s/admin/websearch/guide.html
subtitle = """<a name="10">10. Modify output formats for collection '%s'</a>&nbsp;&nbsp&nbsp;<small>[<a title="See guide" href="%s/admin/websearch/guide.html
def perform_showoutputformats(colID, ln=cdslang, callback='yes', content='', confirm=-1): """shows the outputformats of the current collection colID - the collection id.""" colID = int(colID) col_dict = dict(get_current_name('', ln, get_col_nametypes()[0][0], "collection")) subtitle = """<a name="10">10. Modify outpu...
<br>For more information, please go to the <a href="%s/admin/websearch/guide.html">WebSearch guide</a> and read the section regarding deleting a collection.</dd>
<br>For more information, please go to the <a title="See guide" href="%s/admin/websearch/guide.html">WebSearch guide</a> and read the section regarding deleting a collection.</dd>
def perform_deletecollection(colID, ln=cdslang, confirm=-1, callback='yes'): """form to delete a collection colID - id of collection """ subtitle ='' output = """ <span class="warning"> <strong> <dl> <dt>WARNING:</dt> <dd>When deleting a collection, you also deletes all data related to the collection like translation...
subtitle = """<a name="4">4. Delete collection '%s'</a>&nbsp;&nbsp&nbsp;<small>[<a href="%s/admin/websearch/guide.html
subtitle = """<a name="4">4. Delete collection '%s'</a>&nbsp;&nbsp&nbsp;<small>[<a title="See guide" href="%s/admin/websearch/guide.html
def perform_deletecollection(colID, ln=cdslang, confirm=-1, callback='yes'): """form to delete a collection colID - id of collection """ subtitle ='' output = """ <span class="warning"> <strong> <dl> <dt>WARNING:</dt> <dd>When deleting a collection, you also deletes all data related to the collection like translation...
res = run_sql("SELECT id, title, body FROM portalbox")
res = run_sql("SELECT id, title, body FROM portalbox ORDER by title,body")
def get_pbx(): """Returns all portalboxes""" try: res = run_sql("SELECT id, title, body FROM portalbox") return res except StandardError, e: return ""
if fldvID:
if fldvID and fldvID not in [-1, "-1"]:
def add_col_fld(colID, fldID, type, fldvID=''): """Add a sort/search/field to the collection. colID - the id of the collection involved fmtID - the id of the format. score - the score of the format, decides sorting, if not given, place the format on top""" try: if fldvID: res = run_sql("SELECT score, score_fieldvalue ...
res = run_sql("INSERT INTO collection_field_fieldvalue(id_field, id_fieldvalue, id_collection, type, score, score_fieldvalue) values (%s,%s,%s,'%s',%s,%s)" % (fldID, fldvID, colID, type, score, (v_score + 1)))
res = run_sql("SELECT * FROM collection_field_fieldvalue where id_field=%s and id_collection=%s and type='%s' and id_fieldvalue=%s" % (fldID, colID, type, fldvID)) if not res: res = run_sql("INSERT INTO collection_field_fieldvalue(id_field, id_fieldvalue, id_collection, type, score, score_fieldvalue) values (%s,%s,%s,'...
def add_col_fld(colID, fldID, type, fldvID=''): """Add a sort/search/field to the collection. colID - the id of the collection involved fmtID - the id of the format. score - the score of the format, decides sorting, if not given, place the format on top""" try: if fldvID: res = run_sql("SELECT score, score_fieldvalue ...
return warningMsg(_("This document has never been requested for approval!") + "<BR>&nbsp;", ln = ln) (authors,title,sysno,newrn) = getInfo(doctype,categ,RN)
return _("This document has never been requested for approval!") + "<BR>&nbsp;" try: (authors,title,sysno,newrn) = getInfo(doctype,categ,RN) except TypeError: return _("Cannot display this document.")
def displayDocument(doctype,categ,RN,send, ln = cdslang): # load the right message language _ = gettext_set_language(ln) t="" res = run_sql("select ldocname from sbmDOCTYPE where sdocname=%s", (doctype,)) docname = res[0][0] if categ == "": categ = "unknown" sth = run_sql("select rn,status,dFirstReq,dLastReq,dAction,...
out += get_fieldvalues_alephseq_like(recID, "001,%s,980" % cfg_oaiidtag)
out += get_fieldvalues_alephseq_like(recID, ["001", cfg_oaiidtag, "980"])
def print_record(recID, format='hb', ot='', ln=cdslang, decompress=zlib.decompress, search_pattern=None, uid=None): "Prints record 'recID' formatted accoding to 'format'." _ = gettext_set_language(ln) out = "" # sanity check: record_exist_p = record_exists(recID) if record_exist_p == 0: # doesn't exist return out # ...
out += "<pre>" + cgi.escape(get_fieldvalues_alephseq_like(recID, "001,%s,980" % cfg_oaiidtag)) + "</pre>"
out += "<pre>" + cgi.escape(get_fieldvalues_alephseq_like(recID, ["001", cfg_oaiidtag, "980"])) + "</pre>"
def print_record(recID, format='hb', ot='', ln=cdslang, decompress=zlib.decompress, search_pattern=None, uid=None): "Prints record 'recID' formatted accoding to 'format'." _ = gettext_set_language(ln) out = "" # sanity check: record_exist_p = record_exists(recID) if record_exist_p == 0: # doesn't exist return out # ...
out += "<pre>" + get_fieldvalues_alephseq_like(recID, "001,%s,980" % cfg_oaiidtag) + "</pre>"
out += "<pre>" + get_fieldvalues_alephseq_like(recID, ["001", cfg_oaiidtag, "980"]) + "</pre>"
def print_record(recID, format='hb', ot='', ln=cdslang, decompress=zlib.decompress, search_pattern=None, uid=None): "Prints record 'recID' formatted accoding to 'format'." _ = gettext_set_language(ln) out = "" # sanity check: record_exist_p = record_exists(recID) if record_exist_p == 0: # doesn't exist return out # ...
if fieldname != "001":
if fieldname not in ("001", "002", "003", "004", "005", "006", "007", "008", "009"):
def create_field_lines(fieldname, field, sysno, alephmarc=0): """From the internal representation of a field, as pulled from a record created by bibrecord, create a list of lists whereby each item in the top-level list represents a record line that should be created for the field, and each sublist represents the variou...
<img src="http://pcusrent01.cern.ch/img/webbasket_usergroup.png" alt="%(header1)s" />
<img src="%(imgurl)s/webbasket_usergroup.png" alt="%(header1)s" />
def tmpl_display_manage_member(self, grpID, group_name, members, pending_members, infos=[], warnings=[], ln=cdslang): """Display current members and waiting members of a group. Parameters:
<img src="http://pcusrent01.cern.ch/img/webbasket_usergroup_gray.png" alt="%(header2)s" />
<img src="%(imgurl)s/webbasket_usergroup_gray.png" alt="%(header2)s" />
def tmpl_display_manage_member(self, grpID, group_name, members, pending_members, infos=[], warnings=[], ln=cdslang): """Display current members and waiting members of a group. Parameters:
<img src="http://pcusrent01.cern.ch/img/iconpen.gif" alt="%(header3)s" />
<img src="%(imgurl)s/iconpen.gif" alt="%(header3)s" />
def tmpl_display_manage_member(self, grpID, group_name, members, pending_members, infos=[], warnings=[], ln=cdslang): """Display current members and waiting members of a group. Parameters:
(idx_unit<len(basic_search_units) and basic_search_units[idx_unit+1][0]=="|"):
((idx_unit+1)<len(basic_search_units) and basic_search_units[idx_unit+1][0]=="|"):
def search_pattern(req=None, p=None, f=None, m=None, ap=0, of="id", verbose=0, ln=cdslang): """Search for complex pattern 'p' within field 'f' according to matching type 'm'. Return hitset of recIDs. The function uses multi-stage searching algorithm in case of no exact match found. See the Search Internals document ...
def is_method_valid(collection, rank_method_code):
def is_method_valid(colID, rank_method_code):
def is_method_valid(collection, rank_method_code): """Checks if a method is valid for the collection given""" return 1
return 1 def get_bibrank_methods(collection='',ln=cdslang):
enabled_colls = dict(run_sql("SELECT id_collection, score from collection_rnkMETHOD,rnkMETHOD WHERE id_rnkMETHOD=rnkMETHOD.id AND name='%s'" % rank_method_code)) colID = int(colID) if enabled_colls.has_key(colID): return 1 else: while colID: colID = run_sql("SELECT id_dad FROM collection_collection WHERE id_son=%s" % ...
def is_method_valid(collection, rank_method_code): """Checks if a method is valid for the collection given""" return 1
if CFG_EXTERNAL_AUTHENTICATION.has_key(user_prefs['login_method']) or CFG_EXTERNAL_AUTHENTICATION.has_key(user_prefs['login_method']) and CFG_EXTERNAL_AUTHENTICATION[user_prefs['login_method']][0] != None: Msg = websession_templates.tmpl_lost_password_message(ln=args['ln'], supportemail = supportemail)
if CFG_EXTERNAL_AUTHENTICATION.has_key(user_prefs['login_method']) and \ CFG_EXTERNAL_AUTHENTICATION[user_prefs['login_method']][0] != None: eMsg = _("Cannot send password by email since you are using external authentication system.")
def send_email(self, req, form): # set all the declared query fields as local variables args = wash_urlargd(form, {'p_email': (str, None)}) uid = webuser.getUid(req)
body=Msg,
body=webaccount.perform_emailMessage(eMsg, args['ln']),
def send_email(self, req, form): # set all the declared query fields as local variables args = wash_urlargd(form, {'p_email': (str, None)}) uid = webuser.getUid(req)
toaddrs = "To: " + args['p_email'] to = toaddrs + "\n" sub = "Subject: %s %s\n\n" % (_("Credentials for"), cdsname) body = "%s %s:\n\n" % (_("Here are your user credentials for"), cdsname) body += " %s: %s\n %s: %s\n\n" % (_("username"), args['p_email'], _("password"), passw) body += "%s %s/youraccount/login?ln=%s...
toaddr = "To: " + args['p_email'] subject = "Subject: %s %s" % (_("Credentials for"), cdsname) body = websession_templates.tmpl_account_lost_password_email_body(args['p_email'], passw, args['ln']) msg = toaddr + "\n" + subject + "\n\n" + body
def send_email(self, req, form): # set all the declared query fields as local variables args = wash_urlargd(form, {'p_email': (str, None)}) uid = webuser.getUid(req)
server.sendmail(fromaddr, toaddrs, msg)
server.sendmail(fromaddr, toaddr, msg)
def send_email(self, req, form): # set all the declared query fields as local variables args = wash_urlargd(form, {'p_email': (str, None)}) uid = webuser.getUid(req)
mess += _("You can now access your %(x_url_open)saccount%(x_url_close)s.") %\
mess += " " + _("You can now access your %(x_url_open)saccount%(x_url_close)s.") %\
def register(self, req, form): args = wash_urlargd(form, { 'p_nickname': (str, None), 'p_email': (str, None), 'p_pw': (str, None), 'p_pw2': (str, None), 'action': (str, "login"), 'referer': (str, "")})
unittest.makeSuite(TestStripAccents,'test')))
unittest.makeSuite(TestStripAccents,'test'), unittest.makeSuite(TestQueryParser,'test')))
def create_test_suite(): """Return test suite for the search engine.""" return unittest.TestSuite((unittest.makeSuite(TestWashQueryParameters,'test'), unittest.makeSuite(TestStripAccents,'test')))
msg += "\nurl: <%s/search.py?%s>\n" % (weburl, argstr)
msg += "url: <%s/search.py?%s>\n" % (weburl, argstr)
def email_notify(alert, records, argstr): global FROMADDR global ALERTURL global DEBUGLEVEL global DEVELOPERADDR if len(records) == 0: return msg = "" if DEBUGLEVEL > 0: msg = "*** THIS MESSAGE WAS SENT IN DEBUG MODE, DON'T TAKE IT INTO ACCOUNT ***\n\n" msg += "Hello\n\n" msg += wrap("Below are the results of the e...
<A href="./edit">%(your_settings)s</A>
<A href="./edit?ln=%(ln)s">%(your_settings)s</A>
def tmpl_account_info(self, ln, uid, guest, cfg_cern_site): """ Displays the account information
<dt><A href="../youralerts.py/display">%(your_searches)s</A>
<dt><A href="../youralerts.py/display?ln=%(ln)s">%(your_searches)s</A>
def tmpl_account_info(self, ln, uid, guest, cfg_cern_site): """ Displays the account information
<dt><A href="../yourbaskets.py/display">%(your_baskets)s</A>
<dt><A href="../yourbaskets.py/display?ln=%(ln)s">%(your_baskets)s</A>
def tmpl_account_info(self, ln, uid, guest, cfg_cern_site): """ Displays the account information
<dt><A href="../youralerts.py/list">%(your_alerts)s</A>
<dt><A href="../youralerts.py/list?ln=%s">%(your_alerts)s</A>
def tmpl_account_info(self, ln, uid, guest, cfg_cern_site): """ Displays the account information
<a href="../youraccount.py/login">login or register here</a>.""") % type
<a href="../youraccount.py/login?ln=%s">login or register here</a>.""") % (type, ln)
def tmpl_warning_guest_user(self, ln, type): """ Displays a warning message about the specified type
return _("""You are logged in as %s. You may want to a) <A href="../youraccount.py/logout">logout</A>; b) edit your <A href="../youraccount.py/edit">account settings</a>.""") % user + "<BR><BR>"
return _("""You are logged in as %s. You may want to a) <A href="../youraccount.py/logout?ln=%s">logout</A>; b) edit your <A href="../youraccount.py/edit?ln=%s">account settings</a>.""") % (user, ln, ln) + "<BR><BR>"
def tmpl_account_body(self, ln, user): """ Displays the body of the actions of the user
% {
% { 'ln' : ln,
def tmpl_account_page(self, ln, weburl, accBody, baskets, alerts, searches, messages, administrative): """ Displays the your account page
%(msg)s <A href="../youraccount.py/lost">%(try_again)s</A>
%(msg)s <A href="../youraccount.py/lost?ln=%(ln)s">%(try_again)s</A>
def tmpl_account_emailMessage(self, ln, msg): """ Displays a link to retrieve the lost password
out += _("""You are no longer recognized. If you wish you can <A href="./login">login here</A>.""")
out += _("""You are no longer recognized. If you wish you can <A href="./login?ln=%s">login here</A>.""") % ln
def tmpl_account_logout(self, ln): """ Displays a confirmation message about logging out
out += _("""If you don't own an account yet, please <a href="../youraccount.py/register">register</a> an internal account.""")
out += _("""If you don't own an account yet, please <a href="../youraccount.py/register?ln=%s">register</a> an internal account.""") % ln
def tmpl_login_form(self, ln, referer, internal, register_available, methods, selected_method, supportemail): """ Displays a login form