]> git.parisson.com Git - telemeta.git/commitdiff
added icons button style and some frix on div marker
authorriccardo <riccardo@parisson.com>
Mon, 14 Mar 2011 17:38:30 +0000 (18:38 +0100)
committerriccardo <riccardo@parisson.com>
Mon, 14 Mar 2011 17:38:30 +0000 (18:38 +0100)
19 files changed:
telemeta/htdocs/css/telemeta.css
telemeta/htdocs/images/add.png [new file with mode: 0644]
telemeta/htdocs/images/cancel.png
telemeta/htdocs/images/copy_page.png [new file with mode: 0644]
telemeta/htdocs/images/dublin_core.png [new file with mode: 0644]
telemeta/htdocs/images/edit_page.png
telemeta/htdocs/images/next.png
telemeta/htdocs/images/previous.png
telemeta/htdocs/images/save.png [new file with mode: 0644]
telemeta/htdocs/timeside/src/controller.js
telemeta/htdocs/timeside/src/divmarker.js
telemeta/htdocs/timeside/src/markermap.js
telemeta/htdocs/timeside/src/player.js
telemeta/htdocs/timeside/src/ruler.js
telemeta/templates/telemeta_default/collection_list.html
telemeta/templates/telemeta_default/mediaitem_add.html
telemeta/templates/telemeta_default/mediaitem_detail.html
telemeta/templates/telemeta_default/mediaitem_edit.html
telemeta/templates/telemeta_default/mediaitem_list.html

index e41fa931a51bc337571e67936f2815c8b4dd2876..15445b25a8e1de942741729568ea554befd13302 100644 (file)
@@ -97,12 +97,12 @@ a img { border: none; }
     right: 0;
     top: 0;
 }
-#submenu a {
+/*#submenu a {
     height: 1.6em;
     color: #4d508a;
     font-size: 0.9em;
     font-weight: bold;
-}
+}*/
 
 #rightcol {
     position: relative;
@@ -832,7 +832,16 @@ a.image-link {
     z-index: 10;
 }
 
-.markersdivButton{
+
+.roundBorder4{
+    /*padding: 0.3em 0.8em 0.8em 0.8em;
+    margin: 0 0 1.5em 1.5em;*/
+
+    -moz-border-radius: 4px 4px 4px 4px;
+    -webkit-border-radius: 4px 4px 4px 4px;
+    border-radius: 4px 4px 4px 4px;
+}
+.roundBorder6{
     /*padding: 0.3em 0.8em 0.8em 0.8em;
     margin: 0 0 1.5em 1.5em;*/
 
@@ -840,6 +849,22 @@ a.image-link {
     -webkit-border-radius: 6px 6px 6px 6px;
     border-radius: 6px 6px 6px 6px;
 }
+.roundBorder8{
+    /*padding: 0.3em 0.8em 0.8em 0.8em;
+    margin: 0 0 1.5em 1.5em;*/
+
+    -moz-border-radius: 8px 8px 8px 8px;
+    -webkit-border-radius: 8px 8px 8px 8px;
+    border-radius: 8px 8px 8px 8px;
+}
+.roundBorder10{
+    /*padding: 0.3em 0.8em 0.8em 0.8em;
+    margin: 0 0 1.5em 1.5em;*/
+
+    -moz-border-radius: 10px 10px 10px 10px;
+    -webkit-border-radius:  10px 10px 10px 10px;
+    border-radius:  10px 10px 10px 10px;
+}
 
 .markersdivUneditable{
     border: 0px !important;
@@ -863,31 +888,36 @@ a.image-link {
     font-style: italic;
 }
 .markersdivTopElement{
-    vertical-align:middle;
+    /*vertical-align:middle;*/
 }
 .markersdivTitle{
     font-weight:bold;
     margin:0;
     padding:0;
+    position:relative;
+    top:-0.5ex;
     /*margin-right:margin*/
 }
 .markersdivEdit, .markersdivEdit:hover, .markersdivEdit:visited,
 .markersdivEdit:link, .markersdivEdit:link:hover, .markersdivEdit:visited:hover{
     font-weight:bold;
-    border:1px dotted #333333;
     float:right;
-    color:#000;
+    color:#333;
     background-image: url('/images/edit_marker.png');
     background-repeat:no-repeat;
     background-position: center left;
     border:2px solid #666;
-    height:1ex;
-    padding:0px 1ex 2ex 3ex; /*top right bottom left*/
-    font-size: 70%;
+    height:2.2ex;
+    width: 8.5ex;
+    /*padding:0px 1ex 2ex 3ex;*/ /*top right bottom left*/
+    font-size: 65%;
     margin-left: 1ex;
     margin-right:1ex;
     position:relative;
-    top:-0.5ex;
+    /*top:-0.5ex;*/
+}
+.markersdivEdit span{
+    position:absolute;top:-0.75ex;left:3ex;
 }
 .markersdivDelete{
     border:0px;
@@ -921,3 +951,45 @@ a.image-link {
     border: 1px solid #aaaaaa;
     margin-bottom: 1ex;
 }
+
+
+.mediaitem_button, .mediaitem_button:hover, .mediaitem_button:visited,
+.mediaitem_button:link, .mediaitem_button:link:hover, .mediaitem_button:visited:hover{
+    padding:0.7ex 1ex 0.7ex 4ex; /*top right bottom left*/
+    border-top:  1px solid #DDD;
+    border-left:  1px solid #DDD;
+    border-bottom:  1px solid #666;
+    border-right:  1px solid #666;
+    background-color: #f9f9f9; /*#626262;*/
+    color:#444;
+    font-weight: bold;
+    background-repeat: no-repeat;
+    background-position: 1ex .5ex;
+   
+    
+}
+.mediaitem_button_edit{
+    background-image: url('/images/edit_page.png');
+    
+    }
+.mediaitem_button_copy{
+     background-image: url('/images/copy_page.png');
+}
+.mediaitem_button_previous{
+    background-image: url('/images/previous.png');
+}
+.mediaitem_button_next{
+     background-image: url('/images/next.png');
+}
+.mediaitem_button_dublin_core{
+     background-image: url('/images/dublin_core.png');
+}
+.mediaitem_button_cancel{
+    background-image: url('/images/cancel.png');
+}
+.mediaitem_button_save{
+    background-image: url('/images/save.png');
+}
+.mediaitem_button_add{
+    background-image: url('/images/add.png');
+}
\ No newline at end of file
diff --git a/telemeta/htdocs/images/add.png b/telemeta/htdocs/images/add.png
new file mode 100644 (file)
index 0000000..8431237
Binary files /dev/null and b/telemeta/htdocs/images/add.png differ
index 5f6dcc87d7b0dab235b2f81f4639c13eeb953e28..dd18b3614f903c8c22d6e019dbac15ee335eaa47 100644 (file)
Binary files a/telemeta/htdocs/images/cancel.png and b/telemeta/htdocs/images/cancel.png differ
diff --git a/telemeta/htdocs/images/copy_page.png b/telemeta/htdocs/images/copy_page.png
new file mode 100644 (file)
index 0000000..c600e99
Binary files /dev/null and b/telemeta/htdocs/images/copy_page.png differ
diff --git a/telemeta/htdocs/images/dublin_core.png b/telemeta/htdocs/images/dublin_core.png
new file mode 100644 (file)
index 0000000..d53e56e
Binary files /dev/null and b/telemeta/htdocs/images/dublin_core.png differ
index 8dec4444de6f15cc430e0397251d37f1087211a7..98713acb9f8befd30956996053481c18f7827bd0 100644 (file)
Binary files a/telemeta/htdocs/images/edit_page.png and b/telemeta/htdocs/images/edit_page.png differ
index 8117bd34795a69071313dd9dc903bf72d6fba771..e9cbecd003f1401d5d8d629f56789826a13bd1e0 100644 (file)
Binary files a/telemeta/htdocs/images/next.png and b/telemeta/htdocs/images/next.png differ
index 7d87942f53b431fc6dea6cfaeeff3a865345a435..52fa887f758c8aba8dbe68ef230c11ad2867cfff 100644 (file)
Binary files a/telemeta/htdocs/images/previous.png and b/telemeta/htdocs/images/previous.png differ
diff --git a/telemeta/htdocs/images/save.png b/telemeta/htdocs/images/save.png
new file mode 100644 (file)
index 0000000..8072aea
Binary files /dev/null and b/telemeta/htdocs/images/save.png differ
index 9a7fd174a35ec351f69a9657bf475eb8cfa43759..ddd0d3e8876af04813f16fe7a62e7631a596dbe9 100644 (file)
@@ -116,11 +116,7 @@ TimeSide(function($N) {
                 var divRemoved = this.cfg.divmarkers.splice(idx,1)[0]; //there is only one element removed
                 divRemoved.remove();
                 this.cfg.player.ruler.remove(idx);
-                if(idx<this.cfg.divmarkers.length){
-                    //we might have removed the last index, in this case idx==this.cfg.divmarkers.length
-                    //no need to update and to enter this if
-                    this.updateIndices(idx);
-                }
+                this.updateIndices(idx);
             }
         },
 
@@ -128,8 +124,15 @@ TimeSide(function($N) {
             if(from===undefined || from==null){
                 from = 0;
             }
+            var len = this.cfg.divmarkers.length-1;
+            if(from>len){
+                //it might happen when we remove the last element
+                //suppose [0,1,2], we remove [2] then we call
+                //updateIndices[2] but array till 1 (there is nothing to update)
+                return;
+            }
             if(to==undefined || to ==null){
-                to = this.cfg.divmarkers.length-1;
+                to = len;
             }
             if(to<from){
                 var tmp = to;
index 06d61a23f925c351f770403d8e6ceff6194ebe89..a38f0ffb0e825e1618b9cebd6b22ed18a1e5b088 100644 (file)
@@ -80,12 +80,12 @@ TimeSide(function($N, $J) {
                
                 //edit button
                 this.e_editButton = $J('<a/>')
-                .addClass('markersdivButton')
+                .addClass('roundBorder4')
                 .addClass('markersdivEdit')
                 .addClass('markersdivTopElement')
                 .attr('title','edit marker description')
                 .attr("href","#")
-                .html('EDIT')
+                .html('<span>EDIT</span>')
                                 
 
                 //add all elements to header:
@@ -103,7 +103,7 @@ TimeSide(function($N, $J) {
                 //ok button
                 this.e_okButton = $J('<a/>')
                 .attr('title','save marker description and offset')
-                .addClass('markersdivButton')
+                .addClass('roundBorder6')
                 .addClass('markersdivSave')
                 .attr("href","#")
                 .html("OK");
@@ -116,7 +116,7 @@ TimeSide(function($N, $J) {
                 .append(this.e_header)
                 .append(this.e_descriptionText)
                 .append(this.e_okButton)
-                .addClass('markersdivButton')
+                .addClass('roundBorder8')
                 .addClass('markerdiv');
 
             }
@@ -137,6 +137,8 @@ TimeSide(function($N, $J) {
                     //all jQuery data associated with the removed elements.
                     //This method is useful when removed elements are to be reinserted into the DOM at a later time.
                     this.me.detach();
+                    //note that we might have index!=this.markerIndex without the need to detach the div
+                    //we leave this code to be sure, especially on loading 
                 }else{
                     //div is not added: set description and title
                     this.e_descriptionText.val(marker.desc ? marker.desc : "");
@@ -179,6 +181,7 @@ TimeSide(function($N, $J) {
                     tText.removeAttr('readonly').removeClass('markersdivUneditable').show();
                     okB.show();
                     $(this).hide();
+                    tText.select();
                     return false; //avoid scrolling of the page on anchor click
                 });
                 var eB = this.e_editButton;
@@ -187,12 +190,16 @@ TimeSide(function($N, $J) {
                     //if(marker.desc !== descriptionText.val()){ //strict equality needed. See note below
                     marker.desc = dText.val();
                     marker.title = tText.val();
-                    map.sendHTTP(marker);
-                    //TODO: this should be done IF send was succesful
+                    map.sendHTTP(marker,
+                    
+                    function(){
                     dText.attr('readonly','readonly').addClass('markersdivUneditable');
                     tText.attr('readonly','readonly').addClass('markersdivUneditable');
                     eB.show();
                     okB.hide();
+                    },
+                    true
+                    );
                     //}
                     //                func_fem.apply(klass,[marker,editModeSaved,editButton, descriptionText,
                     //                    descriptionLabel, okButton]);
index 3b4deeda7606fbdc0fe30c7685aa4f56f3821099..367f09ce0cfb65f0af654f07687926a159d86b6b 100644 (file)
@@ -159,19 +159,19 @@ TimeSide(function($N, $J) {
         //in other words, it is useful when we do not want to know if obj is already present
         //in the map, but only WHERE WOULD be inserted obj in the map. obj can be a marker
         //or an offset (time). In the latter case a dummy marker with that offset will be considered
-       indexOf: function(obj){
-           var idx = this.insertionIndex(obj);
-           return idx<0 ? -idx-1 : idx;
-       },
+        indexOf: function(obj){
+            var idx = this.insertionIndex(obj);
+            return idx<0 ? -idx-1 : idx;
+        },
         each: function(callback) {
             $J(this.markers).each(callback);
         },
-        length: function(){
-            return this.markers ? this.markers.length : 0;
-        },
+        //        length: function(){
+        //            return this.markers ? this.markers.length : 0;
+        //        },
        
 
-        sendHTTP: function(marker){
+        sendHTTP: function(marker, functionOnSuccess, showAlertOnError){
 
             //itemid is the item (spund file) name
             var sPath = window.location.pathname;
@@ -189,12 +189,13 @@ TimeSide(function($N, $J) {
                 marker.id=this.uniqid(); //defined in core;
             }
             var method = isSaved ? "telemeta.update_marker" : "telemeta.add_marker";
-            var data2send = '{"id":"jsonrpc", "params":[{"item_id":"'+ itemid+
-            '", "public_id": "'+marker.id+'", "time": "'+marker.offset+
-            '", "author": "'+marker.author+
-            '", "title": "'+marker.title+
-            '","description": "'+marker.desc+'"}], "method":"'+method+'","jsonrpc":"1.0"}';
-
+            
+            var s = this.jsonify;
+            var data2send = '{"id":"jsonrpc", "params":[{"item_id":"'+ s(itemid)+
+            '", "public_id": "'+s(marker.id)+'", "time": "'+s(marker.offset)+
+            '", "author": "'+s(marker.author)+
+            '", "title": "'+s(marker.title)+
+            '","description": "'+s(marker.desc)+'"}], "method":"'+method+'","jsonrpc":"1.0"}';
 
             $.ajax({
                 type: "POST",
@@ -205,10 +206,34 @@ TimeSide(function($N, $J) {
                     if(!isSaved){
                         marker.isSaved = true;
                     }
+                    if(functionOnSuccess){
+                        functionOnSuccess();
+                    }
+                },
+                error: function(jqXHR, textStatus, errorThrown){
+                    if(showAlertOnError){
+                        var details = "\n(no further info available)";
+                        if(jqXHR) {
+                            details="\nThe server responded witha status of "+jqXHR.status+" ("+
+                                jqXHR.statusText+")\n\nDetails (request responseText):\n"+jqXHR.responseText;
+                        }
+                        alert("ERROR: Failed to save marker"+details);
+                    }
                 }
             });
+
+            
         },
 
+        jsonify: function(string){
+            var s = string;
+            if(typeof string == "string"){
+                s = string.replace(/\\/g,"\\\\")
+                .replace(/\n/g,"\\n")
+                .replace(/"/g,"\\\"");
+            }
+            return s;
+        },
         removeHTTP: function(marker){
 
             //  //itemid is the item (spund file) name
index 14bc8da25359850fdbc24e04f46d139d168b1605..793b2a2d91a6989ed9be5e3a9ddb430c07b9d4dd 100644 (file)
@@ -176,8 +176,9 @@ TimeSide(function($N, $J) {
 
             elements.css('width', 'auto'); // for IE6
 
-            if (!height)
+            if (!height){
                 height = 200;
+            }
             var style = {
                 width: this.elements.wave.width(),
                 height: height
index 5fcd6329fa8c8049424027f1b278838b290c3433..e5697e4cff2c4819c0c3cdeba745b22b33992c06 100644 (file)
@@ -217,6 +217,16 @@ TimeSide(function($N, $J) {
             }
 
             this._createPointer();
+            //draw markers
+            if (this.cfg.map) {
+                $J(this.markers).each(function(i, m) {
+                    m.clear();
+                });
+                this.markers = new Array();
+                this.cfg.map.each(this.attach(function(i, m) {
+                    this.markers.push(this._drawMarker(m, i));
+                }));
+            }
         //this._drawMarkers();
         },
 
@@ -404,7 +414,7 @@ TimeSide(function($N, $J) {
 
         add: function(marker, index){
             this.markers.splice(index, 0, this._drawMarker(marker, index));
-            //this.markers.push(this._drawMarker(marker, index));
+        //this.markers.push(this._drawMarker(marker, index));
         },
 
         //        _onMapAdd2: function(e, data) {
@@ -430,7 +440,6 @@ TimeSide(function($N, $J) {
         },
 
         _onDoubleClick: function(evt) {
-            //if (this.cfg.map && CURRENT_USER_NAME) {
             if (CURRENT_USER_NAME) {
                 var offset = (evt.pageX - this.container.offset().left)
                 / this.width * this.duration;
index d2ba7761d85de3f76e5ccbbb167edecc7beb466f..7cf243b62733584a4e0c107ceda97a745ae496c1 100644 (file)
@@ -7,7 +7,9 @@
 {% block submenu %}
     <div class="buttons">  
     {% if user.is_authenticated and perms.telemeta.add_mediacollection %}
-     <button><a href="{% url telemeta-collection-add %}">Add</a></button>
+<!--     <button><a href="{% url telemeta-collection-add %}">Add</a></button>-->
+      <a href="{% url telemeta-collection-add %}" class="roundBorder6 mediaitem_button mediaitem_button_add">Add</a>
+
     {% endif %}
     </div>
 {% endblock %}
index b5c1ae39f07d10ede452419284af19759c7afedd..3b7eafc5c0ecfaa06e8617ec13d4c5a5b4a1223c 100644 (file)
 <div>
     {% if perms.telemeta.add_mediaitem %}
     {% block tools %}
-     <a href="{% url telemeta-item-detail item.public_id %}">
-         <img src="images/edit_cancel.png" /></a>
+<!--     <a href="{% url telemeta-item-detail item.public_id %}">
+         <img src="images/edit_cancel.png" /></a>-->
+ <a href="{% url telemeta-item-detail item.public_id %}"
+           class="roundBorder6 mediaitem_button mediaitem_button_cancel">Cancel</a>
     {% endblock tools %}
     
     {% endif %}
@@ -23,7 +25,7 @@
 
     {% block infos %}
     <div class="infos">
-     <form method="POST" action="">{% csrf_token %}
+     <form method="POST" id ="_addItemForm" action="">{% csrf_token %}
        <table>
        {% for field in form %}
         {% if not field.html_name == "copied_from_item" %}
        {% endfor %}
        </table>
        <div align="center">
-        <a href="{% url telemeta-item-detail item.public_id %}">
+<!--        <a href="{% url telemeta-item-detail item.public_id %}">
          <img src="images/edit_cancel.png" style="vertical-align:middle" /></a>
-        <input type="image" src="images/save_changes.png" style="vertical-align:middle" value="save" />
+        <input type="image" src="images/save_changes.png" style="vertical-align:middle" value="save" />-->
+        <a href="{% url telemeta-item-detail item.public_id %}"
+           class="roundBorder6 mediaitem_button mediaitem_button_cancel">Cancel</a>
+<a href="#" class="roundBorder6 mediaitem_button mediaitem_button_save"
+   onclick="document.getElementById('_addItemForm').submit(); return false;">Save</a>
        </div>
      </form>
     </div>
index 070a8d1bd24c499d1c1013d3bdf39ff930980064..e39d9b05d747cd061f300b3a1e2a6b6fa7728ee5 100644 (file)
 {% block submenu %}
 <div>
     {% block tools %}
-    <a href="{% url telemeta-item-dublincore item.public_id %}">Dublin Core</a>
+    <!--<a href="{% url telemeta-item-dublincore item.public_id %}">Dublin Core</a>-->
+    <a href="{% url telemeta-item-dublincore item.public_id %}" class="roundBorder6 mediaitem_button mediaitem_button_dublin_core">Dublin Core</a>
     {% if user.is_authenticated and perms.telemeta.change_mediaitem %}
+<<<<<<< TREE
+    
+    <!--<a href="{% url telemeta-item-edit item.public_id %}"><img src="images/edit_page.png" style="vertical-align:middle" alt="EDIT" /></a>
+    <button><a href="{% url telemeta-item-copy item.public_id %}">Copy</a></button>-->
+    <a href="{% url telemeta-item-edit item.public_id %}" class="roundBorder6 mediaitem_button mediaitem_button_edit">Edit</a>
+    <a href="{% url telemeta-item-copy item.public_id %}" class="roundBorder6 mediaitem_button mediaitem_button_copy">Copy</a>
+
+    
+=======
     <a href="{% url telemeta-item-edit item.public_id %}"><img src="images/edit_page.png" style="vertical-align:middle" alt="EDIT" /></a>
     <button><a href="{% url telemeta-item-copy item.public_id %}">Copy</a></button>
+>>>>>>> MERGE-SOURCE
     {% endif %}
-    <a href="{% url telemeta-item-detail previous %}"><img src="images/previous.png" style="vertical-align:middle" alt="PREVIOUS" /></a>
-    <a href="{% url telemeta-item-detail next %}"><img src="images/next.png" style="vertical-align:middle" alt="NEXT" /></a>
+    <!--<a href="{% url telemeta-item-detail previous %}"><img src="images/previous.png" style="vertical-align:middle" alt="PREVIOUS" /></a>
+    <a href="{% url telemeta-item-detail next %}"><img src="images/next.png" style="vertical-align:middle" alt="NEXT" /></a>-->
+     <a href="{% url telemeta-item-detail previous %}" class="roundBorder6 mediaitem_button mediaitem_button_previous">Previous</a>
+    <a href="{% url telemeta-item-detail next %}" class="roundBorder6 mediaitem_button mediaitem_button_next">Next</a>
     {% endblock tools %}
 </div>
 {% endblock %}
index 68b779f303ae5fc5a2c874c8852aa02c978ec31e..8abed4ce9958b7459ce3b8a084e4966bc9ba3b18 100644 (file)
@@ -1,13 +1,14 @@
 {% extends "telemeta/mediaitem_detail.html" %}
 
     {% block tools %}
-     <a href="{% url telemeta-item-detail item.public_id %}">
-         <img src="images/edit_cancel.png" /></a>
+<!--     <a href="{% url telemeta-item-detail item.public_id %}">
+         <img src="images/edit_cancel.png" /></a>-->
+ <a href="{% url telemeta-item-detail item.public_id %}"  class="roundBorder6 mediaitem_button mediaitem_button_cancel">Cancel</a>
     {% endblock tools %}
 
   {% block infos %}    
     <div class="infos">
-     <form enctype="multipart/form-data" method="POST" action="">{% csrf_token %}
+     <form enctype="multipart/form-data" id="_editItemForm" method="POST" action="">{% csrf_token %}
       <table>
        {% for field in form %}
         {% if not field.html_name == "copied_from_item" %}
        {% endfor %}
        </table>
        <div align="center">
-        <a href="{% url telemeta-item-detail item.public_id %}">
-         <img src="images/edit_cancel.png" style="vertical-align:middle" /></a>
-        <input type="image" src="images/save_changes.png" style="vertical-align:middle" value="save" />
+<!--        <a href="{% url telemeta-item-detail item.public_id %}">
+         <img src="images/edit_cancel.png" style="vertical-align:middle" /></a>-->
+        <a href="{% url telemeta-item-detail item.public_id %}"
+           class="roundBorder6 mediaitem_button mediaitem_button_cancel">Cancel</a>
+<a href="#" class="roundBorder6 mediaitem_button mediaitem_button_save"
+   onclick="document.getElementById('_editItemForm').submit(); return false;">Save</a>
+<!--           <input type="image" src="images/save_changes.png" style="vertical-align:middle" value="save" />-->
        </div>
      </form>
     </div>
index 5bbf9228fbccc3392e680f64a2efa9465d88b259..b53f4f72a8473547b8dfdc062797518eab95fbbb 100644 (file)
@@ -8,7 +8,8 @@
 {% block submenu %}
     <div class="buttons">  
     {% if user.is_authenticated and perms.telemeta.add_mediaitem %}
-     <button><a href="{% url telemeta-item-add %}">Add</a></button>
+    <!-- <button><a href="{% url telemeta-item-add %}">Add</a></button>-->
+     <a href="{% url telemeta-item-add %}" class="roundBorder6 mediaitem_button mediaitem_button_add">Add</a>
     {% endif %}
     </div>
 {% endblock %}