Cannot list array in alfresco freemarker template -
There are major problems with working on my WordScript. The best part is that everything in the Alfresco JavaScript console is working. If I do not implement the webpit
javascript:
try {var node ruff = args [0] .split ('& amp;'); Var path = []; For (nodesofs in var n) {var doc = search.findNode (nodeRefs [n]); Var path = doc.displayPath + "/" + doc.name; Var host = header ['host']; Path = path.replace ('/ Firmen-Home / Sites', ''); Path = path.replace ('/ companyhome / sites', ''); Path = path. Location (/ \ g), '\\'); Paths.push ("\\\" + + + + + 7070 \\ alfresco "+ path);} Model.paths = path; Model.nodeRefs = nodefaces;} hold (e) {}
freemarker template:
& lt; #scape x as jsonUtils.encodeJSONString (x) & gt; & lt; # Signal node reefs = node reefs & gt; {& Lt ; # Assign N = 0> & gt; path as path path & gt; "$ {noderphs [n]}": "$ {path}" & lt; # if path_has_next & gt ;, & lt ; / # If & gt; & lt; #assignn = n + 1 & gt; & lt; / # list & gt;} & lt; / # escape & gt;
JavaScript Console Output (I used 3 times for the same noderef test):
{"Workbench: \ / \ SpacesStore / 5fa74ad3-9b5b -461b-9df5-de407f1f4fe7": "\\\\" Niue Host: 8080 @ 7070 \\ Alfresco \\ swsdp \\ documentLibrary \\ Budget Files \\ budget.xls "," Workbench: \ / \ SpacesStore \ / 5fa74ad3-9b5b-461b-9df5-de407f1f4fe7 ":" \\ \ Localhost: 8080 @ 7070 \\ Alfresco \\ swsdp \\ documentLibrary \\ budget files \\ budget.xls "," workspace: \ / \ spacesstore \ / 5fa74ad3-9b5b-461b-9df5-de407f1f4fe7 ":" \\\\ Local Host: 8080 @ 7070 \\ Alfresco \\ swsdp \\ documentLibrary \\ budget files \\ budget.xls "}
I posted on all the possible solutions I tried Websites get 3 different errors:
freemarker.core.ParseException - "{" Line Riwartit / uuidsToPaths.get 1, column 19. Json.ftl. One of those was expecting: "in" ... ">"
freemarker.core.InvalidReferenceException: error in changing line 3, column 9 \ uuidsToPaths.get.json.ftl nodeRefs remains undefined . It can not be assigned to node rif
Evaluation for the expected archive or sequence path instead of freemarker.template.SimpleHash
What am I mussing here? I tried $ {nodeRefs}
, $ nodeRefs
, {nodeRefs}
.... but anything seems to work.
Regards, Michael
Edit:
Javascript Controller:
Function main () {var node rough = args [0] .split ("_"); Var path = [nodeRefs.length]; Var i = 0; For (nodesofs in var n) {var doc = search.findNode (nodeRefs [n]); Var path = doc.displayPath + "/" + doc.name; Var host = header ["host"]; Path [i] = "\\" + + + "7070 \ alfresco \\" + path; I ++; } Model.code = "200"; Model.paths = Path; Model.nodeRefs = noderefs; } Main();
Freemer JSON
& lt; #scape x as jsonUtils.encodeJSONString (x) & gt; {"Status": {"code": $ {code} // error is easy to separate from success}, & lt; #assignn = 0> & Lt; # Path as Path Path & gt; "$ {Noderfus [n]}": "$ {path}" & lt; # If path_has_next & gt;, & lt; / # If & gt; & Lt; #assignn = n + 1 & gt; & Lt; / # List & gt; } & Lt; / # Escape & gt;
This is not really a reply, but your comment is not discussed promising is.
First of all, try the Try / Grip element in Javascript so that you can actually see the error in your alfresco.log/share.log. In my case, I will not even add an attempt / hold, variables will be empty which will put an error in the freemakers.
& lt; #assignnodeRefs = nodeRefs & gt;
This is specifying the already available variable itself which does not understand at all :) All the models for your information. & Lt; Variable & gt;
are mapped and thus the freemakers are assigned to variables.
In your case, the admin javascript in model.nodeRefs becomes nodefaces in Freemarker.
The second to & lt; Delete #scape x to jsonUtils.encodeJSONString (x)> Freemarker so that your mailing error does not mess with lining (you should work it later, add it later).
The main error in your log file is:
freemarker Core.InvalidReferenceException: The error in line 3, column 9 is inconverted in Convert \ uuidsToPaths.get.json.ftl nodeRefs . It can not be assigned to nodeRefs
This means that model.nodeRefs does not exist, thus your Javascript has entered an error which does not show in the log.
Comments
Post a Comment