Commit 7c8fd1f4 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Rename the table affiliation_rules as affiliation_keys.

parent 92abcd5a
......@@ -24,7 +24,7 @@ MSG_NO_AUTHORS = "<br><br>Removing affiliation failed.<br>"\
def affiliation_institute():
"""Build affiliation rule form the institute database.
"""Determine affiliation keys using the institute database.
"""
# shortcuts
......@@ -36,20 +36,20 @@ def affiliation_institute():
raise HTTP(500, "Record not found!")
# extract keys defining the affiliation
rule_1 = dict(u=record[u"110"]["u"], v="")
rule_2 = dict(u=record[u"110"]["t"], v="")
key_1 = dict(key_u=record[u"110"]["u"], key_v="")
key_2 = dict(key_u=record[u"110"]["t"], key_v="")
# check that the rules does not exist
# load new rules
for rule in (rule_1, rule_2):
if get_id(db.affiliation_rules, **rule) is None:
db.affiliation_rules[0] = rule
for key in (key_1, key_2):
if get_id(db.affiliation_keys, **key) is None:
db.affiliation_keys[0] = key
return
def affiliation_publication():
"""Build affiliation rule form a given publication.
"""Determine affiliation keys using a given publication.
"""
# shortcuts
......@@ -67,27 +67,28 @@ def affiliation_publication():
# find the author
pattern = "^%s, %s$" % (family_name.strip(), first_name.strip())
reg = re.compile(pattern, re.IGNORECASE)
rule = None
key = None
if "700" in record and isinstance(record[u"700"], list):
for di in record[u"700"]:
author = di["a"]
if reg.match(author):
rule = dict(u=di["u"])
if "v" in di:
rule["v"] = di["v"]
key = dict(key_u=di["u"], key_v=di["v"])
else:
key = dict(key_u=di["u"], key_v="")
break
if rule is None:
if key is None:
raise HTTP(500, "Author not found!")
# check that the rules does not exist
# load new rules
if get_id(db.affiliation_rules, **rule) is None:
db.affiliation_rules[0] = rule
if get_id(db.affiliation_keys, **key) is None:
db.affiliation_keys[0] = key
else:
raise HTTP(500, "Rule already exists!")
raise HTTP(500, "Keys already exists!")
return
......
docs/db_schema/database.png

171 KB | W: | H:

docs/db_schema/database.png

172 KB | W: | H:

docs/db_schema/database.png
docs/db_schema/database.png
docs/db_schema/database.png
docs/db_schema/database.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -549,14 +549,14 @@
<part>id</part>
</key>
</table>
<table x="642" y="492" name="affiliation_rules">
<table x="643" y="492" name="affiliation_keys">
<row name="id" null="1" autoincrement="1">
<datatype>integer</datatype>
<default>NULL</default></row>
<row name="u" null="0" autoincrement="0">
<row name="key_u" null="0" autoincrement="0">
<datatype>string</datatype>
</row>
<row name="v" null="1" autoincrement="0">
<row name="key_v" null="1" autoincrement="0">
<datatype>string</datatype>
<default>NULL</default></row>
<key type="PRIMARY" name="">
......
......@@ -25,8 +25,9 @@
'Address of the invenio store where the search is performed.': 'Addresse du site invenio où les recherches sont effectuées.',
'administrators, librairians,...': 'administrateurs, documentalistes,...',
'Affiliation': 'Affiliation',
'affiliation rules': "régles définissant l'affiliation",
'affiliation_rules': "régles définissant l'affiliation",
'affiliation keys': "clés définissant l'affiliation",
'affiliation_keys': "clés définissant l'affiliation",
'affiliation_rules': 'affiliation_rules',
'Agencies': 'Agences',
'agencies': 'agences',
'agency': 'agence',
......@@ -232,6 +233,7 @@
'Fill': 'Remplir',
'Fill all fields': 'Remplir tous les champs',
'Filter': 'Filtrer',
'Filter affiliation_keys': 'Filter affiliation_keys',
'Filter affiliation_rules': "Filtrer les régles d'affiliation",
'Filter categories': 'Filtrer les catégories',
'Filter collaborations': 'Filtrer les collaborations',
......@@ -321,6 +323,8 @@
'ISBN': 'ISBN',
'ISSN': 'ISSN',
'Javascript API': 'Javascript API',
'Key U': 'Clé U',
'Key V': 'Clé V',
'Last name': 'Last name',
'Level': 'Niveau',
'Level 1': 'Niveau 1',
......
# -*- coding: utf-8 -*-
""" affiliation_rules
"""
db.define_table("affiliation_keys",
Field("key_u", "string", length=255, notnull=True),
Field("key_v", "string", length=255, notnull=False),
migrate="affiliation_keys.table")
\ No newline at end of file
# -*- coding: utf-8 -*-
""" affiliation_rules
"""
db.define_table("affiliation_rules",
Field("u", "string", length=255, notnull=True),
Field("v", "string", length=255, notnull=False),
migrate="affiliation_rules.table")
\ No newline at end of file
......@@ -19,21 +19,21 @@
# GRID CONFIGURATiON
#
#-------------------------------------------------------------------------------
gridModifier = dbui.GridModifier('affiliation_rules')
gridModifier = dbui.GridModifier('affiliation_keys')
gridModifier.append_filter(('u', 'contains', T('contains')))
gridModifier.append_filter(('v', 'contains', T('contains')))
gridModifier.append_filter(('key_u', 'contains', T('contains')))
gridModifier.append_filter(('key_v', 'contains', T('contains')))
gridModifier.configure_filters(plugins=['pFormToolTip'], width=300)
gridModifier.configure_gridWithFilter(selectorTitle=T('Filter'))
gridModifier.configure(plugins=['pGridRowEditor',
'pGridAffiliationRulesContextMenu'])
'pGridAffiliationKeysContextMenu'])
#-------------------------------------------------------------------------------
#
# STORE CONFIGURATiON
#
#-------------------------------------------------------------------------------
storeModifier = dbui.StoreModifier('affiliation_rules')
storeModifier.orderby(db.affiliation_rules.u, db.affiliation_rules.v)
storeModifier = dbui.StoreModifier('affiliation_keys')
storeModifier.orderby(db.affiliation_keys.key_u, db.affiliation_keys.key_v)
......@@ -84,7 +84,7 @@ if session.role == ADMIN:
dataInstituteNode = None
if session.role == ADMIN:
leaves = ('affiliation_rules', 'projects', 'teams')
leaves = ('affiliation_keys', 'projects', 'teams')
dataInstituteNode = Node(T('Data institute'))
dataInstituteNode.add_children(leaves, func=to_grid)
......
......@@ -25,7 +25,7 @@ Ext.require('Ext.direct.RemotingProvider');
Ext.require('Ext.EventManager');
Ext.require('Ext.tip.QuickTipManager');
Ext.require('Limbra.grid.plugin.AffiliationRulesContextMenu');
Ext.require('Limbra.grid.plugin.AffiliationKeysContextMenu');
Ext.require('Limbra.wizard.Harvester');
Ext.onReady(function(){
......
......@@ -2,13 +2,13 @@
* French translation
*
*/
Ext.define('Limbra.local.fr.grid.plugin.AffiliationRulesContextMenu', {
Ext.define('Limbra.local.fr.grid.plugin.AffiliationKeysContextMenu', {
override: 'Limbra.grid.plugin.AffiliationRulesContextMenu',
override: 'Limbra.grid.plugin.AffiliationKeysContextMenu',
textAddFromInstitute: 'Ajouter une règle à partir des fiches laboratoire',
textAddFromPublication: "Ajouter une règle à partir d'une publication",
textDestroy: 'Détruire une régle'
textAddFromInstitute: 'Ajouter des clés à partir des fiches laboratoire',
textAddFromPublication: "Ajouter des clés à partir d'une publication",
textDestroy: 'Détruire'
});
......@@ -24,8 +24,7 @@ Ext.define('Limbra.local.fr.wizard.AffiliationFromInstituteDb', {
"<p>Chaque fiche contient les clés définissant l'affiliation de votre",
"laboratoire. Elles sont utilisée",
"dans les entrepôts <i>inspirehep.net</i> et <i>cds.cern.ch</i>.",
"Cet assistant va trouver ces clés et les charger en tant que",
"régles.</p>",
"Cet assistant va trouver ces clés et les charger.</p>",
"<p>Cliquer sur le boutton <i>suivant</i> ou <i>Précédent</i> pour",
"changer de page.",
"A la fin, cliquer sur le boutton <i>Fin</i>.</p>",
......@@ -55,7 +54,7 @@ Ext.define('Limbra.local.fr.wizard.AffiliationFromPublication', {
"<p>Dans les entrepôts <i>inspirehep.net</i> ou <i>cds.cern.ch</i>",
"l'affiliation est définie pour chaque auteur et pour chaque",
"publication.</p>",
"Cet assistant ca trouvez les clés définissant l'affiliation de",
"Cet assistant va trouver les clés définissant l'affiliation de",
"votre laboratoire en utilisant une publication et un auteur.",
"Gardez à l'esprit que ces clés",
"peuvent dépendre de l'entrepôt, de la collection, <i>etc</i>.",
......
/**
* The plugin instantiating the context menu for the Affiliation_rules grid.
* The context menu for the Affiliation_keys grid.
*
* The menu allows to run the wizard "add rule from publication"
* and "add rule institute database" as well as to delete any rules.
* The menu allows to run the wizard "add key from publication"
* and "add key institute database" as well as to delete any keys.
*
* @uses Dbui.grid.plugin.RowEditorBase
* @since 0.9.6
*
*/
Ext.define('Limbra.grid.plugin.AffiliationRulesContextMenu', {
Ext.define('Limbra.grid.plugin.AffiliationKeysContextMenu', {
extend: 'Dbui.grid.plugin.ContextMenu',
alias: 'plugin.pGridAffiliationRulesContextMenu',
alias: 'plugin.pGridAffiliationKeysContextMenu',
uses: ['Ext.window.Window',
'Limbra.wizard.AffiliationFromInstituteDb',
'Limbra.wizard.AffiliationFromPublication'],
......@@ -21,9 +21,9 @@ Ext.define('Limbra.grid.plugin.AffiliationRulesContextMenu', {
widthFromPublication: 350,
// private properties for internationalization
textAddFromInstitute: 'Add one rule from the institute database',
textAddFromPublication: 'Add one rule from a given publication',
textDestroy: 'Delete a rule',
textAddFromInstitute: 'Add keys from the institute database',
textAddFromPublication: 'Add keys from a given publication',
textDestroy: 'Delete',
// jshint strict: false
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment