"""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 name the configuration file for the method.
<br />The template files includes the necessary parameters for the chosen rank method, and only needs to be edited with the correct tags and paths.
<br />For more information, please go to the <a title="See guide" href="%s/help/admin/bibrank-admin-guide">BibRank guide</a> and read the section about adding a rank method</dd>
text+="""<b><span class="info"><br />Sorry, could not create configuration file: '%s.cfg', either because it already exists, or not enough rights to create file. <br />Please create the file in the path given.</span></b>"""%(configuration.get(get_rnk_code(rnkID)[0][0]+'.cfg',''),)
else:
text="""<b><span class="info">Sorry, could not add rank method, rank method with the same BibRank code probably exists.</span></b>"""
output+=text
elifnotrnkcodeandconfirmnotin[-1,"-1"]:
output+="""<b><span class="info">Sorry, could not add rank method, not enough data submitted.</span></b>"""
return"Ranking method %s does not seem to exist."%str(rnkID)
subtitle='Step 1 - Please modify the wanted values below'
ifnotrnkcode:
oldcode=get_rnk_code(rnkID)[0]
else:
oldcode=rnkcode
output="""
<dl>
<dd>When changing the BibRank code of a rank method, you must also change any scheduled tasks using the old value.
<br />For more information, please go to the <a title="See guide" href="%s/help/admin/bibrank-admin-guide">BibRank guide</a> and read the section about modifying a rank method's BibRank code.</dd>
text+="""<b><span class="info">Cannot load file, either it does not exist, or not enough rights to read it: '%s.cfg'<br />Please create the file in the path given.</span></b>"""%(configuration.get(get_rnk_code(rnkID)[0][0]+'.cfg',''),)
text="""<b><span class="info">Sorry, could not change name of cfg file, must be done manually: '%s.cfg'</span></b>"""%(configuration.get(oldcode+'.cfg',''),)
else:
text="""<b><span class="info">Sorry, could not modify rank method.</span></b>"""
text="""<b><span class="info"><br />Sorry, could not modify configuration file, please check for rights to do so: '%s.cfg'<br />Please modify the file manually.</span></b>"""%(configuration.get(get_rnk_code(rnkID)[0][0]+'.cfg',''),)
<dd><strong>When deleting a rank method, you also deletes all data related to the rank method, like translations, which collections
it was attached to and the data necessary to rank the searchresults. Any scheduled tasks using the deleted rank method will also stop working.
<br /><br />For more information, please go to the <a title="See guide" href="%s/help/admin/bibrank-admin-guide">BibRank guide</a> and read the section regarding deleting a rank method.</strong></dd>
text+="""<br /><b><span class="info">Sorry, could not delete configuration file: '%s/bibrank/%s.cfg'.</span><br />Please delete the file manually.</span></b>"""%(configuration.get(rnkcode+".cfg"),)
else:
text="""<b><span class="info">Sorry, could not delete rank method</span></b>"""
exceptStandardError,e:
text="""<b><span class="info">Sorry, could not delete rank method, most likely already deleted</span></b>"""
text="BibRank not yet run, cannot show statistics for method"
output+=addadminbox(subtitle,[text])
subtitle="""Attached to collections <a href="%s/admin/bibrank/bibrankadmin.py/modifycollection?rnkID=%s&ln=%s">[Modify]</a>"""%(CFG_SITE_URL,rnkID,ln)