cancel
Showing results for 
Search instead for 
Did you mean: 

Expression classdefs is undefined

ddelapasse
Champ in-the-making
Champ in-the-making
I'm trying to copy classes.get.json.ftl (text below) into my amp, but I've never seen ftl before and am struggling.  The code is failing with: <strong>Expression classdefs is undefined on line 3, column 8</strong>

I've renamed the imported file, but haven't changed the content yet, so it should work as the default application.  I don't understand where classdefs is supposed to come from. Is it something that depends on being run in the main webscripts tree?  Is there anyway to reference it from a script in the amp's location?

thanks!


<#import "csss_classdetails.lib.ftl" as classdetailsDefLib/>
[
<#list classdefs as classdef>
<@classdetailsDefLib.classDefJSON classdef=classdef key=classdef_index/><#if classdef_has_next>,</#if>
</#list>
]
5 REPLIES 5

mitpatoliya
Star Collaborator
Star Collaborator
Seems like you are taking wrong approach. What are you trying to achieve? How do you come across this situation?

ddelapasse
Champ in-the-making
Champ in-the-making
I want to modify the functionality that exists in the "built-in" classes.get.json.ftl & classdetails.get.json.ftl to return additonal information.  I thought I could just copy the webscripts into my amp and modify/rename them, but I can't figure out how.

Can I access the repo from a webscript?  I see that there are 'data webscripts' but unable to find any examples doing anything remotely similar.

mitpatoliya
Star Collaborator
Star Collaborator
Ideally you should always use extension machanism to override the existing webscript.

Still if you want to override it here are steps.

Create similar folder structure(of webscript which you want to extend) under web-extension/
Copy file which you want to override  to extension folder.
Do your changes.
Refresh webscripts and you are done.


ddelapasse
Champ in-the-making
Champ in-the-making
Thanks I will try that! I thought creating an amp WAS correct the extension mechanism. I prefer to use the amps, but obviously there's something going on in the built-in "classes.get.json.ftl" giving it access to a "classdefs" list and I can't figure out where that comes from.  My amp version doesn't seem to have the same ability.

I'll try your suggestion.  Thanks!!!

ddelapasse
Champ in-the-making
Champ in-the-making
@mitpatoliya, Now I understand!   I took your advice and copied the files to web-extensions, but that won't work longterm for me because everytime I deploy my amp we remove the alfresco/share subfolders and let tomcat reploy them (we had issues with deployment without this step) BUT…you gave me the idea that instead of creating my own similar webscripts just to override these existing ones.  So I copied the files into my amp structure using that SAME path (org/alfresco/repository/dictionary)  and now the changes deploy with my amp.  I still don't understand why just copying the code into another webscript wouldn't work, but this approach works fine!

I realize that this will likely break if we go to 5.0, but I can't worry about that right now.

With Alfresco there are so many ways to accomplish things that it can be overwhelming and confusing (at least to me).

Thanks for your help!!!