diff --git a/etemplate/js/etemplate2.min.js b/etemplate/js/etemplate2.min.js deleted file mode 100644 index bc91b5f814..0000000000 --- a/etemplate/js/etemplate2.min.js +++ /dev/null @@ -1,38 +0,0 @@ -/*! - * EGroupware (http://www.egroupware.org/) minified Javascript - * - * full sources are available under https://svn.stylite.de/viewvc/egroupware/ - * - * build Mon Mar 07 2016 14:56:03 - */ - -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); -}function convertStringToBoolean(t){switch("string"==typeof t&&(t=t.toLowerCase()),t){case"1":case"true":case"yes":case"y":case 1:case!0:return!0;default:return!1}}function getUrlSymbol(t){return-1!=t.indexOf("?")?"&":"?"}function dhtmlDragAndDropObject(){return window.dhtmlDragAndDrop?window.dhtmlDragAndDrop:(this.lastLanding=0,this.dragNode=0,this.dragStartNode=0,this.dragStartObject=0,this.tempDOMU=null,this.tempDOMM=null,this.waitDrag=0,window.dhtmlDragAndDrop=this,this)}function _dhtmlxError(){return this.catches||(this.catches=[]),this}function dhtmlXHeir(t,e){for(var n in e)"function"==typeof e[n]&&(t[n]=e[n]);return t}function dhtmlxEvent(t,e,n){t.addEventListener?t.addEventListener(e,n,!1):t.attachEvent&&t.attachEvent("on"+e,n)}function dhtmlxDetachEvent(t,e,n){t.removeEventListener?t.removeEventListener(e,n,!1):t.detachEvent&&t.detachEvent("on"+e,n)}function dhtmlxDnD(t,e){e&&(this._settings=e),dhtmlxEventable(this),dhtmlxEvent(t,"mousedown",dhtmlx.bind(function(e){this.dragStart(t,e)},this))}function dataProcessor(t){return this.serverProcessor=t,this.action_param="!nativeeditor_status",this.object=null,this.updatedRows=[],this.autoUpdate=!0,this.updateMode="cell",this._tMode="GET",this.post_delim="_",this._waitMode=0,this._in_progress={},this._invalid={},this.mandatoryFields=[],this.messages=[],this.styles={updated:"font-weight:bold;",inserted:"font-weight:bold;",deleted:"text-decoration : line-through;",invalid:"background-color:FFE0E0;",invalid_cell:"border-bottom:2px solid red;",error:"color:red;",clear:"font-weight:normal;text-decoration:none;"},this.enableUTFencoding(!0),dhtmlxEventable(this),this}function itempickerDocumentAction(context,data){"use strict";var formid="itempicker_action_form",form="
    ";$j("body").append(form),$j("#"+formid).submit().remove()}function etemplate2(_container,_menuaction){"undefined"==typeof _menuaction&&(_menuaction="home.etemplate_new.ajax_process_content.etemplate"),this.DOMContainer=_container,this.menuaction=_menuaction,this.uniqueId=_container.getAttribute("id")?_container.getAttribute("id").replace(".","-"):"",this.widgetContainer=null}function etemplate2_handle_load(_type,_response){var data=_response.data;if(jQuery.isArray(data["refresh-opener"])&&window.opener){var egw=window.egw(opener);egw.refresh.apply(egw,data["refresh-opener"])}var egw=window.egw(window);if("object"==typeof data.data&&"string"==typeof data.data.app_header&&(egw.app_header(data.data.app_header,data.data.currentapp||null),delete data.data.app_header),jQuery.isArray(data.message)&&egw.message.apply(egw,data.message),data["window-close"])return"string"==typeof data["window-close"]&&"true"!==data["window-close"]&&alert(data["window-close"]),egw.close(),!0;if(data["window-focus"]&&window.focus(),window.framework&&jQuery.isArray(data.setSidebox)&&window.framework.setSidebox.apply(window.framework,data.setSidebox),"string"==typeof data.url&&"object"==typeof data.data){if("function"==typeof this.load)return this.load(data.name,data.url,data.data),!0;var node=document.getElementById(data.DOMNodeID);if(node){if(node.children.length){var old=etemplate2.getById(node.id);old&&old.clear()}var et2=new etemplate2(node);return et2.load(data.name,data.url,data.data),!0}egw.debug("error","Could not find target node %s",data.DOMNodeId)}throw"Error while parsing et2_load response"}function etemplate2_handle_validation_error(_type,_response){for(var id in _response.data){var widget=this.widgetContainer.getWidgetById(id);if(widget){widget.showMessage(_response.data[id],"validation_error");for(var tmpWidget=widget;tmpWidget._parent&&"tabbox"!=tmpWidget._type;)tmpWidget=tmpWidget._parent;"tabbox"==tmpWidget._type&&tmpWidget.activateTab(widget)}}egw().debug("warn","Validation errors",_response.data)}function etemplate2_handle_assign(type,res,req){if("undefined"!=typeof res.data.id&&"undefined"!=typeof res.data.key&&"undefined"!=typeof res.data.value){if("undefined"==typeof res.data.etemplate_exec_id||res.data.etemplate_exec_id!=this.etemplate_exec_id)return!1;if("etemplate_exec_id"==res.data.key)return this.etemplate_exec_id=res.data.value,!0;if(null==this.widgetContainer)return egw.debug("warn","Tried to call assign on an un-loaded etemplate",res.data),!1;var widget=this.widgetContainer.getWidgetById(res.data.id);if(widget){if("function"!=typeof widget["set_"+res.data.key])return egw.debug("warn","Cannot set %s attribute %s via JSON assign, no set_%s()",res.data.id,res.data.key,res.data.key),!1;try{return widget["set_"+res.data.key].call(widget,res.data.value),!0}catch(e){egw.debug("error","When assigning %s on %s via AJAX, \n"+(e.message||e+""),res.data.key,res.data.id,widget)}}return!1}throw"Invalid parameters"}function xajax_eT_wrapper(obj,widget){if(egw().debug("warn","xajax_eT_wrapper() is deprecated, replace with widget.getInstanceManager().submit()"),"object"==typeof obj){if($j("div.popupManual div.noPrint").hide(),$j("div.ajax-loader").show(),"undefined"==typeof widget&&obj.id)for(var et2=etemplate2.getByApplication(egw_getAppName()),i=0;i=0){for(var result="_"+_variable.variable,i=0;i<_variable.accessExpressions.length;i++)result+="["+_php_compileString(_vars,_variable.accessExpressions[i])+"]";return"(typeof _"+_variable.variable+' != "undefined" && typeof '+result+'!="undefined" && '+result+" != null ? "+result+':"")'}_throwCompilerErr("Variable $"+_variable.variable+" is not defined.")}function _php_compileString(_vars,_string){_string instanceof Array||(_string=[_string]);for(var parts=[],hasString=!1,i=0;i<_string.length;i++){var part=_string[i];"string"==typeof part?(hasString=!0,parts.push("'"+part.replace(/\\/g,"\\\\").replace(/'/g,"\\'")+"'")):parts.push(_php_compileVariable(_vars,part))}return hasString||parts.push('""'),parts.join(" + ")}function _php_compileJSCode(_vars,_tree){return"return "+_php_compileString(_vars,_tree)+";"}var STATE_DEFAULT=0,STATE_ESCAPED=1,STATE_CURLY_BRACE_OPEN=2,STATE_EXPECT_CURLY_BRACE_CLOSE=3,STATE_EXPECT_RECT_BRACE_CLOSE=4,STATE_EXPR_BEGIN=5,STATE_EXPR_END=6,PHP_VAR_PREG=/^([A-Za-z0-9_]+)/;this.et2_compilePHPExpression=function(_expr,_vars){"undefined"==typeof _vars&&(_vars=[]);try{var parser=_php_parser(_expr),syntaxTree=[];_php_parseDoubleQuoteString(parser,syntaxTree);var js=_php_compileJSCode(_vars,syntaxTree);egw.debug("log","Compiled PHP "+_expr+" --> "+js)}catch(e){return egw.debug("warn","Error compiling PHP "+_expr+" --> using it literally ("+("string"==typeof e?e:e.message)+")!"),function(){return _expr}}for(var attrs=[],i=0;i<_vars.length;i++)attrs.push("_"+_vars[i]);return attrs.push(js),Function.apply(Function,attrs)}}).call(window);var et2_arrayMgr=function(){"use strict";return Class.extend({splitIds:!0,init:function(_data,_parentMgr){if("undefined"==typeof _parentMgr&&(_parentMgr=null),this.parentMgr=_parentMgr,"undefined"!=typeof _data&&_data||(egw.debug("log","No data passed to content array manager. Probably a mismatch between template namespaces and data."),_data={}),this.splitIds)for(var key in _data){var indexes=key.replace(/[/g,"[").split("[");if(indexes.length>1){for(var value=_data[key],target=_data,i=0;i1){indexes=[indexes.shift(),indexes.join("[")],indexes[1]=indexes[1].substring(0,indexes[1].length-1);var children=indexes[1].split("][");children.length&&(indexes=jQuery.merge([indexes[0]],children))}return indexes},getPath:function(_path){return"undefined"==typeof _path&&(_path=[]),null!=this.perspectiveData.key&&(_path=this.perspectiveData.key.replace(/]/g,"").split("[").concat(_path)),null!=this.parentMgr&&(_path=this.parentMgr.getPath(_path)),_path},getEntry:function(_key,_referenceInto,_skipEmpty){"undefined"==typeof _referenceInto&&(_referenceInto=!1),"undefined"==typeof _skipEmpty&&(_skipEmpty=!1);for(var indexes=this.explodeKey(_key),entry=this.data,i=0;i=0&&(null!=this.perspectiveData.row||!_ident.match(/\$\{?row\}?/))){var row=this.perspectiveData.row,row_cont=this.data[row]||{},cont=this.data,_cont=this.data,proto=this.constructor.prototype;if("undefined"==typeof proto.compiledExpressions[_ident])try{null==this.perspectiveData.row?proto.compiledExpressions[_ident]=et2_compilePHPExpression(_ident,["cont","_cont"]):proto.compiledExpressions[_ident]=et2_compilePHPExpression(_ident,["row","cont","row_cont","_cont"])}catch(e){proto.compiledExpressions[_ident]=null,egw.debug("error","Error while compiling PHP->JS ",e)}if(proto.compiledExpressions[_ident])try{_ident=null==this.perspectiveData.row?proto.compiledExpressions[_ident](cont,_cont):proto.compiledExpressions[_ident](row,cont,row_cont,_cont)}catch(e){egw.debug("log","object"==typeof e?e.message:e),_ident=null}}return is_index_in_content&&(_ident="@"==_ident.charAt(1)?this.getRoot().getEntry(_ident.substr(2)):this.getEntry(_ident.substr(1))),_ident},parseBoolExpression:function(_expression){if("!"==_expression.charAt(0))return!this.parseBoolExpression(_expression.substr(1));var parts=_expression.split("="),val=this.expandName(parts[0]);if("undefined"!=typeof parts[1]){var checkVal=this.expandName(parts[1]);return"/"==checkVal.charAt(0)?!!new RegExp(checkVal.substr(1,checkVal.length-2)).test(val):val==checkVal}return et2_evalBool(val)},openPerspective:function(_owner,_root,_row){var root="string"==typeof _root?this.data[_root]:null==_root?this.data:_root;"undefined"==typeof root&&"string"==typeof _root&&(root=this.getEntry(_root));var constructor=this.isReadOnly?et2_readonlysArrayMgr:et2_arrayMgr,mgr=new constructor(root,this);return mgr.perspectiveData.owner=_owner,"string"==typeof _root&&(mgr.perspectiveData.key=_root),"undefined"!=typeof _row&&(mgr.perspectiveData.row=_row),mgr}})}.call(this),et2_readonlysArrayMgr=function(){"use strict";return et2_arrayMgr.extend({isReadOnly:function(_id,_attr,_parent){var entry=null;if(null!=_id){(_id.indexOf("$")>=0||_id.indexOf("@")>=0)&&(_id=this.expandName(_id));for(var mgr=this;mgr.parentMgr&&jQuery.isEmptyObject(mgr.data);)mgr=mgr.parentMgr;entry=mgr.getEntry(_id)}return"undefined"!=typeof entry&&"object"!=typeof entry?entry:"undefined"!=typeof _attr&&null!==_attr?et2_evalBool(_attr):"undefined"!=typeof _parent&&_parent?!0:(entry=this.getEntry("__ALL__"),null!==entry&&"undefined"!=typeof entry)},expandName:function(ident){return this.perspectiveData.owner.getArrayMgr("content").expandName(ident)}})}.call(this),et2_registry={},et2_widget=function(){"use strict";return ClassWithAttributes.extend({attributes:{id:{name:"ID",type:"string",description:"Unique identifier of the widget"},no_lang:{name:"No translation",type:"boolean",default:!1,description:"If true, no translations are made for this widget"},span:{ignore:!0},type:{name:"Widget type",type:"string",ignore:!0,description:"What kind of widget this is"},readonly:{ignore:!0}},legacyOptions:[],createNamespace:!1,init:function(_parent,_attrs){"undefined"==typeof _parent&&(_parent=null),"undefined"==typeof _attrs&&(_attrs={}),this._mgrs={},this._inst=null,this._children=[],this._type=_attrs.type,this.id=_attrs.id,null!=_parent&&_parent.addChild(this),this.supportedWidgetClasses=[et2_widget],_attrs.id&&this.createNamespace&&this.checkCreateNamespace(),this.id,this.transformAttributes(_attrs),this.options=et2_cloneObject(_attrs)},destroy:function(){for(var i=this._children.length-1;i>=0;i--)this._children[i].free();"undefined"!=typeof this._parent&&null!==this._parent&&this._parent.removeChild(this);for(var key in this._mgrs)this._mgrs[key]&&this._mgrs[key].owner==this&&this._mgrs[key].free()},clone:function(_parent){"undefined"==typeof _parent&&(_parent=null);var copy=new this.constructor(_parent,this.options);return copy.assign(this),copy},assign:function(_obj){"undefined"==typeof _obj._children&&this.egw().debug("log","Foo!");for(var i=0;i<_obj._children.length;i++)_obj._children[i].clone(this);this.setArrayMgrs(_obj.mgrs)},getParent:function(){return this._parent},getChildren:function(){return this._children},getRoot:function(){return null!=this._parent?this._parent.getRoot():this},addChild:function(_node){this.insertChild(_node,this._children.length)},insertChild:function(_node,_idx){this.isOfSupportedWidgetClass(_node)?(_node._parent&&_node._parent.removeChild(_node),_node._parent=this,this._children.splice(_idx,0,_node),_node.implements(et2_IDOMNode)&&this.implements(et2_IDOMNode)&&_node.parentNode&&(_node.detachFromDOM(),_node.parentNode=this.getDOMNode(_node),_node.attachToDOM())):this.egw().debug("error","Widget "+_node._type+" is not supported by this widget class",this)},removeChild:function(_node){var idx=this._children.indexOf(_node);idx>=0&&(_node._parent=null,this._children.splice(idx,1))},getWidgetById:function(_id){if(this.id==_id)return this;if(!this._children)return null;for(var i=0;i0){if(_target.id&&this.getArrayMgr("modifications").getEntry(_target.id)){var mod=this.getArrayMgr("modifications").getEntry(_target.id);"undefined"!=typeof mod.options&&(attrValue=_attrsObj[i].value=mod.options)}"@"!=attrValue.charAt(0)&&-1==attrValue.indexOf("$")||(attrValue=mgr.expandName(attrValue));for(var splitted=et2_csvSplit(attrValue+""),j=0;j_proto.legacyOptions.length&&(attrValue=splitted.slice(j));var attr=_proto.attributes[_proto.legacyOptions[j]];"boolean"==attr.type?attrValue=mgr.parseBoolExpression(attrValue):"object"!=typeof attrValue&&(attrValue=mgr.expandName(attrValue)),_target[_proto.legacyOptions[j]]=attrValue}}else{if(null!=mgr&&"undefined"!=typeof _proto.attributes[attrName]){var attr=_proto.attributes[attrName];attrValue="boolean"==attr.type?mgr.parseBoolExpression(attrValue):mgr.expandName(attrValue)}_target[attrName]=attrValue}}},transformAttributes:function(_attrs){if(this.id&&("string"!=typeof this.id&&console.log(this.id),this.getArrayMgr("modifications"))){var data=this.getArrayMgr("modifications").getEntry(this.id);if(this.createNamespace&&this.getArrayMgr("modifications").perspectiveData.owner==this&&(data=this.getArrayMgr("modifications").data),"object"==typeof data)for(var key in data)_attrs[key]=data[key]}for(var key in _attrs)_attrs[key]&&"undefined"!=typeof this.attributes[key]&&(this.attributes[key].translate===!0||"!no_lang"===this.attributes[key].translate&&!_attrs.no_lang)&&(_attrs[key]=this.egw().lang(_attrs[key],"%s"))},createElementFromNode:function(_node){var attributes={},_nodeName=attributes.type=_node.getAttribute("type")?_node.getAttribute("type"):_node.nodeName.toLowerCase(),readonly=attributes.readonly=this.getArrayMgr("readonlys")?this.getArrayMgr("readonlys").isReadOnly(_node.getAttribute("id"),_node.getAttribute("readonly"),"undefined"!=typeof this.readonly?this.readonly:this.options.readonly):!1,modifications=this.getArrayMgr("modifications");if(modifications&&_node.getAttribute("id")){var entry=modifications.getEntry(_node.getAttribute("id"));if(null==entry){var entry=modifications.data[_node.getAttribute("id")];if(entry)this.egw().debug("warn","getEntry("+_node.getAttribute("id")+") failed, but the data is there.",modifications,entry);else var entry=modifications.getRoot().getEntry(_node.getAttribute("id"))}entry&&entry.type&&(_nodeName=attributes.type=entry.type),entry=null}("@"==_nodeName.charAt(0)||_nodeName.indexOf("$")>=0)&&(_nodeName=attributes.type=this.getArrayMgr("content").expandName(_nodeName));var constructor="undefined"==typeof et2_registry[_nodeName]?et2_placeholder:et2_registry[_nodeName];readonly&&"undefined"!=typeof et2_registry[_nodeName+"_ro"]&&(constructor=et2_registry[_nodeName+"_ro"]),this.parseXMLAttrs(_node.attributes,attributes,constructor.prototype),constructor.prototype.generateAttributeSet(attributes);var widget=new constructor(this,attributes);return widget.loadFromXML(_node),widget},loadFromXML:function(_node){for(var i=0;i<_node.childNodes.length;i++){var node=_node.childNodes[i],widgetType=node.nodeName.toLowerCase();"#comment"!=widgetType&&("#text"!=widgetType?this.createElementFromNode(node):node.data.replace(/^\s+|\s+$/g,"")&&this.loadContent(node.data))}},loadContent:function(_content){},loadingFinished:function(promises){if(this.initAttributes(this.options),"undefined"==typeof promises){promises=[];var warn_if_deferred=!0}var loadChildren=function(){for(var i=0;iidx||idx>=this.parentNode.childNodes.length-1?this.parentNode.appendChild(node):this.parentNode.insertBefore(node,this.parentNode.childNodes[idx]),this._attachSet={node:node,parent:this.parentNode},!0}return!1},isAttached:function(){return null!=this.parentNode},getSurroundings:function(){return this._surroundingsMgr||(this._surroundingsMgr=new et2_surroundingsMgr(this)),this._surroundingsMgr},set_parent_node:function(_node){if("string"==typeof _node){var parent=$j("#"+_node);0==parent.length?this.egw().debug("warn",'Unable to find DOM parent node with ID "%s" for widget %o.',_node,this):this.setParentDOMNode(parent.get(0))}else this.setParentDOMNode(_node)},setParentDOMNode:function(_node){_node!=this.parentNode&&(this.detachFromDOM(),this.parentNode=_node,this.attachToDOM())},getParentDOMNode:function(){return this.parentNode},getDOMIndex:function(){if(this._parent){var idx=0,children=this._parent.getChildren();if(children&&children.indexOf)return children.indexOf(this);egw.debug("warn","No Array.indexOf(), falling back to looping. ");for(var i=0;i0){var hasPlaceholder=et2_hasChild(this._widgetSurroundings,this._widgetPlaceholder);if(hasPlaceholder||(this._widgetPlaceholder=document.createElement("span"),this._widgetSurroundings.push(this._widgetPlaceholder),this._ownPlaceholder=!0),1==this._widgetSurroundings.length)this._widgetSurroundings[0]==this._widgetPlaceholder?this._widgetContainer=null:this._widgetContainer=this._widgetSurroundings[0];else{this._widgetContainer=document.createElement("span");for(var i=0;i1?parts.pop():null,template_name=parts.pop(),xml=null,templates=etemplate2.prototype.templates;if(!(xml=templates[template_name])){if(template_name.indexOf(".")<0){var root=_parent?_parent.getRoot():null,top_name=root&&root._inst?root._inst.name:null;top_name&&template_name.indexOf(".")<0&&(template_name=top_name+"."+template_name)}if(xml=templates[template_name],!xml){var url=this.options.url;if(!this.options.url){var splitted=template_name.split(".");url=this.getRoot()._inst.template_base_url+splitted.shift()+"/templates/default/"+splitted.join(".")+".xet"+(cache_buster?"?download="+cache_buster:"")}return-1==url.indexOf("?")&&(url+="?download="+(new Date).valueOf()),void((this.options.url||splitted.length)&&et2_loadXMLFromURL(url,function(_xmldoc){for(var i=0;i<_xmldoc.childNodes.length;i++){var template=_xmldoc.childNodes[i];"template"==template.nodeName.toLowerCase()&&(templates[template.getAttribute("id")]=template)}"undefined"!=typeof templates[template_name]&&this.loadFromXML(templates[template_name]),this.loading.resolve()},this))}}null!==xml&&"undefined"!=typeof xml?(this.egw().debug("log","Loading template from XML: ",template_name),this.loadFromXML(xml),this.loading.resolve()):(this.egw().debug("warn","Unable to find XML for ",template_name),this.loading.reject())}else this.loading.resolve()},checkCreateNamespace:function(){if(this.content){var old_id=this.id;this.id=this.content,this._super.apply(this,arguments),this.id=old_id}},getDOMNode:function(){return this.div},doLoadingFinished:function(){return this._super.apply(this,arguments),this.loading.done(jQuery.proxy(function(){$j(this).trigger("load")},this.div)),this.loading.promise()}})}.call(this);et2_register_widget(et2_template,["template"]);var et2_grid=function(){"use strict";return et2_DOMWidget.extend([et2_IDetachedDOM,et2_IAligned,et2_IResizeable],{createNamespace:!0,attributes:{border:{ignore:!0},align:{name:"Align",type:"string",default:"left",description:"Position of this element in the parent hbox"},spacing:{ignore:!0},padding:{ignore:!0},sortable:{name:"Sortable callback",type:"string",default:et2_no_init,description:"PHP function called when user sorts the grid. Setting this enables sorting the grid rows. The callback will be passed the ID of the grid and the new order of the rows."}},init:function(){this.table=$j(document.createElement("table")).addClass("et2_grid"),this.thead=$j(document.createElement("thead")).appendTo(this.table),this.tfoot=$j(document.createElement("tfoot")).appendTo(this.table),this.tbody=$j(document.createElement("tbody")).appendTo(this.table),this._super.apply(this,arguments),this.rowCount=0,this.columnCount=0,this.cells=[],this.rowData=[],this.colData=[],this.managementArray=[],this.template_node=null,this.wrapper=null},destroy:function(){this._super.call(this,arguments)},_initCells:function(_colData,_rowData){for(var w=_colData.length,h=_rowData.length,cells=new Array(h),y=0;h>y;y++){cells[y]=new Array(w);for(var x=0;w>x;x++)cells[y][x]={td:null,widget:null,colData:_colData[x],rowData:_rowData[y],disabled:_colData[x].disabled||_rowData[y].disabled,class:_colData[x].class,colSpan:1,autoColSpan:!1,rowSpan:1,autoRowSpan:!1,width:_colData[x].width,x:x,y:y}}return cells},_getColDataEntry:function(){return{width:"auto",class:"",align:"",span:"1",disabled:!1}},_getRowDataEntry:function(){return{height:"auto",class:"",valign:"top",span:"1",disabled:!1}},_getCell:function(_cells,_x,_y){if(_y>=0&&_y<_cells.length){var row=_cells[_y];if(_x>=0&&_x0||value.indexOf("$")>0){var ident=content.expandName(value);for("@"!=value[0]&&(ident=content.getEntry(ident,!1,!0));null!=ident&&1e3>rowIndex;)rowData[rowIndex]=jQuery.extend({},rowDataEntry),content.perspectiveData.row=++rowIndex,ident=content.expandName(value),"@"!=value[0]&&(ident=content.getEntry(ident,!1,!0));return void(rowIndex>=1e3&&egw.debug("error","Problem in autorepeat fallback: too many rows for '%s'. Use a nextmatch, or start debugging.",value))}}};et2_filteredNodeIterator(this.lastRowNode,check,this),cont=!1,content.perspectiveData=currentPerspective}rowIndex<=rowData.length-1&&(this.lastRowNode=null)},_fillCells:function(cells,columns,rows){var h=cells.length,w=h>0?cells[0].length:0,currentPerspective=jQuery.extend({},this.getArrayMgr("content").perspectiveData),x=0;et2_filteredNodeIterator(columns,function(node,nodeName){function _readColNode(node,nodeName){if(y>=h)return void this.egw().debug("warn","Skipped grid cell in column, '"+nodeName+"'");var cell=this._getCell(cells,x,y);node.getAttribute("span")?cell.rowSpan=node.getAttribute("span"):(cell.rowSpan=cell.colData.span,cell.autoRowSpan=!0),"all"==cell.rowSpan&&(cell.rowSpan=cells.length);for(var span=cell.rowSpan=this._forceNumber(cell.rowSpan),widget=this.createElementFromNode(node,nodeName),i=0;span>i&&y=w)return void("description"!=nodeName&&this.egw().debug("warn","Skipped grid cell in row, '"+nodeName+"'"));var cell=this._getCell(cells,x,y);node.getAttribute("span")?cell.colSpan=node.getAttribute("span"):(cell.colSpan=cell.rowData.span,cell.autoColSpan=!0),"all"==cell.colSpan&&(cell.colSpan=cells[y].length);var span=cell.colSpan=this._forceNumber(cell.colSpan);if(node.getAttribute("align")&&(cell.align=node.getAttribute("align")),"nextmatch-"==nodeName.substr(0,10)&&(cell.nm_id=node.getAttribute("id")),node.getAttribute("class")&&(cell.class+=(cell.class?" ":"")+node.getAttribute("class")),!cell.disabled){if(!nm){var mgrs=this.getArrayMgrs();for(var name in mgrs)this.getArrayMgr(name).perspectiveData.row=y;this._getCell(cells,x,y).rowData.id&&(this._getCell(cells,x,y).rowData.id=this.getArrayMgr("content").expandName(this._getCell(cells,x,y).rowData.id)),this._getCell(cells,x,y).rowData.class&&(this._getCell(cells,x,y).rowData.class=this.getArrayMgr("content").expandName(this._getCell(cells,x,y).rowData.class))}var widget=this.createElementFromNode(node,nodeName)}for(var i=0;span>i&&xy;y++){var x=0;et2_filteredNodeIterator(this.lastRowNode,readRowNode,this)}for(var name in this.getArrayMgrs())this.getArrayMgr(name).perspectiveData=currentPerspective},_expandLastCells:function(_cells){for(var h=_cells.length,w=h>0?_cells[0].length:0,y=0;h>y;y++)for(var x=w-1;x>=0;x--){var cell=_cells[y][x];if(null!=cell.widget){cell.autoColSpan&&(cell.colSpan=w-x);break}}for(var x=0;w>x;x++)for(var y=h-1;y>=0;y--){var cell=_cells[y][x];if(null!=cell.widget){cell.autoRowSpan&&(cell.rowSpan=h-y);break}}},loadFromXML:function(_node){this.template_node=_node;var rowsElems=et2_directChildrenByTagName(_node,"rows"),columnsElems=et2_directChildrenByTagName(_node,"columns");if(1!=rowsElems.length||1!=columnsElems.length)throw"Error while parsing grid, none or multiple rows or columns tags!";var columns=columnsElems[0],rows=rowsElems[0],colData=[],rowData=[];this._fetchRowColData(columns,rows,colData,rowData);var cells=this._initCells(colData,rowData);this._fillCells(cells,columns,rows),this._expandLastCells(cells),this.createTableFromCells(cells,colData,rowData)},createTableFromCells:function(_cells,_colData,_rowData){this.managementArray=[],this.cells=_cells,this.colData=_colData,this.rowData=_rowData;for(var h=this.rowCount=_cells.length,w=this.columnCount=h>0?_cells[0].length:0,y=0;h>y;y++){var parent=(_cells[y],this.tbody);switch(this.rowData[y].part){case"header":this.tbody.children().length||this.tfoot.children().length||(parent=this.thead);break;case"footer":this.tbody.children().length||(parent=this.tfoot)}var tr=$j(document.createElement("tr")).appendTo(parent).addClass(this.rowData[y].class);this.rowData[y].disabled&&tr.hide(),"auto"!=this.rowData[y].height&&tr.height(this.rowData[y].height),this.rowData[y].valign&&tr.attr("valign",this.rowData[y].valign),this.rowData[y].id&&tr.attr("id",this.rowData[y].id);for(var x=0;w>x;){var cell=this._getCell(_cells,x,y);if(null==cell.td&&null!=cell.widget){var td=$j(document.createElement("td")).appendTo(tr).addClass(cell.class);cell.disabled&&(td.hide(),cell.widget.options=cell.disabled),"auto"!=cell.width&&td.width(cell.width),cell.align&&td.attr("align",cell.align),this.managementArray.push({cell:td[0],widget:cell.widget,disabled:cell.disabled});var cs=x==w-1?w-x:Math.min(w-x,cell.colSpan),rs=y==h-1?h-y:Math.min(h-y,cell.rowSpan);cs>1&&td.attr("colspan",cs),rs>1&&td.attr("rowspan",rs);for(var sx=x;x+cs>sx;sx++)for(var sy=y;y+rs>sy;sy++)this._getCell(_cells,sx,sy).td=td;x+=cell.colSpan}else x++}}},getDOMNode:function(_sender){if(_sender==this||"undefined"==typeof _sender)return null!=this.wrapper?this.wrapper[0]:this.table[0];for(var i=0;i').parent(),this.height&&wrapper.css("height",this.height)),wrapper.css("overflow",_value),!wrapper.length||_value&&null!=_value&&"visible"!==_value||this.table.unwrap()},set_align:function(_value){this.align=_value},get_align:function(_value){return this.align},set_value:function(_value){for(var i=0;i=0;i--)this._children[i].free();for(var key in this._mgrs)this._mgrs[key]&&this._mgrs[key].owner==this&&this._mgrs[key].free()}})}.call(this),et2_placeholder=function(){"use strict";return et2_baseWidget.extend([et2_IDetachedDOM],{init:function(){this._super.apply(this,arguments),this.attrNodes={},this.visible=!1,this.placeDiv=$j(document.createElement("span")).addClass("et2_placeholder");var headerNode=$j(document.createElement("span")).text(this._type||"").addClass("et2_caption").appendTo(this.placeDiv),attrsCntr=$j(document.createElement("span")).appendTo(this.placeDiv).hide();headerNode.click(this,function(e){e.data.visible=!e.data.visible,e.data.visible?attrsCntr.show():attrsCntr.hide()});for(var key in this.options)"undefined"!=typeof this.options[key]&&("undefined"==typeof this.attrNodes[key]&&(this.attrNodes[key]=$j(document.createElement("span")).addClass("et2_attr"),attrsCntr.append(this.attrNodes[key])),this.attrNodes[key].text(key+"="+this.options[key]));this.setDOMNode(this.placeDiv[0])},getDetachedAttributes:function(_attrs){_attrs.push("value")},getDetachedNodes:function(){return[this.placeDiv[0]]},setDetachedAttributes:function(_nodes,_values){this.placeDiv=jQuery(_nodes[0])}})}.call(this),et2_box=function(){"use strict";return et2_baseWidget.extend([et2_IDetachedDOM],{attributes:{rows:{ignore:!0},cols:{ignore:!0}},createNamespace:!0,init:function(){this._super.apply(this,arguments),this.div=$j(document.createElement("div")).addClass("et2_"+this._type).addClass("et2_box_widget"),this.setDOMNode(this.div[0])},loadFromXML:function(_node){if("box"!=this._type)return this._super.apply(this,arguments);for(var childIndex=0,repeatNode=null,i=0;i<_node.childNodes.length;i++){var node=_node.childNodes[i],widgetType=node.nodeName.toLowerCase();if("#comment"!=widgetType)if("#text"!=widgetType){var id=et2_readAttrWithDefault(node,"id","");id.indexOf("$")<0||"box"!=widgetType?(this.createElementFromNode(node),childIndex++):repeatNode=node}else node.data.replace(/^\s+|\s+$/g,"")&&this.loadContent(node.data)}if(null!=repeatNode){var currentPerspective=this.getArrayMgr("content").perspectiveData;for(childIndex;"undefined"!=typeof this.getArrayMgr("content").data[childIndex]&&this.getArrayMgr("content").data[childIndex];childIndex++){var mgrs=this.getArrayMgrs();for(var name in mgrs)this.getArrayMgr(name).getEntry(childIndex)&&(this.getArrayMgr(name).perspectiveData.row=childIndex);this.createElementFromNode(repeatNode)}for(var name in this.getArrayMgrs())this.getArrayMgr(name).perspectiveData=currentPerspective}},getDetachedAttributes:function(_attrs){_attrs.push("data")},getDetachedNodes:function(){return[this.getDOMNode()]},setDetachedAttributes:function(_nodes,_values){if(_values.data)for(var pairs=_values.data.split(/,/g),i=0;iMath.min(pos,A._max,splitter._DA-bar._DA-B._min)?bar.addClass(opts.barDockedClass).css(opts.origin,range):bar.removeClass(opts.barDockedClass).css(opts.origin,limit),bar._DA=bar[0][opts.pxSplit]):resplit(pos),setBarState(pos==limit?opts.barActiveClass:opts.barLimitClass)}function endSplitMouse(evt){setBarState(opts.barNormalClass),bar.addClass(opts.barHoverClass);var pos=A._posSplit+evt[opts.eventPos];opts.outline&&(zombie.remove(),zombie=null,resplit(pos)),panes.css("-webkit-user-select","text").find("iframe").andSelf().filter("iframe").removeClass(opts.iframeClass),$(document).unbind("mousemove"+opts.eventNamespace+" mouseup"+opts.eventNamespace)}function resplit(pos){bar._DA=bar[0][opts.pxSplit],opts.dockPane==A&&posMath.min(pos,A._max,splitter._DA-bar._DA-B._min)?(bar.addClass(opts.barDockedClass),bar._DA=bar[0][opts.pxSplit],pos=opts.dockPane==A?0:splitter._DA-bar._DA,null==bar._pos&&(bar._pos=A[0][opts.pxSplit])):(bar.removeClass(opts.barDockedClass),bar._DA=bar[0][opts.pxSplit],bar._pos=null,pos=Math.max(A._min,splitter._DA-B._max,Math.min(pos,A._max,splitter._DA-bar._DA-B._min))),bar.css(opts.origin,pos).css(opts.fixed,splitter._DF),A.css(opts.origin,0).css(opts.split,pos).css(opts.fixed,splitter._DF),B.css(opts.origin,pos+bar._DA).css(opts.split,splitter._DA-bar._DA-pos).css(opts.fixed,splitter._DF),panes.trigger("resize"+opts.eventNamespace)}function dimSum(jq,dims){for(var sum=0,i=1;i*",splitter[0]).addClass(opts.paneClass).css({position:"absolute","z-index":"1","-moz-outline-style":"none"}),A=$(panes[0]),B=$(panes[1]);opts.dockPane=opts.dock&&(/right|bottom/.test(opts.dock)?B:A);var focuser=$('').attr({accessKey:opts.accessKey,tabIndex:opts.tabIndex,title:opts.splitbarClass}).bind("focus"+opts.eventNamespace,function(){this.focus(),bar.addClass(opts.barActiveClass)}).bind("keydown"+opts.eventNamespace,function(e){var key=e.which||e.keyCode,dir=key==opts["key"+opts.side1]?1:key==opts["key"+opts.side2]?-1:0;dir&&resplit(A[0][opts.pxSplit]+dir*opts.pxPerKey,!1)}).bind("blur"+opts.eventNamespace,function(){bar.removeClass(opts.barActiveClass)}),bar=$("
    ").insertAfter(A).addClass(opts.barClass).addClass(opts.barStateClass).append(focuser).attr({unselectable:"on"}).css({position:"absolute","user-select":"none","-webkit-user-select":"none","-khtml-user-select":"none","-moz-user-select":"none","z-index":"100"}).bind("mousedown"+opts.eventNamespace,startSplitMouse).bind("mouseover"+opts.eventNamespace,function(){$(this).addClass(opts.barHoverClass)}).bind("mouseout"+opts.eventNamespace,function(){$(this).removeClass(opts.barHoverClass)});/^(auto|default|)$/.test(bar.css("cursor"))&&bar.css("cursor",opts.cursor),bar._DA=bar[0][opts.pxSplit],splitter._PBF=dimSum(splitter,"border"+opts.side3+"Width","border"+opts.side4+"Width"),splitter._PBA=dimSum(splitter,"border"+opts.side1+"Width","border"+opts.side2+"Width"),A._pane=opts.side1,B._pane=opts.side2,$.each([A,B],function(){this._splitter_style=this.style,this._min=opts["min"+this._pane]||dimSum(this,"min-"+opts.split),this._max=opts["max"+this._pane]||dimSum(this,"max-"+opts.split)||9999,this._init=opts["size"+this._pane]===!0?parseInt($.curCSS(this[0],opts.split),10):opts["size"+this._pane]});var initPos=A._init;isNaN(B._init)||(initPos=splitter[0][opts.pxSplit]-splitter._PBA-B._init-bar._DA),opts.cookie&&($.cookie||alert("jQuery.splitter(): jQuery cookie plugin required"),initPos=parseInt($.cookie(opts.cookie),10),$(window).bind("unload"+opts.eventNamespace,function(){var state=String(bar.css(opts.origin));$.cookie(opts.cookie,state,{expires:opts.cookieExpires||365,path:opts.cookiePath||document.location.pathname})})),isNaN(initPos)&&(initPos=Math.round((splitter[0][opts.pxSplit]-splitter._PBA-bar._DA)/2)),opts.anchorToWindow&&(opts.resizeTo=window),opts.resizeTo?(splitter._hadjust=dimSum(splitter,"borderTopWidth","borderBottomWidth","marginBottom"),splitter._hmin=Math.max(dimSum(splitter,"minHeight"),20),$(window).bind("resize"+opts.eventNamespace,function(){var top=splitter.offset().top,eh=$(opts.resizeTo).height();splitter.css("height",Math.max(eh-top-splitter._hadjust,splitter._hmin)+"px"),splitter.trigger("resize")}).trigger("resize"+opts.eventNamespace)):opts.resizeToWidth&&$(window).bind("resize"+opts.eventNamespace,function(){splitter.trigger("resize")}),opts.dock&&(splitter.bind("toggleDock"+opts.eventNamespace,function(){var pw=opts.dockPane[0][opts.pxSplit];splitter.trigger(pw?"dock":"undock")}).bind("dock"+opts.eventNamespace,function(){var pw=A[0][opts.pxSplit];if(pw&&!bar.hasClass("splitter-bar-horizontal-docked")&&!bar.hasClass("splitter-bar-vertical-docked")){bar._pos=pw;var x={};x[opts.origin]=opts.dockPane==A?0:splitter[0][opts.pxSplit]-splitter._PBA-bar[0][opts.pxSplit],bar.animate(x,opts.dockSpeed||1,opts.dockEasing,function(){bar.addClass(opts.barDockedClass),resplit(x[opts.origin]+1)})}}).bind("undock"+opts.eventNamespace,function(){var pw=opts.dockPane[0][opts.pxSplit];if(!pw){(null==bar._pos||Math.abs(bar._pos-splitter._DA-bar._DA)<20)&&(bar._pos=splitter._DA/2);var x={};x[opts.origin]=bar._pos+"px",bar.removeClass(opts.barDockedClass).animate(x,opts.undockSpeed||opts.dockSpeed||1,opts.undockEasing||opts.dockEasing,function(){resplit(bar._pos),bar._pos=null})}}),opts.dockKey&&$('').attr({accessKey:opts.dockKey,tabIndex:-1}).appendTo(bar).bind("focus",function(){splitter.trigger("toggleDock"),this.blur()}),bar.bind("dblclick",function(){splitter.trigger("toggleDock")})),splitter.bind("destroy"+opts.eventNamespace,function(){$([window,document]).unbind(opts.eventNamespace),bar.unbind().remove(),panes.removeClass(opts.paneClass),splitter.removeClass(opts.splitterClass).add(panes).unbind(opts.eventNamespace).attr("style",function(el){return this._splitter_style||""}),splitter=bar=focuser=panes=A=B=opts=args=null}).bind("resize"+opts.eventNamespace,function(e,size){e.target==this&&(splitter._DF=splitter[0][opts.pxFixed]-splitter._PBF,splitter._DA=splitter[0][opts.pxSplit]-splitter._PBA,splitter._DF<=0||splitter._DA<=0||(resplit(isNaN(size)?opts.sizeRight||opts.sizeBottom?splitter._DA-B[0][opts.pxSplit]-bar._DA:A[0][opts.pxSplit]:size),setBarState(opts.barNormalClass)))}).trigger("resize",[initPos])}})}}(jQuery);var et2_split=function(){"use strict";return et2_DOMWidget.extend([et2_IResizeable,et2_IPrint],{attributes:{orientation:{name:"Orientation",description:"Horizontal or vertical (v or h)",default:"v",type:"string"},outline:{name:"Outline",description:"Use a 'ghosted' copy of the splitbar and does not resize the panes until the mouse button is released. Reduces flickering or unwanted re-layout during resize",default:!1,type:"boolean"},dock_side:{name:"Dock",description:"Allow the user to 'Dock' the splitbar to one side of the splitter, essentially hiding one pane and using the entire splitter area for the other pane. One of leftDock, rightDock, topDock, bottomDock.",default:et2_no_init,type:"string"},width:{default:"100%"},overflow:{ignore:!0},no_lang:{ignore:!0},rows:{ignore:!0},cols:{ignore:!0}},DOCK_TOLERANCE:15,init:function(){this._super.apply(this,arguments),this.div=$j(document.createElement("div")).addClass("et2_split"),this.dynheight=new et2_dynheight(this.getParent().getDOMNode()||this.getInstanceManager().DOMContainer,this.div,100),this.left=$j("
    Top / Left
    ").appendTo(this.div),this.right=$j("
    Bottom / Right
    ").appendTo(this.div),this.loading=jQuery.Deferred(),this.stop_resize=!1},destroy:function(){this.left.next().off("mouseup"),this.div.trigger("destroy"),this.dynheight.free(),this._super.apply(this,arguments),0==this._children.length&&this.div.empty(),this.div.remove()},loadFromXML:function(){this._super.apply(this,arguments),this._children.length>0&&(this._children[0]&&(this.left.detach(),this.left=$j(this._children[0].getDOMNode(this._children[0])).appendTo(this.div)),this._children[1]&&(this.right.detach(),this.right=$j(this._children[1].getDOMNode(this._children[1])).appendTo(this.div)));for(var i=0;i activates widget"},tabindex:{name:"Tab index",type:"integer",default:et2_no_init,description:"Specifies the tab order of a widget when the 'tab' button is used for navigating."},background_image:{name:"Add image in front of text",type:"boolean",description:"Adds image in front of text instead of just using an image with text as tooltip",default:et2_no_init},novalidate:{name:"Do NOT validate form",type:"boolean",description:"Do NOT validate form before submitting it",default:!1},needed:{ignore:!0}},legacyOptions:["image","ro_image"],init:function(){return this._super.apply(this,arguments),this.label="",this.clicked=!1,this.btn=null,this.image=null,this.options.background_image||!this.options.image&&!this.options.ro_image?(this.options.readonly||(this.btn=$j(document.createElement("button")).addClass("et2_button").attr({type:"button"}),this.setDOMNode(this.btn[0])),void(this.options.image&&this.set_image(this.options.image))):(this.image=jQuery(document.createElement("img")).addClass("et2_button et2_button_icon"),void this.setDOMNode(this.image[0]))},transformAttributes:function(_attrs){if(this.id&&"undefined"==typeof _attrs.background_image&&!_attrs.image)for(var image in et2_button.default_background_images)if(this.id.match(et2_button.default_background_images[image])){_attrs.image=image,_attrs.background_image=!0;break}for(var name in et2_button.default_classes)if(this.id.match(et2_button.default_classes[name])){_attrs.class=("undefined"==typeof _attrs.class?"":_attrs.class+" ")+name;break}this._super.apply(this,arguments)},set_accesskey:function(key){jQuery(this.node).attr("accesskey",key)},set_image:function(_image){this.options.image=_image,this.update_image()},set_ro_image:function(_image){this.options.ro_image=_image,this.update_image()},update_image:function(_image){if(this.isInTree()&&(this.options.background_image||null!=this.image)){"undefined"==typeof _image&&(_image=this.options.readonly?this.options.ro_image:this.options.image),_image.match(/^[0-9]+\%$/)&&(_image="");var found_image=!1;if(""!=_image){var src=this.egw().image(_image);src?found_image=!0:"/"!=_image[0]&&"http"!=_image.substr(0,4)||(src=image,found_image=!0),found_image&&(null!=this.image?this.image.attr("src",src):this.options.background_image&&(this.btn.css("background-image","url("+src+")"),this.btn.addClass("et2_button_with_image")))}found_image||(this.set_label(this.label),this.btn&&(this.btn.css("background-image",""),this.btn.removeClass("et2_button_with_image")))}},set_readonly:function(_ro){_ro!=this.options.readonly&&(this.options.readonly=_ro,this.image&&this.update_image(),(this.btn||this.image)&&(this.btn||this.image).toggleClass("et2_clickable",!_ro).toggleClass("et2_button_ro",_ro).css("cursor",_ro?"default":"pointer"))},attachToDOM:function(){this._super.apply(this,arguments),this.options.readonly&&(this.btn||this.image)&&(this.btn||this.image).removeClass("et2_clickable").addClass("et2_button_ro").css("cursor","default")},getDOMNode:function(){return this.btn?this.btn[0]:this.image?this.image[0]:null},click:function(_ev){return this.options.readonly?!1:(this.clicked=!0,this._super.apply(this,arguments)?("buttononly"!=this._type&&this.getInstanceManager().submit(this,!1,this.options.novalidate),this.clicked=!1,!0):(this.clicked=!1,!1))},set_label:function(_value){this.btn&&(this.label=_value,this.btn.text(_value),_value&&!this.image?this.btn.addClass("et2_button_text"):this.btn.removeClass("et2_button_text")),this.image&&(this.image.attr("alt",_value),this.options.statustext||this.image.attr("title",_value))},set_tabindex:function(index){jQuery(this.btn).attr("tabindex",index)},isDirty:function(){return!1},resetDirty:function(){},getValue:function(){return this.clicked?!0:null},isValid:function(){return!0},getDetachedAttributes:function(_attrs){_attrs.push("label","value","class","image","ro_image","onclick","background_image")},getDetachedNodes:function(){return[null!=this.btn?this.btn[0]:null,null!=this.image?this.image[0]:null]},setDetachedAttributes:function(_nodes,_values){this.btn="#"!=_nodes[0].nodeName[0]?jQuery(_nodes[0]):null,this.image=jQuery(_nodes[1]),"undefined"!=typeof _values.id&&this.set_id(_values.id),"undefined"!=typeof _values.label&&this.set_label(_values.label),"undefined"!=typeof _values.value,"undefined"!=typeof _values.image&&this.set_image(_values.image),"undefined"!=typeof _values.ro_image&&this.set_ro_image(_values.ro_image),"undefined"!=typeof _values.class&&this.set_class(_values.class),"undefined"!=typeof _values.onclick&&(this.options.onclick=_values.onclick);var type=this._type,attrs=jQuery.extend(_values,this.options),parent=this._parent;jQuery(this.getDOMNode()).bind("click.et2_baseWidget",this,function(e){var widget=et2_createWidget(type,attrs,parent);return e.data=widget,e.data.set_id(_values.id),e.data.click.call(e.data,e)})}})}.call(this);et2_register_widget(et2_button,["button","buttononly"]),jQuery.extend(et2_button,{default_background_images:{save:/save(&|\]|$)/,apply:/apply(&|\]|$)/,cancel:/cancel(&|\]|$)/,delete:/delete(&|\]|$)/,edit:/edit(&|\[\]|$)/,next:/(next|continue)(&|\]|$)/,finish:/finish(&|\]|$)/,back:/(back|previous)(&|\]|$)/,copy:/copy(&|\]|$)/,more:/more(&|\]|$)/,check:/(yes|check)(&|\]|$)/,cancelled:/no(&|\]|$)/,ok:/ok(&|\]|$)/,close:/close(&|\]|$)/,add:/(add(&|\]|$)|create)/},default_classes:{et2_button_cancel:/cancel(&|\]|$)/,et2_button_question:/(yes|no)(&|\]|$)/,et2_button_delete:/delete(&|\]|$)/}});var et2_valueWidget=function(){"use strict";return et2_baseWidget.extend({attributes:{label:{name:"Label",default:"",type:"string",description:"The label is displayed by default in front (for radiobuttons behind) each widget (if not empty). If you want to specify a different position, use a '%s' in the label, which gets replaced by the widget itself. Eg. '%s Name' to have the label Name behind a checkbox. The label can contain variables, as descript for name. If the label starts with a '@' it is replaced by the value of the content-array at this index (with the '@'-removed and after expanding the variables).",translate:!0},value:{name:"Value",description:"The value of the widget",type:"rawstring",default:et2_no_init}},transformAttributes:function(_attrs){if(this._super.apply(this,arguments),this.id){var contentMgr=this.getArrayMgr("content");if(null!=contentMgr){var val=contentMgr.getEntry(this.id,!1,!0);null!==val&&(_attrs.value=val)}this.createNamespace&&this.getArrayMgr("content").perspectiveData.owner==this&&(_attrs.value=this.getArrayMgr("content").data)}},set_label:function(_value){if(_value!=this.label){if(_value){null==this._labelContainer&&(this._labelContainer=$j(document.createElement("label")).addClass("et2_label"),this.getSurroundings().insertDOMNode(this._labelContainer[0])),this._labelContainer.empty();var ph=document.createElement("span");this.getSurroundings().setWidgetPlaceholder(ph);for(var parts=et2_csvSplit(_value,2,"%s"),i=0;ilocX?locX=0:locX>barW&&(locX=barW),0>locY?locY=0:locY>barH&&(locY=barH),val.call($this,"xy",{x:locX/barW*rangeX+minX,y:locY/barH*rangeY+minY})},draw=function(){var arrowOffsetX=0,arrowOffsetY=0,barW=bar.w,barH=bar.h,arrowW=arrow.w,arrowH=arrow.h;setTimeout(function(){rangeX>0&&(arrowOffsetX=x==maxX?barW:x/rangeX*barW|0),rangeY>0&&(arrowOffsetY=y==maxY?barH:y/rangeY*barH|0),arrowW>=barW?arrowOffsetX=(barW>>1)-(arrowW>>1):arrowOffsetX-=arrowW>>1,arrowH>=barH?arrowOffsetY=(barH>>1)-(arrowH>>1):arrowOffsetY-=arrowH>>1,arrow.css({left:arrowOffsetX+"px",top:arrowOffsetY+"px"})},0)},val=function(name,value,context){var set=void 0!==value;if(!set)switch(void 0!==name&&null!=name||(name="xy"),name.toLowerCase()){case"x":return x;case"y":return y;case"xy":default:return{x:x,y:y}}if(null==context||context!=$this){var newX,newY,changed=!1;switch(null==name&&(name="xy"),name.toLowerCase()){case"x":newX=value&&(value.x&&0|value.x||0|value)||0;break;case"y":newY=value&&(value.y&&0|value.y||0|value)||0;break;case"xy":default:newX=value&&value.x&&0|value.x||0,newY=value&&value.y&&0|value.y||0}null!=newX&&(minX>newX?newX=minX:newX>maxX&&(newX=maxX),x!=newX&&(x=newX,changed=!0)),null!=newY&&(minY>newY?newY=minY:newY>maxY&&(newY=maxY),y!=newY&&(y=newY,changed=!0)),changed&&fireChangeEvents.call($this,context||$this)}},range=function(name,value){var set=void 0!==value;if(!set)switch(void 0!==name&&null!=name||(name="all"),name.toLowerCase()){case"minx":return minX;case"maxx":return maxX;case"rangex":return{minX:minX,maxX:maxX,rangeX:rangeX};case"miny":return minY;case"maxy":return maxY;case"rangey":return{minY:minY,maxY:maxY,rangeY:rangeY};case"all":default:return{minX:minX,maxX:maxX,rangeX:rangeX,minY:minY,maxY:maxY,rangeY:rangeY}}var newMinX,newMaxX,newMinY,newMaxY;switch(null==name&&(name="all"),name.toLowerCase()){case"minx":newMinX=value&&(value.minX&&0|value.minX||0|value)||0;break;case"maxx":newMaxX=value&&(value.maxX&&0|value.maxX||0|value)||0;break;case"rangex":newMinX=value&&value.minX&&0|value.minX||0,newMaxX=value&&value.maxX&&0|value.maxX||0;break;case"miny":newMinY=value&&(value.minY&&0|value.minY||0|value)||0;break;case"maxy":newMaxY=value&&(value.maxY&&0|value.maxY||0|value)||0;break;case"rangey":newMinY=value&&value.minY&&0|value.minY||0,newMaxY=value&&value.maxY&&0|value.maxY||0;break;case"all":default:newMinX=value&&value.minX&&0|value.minX||0,newMaxX=value&&value.maxX&&0|value.maxX||0,newMinY=value&&value.minY&&0|value.minY||0,newMaxY=value&&value.maxY&&0|value.maxY||0}null!=newMinX&&minX!=newMinX&&(minX=newMinX,rangeX=maxX-minX),null!=newMaxX&&maxX!=newMaxX&&(maxX=newMaxX,rangeX=maxX-minX),null!=newMinY&&minY!=newMinY&&(minY=newMinY,rangeY=maxY-minY),null!=newMaxY&&maxY!=newMaxY&&(maxY=newMaxY,rangeY=maxY-minY)},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(){$(document).unbind("mouseup",mouseUp).unbind("mousemove",mouseMove),bar.unbind("mousedown",mouseDown),bar=null,arrow=null,changeEvents=null};$.extend(!0,$this,{val:val,range:range,bind:bind,unbind:unbind,destroy:destroy}),arrow.src=options.arrow&&options.arrow.image,arrow.w=options.arrow&&options.arrow.width||arrow.width(),arrow.h=options.arrow&&options.arrow.height||arrow.height(),bar.w=options.map&&options.map.width||bar.width(),bar.h=options.map&&options.map.height||bar.height(),bar.bind("mousedown",mouseDown),bind.call($this,draw)},ColorValuePicker=function(picker,color,bindedHex,alphaPrecision){var $this=this,inputs=picker.find("td.Text input"),red=inputs.eq(3),green=inputs.eq(4),blue=inputs.eq(5),alpha=inputs.length>7?inputs.eq(6):null,hue=inputs.eq(0),saturation=inputs.eq(1),value=inputs.eq(2),hex=inputs.eq(inputs.length>7?7:6),ahex=inputs.length>7?inputs.eq(8):null,keyDown=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):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("