core.apps.picture=function(args){this.defaultProfile={title:"",app_style:"",height:200,popup:false,path:null,alt:"",picture_position:"fit",variable_content:false,url:""}} core.apps.picture.prototype={buildContent:function(el){this.buildModel(this.$["content"],[{tag:"div",id:"box",className:"app_picture_container",childs:[{tag:"div",className:"center",childs:[{tag:"img",id:"img",events:{onclick:"onImgClick"}}]}]}]);},onOpen:function(){this.setTitle(this.profile["title"]);this.$["window"].style.overflow="hidden";this.refresh();},onImgClick:function(){if(this.profile.url){location.href=this.profile.url;}else if(this.profile["popup"]){var img_url=this.profile["variable_content"]?core.data.variable_content.image:this.profile["path"];desktop.openImageBox([img_url]);}},refresh:function(){var el=this.$["img"];if(this.profile["variable_content"]){var f=core.data.variable_content.image;if(core.usertypethis.img_preloader.height){style={width:this.img_preloader.width*(this.$["box"].offsetHeight/this.img_preloader.height),height:this.$["box"].offsetHeight} if(style.width>this.$["box"].offsetWidth){style.width=this.$["box"].offsetWidth;style.height=this.img_preloader.height*(style.width/this.img_preloader.width);}}else{style={width:this.$["box"].offsetWidth,height:this.img_preloader.height*(this.$["box"].offsetWidth/this.img_preloader.width)} if(style.height>this.$["box"].offsetHeight){style.height=this.$["box"].offsetHeight;style.width=this.img_preloader.width*(style.height/this.img_preloader.height);}} style.marginLeft=-0.5*style.width;style.marginTop=-0.5*style.height;break;case"fill":if(this.img_preloader.width>this.img_preloader.height){style={width:this.img_preloader.width*(this.$["box"].offsetHeight/this.img_preloader.height),height:this.$["box"].offsetHeight} if(style.width1){for(var i=0;i1){for(var i=0;i"+s+"";},findItem:function(node){if(!node)node=core.data.main_menu;var res=null;for(var i=0;i"+html+"";} this.$["content"].innerHTML=html;},getMenuHTML:function(){var html="";if(this.profile["itemId"]!=null){var mi=this.findItem(this.profile["itemId"]);if(mi!=null){var items=mi.childs;for(var i=0;i"+t+"";var shtml="";}else{var ihtml=""+t+"";var shtml=" class='active'";} html+=""+ihtml+"";}}} return"";},formatTitle:function(mi){return mi.hint?""+mi.title+" ":mi.title;}}); core.launcher.registerLoadedApps(["submenu"]); core.data.theme_style_keys["submenu"] = 'submenu'; core.apps.webnote=function(args){this.defaultProfile={title:"",app_style:"",show_date:0,show_author:0,webnote_content_type:'0',text_id:null,hide_more:0,hide_delay:"5",hide_user:0,hide_timer:0}} core.apps.webnote.prototype={buildContent:function(el){this.buildModel(el,[{tag:"div",display:false,className:"summary_box",id:"summary_box"},{tag:"div",display:false,id:"link_more",className:"link_more_box",childs:[{tag:"a",innerHTML:"more...",events:{onclick:"onMoreClick"}}]},{tag:"div",display:false,className:"content_box",id:"content_box"},{tag:"a",className:"webnote_btn_close",id:"btn_close",events:{onclick:"onBtnCloseClick"},display:false},{tag:"div",id:this.id,display:false},{tag:"div",id:"date_box",className:"date_box",display:false,innerHTML:"Posted on: ",childs:[{tag:"span",id:"date"}]},{tag:"div",id:"author_box",className:"author_box",display:false,innerHTML:"Posted by: ",childs:[{tag:"span",id:"author"}]}]);this.callFunction("initAdmin");this.callFunction("initContributor");},onOpen:function(){this.setTitle(this.profile["title"]);this.refresh();},refresh:function(){if(this.profile["text_id"]){core.data.texts.get(this.profile["text_id"],this.setContent.bind(this));}else{this.setContent(null);}},setContent:function(text){if(this.profile["text_id"]!=null){var data=text;}else if(core.usertype>=USERTYPE_ADMIN){var data={summary:"Click here to select document",content:"Click here to select document"}}else{var data={summary:"",content:""}} if(this.profile["show_date"]&&data.modified){this.showElement("date_box");var d=new Date(data.modified*1000);this.$["date"].innerHTML=d.format("l d M Y");}else{this.hideElement("date_box");} if(this.profile["hide_user"]==1){this.showElement("btn_close");} if(this.profile["hide_timer"]==1){this.onDelayTimeOut(this.id,this.profile["hide_delay"]);} if(this.profile["show_author"]&&data.author){this.showElement("author_box");this.$["author"].innerHTML=data.author;}else{this.hideElement("author_box");} if(this.profile["webnote_content_type"]==0){this.hideElements(["summary_box","link_more"]);this.showElement("content_box");}else{this.showElement("summary_box");if(this.profile["hide_more"]){this.hideElement("link_more");}else{this.showElement("link_more");} this.hideElement("content_box");} this.$["summary_box"].innerHTML=data.summary;this.$["content_box"].innerHTML=data.content;},onMoreClick:function(e){this.hideElements(["link_more","summary_box"]);this.showElement("content_box");},getParentByClassName:function(el,className){if(el.className===className){return el;}else{return this.getParentByClassName(el.parentNode,className);}},onBtnCloseClick:function(e){if(this.profile["hide_user"]!=1)return false;var parent=this.getParentByClassName(e.target,'app_mc');parent.style.display="none";},onDelayTimeOut:function(id,time){if(core.usertype!=USERTYPE_ADMIN){window.setTimeout(function(first){var currentElement=document.getElementById(first);var parent=core.apps.webnote.prototype.getParentByClassName(currentElement,'app_mc');parent.style.display="none";},time*1000,this.id);}}} core.apps.webnote.extendPrototype(core.components.html_component);core.apps.webnote.extendPrototype(core.components.desktop_app); core.launcher.registerLoadedApps(["webnote"]); core.data.theme_style_keys["webnote"] = 'webnote'; core.apps.slideshow=function(args){this.defaultProfile={title:"",app_style:"",labels:[],images:[],alts:[],urls:[],interval:5,effect:"fade",height:200,popup:true,numbers:true,caption:true,nav_handle_mouseover:false,title_in_nav:false,keywords:"",picture_position:"fit"} this.animation_frames=20;this.animation_frame_delay=20;} core.apps.slideshow.prototype={buildContent:function(el){var h=this.profile["height"]+"px";this.buildModel(this.$["content"],{tag:"div",className:"slideshow",id:"slideshow",childs:[{tag:"div",className:"slideshow_box",id:"box",childs:[{tag:"div",className:"picture_container",id:"active_slide",style:{zIndex:1},display:false,childs:[{tag:"div",childs:[{tag:"img",id:"active_img",className:"slideshow_img",events:{onclick:"popupImage"}}]}]},{tag:"div",className:"picture_container",id:"next_slide",style:{zIndex:2},display:false,childs:[{tag:"div",childs:[{tag:"img",id:"next_img",className:"slideshow_img"}]}]}]},{tag:"div",id:"box_nav_content",className:"nav",childs:[{tag:"div",className:"caption",id:"box_nav_text"},{tag:"div",className:"numbers",id:"box_nav"}]}]});},onOpen:function(){this.setTitle(this.profile["title"]);this.$["window"].style.overflow="hidden";this.refresh();},onClose:function(){clearTimeout(this.timeout);},updateBoxSize:function(){var h=this.profile.height+"px";this.$["box"].style.height=h;this.$["active_slide"].style.height=h;this.$["active_slide"].style.width=this.$["box"].offsetWidth+"px";this.$["next_slide"].style.height=h;this.$["next_slide"].style.width=this.$["box"].offsetWidth+"px";},popupImage:function(){var url=this.slides[this.active_slide].url;if(url){location.href=url;}else if(this.profile["popup"]){var images=this.getImagesList();desktop.openImageBox(images,this.active_slide);}},getImagesList:function(){var res=[];for(var i=0;i=this.slides.length){this.active_slide=0;} this.showActiveSlide();},loadSlide:function(){if(!this.img_preloader){this.img_preloader=new Image();this.img_preloader.onload=this.onSlidePreloaded.bind(this);} this.img_preloader.src=this.getImageSrc(this.active_slide);},onSlidePreloaded:function(){this.loaded_slides[this.active_slide]={width:this.img_preloader.width,height:this.img_preloader.height} this.showActiveSlide();},startAnimation:function(){this.animation_started=true;this.setSlideSrc("next",this.active_slide);this.callFunction("initEffect_"+this.profile["effect"]);for(var i=0;i1){var pos=1;}else{var pos=frame/(this.animation_frames-1);} this.callFunction("processEffect_"+this.profile["effect"],pos);if(pos==1){this.endAnimation();}},endAnimation:function(){this.callFunction("finishEffect_"+this.profile["effect"]);this.setSlideSrc("active",this.active_slide);this.setSlideSrc("next",false);this.animation_started=false;this.timeout=setTimeout(this.nextSlide.bind(this),1000*this.profile["interval"]);},initEffect_fade:function(){this.$["active_slide"].style.left=0;this.$["next_slide"].style.left=0;this.setElementOpacity("next_slide",0);},processEffect_fade:function(pos){var v=100-pos*100 this.setElementOpacity("active_slide",100-pos*100);this.setElementOpacity("next_slide",pos*100);},finishEffect_fade:function(){this.setElementOpacity("active_slide",100);},initEffect_scroll:function(){this.$["next_slide"].style.left="20000px";},processEffect_scroll:function(pos){var w=this.$["box"].offsetWidth;this.$["active_slide"].style.left=(-w*pos)+"px";this.$["next_slide"].style.left=(w-w*pos)+"px";},finishEffect_scroll:function(){this.$["next_slide"].style.left=0;this.$["active_slide"].style.left=0;},setSlideSrc:function(key,idx){if(idx===false){this.hideElement(key+"_slide");return;} this.showElement(key+"_slide");var img_el=this.$[key+"_img"];img_el.src=this.getImageSrc(idx);var style={};var original_size=this.loaded_slides[idx];switch(this.profile["picture_position"]){case"size_height":style.height=this.$["box"].offsetHeight;style.width=original_size.width*(this.$["box"].offsetHeight/original_size.height);style.marginLeft=-0.5*style.width;style.marginTop=-0.5*style.height;break;case"size_width":style.width=this.$["box"].offsetWidth;style.height=original_size.height*(this.$["box"].offsetWidth/original_size.width);style.marginLeft=-0.5*style.width;style.marginTop=-0.5*style.height;break;case"fit":if(original_size.width>original_size.height){style={width:original_size.width*(this.$["box"].offsetHeight/original_size.height),height:this.$["box"].offsetHeight} if(style.width>this.$["box"].offsetWidth){style.width=this.$["box"].offsetWidth;style.height=original_size.height*(style.width/original_size.width);}}else{style={width:this.$["box"].offsetWidth,height:original_size.height*(this.$["box"].offsetWidth/original_size.width)} if(style.height>this.$["box"].offsetHeight){style.height=this.$["box"].offsetHeight;style.width=original_size.width*(style.height/original_size.height);}} style.marginLeft=-0.5*style.width;style.marginTop=-0.5*style.height;break;case"fill":if(original_size.width>original_size.height){style={width:original_size.width*(this.$["box"].offsetHeight/original_size.height),height:this.$["box"].offsetHeight} if(style.width