From cfd219979859786b9849cf1096c3d1a7d419f910 Mon Sep 17 00:00:00 2001 From: Andre Kless Date: Wed, 24 Apr 2024 09:52:46 +0200 Subject: [PATCH] ccm.dms.js v5.2.0: multilingualism for user content --- ccm.dms.js | 22 +- ccm.dms.min.js | 2 + ccm.dms.min.js.map | 1 + index.html | 4 +- versions/ccm.dms-5.2.0.js | 629 ++++++++++++++++++++++++++++++ versions/ccm.dms-5.2.0.min.js | 2 + versions/ccm.dms-5.2.0.min.js.map | 1 + 7 files changed, 649 insertions(+), 12 deletions(-) create mode 100644 ccm.dms.min.js create mode 100644 ccm.dms.min.js.map create mode 100644 versions/ccm.dms-5.2.0.js create mode 100644 versions/ccm.dms-5.2.0.min.js create mode 100644 versions/ccm.dms-5.2.0.min.js.map diff --git a/ccm.dms.js b/ccm.dms.js index 1f6d97c..8fa252c 100644 --- a/ccm.dms.js +++ b/ccm.dms.js @@ -2,8 +2,9 @@ * @overview ccmjs-based web component for a digital makerspace * @author André Kless 2018-2022, 2024 * @license The MIT License (MIT) - * @version latest (5.1.0) + * @version latest (5.2.0) * @changes + * version 5.2.0 (24.04.2024): multilingualism for user content * version 5.1.0 (17.04.2024): added register form * version 5.0.0 (03.03.2022): reimplementation * (for older version changes see ccm.dms-4.5.0.js) @@ -98,12 +99,12 @@ this.dark === 'auto' && this.element.classList.add( 'dark_auto' ); this.dark === true && this.element.classList.add( 'dark_mode' ); - // listen to language change event + // listen to language change event => reload page with new language this.lang && this.lang.observe( lang => { - $.params( { lang: lang } ); // change language in URL parameter - element.querySelector( '.timestamp' ) && this.refresh(); // translate timestamps + $.setContent( this.element, '' ); + $.params( { lang } ); + location.reload(); } ); - }; /** @@ -112,6 +113,8 @@ */ this.start = async () => { + $.setContent( this.element, '' ); + // logging of 'start' event this.logger && this.logger.log( 'start' ); @@ -120,6 +123,9 @@ this.components.get( { deleted: false } ), this.apps.get( { deleted: false } ) ] ); + if (this.lang) { + data[0].forEach(component => this.lang.translate(component)); + } data = { components: { arr: data[ 0 ], @@ -465,11 +471,7 @@ this.refresh = () => { const params = $.params(); const lang = this.lang && this.lang.active; - if ( lang ) - if ( params.lang ) - params.lang !== lang && this.lang.switch( params.lang ); - else - $.params( { lang: lang } ); + if ( this.lang ) $.params( { lang: lang } ); switch ( params.view ) { case 'home': return this.render.home(); diff --git a/ccm.dms.min.js b/ccm.dms.min.js new file mode 100644 index 0000000..f431cc6 --- /dev/null +++ b/ccm.dms.min.js @@ -0,0 +1,2 @@ +(()=>{const component={name:"dms",ccm:"https://ccmjs.github.io/ccm/versions/ccm-27.3.1.min.js",config:{apps:["ccm.store"],comment:["ccm.component","https://ccmjs.github.io/tkless-components/comment/versions/ccm.comment-7.2.0.min.js"],css:["ccm.load",["https://ccmjs.github.io/digital-makerspace/libs/bootstrap-5/css/bootstrap.min.css","https://ccmjs.github.io/digital-makerspace/resources/styles.min.css"],"https://ccmjs.github.io/digital-makerspace/libs/bootstrap-5/css/bootstrap-icons.min.css",{url:"https://ccmjs.github.io/digital-makerspace/libs/bootstrap-5/css/bootstrap-fonts.min.css",context:"head"}],components:["ccm.store"],configs:["ccm.store"],dark:false,icon:"https://ccmjs.github.io/digital-makerspace/resources/img/icon.png",helper:["ccm.load","https://ccmjs.github.io/digital-makerspace/libs/ccm/helper.mjs"],html:["ccm.load","https://ccmjs.github.io/digital-makerspace/resources/templates.mjs"],libs:["ccm.load","https://ccmjs.github.io/digital-makerspace/libs/bootstrap-5/js/bootstrap.bundle.min.js"],picture:"https://ccmjs.github.io/akless-components/user/resources/icon.svg",quill:["ccm.component","https://ccmjs.github.io/akless-components/quill/versions/ccm.quill-2.0.0.min.js",{options:{theme:"snow"}}],selectize:["ccm.component","https://ccmjs.github.io/akless-components/selectize/versions/ccm.selectize-1.0.0.min.js",{create:true,create_on_blur:true,plugins:["remove_button"]}],shadow:"none",text:["ccm.load","https://ccmjs.github.io/digital-makerspace/resources/resources.mjs#en"],url:"https://ccmjs.github.io/digital-makerspace/app.html",user:["ccm.instance","https://ccmjs.github.io/akless-components/user/versions/ccm.user-9.7.2.min.js"]},Instance:function(){let $;let data;let element;const tmp={};this.init=async()=>{$=Object.assign({},this.ccm.helper,this.helper);$.use(this.ccm);if(this.lang)this.lang.dark=this.dark};this.ready=async()=>{this.logger&&this.logger.log("ready",$.privatize(this,true));window.addEventListener("popstate",this.refresh);this.dark==="auto"&&this.element.classList.add("dark_auto");this.dark===true&&this.element.classList.add("dark_mode");this.lang&&this.lang.observe((lang=>{$.setContent(this.element,"");$.params({lang:lang});location.reload()}))};this.start=async()=>{$.setContent(this.element,"");this.logger&&this.logger.log("start");data=await Promise.all([this.components.get({deleted:false}),this.apps.get({deleted:false})]);if(this.lang){data[0].forEach((component=>this.lang.translate(component)))}data={components:{arr:data[0],options:{title:{},creator:{},tags:{}}},apps:{arr:data[1],options:{title:{},tool:{},creator:{},tags:{}}}};const ratings={components:[],apps:[]};data.components.arr=data.components.arr.filter((dataset=>dataset.ratings?!ratings.components.push(dataset):dataset.ratings={components:{},tools:{}}));data.apps.arr=data.apps.arr.filter((dataset=>dataset.ratings?!ratings.apps.push(dataset):dataset.ratings={}));data.components.meta=$.arrToObj(data.components.arr);data.apps.meta=$.arrToObj(data.apps.arr);ratings.components.forEach((user=>{for(const key in user.ratings)if(data.components.meta[key])data.components.meta[key].ratings.components[user.user]=user.ratings[key];for(const key in user.tools)if(data.components.meta[key])data.components.meta[key].ratings.tools[user.user]=user.tools[key]}));ratings.apps.forEach((user=>{for(const key in user.ratings)if(data.apps.meta[key])data.apps.meta[key].ratings[user.user]=user.ratings[key]}));data.components.arr.forEach((component=>{const ratings=Object.values(component.ratings.components);const tools=Object.values(component.ratings.tools);component.rating={component:ratings.reduce(((a,b)=>a+b),0)/ratings.length||0,tool:tools.reduce(((a,b)=>a+b),0)/tools.length||0}}));data.apps.arr.forEach((app=>{const ratings=Object.values(app.ratings);app.rating=ratings.reduce(((a,b)=>a+b),0)/ratings.length;app.tool=(data.components.meta[app.component]||{}).title}));const add=(obj,key)=>!obj[key]&&(obj[key]=true);const user=this.user.getValue();data.components.arr.forEach((component=>{component.apps=0;if(!component.listed&&(!user||user.key!==component._.creator))return;add(data.components.options.title,component.title);add(data.components.options.creator,component.creator);component.tags.forEach((tag=>add(data.components.options.tags,tag)))}));data.apps.arr.forEach((app=>{if(!app.listed&&(!user||user.key!==app._.creator))return;const component=data.components.meta[app.component];component&&component.apps++;add(data.apps.options.title,app.title);component&&add(data.apps.options.tool,component.title);add(data.apps.options.creator,app.creator);app.tags.forEach((tag=>add(data.apps.options.tags,tag)))}));for(const key in data.components.options)data.components.options[key]=Object.keys(data.components.options[key]);for(const key in data.apps.options)data.apps.options[key]=Object.keys(data.apps.options[key]);this.html.share(this,data);this.html.render(this.html.main(),this.element);element=this.element.querySelector("main");await this.refresh();this.lang&&$.setContent(this.element.querySelector("#lang"),this.lang.root)};this.getValue=()=>$.clone(data);this.events={onRegister:async()=>{$.params({view:"register"},true,true);await this.refresh()},onRegisterSubmit:async()=>{const store=await this.ccm.store({url:"https://ccm2.inf.h-brs.de",name:"dms-user"});const{name:name,username:username,password:password}=$.formData(element.querySelector("#register_form"));try{await store.set({key:username,user:username,name:name,realm:"cloud",token:this.user.hash.md5(password),_:{creator:username,realm:"cloud",access:{get:"creator",set:"creator",del:"creator"}}});alert(this.lang.translate("register_success"));$.params({view:"home"},true,true);await this.refresh()}catch(e){alert(this.lang.translate("register_failed"))}},onLogin:async()=>{await this.user.login();await this.start()},onLogout:async()=>{await this.user.logout();await this.start()},onHome:async()=>{$.params({view:"home"},true,true);await this.refresh()},onList:async(section,values={})=>{$.params(Object.assign({view:section},values),true,true);await this.refresh()},onSearch:section=>{const values={sort:element.querySelector("#section-sort").value};element.querySelectorAll('input[type="search"]').forEach((input=>values[input.id.split("-").pop()]=input.value));$.params(values);this.render.cards(section,values)},onItem:async(section,meta_key)=>{$.params({view:section,id:meta_key},true,true);await this.refresh()},onEdit:async(type,meta_key)=>{$.params({edit:type,id:meta_key},true,true);await this.refresh()},onEditSubmit:async(type,meta_key)=>{await this.user.login();const form=$.formData(element.querySelector("form"));if(!form.title||!form.visibility)return;if(form.visibility==="private")form.agree={content:false,software:false,copyright:false};else if(type==="app"&&!form.agree.content||!form.agree.software||!form.agree.copyright)return;if(type!=="app")delete form.agree.content;const prop=type!=="app"?"components":"apps";const meta=data[prop].meta[meta_key];form.key=meta.key;form.tags=meta.selectize.getValue();form.description=meta.quill.getHTML();form.listed=form.visibility==="public";form["_.access.get"]=form.visibility==="private"?"creator":"all";delete form.visibility;await Promise.all([await this[prop].set(form),type==="app"&&await this.configs.set({key:meta_key,"_.access.get":form.visibility==="private"?"creator":"all"})]);$.assign(meta,form);const set=(key,value=form[key])=>!data[prop].options[key].includes(value)&&data[prop].options[key].push(value);set("title");set("creator");form.tags.forEach((tag=>set("tags",tag)));await this.events.onItem(type,meta_key)},onDelete:async(type,meta_key)=>{const prop=type!=="app"?"components":"apps";await this[prop].set({key:meta_key,deleted:true});delete data[prop].meta[meta_key];data[prop].arr=data[prop].arr.filter((meta=>meta.key!==meta_key));this.events.onList(type+"s")},onRating:async(type,meta_key,rating)=>{const user_key=(await this.user.login()).key;const prop=type==="app"?"apps":"components";const meta=data[prop].meta[meta_key.toString()];if(user_key===meta._.creator)return this.refresh();const priodata={key:"_"+user_key};priodata[(type==="tool"?"tools":"ratings")+"."+meta.key.toString()]=rating;let ratings=type==="app"?meta.ratings:meta.ratings[type+"s"];if(rating===ratings[user_key])rating=0;ratings[user_key]=rating;ratings=Object.values(ratings);rating=ratings.reduce(((a,b)=>a+b),0)/ratings.length||0;if(type==="app")meta.rating=rating;else meta.rating[type]=rating;this.render.rating(type,meta.key);const store=this[prop];if(await store.get(priodata.key))await store.set(priodata);else await store.set({key:priodata.key,user:user_key,tools:{},ratings:{},_:{creator:user_key,realm:"cloud",access:{get:"all",set:"creator",del:"creator"}}})},onStart:async(type,meta_key,template)=>{switch(type){case"tool":if(template===true)return this.render.editor(meta_key,template);$.params({editor:meta_key,template:template},true,true);break;case"app":$.params({show:meta_key},true,true);break}await this.refresh()},onCreate:async tool_key=>this.render.create(tool_key),onCreateSubmit:async tool_key=>{await this.user.login();const form=$.formData(element.querySelector("form"));if(!form.title||!form.visibility)return;if(form.visibility==="private")form.agree={content:false,software:false,copyright:false};else if(!form.agree.content||!form.agree.software||!form.agree.copyright)return;const tool_meta=data.components.meta[tool_key];form.creator=this.user.getUsername();form.icon=tool_meta.icon;form.tags=tmp.selectize.getValue();form.description=tmp.quill.getHTML();form.listed=form.visibility==="public";form.deleted=false;const config=tmp.editor.getValue();const app_key=$.generateKey();form.key=config.key=[tool_key,app_key];form.component=config.component=tool_key;form.app=config.app=app_key;form.ignore={config:["ccm.get",this.configs.source(),form.key]};$.deepValue(config,"ignore.meta",["ccm.get",this.apps.source(),form.key]);form._=config._={creator:this.user.getValue().key,realm:"cloud",access:{get:form.visibility==="private"?"creator":"all",set:"creator",del:"creator"}};delete form.visibility;tool_meta.apps++;await Promise.all([this.apps.set(form),this.configs.set(config)]);form.ratings={};form.tool=tool_meta.title;form.created_at=form.updated_at=Date.now();data.apps.arr.push(form);data.apps.meta[form.key.toString()]=form;const set=(key,value=form[key])=>!data.apps.options[key].includes(value)&&data.apps.options[key].push(value);set("title");set("creator");form.tags.forEach((tag=>set("tags",tag)));await this.events.onItem("app",form.key)},onSave:async app_key=>{await this.user.login();const config=tmp.editor.getValue();config.key=app_key;await this.configs.set(config);this.events.onStart("app",app_key)},onPreview:tool_key=>this.render.preview(tool_key)};this.refresh=()=>{const params=$.params();const lang=this.lang&&this.lang.active;if(this.lang)$.params({lang:lang});switch(params.view){case"home":return this.render.home();case"tools":case"apps":case"components":return this.render.list(params.view,params);case"tool":case"app":case"component":return this.render.item(params.view,params.id);case"register":return this.render.register()}if(params.edit)return this.render.edit(params.edit,params.id);if(params.editor)return this.render.editor(params.editor,params.template);if(params.show)return this.render.show(params.show);this.render.home()};this.render={header:active=>this.html.render(this.html.header(active),this.element.querySelector("header")),home:()=>{this.render.header();this.html.render(this.html.home(),element);this.lang&&this.lang.translate()},list:(section,values)=>{this.render.header(section==="components"?"developer":section);$.replace(element,element=element.cloneNode());this.html.render(this.html.list(section,values),element);this.lang&&this.lang.translate()},cards:(section,values)=>{this.html.render(this.html.cards(section,values),element.querySelector("#search_results"));this.lang&&this.lang.translate()},item:async(section,meta_key)=>{this.render.header(section==="component"?"developer":section+"s");this.html.render(this.html.item(section,meta_key),element);this.lang&&this.lang.translate();const meta=data[section==="app"?"apps":"components"].meta[meta_key];if(!this.comment||!meta)return;const comments_key=section+"_comments";if(!meta[comments_key])meta[comments_key]=await this.comment.instance({dark:this.dark,"data.key":[].concat(section,meta_key.split(",")),user:["ccm.instance",this.user.component.url,JSON.parse(this.user.config)]});$.setContent(this.element.querySelector("#comments"),meta[comments_key].root);await meta[comments_key].start()},rating:(section,meta_key)=>{this.html.render(this.html.rating(section,meta_key),element.querySelector("#rating article"));this.lang&&this.lang.translate()},edit:async(type,meta_key)=>{const meta=data[type!=="app"?"components":"apps"].meta[meta_key];this.render.header(type==="component"?"developer":type+"s");this.html.render(this.html.edit(type,meta.key),element);if(!meta.selectize){meta.selectize=await this.selectize.start({options:[...new Set([...data.apps.options.tags,...meta.tags||[]])],items:meta.tags||[]})}if(!meta.quill){meta.quill=await this.quill.start();meta.description&&meta.quill.setHTML(meta.description)}$.setContent(this.element.querySelector("#form-tags"),meta.selectize.root);$.setContent(this.element.querySelector("#form-description"),meta.quill.root);const radio=element.querySelector("#form-visibility-private");radio.checked&&radio.click();this.lang&&this.lang.translate()},editor:(tool_key,app_key)=>{this.render.header("tools");const tool_meta=data.components.meta[tool_key];this.html.render(this.html.editor(tool_key,app_key===true?tmp.app_key:app_key),element);this.lang&&this.lang.translate();if(app_key===true)return $.setContent(this.element.querySelector("#editor"),tmp.editor.root);const config=app_key&&data.apps.meta[app_key].ignore.config;Promise.all([$.solveDependency(tool_meta.ignore.editors[0].app||tool_meta.ignore.editors[0].comp||tool_meta.ignore.editors[0],this),$.solveDependency(config,this)]).then((([editor_comp,config={}])=>{if(config.data&&config.data.store&&config.data.key&&data.apps.meta[app_key]._.creator!==(this.user.getValue()||{}).key)delete config.data.key;delete config.key;delete config.component;delete config.app;delete config.ignore?.meta;delete config.created_at;delete config.updated_at;delete config._;editor_comp.start({dark:this.dark,data:{store:["ccm.store",{app:config}],key:"app"},parent:this,root:this.element.querySelector("#editor")}).then((editor_inst=>{tmp.editor=editor_inst;tmp.app_key=app_key}))}))},create:async tool_key=>{this.render.header("tools");this.html.render(this.html.create(tool_key),element);tmp.selectize=await this.selectize.start({root:this.element.querySelector("#form-tags"),options:data.apps.options.tags});tmp.quill=await this.quill.start({root:this.element.querySelector("#form-description")});const radio=element.querySelector("#form-visibility-private");radio.click();radio.checked=false;this.lang&&this.lang.translate()},preview:tool_key=>{this.render.header("tools");const tool_meta=data.components.meta[tool_key];this.html.render(this.html.preview(tool_key),element);this.ccm.start(tool_meta.path,{parent:this,root:this.element.querySelector("#preview"),src:tmp.editor.getValue()});this.lang&&this.lang.translate()},show:async app_key=>{this.render.header("apps");const app_meta=data.apps.meta[app_key];const tool_meta=data.components.meta[app_meta.component];this.html.render(this.html.show(app_key),element);this.lang&&this.lang.translate();await this.ccm.start(tool_meta.path,{src:app_meta.ignore.config,parent:this,root:this.element.querySelector("#app")});await this.handover.start({root:this.element.querySelector("#handover"),"ignore.config":app_meta.ignore.config,tool:tool_meta.path,url:(component,config)=>this.url+"?app="+config[2].toString()})},register:async()=>{this.render.header();this.html.render(this.html.register(),element);this.lang&&this.lang.translate()}}}};let b="ccm."+component.name+(component.version?"-"+component.version.join("."):"")+".js";if(window.ccm&&null===window.ccm.files[b])return window.ccm.files[b]=component;(b=window.ccm&&window.ccm.components[component.name])&&b.ccm&&(component.ccm=b.ccm);"string"===typeof component.ccm&&(component.ccm={url:component.ccm});let c=(component.ccm.url.match(/(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)/)||[""])[0];if(window.ccm&&window.ccm[c])window.ccm[c].component(component);else{var a=document.createElement("script");document.head.appendChild(a);component.ccm.integrity&&a.setAttribute("integrity",component.ccm.integrity);component.ccm.crossorigin&&a.setAttribute("crossorigin",component.ccm.crossorigin);a.onload=function(){(c="latest"?window.ccm:window.ccm[c]).component(component);document.head.removeChild(a)};a.src=component.ccm.url}})(); +//# sourceMappingURL=ccm.dms.min.js.map \ No newline at end of file diff --git a/ccm.dms.min.js.map b/ccm.dms.min.js.map new file mode 100644 index 0000000..698c01f --- /dev/null +++ b/ccm.dms.min.js.map @@ -0,0 +1 @@ +{"version":3,"names":["component","name","ccm","config","apps","comment","css","url","context","components","configs","dark","icon","helper","html","libs","picture","quill","options","theme","selectize","create","create_on_blur","plugins","shadow","text","user","Instance","$","data","element","tmp","this","init","async","Object","assign","use","lang","ready","logger","log","privatize","window","addEventListener","refresh","classList","add","observe","setContent","params","location","reload","start","Promise","all","get","deleted","forEach","translate","arr","title","creator","tags","tool","ratings","filter","dataset","push","tools","meta","arrToObj","key","values","rating","reduce","a","b","length","app","obj","getValue","listed","_","tag","keys","share","render","main","querySelector","root","clone","events","onRegister","view","onRegisterSubmit","store","username","password","formData","set","realm","token","hash","md5","access","del","alert","e","onLogin","login","onLogout","logout","onHome","onList","section","onSearch","sort","value","querySelectorAll","input","id","split","pop","cards","onItem","meta_key","onEdit","type","edit","onEditSubmit","form","visibility","agree","content","software","copyright","prop","description","getHTML","includes","onDelete","onRating","user_key","toString","priodata","onStart","template","editor","show","onCreate","tool_key","onCreateSubmit","tool_meta","getUsername","app_key","generateKey","ignore","source","deepValue","created_at","updated_at","Date","now","onSave","onPreview","preview","active","home","list","item","register","header","replace","cloneNode","comments_key","instance","concat","JSON","parse","Set","items","setHTML","radio","checked","click","solveDependency","editors","comp","then","editor_comp","parent","editor_inst","path","src","app_meta","handover","version","join","files","c","match","document","createElement","head","appendChild","integrity","setAttribute","crossorigin","onload","removeChild"],"sources":["ccm.dms.js"],"mappings":"AAYA,MACE,MAAMA,UAAY,CAChBC,KAAM,MACNC,I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AAM,GAAG3J,OAAOzC,KAAK,OAAOyC,OAAOzC,IAAIqM,MAAM1H,GAAG,OAAOlC,OAAOzC,IAAIqM,MAAM1H,GAAG7E,WAAW6E,EAAElC,OAAOzC,KAAKyC,OAAOzC,IAAIO,WAAWT,UAAUC,QAAQ4E,EAAE3E,MAAMF,UAAUE,IAAI2E,EAAE3E,KAAK,kBAAkBF,UAAUE,MAAMF,UAAUE,IAAI,CAACK,IAAIP,UAAUE,MAAM,IAAIsM,GAAGxM,UAAUE,IAAIK,IAAIkM,MAAM,6CAA6C,CAAC,KAAK,GAAG,GAAG9J,OAAOzC,KAAKyC,OAAOzC,IAAIsM,GAAG7J,OAAOzC,IAAIsM,GAAGxM,UAAUA,eAAe,CAAC,IAAI4E,EAAE8H,SAASC,cAAc,UAAUD,SAASE,KAAKC,YAAYjI,GAAG5E,UAAUE,IAAI4M,WAAWlI,EAAEmI,aAAa,YAAY/M,UAAUE,IAAI4M,WAAW9M,UAAUE,IAAI8M,aAAapI,EAAEmI,aAAa,cAAc/M,UAAUE,IAAI8M,aAAapI,EAAEqI,OAAO,YAAYT,EAAE,SAAS7J,OAAOzC,IAAIyC,OAAOzC,IAAIsM,IAAIxM,UAAUA,WAAW0M,SAASE,KAAKM,YAAYtI,EAAE,EAAEA,EAAEsH,IAAIlM,UAAUE,IAAIK,GAAG,CACn0B,EAvmBF"} \ No newline at end of file diff --git a/index.html b/index.html index 1cb9c81..c59847e 100644 --- a/index.html +++ b/index.html @@ -6,5 +6,5 @@ Digital Makerspace - - \ No newline at end of file + + \ No newline at end of file diff --git a/versions/ccm.dms-5.2.0.js b/versions/ccm.dms-5.2.0.js new file mode 100644 index 0000000..2742228 --- /dev/null +++ b/versions/ccm.dms-5.2.0.js @@ -0,0 +1,629 @@ +/** + * @overview ccmjs-based web component for a digital makerspace + * @author André Kless 2018-2022, 2024 + * @license The MIT License (MIT) + * @version 5.2.0 + * @changes + * version 5.2.0 (24.04.2024): multilingualism for user content + * version 5.1.0 (17.04.2024): added register form + * version 5.0.0 (03.03.2022): reimplementation + * (for older version changes see ccm.dms-4.5.0.js) + */ + +( () => { + const component = { + name: 'dms', + version: [ 5, 2, 0 ], + ccm: 'https://ccmjs.github.io/ccm/versions/ccm-27.3.1.min.js', + config: { + "apps": [ "ccm.store" ], + "comment": [ "ccm.component", "https://ccmjs.github.io/tkless-components/comment/versions/ccm.comment-7.2.0.min.js" ], + "css": [ "ccm.load", + [ + "https://ccmjs.github.io/digital-makerspace/libs/bootstrap-5/css/bootstrap.min.css", + "https://ccmjs.github.io/digital-makerspace/resources/styles.min.css" + ], + "https://ccmjs.github.io/digital-makerspace/libs/bootstrap-5/css/bootstrap-icons.min.css", + { "url": "https://ccmjs.github.io/digital-makerspace/libs/bootstrap-5/css/bootstrap-fonts.min.css", "context": "head" } + ], + "components": [ "ccm.store" ], + "configs": [ "ccm.store" ], + "dark": false, + "icon": "https://ccmjs.github.io/digital-makerspace/resources/img/icon.png", +// "handover": [ "ccm.component", "https://ccmjs.github.io/akless-components/handover_app/versions/ccm.handover_app-3.0.0.min.js" ], + "helper": [ "ccm.load", "https://ccmjs.github.io/digital-makerspace/libs/ccm/helper.mjs" ], + "html": [ "ccm.load", "https://ccmjs.github.io/digital-makerspace/resources/templates.mjs" ], +// "lang": [ "ccm.start", "https://ccmjs.github.io/akless-components/lang/versions/ccm.lang-1.1.0.min.js" ], + "libs": [ "ccm.load", "https://ccmjs.github.io/digital-makerspace/libs/bootstrap-5/js/bootstrap.bundle.min.js" ], +// "logger": [ "ccm.instance", "https://ccmjs.github.io/akless-components/log/versions/ccm.log-5.0.1.min.js", [ "ccm.get", "https://ccmjs.github.io/akless-components/log/resources/configs.min.js", "greedy" ] ], + "picture": "https://ccmjs.github.io/akless-components/user/resources/icon.svg", + "quill": [ "ccm.component", "https://ccmjs.github.io/akless-components/quill/versions/ccm.quill-2.0.0.min.js", { + "options": { + "theme": "snow" + } + } ], + "selectize": [ "ccm.component", "https://ccmjs.github.io/akless-components/selectize/versions/ccm.selectize-1.0.0.min.js", { + "create": true, + "create_on_blur": true, + "plugins": [ "remove_button" ] + } ], + "shadow": "none", + "text": [ "ccm.load", "https://ccmjs.github.io/digital-makerspace/resources/resources.mjs#en" ], + "url": "https://ccmjs.github.io/digital-makerspace/app.html", + "user": [ "ccm.instance", "https://ccmjs.github.io/akless-components/user/versions/ccm.user-9.7.2.min.js" ] + }, + Instance: function () { + + /** + * shortcut to help functions + * @type {Object.} + */ + let $; + + /** + * app state data + * @type {Object} + */ + let data; + + /** + * main HTML element + * @type {Element} + */ + let element; + + /** + * for the temporary storage of instance references + * @type {Object} + */ + const tmp = {}; + + /** + * when the instance is created, when all dependencies have been resolved and before the dependent sub-instances are initialized and ready + * @returns {Promise} + */ + this.init = async () => { + $ = Object.assign( {}, this.ccm.helper, this.helper ); $.use( this.ccm ); // set shortcut to help functions + if ( this.lang ) this.lang.dark = this.dark; // pass setting for dark mode to multilingualism + }; + + /** + * when all dependencies are solved after creation and before the app starts + * @returns {Promise} + */ + this.ready = async () => { + + this.logger && this.logger.log( 'ready', $.privatize( this, true ) ); // logging of 'ready' event + window.addEventListener( 'popstate', this.refresh ); // check route on 'popstate' event + + // setup dark mode + this.dark === 'auto' && this.element.classList.add( 'dark_auto' ); + this.dark === true && this.element.classList.add( 'dark_mode' ); + + // listen to language change event => reload page with new language + this.lang && this.lang.observe( lang => { + $.setContent( this.element, '' ); + $.params( { lang } ); + location.reload(); + } ); + }; + + /** + * starts the app + * @returns {Promise} + */ + this.start = async () => { + + $.setContent( this.element, '' ); + + // logging of 'start' event + this.logger && this.logger.log( 'start' ); + + // load metadata of all components and apps + data = await Promise.all( [ + this.components.get( { deleted: false } ), + this.apps.get( { deleted: false } ) + ] ); + if (this.lang) { + data[0].forEach(component => this.lang.translate(component)); + } + data = { + components: { + arr: data[ 0 ], + options: { + title: {}, + creator: {}, + tags: {} + } + }, + apps: { + arr: data[ 1 ], + options: { + title: {}, + tool: {}, + creator: {}, + tags: {} + } + } + }; + + /** + * ratings data for components/tools and apps + * @type {{components: Object[], apps: Object[]}} + */ + const ratings = { components: [], apps: [] }; + + // filter user ratings for components/tools and apps + data.components.arr = data.components.arr.filter( dataset => dataset.ratings ? !ratings.components.push( dataset ) : dataset.ratings = { components: {}, tools: {} } ); + data.apps.arr = data.apps.arr.filter( dataset => dataset.ratings ? !ratings.apps.push( dataset ) : dataset.ratings = {} ); + + // convert meta data of components and apps to associative array + data.components.meta = $.arrToObj( data.components.arr ); + data.apps.meta = $.arrToObj( data.apps.arr ); + + // integrate user ratings in metadata of components/tools + ratings.components.forEach( user => { + for ( const key in user.ratings ) + if ( data.components.meta[ key ] ) + data.components.meta[ key ].ratings.components[ user.user ] = user.ratings[ key ]; + for ( const key in user.tools ) + if ( data.components.meta[ key ] ) + data.components.meta[ key ].ratings.tools[ user.user ] = user.tools[ key ]; + } ); + + // integrate user ratings in meta data of apps + ratings.apps.forEach( user => { + for ( const key in user.ratings ) + if ( data.apps.meta[ key ] ) + data.apps.meta[ key ].ratings[ user.user ] = user.ratings[ key ]; + } ); + + // calculate average of ratings for all components + data.components.arr.forEach( component => { + const ratings = Object.values( component.ratings.components ); + const tools = Object.values( component.ratings.tools ); + component.rating = { + component: ( ratings.reduce( ( a, b ) => a + b, 0 ) / ratings.length ) || 0, + tool: ( tools.reduce( ( a, b ) => a + b, 0 ) / tools.length ) || 0 + }; + } ); + + // iterate over all apps metadata + data.apps.arr.forEach( app => { + + // calculate average of ratings for all apps + const ratings = Object.values( app.ratings ); + app.rating = ratings.reduce( ( a, b ) => a + b, 0 ) / ratings.length; + + // add title of corresponding tool + app.tool = ( data.components.meta[ app.component ] || {} ).title; + + } ); + + /** @function sets a value as key in an object if key not exists */ + const add = ( obj, key ) => !obj[ key ] && ( obj[ key ] = true ); + + /** + * user data of the logged-in user + * @type {Object} + */ + const user = this.user.getValue(); + + // collect options for tool searches and eliminate duplicates + data.components.arr.forEach( component => { + component.apps = 0; // counter for published apps that are already created with this component + if ( !component.listed && ( !user || user.key !== component._.creator ) ) return; + add( data.components.options.title, component.title ); + add( data.components.options.creator, component.creator ); + component.tags.forEach( tag => add( data.components.options.tags, tag ) ); + } ); + + // collect options for app searches and eliminate duplicates + data.apps.arr.forEach( app => { + if ( !app.listed && ( !user || user.key !== app._.creator ) ) return; + const component = data.components.meta[ app.component ]; + component && component.apps++; // increase app counter for corresponding component + add( data.apps.options.title, app.title ); + component && add( data.apps.options.tool, component.title ); + add( data.apps.options.creator, app.creator ); + app.tags.forEach( tag => add( data.apps.options.tags, tag ) ); + } ); + for ( const key in data.components.options ) data.components.options[ key ] = Object.keys( data.components.options[ key ] ); + for ( const key in data.apps.options ) data.apps.options[ key ] = Object.keys( data.apps.options[ key ] ); + + // share instance and app state data with HTML templates + this.html.share( this, data ); + + // render route specific content + this.html.render( this.html.main(), this.element ); + element = this.element.querySelector( 'main' ); + await this.refresh(); + + // render language selection + this.lang && $.setContent( this.element.querySelector( '#lang' ), this.lang.root ); + + }; + + /** + * returns current app state data + * @returns {Object} + */ + this.getValue = () => $.clone( data ); + + /** + * contains all event handlers + * @type {Object.} + */ + this.events = { + onRegister: async () => { + $.params( { view: 'register' }, true, true ); + await this.refresh(); + }, + onRegisterSubmit: async () => { + const store = await this.ccm.store( { url: 'https://ccm2.inf.h-brs.de', name: 'dms-user' } ); + const { name, username, password } = $.formData( element.querySelector( '#register_form' ) ); + try { + await store.set( { + key: username, + user: username, + name, + realm: 'cloud', + token: this.user.hash.md5( password ), + _: { + creator: username, + realm: 'cloud', + access: { + get: 'creator', + set: 'creator', + del: 'creator' + } + }, + } ); + alert(this.lang.translate('register_success')); + $.params( { view: 'home' }, true, true ); + await this.refresh(); + } catch (e) { + alert(this.lang.translate('register_failed')); + } + }, + onLogin: async () => { + await this.user.login(); + await this.start(); + }, + onLogout: async () => { + await this.user.logout(); + await this.start(); + }, + onHome: async () => { + $.params( { view: 'home' }, true, true ); + await this.refresh(); + }, + onList: async ( section, values = {} ) => { + $.params( Object.assign( { view: section }, values ), true, true ); + await this.refresh(); + }, + onSearch: section => { + const values = { sort: element.querySelector( '#section-sort' ).value }; + element.querySelectorAll( 'input[type="search"]' ).forEach( input => values[ input.id.split( '-' ).pop() ] = input.value ); + $.params( values ); + this.render.cards( section, values ); + }, + onItem: async ( section, meta_key ) => { + $.params( { view: section, id: meta_key }, true, true ); + await this.refresh(); + }, + onEdit: async ( type, meta_key ) => { + $.params( { edit: type, id: meta_key }, true, true ); + await this.refresh(); + }, + onEditSubmit: async ( type, meta_key ) => { + await this.user.login(); + const form = $.formData( element.querySelector( 'form' ) ); + if ( !form.title || !form.visibility ) return; + if ( form.visibility === 'private' ) + form.agree = { content: false, software: false, copyright: false }; + else if ( type === 'app' && !form.agree.content || !form.agree.software || !form.agree.copyright ) + return; + if ( type !== 'app' ) + delete form.agree.content; + const prop = type !== 'app' ? 'components' : 'apps'; + const meta = data[ prop ].meta[ meta_key ]; + form.key = meta.key; + form.tags = meta.selectize.getValue(); + form.description = meta.quill.getHTML(); + form.listed = form.visibility === 'public'; + form[ '_.access.get' ] = form.visibility === 'private' ? 'creator' : 'all'; + delete form.visibility; + + await Promise.all( [ + await this[ prop ].set( form ), + type === 'app' && await this.configs.set( { + key: meta_key, + '_.access.get': form.visibility === 'private' ? 'creator' : 'all' + } ) + ] ); + $.assign( meta, form ); + + const set = ( key, value = form[ key ] ) => !data[ prop ].options[ key ].includes( value ) && data[ prop ].options[ key ].push( value ); + set( 'title' ); + set( 'creator' ); + form.tags.forEach( tag => set( 'tags', tag ) ); + + await this.events.onItem( type, meta_key ); + }, + onDelete: async ( type, meta_key ) => { + const prop = type !== 'app' ? 'components' : 'apps'; + await this[ prop ].set( { key: meta_key, deleted: true } ); + delete data[ prop ].meta[ meta_key ]; + data[ prop ].arr = data[ prop ].arr.filter( meta => meta.key !== meta_key ); + this.events.onList( type + 's' ); + }, + onRating: async ( type, meta_key, rating ) => { + const user_key = ( await this.user.login() ).key; + const prop = type === 'app' ? 'apps' : 'components'; + const meta = data[ prop ].meta[ meta_key.toString() ]; + if ( user_key === meta._.creator ) return this.refresh(); + const priodata = { key: '_' + user_key } + priodata[ ( type === 'tool' ? 'tools' : 'ratings' ) + '.' + meta.key.toString() ] = rating; + let ratings = type === 'app' ? meta.ratings : meta.ratings[ type + 's' ]; + if ( rating === ratings[ user_key ] ) rating = 0; + ratings[ user_key ] = rating; + ratings = Object.values( ratings ); + rating = ( ratings.reduce( ( a, b ) => a + b, 0 ) / ratings.length ) || 0; + if ( type === 'app' ) + meta.rating = rating; + else + meta.rating[ type ] = rating; + this.render.rating( type, meta.key ); + const store = this[ prop ]; + if ( await store.get( priodata.key ) ) + await store.set( priodata ); + else + await store.set( { + "key": priodata.key, + "user": user_key, + "tools": {}, + "ratings": {}, + "_": { + "creator": user_key, + "realm": "cloud", + "access": { + "get": "all", + "set": "creator", + "del": "creator" + } + } + } ); + }, + onStart: async ( type, meta_key, template ) => { + switch ( type ) { + case 'tool': + if ( template === true ) return this.render.editor( meta_key, template ); + $.params( { editor: meta_key, template: template }, true, true ); + break; + case 'app': + $.params( { show: meta_key }, true, true ); + break; + } + await this.refresh(); + }, + onCreate: async tool_key => this.render.create( tool_key ), + onCreateSubmit: async tool_key => { + await this.user.login(); + const form = $.formData( element.querySelector( 'form' ) ); + if ( !form.title || !form.visibility ) return; + if ( form.visibility === 'private' ) + form.agree = { content: false, software: false, copyright: false }; + else if ( !form.agree.content || !form.agree.software || !form.agree.copyright ) + return; + + const tool_meta = data.components.meta[ tool_key ]; + form.creator = this.user.getUsername(); + form.icon = tool_meta.icon; + form.tags = tmp.selectize.getValue(); + form.description = tmp.quill.getHTML(); + form.listed = form.visibility === 'public'; + form.deleted = false; + + const config = tmp.editor.getValue(); + const app_key = $.generateKey(); + form.key = config.key = [ tool_key, app_key ]; + form.component = config.component = tool_key; + form.app = config.app = app_key; + form.ignore = { config: [ 'ccm.get', this.configs.source(), form.key ] }; + $.deepValue( config, 'ignore.meta', [ 'ccm.get', this.apps.source(), form.key ] ); + form._ = config._ = { + creator: this.user.getValue().key, + realm: 'cloud', + access: { + get: form.visibility === 'private' ? 'creator' : 'all', + set: 'creator', + del: 'creator' + } + }; + delete form.visibility; + tool_meta.apps++; + + await Promise.all( [ this.apps.set( form ), this.configs.set( config ) ] ); + form.ratings = {}; + form.tool = tool_meta.title; + form.created_at = form.updated_at = Date.now(); + data.apps.arr.push( form ); + data.apps.meta[ form.key.toString() ] = form; + + const set = ( key, value = form[ key ] ) => !data.apps.options[ key ].includes( value ) && data.apps.options[ key ].push( value ); + set( 'title' ); + set( 'creator' ); + form.tags.forEach( tag => set( 'tags', tag ) ); + + await this.events.onItem( 'app', form.key ); + }, + onSave: async app_key => { + await this.user.login(); + const config = tmp.editor.getValue(); + config.key = app_key; + await this.configs.set( config ); + this.events.onStart( 'app', app_key ); + }, + onPreview: tool_key => this.render.preview( tool_key ) + }; + + /** renders route specific content */ + this.refresh = () => { + const params = $.params(); + const lang = this.lang && this.lang.active; + if ( this.lang ) $.params( { lang: lang } ); + switch ( params.view ) { + case 'home': + return this.render.home(); + case 'tools': + case 'apps': + case 'components': + return this.render.list( params.view, params ); + case 'tool': + case 'app': + case 'component': + return this.render.item( params.view, params.id ); + case 'register': + return this.render.register(); + } + if ( params.edit ) return this.render.edit( params.edit, params.id ); + if ( params.editor ) return this.render.editor( params.editor, params.template ); + if ( params.show ) return this.render.show( params.show ); + this.render.home(); + }; + + /** + * contains all render functions + * @type {Object.} + */ + this.render = { + header: active => this.html.render( this.html.header( active ), this.element.querySelector( 'header' ) ), + home: () => { + this.render.header(); + this.html.render( this.html.home(), element ); + this.lang && this.lang.translate(); + }, + list: ( section, values ) => { + this.render.header( section === 'components' ? 'developer' : section ); + $.replace( element, element = element.cloneNode() ); // resets lit-html template + this.html.render( this.html.list( section, values ), element ); + this.lang && this.lang.translate(); + }, + cards: ( section, values ) => { + this.html.render( this.html.cards( section, values ), element.querySelector( '#search_results' ) ); + this.lang && this.lang.translate(); + }, + item: async ( section, meta_key ) => { + this.render.header( section === 'component' ? 'developer' : section + 's' ); + this.html.render( this.html.item( section, meta_key ), element ); + this.lang && this.lang.translate(); + const meta = data[ section === 'app' ? 'apps' : 'components' ].meta[ meta_key ]; + if ( !this.comment || !meta ) return; + const comments_key = section + '_comments'; + if ( !meta[ comments_key ] ) + meta[ comments_key ] = await this.comment.instance( { + dark: this.dark, + 'data.key': [].concat( section, meta_key.split( ',' ) ), + user: [ 'ccm.instance', this.user.component.url, JSON.parse( this.user.config ) ] + } ); + $.setContent( this.element.querySelector( '#comments' ), meta[ comments_key ].root ); + await meta[ comments_key ].start(); + }, + rating: ( section, meta_key ) => { + this.html.render( this.html.rating( section, meta_key ), element.querySelector( '#rating article' ) ); + this.lang && this.lang.translate(); + }, + edit: async ( type, meta_key ) => { + const meta = data[ type !== 'app' ? 'components' : 'apps' ].meta[ meta_key ]; + this.render.header( type === 'component' ? 'developer' : type + 's' ); + this.html.render( this.html.edit( type, meta.key ), element ); + if ( !meta.selectize ) { + meta.selectize = await this.selectize.start( { + options: [ ...new Set( [ ...data.apps.options.tags, ...( meta.tags || [] ) ] ) ], + items: meta.tags || [] + } ); + } + if ( !meta.quill ) { + meta.quill = await this.quill.start(); + meta.description && meta.quill.setHTML( meta.description ); + } + $.setContent( this.element.querySelector( '#form-tags' ), meta.selectize.root ); + $.setContent( this.element.querySelector( '#form-description' ), meta.quill.root ); + const radio = element.querySelector( '#form-visibility-private' ); + radio.checked && radio.click(); + this.lang && this.lang.translate(); + }, + editor: ( tool_key, app_key ) => { + this.render.header( 'tools' ); + const tool_meta = data.components.meta[ tool_key ]; + this.html.render( this.html.editor( tool_key, app_key === true ? tmp.app_key : app_key ), element ); + this.lang && this.lang.translate(); + if ( app_key === true ) + return $.setContent( this.element.querySelector( '#editor' ), tmp.editor.root ); + const config = app_key && data.apps.meta[ app_key ].ignore.config; + Promise.all( [ + $.solveDependency( tool_meta.ignore.editors[ 0 ].app || tool_meta.ignore.editors[ 0 ].comp || tool_meta.ignore.editors[ 0 ], this ), + $.solveDependency( config, this ) + ] ).then( ( [ editor_comp, config = {} ] ) => { + if ( config.data && config.data.store && config.data.key && data.apps.meta[ app_key ]._.creator !== ( this.user.getValue() || {} ).key ) + delete config.data.key; + delete config.key; delete config.component; delete config.app; delete config.ignore?.meta; delete config.created_at; delete config.updated_at; delete config._; + editor_comp.start( { + dark: this.dark, + data: { store: [ 'ccm.store', { app: config } ], key: 'app' }, + parent: this, + root: this.element.querySelector( '#editor' ) + } ).then( editor_inst => { + tmp.editor = editor_inst; + tmp.app_key = app_key; + } ) + } ); + }, + create: async tool_key => { + this.render.header( 'tools' ); + this.html.render( this.html.create( tool_key ), element ); + tmp.selectize = await this.selectize.start( { + root: this.element.querySelector( '#form-tags' ), + options: data.apps.options.tags + } ); + tmp.quill = await this.quill.start( { + root: this.element.querySelector( '#form-description' ) + } ); + const radio = element.querySelector( '#form-visibility-private' ); + radio.click(); + radio.checked = false; + this.lang && this.lang.translate(); + }, + preview: tool_key => { + this.render.header( 'tools' ); + const tool_meta = data.components.meta[ tool_key ]; + this.html.render( this.html.preview( tool_key ), element ); + this.ccm.start( tool_meta.path, { parent: this, root: this.element.querySelector( '#preview' ), src: tmp.editor.getValue() } ); + this.lang && this.lang.translate(); + }, + show: async app_key => { + this.render.header( 'apps' ); + const app_meta = data.apps.meta[ app_key ]; + const tool_meta = data.components.meta[ app_meta.component ]; + this.html.render( this.html.show( app_key ), element ); + this.lang && this.lang.translate(); + await this.ccm.start( tool_meta.path, { src: app_meta.ignore.config, parent: this, root: this.element.querySelector( '#app' ) } ); + await this.handover.start( { + root: this.element.querySelector( '#handover' ), + 'ignore.config': app_meta.ignore.config, + tool: tool_meta.path, + url: ( component, config ) => this.url + '?app=' + config[ 2 ].toString() + } ); + }, + register: async () => { + this.render.header(); + this.html.render( this.html.register(), element ); + this.lang && this.lang.translate(); + } + }; + + } + }; + let b="ccm."+component.name+(component.version?"-"+component.version.join("."):"")+".js";if(window.ccm&&null===window.ccm.files[b])return window.ccm.files[b]=component;(b=window.ccm&&window.ccm.components[component.name])&&b.ccm&&(component.ccm=b.ccm);"string"===typeof component.ccm&&(component.ccm={url:component.ccm});let c=(component.ccm.url.match(/(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)/)||[""])[0];if(window.ccm&&window.ccm[c])window.ccm[c].component(component);else{var a=document.createElement("script");document.head.appendChild(a);component.ccm.integrity&&a.setAttribute("integrity",component.ccm.integrity);component.ccm.crossorigin&&a.setAttribute("crossorigin",component.ccm.crossorigin);a.onload=function(){(c="latest"?window.ccm:window.ccm[c]).component(component);document.head.removeChild(a)};a.src=component.ccm.url} +} )(); \ No newline at end of file diff --git a/versions/ccm.dms-5.2.0.min.js b/versions/ccm.dms-5.2.0.min.js new file mode 100644 index 0000000..b348a6f --- /dev/null +++ b/versions/ccm.dms-5.2.0.min.js @@ -0,0 +1,2 @@ +(()=>{const component={name:"dms",version:[5,2,0],ccm:"https://ccmjs.github.io/ccm/versions/ccm-27.3.1.min.js",config:{apps:["ccm.store"],comment:["ccm.component","https://ccmjs.github.io/tkless-components/comment/versions/ccm.comment-7.2.0.min.js"],css:["ccm.load",["https://ccmjs.github.io/digital-makerspace/libs/bootstrap-5/css/bootstrap.min.css","https://ccmjs.github.io/digital-makerspace/resources/styles.min.css"],"https://ccmjs.github.io/digital-makerspace/libs/bootstrap-5/css/bootstrap-icons.min.css",{url:"https://ccmjs.github.io/digital-makerspace/libs/bootstrap-5/css/bootstrap-fonts.min.css",context:"head"}],components:["ccm.store"],configs:["ccm.store"],dark:false,icon:"https://ccmjs.github.io/digital-makerspace/resources/img/icon.png",helper:["ccm.load","https://ccmjs.github.io/digital-makerspace/libs/ccm/helper.mjs"],html:["ccm.load","https://ccmjs.github.io/digital-makerspace/resources/templates.mjs"],libs:["ccm.load","https://ccmjs.github.io/digital-makerspace/libs/bootstrap-5/js/bootstrap.bundle.min.js"],picture:"https://ccmjs.github.io/akless-components/user/resources/icon.svg",quill:["ccm.component","https://ccmjs.github.io/akless-components/quill/versions/ccm.quill-2.0.0.min.js",{options:{theme:"snow"}}],selectize:["ccm.component","https://ccmjs.github.io/akless-components/selectize/versions/ccm.selectize-1.0.0.min.js",{create:true,create_on_blur:true,plugins:["remove_button"]}],shadow:"none",text:["ccm.load","https://ccmjs.github.io/digital-makerspace/resources/resources.mjs#en"],url:"https://ccmjs.github.io/digital-makerspace/app.html",user:["ccm.instance","https://ccmjs.github.io/akless-components/user/versions/ccm.user-9.7.2.min.js"]},Instance:function(){let $;let data;let element;const tmp={};this.init=async()=>{$=Object.assign({},this.ccm.helper,this.helper);$.use(this.ccm);if(this.lang)this.lang.dark=this.dark};this.ready=async()=>{this.logger&&this.logger.log("ready",$.privatize(this,true));window.addEventListener("popstate",this.refresh);this.dark==="auto"&&this.element.classList.add("dark_auto");this.dark===true&&this.element.classList.add("dark_mode");this.lang&&this.lang.observe((lang=>{$.setContent(this.element,"");$.params({lang:lang});location.reload()}))};this.start=async()=>{$.setContent(this.element,"");this.logger&&this.logger.log("start");data=await Promise.all([this.components.get({deleted:false}),this.apps.get({deleted:false})]);if(this.lang){data[0].forEach((component=>this.lang.translate(component)))}data={components:{arr:data[0],options:{title:{},creator:{},tags:{}}},apps:{arr:data[1],options:{title:{},tool:{},creator:{},tags:{}}}};const ratings={components:[],apps:[]};data.components.arr=data.components.arr.filter((dataset=>dataset.ratings?!ratings.components.push(dataset):dataset.ratings={components:{},tools:{}}));data.apps.arr=data.apps.arr.filter((dataset=>dataset.ratings?!ratings.apps.push(dataset):dataset.ratings={}));data.components.meta=$.arrToObj(data.components.arr);data.apps.meta=$.arrToObj(data.apps.arr);ratings.components.forEach((user=>{for(const key in user.ratings)if(data.components.meta[key])data.components.meta[key].ratings.components[user.user]=user.ratings[key];for(const key in user.tools)if(data.components.meta[key])data.components.meta[key].ratings.tools[user.user]=user.tools[key]}));ratings.apps.forEach((user=>{for(const key in user.ratings)if(data.apps.meta[key])data.apps.meta[key].ratings[user.user]=user.ratings[key]}));data.components.arr.forEach((component=>{const ratings=Object.values(component.ratings.components);const tools=Object.values(component.ratings.tools);component.rating={component:ratings.reduce(((a,b)=>a+b),0)/ratings.length||0,tool:tools.reduce(((a,b)=>a+b),0)/tools.length||0}}));data.apps.arr.forEach((app=>{const ratings=Object.values(app.ratings);app.rating=ratings.reduce(((a,b)=>a+b),0)/ratings.length;app.tool=(data.components.meta[app.component]||{}).title}));const add=(obj,key)=>!obj[key]&&(obj[key]=true);const user=this.user.getValue();data.components.arr.forEach((component=>{component.apps=0;if(!component.listed&&(!user||user.key!==component._.creator))return;add(data.components.options.title,component.title);add(data.components.options.creator,component.creator);component.tags.forEach((tag=>add(data.components.options.tags,tag)))}));data.apps.arr.forEach((app=>{if(!app.listed&&(!user||user.key!==app._.creator))return;const component=data.components.meta[app.component];component&&component.apps++;add(data.apps.options.title,app.title);component&&add(data.apps.options.tool,component.title);add(data.apps.options.creator,app.creator);app.tags.forEach((tag=>add(data.apps.options.tags,tag)))}));for(const key in data.components.options)data.components.options[key]=Object.keys(data.components.options[key]);for(const key in data.apps.options)data.apps.options[key]=Object.keys(data.apps.options[key]);this.html.share(this,data);this.html.render(this.html.main(),this.element);element=this.element.querySelector("main");await this.refresh();this.lang&&$.setContent(this.element.querySelector("#lang"),this.lang.root)};this.getValue=()=>$.clone(data);this.events={onRegister:async()=>{$.params({view:"register"},true,true);await this.refresh()},onRegisterSubmit:async()=>{const store=await this.ccm.store({url:"https://ccm2.inf.h-brs.de",name:"dms-user"});const{name:name,username:username,password:password}=$.formData(element.querySelector("#register_form"));try{await store.set({key:username,user:username,name:name,realm:"cloud",token:this.user.hash.md5(password),_:{creator:username,realm:"cloud",access:{get:"creator",set:"creator",del:"creator"}}});alert(this.lang.translate("register_success"));$.params({view:"home"},true,true);await this.refresh()}catch(e){alert(this.lang.translate("register_failed"))}},onLogin:async()=>{await this.user.login();await this.start()},onLogout:async()=>{await this.user.logout();await this.start()},onHome:async()=>{$.params({view:"home"},true,true);await this.refresh()},onList:async(section,values={})=>{$.params(Object.assign({view:section},values),true,true);await this.refresh()},onSearch:section=>{const values={sort:element.querySelector("#section-sort").value};element.querySelectorAll('input[type="search"]').forEach((input=>values[input.id.split("-").pop()]=input.value));$.params(values);this.render.cards(section,values)},onItem:async(section,meta_key)=>{$.params({view:section,id:meta_key},true,true);await this.refresh()},onEdit:async(type,meta_key)=>{$.params({edit:type,id:meta_key},true,true);await this.refresh()},onEditSubmit:async(type,meta_key)=>{await this.user.login();const form=$.formData(element.querySelector("form"));if(!form.title||!form.visibility)return;if(form.visibility==="private")form.agree={content:false,software:false,copyright:false};else if(type==="app"&&!form.agree.content||!form.agree.software||!form.agree.copyright)return;if(type!=="app")delete form.agree.content;const prop=type!=="app"?"components":"apps";const meta=data[prop].meta[meta_key];form.key=meta.key;form.tags=meta.selectize.getValue();form.description=meta.quill.getHTML();form.listed=form.visibility==="public";form["_.access.get"]=form.visibility==="private"?"creator":"all";delete form.visibility;await Promise.all([await this[prop].set(form),type==="app"&&await this.configs.set({key:meta_key,"_.access.get":form.visibility==="private"?"creator":"all"})]);$.assign(meta,form);const set=(key,value=form[key])=>!data[prop].options[key].includes(value)&&data[prop].options[key].push(value);set("title");set("creator");form.tags.forEach((tag=>set("tags",tag)));await this.events.onItem(type,meta_key)},onDelete:async(type,meta_key)=>{const prop=type!=="app"?"components":"apps";await this[prop].set({key:meta_key,deleted:true});delete data[prop].meta[meta_key];data[prop].arr=data[prop].arr.filter((meta=>meta.key!==meta_key));this.events.onList(type+"s")},onRating:async(type,meta_key,rating)=>{const user_key=(await this.user.login()).key;const prop=type==="app"?"apps":"components";const meta=data[prop].meta[meta_key.toString()];if(user_key===meta._.creator)return this.refresh();const priodata={key:"_"+user_key};priodata[(type==="tool"?"tools":"ratings")+"."+meta.key.toString()]=rating;let ratings=type==="app"?meta.ratings:meta.ratings[type+"s"];if(rating===ratings[user_key])rating=0;ratings[user_key]=rating;ratings=Object.values(ratings);rating=ratings.reduce(((a,b)=>a+b),0)/ratings.length||0;if(type==="app")meta.rating=rating;else meta.rating[type]=rating;this.render.rating(type,meta.key);const store=this[prop];if(await store.get(priodata.key))await store.set(priodata);else await store.set({key:priodata.key,user:user_key,tools:{},ratings:{},_:{creator:user_key,realm:"cloud",access:{get:"all",set:"creator",del:"creator"}}})},onStart:async(type,meta_key,template)=>{switch(type){case"tool":if(template===true)return this.render.editor(meta_key,template);$.params({editor:meta_key,template:template},true,true);break;case"app":$.params({show:meta_key},true,true);break}await this.refresh()},onCreate:async tool_key=>this.render.create(tool_key),onCreateSubmit:async tool_key=>{await this.user.login();const form=$.formData(element.querySelector("form"));if(!form.title||!form.visibility)return;if(form.visibility==="private")form.agree={content:false,software:false,copyright:false};else if(!form.agree.content||!form.agree.software||!form.agree.copyright)return;const tool_meta=data.components.meta[tool_key];form.creator=this.user.getUsername();form.icon=tool_meta.icon;form.tags=tmp.selectize.getValue();form.description=tmp.quill.getHTML();form.listed=form.visibility==="public";form.deleted=false;const config=tmp.editor.getValue();const app_key=$.generateKey();form.key=config.key=[tool_key,app_key];form.component=config.component=tool_key;form.app=config.app=app_key;form.ignore={config:["ccm.get",this.configs.source(),form.key]};$.deepValue(config,"ignore.meta",["ccm.get",this.apps.source(),form.key]);form._=config._={creator:this.user.getValue().key,realm:"cloud",access:{get:form.visibility==="private"?"creator":"all",set:"creator",del:"creator"}};delete form.visibility;tool_meta.apps++;await Promise.all([this.apps.set(form),this.configs.set(config)]);form.ratings={};form.tool=tool_meta.title;form.created_at=form.updated_at=Date.now();data.apps.arr.push(form);data.apps.meta[form.key.toString()]=form;const set=(key,value=form[key])=>!data.apps.options[key].includes(value)&&data.apps.options[key].push(value);set("title");set("creator");form.tags.forEach((tag=>set("tags",tag)));await this.events.onItem("app",form.key)},onSave:async app_key=>{await this.user.login();const config=tmp.editor.getValue();config.key=app_key;await this.configs.set(config);this.events.onStart("app",app_key)},onPreview:tool_key=>this.render.preview(tool_key)};this.refresh=()=>{const params=$.params();const lang=this.lang&&this.lang.active;if(this.lang)$.params({lang:lang});switch(params.view){case"home":return this.render.home();case"tools":case"apps":case"components":return this.render.list(params.view,params);case"tool":case"app":case"component":return this.render.item(params.view,params.id);case"register":return this.render.register()}if(params.edit)return this.render.edit(params.edit,params.id);if(params.editor)return this.render.editor(params.editor,params.template);if(params.show)return this.render.show(params.show);this.render.home()};this.render={header:active=>this.html.render(this.html.header(active),this.element.querySelector("header")),home:()=>{this.render.header();this.html.render(this.html.home(),element);this.lang&&this.lang.translate()},list:(section,values)=>{this.render.header(section==="components"?"developer":section);$.replace(element,element=element.cloneNode());this.html.render(this.html.list(section,values),element);this.lang&&this.lang.translate()},cards:(section,values)=>{this.html.render(this.html.cards(section,values),element.querySelector("#search_results"));this.lang&&this.lang.translate()},item:async(section,meta_key)=>{this.render.header(section==="component"?"developer":section+"s");this.html.render(this.html.item(section,meta_key),element);this.lang&&this.lang.translate();const meta=data[section==="app"?"apps":"components"].meta[meta_key];if(!this.comment||!meta)return;const comments_key=section+"_comments";if(!meta[comments_key])meta[comments_key]=await this.comment.instance({dark:this.dark,"data.key":[].concat(section,meta_key.split(",")),user:["ccm.instance",this.user.component.url,JSON.parse(this.user.config)]});$.setContent(this.element.querySelector("#comments"),meta[comments_key].root);await meta[comments_key].start()},rating:(section,meta_key)=>{this.html.render(this.html.rating(section,meta_key),element.querySelector("#rating article"));this.lang&&this.lang.translate()},edit:async(type,meta_key)=>{const meta=data[type!=="app"?"components":"apps"].meta[meta_key];this.render.header(type==="component"?"developer":type+"s");this.html.render(this.html.edit(type,meta.key),element);if(!meta.selectize){meta.selectize=await this.selectize.start({options:[...new Set([...data.apps.options.tags,...meta.tags||[]])],items:meta.tags||[]})}if(!meta.quill){meta.quill=await this.quill.start();meta.description&&meta.quill.setHTML(meta.description)}$.setContent(this.element.querySelector("#form-tags"),meta.selectize.root);$.setContent(this.element.querySelector("#form-description"),meta.quill.root);const radio=element.querySelector("#form-visibility-private");radio.checked&&radio.click();this.lang&&this.lang.translate()},editor:(tool_key,app_key)=>{this.render.header("tools");const tool_meta=data.components.meta[tool_key];this.html.render(this.html.editor(tool_key,app_key===true?tmp.app_key:app_key),element);this.lang&&this.lang.translate();if(app_key===true)return $.setContent(this.element.querySelector("#editor"),tmp.editor.root);const config=app_key&&data.apps.meta[app_key].ignore.config;Promise.all([$.solveDependency(tool_meta.ignore.editors[0].app||tool_meta.ignore.editors[0].comp||tool_meta.ignore.editors[0],this),$.solveDependency(config,this)]).then((([editor_comp,config={}])=>{if(config.data&&config.data.store&&config.data.key&&data.apps.meta[app_key]._.creator!==(this.user.getValue()||{}).key)delete config.data.key;delete config.key;delete config.component;delete config.app;delete config.ignore?.meta;delete config.created_at;delete config.updated_at;delete config._;editor_comp.start({dark:this.dark,data:{store:["ccm.store",{app:config}],key:"app"},parent:this,root:this.element.querySelector("#editor")}).then((editor_inst=>{tmp.editor=editor_inst;tmp.app_key=app_key}))}))},create:async tool_key=>{this.render.header("tools");this.html.render(this.html.create(tool_key),element);tmp.selectize=await this.selectize.start({root:this.element.querySelector("#form-tags"),options:data.apps.options.tags});tmp.quill=await this.quill.start({root:this.element.querySelector("#form-description")});const radio=element.querySelector("#form-visibility-private");radio.click();radio.checked=false;this.lang&&this.lang.translate()},preview:tool_key=>{this.render.header("tools");const tool_meta=data.components.meta[tool_key];this.html.render(this.html.preview(tool_key),element);this.ccm.start(tool_meta.path,{parent:this,root:this.element.querySelector("#preview"),src:tmp.editor.getValue()});this.lang&&this.lang.translate()},show:async app_key=>{this.render.header("apps");const app_meta=data.apps.meta[app_key];const tool_meta=data.components.meta[app_meta.component];this.html.render(this.html.show(app_key),element);this.lang&&this.lang.translate();await this.ccm.start(tool_meta.path,{src:app_meta.ignore.config,parent:this,root:this.element.querySelector("#app")});await this.handover.start({root:this.element.querySelector("#handover"),"ignore.config":app_meta.ignore.config,tool:tool_meta.path,url:(component,config)=>this.url+"?app="+config[2].toString()})},register:async()=>{this.render.header();this.html.render(this.html.register(),element);this.lang&&this.lang.translate()}}}};let b="ccm."+component.name+(component.version?"-"+component.version.join("."):"")+".js";if(window.ccm&&null===window.ccm.files[b])return window.ccm.files[b]=component;(b=window.ccm&&window.ccm.components[component.name])&&b.ccm&&(component.ccm=b.ccm);"string"===typeof component.ccm&&(component.ccm={url:component.ccm});let c=(component.ccm.url.match(/(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)/)||[""])[0];if(window.ccm&&window.ccm[c])window.ccm[c].component(component);else{var a=document.createElement("script");document.head.appendChild(a);component.ccm.integrity&&a.setAttribute("integrity",component.ccm.integrity);component.ccm.crossorigin&&a.setAttribute("crossorigin",component.ccm.crossorigin);a.onload=function(){(c="latest"?window.ccm:window.ccm[c]).component(component);document.head.removeChild(a)};a.src=component.ccm.url}})(); +//# sourceMappingURL=ccm.dms-5.2.0.min.js.map \ No newline at end of file diff --git a/versions/ccm.dms-5.2.0.min.js.map b/versions/ccm.dms-5.2.0.min.js.map new file mode 100644 index 0000000..1c106a8 --- /dev/null +++ b/versions/ccm.dms-5.2.0.min.js.map @@ -0,0 +1 @@ +{"version":3,"names":["component","name","version","ccm","config","apps","comment","css","url","context","components","configs","dark","icon","helper","html","libs","picture","quill","options","theme","selectize","create","create_on_blur","plugins","shadow","text","user","Instance","$","data","element","tmp","this","init","async","Object","assign","use","lang","ready","logger","log","privatize","window","addEventListener","refresh","classList","add","observe","setContent","params","location","reload","start","Promise","all","get","deleted","forEach","translate","arr","title","creator","tags","tool","ratings","filter","dataset","push","tools","meta","arrToObj","key","values","rating","reduce","a","b","length","app","obj","getValue","listed","_","tag","keys","share","render","main","querySelector","root","clone","events","onRegister","view","onRegisterSubmit","store","username","password","formData","set","realm","token","hash","md5","access","del","alert","e","onLogin","login","onLogout","logout","onHome","onList","section","onSearch","sort","value","querySelectorAll","input","id","split","pop","cards","onItem","meta_key","onEdit","type","edit","onEditSubmit","form","visibility","agree","content","software","copyright","prop","description","getHTML","includes","onDelete","onRating","user_key","toString","priodata","onStart","template","editor","show","onCreate","tool_key","onCreateSubmit","tool_meta","getUsername","app_key","generateKey","ignore","source","deepValue","created_at","updated_at","Date","now","onSave","onPreview","preview","active","home","list","item","register","header","replace","cloneNode","comments_key","instance","concat","JSON","parse","Set","items","setHTML","radio","checked","click","solveDependency","editors","comp","then","editor_comp","parent","editor_inst","path","src","app_meta","handover","join","files","c","match","document","createElement","head","appendChild","integrity","setAttribute","crossorigin","onload","removeChild"],"sources":["ccm.dms-5.2.0.js"],"mappings":"AAYA,MACE,MAAMA,UAAY,CAChBC,KAAM,MACNC,QAAS,CAAE,EAAG,EAAG,GACjBC,IAAK,yDACLC,OAAQ,CACNC,KAAQ,CAAE,aACVC,QAAW,CAAE,gBAAiB,uFAC9BC,IAAO,CAAE,WACP,CACE,oFACA,uEAEF,0FACA,CAAEC,IAAO,0FAA2FC,QAAW,SAEjHC,WAAc,CAAE,aAChBC,QAAW,CAAE,aACbC,KAAQ,MACRC,KAAQ,oEAERC,OAAU,CAAE,WAAY,kEACxBC,KAAQ,CAAE,WAAY,sEAEtBC,KAAQ,CAAE,WAAY,0FAEtBC,QAAW,oEACXC,MAAS,CAAE,gBAAiB,kFAAmF,CAC7GC,QAAW,CACTC,MAAS,UAGbC,UAAa,CAAE,gBAAiB,0FAA2F,CACzHC,OAAU,KACVC,eAAkB,KAClBC,QAAW,CAAE,mBAEfC,OAAU,OACVC,KAAQ,CAAE,WAAY,yEACtBlB,IAAO,sDACPmB,KAAQ,CAAE,eAAgB,kFAE5BC,SAAU,WAMR,IAAIC,EAMJ,IAAIC,KAMJ,IAAIC,QAMJ,MAAMC,IAAM,CAAC,EAMbC,KAAKC,KAAOC,UACVN,EAAIO,OAAOC,OAAQ,CAAC,EAAGJ,KAAK9B,IAAIW,OAAQmB,KAAKnB,QAAUe,EAAES,IAAKL,KAAK9B,KACnE,GAAK8B,KAAKM,KAAON,KAAKM,KAAK3B,KAAOqB,KAAKrB,IAAI,EAO7CqB,KAAKO,MAAQL,UAEXF,KAAKQ,QAAUR,KAAKQ,OAAOC,IAAK,QAASb,EAAEc,UAAWV,KA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