--- a/.hgtags Tue Jul 31 02:27:09 2012 +0200
+++ b/.hgtags Tue Jul 31 12:13:53 2012 +0200
@@ -83,3 +83,4 @@
619222c32adef46656a3966c8f400bb692f128f9 V01.12
dfdbe9e00aae99212fc4bf4f54765ee36a2857d2 V01.13
99286ab161613fca59b9db72959a38ed8f77be25 V01.14
+d9bfc148a887ffb0b05f4c784f8b18fea4741dfd V01.15
--- a/.settings/org.eclipse.core.resources.prefs Tue Jul 31 02:27:09 2012 +0200
+++ b/.settings/org.eclipse.core.resources.prefs Tue Jul 31 12:13:53 2012 +0200
@@ -1,3 +1,4 @@
+#Fri Jul 27 18:53:06 CEST 2012
eclipse.preferences.version=1
encoding//src/ldt/ldt/core/migrations/0001_initial.py=utf-8
encoding//src/ldt/ldt/core/migrations/0002_auto__del_owner.py=utf-8
@@ -15,6 +16,7 @@
encoding//src/ldt/ldt/ldt_utils/migrations/0011_gen_stat_annotation.py=utf-8
encoding//src/ldt/ldt/ldt_utils/migrations/0015_auto__add_contentstat__del_field_content_last_annotated__del_field_con.py=utf-8
encoding//src/ldt/ldt/ldt_utils/migrations/0017_correct_image_path.py=utf-8
+encoding//src/ldt/ldt/ldt_utils/views/json.py=utf-8
encoding//src/ldt/ldt/management/utils.py=utf-8
encoding//src/ldt/ldt/text/migrations/0001_initial.py=utf-8
encoding//src/ldt/ldt/user/migrations/0001_initial.py=utf-8
--- a/src/ldt/ldt/__init__.py Tue Jul 31 02:27:09 2012 +0200
+++ b/src/ldt/ldt/__init__.py Tue Jul 31 12:13:53 2012 +0200
@@ -1,4 +1,4 @@
-VERSION = (1, 14, 0, "final", 0)
+VERSION = (1, 15, 0, "final", 0)
def get_version():
--- a/src/ldt/ldt/ldt_utils/projectserializer.py Tue Jul 31 02:27:09 2012 +0200
+++ b/src/ldt/ldt/ldt_utils/projectserializer.py Tue Jul 31 12:13:53 2012 +0200
@@ -303,8 +303,7 @@
res = self.ldt_doc.xpath("/iri/annotations/content")
for content_node in res:
- content_id = content_node.attrib[u"id"]
-
+ content_id = content_node.attrib[u"id"]
if self.from_display and content_id not in self.display_contents_list:
continue
content = Content.objects.get(iri_id=content_id) #@UndefinedVariable
@@ -317,14 +316,11 @@
self.__parse_ensemble(ensemble_node, content)
if self.first_cutting and self.first_cutting not in self.display_cuttings_list:
-
cutting_node= self.ldt_doc.xpath('/iri/annotations/content/ensemble/decoupage[@id=\'%s\']' % self.first_cutting)[0]
ensemble_node = cutting_node.xpath('..')[0]
- content_node = ensemble_node.xpath('..')[0]
-
+ content_node = ensemble_node.xpath('..')[0]
iri_id = content_node.get("id")
- content = Content.objects.get(iri_id=iri_id)
-
+ content = Content.objects.get(iri_id=iri_id)
self.__parse_ensemble(ensemble_node, content, cutting_only=[cutting_node])
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/content_project_pagination.html Tue Jul 31 02:27:09 2012 +0200
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/content_project_pagination.html Tue Jul 31 12:13:53 2012 +0200
@@ -1,42 +1,26 @@
{% load front_tags %}
{% if nb_pages %}
- <p class="prev_next_cont_proj" >{% comment %}
- alors ? : {{begin}} - {{middle}} - {{end}} - nb_pages = {{nb_pages}}<br/>
+ {% comment %}alors ? : {{begin}} - {{middle}} - {{end}} - nb_pages = {{nb_pages}}<br/>
alors ? : nb_pages = {{nb_pages}} - range = {{nb_pages|get_range}} - cur_page_nb = {{cur_page_nb}}<br/>{% endcomment %}
{% if 0 < cur_page_nb %}<a class="{{a_class}}" alt="prev"><<</a> {% endif %}
{% for i in begin %}
- {% if i == cur_page_nb %}
- {{i|add:'1'}}
- {% else %}
- <a class="{{a_class}}" alt="{{i}}">{{i|add:'1'}}</a>
- {% endif %}
-
+ {% if i == cur_page_nb %}{{i|add:'1'}}{% else %}<a class="{{a_class}}" alt="{{i}}">{{i|add:'1'}}</a>{% endif %}
{% endfor %}
{% if middle %}
- ...
+ ...
{% for i in middle %}
- {% if i == cur_page_nb %}
- {{i|add:'1'}}
- {% else %}
- <a class="{{a_class}}" alt="{{i}}">{{i|add:'1'}}</a>
- {% endif %}
-
+ {% if i == cur_page_nb %}{{i|add:'1'}}{% else %}<a class="{{a_class}}" alt="{{i}}">{{i|add:'1'}}</a>{% endif %}
{% endfor %}
{% endif %}
{% if end %}
- ...
+ ...
{% for i in end %}
- {% if i == cur_page_nb %}
- {{i|add:'1'}}
- {% else %}
- <a class="{{a_class}}" alt="{{i}}">{{i|add:'1'}}</a>
- {% endif %}
-
+ {% if i == cur_page_nb %}{{i|add:'1'}}{% else %}<a class="{{a_class}}" alt="{{i}}">{{i|add:'1'}}</a>{% endif %}
{% endfor %}
{% endif %}
{% if cur_page_nb|add:'1' < nb_pages %}<a class="{{a_class}}" alt="next">>></a>{% endif %}
- </p>
{% endif %}
+</p>
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/contentslist.html Tue Jul 31 02:27:09 2012 +0200
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/contentslist.html Tue Jul 31 12:13:53 2012 +0200
@@ -2,10 +2,21 @@
{% load thumbnail %}
{% load front_tags %}
+<ul class="prev_next_cont_proj" >
+ <li id="content_tags_li"><span id="content_tags" class="clickable">{% if tag_cloud|length > 0 %}{% trans 'All categories' %}{% endif %}</span>{% if current_content_tag %}{% if current_content_tag != "" %} > {{current_content_tag}} <span id="no_content_tag" class="clickable">[x]</span>{% endif %}{% endif %}</li>
{% if nb_ct_pages %}
- {% load navigation %}{% build_pagination nb_ct_pages current_content_page "contents_page clickable" %}
+ <li>{% load navigation %}{% build_pagination nb_ct_pages current_content_page "contents_page clickable" %}</li>
<input type="hidden" value="{{current_content_page}}" name="current_content_page" id="current_content_page">
{% endif %}
+</ul>
+<div id="content_tags_cloud">{% if tag_cloud|length > 0 %}
+ <p>
+ {% for t in tag_cloud %}
+ <a class="contents_tag clickable" alt="{{t.name}}"><span style="font-size:{{t.font_size|add:"10"}}px;">{{t.name}}</span></a>{% if not forloop.last %}, {% endif %}
+ {% endfor %}
+ </p>{% endif %}
+ <input type="hidden" value="{{current_content_tag}}" name="current_content_tag" id="current_content_tag">
+</div>
<div class="projectscontentsheader projectcontentsheadertitle span-12 last" id="contentsheader">
{% trans "name" %}
</div>
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/projectslist.html Tue Jul 31 02:27:09 2012 +0200
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/projectslist.html Tue Jul 31 12:13:53 2012 +0200
@@ -3,9 +3,10 @@
{% load front_tags %}
{% if nb_pj_pages %}
- {% load navigation %}{% build_pagination nb_pj_pages current_project_page "projects_page clickable" %}
+<ul class="prev_next_cont_proj" >
+ <li>{% load navigation %}{% build_pagination nb_pj_pages current_project_page "projects_page clickable" %}</li>
<input type="hidden" value="{{current_project_page}}" name="current_project_page" id="current_project_page">
- </p>
+</ul>
{% endif %}
<div class="projectscontentsheader projectcontentsheadertitle span-12 last" id="projectsheader">
{% trans "name" %}
--- a/src/ldt/ldt/ldt_utils/urls.py Tue Jul 31 02:27:09 2012 +0200
+++ b/src/ldt/ldt/ldt_utils/urls.py Tue Jul 31 12:13:53 2012 +0200
@@ -46,6 +46,7 @@
url(r'^front/player/(?P<content_iri_id>.*)/(?P<project_id>.*)/(?P<cutting_id>.*)$', 'views.front.annot_content'),
url(r'^front/search/$', 'views.front.search_index'),
url(r'^front/medias', 'views.front.all_contents'),
+ url(r'^mashupbytag/$', 'views.json.mashup_by_tag'),
)
urlpatterns += patterns('',
--- a/src/ldt/ldt/ldt_utils/utils.py Tue Jul 31 02:27:09 2012 +0200
+++ b/src/ldt/ldt/ldt_utils/utils.py Tue Jul 31 12:13:53 2012 +0200
@@ -40,7 +40,7 @@
class LdtUtils(object):
- def generate_ldt(self, contentList, title=u"", author=u"IRI Web", web_url=u"", startSegment=None, projects=None):
+ def generate_ldt(self, contentList, title=u"", author=u"IRI Web", web_url=u"", startSegment=None, projects=None, types_id_list=None):
iri = lxml.etree.Element(u'iri')
doc = lxml.etree.ElementTree(iri)
@@ -116,6 +116,19 @@
decoupage = lxml.etree.SubElement(contentd, "decoupage")
decoupage.set(u"id", decoupage_id)
decoupage.set(u"idens", ensemble_id)
+ # We add the project's decoupages in the generated project
+ if len(annotations_nodes) > 0:
+ if content.iri_id in annotations_nodes:
+ contentnode = annotations_nodes[content.iri_id]
+ if contentnode is not None:
+ for ens in contentnode["ensembles"]:
+ for decoupagenode in ens:
+ type_id = decoupagenode.get(u"id")
+ if type_id in types_id_list:
+ decoupage = lxml.etree.SubElement(contentd, "decoupage")
+ decoupage.set(u"id", decoupagenode.get(u"id"))
+ decoupage.set(u"idens", ens.get(u"id"))
+
if startSegment is not None:
activeSegment = lxml.etree.SubElement(display, "activeSegment")
idas = lxml.etree.SubElement(activeSegment, "id")
--- a/src/ldt/ldt/ldt_utils/views/content.py Tue Jul 31 02:27:09 2012 +0200
+++ b/src/ldt/ldt/ldt_utils/views/content.py Tue Jul 31 12:13:53 2012 +0200
@@ -14,6 +14,7 @@
from ldt.security.utils import assign_perm_to_obj, add_change_attr, get_userlist, get_userlist_model
from ldt.security.cache import cached_assign
from ldt.user.forms import PictureForm
+from tagging.models import Tag, TaggedItem
from urllib2 import urlparse
import ldt.utils.path as ldt_utils_path
import logging
@@ -393,21 +394,35 @@
num_page = 0
if request.GET.has_key('num_page'):
num_page = int(request.GET["num_page"])
+ tag_filter = ""
+ if request.GET.has_key('tag_filter'):
+ tag_filter = request.GET["tag_filter"]
# We paginate the content list, in case of filter or not
- if filter:
+ if filter and not tag_filter :
content_nb = Content.safe_objects.filter(title__icontains=filter).count()
- nb_ct_pages = int(math.ceil(content_nb / settings.LDT_MAX_CONTENTS_PER_PAGE))
+ nb_ct_pages = int(math.ceil(content_nb / settings.LDT_MAX_CONTENTS_PER_PAGE)) + 1
content_list = Content.safe_objects.filter(title__icontains=filter)[(num_page*settings.LDT_MAX_CONTENTS_PER_PAGE):((num_page+1)*settings.LDT_MAX_CONTENTS_PER_PAGE)] #@UndefinedVariable
+ elif filter and tag_filter :
+ #TaggedItem.objects.get_by_model(Content.objects.all(), '"'+tag_filter+'"')
+ content_nb = TaggedItem.objects.get_by_model(Content.safe_objects.filter(title__icontains=filter), '"'+tag_filter+'"').count()
+ nb_ct_pages = int(math.ceil(content_nb / settings.LDT_MAX_CONTENTS_PER_PAGE)) + 1
+ content_list = TaggedItem.objects.get_by_model(Content.safe_objects.filter(title__icontains=filter), '"'+tag_filter+'"')[(num_page*settings.LDT_MAX_CONTENTS_PER_PAGE):((num_page+1)*settings.LDT_MAX_CONTENTS_PER_PAGE)] #@UndefinedVariable
+ elif tag_filter and not filter:
+ content_nb = TaggedItem.objects.get_by_model(Content.safe_objects.all(), '"'+tag_filter+'"').count()
+ nb_ct_pages = int(math.ceil(content_nb / settings.LDT_MAX_CONTENTS_PER_PAGE)) +1
+ content_list = TaggedItem.objects.get_by_model(Content.safe_objects.all(), '"'+tag_filter+'"')[(num_page*settings.LDT_MAX_CONTENTS_PER_PAGE):((num_page+1)*settings.LDT_MAX_CONTENTS_PER_PAGE)] #@UndefinedVariable
else:
content_nb, nb_ct_pages, content_list = get_contents_page(num_page, request.user)
#Change attributes with object permissions
content_list = add_change_attr(request.user, content_list)
+ # Get the all tags list
+ tag_cloud = get_content_tags()
is_gecko = ((request.META['HTTP_USER_AGENT'].lower().find("firefox")) > -1);
return render_to_response("ldt/ldt_utils/partial/contentslist.html",
{'contents': content_list, 'nb_ct_pages': nb_ct_pages, 'content_nb': content_nb, 'current_content_page':float(num_page),
- 'is_gecko': is_gecko
+ 'tag_cloud': tag_cloud, 'current_content_tag':tag_filter, 'is_gecko': is_gecko
},
context_instance=RequestContext(request))
@@ -417,3 +432,10 @@
nb_ct_pages = int(math.ceil(content_nb / settings.LDT_MAX_CONTENTS_PER_PAGE))
content_list = add_change_attr(user, Content.safe_objects.all()[(num_page*settings.LDT_MAX_CONTENTS_PER_PAGE):((num_page+1)*settings.LDT_MAX_CONTENTS_PER_PAGE)]) #@UndefinedVariable
return content_nb, nb_ct_pages, content_list
+
+
+def get_content_tags(limit=None, steps=10):
+ if limit is None:
+ return Tag.objects.cloud_for_model(Content, steps=steps)
+ else :
+ return Tag.objects.cloud_for_model(Content, steps=steps)[:limit]
--- a/src/ldt/ldt/ldt_utils/views/front.py Tue Jul 31 02:27:09 2012 +0200
+++ b/src/ldt/ldt/ldt_utils/views/front.py Tue Jul 31 12:13:53 2012 +0200
@@ -7,6 +7,7 @@
from guardian.shortcuts import get_objects_for_group
from ldt.ldt_utils.models import Content, Project
from ldt.ldt_utils.forms import SearchForm
+from ldt.ldt_utils.views.content import get_content_tags
from ldt.ldt_utils.views.workspace import get_search_results
from tagging.models import Tag, TaggedItem
import base64
@@ -146,8 +147,4 @@
return render_to_response('front/front_search_results.html', {'results': results, 'nb_results' : nb, 'search' : search, 'field': field, 'tag_label':content_tag, 'LDT_MEDIA_PREFIX': settings.LDT_MEDIA_PREFIX, 'colorurl': settings.LDT_MEDIA_PREFIX + 'swf/ldt/pkg/color.xml', 'i18nurl': settings.LDT_MEDIA_PREFIX + 'swf/ldt/pkg/i18n', 'language': language_code, 'baseurl': settings.LDT_MEDIA_PREFIX + 'swf/ldt/'}, context_instance=RequestContext(request))
-def get_content_tags(limit=None, steps=10):
- if limit is None:
- return Tag.objects.cloud_for_model(Content, steps=steps)
- else :
- return Tag.objects.cloud_for_model(Content, steps=steps)[:limit]
+
--- a/src/ldt/ldt/ldt_utils/views/json.py Tue Jul 31 02:27:09 2012 +0200
+++ b/src/ldt/ldt/ldt_utils/views/json.py Tue Jul 31 12:13:53 2012 +0200
@@ -1,12 +1,17 @@
+# -*- coding: utf-8 -*-
from django.conf import settings
from django.http import HttpResponse, HttpResponseForbidden
from django.shortcuts import get_object_or_404, get_list_or_404
from django.utils import simplejson
from django.utils.html import escape
from django.utils.translation import ugettext as _
+from ldt.indexation import get_results_with_context
from ldt.ldt_utils.models import Project
from ldt.ldt_utils.projectserializer import ProjectSerializer
+from ldt.ldt_utils.views.lignesdetemps import search_ldt
+from datetime import datetime
import ldt.auth as ldt_auth
+import lxml.etree
def project_json_id(request, id):
@@ -72,3 +77,76 @@
resp.write(json_str)
return resp
+
+
+
+def mashup_by_tag(request):
+ # do we indent ?
+ indent = request.REQUEST.get("indent")
+ if indent is None:
+ indent = settings.LDT_JSON_DEFAULT_INDENT
+ else:
+ indent = int(indent)
+ # do we escape ?
+ escape_str = request.REQUEST.get("escape")
+ escape_bool = False
+ if escape_str:
+ escape_bool = {'true': True, 'false': False, "0": False, "1": True}.get(escape_str.lower())
+
+ # We search
+ s = request.REQUEST.get("tag")
+ if s:
+ # We get the projects with all the segments
+ project_xml, results = search_ldt(request, "tags", s, None, True, False)
+ project = Project()
+ project.ldt = lxml.etree.tostring(project_xml, pretty_print=True)
+ # Needed datas for jsonification
+ now = datetime.now()
+ project.modification_date = project.creation_date = now
+ #return HttpResponse(lxml.etree.tostring(project_xml, pretty_print=True), mimetype="text/xml;charset=utf-8")
+ ps = ProjectSerializer(project, from_contents=False)
+ mashup_dict = ps.serialize_to_cinelab()
+ # Now we build the mashup with the good segments (the ones between in and out)
+ if results:
+ tc_in = 0
+ if request.REQUEST.get("in") :
+ tc_in = float(request.REQUEST.get("in"))
+ tc_out = float('inf')
+ if request.REQUEST.get("out") :
+ tc_out = float(request.REQUEST.get("out"))
+ # Since the timecodes are saved as strings, we filter after calculating float in and out. Timecodes are in milliseconds
+ mashup_list = {
+ "items": [],
+ "meta": {
+ "dc:contributor": "IRI",
+ "dc:creator": "IRI",
+ "dc:title": "Generated mashup with tag '"+s+"'",
+ "dc:modified": now.isoformat(),
+ "dc:created": now.isoformat(),
+ "listtype": "mashup",
+ "dc:description": ""
+ },
+ "id": "generated_mashup_list"
+ }
+ #filtered_results = []
+ for res in results:
+ cur_in = float(res["begin"])
+ cur_out = cur_in + float(res["duration"])
+ if tc_in<=cur_in and cur_out<=tc_out:
+ #filtered_results.append(res)
+ mashup_list["items"].append(res["element_id"])
+ mashup_dict["lists"].append(mashup_list)
+
+ #mashup_dict["escape_bool"] = escape_bool
+ #mashup_dict["indent"] = indent
+
+ json_str = simplejson.dumps(mashup_dict, ensure_ascii=False, indent=indent)
+ if escape_bool:
+ json_str = escape(json_str)
+
+ resp = HttpResponse(mimetype="application/json; charset=utf-8")
+ resp['Cache-Control'] = 'no-cache, must-revalidate'
+ resp['Pragma'] = 'no-cache'
+ resp.write(json_str)
+
+ return resp
--- a/src/ldt/ldt/ldt_utils/views/lignesdetemps.py Tue Jul 31 02:27:09 2012 +0200
+++ b/src/ldt/ldt/ldt_utils/views/lignesdetemps.py Tue Jul 31 12:13:53 2012 +0200
@@ -31,24 +31,30 @@
resp.write(lxml.etree.tostring(doc, pretty_print=True, encoding="utf-8"))
return resp
-def search_ldt(request, field, query, edition=None):
+def search_ldt(request, field, query, edition=None, return_project=False, query_encoded=True):
contentList = []
resp = HttpResponse(mimetype="text/xml")
queryStr = ""
- if query and len(query) > 0:
- queryStr = base64.urlsafe_b64decode(query.encode("ascii")).decode("utf8")
+ if query and len(query) > 0:
+ if query_encoded:
+ queryStr = base64.urlsafe_b64decode(query.encode("ascii")).decode("utf8")
+ else:
+ queryStr = query
searcher = SimpleSearch()
ids = {}
projIds = {}
-
- for result in searcher.query(field, queryStr):
+ typesIds = {}
+ results = searcher.query(field, queryStr)
+ for result in results:
ids[result["iri_id"]] = ""
projIds[result["project_id"]] = ""
+ typesIds[result["decoupage_id"]] = ""
id_list = ids.keys()
projId_list = projIds.keys()
+ typesId_list = typesIds.keys()
#if edition is not None:
# ids_editions = map(lambda t:t[0], filter(lambda id: id[0] is not None, Speak.objects.filter(session__day__edition=edition).order_by("session__start_ts", "order").values_list("content__iri_id")))
@@ -59,8 +65,10 @@
ldtgen = LdtUtils()
# generate_ldt(contentList, title=u"", author=u"IRI Web", web_url=u"", startSegment=None, projects=None):
- doc = ldtgen.generate_ldt(contentList, title=u"Recherche : " + queryStr, projects=projectList)
- doc = set_forbidden_stream(doc, request.user)
+ doc = ldtgen.generate_ldt(contentList, title=u"Recherche : " + queryStr, projects=projectList, types_id_list=typesId_list)
+ doc = set_forbidden_stream(doc, request.user)
+ if return_project:
+ return doc, results
doc.write(resp, pretty_print=True)
return resp
--- a/src/ldt/ldt/ldt_utils/views/workspace.py Tue Jul 31 02:27:09 2012 +0200
+++ b/src/ldt/ldt/ldt_utils/views/workspace.py Tue Jul 31 12:13:53 2012 +0200
@@ -14,7 +14,7 @@
from ldt.ldt_utils.models import Content, Project, Segment
from ldt.ldt_utils.utils import boolean_convert
from ldt.ldt_utils.projectserializer import ProjectSerializer
-from ldt.ldt_utils.views.content import get_contents_page
+from ldt.ldt_utils.views.content import get_contents_page, get_content_tags
from ldt.ldt_utils.views.project import get_projects_page, get_published_projects_page
from ldt.security.utils import add_change_attr, get_userlist
from lxml.html import fragment_fromstring
@@ -34,7 +34,8 @@
content_nb, nb_ct_pages, content_list = get_contents_page(num_page, request.user)
# get list of projects owned by the current user
project_nb, nb_pj_pages, project_list = get_projects_page(num_page, request.user)
- #project_list = add_change_attr(request.user, Project.safe_objects.filter(owner=request.user)[:settings.LDT_MAX_PROJECTS_PER_PAGE]) #@UndefinedVariable
+ # Get the all tags list
+ tag_cloud = get_content_tags()
is_gecko = ((request.META['HTTP_USER_AGENT'].lower().find("firefox")) > -1);
@@ -49,7 +50,7 @@
return render_to_response("ldt/ldt_utils/workspace.html",
{'contents': content_list, 'nb_ct_pages': nb_ct_pages, 'content_nb': content_nb, 'current_content_page':float(num_page),
'projects': project_list, 'nb_pj_pages': nb_pj_pages, 'project_nb': project_nb, 'current_project_page':float(num_page),
- 'is_gecko': is_gecko, #'project_api_url':"match.url_name",
+ 'tag_cloud': tag_cloud, 'is_gecko': is_gecko, #'project_api_url':"match.url_name",
#'project_api_view':match.url_name,'project_api_args':"project_api_args",'project_api_kwargs':"project_api_kwargs"
},
context_instance=RequestContext(request))
@@ -218,7 +219,6 @@
segment.indexation_id = s['indexation_id']
segment.context = s['context']
segment.context_tags = s['tags']
- segment.highlighted = s['highlighted']
if not s['project_id']:
segment.project_id = '_'
--- a/src/ldt/ldt/static/ldt/css/workspace.css Tue Jul 31 02:27:09 2012 +0200
+++ b/src/ldt/ldt/static/ldt/css/workspace.css Tue Jul 31 12:13:53 2012 +0200
@@ -205,7 +205,7 @@
}
#contentleft input[type=checkbox] {
- float: left;
+ float: left;
}
.shareicon {
@@ -232,10 +232,18 @@
}
.prev_next_cont_proj {
- margin: 0 0 5px;
- float: right;
+ margin-left: -40px;
+ margin-right: 0;
+ list-style: none outside none;
}
-.prev_next_cont_proj a, .prev_next_cont_proj a:visited{
+.prev_next_cont_proj li {
+ float: right;
+ margin: 0 0 -10px;
+}
+#content_tags_li{
+ float: left;
+}
+.prev_next_cont_proj a, .prev_next_cont_proj a:visited, #content_tags_cloud a, #content_tags_cloud a:visited, #no_content_tag{
color: #0063DC;
text-decoration: none;
}
\ No newline at end of file
--- a/src/ldt/ldt/static/ldt/js/projectscontents.js Tue Jul 31 02:27:09 2012 +0200
+++ b/src/ldt/ldt/static/ldt/js/projectscontents.js Tue Jul 31 12:13:53 2012 +0200
@@ -127,7 +127,7 @@
};
}
-function searchCallback(target, container_selector, url, timeout, num_page) {
+function searchCallback(target, container_selector, url, timeout, num_page, tag_filter) {
timeout = typeof(timeout) !== 'undefined' ? timeout : 0;
target = $(target);
@@ -151,13 +151,22 @@
var filterVal = "_" + encodeURIComponent(target.realVal());
url = url.replace('__FILTER__',filterVal);
url = url.replace('__ID_GROUP__',$('#id_group').val());
- if(num_page){
+ var data_obj = null;
+ if(num_page || tag_filter){
+ data_obj = {};
+ if(num_page){
+ data_obj["num_page"] = num_page;
+ }
+ if(tag_filter){
+ data_obj["tag_filter"] = tag_filter;
+ }
+ }
+ if(data_obj!=null){
$.ajax({
url: url,
cache: false,
type: 'GET',
- data: {num_page:num_page
- },
+ data: data_obj,
success: function(data, status, request) {
$(container_selector).html(data);
target.next(".searchajaxloader").hide();
@@ -198,7 +207,7 @@
init_events_base(base_node, embed_url);
// Content pagination in workspace home
- $('.contents_page').click(function(e){
+ $('.contents_page',base_node).click(function(e){
num_page = $(this).attr('alt');
if(num_page=="prev"){
num_page = parseInt($('#current_content_page').val()) - 1;
@@ -206,9 +215,23 @@
else if(num_page=="next"){
num_page = parseInt($('#current_content_page').val()) + 1;
}
- searchCallback($("#searchcontentsinput"),"#contentslistcontainer",content_filter_url,0,num_page);
+ searchCallback($("#searchcontentsinput"),"#contentslistcontainer",content_filter_url,0,num_page,$('#current_content_tag').val());
});
+ // Content pagination in workspace home with tag/category filter
+ $("#content_tags_cloud",base_node).toggle(false);
+ $("#content_tags",base_node).click(function(){
+ $("#content_tags_cloud").slideToggle("fast");
+ });
+ $('.contents_tag',base_node).click(function(e){
+ $('#searchcontentsinput').val("");
+ $('#current_content_tag').val($(this).attr('alt'));
+ searchCallback($("#searchcontentsinput"),"#contentslistcontainer",content_filter_url,0,0,$('#current_content_tag').val());
+ });
+ $("#no_content_tag",base_node).click(function(){
+ searchCallback($("#searchcontentsinput"),"#contentslistcontainer",content_filter_url,0,0);
+ });
+
$('.content_link_create').each(function(i){
$(this).attr("target","_blank");
});
Binary file src/ldt/ldt/static/ldt/swf/ldt/LignesDeTempsFlex.swf has changed