From 958284e71c35b9f0125ef49fa6904e8f7e7cc0f8 Mon Sep 17 00:00:00 2001 From: riccardo Date: Wed, 16 Mar 2011 15:48:06 +0100 Subject: [PATCH] fixed some bugs :wq added: telemeta/htdocs/images/find.png telemeta/htdocs/images/password.png modified: telemeta/htdocs/css/telemeta.css telemeta/htdocs/timeside/src/divmarker.js telemeta/htdocs/timeside/src/markermap.js telemeta/htdocs/timeside/src/ruler.js telemeta/htdocs/timeside/src/util.js telemeta/templates/telemeta_default/base.html telemeta/templates/telemeta_default/geo_continents.html telemeta/templates/telemeta_default/login.html unknown: telemeta/htdocs/timeside/src/marker.js.moved --- telemeta/htdocs/css/telemeta.css | 41 +++++--- telemeta/htdocs/images/find.png | Bin 0 -> 874 bytes telemeta/htdocs/images/password.png | Bin 0 -> 818 bytes telemeta/htdocs/timeside/src/divmarker.js | 99 ++++++++++++------ telemeta/htdocs/timeside/src/markermap.js | 49 +++------ telemeta/htdocs/timeside/src/ruler.js | 19 ---- telemeta/htdocs/timeside/src/util.js | 2 +- telemeta/templates/telemeta_default/base.html | 6 +- .../telemeta_default/geo_continents.html | 6 +- .../templates/telemeta_default/login.html | 6 +- 10 files changed, 120 insertions(+), 108 deletions(-) create mode 100644 telemeta/htdocs/images/find.png create mode 100644 telemeta/htdocs/images/password.png diff --git a/telemeta/htdocs/css/telemeta.css b/telemeta/htdocs/css/telemeta.css index 90aa07c7..98b42904 100644 --- a/telemeta/htdocs/css/telemeta.css +++ b/telemeta/htdocs/css/telemeta.css @@ -892,6 +892,10 @@ a.image-link { font-family: monospace; margin-right:2ex; } +.markersdivIndexLabel span{ + position:relative; + top:-2px; +} .markersdivOffset{ margin-right:1ex; font-style: italic; @@ -933,13 +937,13 @@ a.image-link { float:right; background-image: url('/images/del_marker.png'); background-repeat: no-repeat; - background-position: center center; + background-position: top center; padding:1ex 1ex 1ex 1ex;/*top right bottom left. The padding is only to show the element */ } .markersdivDescription{ - margin:1ex 0px 0ex 0px; /*top right bottom left*/ + margin:0ex 0px 0ex 0px; /*top right bottom left*/ font-family: sans-serif; - padding:0; + padding:0px; width:100%; } .markersdivSave, .markersdivSave:hover, .markersdivSave:visited, @@ -948,15 +952,17 @@ a.image-link { color: #fff; font-weight: bold; padding: 0.3em 0.8em 0.3em 0.8em; - /*here below the 3 lines to properly display top margin without
or including the element ina div*/ - display: block; - margin-top: 1ex; - width:3ex; - /* margin:1ex 0px 0px 0px;*/ /*top right bottom left*/ + padding:5px 10px 5px 26px; + background-repeat: no-repeat; + background-position: 1ex .5ex; + -moz-border-radius: 1ex 1ex 1ex 1ex; + -webkit-border-radius: 1ex 1ex 1ex 1ex; + border-radius: 1ex 1ex 1ex 1ex; + background-image: url('/images/ok.png'); } .markerdiv{ - padding:1ex 1ex 1.2ex 1ex; /*top right bottom left*/ + padding:1ex 1ex 1ex 1ex; /*top right bottom left*/ border: 1px solid #aaaaaa; margin-bottom: 1ex; } @@ -964,7 +970,7 @@ a.image-link { .mediaitem_button, .mediaitem_button:visited, .mediaitem_button:link{ - padding:0.7ex 1ex 0.7ex 4ex; /*top right bottom left*/ + padding:5px 10px 5px 26px; /*top right bottom left - last value depends on the icon size (default=16)*/ border-top: 1px solid #DDD; border-left: 1px solid #DDD; border-bottom: 1px solid #666; @@ -983,6 +989,9 @@ a.image-link { color:#6A0307; text-decoration: none; } +.mediaitem_button_no_icon{ + padding:5px 10px 5px 10px !important; +} .mediaitem_button_edit{ background-image: url('/images/edit_page.png'); @@ -1003,9 +1012,17 @@ a.image-link { background-image: url('/images/cancel.png'); } .mediaitem_button_save{ - /*color:#6A0307 !important;*/ background-image: url('/images/save.png'); } .mediaitem_button_add{ background-image: url('/images/add.png'); -} \ No newline at end of file +} +.mediaitem_button_login{ + background-image: url('/images/password.png'); +} +.mediaitem_button_search{ + background-image: url('/images/find.png'); +} +.mediaitem_button_ok{ + background-image: url('/images/ok.png'); +} diff --git a/telemeta/htdocs/images/find.png b/telemeta/htdocs/images/find.png new file mode 100644 index 0000000000000000000000000000000000000000..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

').css('margin','1ex 0ex 0.5ex 0ex') .append(this.e_indexLabel) .append(this.e_offsetLabel) .append(this.e_titleText) @@ -93,7 +93,6 @@ TimeSide(function($N, $J) { //ok button this.e_okButton = $J('') .attr('title','save marker description and offset') - .addClass('roundBorder6') .addClass('markersdivSave') .attr("href","#") .html("OK"); @@ -103,9 +102,13 @@ TimeSide(function($N, $J) { markerDiv = $J('
') .append(this.e_header) .append(this.e_descriptionText) - .append(this.e_okButton) + //.append(this.e_okButton) + .append($J('
').css('margin','1ex 0ex 1ex 0ex').append(this.e_okButton)) .addClass('roundBorder8') .addClass('markerdiv'); + + //set default visibility + } return markerDiv; }, @@ -113,12 +116,12 @@ TimeSide(function($N, $J) { updateMarkerIndex: function(index){ var map = this.markerMap; var marker = map.get(index); + + //set defualt element values regardeless of the marker state this.e_indexLabel.attr('title',marker.toString()); - this.e_indexLabel.html(index+1); + this.e_indexLabel.html(""+(index+1)+""); this.e_offsetLabel.html(this.formatMarkerOffset(marker.offset)); - this.e_descriptionText.val(marker.desc ? marker.desc : ""); - this.e_titleText.val(marker.title ? marker.title : ""); - + //move the div to the correct index var divIndex = this.me.prevAll().length; //move the div if necessary: //note that moving left to right the actual insertionIndex is index-1 @@ -129,28 +132,41 @@ TimeSide(function($N, $J) { //all jQuery data associated with the removed elements $( this.cfg.parent.children()[insertionIndex] ).before(this.me); //add } + + //set visibility and attach events according to the marker state: + //first, is editing or not + var isEditing = marker.isEditable && marker.isModified; + // (!marker.isSavedOnServer || !(this.e_editButton.is(':visible'))); + + if(!isEditing){ + this.e_descriptionText.val(marker.desc ? marker.desc : ""); + this.e_titleText.val(marker.title ? marker.title : ""); + } - if(!marker.isEditable || marker.isSaved){ - this.e_okButton.hide(); - this.e_descriptionText.attr('readonly','readonly').addClass('markersdivUneditable'); - this.e_titleText.attr('readonly','readonly').addClass('markersdivUneditable'); - if(!marker.isEditable){ - this.e_deleteButton.hide(); - this.e_editButton.hide(); - return; - } + this.e_okButton.hide(); + this.e_editButton.show(); + this.e_deleteButton.show(); + this.e_descriptionText.attr('readonly','readonly').addClass('markersdivUneditable'); + this.e_titleText.attr('readonly','readonly').addClass('markersdivUneditable'); + + + if(!marker.isEditable){ + this.e_editButton.hide(); + this.e_deleteButton.hide(); + //we unbind events to be sure + this.e_okButton.unbind('click') + this.e_deleteButton.unbind('click').hide(); + this.e_editButton.unbind('click').hide(); + return; } var remove = map.remove; this.e_deleteButton.unbind('click').click( function(){ - remove.apply(map,[index]); //which will call this.remove below - return false; //avoid scrolling of the page on anchor click - }).show(); - - this.e_deleteButton.unbind('click').click( function(){ - remove.apply(map,[index]); + if(!(marker.isSavedOnServer) || confirm('delete the marker permanently?')){ + remove.apply(map,[index]); + } return false; //avoid scrolling of the page on anchor click - }).show(); + }) //notifies controller.js @@ -161,11 +177,15 @@ TimeSide(function($N, $J) { var dText = this.e_descriptionText; var tText = this.e_titleText; var okB = this.e_okButton; + var utw = this.updateTitleWidth; + var divmarker = this; this.e_editButton.unbind('click').click( function(){ + marker.isModified = true; dText.removeAttr('readonly').removeClass('markersdivUneditable').show(); tText.removeAttr('readonly').removeClass('markersdivUneditable').show(); okB.show(); $(this).hide(); + utw.apply(divmarker,[tText]); tText.select(); return false; //avoid scrolling of the page on anchor click }); @@ -182,27 +202,38 @@ TimeSide(function($N, $J) { tText.attr('readonly','readonly').addClass('markersdivUneditable'); eB.show(); okB.hide(); + utw.apply(divmarker,[tText]); }, true ); - //} - // func_fem.apply(klass,[marker,editModeSaved,editButton, descriptionText, - // descriptionLabel, okButton]); return false; //avoid scrolling of the page on anchor click }); - //set the title text width. This method - var w = tText.parent().width(); - w-=tText.outerWidth(true)-tText.width(); //so we consider also tText margin border and padding - var space = w-this.e_indexLabel.outerWidth(true) - this.e_offsetLabel.outerWidth(true) - - this.e_editButton.outerWidth(true) - this.e_deleteButton.outerWidth(true); - tText.css('width',space+'px'); - //} - if(!marker.isSaved){ + + if(isEditing){ this.e_editButton.trigger('click'); + //which also calls this.updateTitleWidth(); + }else{ + this.updateTitleWidth(); } }, + updateTitleWidth: function(tText){ + if(!(tText)){ + tText = this.e_titleText; + } + if(tText){ + var w = tText.parent().width(); + w-=tText.outerWidth(true)-tText.width(); //so we consider also tText margin border and padding + var space = w + - (this.e_indexLabel.is(':visible') ? this.e_indexLabel.outerWidth(true) : 0) + - (this.e_offsetLabel.is(':visible') ? this.e_offsetLabel.outerWidth(true) : 0) + - (this.e_editButton.is(':visible') ? this.e_editButton.outerWidth(true) : 0) + - (this.e_deleteButton.is(':visible') ? this.e_deleteButton.outerWidth(true) : 0); + tText.css('width',space+'px'); + } + }, + remove: function(){ this.me.remove(); this.e_indexLabel = null; diff --git a/telemeta/htdocs/timeside/src/markermap.js b/telemeta/htdocs/timeside/src/markermap.js index 6bf72896..1ddc16b9 100644 --- a/telemeta/htdocs/timeside/src/markermap.js +++ b/telemeta/htdocs/timeside/src/markermap.js @@ -61,19 +61,19 @@ TimeSide(function($N, $J) { title: argument.title, author: argument.author, isEditable: editable, - isSaved: true - + isSavedOnServer: true, + isModified:false }; }else if(typeof argument == 'number'){ marker = { - id: undefined, //before was: this.uniqid(), - //now an undefined id means: not saved on server (see sendHTTP below) + id: this.uniqid(), offset: parseFloat(argument), desc: "", title: "", author: CURRENT_USER_NAME, isEditable: true, - isSaved: false + isSavedOnServer: false, + isModified: true }; } return marker; @@ -83,7 +83,7 @@ TimeSide(function($N, $J) { remove: function(index) { var marker = this.get(index); if (marker) { - if(marker.id!==undefined){ + if(marker.isSavedOnServer){ this.removeHTTP(marker); } this.markers.splice(index, 1); @@ -101,7 +101,7 @@ TimeSide(function($N, $J) { var marker = this.markers[realIndex]; marker.offset = newOffset; - marker.isSaved = marker.isEditable ? false : true; + marker.isModified = true; this.fire('moved', { fromIndex: markerIndex, @@ -109,27 +109,7 @@ TimeSide(function($N, $J) { newIndex: realIndex }); -// var newIndex = this.indexOf(newOffset); -// -// //if we moved left to right, the insertion index is actually -// //newIndex-1, as we must also consider to remove the current index markerIndex, so: -// if(newIndex>markerIndex){ -// newIndex--; -// } -// //this way, we are sure that if markerIndex==newIndex we do not have to move, -// //and we can safely first remove the marker then add it at the newIndex without -// //checking if we moved left to right or right to left -// var marker = this.markers[markerIndex]; -// marker.offset = newOffset; -// marker.isSaved = marker.isEditable ? false : true; -// if(newIndex != markerIndex){ -// this.markers.splice(markerIndex,1); -// this.markers.splice(newIndex,0,marker); -// } -// this.fire('moved', { -// fromIndex: markerIndex, -// toIndex: newIndex -// }); + }, // //The core search index function: returns insertionIndex if object is found according to comparatorFunction, @@ -197,11 +177,8 @@ TimeSide(function($N, $J) { // var data2send = '{"id":"jsonrpc", "params":[{"item_id":"'+ itemid+'", "public_id": "'+marker.id+'", "time": "'+ // marker.offset+'","description": "'+marker.desc+'"}], "method":"telemeta.add_marker","jsonrpc":"1.0"}'; - var id = marker.id; - var isSaved = id !== undefined; - if(!isSaved){ - id=this.uniqid(); //defined in core; - } + + var isSaved = marker.isSavedOnServer; var method = isSaved ? "telemeta.update_marker" : "telemeta.add_marker"; var s = this.jsonify; @@ -212,7 +189,7 @@ TimeSide(function($N, $J) { offset = "0.0"; } var data2send = '{"id":"jsonrpc", "params":[{"item_id":"'+ s(itemid)+ - '", "public_id": "'+s(id)+'", "time": "'+s(offset)+ + '", "public_id": "'+s(marker.id)+'", "time": "'+s(offset)+ '", "author": "'+s(marker.author)+ '", "title": "'+s(marker.title)+ '","description": "'+s(marker.desc)+'"}], "method":"'+method+'","jsonrpc":"1.0"}'; @@ -224,8 +201,8 @@ TimeSide(function($N, $J) { data: data2send, success: function(){ if(!isSaved){ - marker.id=id; - marker.isSaved = true; + marker.isSavedOnServer = true; + marker.isModified = false; } if(functionOnSuccess){ functionOnSuccess(); diff --git a/telemeta/htdocs/timeside/src/ruler.js b/telemeta/htdocs/timeside/src/ruler.js index 0844ba23..b624c679 100644 --- a/telemeta/htdocs/timeside/src/ruler.js +++ b/telemeta/htdocs/timeside/src/ruler.js @@ -460,23 +460,4 @@ TimeSide(function($N, $J) { }); -// _onMapRemove: function(e, data) { - // $J(this.markers).each(this.attach(function(i, m) { - // if (m.id == data.marker.id) { - // m.clear(); - // this.markers.splice(i, 1); - // } - // })); - // }, - // onMapMove: function(fromIndex, toIndex) { - // var min = Math.min(fromIndex, toIndex); - // var max = Math.max(fromIndex, toIndex); - // this.updateMarkerIndices(min,max); - //// $J(this.markers).each(this.attach(function(i, m) { - //// if (m.id == data.marker.id) { - //// m.setText(data.index + 1); - //// return false; - //// } - //// })); - // }, diff --git a/telemeta/htdocs/timeside/src/util.js b/telemeta/htdocs/timeside/src/util.js index 2b7c8009..66841988 100755 --- a/telemeta/htdocs/timeside/src/util.js +++ b/telemeta/htdocs/timeside/src/util.js @@ -84,7 +84,7 @@ TimeSide(function($N, $J) { var tabHeight = '3.5ex'; //height for the tab. Must be lower than tabContainerHeight var tabPaddingTop ='.8ex'; //padding top of each tab. Increasing it will increase also the tab height, so //compensate by decreasing tabHeight, in case. In any case, must be lower or equal to tabContainerHeight-tabHeight - var tabWidth = '10ex'; //width of each tab. Each tab from index 1 to n will be at left=n*tabWidth + var tabWidth = '12ex'; //width of each tab. Each tab from index 1 to n will be at left=n*tabWidth var tabBottom ='-1px'; //bottom of each tab. Must be equal and opposite to the border of the div below the tab //retrieve tab container: diff --git a/telemeta/templates/telemeta_default/base.html b/telemeta/templates/telemeta_default/base.html index 67d8c736..03d25e45 100644 --- a/telemeta/templates/telemeta_default/base.html +++ b/telemeta/templates/telemeta_default/base.html @@ -50,9 +50,11 @@
diff --git a/telemeta/templates/telemeta_default/geo_continents.html b/telemeta/templates/telemeta_default/geo_continents.html index ad54a2cb..c7720afb 100644 --- a/telemeta/templates/telemeta_default/geo_continents.html +++ b/telemeta/templates/telemeta_default/geo_continents.html @@ -18,8 +18,10 @@ var resourceMap = new ResourceMap('.continents', { {% block submenu %}
- {% trans "Map" %} | - {% trans "List" %} + {% if continents %} + {% trans "Map" %} | + {% trans "List" %} + {% endif %}
{% endblock %} {% block content %} diff --git a/telemeta/templates/telemeta_default/login.html b/telemeta/templates/telemeta_default/login.html index 5be82a99..1569d0b3 100644 --- a/telemeta/templates/telemeta_default/login.html +++ b/telemeta/templates/telemeta_default/login.html @@ -8,7 +8,7 @@ {% endif %} - -- 2.39.5