--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/embed_iframe.html Tue Nov 06 10:52:51 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/embed_iframe.html Thu Nov 08 17:59:14 2012 +0100
@@ -70,13 +70,15 @@
{
type: "Polemic",
annotation_type: false,
- defaultcolor: "{{polemic_defaultColor}}",
- foundcolor: "{{polemic_foundColor}}"
+ defaultcolor: "#{{ polemic_defaultColor }}",
+ foundcolor: "#{{ polemic_foundColor }}"
}
{% endif %}
{% if sparkline %}
,{
- type: "Sparkline"
+ type: "Sparkline",
+ lineColor: "#{{ sparkline_lineColor }}",
+ fillColor: "#{{ sparkline_fillColor }}",
}
{% endif %}
,{
@@ -136,6 +138,11 @@
{% if social %},{
type: "Social",
container: "Social_ext",
+ show_url: {% if show_url %}true{% else %}false{% endif %},
+ show_twitter: {% if show_twitter %}true{% else %}false{% endif %},
+ show_fb: {% if show_fb %}true{% else %}false{% endif %},
+ show_gplus: {% if show_gplus %}true{% else %}false{% endif %},
+ show_mail: {% if show_mail %}true{% else %}false{% endif %},
url: document.location.href.replace(/#.*$/,""),
text: document.title
}
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/embed_popup.html Tue Nov 06 10:52:51 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/embed_popup.html Thu Nov 08 17:59:14 2012 +0100
@@ -1,11 +1,13 @@
{% extends "ldt/ldt_utils/workspace_base.html" %}
{% load i18n %}
+{% load front_tags %}
{% load analytics %}
{% block js_import %}
{{ block.super }}
<script type="text/javascript" src="{{LDT_MEDIA_PREFIX}}js/jquery.min.js"></script>
<script type="text/javascript" src="{{LDT_MEDIA_PREFIX}}js/jquery.qtip.min.js"></script>
<script type="text/javascript" src="{{LDT_MEDIA_PREFIX}}js/embed_popup.js"></script>
+ <script type="text/javascript" src="{{LDT_MEDIA_PREFIX}}js/jscolor/jscolor.js"></script>
{{ content_form.media.js }}
{% endblock %}
@@ -38,9 +40,10 @@
{{ block.super }}
{{ content_form.media.css }}
<link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}css/style.css" />
- <link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}/css/workspace.css" type="text/css"/>
+ <link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}css/workspace.css" type="text/css"/>
<link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}css/embed_popup.css" type="text/css"/>
<link rel="stylesheet" href="{{LDT_MEDIA_PREFIX}}css/jq-css/jquery.qtip.css" type="text/css"/>
+
{% endblock %}
@@ -49,15 +52,33 @@
<div id='ldt_id_title'>{% trans 'project id' %} <span id="project_id_select">({% trans 'Select' %})</span> : <input id="project_id_input" value="{{ldt_id}}"/></div>
</div>
<a id="displayPlayer" href="javascript:toggle();">{% trans 'Show Player' %}</a>
- <div class="ldt_player" id="wrapper_{{player_id}}" style="display:none">
+ <div id="player_div" style="display:none">
+ <button type="button" id="refresh_player_button" title="Rafraichir le player" >
+ <img src="{{LDT_MEDIA_PREFIX}}img/refresh_button.jpg" id="refresh_player" ></img>
+ </button>
+ <div class="ldt_player" id="wrapper_{{player_id}}"></div>
</div>
<br>
<div id="button_row">
<div id="display_select">
- <input type="button" value="{% trans 'popup_player'%}" class="code_button" id="player_button"/><input id="seo_body_button" type="button" class="code_button" value="{% trans 'popup_seo_body' %}"/><input id="seo_meta_button" type="button" class="code_button" value="{% trans 'popup_seo_meta' %}"/><input id="links_button" type="button" class="code_button" value="{% trans 'popup_links' %}"/>
+ <input id="player_button" type="button" class="code_button" value="{% trans 'popup_player'%}"/>
+ <input id="seo_body_button" type="button" class="code_button" value="{% trans 'popup_seo_body' %}"/>
+ <input id="seo_meta_button" type="button" class="code_button" value="{% trans 'popup_seo_meta' %}"/>
+ <input id="links_button" type="button" class="code_button" value="{% trans 'popup_links' %}"/>
</div>
</div>
+
+
<div style="float: left;">
+ <div id="links_code" class="ldt_player_code">{% include "ldt/ldt_utils/partial/embed_links.html" %}</div>
+
+ <div id="seo_body_code">
+ <textarea id="seo_body_id_code" readonly="readonly" class="ldt_player_code" >{{ embed_rendered.seo_body }}</textarea>
+ </div>
+ <div id="seo_meta_code">
+ <textarea id="seo_meta_id_code" readonly="readonly" class="ldt_player_code">{{ embed_rendered.seo_meta }}</textarea>
+ </div>
+
<div id="player_code">
<div class="configuration">
<br><div id="embed_options"><br> {% trans 'Integration mode' %}
@@ -67,106 +88,123 @@
<a id="displayPreMode" class="OptionsEmbedDisplay">
<span id= "preModeExpArrow" class="expArrow"></span>
<span id= "preModeCollArrow" class="collArrow"></span>
- <span class="title">Modes predefinis</span>
+ <span class="title">{% trans 'Preset Modes' %}</span>
</a><br>
- <div id="iframe_premode">
- <input type="radio" id="mode_1" name="embed_mode" value="mode1" checked onClick="mode1()" > mode 1.1 </input><br>
- <input type="radio" id="mode_2" name="embed_mode" value="mode2" onClick="mode2()"> mode 2.1 </input><br>
- <input type="radio" id="mode_3" name="embed_mode" value="mode3" onClick="mode3()"> mode 3.1 </input><br>
+ <div id="iframe_div_premode">
+ <input type="radio" id="mode_1" name="embed_mode" value="mode1" checked onClick="mode1()" > {% trans 'basic configuration' %} </input><br>
+ <input type="radio" id="mode_2" name="embed_mode" value="mode2" onClick="mode2()"> {% trans 'polemic configuration' %} </input><br>
+ <input type="radio" id="mode_3" name="embed_mode" value="mode3" onClick="mode3()"> {% trans 'polemic configuration with slideshare and tagcloud' %} </input><br>
<br>
</div>
- <div id="div_premode">
- <input type="radio" id="mode_1" name="embed_mode" value="mode1" checked onClick="mode1()" > mode 1 </input><br>
- <input type="radio" id="mode_2" name="embed_mode" value="mode2" onClick="mode2()"> mode 2 </input><br>
- <input type="radio" id="mode_3" name="embed_mode" value="mode3" onClick="mode3()"> mode 3 </input><br>
- <br>
- </div>
+
<a id="displayEmbedOptions" class="OptionsEmbedDisplay">
<span id= "optionsExpArrow" class="expArrow"></span>
<span id= "optionsCollArrow" class="collArrow"></span>
- <span class="title">Personnaliser votre configuration</span>
+ <span class="title">{% trans 'Create your own configuration' %}</span>
</a><br>
<div id="embed_personnalisation" class="embedPersonnalisation">
<div id="createannotation_block">
- <input type="checkbox" id="createannotation_checkbox" value="createannotation" onClick="put_new_code()" > Create Annotation </input><br>
+ <input type="checkbox" id="createannotation_checkbox" value="createannotation" onClick="put_new_code(); display_createannotation();" >
+ <span class="infostooltip title" data-title="createAnnotation" data-desc="{% trans 'Displays a form to create a new annotation' %}">CreateAnnotation</span>
+ </input><br>
+ <div id="createannotation_options" style="text-indent:25px;">
+ <input type="checkbox" id="show_mic_record_checkbox" value="show_mic_record" onClick="put_new_code()" >
+ <span class="infostooltip title" data-title="Show_Mic_Record" data-desc="{% trans 'allows the user to record an annotation' %}">Show Mic Record</span>
+ </input><br>
+ </div>
</div>
- <input type="checkbox" id="segments_checkbox" value="segments" onClick="put_new_code()" > Segments </input><br>
- <input type="checkbox" id="annotations_list_checkbox" value="annotationslist" onClick="put_new_code()"> Annotationslist </input><br>
- <input type="checkbox" id="slideshare_checkbox" value="slideshare" onClick="put_new_code()"> Slideshare </input><br>
- <input type="checkbox" id="social_checkbox" value="social" onClick="put_new_code(); display_social();"> Social </input><br>
+ <input type="checkbox" id="segments_checkbox" value="segments" onClick="put_new_code()" >
+ <span class="infostooltip title" data-title="Segments" data-desc="{% trans 'Displays segments of a media as rectangles on an horizontal line' %}">Segments</span>
+ </input><br>
+ <input type="checkbox" id="annotations_list_checkbox" value="annotationslist" onClick="put_new_code()">
+ <span class="infostooltip title" data-title="Annotationlist" data-desc="{% trans 'Show a list of annotations' %}">AnnotationsList</span>
+ </input><br>
+ <div id='polemic_bloc'>
+ <input type="checkbox" id="polemic_checkbox" value="polemic" onClick="put_new_code(); display_polemic();">
+ <span class="infostooltip title" data-title="Polemic" data-desc="{% trans 'Shows the polemical timeline, i.e. tweets colored according to the polemical syntax' %}">Polemic</span>
+ </input><br>
+ <a id="displayPolemicOptions" class="AdvancedOptionsDisplay" style="margin:22px;">
+ <span class="title">{% trans "personalize tweet's color" %}</span>
+ </a>
+ <div id="polemic_options">
+ <div id="color_default_options" style="text-indent:25px;">
+ <span class="title">{% trans "default color" %} </span>
+ <input type="button" class="blockCo grey" title="Grey" onClick='set_default_color("585858")'></input>
+ <input type="button" class="blockCo orange" title="Orange" onClick='set_default_color("ff9933")'></input>
+ <input type="button" class="blockCo lime" title="Lime" onClick='set_default_color("c9ff23")'></input>
+ <input type="button" class="blockCo fuschia" title="Fuschia" onClick='set_default_color("ff0179")'></input>
+ <input type="button" class="blockCo white" title="White" onClick='set_default_color("ffffff")'></input>
+ <input id="polemic_default_color" class="codeColor_text color {hash:true,caps:false}" onchange="put_new_code();" type="text" maxlength="7"></input>
+ </div>
+ <div id="color_found_options" style="text-indent:25px;">
+ <span class="title">{% trans "found color" %}</span>
+ <input type="button" class="blockCo purple" title="Purple" data-hex="fc00ff" onClick='set_found_color("fc00ff")'></input>
+ <input type="button" class="blockCo orange" title="Orange" data-hex="ff9933" onClick='set_found_color("ff9933")'></input>
+ <input type="button" class="blockCo lime" title="Lime" data-hex="c9ff23" onClick='set_found_color("c9ff23")'></input>
+ <input type="button" class="blockCo fuschia" title="Fuschia" data-hex="ff0179" onClick='set_found_color("ff0179")'></input>
+ <input type="button" class="blockCo white" title="White" data-hex="ffffff" onClick='set_found_color("ffffff")'></input>
+ <input id="polemic_found_color" class="codeColor_text color {hash:true,caps:false}" onchange="put_new_code();" type="text" maxlength="7"></input>
+
+ </div>
+ </div>
+ </div>
+ <div>
+ <input type="checkbox" id="sparkline_checkbox" value="sparkline" onClick="put_new_code(); display_sparkline();">
+ <span class="infostooltip title" data-title="Sparkline" data-desc="{% trans 'Displays a curve showing the volume of tweets across time' %}">Sparkline</span>
+ </input><br>
+ <a id="displaySparklineOptions" class="AdvancedOptionsDisplay" style="margin:22px;">
+ <span class="title">{% trans "personalize sparkline's color" %}</span>
+ </a>
+ <div id="sparkline_options">
+ <div id="color_line_options" style="text-indent:25px;">
+ <span class="title">{% trans 'line color' %} </span>
+ <input type="button" class="blockCo blue_grey" title="Blue-Grey" data-hex="7492b4" onClick='set_line_color("7462b4")'></input>
+ <input type="button" class="blockCo orange" title="Orange" data-hex="ff9933" onClick='set_line_color("ff9933")'></input>
+ <input type="button" class="blockCo dark_lime" title="Dark-lime" data-hex="a1d600" onClick='set_line_color("a1d600")'></input>
+ <input type="button" class="blockCo fuschia" title="Fushia" data-hex="ff0179" onClick='set_line_color("ff0179")'></input>
+ <input type="button" class="blockCo black" title="Black" data-hex="050505" onClick='set_line_color("050505")'></input>
+ <input id="sparkline_line_color" class="codeColor_text color {hash:true,caps:false}" onchange='put_new_code();' type="text" maxlength="7"></input>
+ </div>
+
+ <div id="fill_color_options" style="text-indent:25px;">
+ <span class="title">{% trans 'fill color' %} </span>
+ <input type="button" class="blockCo light_grey" title="Light-Grey" data-hex="aeaeb8" onClick='set_fill_color("aeaeb8")'></input>
+ <input type="button" class="blockCo brown_orange" title="Brown_orange" data-hex="ebc8a3" onClick='set_fill_color("ebc8a3")'></input>
+ <input type="button" class="blockCo pastel_green" title="Pastel_green" data-hex="daf4af" onClick='set_fill_color("daf4af")'></input>
+ <input type="button" class="blockCo pastel_fushia" title="Pastel_fushia" data-hex="da7ba7" onClick='set_fill_color("da7ba7")'></input>
+ <input type="button" class="blockCo white" title="White" data-hex="ffffff" onClick='set_fill_color("ffffff")'></input>
+ <input id="sparkline_fill_color" class="codeColor_text color {hash:true,caps:false}" onchange='put_new_code();' type="text" maxlength="7"></input>
+ </div>
+ </div>
+ </div>
+ <input type="checkbox" id="slideshare_checkbox" value="slideshare" onClick="put_new_code()">
+ <span class="infostooltip title" data-title="Slideshare" data-desc="{% trans 'Displays a div in order to watch the slides displayed in the media' %}">Slideshare</span>
+ </input><br>
+ <div>
+ <input type="checkbox" id="social_checkbox" value="social" onClick="put_new_code(); display_social();">
+ <span class="infostooltip title" data-title="Social" data-desc="{% trans ' Adds buttons to share an URL on social networks' %}">Social</span>
+ </input><br>
<div id="social_options" style="text-indent:25px;">
<input type="checkbox" id="show_url_checkbox" value="show_url" checked onClick="put_new_code()"> Url </input>
<input type="checkbox" id="show_twitter_checkbox" value="show_twitter" checked onClick="put_new_code()"> Twitter </input>
<input type="checkbox" id="show_fb_checkbox" value="show_fb" checked onClick="put_new_code()"> Facebook </input>
<input type="checkbox" id="show_gplus_checkbox" value="show_gplus" checked onClick="put_new_code()"> Google Plus </input>
- <input type="checkbox" id="show_mail_checkbox" value="show_mail" checked onClick="put_new_code()"> Partager par email </input><br>
+ <input type="checkbox" id="show_mail_checkbox" value="show_mail" checked onClick="put_new_code()"> {% trans 'share with email' %} </input><br>
</div>
- <input type="checkbox" id="annotation_checkbox" value="annotation" onClick="put_new_code()"> Annotation </input><br>
- <input type="checkbox" id="tweet_checkbox" value="tweet" onClick="put_new_code()"> Tweet </input><br>
- <input type="checkbox" id="sparkline_checkbox" value="sparkline" onClick="put_new_code(); display_sparkline();"> Sparkline </input><br>
- <a id="displaySparklineOptions" class="AdvancedOptionsDisplay" style="margin:22px;">
- <span class="title">Personnaliser les couleurs de la courbe</span>
- </a>
- <div id="sparkline_options">
- <div id="color_line_options" style="text-indent:25px;">
- <span class="title">Couleur de la courbe : </span>
- <input type="button" class="color_block blue_grey" title="Blue-Grey" data-hex="7492b4" onClick='set_line_color("7462b4")'></input>
- <input type="button" class="color_block orange" title="Orange" data-hex="ff9933" onClick='set_line_color("ff9933")'></input>
- <input type="button" class="color_block dark_lime" title="Dark-lime" data-hex="a1d600" onClick='set_line_color("a1d600")'></input>
- <input type="button" class="color_block fuschia" title="Fushia" data-hex="ff0179" onClick='set_line_color("ff0179")'></input>
- <input type="button" class="color_block black" title="Black" data-hex="050505" onClick='set_line_color("050505")'></input>
- <input id="sparkline_line_color" class="color_text" type="text" maxlength="7"></input>
- </div>
-
- <div id="fill_color_options" style="text-indent:25px;">
- <span class="title">Couleur sous la courbe : </span>
- <input type="button" class="color_block light_grey" title="Light-Grey" data-hex="aeaeb8" onClick='set_fill_color("aeaeb8")'></input>
- <input type="button" class="color_block brown_orange" title="Brown_orange" data-hex="ebc8a3" onClick='set_fill_color("ebc8a3")'></input>
- <input type="button" class="color_block pastel_green" title="Pastel_green" data-hex="daf4af" onClick='set_fill_color("daf4af")'></input>
- <input type="button" class="color_block pastel_fushia" title="Pastel_fushia" data-hex="da7ba7" onClick='set_fill_color("da7ba7")'></input>
- <input type="button" class="color_block white" title="White" data-hex="ffffff" onClick='set_fill_color("ffffff")'></input>
- <input id="sparkline_fill_color" class="color_text" type="text" maxlength="7"></input>
- </div>
- </div>
- <div>
- <input type="checkbox" id="tagcloud_checkbox" value="tagcloud" onClick="put_new_code()"> Tagcloud </input><br>
</div>
- <div id='polemic_bloc'>
- <input type="checkbox" id="polemic_checkbox" value="polemic" onClick="put_new_code(); display_polemic();"> Polemic </input><br>
- <a id="displayPolemicOptions" class="AdvancedOptionsDisplay" style="margin:22px;">
- <span class="title">Personnaliser les couleurs des tweets</span>
- </a>
- <div id="polemic_options">
- <div id="color_default_options" style="text-indent:25px;">
- <span class="title">Couleur par default : </span>
- <input type="button" class="color_block grey" title="Grey" data-hex="585858" onClick='set_default_color("585858")'></input>
- <input type="button" class="color_block orange" title="Orange" data-hex="ff9933" onClick='set_default_color("ff9933")'></input>
- <input type="button" class="color_block lime" title="Lime" data-hex="c9ff23" onClick='set_default_color("c9ff23")'></input>
- <input type="button" class="color_block fuschia" title="Fuschia" data-hex="ff0179" onClick='set_default_color("ff0179")'></input>
- <input type="button" class="color_block white" title="White" data-hex="ffffff" onClick='set_default_color("ffffff")'></input>
- <input id="polemic_default_color" class="color_text" type="text" maxlength="7"></input>
- </div>
- <div id="color_found_options" style="text-indent:25px;">
- <span class="title">Couleur des tweets trouves : </span>
- <input type="button" class="color_block purple" title="Purple" data-hex="fc00ff" onClick='set_found_color("fc00ff")'></input>
- <input type="button" class="color_block orange" title="Orange" data-hex="ff9933" onClick='set_found_color("ff9933")'></input>
- <input type="button" class="color_block lime" title="Lime" data-hex="c9ff23" onClick='set_found_color("c9ff23")'></input>
- <input type="button" class="color_block fuschia" title="Fuschia" data-hex="ff0179" onClick='set_found_color("ff0179")'></input>
- <input type="button" class="color_block white" title="White" data-hex="ffffff" onClick='set_found_color("ffffff")'></input>
- <input id="polemic_found_color" class="color_text" type="text" maxlength="7"></input>
- </div>
- </div>
+ <input type="checkbox" id="annotation_checkbox" value="annotation" onClick="put_new_code()">
+ <span class="infostooltip title" data-title="Annotation" data-desc="{% trans ' Displays information relative to a single segment/annotation while it is being played' %}">Annotation</span>
+ </input><br>
+ <input type="checkbox" id="tweet_checkbox" value="tweet" onClick="put_new_code()">
+ <span class="infostooltip title" data-title="Tweet" data-desc="{% trans 'Show the contents on a tweet when clicked (in Polemic Widget)' %}">Tweet</span>
+ </input><br>
+ <input type="checkbox" id="tagcloud_checkbox" value="tagcloud" onClick="put_new_code()">
+ <span class="infostooltip title" data-title="Tagcloud" data-desc="{% trans 'Shows a tag cloud' %}">Tagcloud</span>
+ </input><br>
- </div>
- </div>
- <textarea id="player_id_code" readonly="readonly" class="ldt_player_code"></textarea>
+ </div>
+ <textarea id="player_id_code" readonly="readonly" class="ldt_player_code" onClick="select_code();"></textarea>
</div>
- <div id="seo_body_code"><textarea id="seo_body_id_code" readonly="readonly" class="ldt_player_code" >{{ embed_rendered.seo_body }}</textarea></div>
- <div id="seo_meta_code"><textarea id="seo_meta_id_code" readonly="readonly" class="ldt_player_code">{{ embed_rendered.seo_meta }}</textarea></div>
- </code>
- <br>
- <div id="links_code" class="ldt_player_code">{% include "ldt/ldt_utils/partial/embed_links.html" %}</div>
- </br>
</div>
{% endblock %}
--- a/src/ldt/ldt/ldt_utils/views/workspace.py Tue Nov 06 10:52:51 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/views/workspace.py Thu Nov 08 17:59:14 2012 +0100
@@ -23,6 +23,7 @@
import django.core.urlresolvers
import ldt.auth as ldt_auth
from django.utils.safestring import mark_safe
+import logging
@@ -135,6 +136,7 @@
rend_dict["polemic"] = request.GET.get("polemic")
rend_dict["polemic_defaultColor"] = request.GET.get("polemic_defaultColor")
rend_dict["polemic_foundColor"] = request.GET.get("polemic_foundColor")
+
if request.GET.has_key("show_mic_record"):
rend_dict["show_mic_record"] = {'true': True, 'false': False, "0": False, "1": True}.get(request.GET.get("show_mic_record").lower())
if request.GET.has_key("annotations_list"):
@@ -143,17 +145,29 @@
if request.GET.has_key("createannotation"):
rend_dict["createannotation"] = {'true': True, 'false': False, "0": False, "1": True}.get(request.GET.get("createannotation").lower())
if request.GET.has_key("sparkline"):
- rend_dict["sparkline"] = {'true': True, 'false': False, "0": False, "1": True}.get(request.GET.get("sparkline").lower())
+ rend_dict["sparkline"] = request.GET.get("sparkline")
+ rend_dict["sparkline_lineColor"] = request.GET.get("sparkline_lineColor")
+ rend_dict["sparkline_fillColor"] = request.GET.get("sparkline_fillColor")
if request.GET.has_key("slideshare"):
rend_dict["slideshare"] = {'true': True, 'false': False, "0": False, "1": True}.get(request.GET.get("slideshare").lower())
if request.GET.has_key("social"):
rend_dict["social"] = {'true': True, 'false': False, "0": False, "1": True}.get(request.GET.get("social").lower())
+ if request.GET.has_key("show_url"):
+ rend_dict["show_url"] = {'true': True, 'false': False, "0": False, "1": True}.get(request.GET.get("show_url").lower())
+ if request.GET.has_key("show_twitter"):
+ rend_dict["show_twitter"] = {'true': True, 'false': False, "0": False, "1": True}.get(request.GET.get("show_twitter").lower())
+ if request.GET.has_key("show_fb"):
+ rend_dict["show_fb"] = {'true': True, 'false': False, "0": False, "1": True}.get(request.GET.get("show_fb").lower())
+ if request.GET.has_key("show_gplus"):
+ rend_dict["show_gplus"] = {'true': True, 'false': False, "0": False, "1": True}.get(request.GET.get("show_gplus").lower())
+ if request.GET.has_key("show_mail"):
+ rend_dict["show_mail"] = {'true': True, 'false': False, "0": False, "1": True}.get(request.GET.get("show_mail").lower())
if request.GET.has_key("annotation"):
rend_dict["annotation"] = {'true': True, 'false': False, "0": False, "1": True}.get(request.GET.get("annotation").lower())
if request.GET.has_key("tweet"):
rend_dict["tweet"] ={'true': True, 'false': False, "0": False, "1": True}.get(request.GET.get("tweet").lower())
if request.GET.has_key("segments"):
- rend_dict["segments"] = {'true': True, 'false': False, "0": False, "1": True}.get(request.GET.get("segments").lower())
+ rend_dict["segments"] = request.GET.get("segments")
if request.GET.has_key("tagcloud"):
rend_dict["tagcloud"] = {'true': True, 'false': False, "0": False, "1": True}.get(request.GET.get("tagcloud").lower())
return render_to_response("ldt/ldt_utils/embed_iframe.html", rend_dict, context_instance=RequestContext(request))
--- a/src/ldt/ldt/locale/fr/LC_MESSAGES/django.po Tue Nov 06 10:52:51 2012 +0100
+++ b/src/ldt/ldt/locale/fr/LC_MESSAGES/django.po Thu Nov 08 17:59:14 2012 +0100
@@ -7,7 +7,7 @@
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2012-10-17 18:07+0200\n"
+"POT-Creation-Date: 2012-11-08 16:55+0100\n"
"PO-Revision-Date: 2010-03-09 15:52+0100\n"
"Last-Translator: Yves-Marie Haussonne <ymh.work@gmail.com>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -37,7 +37,7 @@
msgid "all"
msgstr "tous"
-#: .\ldt_utils\forms.py:33 .\ldt_utils\models.py:58
+#: .\ldt_utils\forms.py:33 .\ldt_utils\models.py:55
#: .\ldt_utils\templates\ldt\ldt_utils\content_list.html.py:69
msgid "title"
msgstr "titre"
@@ -62,7 +62,7 @@
msgid "Content Tag"
msgstr "Catégorie de contenu"
-#: .\ldt_utils\forms.py:52 .\ldt_utils\models.py:160
+#: .\ldt_utils\forms.py:52 .\ldt_utils\models.py:157
msgid "content.content_creation_date"
msgstr "Date de création du contenu"
@@ -94,119 +94,119 @@
msgid "content.front_project"
msgstr "Choisir le front project"
-#: .\ldt_utils\forms.py:57 .\ldt_utils\models.py:159
+#: .\ldt_utils\forms.py:57 .\ldt_utils\models.py:156
msgid "content.duration"
msgstr "Durée"
-#: .\ldt_utils\models.py:47
+#: .\ldt_utils\models.py:44
msgid "media.external_id"
msgstr "id externe"
-#: .\ldt_utils\models.py:48
+#: .\ldt_utils\models.py:45
msgid "media.external_permalink"
msgstr "permalien externe"
-#: .\ldt_utils\models.py:49
+#: .\ldt_utils\models.py:46
msgid "media.external_publication_url"
msgstr "url de publication externe"
-#: .\ldt_utils\models.py:50
+#: .\ldt_utils\models.py:47
msgid "media.external_src_url"
msgstr "url source"
-#: .\ldt_utils\models.py:51
+#: .\ldt_utils\models.py:48
msgid "media.creation_date"
msgstr "Date de création"
-#: .\ldt_utils\models.py:52
+#: .\ldt_utils\models.py:49
msgid "media.media_creation_date"
msgstr "Date de création du média"
-#: .\ldt_utils\models.py:53
+#: .\ldt_utils\models.py:50
msgid "media.update_date"
msgstr "Date de maj"
-#: .\ldt_utils\models.py:54
+#: .\ldt_utils\models.py:51
msgid "media.videopath"
msgstr "videopath"
-#: .\ldt_utils\models.py:55
+#: .\ldt_utils\models.py:52
msgid "media.duration"
msgstr "Durée du contenu (ms)"
-#: .\ldt_utils\models.py:56
+#: .\ldt_utils\models.py:53
msgid "media.creator"
msgstr "Créateur"
-#: .\ldt_utils\models.py:57
+#: .\ldt_utils\models.py:54
msgid "description"
msgstr "description"
-#: .\ldt_utils\models.py:59
+#: .\ldt_utils\models.py:56
msgid "media.src"
msgstr "Sources"
-#: .\ldt_utils\models.py:61
+#: .\ldt_utils\models.py:58
msgid "media.src_hash"
msgstr "Hash de la source"
-#: .\ldt_utils\models.py:62
+#: .\ldt_utils\models.py:59
msgid "media.mimetype"
msgstr "mimetype"
-#: .\ldt_utils\models.py:152
+#: .\ldt_utils\models.py:149
msgid "content.iri_id"
msgstr "iri id"
-#: .\ldt_utils\models.py:153
+#: .\ldt_utils\models.py:150
msgid "content.iriurl"
msgstr "iri url"
-#: .\ldt_utils\models.py:154
+#: .\ldt_utils\models.py:151
msgid "content.creation_date"
msgstr "date de création"
-#: .\ldt_utils\models.py:155
+#: .\ldt_utils\models.py:152
msgid "content.update_date"
msgstr "Date de maj"
-#: .\ldt_utils\models.py:156
+#: .\ldt_utils\models.py:153
msgid "content.title"
msgstr "titre"
-#: .\ldt_utils\models.py:157
+#: .\ldt_utils\models.py:154
msgid "content.description"
msgstr "Description"
-#: .\ldt_utils\models.py:158
+#: .\ldt_utils\models.py:155
msgid "content.authors"
msgstr "Auteurs"
-#: .\ldt_utils\models.py:526
+#: .\ldt_utils\models.py:523
msgid "content_stat.content"
msgstr "statistiques d'annotation"
-#: .\ldt_utils\models.py:527
+#: .\ldt_utils\models.py:524
msgid "content_stat.annotations_volume"
msgstr "Volume d'annotations"
-#: .\ldt_utils\models.py:528
+#: .\ldt_utils\models.py:525
msgid "content_stat.polemics_volume"
msgstr "Volume d'annotations"
-#: .\ldt_utils\models.py:529
+#: .\ldt_utils\models.py:526
msgid "content.nb_annotation"
msgstr "nombre d'annotations"
-#: .\ldt_utils\models.py:530
+#: .\ldt_utils\models.py:527
msgid "content.last_annotated"
msgstr "annoté pour la dernière foiss"
-#: .\ldt_utils\models.py:585
+#: .\ldt_utils\models.py:582
msgid "created by"
msgstr "créé par"
-#: .\ldt_utils\models.py:586
+#: .\ldt_utils\models.py:583
msgid "changed by"
msgstr "modifié par"
@@ -471,14 +471,6 @@
msgid "duration"
msgstr "durée"
-#: .\ldt_utils\templates\ldt\ldt_utils\500.html.py:6
-msgid "Error 500"
-msgstr "Erreur 500"
-
-#: .\ldt_utils\templates\ldt\ldt_utils\500.html.py:10
-msgid "Internal server error"
-msgstr "Erreur interne du serveur"
-
#: .\ldt_utils\templates\ldt\ldt_utils\content_list.html.py:55
#: .\templates\admin\page_base.html.py:19
#: .\user\templates\ldt\user\login_form.html.py:33
@@ -663,7 +655,7 @@
msgstr "Créer un nouveau projet Ligne de Temps"
#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:23
-#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:46
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:54
msgid "Show Player"
msgstr "Afficher le Lecteur métadata"
@@ -671,42 +663,135 @@
msgid "Hide Player"
msgstr "Masquer le Lecteur métadata "
-#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:43
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:52
msgid "project id"
msgstr "Identifiant du projet "
-#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:43
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:52
msgid "Select"
msgstr "Sélectionner"
-#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:51
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:64
msgid "popup_player"
msgstr "Code Lecteur métadata"
-#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:51
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:65
msgid "popup_seo_body"
msgstr "Code SEO"
-#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:51
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:66
msgid "popup_seo_meta"
msgstr "Code balise meta en-tête"
-#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:51
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:67
msgid "popup_links"
msgstr "Liste de liens"
-#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:59
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:84
msgid "Integration mode"
msgstr "Utiliser le mode d'intégration "
-#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:60
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:85
msgid "div"
msgstr "div"
-#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:61
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:86
msgid "iframe"
msgstr "iframe"
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:91
+msgid "Preset Modes"
+msgstr "Modes prédéfinis"
+
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:94
+msgid "basic configuration"
+msgstr "Confirmation de base"
+
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:95
+msgid "polemic configuration"
+msgstr "Configuration avec widget polemic"
+
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:96
+msgid "polemic configuration with slideshare and tagcloud"
+msgstr "Configuration avec widget polemic, slideshare et tagcloud"
+
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:103
+msgid "Create your own configuration"
+msgstr "Personnaliser votre configuration"
+
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:108
+msgid "Displays a form to create a new annotation"
+msgstr "Permet de créer une annotation en affichant un formulaire"
+
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:112
+msgid "allows the user to record an annotation"
+msgstr "Permet à l'utilisateur d'enregistrer une annotation à l'aide d'un micro"
+
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:117
+msgid "Displays segments of a media as rectangles on an horizontal line"
+msgstr "Affiche le chapitrage du média, en horizontal"
+
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:120
+msgid "Show a list of annotations"
+msgstr "Affiche une liste d’annotations "
+
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:124
+msgid ""
+"Shows the polemical timeline, i.e. tweets colored according to the polemical syntax"
+msgstr "Affiche la timeline polémique, c’est à dire les tweets colorés en fonction de la syntaxe polémique "
+
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:127
+msgid "personalize tweet's color"
+msgstr "Personnaliser les couleurs des tweets"
+
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:131
+msgid "default color"
+msgstr "Couleur des tweets sans annotation polémique : "
+
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:140
+msgid "found color"
+msgstr "Couleur d'affichage des tweets lors d'une recherche : "
+
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:153
+msgid "Displays a curve showing the volume of tweets across time"
+msgstr "Affiche une courbe indiquant l’évolution du volume d’annotations au cours du temps"
+
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:156
+msgid "personalize sparkline's color"
+msgstr "Personnaliser les couleurs de la courbe"
+
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:160
+msgid "line color"
+msgstr "Couleur de la courbe : "
+
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:170
+msgid "fill color"
+msgstr "Couleur sous la courbe : "
+
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:181
+msgid "Displays a div in order to watch the slides displayed in the media"
+msgstr "Permet d'afficher les slides d'un média"
+
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:185
+msgid " Adds buttons to share an URL on social networks"
+msgstr "Affiche des boutons pour partager une URL sur les réseaux sociaux"
+
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:192
+msgid "share with email"
+msgstr "Partager par email"
+
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:196
+msgid "Displays information relative to a single segment/annotation while it is being played"
+msgstr "Affiche les informations relatives à une annotation au moment où celle-ci est jouée"
+
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:199
+msgid "Show the contents on a tweet when clicked (in Polemic Widget)"
+msgstr "Affiche furtivement le contenu d’un tweet "
+
+#: .\ldt_utils\templates\ldt\ldt_utils\embed_popup.html.py:202
+msgid "Shows a tag cloud"
+msgstr "Affiche un nuage de mots-clés "
+
#: .\ldt_utils\templates\ldt\ldt_utils\error_confirm.html.py:21
#: .\ldt_utils\templates\ldt\ldt_utils\error_confirm_popup.html.py:34
#: .\ldt_utils\templates\ldt\ldt_utils\reset_confirm.html.py:22
@@ -912,22 +997,22 @@
msgid "copy project"
msgstr "Copier votre projet"
-#: .\ldt_utils\templates\ldt\ldt_utils\partial\projectslist.html.py:41
+#: .\ldt_utils\templates\ldt\ldt_utils\partial\projectslist.html.py:43
#: .\ldt_utils\templates\ldt\ldt_utils\partial\publishedprojectslist.html.py:26
msgid "link json by id"
msgstr "Ouvrir le lecteur de métadata"
-#: .\ldt_utils\templates\ldt\ldt_utils\partial\projectslist.html.py:44
+#: .\ldt_utils\templates\ldt\ldt_utils\partial\projectslist.html.py:48
msgid "Project published, click to unpublish"
msgstr "Projet publié, cliquer pour de-publier"
-#: .\ldt_utils\templates\ldt\ldt_utils\partial\projectslist.html.py:44
-#: .\ldt_utils\templates\ldt\ldt_utils\partial\projectslist.html.py:46
-#: .\ldt_utils\templates\ldt\ldt_utils\partial\projectslist.html.py:57
+#: .\ldt_utils\templates\ldt\ldt_utils\partial\projectslist.html.py:48
+#: .\ldt_utils\templates\ldt\ldt_utils\partial\projectslist.html.py:50
+#: .\ldt_utils\templates\ldt\ldt_utils\partial\projectslist.html.py:61
msgid "You are not allowed to change this project"
msgstr "vous n'avez pas l'autorisation de modifier ce projet"
-#: .\ldt_utils\templates\ldt\ldt_utils\partial\projectslist.html.py:46
+#: .\ldt_utils\templates\ldt\ldt_utils\partial\projectslist.html.py:50
msgid "Project not published, click to publish"
msgstr "Projet non publié, cliquer pour publier"
@@ -939,71 +1024,71 @@
msgid "Project published"
msgstr "Projet publié"
-#: .\ldt_utils\views\content.py:189
+#: .\ldt_utils\views\content.py:187
msgid "Problem when downloading file from url : "
msgstr "Problème lors du téléchargement du fichier : "
-#: .\ldt_utils\views\content.py:192
+#: .\ldt_utils\views\content.py:190
msgid "Problem when uploading file : "
msgstr "Problème lors de l'upload du fichier : "
-#: .\ldt_utils\views\content.py:297
+#: .\ldt_utils\views\content.py:295
msgid "Content creation failure"
msgstr "Echec lors de la creation du contenu"
-#: .\ldt_utils\views\content.py:305
+#: .\ldt_utils\views\content.py:303
msgid "Commit of the content creation failed"
msgstr "Echec lors du commit de la creation du contenu"
-#: .\ldt_utils\views\content.py:319
+#: .\ldt_utils\views\content.py:317
#, python-format
msgid "There is %(count)d error when deleting content"
msgid_plural "There are %(count)d errors when deleting content"
msgstr[0] "Il y a %(count)d erreur lors de l'effacement du contenu"
msgstr[1] "Il y a %(count)d erreurs lors de l'effacement du contenu"
-#: .\ldt_utils\views\content.py:320
+#: .\ldt_utils\views\content.py:318
msgid "title error deleting content"
msgstr "Erreur lors de l'effacement du contenu"
-#: .\ldt_utils\views\content.py:325
+#: .\ldt_utils\views\content.py:323
#, python-format
msgid "Confirm delete content %(titles)s"
msgstr "Veuillez confirmer l'effacement du contenu %(titles)s"
-#: .\ldt_utils\views\content.py:326
+#: .\ldt_utils\views\content.py:324
msgid "confirm delete content"
msgstr "Confirmation effacement contenu"
-#: .\ldt_utils\views\content.py:337
+#: .\ldt_utils\views\content.py:335
#, python-format
msgid "Please unpublish the front project %(title)s"
msgstr "Veuillez dépublier le projet : %(title)s"
-#: .\ldt_utils\views\content.py:338
+#: .\ldt_utils\views\content.py:336
msgid "The front project is published"
msgstr "Projet publié"
-#: .\ldt_utils\views\content.py:339 .\ldt_utils\views\content.py:342
+#: .\ldt_utils\views\content.py:337 .\ldt_utils\views\content.py:340
#: .\ldt_utils\views\project.py:137
msgid "confirm reset"
msgstr "Confirmer la réinitialisation"
-#: .\ldt_utils\views\content.py:341 .\ldt_utils\views\project.py:136
+#: .\ldt_utils\views\content.py:339 .\ldt_utils\views\project.py:136
#, python-format
msgid "please confirm reseting project %(title)s"
msgstr "Veuillez confirmer la réinitialisation du projet %(title)s"
-#: .\ldt_utils\views\content.py:369
+#: .\ldt_utils\views\content.py:367
msgid "An error occurred - Please try again or contact webmaster"
msgstr ""
"Une erreur est apparue - Merci de réessayer ou de contacter le webmaster"
-#: .\ldt_utils\views\content.py:370
+#: .\ldt_utils\views\content.py:368
msgid "Error"
msgstr "Erreur"
-#: .\ldt_utils\views\content.py:413
+#: .\ldt_utils\views\content.py:411
#, python-format
msgid ""
"Content '%(title)s' is referenced by this project : %(project_titles)s. "
@@ -1018,7 +1103,7 @@
"Le contenu '%(title)s' est référencé par les projets suivants : '%"
"(project_titles)s'.Veuillez les effacer préalablement."
-#: .\ldt_utils\views\content.py:416
+#: .\ldt_utils\views\content.py:414
#, python-format
msgid ""
"The project '%(project_title)s' pointing on the content '%(title)s' has "
@@ -1028,16 +1113,16 @@
"Le projet '%(project_title)s' référençant le contenu '%(title)s' comporte "
"plusieurs annotations. Voulez vous quand même supprimer le contenu ?"
-#: .\ldt_utils\views\content.py:442
+#: .\ldt_utils\views\content.py:440
msgid "Content deletion failure"
msgstr "Echec lors de la suppression du contenu"
-#: .\ldt_utils\views\content.py:452
+#: .\ldt_utils\views\content.py:450
msgid "Commit of the content deletion failed"
msgstr "Echec lors du commit de la suppression du contenu"
#: .\ldt_utils\views\json.py:40 .\ldt_utils\views\rdf.py:15
-#: .\ldt_utils\views\workspace.py:178
+#: .\ldt_utils\views\workspace.py:200
msgid "You can not access this project"
msgstr "vous n'avez pas l'autorisation d'accéder à ce projet"
@@ -1073,12 +1158,12 @@
msgid "confirm deletion"
msgstr "Confirmation d'effacement"
-#: .\ldt_utils\views\workspace.py:128
+#: .\ldt_utils\views\workspace.py:123
msgid ""
"The content does not exists or you are not allowed to access this content"
msgstr "Ce contenu n'existe pas, ou vous n'êtes pas autorisé a y acceder"
-#: .\ldt_utils\views\workspace.py:132
+#: .\ldt_utils\views\workspace.py:127
msgid "Parameters project_id or content_id must be given in the url"
msgstr "Les paramètres project_id et content_id doivent être passés dans l'URL"
@@ -1730,5 +1815,11 @@
"Nous vous avons envoyé par courriel les instructions pour activer le compte "
"à l'adresse que vous avez indiquée. Vous devriez le recevoir rapidement."
+#~ msgid "Error 500"
+#~ msgstr "Erreur 500"
+
+#~ msgid "Internal server error"
+#~ msgstr "Erreur interne du serveur"
+
#~ msgid "clik here to see the project content"
#~ msgstr "cliquer ici pour voir le contenu du projet"
--- a/src/ldt/ldt/static/ldt/css/embed_popup.css Tue Nov 06 10:52:51 2012 +0100
+++ b/src/ldt/ldt/static/ldt/css/embed_popup.css Thu Nov 08 17:59:14 2012 +0100
@@ -24,7 +24,7 @@
padding: 5px 10px;
}
-.color_text{
+.codeColor_text{
width: 46px;
text-align: center;
color: #949494;
@@ -32,7 +32,7 @@
padding: 3px;
}
-.color_block {
+.blockCo {
border: 1px solid;
display: inline-block;
height: 13px;
@@ -42,71 +42,71 @@
margin-right: 7px;
}
-.color_block.grey{
+.blockCo.grey{
background-color: #585858;
border-color: #323232;
}
-.color_block.purple {
+.blockCo.purple {
background-color: #fc00ff;
border-color: #97009a;
}
-.color_block.orange {
+.blockCo.orange {
background-color: #FF9933;
border-color: #CC6600;
}
-.color_block.lime {
+.blockCo.lime {
background-color: #C9FF23;
border-color: #8EBC00;
}
-.color_block.fuschia {
+.blockCo.fuschia {
background-color: #FF0179;
border-color: #9A0049;
}
-.color_block.white {
+.blockCo.white {
background-color: #FFFFFF;
border-color: #CCCCCC;
}
-.color_block.blue_grey{
+.blockCo.blue_grey{
background-color: #7492b4;
border-color: #4d6c8f;
}
-.color_block.black{
+.blockCo.black{
background-color: #050505;
border-color: #515151;
}
-.color_block.light_grey{
+.blockCo.light_grey{
background-color: #aeaeb8;
border-color: #858594;
}
-.color_block.brown_orange{
+.blockCo.brown_orange{
background-color: #ebc8a3;
border-color: #FF9933;
}
-.color_block.pastel_green{
+.blockCo.pastel_green{
background-color: #daf4af;
border-color: #a1d600;
}
-.color_block.pastel_fushia{
+.blockCo.pastel_fushia{
background-color: #da7ba7;
border-color: #a72f66;
}
-.color_block.dark_lime{
+.blockCo.dark_lime{
background-color: #a1d600;
border-color: #678a00;
}
Binary file src/ldt/ldt/static/ldt/img/refresh_button.jpg has changed
--- a/src/ldt/ldt/static/ldt/js/embed_popup.js Tue Nov 06 10:52:51 2012 +0100
+++ b/src/ldt/ldt/static/ldt/js/embed_popup.js Thu Nov 08 17:59:14 2012 +0100
@@ -4,7 +4,7 @@
$j.each(["player","seo_body","seo_meta","links"], function(i,display_str) {
var div_selector = "#"+display_str+"_code";
- if(display_str == display_state) {
+ if(display_str === display_state) {
$j(div_selector).show();
}
else {
@@ -16,8 +16,7 @@
function init_events(){
toggle_display();
mode1();
- $j("#iframe_premode").toggle(false);
- $j("#div_premode").toggle(false);
+ $j("#iframe_div_premode").toggle(false);
$j("#embed_personnalisation").toggle(false);
$j("#optionsExpArrow").toggle(true);
$j("#optionsCollArrow").toggle(false);
@@ -35,7 +34,7 @@
$j("#polemic_found_color").val("#fc00ff");
$j("#sparkline_line_color").val("#7492b4");
$j("#sparkline_fill_color").val("#aeaeb8");
-
+ $j("#createannotation_options").toggle(false);
$j("#project_id_select").click(function(){
$j("#project_id_input").focus();
$j("#project_id_input").select();
@@ -70,14 +69,25 @@
alert($j("#"+display_state+"_code").html());
});
+ $j("#refresh_player_button").click(function(e){
+ refresh_player();
+ });
+
+ $j("#refresh_player_button").click(function(){
+ $j("#player_id_code").focus();
+ $j("#player_id_code").select();
+ });
+
$j("#player_button").click(function(){
$j("#player_id_code").focus();
$j("#player_id_code").select();
});
$j("#seo_body_button").click(function(){
+ display_state = "seo_body";
+ toggle_display();
$j("#seo_body_id_code").focus();
- $j("#seo_body_id_code").select();
+ $j("#seo_body_id_code").select();
});
@@ -93,17 +103,9 @@
});
$j('#displayPreMode').click(function(){
- var type_embed=document.getElementById("type_embed_div");
- if(type_embed.checked){
- $j("#div_premode").slideToggle("fast");
-
- }
- else{
- $j("#iframe_premode").slideToggle("fast");
- }
- $j("#preModeExpArrow").toggle();
- $j("#preModeCollArrow").toggle();
-
+ $j("#iframe_div_premode").slideToggle("fast");
+ $j("#preModeExpArrow").toggle();
+ $j("#preModeCollArrow").toggle();
});
$j("#displayEmbedOptions").click(function(){
@@ -118,10 +120,38 @@
});
$j("#displaySparklineOptions").click(function(){
- $j("#sparkline_options").slideToggle("fast");
+ $j("#sparkline_options").slideToggle("fast");
});
+
+ $('.infostooltip').each( function () {
+ var desc = $(this).attr('data-desc');
+ if (desc == 'None') {
+ desc = '';
+ }
+ $(this).qtip({
+ content : {
+ text: '<b>' + $(this).attr('data-title') + '</b><br />' + desc
+ },
+ style: {
+ classes: 'ui-tooltip-dark ui-tooltip-rounded qtipldt'
+ },
+ border: {
+ 'width': 0,
+ 'color': '#505050'
+ },
+ position: {
+ my: 'top left',
+ at: 'bottom left'
+ }
+ });
+ });
+
}
+function select_code(){
+ $j("#player_id_code").focus();
+ $j("#player_id_code").select();
+}
function generate_base_embed_code(){
base='\
<div> \n \
@@ -147,7 +177,7 @@
format: "ldt"\n\
};\n\
var _config = {\n\
- width: "'+player_width+'",\n\
+ width: "550",\n\
container: "'+player_id+'_embed",\n\
css: "'+WEB_URL+LDT_MEDIA_PREFIX+'metadataplayer/LdtPlayer-core.css",\n\
default_options: {\n\
@@ -378,16 +408,9 @@
var code_embed=document.getElementById("player_id_code");
if(type_embed.checked){
var new_code=generate_div_code();
- if(element.style.display=="block"){
- $j(wrapper_id).html(new_code);
- }
-
}
else{
var new_code=generate_iframe_code();
- if(element.style.display=="block"){
- display_iframe_player();
- }
}
code_embed.value= new_code;
$j("#player_id_code").focus();
@@ -395,8 +418,7 @@
}
function div_event(){
- $j("#iframe_premode").toggle(false);
- $j("#div_premode").toggle(false);
+ $j("#iframe_div_premode").toggle(false);
$j("#preModeExpArrow").toggle(true);
$j("#preModeCollArrow").toggle(false);
$j("#createannotation_block").toggle(false);
@@ -406,10 +428,11 @@
function toggle() {
wrapper="wrapper_"+player_id;
wrapper_id="#"+wrapper;
+ var player_div = document.getElementById("player_div");
var element = document.getElementById(wrapper);
var text = document.getElementById("displayPlayer");
var type_embed=document.getElementById("type_embed_div");
- if(element.style.display==="none") {
+ if(player_div.style.display==="none") {
if (type_embed.checked){
var new_code=generate_div_code();
$j(wrapper_id).html(new_code);
@@ -417,12 +440,12 @@
else{
display_iframe_player();
}
- element.style.display="block";
+ player_div.style.display="block";
text.innerHTML = translate_hide;
}
else {
$j(wrapper_id).html('');
- element.style.display="none";
+ player_div.style.display="none";
text.innerHTML = translate_show;
}
}
@@ -440,6 +463,11 @@
function display_social(){
$j("#social_options").slideToggle("fast");
}
+
+function display_createannotation(){
+ $j("#createannotation_options").slideToggle("fast");
+}
+
function mode1(){
var annotationslist_val=document.getElementById('annotations_list_checkbox');
var slideshare_val=document.getElementById('slideshare_checkbox');
@@ -458,7 +486,10 @@
createannotation_val.checked=false;
}
else{
+ $j("#createannotation_options").toggle(true);
createannotation_val.checked=true;
+ var show_mic_record_val = document.getElementById('show_mic_record_checkbox');
+ show_mic_record_val.checked=false;
}
$j("#displayPolemicOptions").toggle(false);
$j("#displaySparklineOptions").toggle(false);
@@ -494,11 +525,16 @@
$j("#sparkline_options").toggle(false);
display_polemic();
display_sparkline();
+
if(type_embed.checked){
createannotation_val.checked=false;
}
else{
+ $j("#createannotation_options").toggle(true);
createannotation_val.checked=true;
+ var show_mic_record_val = document.getElementById('show_mic_record_checkbox');
+ show_mic_record_val.checked=false;
+
}
polemic_val.checked=true;
segments_val.checked=true;
@@ -536,7 +572,10 @@
createannotation_val.checked=false;
}
else{
+ $j("#createannotation_options").toggle(true);
createannotation_val.checked=true;
+ var show_mic_record_val = document.getElementById('show_mic_record_checkbox');
+ show_mic_record_val.checked=false;
}
polemic_val.checked=true;
segments_val.checked=true;
@@ -552,6 +591,7 @@
}
function iframe_event(){
$j("#createannotation_block").toggle(true);
+ $j("#createannotation_options").toggle(true);
var element = document.getElementById(wrapper);
var createannotation_val=document.getElementById('createannotation_checkbox');
createannotation_val.checked=true;
@@ -579,9 +619,21 @@
iframeUrl= iframe_url;
if(createannotation_val.checked){
iframeUrl+="&createannotation=True";
+ var show_mic_record_val = document.getElementById('show_mic_record_checkbox');
+ if(show_mic_record_val.checked){
+ iframeUrl+="&show_mic_record=True";
+ }
}
if (polemic_val.checked){
iframeUrl+="&polemic=all";
+ polemic_defaultColor=$j("#polemic_default_color").val();
+ defaultColor_code_array= polemic_defaultColor.split("#");
+ defaultColor_code=defaultColor_code_array[1];
+ polemic_foundColor=$j("#polemic_found_color").val();
+ foundColor_code_array = polemic_foundColor.split("#");
+ foundColor_code=foundColor_code_array[1];
+ iframeUrl+="&polemic_defaultColor="+defaultColor_code;
+ iframeUrl+="&polemic_foundColor="+foundColor_code;
}
else{
iframeUrl+="&polemic=False";
@@ -593,7 +645,27 @@
iframeUrl+="&slideshare=True";
}
if(social_val.checked){
+ show_url=document.getElementById("show_url_checkbox");
+ show_twitter=document.getElementById("show_twitter_checkbox");
+ show_fb=document.getElementById("show_fb_checkbox");
+ show_gplus=document.getElementById("show_gplus_checkbox");
+ show_mail=document.getElementById("show_mail_checkbox");
iframeUrl+="&social=True";
+ if(show_url.checked){
+ iframeUrl+="&show_url=True";
+ }
+ if(show_twitter.checked){
+ iframeUrl+="&show_twitter=True";
+ }
+ if(show_fb.checked){
+ iframeUrl+="&show_fb=True";
+ }
+ if(show_gplus.checked){
+ iframeUrl+="&show_gplus=True";
+ }
+ if(show_mail.checked){
+ iframeUrl+="&show_mail=True";
+ }
}
if(tweet_val.checked){
iframeUrl+="&tweet=True";
@@ -603,11 +675,18 @@
}
if(sparkline_val.checked){
iframeUrl+="&sparkline=True";
+ sparkline_lineColor=$j("#sparkline_line_color").val();
+ lineColor_code_array= sparkline_lineColor.split("#");
+ lineColor_code=lineColor_code_array[1];
+ sparkline_fillColor=$j("#sparkline_fill_color").val();
+ fillColor_code_array = sparkline_fillColor.split("#");
+ fillColor_code=fillColor_code_array[1];
+ iframeUrl+="&sparkline_lineColor="+lineColor_code;
+ iframeUrl+="&sparkline_fillColor="+fillColor_code;
}
if(tagcloud_val.checked){
iframeUrl+="&tagcloud=True";
}
- iframeUrl+= "&show_mic_record="+show_mic_record+"";
return iframeUrl;
}
@@ -616,20 +695,22 @@
var createannotation_val=document.getElementById('createannotation_checkbox');
var annotationslist_val=document.getElementById('annotations_list_checkbox');
var polemic_val=document.getElementById('polemic_checkbox');
+ var slideshare_val=document.getElementById('slideshare_checkbox');
+ var show_mic_record_val = document.getElementById('show_mic_record_checkbox');
iframeUrl=generate_iframeUrl();
player_width=570;
player_height=430;
if (createannotation_val.checked){
player_height+=281;
}
- if(annotationslist_val.checked){
+ if(annotationslist_val.checked || slideshare_val.checked){
player_width+=430;
}
if(polemic_val.checked){
player_height+=100;
}
- if(show_mic_record!='False'){
+ if(show_mic_record_val.checked){
player_height+=55;
}
@@ -642,27 +723,26 @@
var createannotation_val=document.getElementById('createannotation_checkbox');
var annotationslist_val=document.getElementById('annotations_list_checkbox');
var polemic_val=document.getElementById('polemic_checkbox');
+ var slideshare_val=document.getElementById('slideshare_checkbox');
+ var show_mic_record_val = document.getElementById('show_mic_record_checkbox');
var code_embed=document.getElementById("player_id_code");
- $j("#iframe_premode").toggle(false);
- $j("#div_premode").toggle(false);
- $j("#preModeExpArrow").toggle(true);
- $j("#preModeCollArrow").toggle(false);
wrapper = "wrapper_"+player_id;
wrapper_id = "#"+wrapper;
iframeUrl= generate_iframeUrl();
player_width=570;
player_height=430;
if (createannotation_val.checked){
- player_height+=281;
+ player_height+=300;
+ player_width+=50;
}
- if(annotationslist_val.checked){
+ if(annotationslist_val.checked || slideshare_val.checked){
player_width+=430;
}
if(polemic_val.checked){
player_height+=100;
}
- if(show_mic_record!='False'){
+ if(show_mic_record_val.checked){
player_height+=55;
}
@@ -695,3 +775,13 @@
put_new_code();
}
+function refresh_player(){
+ var type_embed=document.getElementById("type_embed_div");
+ if (type_embed.checked){
+ var new_code=generate_div_code();
+ $j(wrapper_id).html(new_code);
+ }
+ else{
+ display_iframe_player();
+ }
+}
Binary file src/ldt/ldt/static/ldt/js/jscolor/arrow.gif has changed
Binary file src/ldt/ldt/static/ldt/js/jscolor/cross.gif has changed
Binary file src/ldt/ldt/static/ldt/js/jscolor/hs.png has changed
Binary file src/ldt/ldt/static/ldt/js/jscolor/hv.png has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ldt/ldt/static/ldt/js/jscolor/jscolor.js Thu Nov 08 17:59:14 2012 +0100
@@ -0,0 +1,953 @@
+/**
+ * jscolor, JavaScript Color Picker
+ *
+ * @version 1.4.0
+ * @license GNU Lesser General Public License, http://www.gnu.org/copyleft/lesser.html
+ * @author Jan Odvarko, http://odvarko.cz
+ * @created 2008-06-15
+ * @updated 2012-07-06
+ * @link http://jscolor.com
+ */
+
+
+var jscolor = {
+
+
+ dir : '', // location of jscolor directory (leave empty to autodetect)
+ bindClass : 'color', // class name
+ binding : true, // automatic binding via <input class="...">
+ preloading : true, // use image preloading?
+
+
+ install : function() {
+ jscolor.addEvent(window, 'load', jscolor.init);
+ },
+
+
+ init : function() {
+ if(jscolor.binding) {
+ jscolor.bind();
+ }
+ if(jscolor.preloading) {
+ jscolor.preload();
+ }
+ },
+
+
+ getDir : function() {
+ if(!jscolor.dir) {
+ var detected = jscolor.detectDir();
+ jscolor.dir = detected!==false ? detected : 'jscolor/';
+ }
+ return jscolor.dir;
+ },
+
+
+ detectDir : function() {
+ var base = location.href;
+
+ var e = document.getElementsByTagName('base');
+ for(var i=0; i<e.length; i+=1) {
+ if(e[i].href) { base = e[i].href; }
+ }
+
+ var e = document.getElementsByTagName('script');
+ for(var i=0; i<e.length; i+=1) {
+ if(e[i].src && /(^|\/)jscolor\.js([?#].*)?$/i.test(e[i].src)) {
+ var src = new jscolor.URI(e[i].src);
+ var srcAbs = src.toAbsolute(base);
+ srcAbs.path = srcAbs.path.replace(/[^\/]+$/, ''); // remove filename
+ srcAbs.query = null;
+ srcAbs.fragment = null;
+ return srcAbs.toString();
+ }
+ }
+ return false;
+ },
+
+
+ bind : function() {
+ var matchClass = new RegExp('(^|\\s)('+jscolor.bindClass+')\\s*(\\{[^}]*\\})?', 'i');
+ var e = document.getElementsByTagName('input');
+ for(var i=0; i<e.length; i+=1) {
+ var m;
+ if(!e[i].color && e[i].className && (m = e[i].className.match(matchClass))) {
+ var prop = {};
+ if(m[3]) {
+ try {
+ prop = (new Function ('return (' + m[3] + ')'))();
+ } catch(eInvalidProp) {}
+ }
+ e[i].color = new jscolor.color(e[i], prop);
+ }
+ }
+ },
+
+
+ preload : function() {
+ for(var fn in jscolor.imgRequire) {
+ if(jscolor.imgRequire.hasOwnProperty(fn)) {
+ jscolor.loadImage(fn);
+ }
+ }
+ },
+
+
+ images : {
+ pad : [ 181, 101 ],
+ sld : [ 16, 101 ],
+ cross : [ 15, 15 ],
+ arrow : [ 7, 11 ]
+ },
+
+
+ imgRequire : {},
+ imgLoaded : {},
+
+
+ requireImage : function(filename) {
+ jscolor.imgRequire[filename] = true;
+ },
+
+
+ loadImage : function(filename) {
+ if(!jscolor.imgLoaded[filename]) {
+ jscolor.imgLoaded[filename] = new Image();
+ jscolor.imgLoaded[filename].src = jscolor.getDir()+filename;
+ }
+ },
+
+
+ fetchElement : function(mixed) {
+ return typeof mixed === 'string' ? document.getElementById(mixed) : mixed;
+ },
+
+
+ addEvent : function(el, evnt, func) {
+ if(el.addEventListener) {
+ el.addEventListener(evnt, func, false);
+ } else if(el.attachEvent) {
+ el.attachEvent('on'+evnt, func);
+ }
+ },
+
+
+ fireEvent : function(el, evnt) {
+ if(!el) {
+ return;
+ }
+ if(document.createEvent) {
+ var ev = document.createEvent('HTMLEvents');
+ ev.initEvent(evnt, true, true);
+ el.dispatchEvent(ev);
+ } else if(document.createEventObject) {
+ var ev = document.createEventObject();
+ el.fireEvent('on'+evnt, ev);
+ } else if(el['on'+evnt]) { // alternatively use the traditional event model (IE5)
+ el['on'+evnt]();
+ }
+ },
+
+
+ getElementPos : function(e) {
+ var e1=e, e2=e;
+ var x=0, y=0;
+ if(e1.offsetParent) {
+ do {
+ x += e1.offsetLeft;
+ y += e1.offsetTop;
+ } while(e1 = e1.offsetParent);
+ }
+ while((e2 = e2.parentNode) && e2.nodeName.toUpperCase() !== 'BODY') {
+ x -= e2.scrollLeft;
+ y -= e2.scrollTop;
+ }
+ return [x, y];
+ },
+
+
+ getElementSize : function(e) {
+ return [e.offsetWidth, e.offsetHeight];
+ },
+
+
+ getRelMousePos : function(e) {
+ var x = 0, y = 0;
+ if (!e) { e = window.event; }
+ if (typeof e.offsetX === 'number') {
+ x = e.offsetX;
+ y = e.offsetY;
+ } else if (typeof e.layerX === 'number') {
+ x = e.layerX;
+ y = e.layerY;
+ }
+ return { x: x, y: y };
+ },
+
+
+ getViewPos : function() {
+ if(typeof window.pageYOffset === 'number') {
+ return [window.pageXOffset, window.pageYOffset];
+ } else if(document.body && (document.body.scrollLeft || document.body.scrollTop)) {
+ return [document.body.scrollLeft, document.body.scrollTop];
+ } else if(document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) {
+ return [document.documentElement.scrollLeft, document.documentElement.scrollTop];
+ } else {
+ return [0, 0];
+ }
+ },
+
+
+ getViewSize : function() {
+ if(typeof window.innerWidth === 'number') {
+ return [window.innerWidth, window.innerHeight];
+ } else if(document.body && (document.body.clientWidth || document.body.clientHeight)) {
+ return [document.body.clientWidth, document.body.clientHeight];
+ } else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
+ return [document.documentElement.clientWidth, document.documentElement.clientHeight];
+ } else {
+ return [0, 0];
+ }
+ },
+
+
+ URI : function(uri) { // See RFC3986
+
+ this.scheme = null;
+ this.authority = null;
+ this.path = '';
+ this.query = null;
+ this.fragment = null;
+
+ this.parse = function(uri) {
+ var m = uri.match(/^(([A-Za-z][0-9A-Za-z+.-]*)(:))?((\/\/)([^\/?#]*))?([^?#]*)((\?)([^#]*))?((#)(.*))?/);
+ this.scheme = m[3] ? m[2] : null;
+ this.authority = m[5] ? m[6] : null;
+ this.path = m[7];
+ this.query = m[9] ? m[10] : null;
+ this.fragment = m[12] ? m[13] : null;
+ return this;
+ };
+
+ this.toString = function() {
+ var result = '';
+ if(this.scheme !== null) { result = result + this.scheme + ':'; }
+ if(this.authority !== null) { result = result + '//' + this.authority; }
+ if(this.path !== null) { result = result + this.path; }
+ if(this.query !== null) { result = result + '?' + this.query; }
+ if(this.fragment !== null) { result = result + '#' + this.fragment; }
+ return result;
+ };
+
+ this.toAbsolute = function(base) {
+ var base = new jscolor.URI(base);
+ var r = this;
+ var t = new jscolor.URI;
+
+ if(base.scheme === null) { return false; }
+
+ if(r.scheme !== null && r.scheme.toLowerCase() === base.scheme.toLowerCase()) {
+ r.scheme = null;
+ }
+
+ if(r.scheme !== null) {
+ t.scheme = r.scheme;
+ t.authority = r.authority;
+ t.path = removeDotSegments(r.path);
+ t.query = r.query;
+ } else {
+ if(r.authority !== null) {
+ t.authority = r.authority;
+ t.path = removeDotSegments(r.path);
+ t.query = r.query;
+ } else {
+ if(r.path === '') {
+ t.path = base.path;
+ if(r.query !== null) {
+ t.query = r.query;
+ } else {
+ t.query = base.query;
+ }
+ } else {
+ if(r.path.substr(0,1) === '/') {
+ t.path = removeDotSegments(r.path);
+ } else {
+ if(base.authority !== null && base.path === '') {
+ t.path = '/'+r.path;
+ } else {
+ t.path = base.path.replace(/[^\/]+$/,'')+r.path;
+ }
+ t.path = removeDotSegments(t.path);
+ }
+ t.query = r.query;
+ }
+ t.authority = base.authority;
+ }
+ t.scheme = base.scheme;
+ }
+ t.fragment = r.fragment;
+
+ return t;
+ };
+
+ function removeDotSegments(path) {
+ var out = '';
+ while(path) {
+ if(path.substr(0,3)==='../' || path.substr(0,2)==='./') {
+ path = path.replace(/^\.+/,'').substr(1);
+ } else if(path.substr(0,3)==='/./' || path==='/.') {
+ path = '/'+path.substr(3);
+ } else if(path.substr(0,4)==='/../' || path==='/..') {
+ path = '/'+path.substr(4);
+ out = out.replace(/\/?[^\/]*$/, '');
+ } else if(path==='.' || path==='..') {
+ path = '';
+ } else {
+ var rm = path.match(/^\/?[^\/]*/)[0];
+ path = path.substr(rm.length);
+ out = out + rm;
+ }
+ }
+ return out;
+ }
+
+ if(uri) {
+ this.parse(uri);
+ }
+
+ },
+
+
+ /*
+ * Usage example:
+ * var myColor = new jscolor.color(myInputElement)
+ */
+
+ color : function(target, prop) {
+
+
+ this.required = true; // refuse empty values?
+ this.adjust = true; // adjust value to uniform notation?
+ this.hash = false; // prefix color with # symbol?
+ this.caps = true; // uppercase?
+ this.slider = true; // show the value/saturation slider?
+ this.valueElement = target; // value holder
+ this.styleElement = target; // where to reflect current color
+ this.onImmediateChange = null; // onchange callback (can be either string or function)
+ this.hsv = [0, 0, 1]; // read-only 0-6, 0-1, 0-1
+ this.rgb = [1, 1, 1]; // read-only 0-1, 0-1, 0-1
+ this.minH = 0; // read-only 0-6
+ this.maxH = 6; // read-only 0-6
+ this.minS = 0; // read-only 0-1
+ this.maxS = 1; // read-only 0-1
+ this.minV = 0; // read-only 0-1
+ this.maxV = 1; // read-only 0-1
+
+ this.pickerOnfocus = true; // display picker on focus?
+ this.pickerMode = 'HSV'; // HSV | HVS
+ this.pickerPosition = 'bottom'; // left | right | top | bottom
+ this.pickerSmartPosition = true; // automatically adjust picker position when necessary
+ this.pickerButtonHeight = 20; // px
+ this.pickerClosable = false;
+ this.pickerCloseText = 'Close';
+ this.pickerButtonColor = 'ButtonText'; // px
+ this.pickerFace = 10; // px
+ this.pickerFaceColor = 'ThreeDFace'; // CSS color
+ this.pickerBorder = 1; // px
+ this.pickerBorderColor = 'ThreeDHighlight ThreeDShadow ThreeDShadow ThreeDHighlight'; // CSS color
+ this.pickerInset = 1; // px
+ this.pickerInsetColor = 'ThreeDShadow ThreeDHighlight ThreeDHighlight ThreeDShadow'; // CSS color
+ this.pickerZIndex = 10000;
+
+
+ for(var p in prop) {
+ if(prop.hasOwnProperty(p)) {
+ this[p] = prop[p];
+ }
+ }
+
+
+ this.hidePicker = function() {
+ if(isPickerOwner()) {
+ removePicker();
+ }
+ };
+
+
+ this.showPicker = function() {
+ if(!isPickerOwner()) {
+ var tp = jscolor.getElementPos(target); // target pos
+ var ts = jscolor.getElementSize(target); // target size
+ var vp = jscolor.getViewPos(); // view pos
+ var vs = jscolor.getViewSize(); // view size
+ var ps = getPickerDims(this); // picker size
+ var a, b, c;
+ switch(this.pickerPosition.toLowerCase()) {
+ case 'left': a=1; b=0; c=-1; break;
+ case 'right':a=1; b=0; c=1; break;
+ case 'top': a=0; b=1; c=-1; break;
+ default: a=0; b=1; c=1; break;
+ }
+ var l = (ts[b]+ps[b])/2;
+
+ // picker pos
+ if (!this.pickerSmartPosition) {
+ var pp = [
+ tp[a],
+ tp[b]+ts[b]-l+l*c
+ ];
+ } else {
+ var pp = [
+ -vp[a]+tp[a]+ps[a] > vs[a] ?
+ (-vp[a]+tp[a]+ts[a]/2 > vs[a]/2 && tp[a]+ts[a]-ps[a] >= 0 ? tp[a]+ts[a]-ps[a] : tp[a]) :
+ tp[a],
+ -vp[b]+tp[b]+ts[b]+ps[b]-l+l*c > vs[b] ?
+ (-vp[b]+tp[b]+ts[b]/2 > vs[b]/2 && tp[b]+ts[b]-l-l*c >= 0 ? tp[b]+ts[b]-l-l*c : tp[b]+ts[b]-l+l*c) :
+ (tp[b]+ts[b]-l+l*c >= 0 ? tp[b]+ts[b]-l+l*c : tp[b]+ts[b]-l-l*c)
+ ];
+ }
+ drawPicker(pp[a], pp[b]);
+ }
+ };
+
+
+ this.importColor = function() {
+ if(!valueElement) {
+ this.exportColor();
+ } else {
+ if(!this.adjust) {
+ if(!this.fromString(valueElement.value, leaveValue)) {
+ styleElement.style.backgroundImage = styleElement.jscStyle.backgroundImage;
+ styleElement.style.backgroundColor = styleElement.jscStyle.backgroundColor;
+ styleElement.style.color = styleElement.jscStyle.color;
+ this.exportColor(leaveValue | leaveStyle);
+ }
+ } else if(!this.required && /^\s*$/.test(valueElement.value)) {
+ valueElement.value = '';
+ styleElement.style.backgroundImage = styleElement.jscStyle.backgroundImage;
+ styleElement.style.backgroundColor = styleElement.jscStyle.backgroundColor;
+ styleElement.style.color = styleElement.jscStyle.color;
+ this.exportColor(leaveValue | leaveStyle);
+
+ } else if(this.fromString(valueElement.value)) {
+ // OK
+ } else {
+ this.exportColor();
+ }
+ }
+ };
+
+
+ this.exportColor = function(flags) {
+ if(!(flags & leaveValue) && valueElement) {
+ var value = this.toString();
+ if(this.caps) { value = value.toUpperCase(); }
+ if(this.hash) { value = '#'+value; }
+ valueElement.value = value;
+ }
+ if(!(flags & leaveStyle) && styleElement) {
+ styleElement.style.backgroundImage = "none";
+ styleElement.style.backgroundColor =
+ '#'+this.toString();
+ styleElement.style.color =
+ 0.213 * this.rgb[0] +
+ 0.715 * this.rgb[1] +
+ 0.072 * this.rgb[2]
+ < 0.5 ? '#FFF' : '#000';
+ }
+ if(!(flags & leavePad) && isPickerOwner()) {
+ redrawPad();
+ }
+ if(!(flags & leaveSld) && isPickerOwner()) {
+ redrawSld();
+ }
+ };
+
+
+ this.fromHSV = function(h, s, v, flags) { // null = don't change
+ if(h !== null) { h = Math.max(0.0, this.minH, Math.min(6.0, this.maxH, h)); }
+ if(s !== null) { s = Math.max(0.0, this.minS, Math.min(1.0, this.maxS, s)); }
+ if(v !== null) { v = Math.max(0.0, this.minV, Math.min(1.0, this.maxV, v)); }
+
+ this.rgb = HSV_RGB(
+ h===null ? this.hsv[0] : (this.hsv[0]=h),
+ s===null ? this.hsv[1] : (this.hsv[1]=s),
+ v===null ? this.hsv[2] : (this.hsv[2]=v)
+ );
+
+ this.exportColor(flags);
+ };
+
+
+ this.fromRGB = function(r, g, b, flags) { // null = don't change
+ if(r !== null) { r = Math.max(0.0, Math.min(1.0, r)); }
+ if(g !== null) { g = Math.max(0.0, Math.min(1.0, g)); }
+ if(b !== null) { b = Math.max(0.0, Math.min(1.0, b)); }
+
+ var hsv = RGB_HSV(
+ r===null ? this.rgb[0] : r,
+ g===null ? this.rgb[1] : g,
+ b===null ? this.rgb[2] : b
+ );
+ if(hsv[0] !== null) {
+ this.hsv[0] = Math.max(0.0, this.minH, Math.min(6.0, this.maxH, hsv[0]));
+ }
+ if(hsv[2] !== 0) {
+ this.hsv[1] = hsv[1]===null ? null : Math.max(0.0, this.minS, Math.min(1.0, this.maxS, hsv[1]));
+ }
+ this.hsv[2] = hsv[2]===null ? null : Math.max(0.0, this.minV, Math.min(1.0, this.maxV, hsv[2]));
+
+ // update RGB according to final HSV, as some values might be trimmed
+ var rgb = HSV_RGB(this.hsv[0], this.hsv[1], this.hsv[2]);
+ this.rgb[0] = rgb[0];
+ this.rgb[1] = rgb[1];
+ this.rgb[2] = rgb[2];
+
+ this.exportColor(flags);
+ };
+
+
+ this.fromString = function(hex, flags) {
+ var m = hex.match(/^\W*([0-9A-F]{3}([0-9A-F]{3})?)\W*$/i);
+ if(!m) {
+ return false;
+ } else {
+ if(m[1].length === 6) { // 6-char notation
+ this.fromRGB(
+ parseInt(m[1].substr(0,2),16) / 255,
+ parseInt(m[1].substr(2,2),16) / 255,
+ parseInt(m[1].substr(4,2),16) / 255,
+ flags
+ );
+ } else { // 3-char notation
+ this.fromRGB(
+ parseInt(m[1].charAt(0)+m[1].charAt(0),16) / 255,
+ parseInt(m[1].charAt(1)+m[1].charAt(1),16) / 255,
+ parseInt(m[1].charAt(2)+m[1].charAt(2),16) / 255,
+ flags
+ );
+ }
+ return true;
+ }
+ };
+
+
+ this.toString = function() {
+ return (
+ (0x100 | Math.round(255*this.rgb[0])).toString(16).substr(1) +
+ (0x100 | Math.round(255*this.rgb[1])).toString(16).substr(1) +
+ (0x100 | Math.round(255*this.rgb[2])).toString(16).substr(1)
+ );
+ };
+
+
+ function RGB_HSV(r, g, b) {
+ var n = Math.min(Math.min(r,g),b);
+ var v = Math.max(Math.max(r,g),b);
+ var m = v - n;
+ if(m === 0) { return [ null, 0, v ]; }
+ var h = r===n ? 3+(b-g)/m : (g===n ? 5+(r-b)/m : 1+(g-r)/m);
+ return [ h===6?0:h, m/v, v ];
+ }
+
+
+ function HSV_RGB(h, s, v) {
+ if(h === null) { return [ v, v, v ]; }
+ var i = Math.floor(h);
+ var f = i%2 ? h-i : 1-(h-i);
+ var m = v * (1 - s);
+ var n = v * (1 - s*f);
+ switch(i) {
+ case 6:
+ case 0: return [v,n,m];
+ case 1: return [n,v,m];
+ case 2: return [m,v,n];
+ case 3: return [m,n,v];
+ case 4: return [n,m,v];
+ case 5: return [v,m,n];
+ }
+ }
+
+
+ function removePicker() {
+ delete jscolor.picker.owner;
+ document.getElementsByTagName('body')[0].removeChild(jscolor.picker.boxB);
+ }
+
+
+ function drawPicker(x, y) {
+ if(!jscolor.picker) {
+ jscolor.picker = {
+ box : document.createElement('div'),
+ boxB : document.createElement('div'),
+ pad : document.createElement('div'),
+ padB : document.createElement('div'),
+ padM : document.createElement('div'),
+ sld : document.createElement('div'),
+ sldB : document.createElement('div'),
+ sldM : document.createElement('div'),
+ btn : document.createElement('div'),
+ btnS : document.createElement('span'),
+ btnT : document.createTextNode(THIS.pickerCloseText)
+ };
+ for(var i=0,segSize=4; i<jscolor.images.sld[1]; i+=segSize) {
+ var seg = document.createElement('div');
+ seg.style.height = segSize+'px';
+ seg.style.fontSize = '1px';
+ seg.style.lineHeight = '0';
+ jscolor.picker.sld.appendChild(seg);
+ }
+ jscolor.picker.sldB.appendChild(jscolor.picker.sld);
+ jscolor.picker.box.appendChild(jscolor.picker.sldB);
+ jscolor.picker.box.appendChild(jscolor.picker.sldM);
+ jscolor.picker.padB.appendChild(jscolor.picker.pad);
+ jscolor.picker.box.appendChild(jscolor.picker.padB);
+ jscolor.picker.box.appendChild(jscolor.picker.padM);
+ jscolor.picker.btnS.appendChild(jscolor.picker.btnT);
+ jscolor.picker.btn.appendChild(jscolor.picker.btnS);
+ jscolor.picker.box.appendChild(jscolor.picker.btn);
+ jscolor.picker.boxB.appendChild(jscolor.picker.box);
+ }
+
+ var p = jscolor.picker;
+
+ // controls interaction
+ p.box.onmouseup =
+ p.box.onmouseout = function() { target.focus(); };
+ p.box.onmousedown = function() { abortBlur=true; };
+ p.box.onmousemove = function(e) {
+ if (holdPad || holdSld) {
+ holdPad && setPad(e);
+ holdSld && setSld(e);
+ if (document.selection) {
+ document.selection.empty();
+ } else if (window.getSelection) {
+ window.getSelection().removeAllRanges();
+ }
+ dispatchImmediateChange();
+ }
+ };
+ p.padM.onmouseup =
+ p.padM.onmouseout = function() { if(holdPad) { holdPad=false; jscolor.fireEvent(valueElement,'change'); } };
+ p.padM.onmousedown = function(e) {
+ // if the slider is at the bottom, move it up
+ switch(modeID) {
+ case 0: if (THIS.hsv[2] === 0) { THIS.fromHSV(null, null, 1.0); }; break;
+ case 1: if (THIS.hsv[1] === 0) { THIS.fromHSV(null, 1.0, null); }; break;
+ }
+ holdPad=true;
+ setPad(e);
+ dispatchImmediateChange();
+ };
+ p.sldM.onmouseup =
+ p.sldM.onmouseout = function() { if(holdSld) { holdSld=false; jscolor.fireEvent(valueElement,'change'); } };
+ p.sldM.onmousedown = function(e) {
+ holdSld=true;
+ setSld(e);
+ dispatchImmediateChange();
+ };
+
+ // picker
+ var dims = getPickerDims(THIS);
+ p.box.style.width = dims[0] + 'px';
+ p.box.style.height = dims[1] + 'px';
+
+ // picker border
+ p.boxB.style.position = 'absolute';
+ p.boxB.style.clear = 'both';
+ p.boxB.style.left = x+'px';
+ p.boxB.style.top = y+'px';
+ p.boxB.style.zIndex = THIS.pickerZIndex;
+ p.boxB.style.border = THIS.pickerBorder+'px solid';
+ p.boxB.style.borderColor = THIS.pickerBorderColor;
+ p.boxB.style.background = THIS.pickerFaceColor;
+
+ // pad image
+ p.pad.style.width = jscolor.images.pad[0]+'px';
+ p.pad.style.height = jscolor.images.pad[1]+'px';
+
+ // pad border
+ p.padB.style.position = 'absolute';
+ p.padB.style.left = THIS.pickerFace+'px';
+ p.padB.style.top = THIS.pickerFace+'px';
+ p.padB.style.border = THIS.pickerInset+'px solid';
+ p.padB.style.borderColor = THIS.pickerInsetColor;
+
+ // pad mouse area
+ p.padM.style.position = 'absolute';
+ p.padM.style.left = '0';
+ p.padM.style.top = '0';
+ p.padM.style.width = THIS.pickerFace + 2*THIS.pickerInset + jscolor.images.pad[0] + jscolor.images.arrow[0] + 'px';
+ p.padM.style.height = p.box.style.height;
+ p.padM.style.cursor = 'crosshair';
+
+ // slider image
+ p.sld.style.overflow = 'hidden';
+ p.sld.style.width = jscolor.images.sld[0]+'px';
+ p.sld.style.height = jscolor.images.sld[1]+'px';
+
+ // slider border
+ p.sldB.style.display = THIS.slider ? 'block' : 'none';
+ p.sldB.style.position = 'absolute';
+ p.sldB.style.right = THIS.pickerFace+'px';
+ p.sldB.style.top = THIS.pickerFace+'px';
+ p.sldB.style.border = THIS.pickerInset+'px solid';
+ p.sldB.style.borderColor = THIS.pickerInsetColor;
+
+ // slider mouse area
+ p.sldM.style.display = THIS.slider ? 'block' : 'none';
+ p.sldM.style.position = 'absolute';
+ p.sldM.style.right = '0';
+ p.sldM.style.top = '0';
+ p.sldM.style.width = jscolor.images.sld[0] + jscolor.images.arrow[0] + THIS.pickerFace + 2*THIS.pickerInset + 'px';
+ p.sldM.style.height = p.box.style.height;
+ try {
+ p.sldM.style.cursor = 'pointer';
+ } catch(eOldIE) {
+ p.sldM.style.cursor = 'hand';
+ }
+
+ // "close" button
+ function setBtnBorder() {
+ var insetColors = THIS.pickerInsetColor.split(/\s+/);
+ var pickerOutsetColor = insetColors.length < 2 ? insetColors[0] : insetColors[1] + ' ' + insetColors[0] + ' ' + insetColors[0] + ' ' + insetColors[1];
+ p.btn.style.borderColor = pickerOutsetColor;
+ }
+ p.btn.style.display = THIS.pickerClosable ? 'block' : 'none';
+ p.btn.style.position = 'absolute';
+ p.btn.style.left = THIS.pickerFace + 'px';
+ p.btn.style.bottom = THIS.pickerFace + 'px';
+ p.btn.style.padding = '0 15px';
+ p.btn.style.height = '18px';
+ p.btn.style.border = THIS.pickerInset + 'px solid';
+ setBtnBorder();
+ p.btn.style.color = THIS.pickerButtonColor;
+ p.btn.style.font = '12px sans-serif';
+ p.btn.style.textAlign = 'center';
+ try {
+ p.btn.style.cursor = 'pointer';
+ } catch(eOldIE) {
+ p.btn.style.cursor = 'hand';
+ }
+ p.btn.onmousedown = function () {
+ THIS.hidePicker();
+ };
+ p.btnS.style.lineHeight = p.btn.style.height;
+
+ // load images in optimal order
+ switch(modeID) {
+ case 0: var padImg = 'hs.png'; break;
+ case 1: var padImg = 'hv.png'; break;
+ }
+ p.padM.style.backgroundImage = "url('"+jscolor.getDir()+"cross.gif')";
+ p.padM.style.backgroundRepeat = "no-repeat";
+ p.sldM.style.backgroundImage = "url('"+jscolor.getDir()+"arrow.gif')";
+ p.sldM.style.backgroundRepeat = "no-repeat";
+ p.pad.style.backgroundImage = "url('"+jscolor.getDir()+padImg+"')";
+ p.pad.style.backgroundRepeat = "no-repeat";
+ p.pad.style.backgroundPosition = "0 0";
+
+ // place pointers
+ redrawPad();
+ redrawSld();
+
+ jscolor.picker.owner = THIS;
+ document.getElementsByTagName('body')[0].appendChild(p.boxB);
+ }
+
+
+ function getPickerDims(o) {
+ var dims = [
+ 2*o.pickerInset + 2*o.pickerFace + jscolor.images.pad[0] +
+ (o.slider ? 2*o.pickerInset + 2*jscolor.images.arrow[0] + jscolor.images.sld[0] : 0),
+ o.pickerClosable ?
+ 4*o.pickerInset + 3*o.pickerFace + jscolor.images.pad[1] + o.pickerButtonHeight :
+ 2*o.pickerInset + 2*o.pickerFace + jscolor.images.pad[1]
+ ];
+ return dims;
+ }
+
+
+ function redrawPad() {
+ // redraw the pad pointer
+ switch(modeID) {
+ case 0: var yComponent = 1; break;
+ case 1: var yComponent = 2; break;
+ }
+ var x = Math.round((THIS.hsv[0]/6) * (jscolor.images.pad[0]-1));
+ var y = Math.round((1-THIS.hsv[yComponent]) * (jscolor.images.pad[1]-1));
+ jscolor.picker.padM.style.backgroundPosition =
+ (THIS.pickerFace+THIS.pickerInset+x - Math.floor(jscolor.images.cross[0]/2)) + 'px ' +
+ (THIS.pickerFace+THIS.pickerInset+y - Math.floor(jscolor.images.cross[1]/2)) + 'px';
+
+ // redraw the slider image
+ var seg = jscolor.picker.sld.childNodes;
+
+ switch(modeID) {
+ case 0:
+ var rgb = HSV_RGB(THIS.hsv[0], THIS.hsv[1], 1);
+ for(var i=0; i<seg.length; i+=1) {
+ seg[i].style.backgroundColor = 'rgb('+
+ (rgb[0]*(1-i/seg.length)*100)+'%,'+
+ (rgb[1]*(1-i/seg.length)*100)+'%,'+
+ (rgb[2]*(1-i/seg.length)*100)+'%)';
+ }
+ break;
+ case 1:
+ var rgb, s, c = [ THIS.hsv[2], 0, 0 ];
+ var i = Math.floor(THIS.hsv[0]);
+ var f = i%2 ? THIS.hsv[0]-i : 1-(THIS.hsv[0]-i);
+ switch(i) {
+ case 6:
+ case 0: rgb=[0,1,2]; break;
+ case 1: rgb=[1,0,2]; break;
+ case 2: rgb=[2,0,1]; break;
+ case 3: rgb=[2,1,0]; break;
+ case 4: rgb=[1,2,0]; break;
+ case 5: rgb=[0,2,1]; break;
+ }
+ for(var i=0; i<seg.length; i+=1) {
+ s = 1 - 1/(seg.length-1)*i;
+ c[1] = c[0] * (1 - s*f);
+ c[2] = c[0] * (1 - s);
+ seg[i].style.backgroundColor = 'rgb('+
+ (c[rgb[0]]*100)+'%,'+
+ (c[rgb[1]]*100)+'%,'+
+ (c[rgb[2]]*100)+'%)';
+ }
+ break;
+ }
+ }
+
+
+ function redrawSld() {
+ // redraw the slider pointer
+ switch(modeID) {
+ case 0: var yComponent = 2; break;
+ case 1: var yComponent = 1; break;
+ }
+ var y = Math.round((1-THIS.hsv[yComponent]) * (jscolor.images.sld[1]-1));
+ jscolor.picker.sldM.style.backgroundPosition =
+ '0 ' + (THIS.pickerFace+THIS.pickerInset+y - Math.floor(jscolor.images.arrow[1]/2)) + 'px';
+ }
+
+
+ function isPickerOwner() {
+ return jscolor.picker && jscolor.picker.owner === THIS;
+ }
+
+
+ function blurTarget() {
+ if(valueElement === target) {
+ THIS.importColor();
+ }
+ if(THIS.pickerOnfocus) {
+ THIS.hidePicker();
+ }
+ }
+
+
+ function blurValue() {
+ if(valueElement !== target) {
+ THIS.importColor();
+ }
+ }
+
+
+ function setPad(e) {
+ var mpos = jscolor.getRelMousePos(e);
+ var x = mpos.x - THIS.pickerFace - THIS.pickerInset;
+ var y = mpos.y - THIS.pickerFace - THIS.pickerInset;
+ switch(modeID) {
+ case 0: THIS.fromHSV(x*(6/(jscolor.images.pad[0]-1)), 1 - y/(jscolor.images.pad[1]-1), null, leaveSld); break;
+ case 1: THIS.fromHSV(x*(6/(jscolor.images.pad[0]-1)), null, 1 - y/(jscolor.images.pad[1]-1), leaveSld); break;
+ }
+ }
+
+
+ function setSld(e) {
+ var mpos = jscolor.getRelMousePos(e);
+ var y = mpos.y - THIS.pickerFace - THIS.pickerInset;
+ switch(modeID) {
+ case 0: THIS.fromHSV(null, null, 1 - y/(jscolor.images.sld[1]-1), leavePad); break;
+ case 1: THIS.fromHSV(null, 1 - y/(jscolor.images.sld[1]-1), null, leavePad); break;
+ }
+ }
+
+
+ function dispatchImmediateChange() {
+ if (THIS.onImmediateChange) {
+ var callback;
+ if (typeof THIS.onImmediateChange === 'string') {
+ callback = new Function (THIS.onImmediateChange);
+ } else {
+ callback = THIS.onImmediateChange;
+ }
+ callback.call(THIS);
+ }
+ }
+
+
+ var THIS = this;
+ var modeID = this.pickerMode.toLowerCase()==='hvs' ? 1 : 0;
+ var abortBlur = false;
+ var
+ valueElement = jscolor.fetchElement(this.valueElement),
+ styleElement = jscolor.fetchElement(this.styleElement);
+ var
+ holdPad = false,
+ holdSld = false;
+ var
+ leaveValue = 1<<0,
+ leaveStyle = 1<<1,
+ leavePad = 1<<2,
+ leaveSld = 1<<3;
+
+ // target
+ jscolor.addEvent(target, 'focus', function() {
+ if(THIS.pickerOnfocus) { THIS.showPicker(); }
+ });
+ jscolor.addEvent(target, 'blur', function() {
+ if(!abortBlur) {
+ window.setTimeout(function(){ abortBlur || blurTarget(); abortBlur=false; }, 0);
+ } else {
+ abortBlur = false;
+ }
+ });
+
+ // valueElement
+ if(valueElement) {
+ var updateField = function() {
+ THIS.fromString(valueElement.value, leaveValue);
+ dispatchImmediateChange();
+ };
+ jscolor.addEvent(valueElement, 'keyup', updateField);
+ jscolor.addEvent(valueElement, 'input', updateField);
+ jscolor.addEvent(valueElement, 'blur', blurValue);
+ valueElement.setAttribute('autocomplete', 'off');
+ }
+
+ // styleElement
+ if(styleElement) {
+ styleElement.jscStyle = {
+ backgroundImage : styleElement.style.backgroundImage,
+ backgroundColor : styleElement.style.backgroundColor,
+ color : styleElement.style.color
+ };
+ }
+
+ // require images
+ switch(modeID) {
+ case 0: jscolor.requireImage('hs.png'); break;
+ case 1: jscolor.requireImage('hv.png'); break;
+ }
+ jscolor.requireImage('cross.gif');
+ jscolor.requireImage('arrow.gif');
+
+ this.importColor();
+ }
+
+};
+
+
+jscolor.install();