}\r
}\r
\r
-function PopupUtils(){\r
- var $J= jQuery;\r
- var wdow = $J(window); //reference the window object (doing it once speeds up a bit performances)\r
- var doc = $J(document);\r
- var screenRect = function(){\r
- return {\r
- x:wdow.scrollLeft(),\r
- y:wdow.scrollTop(),\r
- width:wdow.width(),\r
- height:wdow.height()\r
- };\r
- };\r
- \r
-\r
- /**\r
- * sets dialogDiv (a jQuery object or a DivDialog, see below) as popup mode. In other words,\r
- * scans each sub-element of dialogDiv and assigns to it a onblur event: when the subselemnt looses the focus and the focus\r
- * is NOT given to another dialogDiv subelement, hides or removes (depending on removeOnHide param) dialogDiv.\r
- * The workaround is quite tricky and maybe not well formed, as it uses a timeout function. However, any other implementation was trickier\r
- * and with potential drawbacks. Note that any subelement of dialogDiv is assigned a "focus" attribute with the current time in millisecs\r
- */\r
- // var setAsPopup = function(dialogDiv, removeOnHide){\r
- // dialogDiv.setAsPopup(removeOnHide ? function(){dialogDiv.remove();} : function(){dialogDiv.hide();});\r
- // };\r
-\r
- this.bindClickToPopup = function(invokerAsJQueryObj, popupContent){\r
- var p = new DivDialog(popupContent);\r
- var oldShow = p.show;\r
- // var pint = parseInt;\r
- p.show = function(){\r
-\r
- var rect = screenRect();\r
- var offs = invokerAsJQueryObj.offset();\r
- var height = invokerAsJQueryObj.outerHeight();\r
-\r
- var spaceAbove = offs.top - rect.y;\r
- var spaceBelow = rect.height - height - spaceAbove;\r
-\r
- // consolelog('wHeight:'+rect.height+ ' space above: '+spaceAbove + ' spacebelow: '+spaceBelow);\r
-\r
- if(spaceAbove>spaceBelow){\r
- p.css({\r
- 'maxHeight':(spaceAbove-p.shadowoffset)+'px',\r
- 'top':rect.y+'px'\r
- });\r
- }else{\r
- p.css({\r
- 'maxHeight':(spaceBelow-p.shadowoffset)+'px',\r
- 'top':(offs.top+height)+'px'\r
- });\r
- }\r
- p.css({\r
- 'height':'auto',\r
- 'width' :'auto',\r
- 'maxWidth': (rect.x+rect.width-offs.left)+'px'\r
- });\r
-\r
- //consolelog("size"); consolelog(size);\r
- // p.offset({\r
- // left: rect.x + pint((rect.width-size.width)/2),\r
- // top: rect.y + pint((rect.height-size.height)/2)\r
- // });\r
- //consolelog("offset"); consolelog({\r
- // left: rect.x + pint((rect.width-size.width)/2),\r
- // top: rect.y + pint((rect.height-size.height)/2)\r
- // });\r
-\r
- oldShow.apply(p,arguments);\r
- p.refreshShadowPosition();\r
- p.setFocus();\r
- };\r
- //consolelog(invokerAsJQueryObj);\r
- p.css({\r
- 'minWidth':invokerAsJQueryObj.outerWidth()+'px',\r
- 'left':invokerAsJQueryObj.offset().left+'px'\r
- });\r
-\r
- p.setPopupFocus(function(){\r
- p.hide();\r
- });\r
-\r
- invokerAsJQueryObj.unbind('click').click(function(evt){\r
- p.show();\r
- return false;\r
- });\r
- //p.show();\r
- //p.setFocus();\r
- }\r
- /**\r
- * Shows an info dialog centered in screeen. The dialog is a DivDialog with maxwidth and maxheight equals to the half of the\r
- * visible window width and height, respectively. Content can be a jQuery object (ie an array of html elements) or a string\r
- * denoting the innerHTML of the dialog div. timeInMsec can be:\r
- * a number (in msec) specifying after how much time the dialog will be removed (for fast messages)\r
- * the string 'hide' to specify that the div will be hidden when it looses focus\r
- * the string 'remove' to specify that the div will be removed when it looses the focus\r
- *\r
- */\r
- this.showInfoDialog = function(content, timeInMsec){\r
- var p = new DivDialog(content);\r
- var oldShow = p.show;\r
- var pint = parseInt;\r
- p.show = function(){\r
- oldShow.apply(p,arguments);\r
- var rect = screenRect();\r
- // var pint = parseInt;\r
- // p.css({\r
- // 'maxWidth':pint(rect.width/2)+'px',\r
- // 'maxHeight':pint(rect.height/2)+'px'\r
- // });\r
- //consolelog("screeenrect"); consolelog(rect);\r
- var size = p.size();\r
- //consolelog("size"); consolelog(size);\r
- p.offset({\r
- left: rect.x + pint((rect.width-size.width)/2),\r
- top: rect.y + pint((rect.height-size.height)/2)\r
- });\r
- //consolelog("offset"); consolelog({\r
- // left: rect.x + pint((rect.width-size.width)/2),\r
- // top: rect.y + pint((rect.height-size.height)/2)\r
- // });\r
-\r
- p.refreshShadowPosition();\r
-\r
- };\r
- var rect = screenRect();\r
- p.css({\r
- 'maxWidth':pint(rect.width/2)+'px',\r
- 'maxHeight':pint(rect.height/2)+'px'\r
- });\r
- \r
- if(typeof timeInMsec == 'number'){ //set a timeout\r
- setTimeout(function(){\r
- p.remove();\r
- p=null;\r
- },timeInMsec);\r
- }else if(timeInMsec == 'hide'){ //is a boolean\r
- p.setPopupFocus(function(){\r
- p.hide();\r
- });\r
- }else if(timeInMsec == 'remove'){ //is a boolean\r
- p.setPopupFocus(function(){\r
- p.remove();\r
- });\r
- }\r
- p.show();\r
- p.setFocus();\r
- };\r
-}\r
-\r
-//content: string or jQueryElement\r
-//type 'popup',\r
-//DivDialog(content,type,attributes)\r
-\r
-var pppUtils = new PopupUtils();\r
-function DivDialog(content){\r
- var $J = jQuery;\r
- var doc = $J(document);\r
- var firstFocusableElement = undefined; //set in focusout\r
- var className = 'component';\r
- var basecss = {\r
- 'position':'absolute',\r
- 'display':'none'\r
- };\r
- var popup = $J('<div/>').addClass(className).css(basecss).css({\r
- 'zIndex':1000\r
- });\r
- var popupContent = $J('<div/>').css({\r
- 'overflow':'auto'\r
- });\r
- \r
- var popupshadow = popup.clone(true,true).removeAttr('id').empty().css({\r
- 'backgroundColor':'#000',\r
- 'border':'0px',\r
- 'zIndex':900,\r
- 'margin':'0px',\r
- 'padding':'0px'\r
- }).fadeTo(0,0.4);\r
- var both = popup.add(popupshadow);\r
-\r
-\r
- if(content){\r
- if(content instanceof $J){\r
- popupContent.empty().append(content);\r
- }else{\r
- popupContent.html(content);\r
- }\r
- }\r
- popup.append(popupContent);\r
-\r
-\r
-\r
- // if(invoker.is('a') || invoker.is('input[type=button]') || invoker.is('button') ||\r
- // invoker.is('input[type=submit]')){\r
- // var w = invoker.outerWidth();\r
- // popup.css({'minWidth':w+'px'});\r
- // this.show = show1();\r
- // }else{\r
- //\r
- // }\r
-\r
- this.maxSize = function(size){\r
- popup.css({\r
- 'maxHeight':size.height,\r
- 'maxWidth':size.width\r
- });\r
- popupContent.css({\r
- 'maxHeight':size.height-(popup.outerHeight()-popup.height()),\r
- 'maxWidth':size.width-(popup.outerWidth()-popup.width())\r
- });\r
- };\r
- this.minsize = function(size){\r
- popup.css({\r
- 'minHeight':size.height,\r
- 'minWidth':size.width\r
- });\r
- };\r
- this.offset = function(){\r
- var ret = popup.offset.apply(popup,arguments);\r
- //refreshPosition();\r
- return me;\r
- };\r
-\r
- //function (private) to refresh shadow position\r
- this.shadowoffset = 5;\r
- this.size = function(){\r
- return {\r
- width: popup.outerWidth(),\r
- height:popup.outerHeight()\r
- };\r
- };\r
-\r
-\r
-\r
- this.refreshShadowPosition = function(){\r
- if(!popup.is(":visible")){\r
- popupshadow.hide(); //to be sure\r
- return;\r
- }else{\r
- popupshadow.show();\r
- }\r
- var offs = popup.offset();\r
- offs.top+=this.shadowoffset;\r
- offs.left+=this.shadowoffset;\r
- popupshadow.offset(offs);\r
- popupshadow.css({\r
- 'width':popup.outerWidth()+'px',\r
- 'height':popup.outerHeight()+'px'\r
- });\r
- popupContent.css({\r
- 'maxWidth': (parseInt(popup.css('maxWidth')) -(popupContent.outerWidth()-popupContent.width())) +'px',\r
- 'maxHeight':(parseInt(popup.css('maxHeight'))-(popupContent.outerHeight()-popupContent.height()))+'px'\r
- });\r
- };\r
-\r
- //dummy overriding of some jquery functions\r
- var me = this;\r
- this.remove = function(){\r
- both.empty();\r
- both.remove.apply(both,arguments);\r
- return me;\r
- };\r
- this.find = function(){\r
- return popupContent.find.apply(popupContent,arguments);\r
- };\r
- this.hide = function(){\r
- return both.hide.apply(both,arguments);\r
- return me;\r
- };\r
- \r
- this.show = function(){\r
- if(!(popup.parent().length)){\r
- $J('body').append(both);\r
- }\r
- var ret = popup.show.apply(popup,arguments);\r
- //refreshPosition();\r
- return me;\r
- };\r
-\r
- this.setFocus = function(){\r
- if(firstFocusableElement && firstFocusableElement.parent().length && firstFocusableElement.is(':visible')){\r
- firstFocusableElement.focus();\r
- }\r
- }\r
- //popup specific functions\r
-\r
- //set css: note that margin position and zIndex will be overridden\r
- this.css = function(){\r
- var arg = arguments;\r
- if(arguments.length==2){ //setting a single css element\r
- if(arguments[0] == 'margin' || arguments[0] == 'position' || arguments[0] == 'zIndex'){\r
- return me;\r
- }\r
- }else if(arguments.length==1){ //single argument\r
- if(typeof arguments[0] == 'string'){\r
- return popup.css(arguments[0]);\r
- }else{\r
- var a = arguments[0];\r
- for(var k in a){\r
- if(k == 'margin' || k == 'position' || k == 'zIndex'){\r
- delete a[k];\r
- }\r
- }\r
- arg = [a];\r
- // consolelog('css');\r
- // consolelog(arg);\r
- }\r
- }else{\r
- return me;\r
- }\r
- var ret = popup.css.apply(popup,arg);\r
- //refreshPosition();\r
- return me;\r
- };\r
-\r
-\r
-\r
- // this.bindAsPopupFor = function(jQueryAnchorElement){\r
- // if(!jQueryAnchorElement.attr('id')){\r
- // jQueryAnchorElement.attr('id','popup_'+new Date().getTime());\r
- // }\r
- // var id = jQueryAnchorElement.attr('id');\r
- //\r
- // anchorElement.click(function(){\r
- //\r
- // })\r
- //\r
- // }\r
- \r
- this.setPopupFocus = function(callbackOnFocusLost){\r
- \r
- //find all foccusable elements\r
- var elementsWithFocus = $J(popupContent).find('textarea,a,input');\r
- //focus must be given also to the containing popup beacuse\r
- //if a scrollbar is present, moving the scrollbar sets the focus to popup (not popupContent. So\r
- //apparently even if the scrollbar is caused by css 'popupContent.scroll=auto', it's like if it was\r
- //'part' of the parent container popup)\r
- //TODO: TEST IT WITH OTHER BROWSERS!!!! if not working, manda tutto affanculo and use click events\r
- popup.attr('tabindex',1);\r
- elementsWithFocus = elementsWithFocus.add(popup);\r
- //build the attribute focus to recognize subelement of popup\r
- var focusid = 'popupfocus'+(new Date().getTime());\r
- //bind the blur to each focusable element:\r
- elementsWithFocus.each(function(i,e){\r
- var ee = $J(e);\r
- ee.attr(focusid,'true');\r
- ee.blur(function(){\r
- //wait 250msec to see if the focus has been given to another popup focusable element: if yes, do nothing\r
- //otherwise execute callback\r
- setTimeout(function(){\r
- var v = document.activeElement;\r
- // consolelog(v);\r
- if(v && $J(v).attr(focusid)){\r
- return;\r
- }\r
- callbackOnFocusLost();\r
- },200)\r
- }); //set here another time delay. 300 seems to be the good compromise between visual hide and safetiness that\r
- //meanwhile the focus has already been given to the next component\r
- });\r
- //set the first focusable element\r
- firstFocusableElement = $J(elementsWithFocus[0]);\r
- };\r
- \r
- this.attr = function(){\r
- var ret = popup.attr.apply(popup,arguments);\r
- //refreshPosition();\r
- return me;\r
- };\r
- this.html = function(){\r
- if(arguments.length==0){\r
- return popupContent.html();\r
- }\r
- var ret = popupContent.html.apply(popup,arguments);\r
- //refreshPosition();\r
- return me;\r
- }\r
- this.append = function(){\r
- var ret = popupContent.append.apply(popup,arguments);\r
- //refreshPosition();\r
- return me;\r
- }\r
-}\r
-//------------\r
-\r
-\r
-\r
-\r
\r
function PopupDiv(){\r
var $J = jQuery;\r
p.fadeOutTime = 0,\r
p.shadowOpacity = 0.3;\r
p.zIndex = 10000;\r
- p.listItemClass = '';\r
+ // p.listItemClass = '';\r
\r
p.getFormData = function(){\r
var elms = this.find('input,select,textarea');\r
var ret = {};\r
- consolelog(elms);\r
elms.each(function(i,e){\r
var ee = $(e);\r
var key = ee.attr('name');\r
return ret;\r
};\r
\r
+ p.closeLater = function(millseconds){\r
+ var me = this;\r
+ setTimeout(function(){ me.close();},millseconds);\r
+ },\r
+\r
//methods:\r
p.find = function(argumentAsInJQueryFind){\r
return $(this.getDiv().children()[1]).find(argumentAsInJQueryFind);\r
\r
p.trigger = function(eventName){\r
var listeners = this.getListeners();\r
+ var me = this;\r
if(eventName in listeners){\r
var callbacks = listeners[eventName];\r
var i = 0;\r
if(eventName == 'ok'){\r
var data = this.getFormData();\r
for(i=0; i<callbacks.length; i++){\r
- callbacks[i](data);\r
+ callbacks[i].apply(me,[data]);\r
}\r
if(arguments.length>1 && arguments[1]){\r
//workaround to remove listeners on close:\r
}\r
}else{\r
for(i=0; i<callbacks.length; i++){\r
- callbacks[i]();\r
+ callbacks[i].apply(me);\r
}\r
}\r
}\r
var container = $($(div).children()[1]);\r
//div.appendTo('body'); //necessary to properly display the div size\r
container.empty();\r
- consolelog('emptying');\r
+ \r
if(content instanceof $){\r
container.append(content);\r
}else if(content instanceof Array){\r
var jQ = $;\r
var me = this;\r
- var name = this.getListItemName();\r
- var input = $('<input/>').attr('type','hidden').attr('name','value');\r
- for(var h=0; h<content.length; h++){\r
- var a = $('<a/>').attr('href','#').attr('name',name).html(content[h]).click(function(){\r
- input.val(jQ(this).html());\r
+ //var name = this.getListItemName();\r
+ var input = $('<input/>').attr('type','hidden').attr('name','selIndex');\r
+ var setEvents = function(idx,anchor,input){\r
+ anchor.click(function(){\r
+ input.val(idx);\r
me.trigger('ok',true);\r
- }).focus(function(){ //focus because we need to\r
- input.val(jQ(this).html());\r
- });\r
+ return false;\r
+ }).focus(function(){ //focus because we need to get the value if ok is present\r
+ input.val(idx);\r
+ })\r
+ };\r
+ for(var h=0; h<content.length; h++){\r
+ var item = content[h];\r
+ var a = $('<a/>').attr('href','#');\r
+ if('class' in item){\r
+ a.addClass(item['class']);\r
+ }\r
+ if('html' in item){\r
+ a.html(item['html']);\r
+ }\r
+ if('name' in item){\r
+ a.attr('name', item['name']);\r
+ }\r
+ if('id' in item){\r
+ a.attr('id', item['id']);\r
+ }\r
+ if('css' in item){\r
+ a.css(item['css']);\r
+ }\r
+ a.css('display','block');\r
+ setEvents(h,a,input);\r
container.append(a);\r
}\r
container.append(input);\r
rightElements.css({\r
'width':Math.round((3/5)*Math.max(maxw[0], maxw[1]))+'em'\r
}); //might be zero if default values are all ""\r
+ }else{\r
+ container.append(""+content);\r
}\r
\r
};\r
\r
- \r
-\r
-// p.setInvoker = function(invoker){\r
-// var focusAttr = this.getFocusAttr();\r
-// var invk = this.invoker;\r
-// var clickNameSpace = "click."+this.getId();\r
-// if(this.isClickElement(invk)){\r
-// invk.unbind(clickNameSpace); //.removeAttr('tabindex').removeAttr(focusAttr);\r
-// }\r
-//\r
-// if(this.isClickElement(invoker)){\r
-// var me = this;\r
-// //me.setFocusable(true);\r
-// invoker.unbind(clickNameSpace).bind(clickNameSpace,function(evt){\r
-// //let the invoker have focus and let it be recognized as an element which does not blur the popup:\r
-// //invoker.attr('tabindex',0).attr(focusAttr,'true');\r
-// var popupDiv = me.getDiv();\r
-//\r
-// if(popupDiv.length && popupDiv.is(':visible')){\r
-// var v = me.getFirstFocusableElement();\r
-// if(v){\r
-// me.getFirstFocusableElement().focus();\r
-// }\r
-// return false;\r
-// }\r
-// me.show.apply(me);\r
-// return false;\r
-// });\r
-// }\r
-// if(!invoker || !(invoker instanceof $)){\r
-// delete this.invoker; //so we'll call the prorotype invoker\r
-// return;\r
-// }\r
-// this.invoker = invoker;\r
-// // invk = invoker;\r
-// }\r
-\r
-\r
p.setFocusCycleRoot = function(value){\r
//var value = this.focusable;\r
var popup = this.getDiv();\r
//otherwise execute callback\r
setTimeout(function(){\r
var v = doc_.activeElement;\r
- consolelog(v);\r
if(v && $(v).attr(focusAttr) || me.isClosing){\r
//if we are closing, we will call back this method which removes the focus attributes, bt meanwhile the\r
//timeout should execute\r
var div = this.getDiv();\r
var me = this;\r
\r
- \r
+ \r
var cssModified = (this.popupClass || this.popupCss);\r
if(this.popupClass){\r
//which might be the prototype\r
}\r
\r
//if we have elements of type listitem, add the specified class\r
- var name = this.getListItemName();\r
- var elms = this.find('a[name='+name+']');\r
- if(this.listItemClass){\r
- elms.removeClass().addClass(this.listItemClass);\r
- this.listItemClass = "";\r
- }\r
- elms.css('display','block');\r
+// var name = this.getListItemName();\r
+// var elms = this.find('a[name='+name+']');\r
+// if(this.listItemClass){\r
+// elms.removeClass().addClass(this.listItemClass);\r
+// this.listItemClass = "";\r
+// }\r
+// elms.css('display','block');\r
\r
\r
this.setFocusCycleRoot(this.focusable);\r
\r
\r
//set central div max height ONLY IF NECESSARY:\r
- var maxHeight = (div.height()-topDiv.outerHeight()-bottomDiv.outerHeight()-\r
+ var maxHeight = (div.height()-topDiv.outerHeight(true)-bottomDiv.outerHeight(true)-\r
(centralDiv.outerHeight(true)-centralDiv.height()));\r
var height = centralDiv.height();\r
if(sizeAsPopup && maxHeight<height){\r
\r
if(remove){\r
div.remove();\r
- \r
//this is because all bindings will be removed, including blur events\r
//we remove this.getFocusAttr() to reupdate focus cycle root when calling show again\r
}\r
return this.getId()+"_focus";\r
}\r
\r
- p.getListItemName = function(){\r
- return this.getId()+"_listitem";\r
- }\r
+// p.getListItemName = function(){\r
+// return this.getId()+"_listitem";\r
+// }\r
\r
\r
})(PopupDiv.prototype);\r
\r
//default PopupDiv properties in telemeta\r
-PopupDiv.listItemClass = 'component_icon list_item icon_playlist';\r
+//PopupDiv.listItemClass = 'component_icon list_item icon_playlist';\r
PopupDiv.shadowOffset = 4;\r
PopupDiv.popupClass = 'control component';\r
PopupDiv.popupCss = {\r
-
var playlistUtils = {
- playlists : {},
+ playlists : [],
addPlaylist: function(name, id){
- this.playlists[name]=id;
+ //this.playlists[name]=id;
+ this.playlists.push({
+ 'name':name,
+ 'id':id
+ });
},
-// /*shows the popup for adding an item to the playlist*/
-// showPopupAddToPlaylist: function(event,resourceType,objectId, optionalMessage){
-// var $J = jQuery;
-// var content = $J('<div/>').addClass("_popup_add_to_playlist");
-// var addToPlaylist = this.addToPlaylist;
-// for(var p in this.playlists){
-// var id = this.playlists[p];
-//
-// var a = $J('<a/>').
-// attr('href','#').
-// addClass("component_icon").
-// addClass("list_item icon_playlist").
-// html(p).
-// //by wrapping the addToPlaylist function in order to accept the id variable as an argument
-// //we avoid calling the function with id = number_of_playlists for all anchors
-// //by returning another function (basically create another closure) we avoid executing the function
-// //immediately
-// click(function(id_){
-// return function(){
-// addToPlaylist(id_,resourceType,objectId,optionalMessage);
-// return false;
-// }
-// }(id)
-// );
-// content.append(a);
-// }
-// return popup.show(content,event);
-// },
-
/*shows the popup for adding an item to the playlist*/
- showPopupAddToPlaylist: function(event,resourceType,objectId, optionalMessage){
- var $J = jQuery;
- var content = $J('<div/>').addClass("_popup_add_to_playlist");
- var addToPlaylist = this.addToPlaylist;
- for(var p in this.playlists){
- var id = this.playlists[p];
-
- var a = $J('<a/>').
- attr('href','#').
- addClass("component_icon").
- addClass("list_item icon_playlist").
- html(p).
- //by wrapping the addToPlaylist function in order to accept the id variable as an argument
- //we avoid calling the function with id = number_of_playlists for all anchors
- //by returning another function (basically create another closure) we avoid executing the function
- //immediately
- click(function(id_){
- return function(){
- addToPlaylist(id_,resourceType,objectId,optionalMessage);
- return false;
- }
- }(id)
- );
- content.append(a);
+ 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"
+ });
}
- return popup.show(content,event);
+ if(!ar.length){
+ return;
+ }
+ var addFcn = this.addToPlaylist;
+ new PopupDiv({
+ defaultCloseOperation: 'remove',
+ focusable:true,
+ 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>",
+ defaultCloseOperation: 'remove'
+
+ });
+ p.bind('show', function(){
+ this.closeLater(2500)
+ });
+ p.show();
+ }
+ }
+ addFcn(playlists[val].id,resourceType,objectId,callbackok);
+
+
+ }
+ }).show();
+
},
- bindToNewPlaylistAction: function(anchorElement){
- var t = gettrans('title');
+ showAdd: function(anchorElement){
+
+ var t = gettrans('title');
var d = gettrans('description');
var dd = {};
dd[t]='';
dd[d]='';
var playlist = this;
- var ppp_ = new PopupDiv({'content':dd,
- focusable:true, invoker:anchorElement, showclose:true, showok:true, ok:function(data){
- if(!data[t] && !data[d]){
- return;
- }
- //convert language
- playlist.add({'title':data[t],'description':data[d]});
- } });
-consolelog(anchorElement);
- anchorElement.unbind('click').click(function(){ppp_.show();});
-// p.okButtonTitle = 'A';
-// ppp_.show();
+ new PopupDiv({
+ 'content':dd,
+ focusable:true,
+ invoker:anchorElement,
+ defaultCloseOperation:'remove',
+ showclose:true,
+ showok:true,
+ ok:function(data){
+ if(!data[t] && !data[d]){
+ return;
+ }
+ //convert language
+ playlist.add({
+ 'title':data[t],
+ 'description':data[d]
+ });
+ }
+ }).show();
+
},
+
add : function(dictionary){
},
//resourceType can be: 'collection', 'item', 'marker'
- addToPlaylist: function(playlistId,resourceType,objectId, optionalOkMessage){
+ addToPlaylist: function(playlistId,resourceType,objectId, callbackOnSuccess,callbackOnError){
consolelog(playlistId)
var send = {
'public_id':uniqid(),
'resource_type':resourceType,
'resource_id':objectId
};
- json([playlistId,send],'telemeta.add_playlist_resource',function(){
- var p = popup;
- if(optionalOkMessage){
- p.show(jQuery('<div/>').addClass("icon_ok").addClass("component_icon").html(optionalOkMessage));
- setTimeout(function(){
- p.hide();
- },1000);
- }else{
- p.hide(); //to be sure
- }
- });
+ json([playlistId,send],'telemeta.add_playlist_resource',callbackOnSuccess,callbackOnError);
}