(function(){fcmsJs.Class('fcmsLib_Skeleton_Controller').inherits(fcmsLib_Core_Class).construct(function(name){this._setName(name);this.onReady=new fcmsLib_Core_Observer();Event.observe(window,'load',function(){this.init();}.bind(this));}).method('init',function init(){var view=null;if(typeof this._viewClass=="function"){view=new this._viewClass(this.getName(),this.getModel());view.setController(this);view.init();this._view=view;}else{fcmsJs.console.warn('Keine viewClass gesetzt.');} this.getModel().onDataChange.subscribe(this.getView().display.bind(this.getView()));this.onReady.notify(this);}).method('getModel',function getModel(){return this._model;}).method('getView',function getView(){return this._view;}).method('getName',function getName(){return this._name;}).method('_setName',function _setName(name){if(typeof name=="undefined"){fcmsJs.console.warn("Kein Name für "+this.className+" vergeben.");} this._name=name;});})();(function(){fcmsJs.Class('fcmsLib_Skeleton_Editor').inherits(fcmsLib_Core_Class).construct(function(name,sessionId,tmpId){this._editorElements=[];this._webservice=new fcmsAdmin_Core_Webservice(name,sessionId,tmpId);this._name=name;this._messageController=new fcmsLib_Utils_Message_Controller();this._canInsertElements=false;this.transactionId=tmpId;this.errorbox=new fcmsLib_Utils_Message_Error('errorbox','editor-errorbox');fcmsJs.windowCallback=fcmsJs.windowCallbackOff;fcmsJs.window.enableWindowCallback();this.serverChannel=fcmsAdmin_Core_ServerChannel.getChannel('Editor',{interval:0});this.onReady=new fcmsLib_Core_Observer();Event.observe(window,'load',function(){this.init(name);}.bind(this));}).method('getTransactionId',function(){return this.transactionId;}).method('makeTabMenu',function(model){var foo=new fcmsLib_Skeleton_TabMenu_Model();if(typeof this.tabMenuItems==='object'){fcmsLib_Core_Array.each(this.tabMenuItems,function(item){foo.addItem(item.name,item.options);});} return foo;}).method('getTabMenu',function(){return this._tabmenu;}).method('init',function(name){var infobar=new fcmsLib_Utils_Message_InfoBar("editor-messagebox");if(typeof this._viewClass==='function'){this._view=new this._viewClass(name,this._model);}else{fcmsJs.console.warn('Keine viewClass gesetzt.');} fcmsJs.window.fitToHeight(1200,1024);this.errorbox.init();this._tabmenu=this.makeTabMenu(this._model);this._tabmenuView=new fcmsLib_Skeleton_TabMenu_View('tabmenu',this._model);this._tabmenuView.display(this._tabmenu);if(typeof this.tabMenuItems==='object'){try{this._tabmenuView.show(this.tabMenuItems.first().name);}catch(e){fcmsJs.console.error(e);}} this._menuView=new fcmsLib_Skeleton_Menu_View('mainmenu',this._menu,true,{hasShortcuts:true});this._messageController.attach(infobar);if(typeof this._model!=='undefined'&&typeof this.notice!=='undefined'){this._model.onDataChange.subscribe(function(){if(this._model.data.id>0){this.notice.setObjectId(this._model.data.id);this.notice.enableLatestNoticeView('latestnotice','latestnotice');this.notice.enableCountNoticeView('showNoticeCount');}}.bind(this));} this._view.setController(this);this._form=new fcmsLib_Core_Form(this._name+'_form','editor_form');this._webservice.responseObserver.subscribe(this.errorbox.displayWebserviceError.bind(this.errorbox));this._model.onDataChange.subscribe(this._view.display.bind(this._view));for(var i=0,ii=this._editorElements.length;i0){this.errorbox.display('Fehler beim laden des Artikels.',errs);}}).method('del',function(name){var that=this;var q=new fcmsLib_Utils_Message_Question('genericQuestion','Wollen Sie den Artikel wirklich löschen?',function(){that._del();},function(){});q.display();}).method('_del',function(name){if(this._model.data.id>0){this._messageController.running('Wird gelöscht.');this._webservice.call('delete',{},(function(r){if(r.status==1){this._messageController.info('Erfolgreich gelöscht!');this.close();}else{this._messageController.hide();}}).bind(this),this._name,this._model.data.id);}else{this.errorbox.display('Es ist ein Fehler aufgetreten.',['Der Artikel wurde nicht gespeichert und kann daher nicht gelöscht werden.']);}}).method('setErrorBox',function(errorbox){this.errorbox=errorbox;this._webservice.responseObserver.subscribe(this.errorbox.displayWebserviceError.bind(this.errorbox));}).method('close',function(delay){if(delay>0){fcmsJs.window.$.setTimeout(this.close.bind(this),delay);}else{if(typeof opreload==='function'){try{opreload();}catch(e){}} window.close();}}).method('getDataParameterName',function(){var result='';if(this._dataParameterName!==undefined){result=this._dataParameterName;}else{result=this._name;} return result.toLowerCase();}).method('setDataParameterName',function(dataParameterName){this._dataParameterName=dataParameterName.toLowerCase();}).method('getModuleName',function(){var strfrom=this.className.indexOf('_')+1;var strlen=this.className.lastIndexOf('_')-strfrom;var name=this.className.substr(strfrom,strlen).toLowerCase();return name;}).method('getWebservice',function(){return this._webservice;});})();(function(){fcmsJs.Class('fcmsLib_Skeleton_EditorElement_View').inherits(fcmsLib_Core_Class).construct(function(name){this._name=name;this.actionController=new fcmsAdmin_Core_Action_Controller();}).method('display',function(model){this.buttons=[];if($(this._name)){$(this._name).setStyle({display:'block'});}else{fcmsJs.console.error('DOM-ID '+this._name+' nicht gefunden.');} fcmsJs.console.info('Display EditorElement '+this._name);}).method('getModel',function(){return this._model;}).method('init',function(){}).method('display',function(){this.postDisplay();}).method('postDisplay',function(){if(this.getDomNode()){this.getDomNode().bind('click',function(ev){var options={view:this};if(typeof ev.getSourceElement().getAttributes()['data-fcms-action']==='string'){fcmsLib_Core_Object.each(ev.getSourceElement().getAttributes(),function(pair){if(pair.key.substr(0,10)==='data-fcms-'){options[pair.key.substr(10)]=pair.value;}});this.actionController.executeAction(options['action'],this.getModel(),options);}else{if(ev.getSourceElement().up('[data-fcms-action]')){fcmsLib_Core_Object.each(ev.getSourceElement().up('[data-fcms-action]').getAttributes(),function(pair){if(pair.key.substr(0,10)==='data-fcms-'){options[pair.key.substr(10)]=pair.value;}});this.actionController.executeAction(options['action'],this.getModel(),options);}} if(ev.getSourceElement().tagType()==='A'&&ev.getSourceElement().getAttribute('href')==='#') {ev.preventDefault();} ev.stop();}.bind(this),{'stopPropagation':false,'preventDefault':false});}}).method('getDomNode',function(){return this._domNode;}).method('setDomNode',function(d){this._domNode=d;}).method('getEditorElement',function(){return this.editor;}).method('addButton',function(button){this.buttons.push(button);}).method('displayError',function(model){fcmsJs.console.info('Display Error');}).method('displayWaiting',function(model){fcmsJs.console.info('Display Error');});})();(function(){fcmsJs.Class('fcmsLib_Skeleton_EditorElement_Editor').inherits(fcmsLib_Core_Class).construct(function(model,webservice){this._model=model;this._webservice=webservice;}).method('getModel',function(){return this._model;}).method('init',function(messagebox,webservice){this._messagebox=messagebox;if(typeof this.viewClass==='function'&&typeof this._view!=='object'||this._view===null){this._view=new this.viewClass(this.getModel(),typeof this.config!=='undefined'?this.config:{});this._view.editor=this;if(typeof this.editor._view==='object'){this.editor._view.displayObserver.subscribe(this._view.display.bind(this._view));} this._view.init();}}).method('getView',function(){return this._view;}).method('handleResponse',function(){}).method('setEditor',function(ed){this.editor=ed;}).method('getEditor',function(){return this.editor;});})();(function(){fcmsJs.Class('fcmsLib_Skeleton_EditorElement_Geolocation_Editor').inherits(fcmsLib_Skeleton_EditorElement_Editor).construct(function(model,webservice){this._model=model;this._webservice=webservice;this.config={};this.config.getMethod='getGeolocations';this.config.setMethod='setGeolocations';}).method('init',function(messagebox,webservice){this._messagebox=messagebox;this._view=new fcmsLib_Skeleton_EditorElement_Geolocation_View('geolocationSelect',this._model);this._view.editor=this;this._view.init();this._model.onGeolocationChange.subscribe(this._view.display.bind(this._view));this.serverChannel.listen(this.config.getMethod,this.setObject.bind(this));}).method('addGeolocation',function(geoloc){this._model.addGeolocation(geoloc);}).method('delGeolocation',function(geoloc){geoloc.googleMarker.setVisible(false);geoloc.googleMarker.setMap(null);this._model.delGeolocation(geoloc);}).method('onShow',function(){this._view.onShow();}).method('onHide',function(){}).method('render',function(){this._webservice.call(this.config.getMethod,{},(function(response){this.serverChannel.sendLocalMessage({type:this.config.getMethod,data:response.data});}).bind(this));}).method('setObject',function(data){if(data){var obj=this.makeObjects(data);this._model[this.config.setMethod].apply(this._model,[obj]);}}).method('save',function(callChain){var geolocData=this._model.getGeolocationsWs();this._webservice.call(this.config.setMethod,{geolocations:geolocData},(function(response){callChain.callNext();}).bind(this));}).method('makeObjects',function(data){return data.map(function(gl){var x=new fcmsLib_Skeleton_EditorElement_Geolocation_Model();x.fromWs(gl);return x;});}).method('handleResponse',function(){});})();(function(){fcmsJs.Class('fcmsLib_Skeleton_EditorElement_Geolocation_Mixin').construct(function(){this._geolocations=[];this.onGeolocationChange=new fcmsLib_Core_Observer();}).method('addGeolocation',function(gl){if(typeof this._geolocations!=='object'){this._geolocations=[];} this._geolocations.push(gl);this.onGeolocationChange.notify();}).method('delGeolocation',function(gl){this._geolocations=fcmsLib_Core_Array.select(this._geolocations,function(g){fcmsJs.console.info(gl.getIdentifyer()+' !== '+g.getIdentifyer());return(gl.getIdentifyer()!==g.getIdentifyer());});this.onGeolocationChange.notify();}).method('setGeolocations',function(gl){this._geolocations=gl;this.onGeolocationChange.notify();}).method('getGeolocations',function(){if(typeof this._geolocations!=='object'){this._geolocations=[];} return this._geolocations;}).method('getGeolocationsWs',function(){return this.getGeolocations().map(function(gl){return gl.toWs();});});})();(function(){var markLetters=['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'];var nextLetter=0;fcmsJs.Class('fcmsLib_Skeleton_EditorElement_Geolocation_Model').construct(function(marker){this.googleMarker=marker;this._data={id:0,title:'Title',description:''};this.config={};this.config.iconPath='/_/admin/pics/maps/';this.markLetter=markLetters[nextLetter++%markLetters.length];this._origzoom=7;}).method('getIdentifyer',function(){if(typeof this._data.id==='undefined'||this._data.id===0||this._data.id==='0'){return'new-'+this.markLetter;} return this._data.id;}).method('moveTo',function(pos){this.googleMarker.setPosition(pos);}).method('getTitle',function(){return this._data.title;}).method('getDescription',function(){return this._data.description;}).method('getId',function(){return this._data.id;}).method('getZoom',function(){return this._origzoom;}).method('getHighlightPic',function(){return this.config.iconPath+"yellow"+"_Marker"+this.markLetter+'.png';}).method('setTitle',function(title){this._data.title=title;this.googleMarker.setTitle(title);}).method('getNormalPic',function(){return this.config.iconPath+"red"+"_Marker"+this.markLetter+'.png';}).method('toWs',function(){return{id:this._data.id,title:this._data.title,description:this._data.description,latitude:this.googleMarker.getPosition().lat(),longitude:this.googleMarker.getPosition().lng(),zoomLevel:(this.googleMarker.getMap())?this.googleMarker.getMap().getZoom():this._origzoom};}).method('fromWs',function(gl){this._data.id=gl.id;this._data.title=gl.title;this._data.description=gl.description;this._origzoom=parseInt(gl.zoomLevel,10);if(isNaN(this._origzoom)||this._origzoom===0){this._origzoom=7;} this.googleMarker=new google.maps.Marker({position:new google.maps.LatLng(gl.latitude,gl.longitude),map:null,title:this._data.title,draggable:true});});})();(function(){fcmsJs.Class('fcmsLib_Skeleton_EditorElement_Geolocation_View').inherits(fcmsLib_Skeleton_EditorElement_View).construct(function(name,model){var that=this;this._name=name;this._model=model;this._markers=[];this._map=null;this.sliceSize=10;this.config={};this.config.prefix='geolocation';this.config.getMethod='getGeolocations';this.infoRules={'@id':function(){return this._name+"InfoBox";}.bind(this),'input[name="title"]@value':function(c){return c.context.getTitle();},'textarea[name="description"]':function(c){return c.context.getDescription();}};this.itemSliderRules={'.normalThumbnailUrl@src':function(context){return'/_/admin/pics/editor/platzhalter/default-geolocation_60x60.jpg';},'.title':function(c){return c.item.getTitle().slice(0,8);},'@id':function(context){return this.config.prefix+'-'+context.item.getIdentifyer();}.bind(this)};}).method('init',function(){this._itemContainer=new fcmsLib_Utils_Pure_Template(this._name+'Template',this._name,{'@id':function(){return this._name;}.bind(this),'#geoSearchFormTemplate@id':'"geoSearchForm"'});this._itemList=new fcmsLib_Utils_Pure_List(this._name+'ItemWrapper',this._name+'ItemWrapper',this.config.prefix,this.makeDirective());this._itemTemplate=new fcmsLib_Utils_Pure_Template(this._name+'InfoBox',this._name+'InfoBox',this.infoRules);this._geocoder=new google.maps.Geocoder();this._itemContainer.render(this._model);this._form=new fcmsLib_Core_Form('geoSearchForm');this.renderGoogleMaps();$(this._name).select('.searchfield input[name=address]')[0].observe('focus',function(e){this.value='';this.stopObserving('focus',arguments.callee);});$(this._name).select('.addbutton a')[0].observe('click',function(){var mark=new google.maps.Marker({position:this._map.getCenter(),map:this._map,title:"Titel eingeben",draggable:true});var geoloc=new fcmsLib_Skeleton_EditorElement_Geolocation_Model(mark);google.maps.event.addListener(mark,'click',function(){this.displaySingleItem(geoloc);}.bind(this));this.editor.addGeolocation(geoloc);this.displaySingleItem(geoloc);}.bind(this));$(this._name).select('.prevSingleItem')[0].observe('click',function(){this.displayPrevItem();}.bind(this));$(this._name).select('.nextSingleItem')[0].observe('click',function(){this.displayNextItem();}.bind(this));$(this._name).select('.searchfield input[name=address]')[0].observe('keypress',function(e){if(e.keyCode===13){Event.stop(e);this.searchLocation();return false;} return true;}.bind(this));$(this._name).select('.submit')[0].observe('click',function(e){this.searchLocation();return false;}.bind(this));if(typeof $(this._name).select('.prevItem')[0]!=='undefined'){$(this._name).select('.prevItem')[0].observe('click',(function(){this._glider.previous();}).bind(this));}else{fcmsJs.console.error('Keine .prevItem in '+this._name);} if(typeof $(this._name).select('.nextItem')[0]!=='undefined'){$(this._name).select('.nextItem')[0].observe('click',(function(){this._glider.next();}).bind(this));}else{fcmsJs.console.error('Keine .nextItem in '+this._name);}}).method('makeDirective',function(){var count=0,ret={};ret['.subItem']={};ret['.subItem']['section <- '+this.config.prefix+'.sections']=this.itemSliderRules;return ret;}).method('display',function(){this.uber('display');$(this._name).setStyle({display:'block'});this.displayItemList();if(this._model.getGeolocations().length>0){this.displaySingleItem(this._model.getGeolocations()[0]);}else{$(this._name).select('.infobox')[1].hide();}}).method('renderGoogleMaps',function(){var latlng=new google.maps.LatLng(49.792593124034006,9.938604914855963),myOptions={zoom:10,center:latlng,mapTypeId:google.maps.MapTypeId.ROADMAP};if(typeof this._model.getGeolocations()[0]!=='undefined'){myOptions.center=this._model.getGeolocations()[0].googleMarker.getPosition();} this._map=new google.maps.Map($(this._name).select('.mapsCanvas')[0],myOptions);fcmsLib_Core_Array.each(this._model.getGeolocations(),function(elem){elem.googleMarker.setMap(this._map);}.bind(this));}).method('displayNextItem',function(){var items=this._model[this.config.getMethod].apply(this._model),usenext=false,nextItem=null;items.each(function(i){if(nextItem===null){if(usenext===true){nextItem=i;}else if(i.getIdentifyer()===this._singleItem.getIdentifyer()){usenext=true;}}}.bind(this));if(nextItem===null){nextItem=items[0];} this.displaySingleItem(nextItem);}).method('displayPrevItem',function(){var items=fcmsLib_Core_Array.reverse(this._model[this.config.getMethod].apply(this._model)),usenext=false,nextItem=null;items.each(function(i){if(nextItem===null){if(usenext===true){nextItem=i;}else if(i.getIdentifyer()===this._singleItem.getIdentifyer()){usenext=true;}}}.bind(this));if(nextItem===null){nextItem=items[0];} this.displaySingleItem(nextItem);}).method('displaySingleItem',function(item){var items=this._model[this.config.getMethod].apply(this._model),length=items.length;this._singleItem=item;this._itemTemplate.render(item);fcmsLib_Core_Array.each(items,function(i){if(i===item){i.googleMarker.setIcon(i.getHighlightPic());if($(this.config.prefix+'-'+item.getIdentifyer())){$(this.config.prefix+'-'+item.getIdentifyer()).addClassName('on');}}else{i.googleMarker.setIcon(i.getNormalPic());if($(this.config.prefix+'-'+i.getIdentifyer())){$(this.config.prefix+'-'+i.getIdentifyer()).removeClassName('on');}}}.bind(this));this._map.panTo(item.googleMarker.getPosition());$(this._name).select('.infobox')[1].show();$(this._name).select('.addbutton a')[0].observe('click',function(){var geoloc=new fcmsLib_Skeleton_EditorElement_Geolocation_Model(new google.maps.Marker({position:this._map.getCenter(),map:this._map,title:"Titel eingeben",draggable:true}));google.maps.event.addListener(geoloc.googleMarker,'click',function(){this.displaySingleItem(geoloc);}.bind(this));this.editor.addGeolocation(geoloc);this.displaySingleItem(geoloc);}.bind(this));$(this._name).select('.delbutton a')[0].observe('click',function(){this.editor.delGeolocation(item);}.bind(this));$(this._name).select('input[name="title"]')[0].observe('change',function(e){item.setTitle(Event.element(e).getValue());this.displayItemList();}.bind(this));$(this._name).select('textarea[name="description"]')[0].observe('change',function(e){item._data.description=$F(Event.element(e));this.displayItemList();}.bind(this));if(typeof item.onTreeChange!=='undefined'){item.onTreeChange.subscribe(function(){this.displaySingleItem(item);item.onTreeChange.unsubscribe(arguments.callee);}.bind(this));}}).method('makeItemSlices',function(){var items=this._model.getGeolocations(),slices=[],count=0,sliceSize=this.sliceSize,curSlice=[];fcmsLib_Core_Array.each(items,function(val){curSlice.push(val);if(++count%sliceSize===0){slices.push({sections:curSlice});curSlice=[];}});if(curSlice.length>0){slices.push({sections:curSlice});curSlice=[];} return slices;}).method('displayItemList',function(){var items=this._model.getGeolocations(),slices=[],curSlice=[],count=0,sliceSize=this.sliceSize;slices=this.makeItemSlices();this._itemList.render(slices);if(items.length>1){$(this._name).select('.nextSingleItem')[0].show();$(this._name).select('.prevSingleItem')[0].show();}else{$(this._name).select('.nextSingleItem')[0].hide();$(this._name).select('.prevSingleItem')[0].hide();} if(slices.length){fcmsLib_Core_Array.each(items,function(elem,key){$(this.config.prefix+'-'+elem.getIdentifyer()).observe('click',function(){this.displaySingleItem(elem);}.bind(this));if(typeof elem.onPreviewPictureChange!=='undefined'){elem.onPreviewPictureChange.subscribe(this.updateThumbnail.curry(elem).bind(this));elem.onPreviewPictureChange.subscribe(function(){if(key===this._singleItemPointer){this.showHighlightItem(0);}}.bind(this));}}.bind(this));if(slices.length>1){this._glider=new Glider(this._name+'Glider',{duration:0.5});}}}).method('searchLocation',function(){this._geocoder.geocode({'address':this._form.getValue('address'),region:'Germany'},function(results,status){if(status==google.maps.GeocoderStatus.OK){this._map.setCenter(results[0].geometry.location);if(this._singleItem){this._singleItem.googleMarker.setPosition(results[0].geometry.location);}}}.bind(this));return false;}).method('onShow',function(){var bounds=new google.maps.LatLngBounds();google.maps.event.trigger(this._map,'resize');fcmsLib_Core_Array.each(this._model.getGeolocations(),function(elem){bounds.extend(elem.googleMarker.getPosition());elem.googleMarker.setMap(this._map);google.maps.event.addListener(elem.googleMarker,'click',function(){this.displaySingleItem(elem);}.bind(this));}.bind(this));if(typeof this._model.getGeolocations()[0]!=='undefined'){this._map.panTo(this._model.getGeolocations()[0].googleMarker.getPosition());this._map.setZoom(this._model.getGeolocations()[0].getZoom());}}).method('displayError',function(model){fcmsJs.console.info('Display Error');}).method('displayWaiting',function(model){fcmsJs.console.info('Display Error');});})();(function(){fcmsJs.Class('fcmsLib_Skeleton_EditorElement_InheritFlag_Editor').inherits(fcmsLib_Skeleton_EditorElement_Editor).construct(function(model,webservice){this._model=model;this._webservice=webservice;this.onInheritFlagChange=new fcmsLib_Core_Observer();this.config={};this.config.getMethod='getInheritFlags';this.config.setMethod='setInheritFlags';}).method('init',function(messagebox,webservice){this._messagebox=messagebox;this._model.onInheritFlagChange.subscribe(this.setInheritFlags.bind(this));this.serverChannel.listen(this.config.getMethod,this.setObject.bind(this));}).method('setInheritFlags',function(flagName){this._messagebox.running('Bitte warten ...');this._webservice.call(this.config.setMethod,{inheritFlags:this._model.getInheritFlags()},(function(response){this.onInheritFlagChange.notify(flagName);}.bind(this)));}).method('render',function(){this._webservice.call(this.config.getMethod,{},(function(response){this.serverChannel.sendLocalMessage({type:this.config.getMethod,data:response.data});}).bind(this));}).method('setObject',function(data){if(data){this._model[this.config.setMethod].apply(this._model,[data]);}}).method('handleResponse',function(){});})();(function(){fcmsJs.Class('fcmsLib_Skeleton_EditorElement_InheritFlag_Mixin').construct(function(){this.onInheritFlagChange=new fcmsLib_Core_Observer();this.hasInheritFlags=true;this._inheritFlags={};}).method('setInheritFlags',function(flags){fcmsLib_Core_Object.each(flags,function(p){var val=(p.value)?1:0;this._inheritFlags[p.key]=val;}.bind(this));}).method('getInheritFlags',function(){return this._inheritFlags;}).method('mayChangeInheritFlag',function(name){if(name==='linkboxes'){return true;} return false;}).method('setInheritFlag',function(name,value){if(value){this._inheritFlags[name]=1;}else{this._inheritFlags[name]=0;} this.onInheritFlagChange.notify(name);}).method('getInheritFlag',function(name){if(typeof this._inheritFlags[name]!=='undefined'){if(this._inheritFlags[name]===0||this._inheritFlags[name]==='0'){fcmsJs.console.debug(name);return 0;}} return 1;});})();(function(){fcmsJs.Class('fcmsLib_Skeleton_EditorElement_InheritFlags_SingleFlagView').inherits(fcmsLib_Skeleton_EditorElement_View).construct(function(name,model){this._flagName=name;this._name='inheritSelect'+new fcmsLib_Core_String(name).ucFirst();this._model=model;this._markers=[];this._map=null;this._templateName='inheritFlagTemplate';this._selectName='inherit'+new fcmsLib_Core_String(this._flagName).ucFirst();}).method('init',function(){this._inheritSelectTemplate=new fcmsLib_Utils_Pure_Template(this._templateName,this._name,{'@id':function(){return this._name;}.bind(this),'.selectbox@id':'"selectbox_'+this._selectName+'"'});}).method('display',function(){if(!$(this._name)){return;} this._inheritSelectTemplate.render(this._model);if(this._model.mayChangeInheritFlag(this._flagName)){$(this._name).select('*[data-fcms-toggle]').each(Element.show);} fcmsLib_Utils_Pure_Select.makeBooleanButton(this._selectName,this._selectName,this._model,{0:'Nein',1:'Ja'},{getSelected:this._model.getInheritFlag.curry(this._flagName).bind(this._model),setSelected:this._model.setInheritFlag.curry(this._flagName).bind(this._model)});$(this._name).show();}).method('displayError',function(model){fcmsJs.console.info('Display Error');}).method('displayWaiting',function(model){fcmsJs.console.info('Display Error');});})();(function(){fcmsJs.Class('fcmsLib_Skeleton_EditorElement_Mixin');})();(function(){fcmsJs.Class('fcmsLib_Skeleton_EditorElement_Select_Editor').inherits(fcmsLib_Skeleton_EditorElement_Editor).construct(function(model,webservice){this._model=model;this._webservice=webservice;this.startRender=false;this.firstRender=true;this.onRemove=new fcmsLib_Core_Observer();}).method('registerUpdateCallback',function(){var o={};if(typeof this.config.editUrl!=='undefined'){o=this.config.editUrl.parseQuery();} if(typeof o._CMFUNC!=='undefined'){fcmsJs.window.windowCallback.subscribe(function(windowName,args){if(typeof args==='object'&&args.reason==='close'&&args.url.parseQuery()._CMFUNC===o._CMFUNC) {this.render();}}.bind(this));}}).method('getInheritFlagName',function(){if(typeof this.config.inheritFlag!=='undefined'){return this.config.inheritFlag;} return this.config.prefix;}).method('init',function(messagebox,webservice){this._messagebox=messagebox;this._view.init();this.registerUpdateCallback();this._addCallback=function(title,ids){if(title===fcmsJs.window.cleanWindowName(this.config.addItemTitle)){this.add(ids);}}.bind(this);fcmsJs.windowCallback.subscribe(this._addCallback);this.serverChannel.listen(this.config.getMethod,this.setObjects.bind(this));if(typeof this.editor.inheritFlagEditor==='object'&&this.editor.inheritFlagEditor.onInheritFlagChange){this.editor.inheritFlagEditor.onInheritFlagChange.subscribe(function(flag){if(flag===this.getInheritFlagName()){this.render();}}.bind(this));} fcmsJs.window.$.setTimeout(function(){this.startRender=true;}.bind(this),3000);}).method('startRender',function(){this.startRender=true;this.render();}).method('updateSort',function(ids){var p={};p['order']=ids;this._webservice.call(this.config.sortMethod,p,(function(response){fcmsJs.console.debug(response);}).bind(this));}).method('remove',function(id){var p={};p[this.config.prefix+'Id']=id;this._webservice.call(this.config.removeMethod,p,(function(response){this.render();this.onRemove.notify(id);}).bind(this));}).method('add',function(id){var p={};this._messagebox.running('Wird hinzugefügt...');p[this.config.prefix+'Id']=id;this._webservice.call(this.config.addMethod,p,(function(response){this.render();}).bind(this));}).method('render',function(){if(this.startRender===true){this._webservice.call(this.config.getMethod,{},(function(response){this.serverChannel.sendLocalMessage({type:this.config.getMethod,data:response.data});if(this.firstRender){this.firstRender=false;fcmsJs.console.debug('First render: '+this.className);}}).bind(this),'article',this.getSourceArticle());}}).method('getSourceArticle',function(){return this._model.getId();}).method('setObjects',function(data){var obj=this.makeObjects(data);this._model[this.config.setMethod].apply(this._model,[obj]);this._messagebox.hide();}).method('makeObjects',function(data){return data;}).method('handleResponse',function(){});})();(function(){fcmsJs.Class('fcmsLib_Skeleton_EditorElement_Select_Mixin');})();(function(){fcmsJs.Class('fcmsLib_Skeleton_EditorElement_Select_View').inherits(fcmsLib_Skeleton_EditorElement_View).construct(function(name,model){this._name=name;this._itemPointer=0;this._singleItemPointer=0;this._model=model;this.sliceSize=10;this.infoRules={'@id':function(){return this._name+"InfoBox";}.bind(this),'.title':function(c){return c.context.data.title;},'.actions .bearbeiten@href+':'data.id','.author':'data.author','.location':'data.location','.date':function(c){if(c.context.data.date){return fcmsLib_Core_Date.format('dd.mm.yyyy',c.context.data.date);} return'';},'.tree':'_tree.data.label','.tree@href+':'_tree.data.id','.normalPictureUrl@src':function(context){return context.context.getScaledLink('normal',{h:200,w:200});},'.text':function(c){return fcmsLib_Utils_String.shorten(c.context.data.text,800,'...');}};this.sliderRules={'.normalThumbnailUrl@src':function(context){return context.item.getScaledLink('normal',{h:200,w:200});},'.data .title':function(c){return fcmsLib_Utils_String.shorten(c.item.data.title,12,'...');},'@data-fcms-id':function(context){return context.item.data.id;},'@id':function(context){return this.config.prefix+'-'+context.item.data.id;}.bind(this)};}).method('init',function(){this._itemList=new fcmsLib_Utils_Pure_List(this._name+'ItemWrapper','itemWrapper',this.config.prefix,this.makeDirective());if(typeof this._model.hasInheritFlags!=='undefined'&&this._model.hasInheritFlags===true) {this._inheritFlagsView=new fcmsLib_Skeleton_EditorElement_InheritFlags_SingleFlagView(this.editor.getInheritFlagName(),this._model);this._inheritFlagsView.init();} this._itemTemplate=new fcmsLib_Utils_Pure_Template('itemInfobox',this._name+'InfoBox',this.infoRules);this._itemContainer=new fcmsLib_Utils_Pure_Template(this.config.domTemplate,this.config.domTarget,{'@id':function(){return this._name;}.bind(this),'#itemWrapper@id':function(){return this._name+"ItemWrapper";}.bind(this),'#itemInfobox@id':function(){return this._name+"InfoBox";}.bind(this),'.addItem':function(){return this.config.addItemTitle;}.bind(this),'.generateItem':function(){return this.config.createItemTitle;}.bind(this),'.inheritSelect@id':'"inheritSelect'+new fcmsLib_Core_String(this.editor.getInheritFlagName()).ucFirst()+'"'});}).method('updateThumbnail',function(item){try{$(this.config.prefix+'-'+item.data.id).select('.normalThumbnailUrl')[0].src=item.getPreviewPicture().getScaledLink('normal',{h:200,w:200});}catch(e){fcmsJs.console.error(e);}}).method('_displayInheritFlag',function(){var select=$(this._name).down('.inheritSelect');if(select){select.show();}}).method('display',function(){var slices=[],curSlice=[],count=0,sliceSize=this.sliceSize,items=this._model[this.config.getMethod].apply(this._model);this.uber('display');this._itemContainer.render(this._model);this._itemList.render(items);if(fcmsLib_Core_Array.size(items)){fcmsLib_Core_Array.each(items,function(elem,key){$(this.config.prefix+'-'+elem.data.id).observe('click',function(){this.showSingleItem(elem);}.bind(this));if(typeof elem.onPreviewPictureChange!=='undefined'){elem.onPreviewPictureChange.subscribe(this.onPreviewPictureChange.bind(this));}}.bind(this));this.showHighlightItem(0);}else{this._showNoInfo();} if(this._inheritFlagsView){this._inheritFlagsView.display(this._model);} this.sortable=new fcmsLib_Utils_Html_Sortable(new fcmsLib_Utils_Dom_Element(this._name).down('ul.slides'));this.sortable.onUpdate.subscribe(function(){var ids=[];fcmsLib_Core_Array.each(new fcmsLib_Utils_Dom_Element(this._name+'ItemWrapper').down('ul').select('li[data-fcms-id]'),function(e){ids.push(e.getAttribute('data-fcms-id'));});this.editor.updateSort(ids);}.bind(this));this.makeButtons();this._toggleElementsAreInherited();$(this._name).setStyle({display:'block'});}).method('_toggleElementsAreInherited',function(){if(typeof this._model.getInheritFlag==='function'&&this._model.getInheritFlag(this.editor.getInheritFlagName())){$(this._name).select('*[data-fcms-toggle=elementsAreInherited]').each(function(e){e.show();});$(this._name).select('*[data-fcms-toggle=elementsAreNotInherited]').each(function(e){e.hide();});}else{$(this._name).select('*[data-fcms-toggle=elementsAreInherited]').each(function(e){e.hide();});$(this._name).select('*[data-fcms-toggle=elementsAreNotInherited]').each(function(e){e.show();});}}).method('showHighlightItem',function(pointerMove){var items=this._model[this.config.getMethod].apply(this._model),length=items.length;this._singleItemPointer=((this._singleItemPointer+pointerMove+length)%length);if(typeof items[this._singleItemPointer]!=='undefined'){this.showSingleItem(items[this._singleItemPointer]);}}).method('showSingleItem',function(item){var items=this._model[this.config.getMethod].apply(this._model),length=items.length;fcmsLib_Core_Array.each(items,function(i,pos){if(i.data.id==item.data.id){this._singleItemPointer=pos;if($(this.config.prefix+'-'+item.data.id)){$(this.config.prefix+'-'+item.data.id).addClassName('on');}}else{if($(this.config.prefix+'-'+i.data.id)){$(this.config.prefix+'-'+i.data.id).removeClassName('on');}}}.bind(this));this._itemTemplate.render(item);if($(this._name).select('.editButton')[0]){$(this._name).select('.editButton')[0].observe('click',function(e){if(fcmsJs.window.openEditor(item)){Event.stop(e);}else{fcmsJs.console.error('Fehler beim öffnen eines Editors für '+item.className);} return false;});} if($(this._name).select('.normalPictureUrl')[0]){$(this._name).select('.normalPictureUrl')[0].observe('click',function(e){if(fcmsJs.window.openEditor(item)){Event.stop(e);}else{fcmsJs.console.error('Fehler beim öffnen eines Editors für '+item.className);} return false;});} this._toggleElementsAreInherited();if($(this._name).select('.tree')[0]){$(this._name).select('.tree')[0].observe('click',function(e){fcmsJs.console.info('OpenEditor '+item.getTree());if(fcmsJs.window.openEditor(item.getTree())){Event.stop(e);}else{fcmsJs.console.error('Fehler beim öffnen eines Editors für '+item.className);} return false;});} if(typeof item.onTreeChange!=='undefined'){item.onTreeChange.subscribe(this.onItemTreeChange.bind(this));} if(typeof $(this._name).select('.prevSingleItem')[0]!=='undefined'&&length>1) {$($(this._name).select('.prevSingleItem')[0]).show();$(this._name).select('.prevSingleItem')[0].observe('click',(function(){this.showHighlightItem(-1);}).bind(this));} if(typeof $(this._name).select('.insertButton')[0]!=='undefined'){if(this.editor.editor.canInsertElements()&&typeof this.config.insertCallbackTitle!=='undefined') {$(this._name).select('.insertButton')[0].observe('click',function(){this.editor.editor._tabmenuView.show('grundtext');fcmsJs.windowCallback.notify(this.config.insertCallbackTitle,[item.data.id]);}.bind(this));}else{$($(this._name).select('.insertButton')[0].parentNode).hide();}} if(typeof $(this._name).select('.delItem')[0]!=='undefined'){$(this._name).select('.delItem')[0].observe('click',(function(){this.editor.remove(item.data.id);}).bind(this));} if(typeof $(this._name).select('.nextSingleItem')[0]!=='undefined'&&length>1) {$($(this._name).select('.nextSingleItem')[0]).show();$(this._name).select('.nextSingleItem')[0].observe('click',(function(){this.showHighlightItem(1);}).bind(this));} if(typeof this.editor.addThumbnail==='function'){if(typeof $(this._name).select('.addThumbButton')[0]!=='undefined'){$(this._name).select('.addThumbButton')[0].observe('click',this.editor.addThumbnail.curry(item.data.id).bind(this.editor));$($(this._name).select('.addThumbButton')[0].parentNode).show();}} this._hideNoInfo();}).method('getCurrentItem',function(){var items=this._model[this.config.getMethod].apply(this._model);if(typeof items[this._singleItemPointer]!=='undefined'){this.showSingleItem(items[this._singleItemPointer]);} return null;}).method('onItemTreeChange',function(item){if(item===this.getCurrentItem()){this.showHighlightItem(0);}}).method('onPreviewPictureChange',function(item){this.updateThumbnail(item);if(item===this.getCurrentItem()){this.showHighlightItem(0);}}).method('_hideNoInfo',function(){$(this._name).select('.empty')[0].hide();$(this._name).select('.iteminfo')[0].show();}).method('_showNoInfo',function(){$(this._name).select('.iteminfo')[0].hide();$(this._name).select('.empty')[0].show();}).method('makeButtons',function(){var items=this._model[this.config.getMethod].apply(this._model),addWindow=null,length=items.length;$(this._name).select('.addItem')[0].observe('click',(function(){fcmsJs.window.open(this.config.addItemTitle,'select.html?_CMPARM=IMAGES-SMULTI-imglist_showlist----','width=800 ,height=600 ,resizable=1 ,scrollbars=1');}).bind(this));}).method('makeDirective',function(domPrefix,objPrefix){return this.sliderRules;}).method('displayError',function(model){fcmsJs.console.info('Display Error');}).method('displayWaiting',function(model){fcmsJs.console.info('Display Error');});})();(function(){fcmsJs.Class('fcmsLib_Skeleton_EditorElement_SingleGeoLoc_Editor').inherits(fcmsLib_Skeleton_EditorElement_Editor).construct(function(model,webservice,config){this.uber('construct',model,webservice);this._model=model;this._webservice=webservice;this._name='singleGeolocElement';this.config=fcmsLib_Core_Object.extend({name:'singleGeolocElement',domTemplate:'singleGeoloc',setMethod:function(lat,lng){this.data.latitude=lat;this.data.longitude=lng;},getMethod:function(){return{lat:this.data.latitude,lng:this.data.longitude};},pureDirective:{},form:'editor_form'},config);this.viewClass=fcmsLib_Skeleton_EditorElement_SingleGeoLoc_View;}).method('init',function(messagebox,webservice){this._messagebox=messagebox;if(typeof this.viewClass==='function'){this._view=new this.viewClass(this._name,this.getModel());this._view.config=this.config;this._view.editor=this;} this.editor._view.displayObserver.subscribe(this._view.display.bind(this._view));this._view.init();}).method('changeCoordinates',function(lat,lng){this.config.setMethod.apply(this._model,[lat,lng]);}).method('addMarker',function(){});})();(function(){fcmsJs.Class('fcmsLib_Skeleton_EditorElement_SingleGeoLoc_View').inherits(fcmsLib_Skeleton_EditorElement_View).construct(function(name,model,config){this._name=name;this._domId=name;this._model=model;}).method('init',function(){this._elementContainer=new fcmsLib_Utils_Pure_Template(this.config.domTemplate,this.config.name,this.config.pureDirective);this._form=new fcmsLib_Core_Form(this.config.form);this._geocoder=new google.maps.Geocoder();}).method('makeButton',function(){$(this.config.name).down('*[data-fcms-button=search]').observe('click',(function(){this.searchLocation();}).bind(this));$(this.config.name).down('*[data-fcms-button=del]').observe('click',(function(){this._geoloc.googleMarker.setVisible(false);this._geoloc.googleMarker.setMap(null);this._geoloc=null;this.editor.changeCoordinates('','');}).bind(this));$(this.config.name).down('*[data-fcms-button=set]').observe('click',(function(){this.moveMarker(this._map.getCenter().lat(),this._map.getCenter().lng());}).bind(this));}).method('moveMarker',function(lat,lng){var latlng=new google.maps.LatLng(lat,lng);if(typeof this._geoloc==='undefined'||!this._geoloc){this._geoloc=new fcmsLib_Skeleton_EditorElement_Geolocation_Model(new google.maps.Marker({position:latlng,map:this._map,title:"Location",draggable:true}));google.maps.event.addListener(this._geoloc.googleMarker,'dragend',function(){this.moveMarker(this._geoloc.googleMarker.getPosition().lat(),this._geoloc.googleMarker.getPosition().lng());}.bind(this));} this.editor.changeCoordinates(lat,lng);this._geoloc.moveTo(latlng);}).method('searchLocation',function(){this._geocoder.geocode({'address':this._form.getValue('address'),region:'Germany'},function(results,status){if(status==google.maps.GeocoderStatus.OK){this._map.setCenter(results[0].geometry.location);}}.bind(this));return false;}).method('display',function(){this.uber('display');this._elementContainer.render(this._model);try{this.makeButton();}catch(e){fcmsJs.console.error('asdf');} $(this.config.name).show();var latlng=new google.maps.LatLng(49.792593124034006,9.938604914855963);var coords=this.config.getMethod.apply(this._model);if(this.validCoords(coords)){latlng=new google.maps.LatLng(coords.lat,coords.lng);} this._map=new google.maps.Map($(this.config.name).select('.mapsCanvas')[0],{zoom:10,center:latlng,mapTypeId:google.maps.MapTypeId.ROADMAP});if(typeof this._geoloc==='object'&&this._geoloc){this._geoloc=null;} if(this.validCoords(coords)){this.moveMarker(coords.lat,coords.lng);}}).method('validCoords',function(coords){if(typeof coords==='object'){if(coords.lat&&coords.lng&&coords.lat!==0&&coords.lng!==0&&coords.lat!=='0'&&coords.lng!=='0'){return true;}} return false;}).method('displayError',function(model){fcmsJs.console.info('Display Error');}).method('displayWaiting',function(model){fcmsJs.console.info('Display Error');});})();(function(){fcmsJs.Class('fcmsLib_Skeleton_EditorElement_SingleSelect_Editor').inherits(fcmsLib_Skeleton_EditorElement_Editor).construct(function(model,webservice){this._model=model;this._webservice=webservice;}).method('getModel',function(){return this._model;}).method('init',function(messagebox,webservice){this._messagebox=messagebox;this._addCallback=function(title,ids){if(title===fcmsJs.window.cleanWindowName(this.config.selectElementTitle)){this.select(ids);}}.bind(this);if(typeof this.viewClass==='function'){this._view=new this.viewClass(this._name,this.getModel());this._view.config=this.config;this._view.editor=this;} fcmsJs.windowCallback.subscribe(this._addCallback);this.editor._view.displayObserver.subscribe(this._view.display.bind(this._view));this._view.init();this._model.onTreeChange.subscribe(this._view.display.bind(this._view));this.serverChannel.listen(this.config.getMethod,this.setObject.bind(this));}).method('select',function(id){var param={};param[this.config.parameterName]=id;this._webservice.call(this.config.setMethod,param,(function(response){this.render();}).bind(this));}).method('render',function(){this._webservice.call(this.config.getMethod,{},(function(response){this.serverChannel.sendLocalMessage({type:this.config.getMethod,data:response.data});}).bind(this));}).method('setObject',function(data){var d=data;if(typeof this.config.objectClass==='function'){d=this.config.objectClass.cast(data);} this._model[this.config.setMethod].apply(this._model,[d]);this._view.display();});})();(function(){fcmsJs.Class('fcmsLib_Skeleton_EditorElement_SingleSelect_Mixin');})();(function(){fcmsJs.Class('fcmsLib_Skeleton_EditorElement_SingleSelect_View').inherits(fcmsLib_Skeleton_EditorElement_View).construct(function(name,model){this._name=name;this._domId=name;this._model=model;}).method('init',function(){this._elementContainer=new fcmsLib_Utils_Pure_Template(this.config.domTemplate,this.config.domTemplate,this.config.pureDirective);}).method('makeButton',function(){$(this._name).down('*[data-fcms-button=edit]').observe('click',(function(){try{fcmsJs.window.openEditor(this._model[this.config.getMethod]());}catch(e){fcmsJs.console.error(e);}}).bind(this));$(this._domId).down('*[data-fcms-button=select]').observe('click',(function(){fcmsJs.window.open(this.config.selectElementTitle,this.config.selectLink,this.config.selectParams);}).bind(this));}).method('display',function(){this.uber('display');this._elementContainer.render(this._model);this.makeButton();}).method('displayError',function(model){fcmsJs.console.info('Display Error');}).method('displayWaiting',function(model){fcmsJs.console.info('Display Error');});})();(function(){var count=0;fcmsJs.Class('fcmsLib_Skeleton_EditorElement_TextEditor_Editor').inherits(fcmsLib_Skeleton_EditorElement_Editor).construct(function(model,webservice){this._model=model;this._webservice=webservice;this.switching=false;this.setDataInProgress=false;this.setDataQueue=new fcmsLib_Core_Observer();this._dontPrefixAttributes={'src':true,'style':true,'width':true,'height':true,'align':true,'alt':true,'href':true,'title':true,'name':true,'class':true};this._filterAttributes={'fcms-id':true,'_cke_saved_src':true};this._editorMode='text';}).method('init',function(messagebox,webservice){this._messagebox=messagebox;this._editorModeStore=new fcmsLib_Utils_ClientStore('TexteditorMode');fcmsJs.windowCallback.subscribe(function(title,ids){var callbackArgumnet;if(typeof ids.each!=='undefined'){callbackArgumnet=[];ids.each(function(i){callbackArgumnet.push(i);});}else{callbackArgumnet=ids;} if((typeof this.config.selectElements[title]!=='undefined')&&(typeof this.config.selectElements[title].callback==='function')) {this.config.selectElements[title].callback(callbackArgumnet);}}.bind(this));this._view.init();this._editorModeStore.get('editorMode',function(ok,value){fcmsJs.console.error(ok,value);if(ok&&value==='wysiwyg'){this._view.doSwitchMode=true;}else if(ok&&value==='text'){this._view.doSwitchMode=false;}else{try{if(fcmsJs.config.articleEditor.defaultEditorMode==='wysiwyg'){this._view.doSwitchMode=true;}else{this._view.doSwitchMode=false;}}catch(e){fcmsJs.console.error(e);}}}.bind(this));if(typeof this.editor._tabmenu!=='undefined'){this.editor._tabmenu.getItem('Grundtext').registerElement(this);}}).method('onShow',function(){this._view.onShow();}).method('onHide',function(){this._view.onHide();}).method('switchMode',function(){if(this.switching===true){return;} this.switching=true;this._model.data.text=this.getText();if(this._editorMode!=='text'){this._editorMode='text';}else{if(CKEDITOR.env.isCompatible){this._editorMode='wysiwyg';}} this._editorModeStore.set('editorMode',this._editorMode);this._view.switchMode();if(this._editorMode==='wysiwyg'&&typeof this._view.ckEditor!='undefined'&&this._view.ckEditor){this._view.ckEditor.on('dataReady',function(){this.switching=false;}.bind(this));}else{this.switching=false;}}).method('getView',function(){return this._view;}).method('render',function(){this._view.display();}).method('addTextElement',function(type,propertyName,ids){var elements=[],element;if(!Object.isArray(ids)){ids=[ids];} try{ids.each(function(id){var e=this.getPropertyModel(type,propertyName,id);if(e!==null){this._callInsertMethod(type,e);}else{this._model[this.config.selectElements[type].propertyObserver].subscribeOnce(function(){if(count++>10){return false;} this.addTextElement(type,propertyName,[id]);}.bind(this));}}.bind(this));}catch(e){fcmsJs.console.error('Fehler in addTextElement');fcmsJs.console.error(e);}}).method('_callInsertMethod',function(type,element){fcmsJs.console.info('_callInsertMethod');try{if(this._editorMode=='text'&&typeof this.config.selectElements[type].insertIntoText!=='undefined') {this.config.selectElements[type].insertIntoText(element);}else if(this._editorMode=='wysiwyg'&&typeof this.config.selectElements[type].insertIntoWysiwyg!=='undefined') {this.config.selectElements[type].insertIntoWysiwyg(element);}}catch(e){fcmsJs.console.error(e);}}).method('setText',function(text){this._model.data.text=text;if(this._editorMode!='text'){if(this._view.ckEditor!==null){if(this.setDataInProgress){this.setDataQueue.subscribeOnce(function(){this.setText(text);}.bind(this));}else{this.setDataInProgress=true;this._view.ckEditor.setData(this.computeTextTags(),function(){this.setDataInProgress=false;this.setDataQueue.notify();}.bind(this));}}}else{return this.editor._form.setValue('text',text);}}).method('getText',function(){if(this._editorMode=='text'){if(typeof this.editor._form!=='undefined'){return this.editor._form.getValue('text');}else{return this._model.data.text;}}else{try{if(this._view.ckEditor!==null){if(this.setDataInProgress){return'';} return this.computeWysiwygTags(undefined,true);}else{fcmsJs.console.warning('Der Editor-Modus ist WYSIWYG aber es existiert (noch?) kein ckEditor.');return this._model.data.text;}}catch(e){fcmsJs.console.error(e);return this._model.data.text;}}}).method('insertTextTag',function(tagName,element,attributes){var tag=this.createTextTag(tagName,element,attributes);if(tag){var pos=this.editor._form.getCursorPosition('text');var first=this.editor._form.getValue('text').substr(0,pos);var last=this.editor._form.getValue('text').substr(pos);this.editor._form.setValue('text',first+tag+last);this.editor._form.setCursorPosition('text',pos+tag.length);}}).method('createTextTag',function(tagName,element,attributes){var atts={};if(typeof attributes=='object'){atts=attributes;} if(element&&typeof element!=='undefined'&&typeof element.data!=='undefined'&&element.data.id!==null&&typeof element.data.id!=='undefined') {atts.id=element.data.id;}else{} var tag='<%'+tagName;fcmsLib_Core_Object.each(atts,function(attribute){if(attribute.key==='class'){} tag=tag+' '+attribute.key+'="'+attribute.value+'"';});tag=tag+'%>';return tag;}).method('getTextTags',function(text){var matchingMapping={};fcmsLib_Core_Array.each(text.match(/(<%[\s\S]*?%>)/mg),function(match){try{matchingMapping[match]=this.explodeTextTag(match);}catch(e){fcmsJs.console.info(e);}}.bind(this));return matchingMapping;}).method('explodeTextTag',function(match){var matches=match.match(/<%([A-Z]+)\s+(([^=\s]+?="[^"]*"\s*)+)\s*?%>/mi),tagType=matches[1].toUpperCase(),attributeMatches={};matches[2].scan(/(\w+)="([^"]*)"/i,function(match){attributeMatches[match[1].toLowerCase()]=match[2];});attributeMatches['type']=tagType;return attributeMatches;}).method('computeTextTags',function(){var text=this._model.data.text,matchingMapping={},matches=text.match(/(<%[\s\S]*?%>)/gm);if(matches){matches.each(function(match){matchingMapping[match]=this._convertTextTag(match);}.bind(this));} fcmsLib_Core_Object.each(matchingMapping,function(mapping){if(mapping.value!=''){text=fcmsLib_Utils_String.replaceAll(text,mapping.key,mapping.value);}});return text;}).method('_convertTextTag',function(tag){var replacementTag,attHash;try{if(tag&&tag.length){var matches=tag.match(/<%([A-Z]+)\s+(([^=\s]+?="[^"]*"\s*)+)\s*?%>/mi);if(Object.isArray(matches)&&matches[1]&&matches[2]){var tagType=matches[1].toUpperCase();var attributeMatches={};matches[2].scan(/([^=\s]+)="([^"]*)"/i,function(match){if(fcmsLib_Utils_String.trim(match[1])!==''){attributeMatches[match[1].toLowerCase()]=match[2];}});if(tagType==='LINK'){var tags='';if(typeof attributeMatches['href']==='undefined'){tags=tags+' href="" ';} fcmsLib_Core_Object.each(attributeMatches,function(att){var a=att.key;if(att.key!=='text'){if(typeof this._dontPrefixAttributes[att.key]==='undefined'){a='data-fcms-'+att.key;} tags=tags+' '+a+'="'+att.value+'"';}}.bind(this));return''+fcmsLib_Utils_String.decodeHtml(attributeMatches['text'])+'';} var attributes=this._convertTextToWysiwygAttributes(attributeMatches,tagType);if(typeof attributes.src==='undefined'){attributes.src=this.config.selectElements[this.config.textElementMapping[tagType]].picture;} var element=null;if(typeof attributeMatches.id!=='undefined'&&attributeMatches.id!==''&&attributeMatches.id!==null&&attributeMatches.id!==undefined&&attributeMatches.id!=='undefined') {element=this.getPropertyModel(this.config.textElementMapping[tagType],this.config.selectElements[this.config.textElementMapping[tagType]].propertyName,attributeMatches.id);if(!element){replacementTag='';return replacementTag;}else{return this.createWysiwygTag(tagType,element,attributes);}}else{if(this.config.selectElements[this.config.textElementMapping[tagType.toUpperCase()]].isAnonymous&&typeof this.config.selectElements[this.config.textElementMapping[tagType.toUpperCase()]].getDummyModel==='function') {element=new this.config.selectElements[this.config.textElementMapping[tagType.toUpperCase()]].getDummyModel();return this.createWysiwygTag(tagType,element,attributes);}}}}}catch(e){fcmsJs.console.error(e);} return'';}).method('_convertTextToWysiwygAttributes',function(textAttributes,tag){var wysiwygAttributes={};if(typeof textAttributes==='object'){var styles={};if(typeof textAttributes.scl_width!=='undefined'){styles.width=((textAttributes.scl_width>42)?textAttributes.scl_width:42)+"px";delete textAttributes.scl_width;} if(typeof textAttributes.scl_height!=='undefined'){styles.height=((textAttributes.scl_height>42)?textAttributes.scl_height:42)+"px";delete textAttributes.scl_height;} if(!(tag==='PIC'||tag==='IMG')){styles={};} fcmsLib_Core_Object.each(textAttributes,function(att){wysiwygAttributes[att.key]=att.value;});wysiwygAttributes.style=fcmsLib_Utils_Html.toStyleString(styles);} return wysiwygAttributes;}).method('_convertWysiwygToTextAttributes',function(wysiwygAttributes){var textAttributes={};if(typeof wysiwygAttributes=='object'){delete wysiwygAttributes.src;delete wysiwygAttributes.cms_otag;if(typeof wysiwygAttributes.style!=='undefined'){var style=fcmsLib_Utils_Html.parseStyle(wysiwygAttributes.style);if(typeof style.width!=='undefined'){wysiwygAttributes.scl_width=style.width;if(wysiwygAttributes.scl_width.indexOf('px')!==-1){wysiwygAttributes.scl_width=wysiwygAttributes.scl_width.slice(0,wysiwygAttributes.scl_width.indexOf('px'));}} if(typeof style.height!=='undefined'){wysiwygAttributes.scl_height=style.height;if(wysiwygAttributes.scl_height.indexOf('px')!==-1){wysiwygAttributes.scl_height=wysiwygAttributes.scl_height.slice(0,wysiwygAttributes.scl_height.indexOf('px'));}} delete wysiwygAttributes.style;} fcmsLib_Core_Object.each(wysiwygAttributes,function(att){fcmsJs.console.info('Attribute: '+att.key+' '+att.value);if(att.key.substr(0,4)=='cms_'){textAttributes[att.key.substr(4)]=att.value;}else{textAttributes[att.key]=att.value;}});} return textAttributes;}).method('getModelByTag',function(tagType,id){var property=this.config.selectElements[this.config.textElementMapping[tagType]].propertyName;return this.getPropertyModel(this.config.textElementMapping[tagType],property,id);}).method('getPropertyModel',function(configIndex,propertyName,id){var model=null;if(typeof this._model[propertyName]!=='undefined'&&id){fcmsLib_Core_Array.each(this._model[propertyName],function(element){if(element.data.id==id){model=element;}});} if(typeof model!=='object'||model===null){if(typeof this.config.selectElements[configIndex]!='undefined'&&typeof this.config.selectElements[configIndex].editorElement!='undefined') {var editorElement=this.editor[this.config.selectElements[configIndex].editorElement];editorElement.add(id);}} return model;}).method('insertWysiwygTag',function(tagName,element,attributes){var tag=this.createWysiwygTag(tagName,element,attributes);if(tag){try{this._view.ckEditor.document.focus();fcmsJs.window.$.setTimeout(this._view.ckEditor.insertHtml.curry(tag).bind(this._view.ckEditor),100);}catch(e){fcmsJs.console.error('Fehler beim einfügen des Tags in den Wysiwyg-Editor.');fcmsJs.console.error(e);}}}).method('setIntoWysiwyg',function(data){this._view.ckEditor.insertHtml(data);}).method('setIntoText',function(data){var pos=this.editor._form.getCursorPosition('text');var first=this.editor._form.getValue('text').substr(0,pos);var last=this.editor._form.getValue('text').substr(pos);this.editor._form.setValue('text',first+data+last);this.editor._form.setCursorPosition('text',pos+data.length);}).method('createWysiwygTag',function(tagName,element,attributes){var atts={},tag;if(typeof attributes==='object'){atts=attributes;} atts.cms_otag=tagName;if(element!==null){if(typeof element.data!=='undefined'&&typeof element.data.id!=='undefined'&&element.data.id!=='') {if(typeof element.data.title!=='undefined'){atts.title=element.data.title;} atts.cms_id=element.data.id;atts['fcms-id']=tagName+element.data.id;} if(typeof element.hasPreviewPicture==='function'&&element.hasPreviewPicture()) {try{atts.src=element.getPreviewPicture().getScaledLink((typeof atts.showbig!=='undefined'&&atts.showbig==1)?'pic':'thumb',{h:(typeof atts.scl_height!=='undefined'&&atts.scl_height)?atts.scl_height:null,w:(typeof atts.scl_width!=='undefined'&&atts.scl_width)?atts.scl_width:null});}catch(e){fcmsJs.console.error(e);}} if(!atts.src){atts.src=this.config.selectElements[this.config.textElementMapping[tagName]].picture;this._view.updateElementPicture(element,tagName);}}else{if(typeof atts.src==='undefined'){atts.src=this.config.selectElements[this.config.textElementMapping[tagName]].picture;}} tag='';return tag;}).method('_convertWysiwygTag',function(tag,noautoload){if(tag&&tag.length){var matches=tag.match(/]*)\s*\/>/i);if(matches[1]){var attributeMatches={};matches[1].scan(/([^=\s]+)="([^"]*)"/i,function(match){var a=match[1].toLowerCase();if(a.substr(0,5)==='data-'){a=a.substr(5,a.length);} if(typeof this._filterAttributes[a]!=='undefined'){return;} delete attributeMatches[match[1].toLowerCase()];attributeMatches[a]=match[2];}.bind(this));var tagType=attributeMatches.cms_otag;var attributes=this._convertWysiwygToTextAttributes(attributeMatches);var element=null;if(typeof noautoload==='undefined'||!noautoload){if(typeof attributeMatches.cms_id!=='undefined'&&attributeMatches.cms_id!==''&&attributeMatches.cms_id!==null&&attributeMatches.cms_id!=='undefined'&&attributeMatches.cms_id!==undefined) {element=this.getPropertyModel(this.config.textElementMapping[tagType],this.config.selectElements[this.config.textElementMapping[tagType]].propertyName,attributeMatches.cms_id);}else{if(this.config.selectElements[this.config.textElementMapping[tagType]].isAnonymous&&typeof this.config.selectElements[this.config.textElementMapping[tagType]].getDummyModel==='function') {element=new this.config.selectElements[this.config.textElementMapping[tagType]].getDummyModel();}}} var a=this.createTextTag(tagType,element,attributes);return a;}} return'';}).method('_findWysiwygTags',function(src,autoload){var matchingMapping={};src.scan(/(<]*cms_otag[^<>]*\/>)/,function(match){matchingMapping[match[0]]=this._convertWysiwygTag(match[0],autoload);}.bind(this));return matchingMapping;}).method('computeWysiwygTags',function(text,autoload){var matchingMapping={};if(typeof text!=='string'){text=this._view.ckEditor.getData();} text.scan(/<]*>.*?<\/a>/,function(match){fcmsLib_Core_Array.each(match,function(ma){var te=ma.match(/<]*)>(.*?)<\/a>/);var tags=' text="'+fcmsLib_Utils_String.encodeHtml(te[2])+'" ';te[1].scan(/([^=\s]+)="([^"]*)"/i,function(at){var a=at[1];if(a.substr(0,10)==='data-fcms-'){a=a.substr(10,a.length);} if(a==='href'&&fcmsLib_Utils_String.trim(at[2])===''){return;} tags=tags+' '+a+'="'+at[2]+'"';});matchingMapping[ma]='<%LINK '+tags+' %>';}.bind(this));}.bind(this));fcmsLib_Core_Object.extend(matchingMapping,this._findWysiwygTags(text,autoload));fcmsLib_Core_Object.each(matchingMapping,function(mapping){text=fcmsLib_Utils_String.replaceAll(text,mapping.key,mapping.value);});return text;});})();(function(){fcmsJs.Class('fcmsLib_Skeleton_EditorElement_TextEditor_Mixin');})();(function(){fcmsJs.Class('fcmsLib_Skeleton_EditorElement_TextEditor_View').inherits(fcmsLib_Skeleton_EditorElement_View).construct(function(name,model){this.uber('construct',name,model);this._name=name;this._model=model;this.doSwitchMode=true;this.ckEditorReady=false;this.ckEditor=undefined;}).method('init',function(){this._editorContainer=new fcmsLib_Utils_Pure_Template(this.config.domTemplate,this._name,this.config.pureDirective);this._model.onDataChange.subscribe(function(){this.display();}.bind(this));if(typeof this._observersRegistered==='undefined'){if(typeof this.config.selectElements!='undefinded'){fcmsLib_Core_Object.each(this.config.selectElements,function(selectElement){if(typeof selectElement.value.propertyObserver!='undefined'){this._model[selectElement.value.propertyObserver].subscribe(this.renderTag.curry(selectElement.key).bind(this));} if(typeof selectElement.value.editorElement!='undefined'&&typeof this.editor.editor[selectElement.value.editorElement].onRemove!=='undefined'&&typeof selectElement.value.prefix!=='undefined') {this.editor.editor[selectElement.value.editorElement].onRemove.subscribe(this.remove.curry(selectElement.value.prefix.toUpperCase()).bind(this));}}.bind(this));} this._observersRegistered=true;}}).method('switchMode',function(soft){if(typeof soft==='undefined'){soft=false;} var show=false;if(this.editor.editor.getTabMenu().getItem('Grundtext').isVisible()){show=true;} if(this.editor._editorMode==='wysiwyg'){this.ckEditorReady=false;if(show){$('simpleEditor').hide();$('wysiwygEditor').show();} if(!soft){if(typeof this.ckEditor!=='undefined'&&this.ckEditor){this.ckEditor.setData(this.editor.computeTextTags());}else{window.setTimeout(function(){if(typeof this.ckEditor!=='undefined'&&this.ckEditor){this.ckEditor.setData(this.editor.computeTextTags());}}.bind(this),100);}}}else{if(!soft){$(this._name).select('textarea')[0].setValue(this.editor._model.data.text);} if(show){$('wysiwygEditor').hide();$('simpleEditor').show();}}}).method('_makeMoreElements',function(){this._menu=new fcmsLib_Skeleton_Menu_Model(this.editor);this._menu.addItem('Direkt-Bild',{onClick:this.config.selectElements.addTextPicture.action});this._menu.addItem('Imagemap',{onClick:this.config.selectElements.addTextImagemap.action});this._menu.addItem('XMedia',{onClick:this.config.selectElements.addTextXmedia.action});this._menu.addItem('Neue Seite / Werbung',{onClick:this.config.selectElements.addTextSeparator.action});this._menu.addItem('Kaufoption einfügen',{onClick:this.config.selectElements.addTextBuy.action});this._menuView=new fcmsLib_Skeleton_Menu_View('moreelements',this._menu);this._menuView.display(this._menu);}).method('onShow',function(){this.ckEditor.setData(this.ckEditor.getData());if(this.editor._editorMode==='wysiwyg'){$('wysiwygEditor').show();} this.visible=true;if(this.displayLater===true){this.displayLater=false;this.display();}}).method('hide',function(){$(this._name).hide();$('wysiwygEditor').hide();}).method('onHide',function(){$('wysiwygEditor').hide();this.visible=false;this.displayLater=false;}).method('destroy',function(){if(typeof this.ckEditor!=='undefined'){this.ckEditor.destroy();this.ckEditor.fcmsEditor=null;this.ckEditor=null;}}).method('display',function(){fcmsJs.console.info('Display TEXT-Editor !');if(this.visible===false){this.displayLater=true;} this.uber('display');this._editorContainer.render(this._model);this._makeMoreElements();var text=this.editor.getText();if(typeof this.ckEditor!=='object'||!this.ckEditor){new fcmsLib_Utils_Dom_Element("wysiwygEditor").clonePosition(".wysiwyg");this.initCkEditor(text);}else{} if(this.doSwitchMode===true){this.doSwitchMode=false;this.editor.switchMode();}else{this.switchMode(true);} this.makeButtons();}).method('initCkEditor',function(text){this.ckEditor=CKEDITOR.appendTo('wysiwygEditor',{'language':'de'},text);if(this.ckEditor===null||!this.ckEditor){this.ckEditor=undefined;fcmsJs.console.error('Fehler beim erstellen des ckEditors.');return false;} this.ckEditor.fcmsEditor=this.editor.editor;this.ckEditor.on('doubleclick',function(evt){var element=evt.data.element;if(element.is('img')&&element.getAttribute('data-cms_otag')==='BUY'){this.editor.editor.buyTagEditor.render();}}.bind(this));this.ckEditor.on('dataReady',function(){this.ckEditorReady=true;if(typeof this.ckEditor.document!=='undefined'&&this.ckEditor.document!==null){fcmsJs.shortcut.observe(this.ckEditor.document.$);}}.bind(this));}).method('makeButtons',function(){if(typeof(this.config.selectElements)!='undefinded'){fcmsLib_Core_Object.each(this.config.selectElements,function(selectElement){if($(selectElement.key)){$(selectElement.key).observe('click',selectElement.value.action.bind(this));}});} if(typeof this.config.switchElement!='undefined'){if(typeof this.ckEditor==='undefined'||!this.ckEditor){$(this.config.switchElement).hide();}else{$(this.config.switchElement).observe('click',function(){this.editor.switchMode();}.bind(this));}}}).method('remove',function(type,id){var replace=[],text=this.editor.getText();if(text.length===0){fcmsJs.window.$.setTimeout(function(){text=this.editor.getText();fcmsLib_Core_Object.each(this.editor.getTextTags(text),function(pair){if(pair.value.id==id&&type==pair.value.type){replace.push(pair.key);text=text.replace(pair.key,'');}});this.editor.setText(text);}.bind(this),100);}else{fcmsLib_Core_Object.each(this.editor.getTextTags(text),function(pair){if(pair.value.id==id&&type==pair.value.type){replace.push(pair.key);text=text.replace(pair.key,'');}});this.editor.setText(text);}}).method('updateElementPicture',function(elem,elemPrefix){var domIds,domId;if(typeof elem.getPreviewPicture==='function'&&elem.hasPreviewPicture()) {try{domIds=Element.select(this.ckEditor.document.$,'*[data-fcms-id='+elemPrefix+elem.data.id+']');fcmsLib_Core_Array.each(domIds,function(domId){try{$(domId).src=elem.getPreviewPicture().getScaledLink(($(domId).getAttribute('data-showbig')&&$(domId).getAttribute('data-showbig')==1)?'pic':'thumb',{h:(domId.style.height)?fcmsLib_Utils_Html.removeUnit(domId.style.height):null,w:(domId.style.width)?fcmsLib_Utils_Html.removeUnit(domId.style.width):null});$(domId).setAttribute('_cke_saved_src',domId.src);}catch(e){fcmsJs.console.error('Fehler: ');fcmsJs.console.error(e);}}.bind(this));}catch(e){fcmsJs.console.error('Fehler: ');fcmsJs.console.error(e);}}else{if(typeof elem.onPreviewPictureChange!=='undefined'){elem.onPreviewPictureChange.subscribeOnce(function(){this.updateElementPicture(elem,elemPrefix);}.bind(this));}else{fcmsJs.console.info('Keine onPreviewPictureChange bei '+elemPrefix+' '+elem.className);}}}).method('renderTag',function(elementKey){if(this.ckEditorReady===true){var models=this._model[this.config.selectElements[elementKey].propertyName];fcmsLib_Core_Array.each(models,function(elem){try{this.updateElementPicture(elem,this.config.selectElements[elementKey].prefix);}catch(e){fcmsJs.console.error('Error in renderTag');fcmsJs.console.error(e);}}.bind(this));}else{if(this.ckEditor){this.ckEditor.on('dataReady',this.renderTag.curry(elementKey).bind(this));}}}).method('displayError',function(model){fcmsJs.console.info('Display Error');}).method('displayWaiting',function(model){fcmsJs.console.info('Display Error');});})();(function(){fcmsJs.Class('fcmsLib_Skeleton_EditorElement_TextSelect_Editor').inherits(fcmsLib_Skeleton_EditorElement_Editor).construct(function(model,webservice){this._model=model;this._webservice=webservice;}).method('init',function(messagebox,webservice){this._messagebox=messagebox;this._addCallback=function(title,ids){if(title===this.config.addItemTitle){this.add(ids);}}.bind(this);fcmsJs.windowCallback.subscribe(this._addCallback);}).method('add',function(ids){if(!Object.isArray(ids)){ids=[ids];} fcmsLib_Core_Array.each(ids,function(id){this._webservice.call('fetch',{},function(response){var obj=this.makeObjects([response.data]);this._model[this.config.setMethod].apply(this._model,obj);}.bind(this),this.config.webserviceModule,id);}.bind(this));}).method('makeObjects',function(data){return data;}).method('handleResponse',function(){});})();(function(){fcmsJs.Class('fcmsLib_Skeleton_EditorElement_TextSelect_Mixin');})();(function(){fcmsJs.Class('fcmsLib_Skeleton_Exception').method('construct',function(message){this.message=message;this.name='fcmsLib_Skeleton_Exception';});})();(function(){fcmsJs.Class('fcmsLib_Skeleton_Menu_ContextControl').inherits(fcmsLib_Core_Class).construct(function(button,popup){this.menuCloseTimeout=500;this.toClose=null;this.button=button;this.popup=popup;this.onShow=new fcmsLib_Core_Observer();this.onHide=new fcmsLib_Core_Observer();if(!this.popup){fcmsJs.console.error('kein Popup für den ContextControl übergeben.');} if(!this.button){fcmsJs.console.error('kein Button für den ContextControl übergeben.');} button.observe('mouseover',function(){this.showContextMenu();if(this.toClose!==null){fcmsJs.window.$.clearTimeout(this.toClose);this.toClose=null;}}.bind(this));button.observe('mouseout',function(){if(this.toClose===null){this.toClose=fcmsJs.window.$.setTimeout(function(){this.hideContextMenu();this.toClose=null;}.bind(this),this.menuCloseTimeout);}}.bind(this));popup.observe('mouseover',function(){this.showContextMenu();if(this.toClose!==null){fcmsJs.window.$.clearTimeout(this.toClose);this.toClose=null;}}.bind(this));popup.observe('mouseout',function(){if(this.toClose===null){this.toClose=fcmsJs.window.$.setTimeout(function(){this.hideContextMenu();this.toClose=null;}.bind(this),this.menuCloseTimeout);}}.bind(this));}).method('toggleContextMenu',function(){if(this.popup.visible()){this.hideContextMenu();}else{this.showContextMenu();}}).method('hideContextMenu',function(){if(this.popup.visible()){this.onHide.notify();this.popup.hide();}}).method('showContextMenu',function(){if(!this.popup.visible()){this.onShow.notify();this.popup.show();}});})();(function(){fcmsJs.Class('fcmsLib_Skeleton_Menu_Item').construct(function(name,options,submenu){this.name=name;this.options=options;this.shortcut=options.shortcut;this.submenu=submenu;this.href=options.href;}).method('getIdentifyer',function(){return this.name.replace(/[^a-z]/ig,'_').toLowerCase();}).method('getOption',function(name){if(typeof this.options[name]!=='undefined'){return this.options[name];} return false;});})();(function(){fcmsJs.Class('fcmsLib_Skeleton_Menu_Model').construct(function(name){this.items=[];}).method('addItem',function(name,options){var submenu=new fcmsLib_Skeleton_Menu_Model();this.items.push(new fcmsLib_Skeleton_Menu_Item(name,options,submenu));return{addItem:this.addItem.bind(this),addSubItem:submenu.addItem.bind(submenu)};}).method('removeAllItems',function(){this.items=[];});})();(function(){fcmsJs.Class('fcmsLib_Skeleton_Menu_View').inherits(fcmsLib_Core_Class).construct(function(name,model,subitems,options){this._model=model;this._name=name;this.toClose=null;this._selectedItem='0';this.disabled=false;this.options={hasShortcuts:false,contextTemplate:false,hasHref:false};if(typeof options!=='undefined'){this.options=Object.extend(this.options,options);} if(subitems===true){this._subitems=true;}else{this._subitems=false;} this._contextTemplate=this._name+'Context';this._context=this._name+'Context';if(!$(this._context)){if(this.options.contextTemplate){var div=document.createElement('div');div.id=this._context;document.body.appendChild(div);this._context=this._context;this._contextTemplate=this.options.contextTemplate;}} this._template=new fcmsLib_Utils_Pure_List(this._context,this._contextTemplate,'menu',this.makeDirective());if($('shortmenu')){this._shortmenutpl=new fcmsLib_Utils_Pure_List('shortmenu','shortmenu','menu',this.makeShortDir());}}).method('makeShortDir',function(){return{'a+':'menu.name','a@class':function(c){return c.item.name.replace(/[^a-z]/ig,'_').toLowerCase();},'img@alt':'menu.name','img@title':'menu.name','img@src':'menu.options.icon'};}).method('makeDirective',function(){var dir={};if(this.options.hasHref){dir['a@href']='menu.href';} dir['a+']='menu.name';if(this.options.hasShortcuts){dir['.shortcut']='menu.shortcut';} dir['@id']=function(c){return this._name+'_'+c.item.getIdentifyer();}.bind(this);if(this._subitems){dir['div.subitems']=function(c){return c.item.submenu.items.length?this._template._subrule({elements:c.item.submenu.items}):'';}.bind(this);} return dir;}).method('display',function(menu){var displayItems;this.menu=menu;this._template.render(menu.items);if(typeof this._shortmenutpl==='object'){this._shortmenutpl.render(fcmsLib_Core_Array.filter(menu.items,function(m){if(m){return m.getOption('shortmenu');}}));} fcmsLib_Core_Array.each(menu.items,function(i){this.registerItem(i);}.bind(this));if($(this._name).nodeName==='AREA'){var pos=$(this._name).parentNode.cumulativeOffset();if(pos[0]===0&&pos[1]===0){pos=$($(this._name).parentNode.parentNode).cumulativeOffset();} var coords=$(this._name).getAttribute('coords').split(',');var c=$(this._name+'Context');c.style.left=(parseInt(pos[0],10)+parseInt(coords[0],10)+5)+'px';c.style.top=(parseInt(pos[1],10)+parseInt(coords[1],10)+5)+'px';fcmsJs.console.debug(c);}else if($(this._name).select('.menuicon')[0]){$(this._name+'Context').clonePosition($(this._name).select('.menuicon')[0],{setTop:false,setWidth:false,setHeight:false});}else{$(this._name+'Context').clonePosition($(this._name),{setWidth:false,setHeight:false});} this.contextmenu=new fcmsLib_Skeleton_Menu_ContextControl($(this._name).select('.menuicon')[0]||$(this._name),$(this._name+'Context'));this.enable();}).method('registerItem',function(i){if($(this._name+'_'+i.getIdentifyer())){$(this._name+'_'+i.getIdentifyer()).observe('click',function(){this.click(i);}.bind(this));} try{$(this._name).select('.'+i.getIdentifyer())[0].observe('click',function(ev){this.click(i,ev);}.bind(this));}catch(e){} if(i.submenu.items.length){new fcmsLib_Skeleton_Menu_ContextControl($(this._name+'_'+i.getIdentifyer()),$(this._name+'_'+i.getIdentifyer()).select('.subitems .contextmenu')[0]);fcmsLib_Core_Array.each(i.submenu.items,function(item){this.registerItem(item);}.bind(this));}}).method('disable',function(){this.disabled=true;fcmsJs.console.debug(this._name);}).method('enable',function(){this.disabled=false;}).method('click',function(item,evt){if(typeof evt!=='undefined'){Event.stop(evt);} if(this.disabled===true){return;} if(typeof item.options.onClick!=='undefined'){if(typeof item.options.onClick==='function'){item.options.onClick();this.contextmenu.hideContextMenu();}}}).method('mouseover',function(i){}).method('displayError',function(error){}).method('displayWaiting',function(){});})();(function(){fcmsJs.Class('fcmsLib_Skeleton_Model').inherits(fcmsLib_Core_Class).construct(function(){this.data={};this._tree=undefined;this.onDataChange=new fcmsLib_Core_Observer();this.onTreeChange=new fcmsLib_Core_Observer();this.onChange=new fcmsLib_Core_Observer();this.onChangeStart=new fcmsLib_Core_Observer();this.onChangeStop=new fcmsLib_Core_Observer();this.onError=new fcmsLib_Core_Observer();this.onDelete=new fcmsLib_Core_Observer();this.onSave=new fcmsLib_Core_Observer();}).method('setData',function(data){fcmsLib_Core_Object.each(data,function(pair){this[pair.key]=pair.value;}.bind(this));this.onDataChange.notify();}).method('getName',function(){if(typeof this.data.title!=='undefined'){return this.data.title;}else if(this.data.label){return this.data.label;} return'';}).method('updateModel',function(data){if(typeof data!=='object'){throw new fcmsLib_Core_Exception('Falsche Daten an updateModel übergeben.');} fcmsLib_Core_Object.each(data,function(pair){if(typeof pair.value==='object'&&!Object.isArray(pair.value)){fcmsLib_Core_Object.each(pair.value,function(k){if(typeof this['set'+fcmsLib_Utils_String.ucFirst(k.key)]!=='undefined'){this['set'+fcmsLib_Utils_String.ucFirst(k.key)].apply(this,[k.value]);}else{this[pair.key][k.key]=k.value;}}.bind(this));}else{this[pair.key]=pair.value;}}.bind(this));this.onChange.notify();}).method('getData',function(){return this.data;}).method('getId',function(){return this.data.id;}).method('getWebserviceData',function(){return{data:this.data};}).method('getType',function(){return this.getModuleName();}).method('getModuleName',function(){var parts=this.className.split('_');parts.pop();parts.shift();return parts.join('_');}).method('getField',function(name){return fcmsLib_Core_Object.getMultiDimKey(this,name);}).method('setField',function(name,val){return fcmsLib_Core_Object.setMultiDimKey(this,name,val);}).staticMethod('create',function(obj){var x=new this();for(var i in obj){if(obj.hasOwnProperty(i)){x[i]=obj[i];}} return x;});})();(function(){fcmsJs.Class('fcmsLib_Skeleton_TabMenu_MenuItem').construct(function(name,options){this.name=name;this.options=options;this.domId=name.toLowerCase()+"Tab";if(typeof(this.options.domId)!=='undefined'){this.domId=this.options.domId;} this.visible=false;}).method('isVisible',function(){return this.visible;}).method('show',function(){if(this.visible===false){$(this.domId).setStyle({display:'block'});this.visible=true;this._callOnElements('onShow');return true;} return false;}).method('registerElement',function(editorElement){if(typeof this.options.editorElements!=='object'){this.options.editorElements=[];} this.options.editorElements.push(editorElement);}).method('hide',function(){if(this.visible===true){$(this.domId).setStyle({display:'none'});this._callOnElements('onHide');this.visible=false;return true;} return false;}).method('_callOnElements',function(method){if(typeof this.options.editorElements==='object'){fcmsLib_Core_Array.each(this.options.editorElements,function(ee){if(typeof ee[method]!=='undefined'){ee[method].apply(ee,[]);}});}});})();(function(){fcmsJs.Class('fcmsLib_Skeleton_TabMenu_Model').construct(function(name){this.items=[];}).method('addItem',function(name,options){this.items.push(new fcmsLib_Skeleton_TabMenu_MenuItem(name,options));}).method('getItem',function(name){return this.items.find(function(i){return i.name===name;});}).method('show',function(name){var ret=false;fcmsLib_Core_Array.each(this.items,function(i){try{if(i.name.toLowerCase()===name.toLowerCase()){ret=i.show();}else{i.hide();}}catch(e){fcmsJs.console.error('Keine DOM-ID '+i.name);fcmsJs.console.debug(i);fcmsJs.console.debug(e);}});return ret;});})();(function(){fcmsJs.Class('fcmsLib_Skeleton_TabMenu_View').inherits(fcmsLib_Core_Class).construct(function(name,model){this._selectedItem='0';this._template=new fcmsLib_Utils_Pure_List('tabmenu','tabmenu','tab',this.makeDirective());this._model=model;this._name=name;this.active='grundtext';try{this._model.pictureObserver.subscribe(this.display.curry(null).bind(this));this._model.thumbObserver.subscribe(this.display.curry(null).bind(this));this._model.streamsetObserver.subscribe(this.display.curry(null).bind(this));this._model.linkboxObserver.subscribe(this.display.curry(null).bind(this));this._model.diashowObserver.subscribe(this.display.curry(null).bind(this));this._model.onGeolocationChange.subscribe(this.display.curry(null).bind(this));}catch(e){}}).method('makeDirective',function(){var dir={};dir['.title']='tab.name';dir['@id']=function(c){return'menu_'+c.item.name.toLowerCase();};dir['@class+']=function(c){if(c.item.name.toLowerCase()===this.active.toLowerCase()){return' tab_aktiv';}else{return' tab_inaktiv';}}.bind(this);dir['.anzahl']=function(context){var ret=NaN;if(typeof context.item.options.count==='undefined'){return'';} if(typeof this._model[context.item.options.count]!=='undefined'){ret=this._model[context.item.options.count].apply(this._model);} if(ret){return'('+ret.length+')';} return'(?)';}.bind(this);return dir;}).method('display',function(menu){var displayItems;if(menu!==null){this.menu=menu;} displayItems=fcmsLib_Core_Array.filter(this.menu.items,function(i){if(typeof i.options.hidden!=='undefined'&&i.options.hidden===true){return false;} return true;});this._template.render(displayItems);$(this._name).select('.tabs')[0].show();fcmsLib_Core_Array.each(displayItems,function(i){$('menu_'+i.name.toLowerCase()).observe('click',function(){this.show(i.name);}.bind(this));}.bind(this));}).method('show',function(name){if(this.menu.show(name)){this.active=name;this.display(this.menu);}}).method('displayError',function(error){}).method('displayWaiting',function(){});})();(function(){fcmsJs.Class('fcmsLib_Skeleton_Tree_EditorElement_Ressort_Editor').inherits(fcmsLib_Skeleton_EditorElement_SingleSelect_Editor).construct(function(model,webservice){this.uber('construct',model,webservice);this._name='ressortSelect';this.config={};this.config.prefix='ressort';this.config.getMethod='getTree';this.config.setMethod='setTree';this.config.selectElementTitle='Ressort auswählen';this.config.domTemplate='ressortSelect';this.config.parameterName='treeId';this.config.pureDirective={'a.label':function(directiveData){if(typeof(directiveData.context._tree.data)!=='undefined'&&typeof(directiveData.context._tree.data.label)!=='undefined'&&directiveData.context._tree.data.label.length) {return directiveData.context._tree.data.label;} return'keines';},'div.path':function(directiveData){if(typeof(directiveData.context._tree.data)!=='undefined'&&typeof(directiveData.context._tree.data.path)!=='undefined'&&directiveData.context._tree.data.path.length) {return directiveData.context._tree.data.path;}}};});})();(function(){fcmsJs.Class('fcmsLib_Skeleton_Tree_EditorElement_Ressort_Mixin').inherits(fcmsLib_Skeleton_EditorElement_SingleSelect_Mixin).method('setTree',function(tree){if(typeof tree.data!=='undefined'){this._tree=fcmsAdmin_Article_Tree_Model.cast(tree);fcmsJs.console.debug(this._tree);if(typeof this.onTreeChange){this.onTreeChange.notify(this._tree);}}else{return false;} return true;}).method('getTree',function(){return this._tree;});})();(function(){fcmsJs.Class('fcmsLib_Skeleton_Tree_EditorElement_Ressort_View').inherits(fcmsLib_Skeleton_EditorElement_SingleSelect_View).method('makeButton',function(){$(this.config.setMethod).observe('click',(function(){fcmsJs.window.open(this.config.selectElementTitle,'tree.html?_CMPARM='+this.config.selectElementType+'-CALLBACK-NONE---'+this._model._tree.data.id,'width=300,height=500,scrollbars=1,resizable=1');}).bind(this));});})();(function(){fcmsJs.Class('fcmsLib_Skeleton_Tree_Model').inherits(fcmsLib_Skeleton_Model).method('getClass',function(){return this.data['class'];});})();(function(){fcmsJs.Class('fcmsLib_Skeleton_View').construct(function(name,model){if(typeof name!="string"){fcmsJs.console.warn("Kein Name für den View "+this.className+" angegeben.");} if(!(model instanceof fcmsLib_Skeleton_Model)){fcmsJs.console.warn("Kein Model für den View "+this.className+" angegeben.");} this._name=name;this._model=model;this.displayObserver=new fcmsLib_Core_Observer();}).method('makeDirective',function(){return null;}).method('setTemplate',function(templateId,targetId,renderMode){if(typeof(this._template)!='undefined'){return true;} this._template=new fcmsLib_Utils_Pure_Template(templateId,targetId,fcmsLib_Utils_Pure_Util.filterFormRules(this.makeDirective()));if(renderMode){this._template.setRenderMode(renderMode);}}).method('findDomNode',function(element){this.setDomNode(new fcmsLib_Utils_Dom_Element(this._template.getTargetId()));}).method('getDomNode',function(){return this._domNode;}).method('setDomNode',function(d){if(d){this._domNode=d;}else{fcmsJs.console.error('Fehler beim setzen des DOM-Nodes.');}}).method('getModel',function getModel(){return this._model;}).method('getName',function getName(){return this._name;}).method('getController',function getController(){return this.editor;}).method('setController',function setController(controller){if(!(controller instanceof fcmsLib_Skeleton_Controller||controller instanceof fcmsLib_Skeleton_Editor)){throw new fcmsLib_Core_Exception("Controller hat falschen Typ.");} this.editor=controller;}).method('getTemplate',function(){return this._template;}).method('display',function(){if(typeof(this._template)==='undefined'){return false;} var ret=this._template.render(this.getModel());this.setDomNode(new fcmsLib_Utils_Dom_Element(ret));return ret;});})();fcmsJs.Class('fcmsLib_Skeleton_FormModel').inherits(fcmsLib_Skeleton_Model).construct(function(form){this.uber('construct');this.form=form;}).method('setField',function(name,asdf){return this.form.setValue(name,asdf);}).method('getField',function(name){return this.form.getValue(name);});if(typeof fcmsJs==="object"){fcmsJs.loaded("fcmsLib_Skeleton");}