Merge with 05f2b7c3ea04156213e02cd9045ca5ff291813d1
authorcavaliet
Wed, 18 Jul 2012 15:08:02 +0200
changeset 703 049491bfcd29
parent 702 d50cb79f96ee (current diff)
parent 701 05f2b7c3ea04 (diff)
child 704 99286ab16161
Merge with 05f2b7c3ea04156213e02cd9045ca5ff291813d1
src/ldt/ldt/ldt_utils/templates/front/front_all_contents.html
--- a/src/ldt/ldt/ldt_utils/templates/front/front_all_contents.html	Wed Jul 18 15:04:46 2012 +0200
+++ b/src/ldt/ldt/ldt_utils/templates/front/front_all_contents.html	Wed Jul 18 15:08:02 2012 +0200
@@ -13,8 +13,8 @@
 
 {% block js_import %}
 {{block.super}}
-<script src="{{LDT_MEDIA_PREFIX}}js/raphael.js" type="text/javascript"/></script>
-<script src="{{LDT_MEDIA_PREFIX}}js/Ldt_front_sparkline.js" type="text/javascript"/></script>
+<script src="{{LDT_MEDIA_PREFIX}}js/raphael.js" type="text/javascript"></script>
+<script src="{{LDT_MEDIA_PREFIX}}js/Ldt_front_sparkline.js" type="text/javascript"></script>
 {% endblock %}
 
 {% block css_import %}
--- a/src/ldt/ldt/ldt_utils/templates/front/front_player.html	Wed Jul 18 15:04:46 2012 +0200
+++ b/src/ldt/ldt/ldt_utils/templates/front/front_player.html	Wed Jul 18 15:08:02 2012 +0200
@@ -12,25 +12,8 @@
 {% endblock %}
 
 {% block js_declaration %}
-<script type="text/javascript" src="{{LDT_MEDIA_PREFIX}}js/jquery.qtip.min.js"></script>
 <script type="text/javascript">
     var $j = jQuery.noConflict();
-</script>
-<script type="text/javascript" src="{{LDT_MEDIA_PREFIX}}js/embed_popup.js"></script>
-<script type="text/javascript" src="{{LDT_MEDIA_PREFIX}}js/ZeroClipboard.js"></script>
-<script type="text/javascript">
-    $j(document).ready(function(){
-        ZeroClipboard.setMoviePath( '{{WEB_URL}}{{LDT_MEDIA_PREFIX}}swf/ZeroClipboard10.swf' );
-        clip = new ZeroClipboard.Client();
-        $j("#clipboard_button").html(clip.getHTML(32,32));
-        clip.setHandCursor(true);
-        clip.setText('{{ldt_id}}');
-        $j("#clipboard_button").qtip({
-            style: {
-                classes: 'ui-tooltip-dark ui-tooltip-rounded qtipldt'
-            }
-        });
-    });
     $j(document).ready(function () {          
         $j("#id_search").bind('hastext', function () {
             $j("#search_submit").addClass('search_valid').removeClass('search_invalid');
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html	Wed Jul 18 15:04:46 2012 +0200
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html	Wed Jul 18 15:08:02 2012 +0200
@@ -9,6 +9,7 @@
   
 IriSP.libFiles.defaultDir = "{{WEB_URL}}{{LDT_MEDIA_PREFIX}}js/";
 IriSP.libFiles.locations.jwPlayerSWF = "{{WEB_URL}}{{LDT_MEDIA_PREFIX}}swf/player.swf";
+IriSP.libFiles.locations.zeroClipboardSwf = "{{WEB_URL}}{{LDT_MEDIA_PREFIX}}swf/ZeroClipboard10.swf";
 IriSP.libFiles.locations.cssjQueryUI = "{{WEB_URL}}{{LDT_MEDIA_PREFIX}}css/jq-css/themes/base/jquery-ui.css"
 IriSP.language = '{{LANGUAGE_CODE}}';
 
--- a/src/ldt/ldt/static/ldt/metadataplayer/Annotation.js	Wed Jul 18 15:04:46 2012 +0200
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Annotation.js	Wed Jul 18 15:08:02 2012 +0200
@@ -132,6 +132,13 @@
     }
     if (typeof this.socialWidget !== "undefined") {
         this.socialWidget.updateUrls(_url, _text);
+    } else {
+        var _this = this;
+        setTimeout(function() {
+            if (typeof _this.socialWidget !== "undefined") {
+                _this.socialWidget.updateUrls(_url, _text);
+            }
+        },800);
     }
     this.$.find(".Ldt-Annotation-Inner").removeClass("Ldt-Annotation-Empty");
 }
--- a/src/ldt/ldt/static/ldt/metadataplayer/LdtPlayer-core.js	Wed Jul 18 15:04:46 2012 +0200
+++ b/src/ldt/ldt/static/ldt/metadataplayer/LdtPlayer-core.js	Wed Jul 18 15:08:02 2012 +0200
@@ -97,13 +97,15 @@
     /* widget specific requirements */
     for(var _i = 0; _i < this.config.gui.widgets.length; _i++) {
         var _t = this.config.gui.widgets[_i].type;
-        if (typeof IriSP.widgetsRequirements[_t] !== "undefined" && typeof IriSP.widgetsRequirements[_t].requires !== "undefined") {
-            $L.script(IriSP.getLib(IriSP.widgetsRequirements[_t].requires));
+        if (typeof IriSP.widgetsRequirements[_t] !== "undefined" && typeof IriSP.widgetsRequirements[_t].requires !== "undefined" ) {
+            for (var _j = 0; _j < IriSP.widgetsRequirements[_t].requires.length; _j++) {
+                $L.script(IriSP.getLib(IriSP.widgetsRequirements[_t].requires[_j]));
+            }
         }
     }
     
     var _this = this;
-    IriSP.log($L);
+    
     $L.wait(function() {
         _this.onLibsLoaded();
     });
@@ -1392,7 +1394,9 @@
         raphael : "raphael-min.js",
         tracemanager : "tracemanager.js",
         jwPlayerSWF : "player.swf",
-        json : "json2.js"
+        json : "json2.js",
+        zeroClipboardJs: "ZeroClipboard.js",
+        zeroClipboardSwf: "ZeroClipboard.swf"
     },
     locations : {
         // use to define locations outside defautl_dir
@@ -1410,22 +1414,25 @@
 IriSP.widgetsRequirements = {
     Sparkline: {
         noCss: true,
-        requires: "raphael"
+        requires: [ "raphael" ]
     },
     Arrow: {
         noCss: true,
-        requires: "raphael"
+        requires: [ "raphael" ]
     },
     Mediafragment: {
         noCss: true
     },
     Trace : {
         noCss: true,
-        requires: "tracemanager"
+        requires: [ "tracemanager" ]
     },
     SlideShare: {
-        requires: "swfObject"
-    } 
+        requires: [ "swfObject" ]
+    },
+    Social: {
+        requires: [ "zeroClipboardJs" ]
+    }
 }
 
 IriSP.guiDefaults = {
@@ -1545,14 +1552,23 @@
 
 IriSP.Widgets.Widget.prototype.insertSubwidget = function(_selector, _propname, _widgetoptions) {
     var _id = _selector.attr("id"),
-        _this = this;
+        _this = this,
+        _type = _widgetoptions.type,
+        $L = $LAB;
     if (typeof _id == "undefined") {
         _id = IriSP._.uniqueId(this.container + '_sub_widget_' + _widgetoptions.type);
         _selector.attr("id", _id);
     }
     _widgetoptions.container = _id;
-    _this.player.loadWidget(_widgetoptions, function(_widget) {
-        _this[_propname] = _widget;
+    if (typeof IriSP.widgetsRequirements[_type] !== "undefined" && typeof IriSP.widgetsRequirements[_type].requires !== "undefined" ) {
+        for (var _j = 0; _j < IriSP.widgetsRequirements[_type].requires.length; _j++) {
+            $L.script(IriSP.getLib(IriSP.widgetsRequirements[_type].requires[_j]));
+        }
+    }
+    $L.wait(function() {
+        _this.player.loadWidget(_widgetoptions, function(_widget) {
+            _this[_propname] = _widget;
+        });
     });
 }
 
--- a/src/ldt/ldt/static/ldt/metadataplayer/Social.css	Wed Jul 18 15:04:46 2012 +0200
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Social.css	Wed Jul 18 15:08:02 2012 +0200
@@ -2,6 +2,49 @@
     display: inline-block; width: 24px; height: 24px; margin: 2px 0 0 2px; background: url(img/socialbuttons.png);
 }
 
+.Ldt-Social-Url-Container {
+    display: inline-block; width: 24px; height: 24px; margin: 2px 0 0 2px; position: relative;
+}
+
+a.Ldt-Social-Url {
+    margin: 0; background-position: -96px 0;
+}
+
+a.Ldt-Social-Url:hover {
+    background-position: -96px -24px;
+}
+
+.Ldt-Social-UrlPop {
+    position: absolute; left: 20px; top: -2px; background: url(img/socialcopy.png);
+    padding: 3px 0 0 12px; width: 218px; height: 27px;
+    display: none;
+}
+
+.Ldt-Social-Input, .Ldt-Social-CopyBtn {
+    font-size: 11px; margin: 1px; border: 1px solid #ccc; height: 16px;
+    padding: 1px; border-radius: 2px; display: inline-block;
+}
+
+.Ldt-Social-Input:hover, .Ldt-Social-CopyBtn.hover {
+    border-color: #8080ff;
+}
+
+.Ldt-Social-Input {
+    width: 150px;
+}
+
+.Ldt-Social-CopyBtn {
+    font-weight: bold; width: 50px; text-align: center; background: #f0f0ff;
+}
+
+.Ldt-Social-CopyBtn.hover {
+    background: #ffe0a0;
+}
+
+.Ldt-Social-CopyBtn.active {
+    background: #ff8000;
+}
+
 a.Ldt-Social-Twitter {
     background-position: 0 0;
 }
--- a/src/ldt/ldt/static/ldt/metadataplayer/Social.js	Wed Jul 18 15:04:46 2012 +0200
+++ b/src/ldt/ldt/static/ldt/metadataplayer/Social.js	Wed Jul 18 15:08:02 2012 +0200
@@ -2,6 +2,7 @@
 
 IriSP.Widgets.Social = function(player, config) {
     IriSP.Widgets.Widget.call(this, player, config);
+    ZeroClipboard.setMoviePath( IriSP.getLib('zeroClipboardSwf') );
 }
 
 IriSP.Widgets.Social.prototype = new IriSP.Widgets.Widget();
@@ -9,6 +10,7 @@
 IriSP.Widgets.Social.prototype.defaults = {
     text: "",
     url: "",
+    show_url: true,
     show_twitter: true,
     show_fb: true,
     show_gplus: true,
@@ -16,7 +18,9 @@
 }
 
 IriSP.Widgets.Social.prototype.template =
-    '<span class="Ldt-Social">{{#show_fb}}<a href="#" target="_blank" class="Ldt-Social-Fb Ldt-TraceMe" title="{{l10n.share_on}} Facebook"></a>{{/show_fb}}'
+    '<span class="Ldt-Social">{{#show_url}}<div class="Ldt-Social-Url-Container"><a href="#" target="_blank" class="Ldt-Social-Square Ldt-Social-Url Ldt-TraceMe" title="{{l10n.share_link}}">'
+    + '</a><div class="Ldt-Social-UrlPop"><input class="Ldt-Social-Input"/><div class="Ldt-Social-CopyBtn">{{l10n.copy}}</div></div></div>{{/show_url}}'
+    + '{{#show_fb}}<a href="#" target="_blank" class="Ldt-Social-Fb Ldt-TraceMe" title="{{l10n.share_on}} Facebook"></a>{{/show_fb}}'
     + '{{#show_twitter}}<a href="#" target="_blank" class="Ldt-Social-Twitter Ldt-TraceMe" title="{{l10n.share_on}} Twitter"></a>{{/show_twitter}}'
     + '{{#show_gplus}}<a href="#" target="_blank" class="Ldt-Social-Gplus Ldt-TraceMe" title="{{l10n.share_on}} Google+"></a>{{/show_gplus}}'
     + '{{#show_mail}}<a href="#" target="_blank" class="Ldt-Social-Mail Ldt-TraceMe" title="{{l10n.share_mail}}"></a>{{/show_mail}}</span>';
@@ -24,20 +28,58 @@
 IriSP.Widgets.Social.prototype.messages = {
     "fr": {
         share_on: "Partager sur",
-        share_mail: "Envoyer par courriel"
+        share_mail: "Envoyer par courriel",
+        share_link: "Partager le lien hypertexte",
+        copy: "Copier"
     },
     "en" : {
         share_on: "Share on",
-        share_mail: "Share by e-mail"
+        share_mail: "Share by e-mail",
+        share_link: "Share hypertext link",
+        copy: "Copy"
     }
 }
 
 IriSP.Widgets.Social.prototype.draw = function() {
     this.renderTemplate();
+    this.clipId = IriSP._.uniqueId("Ldt-Social-CopyBtn-");
+    this.$.find(".Ldt-Social-CopyBtn").attr("id", this.clipId);
+    var _this = this;
+    this.$.find(".Ldt-Social-Url").click(function() {
+        _this.toggleCopy();
+        return false;
+    });
+    this.$.find(".Ldt-Social-Input").focus(function() {
+        this.select();
+    });
     this.updateUrls(this.url, this.text);
 }
 
+IriSP.Widgets.Social.prototype.toggleCopy = function() {
+    var _pop = this.$.find(".Ldt-Social-UrlPop");
+    _pop.toggle();
+    if (_pop.is(":visible")) {
+        if (typeof this.clip == "undefined") {
+            this.clip = new ZeroClipboard.Client();
+            this.clip.setHandCursor( true );
+            this.clip.glue(this.clipId);
+            var _this = this;
+            this.clip.addEventListener( 'onMouseUp', function() {
+                _pop.hide();
+                _this.clip.hide();
+            });
+        }
+        this.clip.show();
+        this.clip.setText( this.url );
+        this.$.find(".Ldt-Social-Input").val(this.url).focus();
+    } else {
+        this.clip.hide();
+    }
+}
+
 IriSP.Widgets.Social.prototype.updateUrls = function(_url, _text) {
+    this.url = _url;
+    this.text = _text;
     this.$.find(".Ldt-Social-Fb").attr("href", "http://www.facebook.com/share.php?" + IriSP.jQuery.param({ u: _url, t: _text }));
     this.$.find(".Ldt-Social-Twitter").attr("href", "https://twitter.com/intent/tweet?" + IriSP.jQuery.param({ url: _url, text: _text }));
     this.$.find(".Ldt-Social-Gplus").attr("href", "https://plusone.google.com/_/+1/confirm?" + IriSP.jQuery.param({ url: _url, title: _text }));
Binary file src/ldt/ldt/static/ldt/metadataplayer/img/socialbuttons.png has changed
Binary file src/ldt/ldt/static/ldt/metadataplayer/img/socialcopy.png has changed