font-family: monospace;
margin-right:2ex;
}
+.markersdivIndexLabel span{
+ position:relative;
+ top:-2px;
+}
.markersdivOffset{
margin-right:1ex;
font-style: italic;
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,
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 <br> 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;
}
.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;
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');
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');
+}
//add all elements to header:
- this.e_header = $J('<div/>')
+ this.e_header = $J('<div/>').css('margin','1ex 0ex 0.5ex 0ex')
.append(this.e_indexLabel)
.append(this.e_offsetLabel)
.append(this.e_titleText)
//ok button
this.e_okButton = $J('<a/>')
.attr('title','save marker description and offset')
- .addClass('roundBorder6')
.addClass('markersdivSave')
.attr("href","#")
.html("OK");
markerDiv = $J('<div/>')
.append(this.e_header)
.append(this.e_descriptionText)
- .append(this.e_okButton)
+ //.append(this.e_okButton)
+ .append($J('<div/>').css('margin','1ex 0ex 1ex 0ex').append(this.e_okButton))
.addClass('roundBorder8')
.addClass('markerdiv');
+
+ //set default visibility
+
}
return markerDiv;
},
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("<span>"+(index+1)+"</span>");
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
//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
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
});
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;
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;
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);
var marker = this.markers[realIndex];
marker.offset = newOffset;
- marker.isSaved = marker.isEditable ? false : true;
+ marker.isModified = true;
this.fire('moved', {
fromIndex: markerIndex,
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,
// 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;
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"}';
data: data2send,
success: function(){
if(!isSaved){
- marker.id=id;
- marker.isSaved = true;
+ marker.isSavedOnServer = true;
+ marker.isModified = false;
}
if(functionOnSuccess){
functionOnSuccess();
});
-// _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;
- //// }
- //// }));
- // },
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:
</div>
<div id="quick_search">
-<form action="{% url telemeta-search %}" method="GET">
+<form action="{% url telemeta-search %}" id="_quickSearchForm" method="GET">
<input type="text" id="quick_search_pattern" name="pattern" />
-<input type="submit" value="{% trans 'Search' %}" />
+<!--<input type="submit" value="{% trans 'Search' %}" />-->
+<a href="#" class="mediaitem_button mediaitem_button_no_icon"
+ onclick="document.getElementById('_quickSearchForm').submit(); return false;">{% trans "Search" %}</a>
</form>
</div>
{% block submenu %}
<div>
- <a href="#" onclick="resourceMap.toggle('map'); return false;">{% trans "Map" %}</a> |
- <a href="#" onclick="resourceMap.toggle('list'); return false;">{% trans "List" %}</a>
+ {% if continents %}
+ <a href="#" onclick="resourceMap.toggle('map'); return false;" class="mediaitem_button mediaitem_button_no_icon">{% trans "Map" %}</a> |
+ <a href="#" onclick="resourceMap.toggle('list'); return false;" class="mediaitem_button mediaitem_button_no_icon">{% trans "List" %}</a>
+ {% endif %}
</div>
{% endblock %}
{% block content %}
<p class="login-error">{% trans "Your username and password didn't match. Please try again." %}</p>
{% endif %}
-<form class="login" method="post" action="{% url telemeta-login %}">{% csrf_token %}
+<form class="login" id="_loginForm" method="post" action="{% url telemeta-login %}">{% csrf_token %}
<p>
{{ form.username.label_tag }}
{{ form.username }}<br />
{{ form.password }}
</p>
-<input class="submit" type="submit" value="{% trans "Sign in" %}"/>
+<a href="#" class="mediaitem_button mediaitem_button_login"
+ onclick="document.getElementById('_loginForm').submit(); return false;">{% trans "Sign in" %}</a>
+<!--<input class="submit" type="submit" value="{% trans "Sign in" %}"/>-->
<input type="hidden" name="next" value="{{ next }}" />
</form>