JimStoner
1 Apr 2008, 1:30 PM
Hi there,
I wanted to raise the issue of how users could/should handle custom javascript libraries in conjunction with Ext.nd. Obviously you can manually include any javascript libraries you want on a db by db, form by form basis. However, if you have made a few custom extensions to Ext.nd that you want to use across many databases/applications, it seems to me like it might be nice to have them packaged up with your Ext.nd application profile.
Here's a summary of some simple changes I've made to the Ext.nd Beta 1 db:
I've edited the Application Profile form to add one more visible field called CustomLibraries; this field can have multiple values.
I've edited the HTMLHeadNoUI hidden computed field so that if there are one or more entries in the CustomLibraries field, they get added to the end of the JS header that Ext.nd generates for each application profile. I'll include a copy of the exact changes below.
Finally, I've added a few JS libraries to the Ext.nd db ScriptLibrary.
Now, whenever I create an application profile in Ext.nd, I can just name any additional JS libraries I want to include in that application, and those libraries are automatically included anytime I use Ext.nd in that application. It seems really convenient and easy to me.
Does this seem like a reasonable way to proceed? If so, would it be worthwhile adding this simple functionality to the next Ext.nd release?
Thanks,
Jim
Here's the new formula I'm using for the HTMLHeadNoUI field, with my additions in red. Basically it just adds a temporary string variable called customLibs that has a script tag for each entry in the CustomLibraries multi-value field, and then it includes that string of script tags at the end of the output.
webDbName := @WebDbName;
extUrl := "/" + webDbName + "/ext/" + ExtndVersion + "/";
extndUrl := "/" + webDbName + "/extnd/" + ExtndVersion + "/";
sViewName := "'" + ViewName + "'";
sOutlineName := "'" + OutlineName + "'";
bShowSearch := "true";
theme := @If(
Theme != "default";
"\"<link rel='stylesheet' type='text/css' href='" + extUrl + "resources/css/xtheme-" + Theme + ".css' />\"";
"\"\"");
customLibs := @If (
CustomLibraries != "" ;
"<script type='text/javascript' src='" + extndUrl + CustomLibraries + ".js'></script>";
"" );
REM {Now the code that will be injected into your page/form};
"mode := @If(@UrlQueryString(\"debug\") = \"true\"; \"-debug\"; \"\");
thisWebDbName := @WebDbName;
unid := @If(@IsNewDoc;\"\";@Text(@DocumentUniqueID));
editMode := @If(@IsDocBeingEdited;\"true\";\"false\");
output := \"\";
output := output + @NewLine + @NewLine;
output := output + \"<!-- Ext JS library -->\" + @NewLine;
output := output + \"<script type='text/javascript' src='" + extUrl + "adapter/ext/ext-base.js'></script>\" + @NewLine;
output := output + \"<script type='text/javascript' src='" + extUrl + "ext-all\" + mode + \".js'></script>\" + @NewLine;
output := output + \"<!-- Ext.nd JS library -->\" + @NewLine;
output := output + \"<script type='text/javascript' src='" + extndUrl + "extnd-all\" + mode + \".js'></script>\" + @NewLine;
output := output + \"<script type='text/javascript' src='" + extndUrl + "Session.js?OpenAgent&db=\" + thisWebDbName + \"'></script>\" + @NewLine;
output := output + \"<script type='text/javascript' src='" + extndUrl + "UIDocument.js?OpenAgent&db=\" + thisWebDbName + \"&unid=\" + unid + \"&editmode=\" + editMode + \"'></script>\" + @NewLine;
output := output + \"<script type='text/javascript'>\" + @NewLine;
output := output + \" Ext.nd.init({extndUrl : '" + extndUrl + "', extUrl : '" + extUrl + "'});\" + @NewLine;
output := output + \"</script>\" + @NewLine;
output := output + \"<link rel='stylesheet' type='text/css' href='" + extUrl + "resources/css/ext-all.css' />\" + @NewLine;
output := output + " + theme + " + @NewLine;
output := output + \"<link rel='stylesheet' type='text/css' href='" + extndUrl + "resources/css/domino.css' />\" + @NewLine;
output := output + \"" + @Implode(customLibs ) + "\";
output;"
I wanted to raise the issue of how users could/should handle custom javascript libraries in conjunction with Ext.nd. Obviously you can manually include any javascript libraries you want on a db by db, form by form basis. However, if you have made a few custom extensions to Ext.nd that you want to use across many databases/applications, it seems to me like it might be nice to have them packaged up with your Ext.nd application profile.
Here's a summary of some simple changes I've made to the Ext.nd Beta 1 db:
I've edited the Application Profile form to add one more visible field called CustomLibraries; this field can have multiple values.
I've edited the HTMLHeadNoUI hidden computed field so that if there are one or more entries in the CustomLibraries field, they get added to the end of the JS header that Ext.nd generates for each application profile. I'll include a copy of the exact changes below.
Finally, I've added a few JS libraries to the Ext.nd db ScriptLibrary.
Now, whenever I create an application profile in Ext.nd, I can just name any additional JS libraries I want to include in that application, and those libraries are automatically included anytime I use Ext.nd in that application. It seems really convenient and easy to me.
Does this seem like a reasonable way to proceed? If so, would it be worthwhile adding this simple functionality to the next Ext.nd release?
Thanks,
Jim
Here's the new formula I'm using for the HTMLHeadNoUI field, with my additions in red. Basically it just adds a temporary string variable called customLibs that has a script tag for each entry in the CustomLibraries multi-value field, and then it includes that string of script tags at the end of the output.
webDbName := @WebDbName;
extUrl := "/" + webDbName + "/ext/" + ExtndVersion + "/";
extndUrl := "/" + webDbName + "/extnd/" + ExtndVersion + "/";
sViewName := "'" + ViewName + "'";
sOutlineName := "'" + OutlineName + "'";
bShowSearch := "true";
theme := @If(
Theme != "default";
"\"<link rel='stylesheet' type='text/css' href='" + extUrl + "resources/css/xtheme-" + Theme + ".css' />\"";
"\"\"");
customLibs := @If (
CustomLibraries != "" ;
"<script type='text/javascript' src='" + extndUrl + CustomLibraries + ".js'></script>";
"" );
REM {Now the code that will be injected into your page/form};
"mode := @If(@UrlQueryString(\"debug\") = \"true\"; \"-debug\"; \"\");
thisWebDbName := @WebDbName;
unid := @If(@IsNewDoc;\"\";@Text(@DocumentUniqueID));
editMode := @If(@IsDocBeingEdited;\"true\";\"false\");
output := \"\";
output := output + @NewLine + @NewLine;
output := output + \"<!-- Ext JS library -->\" + @NewLine;
output := output + \"<script type='text/javascript' src='" + extUrl + "adapter/ext/ext-base.js'></script>\" + @NewLine;
output := output + \"<script type='text/javascript' src='" + extUrl + "ext-all\" + mode + \".js'></script>\" + @NewLine;
output := output + \"<!-- Ext.nd JS library -->\" + @NewLine;
output := output + \"<script type='text/javascript' src='" + extndUrl + "extnd-all\" + mode + \".js'></script>\" + @NewLine;
output := output + \"<script type='text/javascript' src='" + extndUrl + "Session.js?OpenAgent&db=\" + thisWebDbName + \"'></script>\" + @NewLine;
output := output + \"<script type='text/javascript' src='" + extndUrl + "UIDocument.js?OpenAgent&db=\" + thisWebDbName + \"&unid=\" + unid + \"&editmode=\" + editMode + \"'></script>\" + @NewLine;
output := output + \"<script type='text/javascript'>\" + @NewLine;
output := output + \" Ext.nd.init({extndUrl : '" + extndUrl + "', extUrl : '" + extUrl + "'});\" + @NewLine;
output := output + \"</script>\" + @NewLine;
output := output + \"<link rel='stylesheet' type='text/css' href='" + extUrl + "resources/css/ext-all.css' />\" + @NewLine;
output := output + " + theme + " + @NewLine;
output := output + \"<link rel='stylesheet' type='text/css' href='" + extndUrl + "resources/css/domino.css' />\" + @NewLine;
output := output + \"" + @Implode(customLibs ) + "\";
output;"