From: riccardo Date: Mon, 14 Mar 2011 17:38:30 +0000 (+0100) Subject: added icons button style and some frix on div marker X-Git-Tag: 1.1~390 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=fb4d12e09fe37561dbce4cf92a1dad81b7f8cf0c;p=telemeta.git added icons button style and some frix on div marker --- diff --git a/telemeta/htdocs/css/telemeta.css b/telemeta/htdocs/css/telemeta.css index e41fa931..15445b25 100644 --- a/telemeta/htdocs/css/telemeta.css +++ b/telemeta/htdocs/css/telemeta.css @@ -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 index 00000000..8431237b Binary files /dev/null and b/telemeta/htdocs/images/add.png differ diff --git a/telemeta/htdocs/images/cancel.png b/telemeta/htdocs/images/cancel.png index 5f6dcc87..dd18b361 100644 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 index 00000000..c600e997 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 index 00000000..d53e56ef Binary files /dev/null and b/telemeta/htdocs/images/dublin_core.png differ diff --git a/telemeta/htdocs/images/edit_page.png b/telemeta/htdocs/images/edit_page.png index 8dec4444..98713acb 100644 Binary files a/telemeta/htdocs/images/edit_page.png and b/telemeta/htdocs/images/edit_page.png differ diff --git a/telemeta/htdocs/images/next.png b/telemeta/htdocs/images/next.png index 8117bd34..e9cbecd0 100644 Binary files a/telemeta/htdocs/images/next.png and b/telemeta/htdocs/images/next.png differ diff --git a/telemeta/htdocs/images/previous.png b/telemeta/htdocs/images/previous.png index 7d87942f..52fa887f 100644 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 index 00000000..8072aea3 Binary files /dev/null and b/telemeta/htdocs/images/save.png differ diff --git a/telemeta/htdocs/timeside/src/controller.js b/telemeta/htdocs/timeside/src/controller.js index 9a7fd174..ddd0d3e8 100644 --- a/telemeta/htdocs/timeside/src/controller.js +++ b/telemeta/htdocs/timeside/src/controller.js @@ -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(idxlen){ + //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') - .addClass('markersdivButton') + .addClass('roundBorder4') .addClass('markersdivEdit') .addClass('markersdivTopElement') .attr('title','edit marker description') .attr("href","#") - .html('EDIT') + .html('EDIT') //add all elements to header: @@ -103,7 +103,7 @@ TimeSide(function($N, $J) { //ok button this.e_okButton = $J('') .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]); diff --git a/telemeta/htdocs/timeside/src/markermap.js b/telemeta/htdocs/timeside/src/markermap.js index 3b4deeda..367f09ce 100644 --- a/telemeta/htdocs/timeside/src/markermap.js +++ b/telemeta/htdocs/timeside/src/markermap.js @@ -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 diff --git a/telemeta/htdocs/timeside/src/player.js b/telemeta/htdocs/timeside/src/player.js index 14bc8da2..793b2a2d 100644 --- a/telemeta/htdocs/timeside/src/player.js +++ b/telemeta/htdocs/timeside/src/player.js @@ -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 diff --git a/telemeta/htdocs/timeside/src/ruler.js b/telemeta/htdocs/timeside/src/ruler.js index 5fcd6329..e5697e4c 100644 --- a/telemeta/htdocs/timeside/src/ruler.js +++ b/telemeta/htdocs/timeside/src/ruler.js @@ -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; diff --git a/telemeta/templates/telemeta_default/collection_list.html b/telemeta/templates/telemeta_default/collection_list.html index d2ba7761..7cf243b6 100644 --- a/telemeta/templates/telemeta_default/collection_list.html +++ b/telemeta/templates/telemeta_default/collection_list.html @@ -7,7 +7,9 @@ {% block submenu %} {% endblock %} diff --git a/telemeta/templates/telemeta_default/mediaitem_add.html b/telemeta/templates/telemeta_default/mediaitem_add.html index b5c1ae39..3b7eafc5 100644 --- a/telemeta/templates/telemeta_default/mediaitem_add.html +++ b/telemeta/templates/telemeta_default/mediaitem_add.html @@ -10,8 +10,10 @@
{% if perms.telemeta.add_mediaitem %} {% block tools %} - - + + Cancel {% endblock tools %} {% endif %} @@ -23,7 +25,7 @@ {% block infos %}
-
{% csrf_token %} + {% csrf_token %} {% for field in form %} {% if not field.html_name == "copied_from_item" %} @@ -35,9 +37,13 @@ {% endfor %}
diff --git a/telemeta/templates/telemeta_default/mediaitem_detail.html b/telemeta/templates/telemeta_default/mediaitem_detail.html index 070a8d1b..e39d9b05 100644 --- a/telemeta/templates/telemeta_default/mediaitem_detail.html +++ b/telemeta/templates/telemeta_default/mediaitem_detail.html @@ -41,13 +41,26 @@ {% block submenu %}
{% block tools %} - Dublin Core + + Dublin Core {% if user.is_authenticated and perms.telemeta.change_mediaitem %} +<<<<<<< TREE + + + Edit + Copy + + +======= EDIT +>>>>>>> MERGE-SOURCE {% endif %} - PREVIOUS - NEXT + + Previous + Next {% endblock tools %}
{% endblock %} diff --git a/telemeta/templates/telemeta_default/mediaitem_edit.html b/telemeta/templates/telemeta_default/mediaitem_edit.html index 68b779f3..8abed4ce 100644 --- a/telemeta/templates/telemeta_default/mediaitem_edit.html +++ b/telemeta/templates/telemeta_default/mediaitem_edit.html @@ -1,13 +1,14 @@ {% extends "telemeta/mediaitem_detail.html" %} {% block tools %} - - + + Cancel {% endblock tools %} {% block infos %}
-
{% csrf_token %} + {% csrf_token %} {% for field in form %} {% if not field.html_name == "copied_from_item" %} @@ -19,9 +20,13 @@ {% endfor %}
- - - + + Cancel +Save +
diff --git a/telemeta/templates/telemeta_default/mediaitem_list.html b/telemeta/templates/telemeta_default/mediaitem_list.html index 5bbf9228..b53f4f72 100644 --- a/telemeta/templates/telemeta_default/mediaitem_list.html +++ b/telemeta/templates/telemeta_default/mediaitem_list.html @@ -8,7 +8,8 @@ {% block submenu %}
{% if user.is_authenticated and perms.telemeta.add_mediaitem %} - + + Add {% endif %}
{% endblock %}