font-size:12px;
color:red;
}
+
+
+.ressource-retrieve * {margin-top: 1em;}
+
+.le-titre{line-height: 24px;}
+
+.fiche, .original, .provenance {font-size: 80%; margin: 2px 0px;}
+.fiche {margin-top: 12px;}
+.fiche a, .original a, .provenance a{text-decoration: none;}
import urllib, httplib, time, simplejson, pprint, math, re
from django.core.urlresolvers import reverse
from django.conf import settings
+from auf_savoirs_en_partage.backend_config import RESOURCES
from sep import SEP
from utils import smart_str
from savoirs.globals import configuration
-
def google_search (page, q, data):
params = {'q': q,
'rsz': 'large',
if len (uri) == 0:
uri = r.get ("source")
+ serveur = RESOURCES[r.get('server')]['url']
+
# Récupère la source si ce n'est pas une URL
source = r.get("source", None)
if source is not None and source.startswith('http'):
data['results'].append ({
'uri': uri,
+ 'getServeurURL': serveur,
'source' : source,
'id': r.get("id"), \
'title': hl(regexp, title),
# Manager
objects = RecordManager()
+ def getServeurURL(self,):
+ """Retourne l'URL du serveur de provenance"""
+ return RESOURCES[self.server]['url']
+
def est_complet(self,):
"""teste si le record à toutes les données obligatoires"""
return self.disciplines.count() > 0 and \
Context ({'type': type,
'page': page,
'data': r,
+ 'search_regexp': None, # pour pouvoir utiliser la même template de résultat
'form': f,
'q': q}),
context_instance = RequestContext(request))
<h4>Résultats de recherche:</h4>
<div class="zone-texte">
- {% for r in data.results %}
- {% include "savoirs/resultat.html" %}
+ {% for r in data.results %}
+ {% with r as ressource %}
+ {% include "savoirs/ressource_resultat.html" %}
+ {% endwith %}
{% empty %}
<div class="resultatRecherche">
<h2>Aucun résultat trouvé</h2>
{% load search %}
<div class="resultatRecherche">
- <a class="le-titre" href="{{ ressource.uri }}">{{ ressource.title|highlight:search_regexp }}</a>
+ <a class="le-titre" href="{% url savoirs.views.ressource_retrieve ressource.id %}">{{ ressource.title|highlight:search_regexp }}</a>
{% if ressource.creator %}
<div><span class="lbl">Auteur:</span> {{ ressource.creator|highlight:search_regexp }}</div>
{% endif %}
{% if ressource.description %}
<div class="resultatResume"><span class="lbl">Description:</span> {{ ressource.description|excerpt:search_regexp|highlight:search_regexp }}</div>
{% endif %}
+ <div class="fiche"><span>Fiche: </span><a href="{% url savoirs.views.ressource_retrieve ressource.id %}">{% url savoirs.views.ressource_retrieve ressource.id %}</a></div>
+ <div class="original"><span>Contenu original: </span><a target="_blank" href="{{ ressource.uri }}">{{ ressource.uri }}</a></div>
+ <div class="provenance"><span>Provenance: </span><a target="_blank" href="{{ ressource.getServeurURL }}">{{ ressource.getServeurURL }}</a></div>
</div>
+
+ {% comment %}
+ {% if user.is_authenticated %}
+ <a href="{{ r.admin_url}}" target="_blank">Modifier</a>
+ {% endif %}
+ {% endcomment %}
{% block contenu %}
<h4>Ressource</h4>
-<div class="zone-texte">
- {% with ressource as r %}
- {% include "savoirs/resultat.html" %}
- {% endwith %}
+<div class="zone-texte ressource-retrieve">
+
+ <a class="le-titre" href="{% url savoirs.views.ressource_retrieve ressource.id %}">{{ ressource.title }}</a>
+
+ {% if ressource.subject %}
+ <div><span class="lbl">Sujet:</span> {{ ressource.subject }}</div>
+ {% endif %}
+
+ {% if ressource.creator %}
+ <div><span class="lbl">Auteur:</span> {{ ressource.creator }}</div>
+ {% endif %}
+ {% if ressource.description %}
+ <div class="resultatResume"><span class="lbl">Description:</span> {{ ressource.description }}</div>
+ {% endif %}
+
+ {% if ressource.source %}
+ <div><span class="lbl">Source:</span> {{ ressource.source }}</div>
+ {% endif %}
+
+ {% if ressource.publisher %}
+ <div><span class="lbl">Editeur:</span> {{ ressource.publisher }}</div>
+ {% endif %}
+
+ {% if ressource.format %}
+ <div><span class="lbl">Format:</span> {{ ressource.format }}</div>
+ {% endif %}
+
+ {% if ressource.type %}
+ <div><span class="lbl">Type:</span> {{ ressource.type }}</div>
+ {% endif %}
+
+
+
+
+
+ <div class="fiche"><span>Fiche: </span><a href="{% url savoirs.views.ressource_retrieve ressource.id %}">{% url savoirs.views.ressource_retrieve ressource.id %}</a></div>
+ <div class="original"><span>Contenu original: </span><a target="_blank" href="{{ ressource.uri }}">{{ ressource.uri }}</a></div>
+ <div class="provenance"><span>Provenance: </span><a target="_blank" href="{{ ressource.getServeurURL }}">{{ ressource.getServeurURL }}</a></div>
+
+
+
</div>
{% endblock %}
+++ /dev/null
-<div class="resultatRecherche">
- <a class="le-titre" href="{{ r.uri }}">{{ r.title|safe }}</a>
- {% if r.creator %}
- <div><span class="lbl">Auteur:</span> {{ r.creator|safe }}</div>
- {% endif %}
- {% if r.content %}
- <div class="resultatResume"><span class="lbl">Description:</span> {{ r.content|safe }}</div>
- {% endif %}
-
- {% comment %}
- {% if r.contributors %}
- <div><span class="lbl">Contributeurs:</span> {{ r.contributors|safe }}</div>
- {% endif %}
- {% if r.subject %}
- <div><span class="lbl">Sujets:</span> {{ r.subject|safe }}</div>
- {% endif %}
- {% if r.source %}
- <div><span class="lbl">Source:</span> {{ r.source|safe }}</div>
- {% endif %}
- {% if r.modified %}
- <div><span class="lbl">Date de modification:</span> {{ r.modified }}</div>
- {% endif %}
- {% if r.isbn %}
- <div><span class="lbl">ISBN:</span> {{ r.isbn|safe }}</div>
- {% endif %}
- {% if user.is_authenticated %}
- <a href="{{ r.admin_url}}" target="_blank">Modifier</a>
- {% endif %}
- {% endcomment %}
-</div>