agg screens management in localdb
This commit is contained in:
		| @@ -46,20 +46,21 @@ Wwws.getwco = (wconame, ctx) => { | ||||
|         webpage.pages[ctx.pagename].tpldata[t] = pathtpldata; | ||||
|       } | ||||
|       wcoinfo.lang.forEach((l) => { | ||||
|         if (!fs.existsSync(`${pathtpldata}_${l}.json`)) { | ||||
|           if (!fs.existsSync(`../${wcoinfo.tpldatamodel[t]}_${l}.json`)) { | ||||
|             fs.copySync( | ||||
|               `../${wcoinfo.tpldatamodel[t]}_${l}.json`, | ||||
|               `${pathtpldata}_${l}.json` | ||||
|             ); | ||||
|           } | ||||
|         if ( | ||||
|           !fs.existsSync(`${pathtpldata}_${l}.json`) && | ||||
|           fs.existsSync(`../${wcoinfo.tpldatamodel[t]}_${l}.json`) | ||||
|         ) { | ||||
|           fs.copySync( | ||||
|             `../${wcoinfo.tpldatamodel[t]}_${l}.json`, | ||||
|             `${pathtpldata}_${l}.json` | ||||
|           ); | ||||
|         } | ||||
|       }); | ||||
|     }); | ||||
|   } | ||||
|   if (wcoinfo.ref && Object.keys(wcoinfo.ref).length > 0) { | ||||
|     Object.keys(wcoinfo.ref).forEach((t) => { | ||||
|       t=t.replace("{{tribe}}",ctx.tribe) | ||||
|       t = t.replace("{{tribe}}", ctx.tribe); | ||||
|       if (!Object.keys(webpage.pages[ctx.pagename].ref).includes(t)) { | ||||
|         webpage.pages[ctx.pagename].ref[t] = wcoinfo.ref[t]; | ||||
|       } | ||||
| @@ -70,12 +71,17 @@ Wwws.getwco = (wconame, ctx) => { | ||||
|       wcoinfo.schema.forEach((s) => { | ||||
|         s = s.replace("{{tribe}}", ctx.tribe); | ||||
|         if (webpage.pages[ctx.pagename].schema.includes(s)) { | ||||
|           webpage.pages[ctx.pagename].schema.pusf(s); | ||||
|           webpage.pages[ctx.pagename].schema.push(s); | ||||
|         } | ||||
|       }), | ||||
|     ]; | ||||
|   fs.outputJSONSync(webconf,webpage) | ||||
|   return { status: 200, ref:"Wwws",msg:"wcoupdatesuccessinpageconf",data: { file: path.resolve(filereq) } }; | ||||
|   fs.outputJSONSync(webconf, webpage); | ||||
|   return { | ||||
|     status: 200, | ||||
|     ref: "Wwws", | ||||
|     msg: "wcoupdatesuccessinpageconf", | ||||
|     data: { file: path.resolve(filereq) }, | ||||
|   }; | ||||
| }; | ||||
|  | ||||
| Wwws.build = (tribeId, webapp, srcdist, options) => { | ||||
| @@ -383,6 +389,7 @@ Wwws.initlocaldata = (tribe, appname, pagename, version, profils, lg) => { | ||||
|     tpldata: {}, | ||||
|     ref: {}, | ||||
|     schema: {}, | ||||
|     screens:{} | ||||
|   }; | ||||
|   localstorage.headers.xlang = lg; | ||||
|   // A faire plus tard charger tous les referentiele et les data pour une page adminpage | ||||
| @@ -437,6 +444,7 @@ Wwws.initlocaldata = (tribe, appname, pagename, version, profils, lg) => { | ||||
|   } | ||||
|   if (!loc.tpl) loc.tpl = {}; | ||||
|   if (!loc.tpldata) loc.tpldata = {}; | ||||
|   // remove loc.components (this is now in tpldata and tpl) | ||||
|   if (loc.components) { | ||||
|     loc.components.forEach((c) => { | ||||
|       console.log("ggggggggggggggggg", c); | ||||
| @@ -477,6 +485,23 @@ Wwws.initlocaldata = (tribe, appname, pagename, version, profils, lg) => { | ||||
|       } | ||||
|     }); | ||||
|   } | ||||
|   if (!loc.screens) loc.screens={} | ||||
|   if (loc.screens) { | ||||
|     Object.keys(loc.screens).forEach((r) => { | ||||
|       let src = `../${loc.screens[r]}`; | ||||
|       //console.log(path.resolve(src)) | ||||
|       if (!fs.existsSync(src)) { | ||||
|         src += `_${lg}.json`; | ||||
|       } | ||||
|       if (fs.existsSync(src)) { | ||||
|         localstorage.screens[r] = fs.readJSONSync(src); | ||||
|       } else { | ||||
|         localstorage.screens[ | ||||
|           r | ||||
|         ] = `Check your ${fileparam} for template in ${pagename} profil and ${r} in screens`; | ||||
|       } | ||||
|     }); | ||||
|   } | ||||
|   if (loc.schema) { | ||||
|     loc.schema.forEach((objpath) => { | ||||
|       const name = path.basename(objpath); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user