]> git.parisson.com Git - telemeta.git/commitdiff
fixed some bugs
authorriccardo <riccardo@parisson.com>
Wed, 16 Mar 2011 14:48:06 +0000 (15:48 +0100)
committerriccardo <riccardo@parisson.com>
Wed, 16 Mar 2011 14:48:06 +0000 (15:48 +0100)
: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
telemeta/htdocs/images/find.png [new file with mode: 0644]
telemeta/htdocs/images/password.png [new file with mode: 0644]
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

index 90aa07c7e16b0a4a4fd705ba6bcb053a20d3ca0a..98b429044f6880f66dca063118023860022e4bb3 100644 (file)
@@ -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 <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;
 }
@@ -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 (file)
index 0000000..943e00b
Binary files /dev/null and b/telemeta/htdocs/images/find.png differ
diff --git a/telemeta/htdocs/images/password.png b/telemeta/htdocs/images/password.png
new file mode 100644 (file)
index 0000000..192b6f7
Binary files /dev/null and b/telemeta/htdocs/images/password.png differ
index 6d9cff5880ed8a2e335ace38de15261f99b72259..4d56b84a734abab8fec9ed21dd5604e578b17380 100644 (file)
@@ -79,7 +79,7 @@ TimeSide(function($N, $J) {
                                 
 
                 //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)
@@ -93,7 +93,6 @@ TimeSide(function($N, $J) {
                 //ok button
                 this.e_okButton = $J('<a/>')
                 .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('<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;
         },
@@ -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("<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
@@ -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;
index 6bf72896c0e14292573025d7f4c6cd0bf0265c87..1ddc16b937db8160ac1b5d5c61e0bf99166fdb57 100644 (file)
@@ -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();
index 0844ba23a1b62f05cf81df343b1d61e02e7156de..b624c6797394fa6a1d7ba7706971d6e0a05ca2f7 100644 (file)
@@ -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;
-        ////                }
-        ////            }));
-        //        },
index 2b7c800985d559fe8a01bfa8a397d13f213618a9..668419887b4269fc667c62b81aeccc66dddcfaa7 100755 (executable)
@@ -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:
index 67d8c736b02ef2a4a66e98c7cbff1406c9c87b0c..03d25e45ef2de623549770caaf4ed9c665a18b1f 100644 (file)
 </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>
 
index ad54a2cbb558e8538eb85f9e9fd157b968129bf3..c7720afb0033581ecc094a878a858200a10f798d 100644 (file)
@@ -18,8 +18,10 @@ var resourceMap = new ResourceMap('.continents', {
 
 {% 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 %}
index 5be82a9940e0dcaf564cf1652f52781d6a7c5f93..1569d0b3b5da428dbd523f255dace450e6c6e9da 100644 (file)
@@ -8,7 +8,7 @@
 <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 />
@@ -17,7 +17,9 @@
 {{ 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>