]> git.parisson.com Git - telemeta.git/commitdiff
updated some playlist utilities
authorriccardo <riccardo@parisson.com>
Wed, 11 May 2011 10:42:52 +0000 (12:42 +0200)
committerriccardo <riccardo@parisson.com>
Wed, 11 May 2011 10:42:52 +0000 (12:42 +0200)
telemeta/htdocs/timeside/src/divmarker.js
telemeta/htdocs/timeside/src/playlist.js
telemeta/templates/telemeta_default/collection_detail.html
telemeta/templates/telemeta_default/mediaitem_detail.html

index 038d1217852fa4374aa48be81e486aefb194befc..99cda9472d4991d38976de541f9fd31fab2e58a1 100644 (file)
@@ -5,6 +5,9 @@
  * License: GNU General Public License version 2.0
  */
 
+/**
+ * Class for showing/editing a marker on details. 
+ */
 var MarkerMapDiv = TimesideArray.extend({
     init:function(){
         this._super();
@@ -254,8 +257,7 @@ var MarkerMapDiv = TimesideArray.extend({
         })
 
         e_addplaylistButton.unbind('click').bind('click',function(evtObj_){
-            playlistUtils.showAddToPlaylist(e_addplaylistButton,'marker',""+marker.id,gettrans('marker added to the selected playlist'));
-            //playlistUtils.showPopupAddToPlaylist(evtObj_,'marker',""+marker.id,gettrans('marker added to the selected playlist'));
+            playlistUtils.showAddResourceToPlaylist(e_addplaylistButton,'marker',""+marker.id,gettrans('marker added to the selected playlist'));
             return false;
         });
 
index ed320d9e64e500decad25083d469e0d18328c2e7..a68ddd4c96ad96de833172df6886bec09936277a 100644 (file)
@@ -34,51 +34,6 @@ var playlistUtils = {
         });
     },
 
-    
-    /*shows the popup for adding an item to the playlist*/
-    showAddToPlaylist: function(anchorElement,resourceType,objectId, optionalOkMessage){
-        var ar = [];
-        var playlists = this.playlists;
-        for(var i=0; i< playlists.length; i++){
-            ar.push({
-                'html':playlists[i].name,
-                'class':"component_icon list_item icon_playlist"
-            });
-        }
-        if(!ar.length){
-            return;
-        }
-        var addFcn = this.addToPlaylist;
-        new PopupDiv({
-            invoker:anchorElement,
-            content: ar,
-            ok:function(data){
-                var val = data.selIndex;
-                consolelog(data);
-                var callbackok = undefined;
-                if(optionalOkMessage){
-                    callbackok = function(){
-                        var p =new PopupDiv({
-                            content : "<div class='component_icon icon_ok'>"+optionalOkMessage+"</div>",
-                            focusable: false
-
-                        });
-                        p.bind('show', function(){
-                            this.closeLater(1500);
-                        });
-                        p.show();
-                    }
-                }
-                addFcn(playlists[val].id,resourceType,objectId,callbackok);
-                
-                
-            }
-        }).show();
-
-    },
-
-
-
     showAdd: function(anchorElement){
 
         var t = gettrans('title');
@@ -109,7 +64,7 @@ var playlistUtils = {
     add : function(dictionary){
 
         if(dictionary.public_id===undefined){
-            dictionary.public_id = uniqid();
+            dictionary.public_id = uniqid(); //defined in application.js
         }
         if(dictionary.user===undefined){
             dictionary.user = CURRENT_USER_NAME;
@@ -132,9 +87,53 @@ var playlistUtils = {
             window.location.reload();
         });
     },
-    
+
+
+    /*shows the popup for adding a resource to a playlist*/
+    showAddResourceToPlaylist: function(anchorElement,resourceType,objectId, optionalOkMessage){
+        var ar = [];
+        var playlists = this.playlists;
+        for(var i=0; i< playlists.length; i++){
+            ar.push({
+                'html':playlists[i].name,
+                'class':"component_icon list_item icon_playlist"
+            });
+        }
+        if(!ar.length){
+            return;
+        }
+        var addFcn = this.addResourceToPlaylist;
+        new PopupDiv({
+            invoker:anchorElement,
+            content: ar,
+            ok:function(data){
+                var val = data.selIndex;
+                consolelog(data);
+                var callbackok = undefined;
+                if(optionalOkMessage){
+                    callbackok = function(){
+                        var p =new PopupDiv({
+                            content : "<div class='component_icon icon_ok'>"+optionalOkMessage+"</div>",
+                            focusable: false
+
+                        });
+                        p.bind('show', function(){
+                            this.closeLater(1500); //this refers to p
+                        });
+                        p.show();
+                    }
+                }
+                addFcn(playlists[val].id,resourceType,objectId,callbackok);
+
+
+            }
+        }).show();
+
+    },
+
     //resourceType can be: 'collection', 'item', 'marker'
-    addToPlaylist: function(playlistId,resourceType,objectId, callbackOnSuccess,callbackOnError){
+    //addResource RENAME TODO!!!!
+    addResourceToPlaylist: function(playlistId,resourceType,objectId, callbackOnSuccess,callbackOnError){
         consolelog(playlistId)
         var send = {
             'public_id':uniqid(),
index de882e2cf423556db93de1b146a5bd63de49fd29..7a086ec0fdac9896a65750f9c4774a663303c43b 100644 (file)
@@ -19,8 +19,8 @@
         {% if collection %}
         var anchor = jQuery('#_add_to_playlist');
         if(anchor.length){
-        anchor.click(function(evtObj_){
-            p.showPopupAddToPlaylist(evtObj_,'collection','{{collection.public_id}}',gettrans('collection added to the selected playlist'));return false;
+        anchor.click(function(){
+            p.showAddResourceToPlaylist(anchor,'collection','{{collection.public_id}}',gettrans('collection added to the selected playlist'));return false;
         });
         }
         {% endif %}
index 7b649da441676403feff727319cbfeb60dad7912..067db0e097ce0de00ce937ffd93b410f931f2466 100644 (file)
@@ -36,7 +36,7 @@
         var anchor = jQuery('#_add_to_playlist');
         if(anchor.length){
             anchor.unbind('click').click(function(){
-                p.showAddToPlaylist(anchor,'item','{{item.public_id}}',gettrans('item added to the selected playlist'));
+                p.showAddResourceToPlaylist(anchor,'item','{{item.public_id}}',gettrans('item added to the selected playlist'));
                 return false;
             });
         }