From 784aa2c82fe0e998da52fa99f02a305afb1abc04 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Thu, 3 Mar 2016 14:10:08 +0000 Subject: [PATCH] Mobile theme W.I.P: - Fix view mode loads with wrong context - Fix mail view actions --- etemplate/js/etemplate2.js | 4 +- etemplate/js/etemplate2.min.js | 8 +- etemplate/js/etemplate2.min.js.map | 2 +- mail/inc/class.mail_ui.inc.php | 10 +- mail/js/app.js | 64 +++++++--- mail/js/app.min.js | 8 +- mail/js/app.min.js.map | 2 +- mail/templates/mobile/app.css | 3 - mail/templates/mobile/app.less | 1 - phpgwapi/js/jquery/etherpad/README.md | 48 ++++++++ .../js/jquery/etherpad/etherpad.jquery.json | 25 ++++ phpgwapi/js/jquery/etherpad/index.html | 67 +++++++++++ phpgwapi/js/jquery/etherpad/js/etherpad.js | 113 ++++++++++++++++++ phpgwapi/js/jsapi.min.js | 18 +-- phpgwapi/js/jsapi.min.js.map | 2 +- phpgwapi/js/jsapi/app_base.js | 89 ++++++++------ 16 files changed, 381 insertions(+), 83 deletions(-) create mode 100644 phpgwapi/js/jquery/etherpad/README.md create mode 100644 phpgwapi/js/jquery/etherpad/etherpad.jquery.json create mode 100644 phpgwapi/js/jquery/etherpad/index.html create mode 100644 phpgwapi/js/jquery/etherpad/js/etherpad.js diff --git a/etemplate/js/etemplate2.js b/etemplate/js/etemplate2.js index 9d16a38a0d..acd13b1207 100644 --- a/etemplate/js/etemplate2.js +++ b/etemplate/js/etemplate2.js @@ -332,9 +332,11 @@ etemplate2.prototype.download = function(_url) * @param {string} _url url to load template * @param {object} _data object with attributes content, langRequire, etemplate_exec_id, ... * @param {function} _callback called after tempalte is loaded + * @param {object} _app local app object */ -etemplate2.prototype.load = function(_name, _url, _data, _callback) +etemplate2.prototype.load = function(_name, _url, _data, _callback, _app) { + var app = _app || window.app; this.name = _name; // store top-level template name to have it available in widgets // store template base url, in case initial template is loaded via webdav, to use that for further loads too // need to split off domain first, as it could contain app-name part of template eg. stylite.report.xet and https://my.stylite.de/egw/... diff --git a/etemplate/js/etemplate2.min.js b/etemplate/js/etemplate2.min.js index f829ec7da7..5749309afa 100644 --- a/etemplate/js/etemplate2.min.js +++ b/etemplate/js/etemplate2.min.js @@ -3,7 +3,7 @@ * * full sources are available under https://svn.stylite.de/viewvc/egroupware/ * - * build Wed Mar 02 2016 15:23:55 + * build Thu Mar 03 2016 15:04:04 */ function et2_loadXMLFromURL(_url,_callback,_context){"undefined"==typeof _context&&(_context=null);var win;try{opener&&opener.etemplate2&&(win=opener)}catch(e){}"undefined"==typeof win&&(win=top),win.jQuery.ajax({url:_url,context:_context,type:"GET",dataType:"xml",success:function(_data,_status,_xmlhttp){_callback.call(_context,_data.documentElement)},error:function(_xmlhttp,_err){egw().debug("error","Loading eTemplate from "+_url+" failed! "+_xmlhttp.status+" "+_xmlhttp.statusText)}})}function et2_directChildrenByTagName(_node,_tagName){_tagName=_tagName.toLowerCase();for(var result=[],i=0;i<_node.childNodes.length;i++)_tagName==_node.childNodes[i].nodeName.toLowerCase()&&result.push(_node.childNodes[i]);return result}function et2_filteredNodeIterator(_node,_callback,_context){for(var i=0;i<_node.childNodes.length;i++){var node=_node.childNodes[i],nodeName=node.nodeName.toLowerCase();"#"!=nodeName.charAt(0)&&_callback.call(_context,node,nodeName)}}function et2_readAttrWithDefault(_node,_name,_default){var val=_node.getAttribute(_name);return null===val?_default:val}function et2_evalBool(_val){return"string"!=typeof _val||"false"!=_val&&"0"!=_val?!!_val:!1}function et2_form_name(_cname,_name){for(var parts=[],i=0;i0&&(parts=parts.concat(name.replace(/]/g,"").split("[")))}var name=parts.shift();return parts.length?name+"["+parts.join("][")+"]":name}function et2_checkType(_val,_type,_attr,_widget){function _err(){var res=et2_typeDefaults[_type];return"undefined"!=typeof _val&&_val&&egw.debug("warn","Widget %o: '"+_val+"' was not of specified _type '"+_type+(null!=_attr?"' for attribute '"+_attr+"' ":"")+"and is now '"+res+"'",_widget),res}if("undefined"==typeof _attr&&(_attr=null),"any"==_type)return _val;if(_val===et2_typeDefaults[_type])return _val;if("boolean"==_type){if(_val===!0||_val===!1)return _val;if("string"==typeof _val){var lcv=_val.toLowerCase();if("true"===lcv||"false"===lcv||""===lcv)return"true"===_val;if("0"===lcv||"1"===lcv)return"1"===_val}else if("number"==typeof _val)return 0!=_val;return _err()}if("string"==_type||"html"==_type||"rawstring"==_type)return"number"==typeof _val?_val.toString():"string"==typeof _val?"string"==_type?html_entity_decode(_val):_val:"object"==typeof _val&&jQuery.isEmptyObject(_val)?"":_err();if("float"==_type)return"number"==typeof _val?_val:isNaN(_val)?_err():parseFloat(_val);if("integer"==_type)return parseInt(_val)==_val?parseInt(_val):_err();if("dimension"==_type)return"auto"==_val?_val:isNaN(_val)?"string"==typeof _val&&(_val.indexOf("px")==_val.length-2&&!isNaN(_val.split("px")[0])||_val.indexOf("%")==_val.length-1&&!isNaN(_val.split("%")[0]))?_val:_err():parseFloat(_val)+"px";if("js"==_type){if("function"==typeof _val||"undefined"==typeof _val)return _val;if(_val&&(_val=_val.replace(/window\.close\(\)/g,"egw(window).close()")),"string"==typeof _val&&"app."==_val.substr(0,4)&&window.app){for(var parts=_val.split("."),func=parts.pop(),parent=window,i=0;istart&&(start+=end),end="undefined"==typeof len?end:0>len?len+end:len+start,start>=str.length||0>start||start>end?"":str.slice(start,end)}function et2_csvSplit(_str,_num,_delimiter,_enclosure){if("undefined"!=typeof _str&&null!=_str||(_str=""),"undefined"==typeof _num&&(_num=null),"undefined"==typeof _delimiter&&(_delimiter=","),"undefined"==typeof _enclosure&&(_enclosure='"'),-1==_str.indexOf(_enclosure))return null===_num?_str.split(_delimiter):_str.split(_delimiter,_num);for(var parts=_str.split(_delimiter),n=0;"undefined"!=typeof parts[n];n++){var part=parts[n];if(part.charAt(0)===_enclosure){for(var m=n;"undefined"!=typeof parts[m+1]&&parts[n].substr(-1)!==_enclosure;)parts[n]+=_delimiter+parts[++m],delete parts[m];parts[n]=et2_substr(parts[n].replace(new RegExp(_enclosure+_enclosure,"g"),_enclosure),1,-1),n=m}}return parts=et2_arrayValues(parts),null!==_num&&_num>0&&_num0&&(parts[_num-1]=parts.slice(_num-1,parts.length).join(_delimiter),parts=parts.slice(0,_num)),parts}function et2_activateLinks(_content){function _splitPush(_matches,_proc){if(_matches){_match=!0;for(var i=1;i<_matches.length;i++)"undefined"==typeof _matches[i]&&(_matches[i]="");var splitted=_content.split(_matches[0]),left=splitted.shift();left&&(arr=arr.concat(et2_activateLinks(left))),_proc(_matches),_content=splitted.join(_matches[0])}}var _match=!1,arr=[],mail_regExp=/(mailto:)?([a-z0-9._-]+)@([a-z0-9_-]+)\.([a-z0-9._-]+)/i,protocol="(http:\\/\\/|(ftp:\\/\\/|https:\\/\\/))",domain="([\\w-]+\\.[\\w-.]+)",subdir="([\\w\\-\\.,@?^=%&;:\\/~\\+#]*[\\w\\-\\@?^=%&\\/~\\+#])?",http_regExp=new RegExp(protocol+domain+subdir,"i"),domain="www(\\.[\\w-.]+)",subdir="([\\w\\-\\.,@?^=%&:\\/~\\+#]*[\\w\\-\\@?^=%&\\/~\\+#])?",www_regExp=new RegExp(domain+subdir,"i");do{if(_match=!1,!_content)break;_splitPush(_content.match(mail_regExp),function(_matches){arr.push({href:(_matches[1]?"":"mailto:")+_matches[0],text:_matches[2]+"@"+_matches[3]+"."+_matches[4]})}),_splitPush(_content.match(http_regExp),function(_matches){arr.push({href:_matches[0],text:_matches[2]+_matches[3]+_matches[4]})}),_splitPush(_content.match(www_regExp),function(_matches){arr.push({href:"http://"+_matches[0],text:_matches[0]})})}while(_match);return arr.push(_content),arr}function et2_insertLinkText(_text,_node,_target){if(!_node)return void egw.debug("warn","et2_insertLinkText called without node",_text,_node,_target);for(var i=_node.childNodes.length-1;i>=0;i--)_node.removeChild(_node.childNodes[i]);for(var i=0;i<_text.length;i++){var s=_text[i];if("string"==typeof s||"number"==typeof s)for(var lines=s.split?s.split("\n"):[s],j=0;j_ar2.bottom)}function et2_rangeIntersectDir(_ar1,_ar2){return _ar1.bottom<_ar2.top?-1:_ar1.top>_ar2.bottom?1:0}function et2_rangeEqual(_ar1,_ar2){return _ar1.top===_ar2.top&&_ar1.bottom===_ar2.bottom}function et2_rangeSubstract(_ar1,_ar2){var res=[_ar1];et2_rangeIntersect(_ar1,_ar2)&&(res=[et2_bounds(_ar1.top,_ar2.top),et2_bounds(_ar2.bottom,_ar1.bottom)]);for(var i=res.length-1;i>=0;i--)res[i].bottom-res[i].top<=0&&res.splice(i,1);return res}function html_entity_decode(_str){return _str&&-1!=_str.indexOf("&")?jQuery(""+_str+"").text():_str}function et2_arrayMgrs_expand(_owner,_mgrs,_data,_row){var result={};for(var key in _mgrs)if(result[key]=_mgrs[key],"undefined"!=typeof _data[key]){var rowData={};rowData[_row]=_data[key],result[key]=_mgrs[key].openPerspective(_owner,rowData,_row)}return result}function et2_register_widget(_constructor,_types){"use strict";for(var i=0;i<_types.length;i++){var type=_types[i].toLowerCase();et2_registry[type]&&egw.debug("warn","Widget class registered for "+type+" will be overwritten."),et2_registry[type]=_constructor}}function et2_createWidget(_name,_attrs,_parent){"use strict";"undefined"==typeof _attrs&&(_attrs={}),"undefined"==typeof _parent&&(_parent=null);var nodeName=_attrs.type=_name,readonly=_attrs.readonly="undefined"==typeof _attrs.readonly?!1:_attrs.readonly,constructor="undefined"==typeof et2_registry[nodeName]?et2_placeholder:et2_registry[nodeName];return readonly&&"undefined"!=typeof et2_registry[nodeName+"_ro"]&&(constructor=et2_registry[nodeName+"_ro"]),constructor.prototype.generateAttributeSet(_attrs),new constructor(_parent,_attrs)}function et2_action_object_impl(widget,node){var aoi=new egwActionObjectInterface,objectNode=node;return aoi.getWidget=function(){return widget},aoi.doGetDOMNode=function(){return objectNode?objectNode:widget.getDOMNode()},aoi.doSetState=function(_state,_outerCall){},aoi.doTriggerEvent=function(_event,_data){switch(_event){case EGW_AI_DRAG_OVER:$j(this.node).addClass("ui-state-active");break;case EGW_AI_DRAG_OUT:$j(this.node).removeClass("ui-state-active")}},aoi}function expose(widget){"use strict";var IMAGE_DEFAULT={title:egw.lang("loading"),href:"",type:"image/png",thumbnail:"",loading:!0},mime_regex=new RegExp(/(video\/(mp4|ogg|webm))|(image\/:*(?!tif|x-xcf|pdf))/);navigator.userAgent.match(/(MSIE|Trident)/)&&mime_regex.compile(/(video\/mp4)|(image\/:*(?!tif|x-xcf|pdf))/);var gallery=null,find_nextmatch=function(widget){for(var current=widget,nextmatch=null;null==nextmatch&¤t;)current=current.getParent(),"undefined"!=typeof current&¤t.instanceOf(et2_nextmatch)&&(nextmatch=current);return null!=nextmatch&&null!=nextmatch.controller&&nextmatch.dom_id.match(/filemanager/,"ig")?nextmatch:null},read_from_nextmatch=function(nm,images,start_at){start_at||(start_at=0);for(var image_index=start_at,stop=Math.max.apply(null,Object.keys(nm.controller._indexMap)),i=start_at;stop>=i;i++)if(nm.controller._indexMap[i]&&nm.controller._indexMap[i].uid){var uid=nm.controller._indexMap[i].uid;if(uid){var data=egw.dataGetUIDdata(uid);if(data&&data.data&&data.data.mime&&mime_regex.test(data.data.mime)){var media=this.getMedia(data.data);images[image_index++]=jQuery.extend({},data.data,media[0])}}}else images[image_index++]=IMAGE_DEFAULT},set_slide=function(index,image){for(var active=index==gallery.index;index>gallery.getNumber();)gallery.add([jQuery.extend({},IMAGE_DEFAULT)]);if(image.loading)return void(gallery.slidesContainer.find('[data-index="'+index+'"]').hasClass(gallery.options.slideErrorClass)&&$j(gallery.slides[index]).addClass(gallery.options.slideLoadingClass).removeClass(gallery.options.slideErrorClass));$j(gallery.slides[index]).removeClass(gallery.options.slideLoadingClass);var new_index=gallery.num;gallery.add([image]),gallery.list[index]=gallery.list[new_index],gallery.list.splice(new_index,1);var dom_nodes=["indicators","slides"];for(var i in dom_nodes){var var_name=dom_nodes[i];$j(gallery[var_name][index]).remove(),gallery[var_name][index]=gallery[var_name][new_index];var node=$j(gallery[var_name][index]);node.attr("data-index",index).insertAfter($j("[data-index='"+(index-1)+"']",node.parent())),active&&node.addClass(gallery.options.activeIndicatorClass),gallery[var_name].splice(new_index,1)}active&&(gallery.activeIndicator=$j(gallery.indicators[index])),gallery.positions[index]=active?0:index>gallery.index?gallery.slideWidth:-gallery.slideWidth,gallery.positions.splice(new_index,1),gallery.elements[index]&&(delete gallery.elements[index],gallery.loadElement(index)),gallery.num-=1};return widget.extend([et2_IExposable],{init:function(){this._super.apply(this,arguments),this.mime_regexp=mime_regex;var self=this;this.expose_options={container:"#blueimp-gallery",slidesContainer:"div",titleElement:"h3",displayClass:"blueimp-gallery-display",controlsClass:"blueimp-gallery-controls",singleClass:"blueimp-gallery-single",leftEdgeClass:"blueimp-gallery-left",rightEdgeClass:"blueimp-gallery-right",playingClass:"blueimp-gallery-playing",slideClass:"slide",slideLoadingClass:"",slideErrorClass:"slide-error",slideContentClass:"slide-content",toggleClass:"toggle",prevClass:"prev",nextClass:"next",closeClass:"close",playPauseClass:"play-pause",fullscreenClass:"fullscreen",typeProperty:"type",titleProperty:"title",urlProperty:"href",displayTransition:!0,clearSlides:!0,stretchImages:!0,toggleControlsOnReturn:!0,toggleSlideshowOnSpace:!0,enableKeyboardNavigation:!0,closeOnEscape:!0,closeOnSlideClick:!1,closeOnSwipeUpOrDown:!0,emulateTouchEvents:!0,stopTouchEventsPropagation:!1,hidePageScrollbars:!0,disableScroll:!0,carousel:!0,continuous:!1,unloadElements:!0,startSlideshow:!1,slideshowInterval:3e3,index:0,preloadRange:2,transitionSpeed:400,hideControlsOnSlideshow:!0,toggleFullscreenOnSlideShow:!0,slideshowTransitionSpeed:void 0,indicatorContainer:"ol",activeIndicatorClass:"active",thumbnailProperty:"thumbnail",thumbnailIndicators:!0,thumbnailWithImgTag:!0,onopen:jQuery.proxy(this.expose_onopen,this),onopened:jQuery.proxy(this.expose_onopened,this),onslide:function(index,slide){self.expose_onslide.apply(self,[this,index,slide])},onslideend:function(index,slide){self.expose_onslideend.apply(self,[this,index,slide])},onslidecomplete:function(index,slide){self.expose_onslidecomplete.apply(self,[this,index,slide])},onclose:jQuery.proxy(this.expose_onclose,this),onclosed:jQuery.proxy(this.expose_onclosed,this)};var $body=jQuery("body");if(0==$body.find("#blueimp-gallery").length){var $expose_node=jQuery(document.createElement("div")).attr({id:"blueimp-gallery",class:"blueimp-gallery"});$expose_node.append('

×
    '),$body.append($expose_node)}},set_value:function(_value){if("undefined"!=typeof this._super&&(this._super.apply(this,arguments),this.options.expose_view)){var self=this;_value&&"string"==typeof _value.mime&&_value.mime.match(mime_regex,"ig")&&"undefined"!=typeof _value.download_url&&"undefined"!=typeof this.options.expose_view&&this.options.expose_view&&jQuery(this.node).on("click",function(event){event.altKey||event.ctrlKey||event.shiftKey||event.metaKey||self._init_blueimp_gallery(event,_value),event.stopImmediatePropagation()}).addClass("et2_clickable")}},_init_blueimp_gallery:function(event,_value){var mediaContent=[],nm=find_nextmatch(this),current_index=0;if(nm&&!this._is_target_indepth(nm,event.target)){var current_entry=nm.controller.getRowByNode(event.target);read_from_nextmatch.call(this,nm,mediaContent);for(var i=0;i0&&(res=!0)}return res},expose_onopen:function(event){},expose_onopened:function(event){var nm=find_nextmatch(this),self=this;if(nm){var total_count=nm.controller._grid.getTotalCount();if(total_count>=gallery.num){var $indicator=gallery.container.find(".indicator");$indicator.off().addClass("paginating").swipe(function(event,direction,distance){if(direction==jQuery.fn.swipe.directions.LEFT)distance*=-1;else if(direction!=jQuery.fn.swipe.directions.RIGHT)return;$j(this).css("left",min(0,parseInt($j(this).css("left"))-30*distance)+"px")}),$indicator.bind("mousewheel DOMMousewheel",function(event,_delta){var delta=_delta||event.originalEvent.wheelDelta/120;if(!(delta>0&&parseInt($j(this).css("left"))>gallery.container.width()/2)){if(0>delta&&$j(this).width()+parseInt($j(this).css("left"))=index?1:-1;break}if(!gallery.list[index+direction]||gallery.list[index+direction].loading||total_count>gallery.getNumber()&&index+ET2_DATAVIEW_STEPSIZE>gallery.getNumber()){var start=Math.max(0,direction>0?index:index-ET2_DATAVIEW_STEPSIZE),end=Math.min(total_count-1,start+ET2_DATAVIEW_STEPSIZE);nm.controller._gridCallback(start,end);var images=[];read_from_nextmatch.call(this,nm,images,start);for(var i in images)set_slide(i,images[i])}}},expose_onslidecomplete:function(gallery,index,slide){},expose_onclose:function(event){var nm=find_nextmatch(this);nm&&!this._is_target_indepth(nm)&&(gallery.container.find(".indicator").removeClass("paginating").off("mousewheel").off("swipe"),nm.applyFilters({col_filter:{mime:""}}))},expose_onclosed:function(event){}})}function date(format,timestamp){var jsdate,f,formatChrCb,that=this,formatChr=/\\?([a-z])/gi,_pad=function(n,c){return(n+="").length4||21>j?"th":{1:"st",2:"nd",3:"rd"}[j%10]||"th"},w:function(){return jsdate.getDay()},z:function(){var a=new Date(f.Y(),f.n()-1,f.j()),b=new Date(f.Y(),0,1);return Math.round((a-b)/864e5)+1},W:function(){var a=new Date(f.Y(),f.n()-1,f.j()-f.N()+3),b=new Date(a.getFullYear(),0,4);return _pad(1+Math.round((a-b)/864e5/7),2)},F:function(){return txt_words[6+f.n()]},m:function(){return _pad(f.n(),2)},M:function(){return f.F().slice(0,3)},n:function(){return jsdate.getMonth()+1},t:function(){return new Date(f.Y(),f.n(),0).getDate()},L:function(){return 1===new Date(f.Y(),1,29).getMonth()|0},o:function(){var n=f.n(),W=f.W(),Y=f.Y();return Y+(12===n&&9>W?-1:1===n&&W>9)},Y:function(){return jsdate.getFullYear()},y:function(){return(f.Y()+"").slice(-2)},a:function(){return jsdate.getHours()>11?"pm":"am"},A:function(){return f.a().toUpperCase()},B:function(){var H=3600*jsdate.getUTCHours(),i=60*jsdate.getUTCMinutes(),s=jsdate.getUTCSeconds();return _pad(Math.floor((H+i+s+3600)/86.4)%1e3,3)},g:function(){return f.G()%12||12},G:function(){return jsdate.getHours()},h:function(){return _pad(f.g(),2)},H:function(){return _pad(f.G(),2)},i:function(){return _pad(jsdate.getMinutes(),2)},s:function(){return _pad(jsdate.getSeconds(),2)},u:function(){return _pad(1e3*jsdate.getMilliseconds(),6)},e:function(){throw"Not supported (see source code of date() for timezone on how to add support)"},I:function(){var a=new Date(f.Y(),0),c=Date.UTC(f.Y(),0),b=new Date(f.Y(),6),d=Date.UTC(f.Y(),6);return 0+(a-c!==b-d)},O:function(){var a=jsdate.getTimezoneOffset();return(a>0?"-":"+")+_pad(Math.abs(a/60*100),4)},P:function(){var O=f.O();return O.substr(0,3)+":"+O.substr(3,2)},T:function(){return"UTC"},Z:function(){return 60*-jsdate.getTimezoneOffset()},c:function(){return"Y-m-d\\Th:i:sP".replace(formatChr,formatChrCb)},r:function(){return"D, d M Y H:i:s O".replace(formatChr,formatChrCb)},U:function(){return jsdate.getTime()/1e3|0}},this.date=function(format,timestamp){return that=this,jsdate="undefined"==typeof timestamp?new Date:timestamp instanceof Date?new Date(timestamp):new Date(1e3*timestamp),format.replace(formatChr,formatChrCb)},this.date(format,timestamp)}function et2_dataview_rowAOI(_node){"use strict";var aoi=new egwActionObjectInterface;aoi.node=_node,aoi.selectMode=EGW_SELECTMODE_DEFAULT,aoi.checkBox=null,aoi.doGetDOMNode=function(){return aoi.node},$j(_node).mousedown(egwPreventSelect);var selectHandler=function(e,_params){if(egwUnfocus(),_node.onselectstart=null,e.target!=aoi.checkBox){var selected=egwBitIsSet(aoi.getState(),EGW_AO_STATE_SELECTED),state=egwGetShiftState(e);if(_params&&egwIsMobile())switch(_params.swip){case"left":case"right":state=1,_egw_active_menu&&_egw_active_menu.hide();break;case"up":case"down":return}switch(aoi.selectMode){case EGW_SELECTMODE_DEFAULT:aoi.updateState(EGW_AO_STATE_SELECTED,!egwBitIsSet(state,EGW_AO_SHIFT_STATE_MULTI)||!selected,state);break;case EGW_SELECTMODE_TOGGLE:aoi.updateState(EGW_AO_STATE_SELECTED,!selected,egwSetBit(state,EGW_AO_SHIFT_STATE_MULTI,!0))}}};return egwIsMobile()?$j(_node).swipe({allowPageScroll:"vertical",swipe:function(event,direction){selectHandler(event,{swip:direction})},click:function(event){selectHandler(event)}}):$j(_node).click(selectHandler),$j(aoi.checkBox).change(function(){aoi.updateState(EGW_AO_STATE_SELECTED,this.checked,EGW_AO_SHIFT_STATE_MULTI)}),aoi.doSetState=function(_state){var selected=egwBitIsSet(_state,EGW_AO_STATE_SELECTED);this.checkBox&&(this.checkBox.checked=selected),$j(this.node).toggleClass("focused",egwBitIsSet(_state,EGW_AO_STATE_FOCUSED)),$j(this.node).toggleClass("selected",selected)},aoi}function nm_action(_action,_senders,_target,_ids){if(!_action.checkbox||_action.data&&"undefined"!=typeof _action.data.nm_action){if("undefined"!=typeof _action.data&&_action.data||(_action.data={}),"undefined"==typeof _action.data.nm_action&&"popup"==_action.type&&(_action.data.nm_action="submit"),"undefined"==typeof _ids){for(var nm=null,action=_action;null==nm&&null!=action;)null!=action.data&&action.data.nextmatch&&(nm=action.data.nextmatch),action=action.parent;nm&&(_ids=nm.getSelection(),_action.data.nextmatch=nm)}for(var idsArr=_ids.ids,i=0;i=0?'"'+id.replace(/"/g,'""')+'"':id)+(i=0?egw_open_id=egw_open_id.split(":")[params.shift(params[2])]:params.length>1&&""==params[0]&&-1!=params[1].indexOf("from=merge")?params.shift():params.shift(params[2])),params.length>1&&""==params[0]&&-1!=params[1].indexOf("from=merge")&¶ms.shift();var extra=params.join("-");egw(app,window).open(egw_open_id,app,type,extra,target);break;case"open_popup":if(null==nm_popup_action){nm_open_popup(_action,_ids.ids);break}case"submit":var checkboxes=mgr.getActionsByAttr("checkbox",!0),checkbox_values={};if(checkboxes)for(var i in checkboxes)checkbox_values[checkboxes[i].id]=checkboxes[i].checked;var nextmatch=_action.data.nextmatch;if(!nextmatch&&_senders.length&&(nextmatch=_senders[0]._context._widget),nextmatch){var old_value=nextmatch.getValue,value=nextmatch.getValue();jQuery.extend(value,this.activeFilters,{selected:idsArr,select_all:_ids.all,checkboxes:checkbox_values}),value[nextmatch.options.settings.action_var]=_action.id,nextmatch.getValue=function(){return value},_action.data.postSubmit?nextmatch.getInstanceManager().postSubmit():nextmatch.getInstanceManager().submit(),"open_popup"==_action.data.nm_action&&(nextmatch.refresh(idsArr),nextmatch.getValue=old_value)}else egw().debug("error","Missing nextmatch widget, could not submit",_action)}}}function fetchAll(ids,nextmatch,callback){if(!nextmatch||!nextmatch.controller)return!1;var selection=nextmatch.getSelection();if(!selection.all)return!1;if(nextmatch.controller._grid&&nextmatch.controller._grid.getTotalCount()>ids.length){var idsArr=[],count=idsArr.length,total=nextmatch.controller._grid.getTotalCount(),cancel=!1,dialog=et2_dialog.show_dialog(function(){count=total,cancel=!0},egw.lang("Loading"),egw.lang("please wait..."),{},[{button_id:et2_dialog.CANCEL_BUTTON,text:"cancel",id:"dialog[cancel]",image:"cancel"}]);do nextmatch.controller.dataFetch({start:count,num_rows:200},function(data){if(data&&data.order)for(var i=0;i=total&&(dialog.destroy(),cancel||callback.call(this,idsArr))},this),count+=200;while(total>count);return!0}return!1}function doLongTask(idsArr,all,_action,nextmatch){if(all||idsArr.length>1||"undefined"==typeof _action.data.egw_open){if(all){var fetching=fetchAll(idsArr,nextmatch,function(idsArr){et2_dialog.long_task(null,_action.data.message||_action.caption,_action.data.title,_action.data.menuaction,idsArr)});if(fetching)return!0}return et2_dialog.long_task(null,_action.data.message||_action.caption,_action.data.title,_action.data.menuaction,idsArr),!0}return!1}function nm_compare_field(_action,_senders,_target){var value=!1,field=document.getElementById(_action.data.fieldId);if(field)value=$j(field).val();else{var nextmatch=_action.data.nextmatch;if(!nextmatch&&_senders.length&&(nextmatch=_senders[0]._context._widget),!nextmatch)return!1;field=nextmatch.getWidgetById(_action.data.fieldId),value=field.getValue()}return field?"!"==_action.data.fieldValue.substr(0,1)?value!=_action.data.fieldValue.substr(1):value==_action.data.fieldValue:!1}function nm_open_popup(_action,_selected){var uid;"undefined"!=typeof _action.data.nextmatch?uid=_action.data.nextmatch.getInstanceManager().uniqueId:"undefined"!=typeof _selected[0]&&(uid=_selected[0].manager.data.nextmatch.getInstanceManager().uniqueId);var popup=jQuery("#"+(uid||"")+"_"+_action.id+"_popup").first()||jQuery("[id*='"+_action.id+"_popup']").first();if(popup){nm_popup_action=_action,_selected.length&&"object"==typeof _selected[0]?(_action.data.nextmatch=_selected[0]._context._widget,nm_popup_ids=_selected):(egw().debug("warn","Not proper format for IDs, should be array of egwActionObject",_selected),nm_popup_ids=_selected);var dialog=jQuery(".action_popup-content",popup);if(0==dialog.length&&(dialog=jQuery(document.createElement("div")).addClass("action_popup-content"),1==popup.children().length?dialog.append(popup.children().children().slice(1,popup.children().children().length-1)):dialog.append(popup.children().slice(1,popup.children().length-1)),dialog.appendTo(popup)),1==dialog.length){var dialog_parent=dialog.parent(),d_buttons=[],action=_action;popup.show();var buttons=jQuery("button:visible",popup).each(function(index){var but=jQuery(this);if(but.hide(),but.attr("id"))var widget_id=but.attr("id").replace(_action.data.nextmatch.getInstanceManager().uniqueId+"_",""),button=nm_popup_action.data.nextmatch.getRoot().getWidgetById(widget_id);d_buttons.push({text:but.text(),click:button&&button.onclick?function(e){dialog.dialog("close"),nm_popup_action=action,button.onclick.apply(button,e.currentTarget)}:function(e){dialog.dialog("close"),nm_popup_action=null}})}),dialog_width=dialog.outerWidth(!0);popup.hide(),dialog.dialog({title:jQuery(".promptheader",popup).text(),modal:!0,buttons:d_buttons,minWidth:dialog_width,close:function(event,ui){dialog.dialog("destroy"),dialog.appendTo(dialog_parent),buttons.show()}})}nm_popup_action=null,nm_popup_senders=null}}function nm_submit_popup(button){if(nm_popup_action.data.nextmatch){var widget_id=$j(button).attr("id").replace(nm_popup_action.data.nextmatch.getInstanceManager().uniqueId+"_","");nm_popup_action.data.nextmatch.getRoot().getWidgetById(widget_id).clicked=!0}if(nm_popup_ids.length&&"object"!=typeof nm_popup_ids[0]){var ids={ids:[]};for(var i in nm_popup_ids)nm_popup_ids[i]&&ids.ids.push(nm_popup_ids[i])}nm_action(nm_popup_action,nm_popup_ids,button,ids),nm_hide_popup(button,null),nm_popup_ids=null}function nm_hide_popup(element,div_id){var prefix=element.id.substring(0,element.id.indexOf("[")),popup=div_id?document.getElementById(div_id):jQuery("#"+prefix+"_popup").get(0)||jQuery("[id*='"+prefix+"_popup']").get(0);return popup&&(popup.style.display="none"),nm_popup_action=null,nm_popup_senders=null,!1}function nm_activate_link(_action,_senders){$j(_senders[0].iface.getDOMNode()).find(".et2_clickable:first").trigger("click")}function dtmlXMLLoaderObject(t,e,n,i){return this.xmlDoc="",this.async="undefined"!=typeof n?n:!0,this.onloadAction=t||null,this.mainObject=e||null,this.waitCall=null,this.rSeed=i||!1,this}function callerFunction(t,e){return this.handler=function(n){return n||(n=window.event),t(n,e),!0},this.handler}function getAbsoluteLeft(t){return getOffset(t).left}function getAbsoluteTop(t){return getOffset(t).top}function getOffsetSum(t){for(var e=0,n=0;t;)e+=parseInt(t.offsetTop),n+=parseInt(t.offsetLeft),t=t.offsetParent;return{top:e,left:n}}function getOffsetRect(t){var e=t.getBoundingClientRect(),n=document.body,i=document.documentElement,a=window.pageYOffset||i.scrollTop||n.scrollTop,s=window.pageXOffset||i.scrollLeft||n.scrollLeft,r=i.clientTop||n.clientTop||0,o=i.clientLeft||n.clientLeft||0,d=e.top+a-r,l=e.left+s-o;return{top:Math.round(d),left:Math.round(l)}}function getOffset(t){return t.getBoundingClientRect?getOffsetRect(t):getOffsetSum(t); @@ -13,7 +13,7 @@ label:{name:"Label",type:"string",default:"",description:"Label for group box",t if(""!=e.target.value||e.target==hex.get(0)||(null==bindedHex||e.target==bindedHex.get(0))&&null!=bindedHex){if(!validateKey(e))return e;switch(e.target){case red.get(0):switch(e.keyCode){case 38:return red.val(setValueInRange.call($this,(red.val()<<0)+1,0,255)),color.val("r",red.val(),e.target),!1;case 40:return red.val(setValueInRange.call($this,(red.val()<<0)-1,0,255)),color.val("r",red.val(),e.target),!1}break;case green.get(0):switch(e.keyCode){case 38:return green.val(setValueInRange.call($this,(green.val()<<0)+1,0,255)),color.val("g",green.val(),e.target),!1;case 40:return green.val(setValueInRange.call($this,(green.val()<<0)-1,0,255)),color.val("g",green.val(),e.target),!1}break;case blue.get(0):switch(e.keyCode){case 38:return blue.val(setValueInRange.call($this,(blue.val()<<0)+1,0,255)),color.val("b",blue.val(),e.target),!1;case 40:return blue.val(setValueInRange.call($this,(blue.val()<<0)-1,0,255)),color.val("b",blue.val(),e.target),!1}break;case alpha&&alpha.get(0):switch(e.keyCode){case 38:return alpha.val(setValueInRange.call($this,parseFloat(alpha.val())+1,0,100)),color.val("a",Math.precision(255*alpha.val()/100,alphaPrecision),e.target),!1;case 40:return alpha.val(setValueInRange.call($this,parseFloat(alpha.val())-1,0,100)),color.val("a",Math.precision(255*alpha.val()/100,alphaPrecision),e.target),!1}break;case hue.get(0):switch(e.keyCode){case 38:return hue.val(setValueInRange.call($this,(hue.val()<<0)+1,0,360)),color.val("h",hue.val(),e.target),!1;case 40:return hue.val(setValueInRange.call($this,(hue.val()<<0)-1,0,360)),color.val("h",hue.val(),e.target),!1}break;case saturation.get(0):switch(e.keyCode){case 38:return saturation.val(setValueInRange.call($this,(saturation.val()<<0)+1,0,100)),color.val("s",saturation.val(),e.target),!1;case 40:return saturation.val(setValueInRange.call($this,(saturation.val()<<0)-1,0,100)),color.val("s",saturation.val(),e.target),!1}break;case value.get(0):switch(e.keyCode){case 38:return value.val(setValueInRange.call($this,(value.val()<<0)+1,0,100)),color.val("v",value.val(),e.target),!1;case 40:return value.val(setValueInRange.call($this,(value.val()<<0)-1,0,100)),color.val("v",value.val(),e.target),!1}}}},keyUp=function(e){if(""!=e.target.value||e.target==hex.get(0)||(null==bindedHex||e.target==bindedHex.get(0))&&null!=bindedHex){if(!validateKey(e))return e;switch(e.target){case red.get(0):red.val(setValueInRange.call($this,red.val(),0,255)),color.val("r",red.val(),e.target);break;case green.get(0):green.val(setValueInRange.call($this,green.val(),0,255)),color.val("g",green.val(),e.target);break;case blue.get(0):blue.val(setValueInRange.call($this,blue.val(),0,255)),color.val("b",blue.val(),e.target);break;case alpha&&alpha.get(0):alpha.val(setValueInRange.call($this,alpha.val(),0,100)),color.val("a",Math.precision(255*alpha.val()/100,alphaPrecision),e.target);break;case hue.get(0):hue.val(setValueInRange.call($this,hue.val(),0,360)),color.val("h",hue.val(),e.target);break;case saturation.get(0):saturation.val(setValueInRange.call($this,saturation.val(),0,100)),color.val("s",saturation.val(),e.target);break;case value.get(0):value.val(setValueInRange.call($this,value.val(),0,100)),color.val("v",value.val(),e.target);break;case hex.get(0):hex.val(hex.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6)),bindedHex&&bindedHex.val(hex.val()),color.val("hex",""!=hex.val()?hex.val():null,e.target);break;case bindedHex&&bindedHex.get(0):bindedHex.val(bindedHex.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,6)),hex.val(bindedHex.val()),color.val("hex",""!=bindedHex.val()?bindedHex.val():null,e.target);break;case ahex&&ahex.get(0):ahex.val(ahex.val().replace(/[^a-fA-F0-9]/g,"").toLowerCase().substring(0,2)),color.val("a",null!=ahex.val()?parseInt(ahex.val(),16):null,e.target)}}},blur=function(e){if(null!=color.val())switch(e.target){case red.get(0):red.val(color.val("r"));break;case green.get(0):green.val(color.val("g"));break;case blue.get(0):blue.val(color.val("b"));break;case alpha&&alpha.get(0):alpha.val(Math.precision(100*color.val("a")/255,alphaPrecision));break;case hue.get(0):hue.val(color.val("h"));break;case saturation.get(0):saturation.val(color.val("s"));break;case value.get(0):value.val(color.val("v"));break;case hex.get(0):case bindedHex&&bindedHex.get(0):hex.val(color.val("hex")),bindedHex&&bindedHex.val(color.val("hex"));break;case ahex&&ahex.get(0):ahex.val(color.val("ahex").substring(6))}},validateKey=function(e){switch(e.keyCode){case 9:case 16:case 29:case 37:case 39:return!1;case"c".charCodeAt():case"v".charCodeAt():if(e.ctrlKey)return!1}return!0},setValueInRange=function(value,min,max){return""==value||isNaN(value)?min:value>max?max:min>value?min:value},colorChanged=function(ui,context){var all=ui.val("all");context!=red.get(0)&&red.val(null!=all?all.r:""),context!=green.get(0)&&green.val(null!=all?all.g:""),context!=blue.get(0)&&blue.val(null!=all?all.b:""),alpha&&context!=alpha.get(0)&&alpha.val(null!=all?Math.precision(100*all.a/255,alphaPrecision):""),context!=hue.get(0)&&hue.val(null!=all?all.h:""),context!=saturation.get(0)&&saturation.val(null!=all?all.s:""),context!=value.get(0)&&value.val(null!=all?all.v:""),context!=hex.get(0)&&(bindedHex&&context!=bindedHex.get(0)||!bindedHex)&&hex.val(null!=all?all.hex:""),bindedHex&&context!=bindedHex.get(0)&&context!=hex.get(0)&&bindedHex.val(null!=all?all.hex:""),ahex&&context!=ahex.get(0)&&ahex.val(null!=all?all.ahex.substring(6):"")},destroy=function(){red.add(green).add(blue).add(alpha).add(hue).add(saturation).add(value).add(hex).add(bindedHex).add(ahex).unbind("keyup",keyUp).unbind("blur",blur),red.add(green).add(blue).add(alpha).add(hue).add(saturation).add(value).unbind("keydown",keyDown),color.unbind(colorChanged),red=null,green=null,blue=null,alpha=null,hue=null,saturation=null,value=null,hex=null,ahex=null};$.extend(!0,$this,{destroy:destroy}),red.add(green).add(blue).add(alpha).add(hue).add(saturation).add(value).add(hex).add(bindedHex).add(ahex).bind("keyup",keyUp).bind("blur",blur),red.add(green).add(blue).add(alpha).add(hue).add(saturation).add(value).bind("keydown",keyDown),color.bind(colorChanged)};$.jPicker={List:[],Color:function(init){var r,g,b,a,h,s,v,$this=this,changeEvents=new Array,fireChangeEvents=function(context){for(var i=0;i255&&(newV.r=255),r!=newV.r&&(r=newV.r,changed=!0);break;case"g":if(hsv)continue;rgb=!0,newV.g=value&&value.g&&0|value.g||value&&0|value||0,newV.g<0?newV.g=0:newV.g>255&&(newV.g=255),g!=newV.g&&(g=newV.g,changed=!0);break;case"b":if(hsv)continue;rgb=!0,newV.b=value&&value.b&&0|value.b||value&&0|value||0,newV.b<0?newV.b=0:newV.b>255&&(newV.b=255),b!=newV.b&&(b=newV.b,changed=!0);break;case"a":newV.a=value&&null!=value.a?0|value.a:null!=value?0|value:255,newV.a<0?newV.a=0:newV.a>255&&(newV.a=255),a!=newV.a&&(a=newV.a,changed=!0);break;case"h":if(rgb)continue;hsv=!0,newV.h=value&&value.h&&0|value.h||value&&0|value||0,newV.h<0?newV.h=0:newV.h>360&&(newV.h=360),h!=newV.h&&(h=newV.h,changed=!0);break;case"s":if(rgb)continue;hsv=!0,newV.s=value&&null!=value.s?0|value.s:null!=value?0|value:100,newV.s<0?newV.s=0:newV.s>100&&(newV.s=100),s!=newV.s&&(s=newV.s,changed=!0);break;case"v":if(rgb)continue;hsv=!0,newV.v=value&&null!=value.v?0|value.v:null!=value?0|value:100,newV.v<0?newV.v=0:newV.v>100&&(newV.v=100),v!=newV.v&&(v=newV.v,changed=!0)}if(changed){if(rgb){r=r||0,g=g||0,b=b||0;var ret=ColorMethods.rgbToHsv({r:r,g:g,b:b});h=ret.h,s=ret.s,v=ret.v}else if(hsv){h=h||0,s=null!=s?s:100,v=null!=v?v:100;var ret=ColorMethods.hsvToRgb({h:h,s:s,v:v});r=ret.r,g=ret.g,b=ret.b}a=null!=a?a:255,fireChangeEvents.call($this,context||$this)}}}},bind=function(callback){$.isFunction(callback)&&changeEvents.push(callback)},unbind=function(callback){if($.isFunction(callback))for(var i;-1!=(i=$.inArray(callback,changeEvents));)changeEvents.splice(i,1)},destroy=function(){changeEvents=null};$.extend(!0,$this,{val:val,bind:bind,unbind:unbind,destroy:destroy}),init&&(null!=init.ahex?val("ahex",init):null!=init.hex?val((null!=init.a?"a":"")+"hex",null!=init.a?{ahex:init.hex+ColorMethods.intToHex(init.a)}:init):null!=init.r&&null!=init.g&&null!=init.b?val("rgb"+(null!=init.a?"a":""),init):null!=init.h&&null!=init.s&&null!=init.v&&val("hsv"+(null!=init.a?"a":""),init))},ColorMethods:{hexToRgba:function(hex){if(hex=this.validateHex(hex),""==hex)return{r:null,g:null,b:null,a:null};var r="00",g="00",b="00",a="255";return 6==hex.length&&(hex+="ff"),hex.length>6?(r=hex.substring(0,2),g=hex.substring(2,4),b=hex.substring(4,6),a=hex.substring(6,hex.length)):(hex.length>4&&(r=hex.substring(4,hex.length),hex=hex.substring(0,4)),hex.length>2&&(g=hex.substring(2,hex.length),hex=hex.substring(0,2)),hex.length>0&&(b=hex.substring(0,hex.length))),{r:this.hexToInt(r),g:this.hexToInt(g),b:this.hexToInt(b),a:this.hexToInt(a)}},validateHex:function(hex){return hex=hex.toLowerCase().replace(/[^a-f0-9]/g,""),hex.length>8&&(hex=hex.substring(0,8)),hex},rgbaToHex:function(rgba){return this.intToHex(rgba.r)+this.intToHex(rgba.g)+this.intToHex(rgba.b)+this.intToHex(rgba.a)},intToHex:function(dec){var result=(0|dec).toString(16);return 1==result.length&&(result="0"+result),result.toLowerCase()},hexToInt:function(hex){return parseInt(hex,16)},rgbToHsv:function(rgb){var delta,r=rgb.r/255,g=rgb.g/255,b=rgb.b/255,hsv={h:0,s:0,v:0},min=0,max=0;return r>=g&&r>=b?(max=r,min=g>b?b:g):g>=b&&g>=r?(max=g,min=r>b?b:r):(max=b,min=g>r?r:g),hsv.v=max,hsv.s=max?(max-min)/max:0,hsv.s?(delta=max-min,r==max?hsv.h=(g-b)/delta:g==max?hsv.h=2+(b-r)/delta:hsv.h=4+(r-g)/delta,hsv.h=parseInt(60*hsv.h),hsv.h<0&&(hsv.h+=360)):hsv.h=0,hsv.s=100*hsv.s|0,hsv.v=100*hsv.v|0,hsv},hsvToRgb:function(hsv){var rgb={r:0,g:0,b:0,a:100},h=hsv.h,s=hsv.s,v=hsv.v;if(0==s)0==v?rgb.r=rgb.g=rgb.b=0:rgb.r=rgb.g=rgb.b=255*v/100|0;else{360==h&&(h=0),h/=60,s/=100,v/=100;var i=0|h,f=h-i,p=v*(1-s),q=v*(1-s*f),t=v*(1-s*(1-f));switch(i){case 0:rgb.r=v,rgb.g=t,rgb.b=p;break;case 1:rgb.r=q,rgb.g=v,rgb.b=p;break;case 2:rgb.r=p,rgb.g=v,rgb.b=t;break;case 3:rgb.r=p,rgb.g=q,rgb.b=v;break;case 4:rgb.r=t,rgb.g=p,rgb.b=v;break;case 5:rgb.r=v,rgb.g=p,rgb.b=q}rgb.r=255*rgb.r|0,rgb.g=255*rgb.g|0,rgb.b=255*rgb.b|0}return rgb}}};var Color=$.jPicker.Color,List=$.jPicker.List,ColorMethods=$.jPicker.ColorMethods;$.fn.jPicker=function(options){var $arguments=arguments;return this.each(function(){var $this=this,settings=$.extend(!0,{},$.fn.jPicker.defaults,options);"input"==$($this).get(0).nodeName.toLowerCase()&&($.extend(!0,settings,{window:{bindToInput:!0,expandable:!0,input:$($this)}}),""==$($this).val()?(settings.color.active=new Color({hex:null}),settings.color.current=new Color({hex:null})):ColorMethods.validateHex($($this).val())&&(settings.color.active=new Color({hex:$($this).val(),a:settings.color.active.val("a")}),settings.color.current=new Color({hex:$($this).val(),a:settings.color.active.val("a")}))),settings.window.expandable?$($this).after('    '):settings.window.liveUpdate=!1;var isLessThanIE7=parseFloat(navigator.appVersion.split("MSIE")[1])<7&&document.body.filters,container=null,colorMapDiv=null,colorBarDiv=null,colorMapL1=null,colorMapL2=null,colorMapL3=null,colorBarL1=null,colorBarL2=null,colorBarL3=null,colorBarL4=null,colorBarL5=null,colorBarL6=null,colorMap=null,colorBar=null,colorPicker=null,elementStartX=null,elementStartY=null,pageStartX=null,pageStartY=null,activePreview=null,currentPreview=null,okButton=null,cancelButton=null,grid=null,iconColor=null,iconAlpha=null,iconImage=null,moveBar=null,setColorMode=function(colorMode){var rgbMap,rgbBar,active=color.active,hex=(images.clientPath,active.val("hex"));switch(settings.color.mode=colorMode,colorMode){case"h":if(setTimeout(function(){setBG.call($this,colorMapDiv,"transparent"),setImgLoc.call($this,colorMapL1,0),setAlpha.call($this,colorMapL1,100),setImgLoc.call($this,colorMapL2,260),setAlpha.call($this,colorMapL2,100),setBG.call($this,colorBarDiv,"transparent"),setImgLoc.call($this,colorBarL1,0),setAlpha.call($this,colorBarL1,100),setImgLoc.call($this,colorBarL2,260),setAlpha.call($this,colorBarL2,100),setImgLoc.call($this,colorBarL3,260),setAlpha.call($this,colorBarL3,100),setImgLoc.call($this,colorBarL4,260),setAlpha.call($this,colorBarL4,100),setImgLoc.call($this,colorBarL6,260),setAlpha.call($this,colorBarL6,100)},0),colorMap.range("all",{minX:0,maxX:100,minY:0,maxY:100}),colorBar.range("rangeY",{minY:0,maxY:360}),null==active.val("ahex"))break;colorMap.val("xy",{x:active.val("s"),y:100-active.val("v")},colorMap),colorBar.val("y",360-active.val("h"),colorBar);break;case"s":if(setTimeout(function(){setBG.call($this,colorMapDiv,"transparent"),setImgLoc.call($this,colorMapL1,-260),setImgLoc.call($this,colorMapL2,-520),setImgLoc.call($this,colorBarL1,-260),setImgLoc.call($this,colorBarL2,-520),setImgLoc.call($this,colorBarL6,260),setAlpha.call($this,colorBarL6,100)},0),colorMap.range("all",{minX:0,maxX:360,minY:0,maxY:100}),colorBar.range("rangeY",{minY:0,maxY:100}),null==active.val("ahex"))break;colorMap.val("xy",{x:active.val("h"),y:100-active.val("v")},colorMap),colorBar.val("y",100-active.val("s"),colorBar);break;case"v":if(setTimeout(function(){setBG.call($this,colorMapDiv,"000000"),setImgLoc.call($this,colorMapL1,-780),setImgLoc.call($this,colorMapL2,260),setBG.call($this,colorBarDiv,hex),setImgLoc.call($this,colorBarL1,-520),setImgLoc.call($this,colorBarL2,260),setAlpha.call($this,colorBarL2,100),setImgLoc.call($this,colorBarL6,260),setAlpha.call($this,colorBarL6,100)},0),colorMap.range("all",{minX:0,maxX:360,minY:0,maxY:100}),colorBar.range("rangeY",{minY:0,maxY:100}),null==active.val("ahex"))break;colorMap.val("xy",{x:active.val("h"),y:100-active.val("s")},colorMap),colorBar.val("y",100-active.val("v"),colorBar);break;case"r":if(rgbMap=-1040,rgbBar=-780,colorMap.range("all",{minX:0,maxX:255,minY:0,maxY:255}),colorBar.range("rangeY",{minY:0,maxY:255}),null==active.val("ahex"))break;colorMap.val("xy",{x:active.val("b"),y:255-active.val("g")},colorMap),colorBar.val("y",255-active.val("r"),colorBar);break;case"g":if(rgbMap=-1560,rgbBar=-1820,colorMap.range("all",{minX:0,maxX:255,minY:0,maxY:255}),colorBar.range("rangeY",{minY:0,maxY:255}),null==active.val("ahex"))break;colorMap.val("xy",{x:active.val("b"),y:255-active.val("r")},colorMap),colorBar.val("y",255-active.val("g"),colorBar);break;case"b":if(rgbMap=-2080,rgbBar=-2860,colorMap.range("all",{minX:0,maxX:255,minY:0,maxY:255}),colorBar.range("rangeY",{minY:0,maxY:255}),null==active.val("ahex"))break;colorMap.val("xy",{x:active.val("r"),y:255-active.val("g")},colorMap),colorBar.val("y",255-active.val("b"),colorBar);break;case"a":if(setTimeout(function(){setBG.call($this,colorMapDiv,"transparent"),setImgLoc.call($this,colorMapL1,-260),setImgLoc.call($this,colorMapL2,-520),setImgLoc.call($this,colorBarL1,260),setImgLoc.call($this,colorBarL2,260),setAlpha.call($this,colorBarL2,100),setImgLoc.call($this,colorBarL6,0),setAlpha.call($this,colorBarL6,100)},0),colorMap.range("all",{minX:0,maxX:360,minY:0,maxY:100}),colorBar.range("rangeY",{minY:0,maxY:255}),null==active.val("ahex"))break;colorMap.val("xy",{x:active.val("h"),y:100-active.val("v")},colorMap),colorBar.val("y",255-active.val("a"),colorBar);break;default:throw"Invalid Mode"}switch(colorMode){case"h":break;case"s":case"v":case"a":setTimeout(function(){setAlpha.call($this,colorMapL1,100),setAlpha.call($this,colorBarL1,100),setImgLoc.call($this,colorBarL3,260),setAlpha.call($this,colorBarL3,100),setImgLoc.call($this,colorBarL4,260),setAlpha.call($this,colorBarL4,100)},0);break;case"r":case"g":case"b":setTimeout(function(){setBG.call($this,colorMapDiv,"transparent"),setBG.call($this,colorBarDiv,"transparent"),setAlpha.call($this,colorBarL1,100),setAlpha.call($this,colorMapL1,100),setImgLoc.call($this,colorMapL1,rgbMap),setImgLoc.call($this,colorMapL2,rgbMap-260),setImgLoc.call($this,colorBarL1,rgbBar-780),setImgLoc.call($this,colorBarL2,rgbBar-520),setImgLoc.call($this,colorBarL3,rgbBar),setImgLoc.call($this,colorBarL4,rgbBar-260),setImgLoc.call($this,colorBarL6,260),setAlpha.call($this,colorBarL6,100)},0)}null!=active.val("ahex")&&activeColorChanged.call($this,active)},activeColorChanged=function(ui,context){(null==context||context!=colorBar&&context!=colorMap)&&positionMapAndBarArrows.call($this,ui,context),setTimeout(function(){updatePreview.call($this,ui),updateMapVisuals.call($this,ui),updateBarVisuals.call($this,ui)},0)},mapValueChanged=function(ui,context){var active=color.active;if(context==colorMap||null!=active.val()){var xy=ui.val("all");switch(settings.color.mode){case"h":active.val("sv",{s:xy.x,v:100-xy.y},context);break;case"s":case"a":active.val("hv",{h:xy.x,v:100-xy.y},context);break;case"v":active.val("hs",{h:xy.x,s:100-xy.y},context);break;case"r":active.val("gb",{g:255-xy.y,b:xy.x},context);break;case"g":active.val("rb",{r:255-xy.y,b:xy.x},context);break;case"b":active.val("rg",{r:xy.x,g:255-xy.y},context)}}},colorBarValueChanged=function(ui,context){var active=color.active;if(context==colorBar||null!=active.val())switch(settings.color.mode){case"h":active.val("h",{h:360-ui.val("y")},context);break;case"s":active.val("s",{s:100-ui.val("y")},context);break;case"v":active.val("v",{v:100-ui.val("y")},context);break;case"r":active.val("r",{r:255-ui.val("y")},context);break;case"g":active.val("g",{g:255-ui.val("y")},context);break;case"b":active.val("b",{b:255-ui.val("y")},context);break;case"a":active.val("a",255-ui.val("y"),context)}},positionMapAndBarArrows=function(ui,context){if(context!=colorMap)switch(settings.color.mode){case"h":var sv=ui.val("sv");colorMap.val("xy",{x:null!=sv?sv.s:100,y:100-(null!=sv?sv.v:100)},context);break;case"s":case"a":var hv=ui.val("hv");colorMap.val("xy",{x:hv&&hv.h||0,y:100-(null!=hv?hv.v:100)},context);break;case"v":var hs=ui.val("hs");colorMap.val("xy",{x:hs&&hs.h||0,y:100-(null!=hs?hs.s:100)},context);break;case"r":var bg=ui.val("bg");colorMap.val("xy",{x:bg&&bg.b||0,y:255-(bg&&bg.g||0)},context);break;case"g":var br=ui.val("br");colorMap.val("xy",{x:br&&br.b||0,y:255-(br&&br.r||0)},context);break;case"b":var rg=ui.val("rg");colorMap.val("xy",{x:rg&&rg.r||0,y:255-(rg&&rg.g||0)},context)}if(context!=colorBar)switch(settings.color.mode){case"h":colorBar.val("y",360-(ui.val("h")||0),context);break;case"s":var s=ui.val("s");colorBar.val("y",100-(null!=s?s:100),context);break;case"v":var v=ui.val("v");colorBar.val("y",100-(null!=v?v:100),context);break;case"r":colorBar.val("y",255-(ui.val("r")||0),context);break;case"g":colorBar.val("y",255-(ui.val("g")||0),context);break;case"b":colorBar.val("y",255-(ui.val("b")||0),context);break;case"a":var a=ui.val("a");colorBar.val("y",255-(null!=a?a:255),context)}},updatePreview=function(ui){try{var all=ui.val("all");activePreview.css({backgroundColor:all&&"#"+all.hex||"transparent"}),setAlpha.call($this,activePreview,all&&Math.precision(100*all.a/255,4)||0)}catch(e){}},updateMapVisuals=function(ui){switch(settings.color.mode){case"h":setBG.call($this,colorMapDiv,new Color({h:ui.val("h")||0,s:100,v:100}).val("hex"));break;case"s":case"a":var s=ui.val("s");setAlpha.call($this,colorMapL2,100-(null!=s?s:100));break;case"v":var v=ui.val("v");setAlpha.call($this,colorMapL1,null!=v?v:100);break;case"r":setAlpha.call($this,colorMapL2,Math.precision((ui.val("r")||0)/255*100,4));break;case"g":setAlpha.call($this,colorMapL2,Math.precision((ui.val("g")||0)/255*100,4));break;case"b":setAlpha.call($this,colorMapL2,Math.precision((ui.val("b")||0)/255*100))}var a=ui.val("a");setAlpha.call($this,colorMapL3,Math.precision(100*(255-(a||0))/255,4))},updateBarVisuals=function(ui){switch(settings.color.mode){case"h":var a=ui.val("a");setAlpha.call($this,colorBarL5,Math.precision(100*(255-(a||0))/255,4));break;case"s":var hva=ui.val("hva"),saturatedColor=new Color({h:hva&&hva.h||0,s:100,v:null!=hva?hva.v:100});setBG.call($this,colorBarDiv,saturatedColor.val("hex")),setAlpha.call($this,colorBarL2,100-(null!=hva?hva.v:100)),setAlpha.call($this,colorBarL5,Math.precision(100*(255-(hva&&hva.a||0))/255,4));break;case"v":var hsa=ui.val("hsa"),valueColor=new Color({h:hsa&&hsa.h||0,s:null!=hsa?hsa.s:100,v:100});setBG.call($this,colorBarDiv,valueColor.val("hex")),setAlpha.call($this,colorBarL5,Math.precision(100*(255-(hsa&&hsa.a||0))/255,4));break;case"r":case"g":case"b":var hValue=0,vValue=0,rgba=ui.val("rgba");"r"==settings.color.mode?(hValue=rgba&&rgba.b||0,vValue=rgba&&rgba.g||0):"g"==settings.color.mode?(hValue=rgba&&rgba.b||0,vValue=rgba&&rgba.r||0):"b"==settings.color.mode&&(hValue=rgba&&rgba.r||0,vValue=rgba&&rgba.g||0);var middle=vValue>hValue?hValue:vValue;setAlpha.call($this,colorBarL2,hValue>vValue?Math.precision((hValue-vValue)/(255-vValue)*100,4):0),setAlpha.call($this,colorBarL3,vValue>hValue?Math.precision((vValue-hValue)/(255-hValue)*100,4):0),setAlpha.call($this,colorBarL4,Math.precision(middle/255*100,4)),setAlpha.call($this,colorBarL5,Math.precision(100*(255-(rgba&&rgba.a||0))/255,4));break;case"a":var a=ui.val("a");setBG.call($this,colorBarDiv,ui.val("hex")||"000000"),setAlpha.call($this,colorBarL5,null!=a?0:100),setAlpha.call($this,colorBarL6,null!=a?100:0)}},setBG=function(el,c){el.css({backgroundColor:c&&6==c.length&&"#"+c||"transparent"})},setImg=function(img,src){!isLessThanIE7||-1==src.indexOf("AlphaBar.png")&&-1==src.indexOf("Bars.png")&&-1==src.indexOf("Maps.png")?img.css({backgroundImage:"url('"+src+"')"}):(img.attr("pngSrc",src),img.css({backgroundImage:"none",filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+src+"', sizingMethod='scale')"}))},setImgLoc=function(img,y){img.css({top:y+"px"})},setAlpha=function(obj,alpha){if(obj.css({visibility:alpha>0?"visible":"hidden"}),alpha>0&&100>alpha)if(isLessThanIE7){var src=obj.attr("pngSrc");null==src||-1==src.indexOf("AlphaBar.png")&&-1==src.indexOf("Bars.png")&&-1==src.indexOf("Maps.png")?obj.css({opacity:Math.precision(alpha/100,4)}):obj.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+src+"', sizingMethod='scale') progid:DXImageTransform.Microsoft.Alpha(opacity="+alpha+")"})}else obj.css({opacity:Math.precision(alpha/100,4)});else if(0==alpha||100==alpha)if(isLessThanIE7){var src=obj.attr("pngSrc");null==src||-1==src.indexOf("AlphaBar.png")&&-1==src.indexOf("Bars.png")&&-1==src.indexOf("Maps.png")?obj.css({opacity:""}):obj.css({filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+src+"', sizingMethod='scale')"})}else obj.css({opacity:""})},revertColor=function(){color.active.val("ahex",color.current.val("ahex"))},commitColor=function(){color.current.val("ahex",color.active.val("ahex"))},radioClicked=function(e){$(this).parents("tbody:first").find('input:radio[value!="'+e.target.value+'"]').removeAttr("checked"),setColorMode.call($this,e.target.value)},currentClicked=function(){revertColor.call($this)},cancelClicked=function(){revertColor.call($this),settings.window.expandable&&hide.call($this),$.isFunction(cancelCallback)&&cancelCallback.call($this,color.active,cancelButton)},okClicked=function(){commitColor.call($this),settings.window.expandable&&hide.call($this),$.isFunction(commitCallback)&&commitCallback.call($this,color.active,okButton)},iconImageClicked=function(){show.call($this)},currentColorChanged=function(ui,context){var hex=ui.val("hex");currentPreview.css({backgroundColor:hex&&"#"+hex||"transparent"}),setAlpha.call($this,currentPreview,Math.precision(100*(ui.val("a")||0)/255,4))},expandableColorChanged=function(ui,context){var hex=ui.val("hex"),va=ui.val("va");iconColor.css({backgroundColor:hex&&"#"+hex||"transparent"}),setAlpha.call($this,iconAlpha,Math.precision(100*(255-(va&&va.a||0))/255,4)),settings.window.bindToInput&&settings.window.updateInputColor&&settings.window.input.css({backgroundColor:hex&&"#"+hex||"transparent",color:null==va||va.v>75?"#000000":"#ffffff"})},moveBarMouseDown=function(e){settings.window.element,settings.window.page;elementStartX=parseInt(container.css("left")),elementStartY=parseInt(container.css("top")),pageStartX=e.pageX,pageStartY=e.pageY,$(document).bind("mousemove",documentMouseMove).bind("mouseup",documentMouseUp),e.preventDefault()},documentMouseMove=function(e){return container.css({left:elementStartX-(pageStartX-e.pageX)+"px",top:elementStartY-(pageStartY-e.pageY)+"px"}),settings.window.expandable&&!$.support.boxModel&&container.prev().css({left:container.css("left"),top:container.css("top")}),e.stopPropagation(),e.preventDefault(),!1},documentMouseUp=function(e){return $(document).unbind("mousemove",documentMouseMove).unbind("mouseup",documentMouseUp),e.stopPropagation(),e.preventDefault(),!1},quickPickClicked=function(e){return e.preventDefault(),e.stopPropagation(),color.active.val("ahex",$(this).attr("title")||null,e.target),!1},commitCallback=$.isFunction($arguments[1])&&$arguments[1]||null,liveCallback=$.isFunction($arguments[2])&&$arguments[2]||null,cancelCallback=$.isFunction($arguments[3])&&$arguments[3]||null,show=function(){color.current.val("ahex",color.active.val("ahex"));var attachIFrame=function(){if(settings.window.expandable&&!$.support.boxModel){var table=container.find("table:first");container.before("'; + + + var $iFrameLink = $(iFrameLink); + + if (useValue) { + var $toggleLink = $(''+ settings.toggleTextOn +'').click(function(){ + var $this = $(this); + $this.toggleClass('active'); + if ($this.hasClass('active')) $this.text(settings.toggleTextOff); + $self.pad({getContents: true}); + return false; + }); + $self + .hide() + .after($toggleLink) + .after($iFrameLink) + ; + } + else { + $self.html(iFrameLink); + } + } + + // This reads the etherpad contents if required + else { + var frameUrl = $('#'+ epframeId).attr('src').split('?')[0]; + var contentsUrl = frameUrl + "/export/html"; + var target = $('#'+ options.getContents); + + // perform an ajax call on contentsUrl and write it to the parent + $.get(contentsUrl, function(data) { + + if (target.is(':input')) { + target.val(data).show(); + } + else { + target.html(data); + } + + $('#'+ epframeId).remove(); + }); + } + + + return $self; + }; +})( jQuery ); diff --git a/phpgwapi/js/jsapi.min.js b/phpgwapi/js/jsapi.min.js index 4f3a4a8791..b0b98542a7 100644 --- a/phpgwapi/js/jsapi.min.js +++ b/phpgwapi/js/jsapi.min.js @@ -3,7 +3,7 @@ * * full sources are available under https://svn.stylite.de/viewvc/egroupware/ * - * build Thu Mar 03 2016 10:20:34 + * build Thu Mar 03 2016 15:03:58 */ function egw_insertJS(_html){if(_html){var in_pos=-1,out_pos=-1;do{var in_pos=_html.search(/