Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
controlling dcr name and .htm file names
kellyrmilligan
Is there a way to set a default name of the dcr when saving for the first time, and also setting this for the .htm file? I have set up a table of contents type setup, and am using the fields in the dcr to come up with the link to the physical file. I just want to make this more fool-proof by setting the file name ahead of time so all they have to do is hit save in both cases
I think if anyone has done this, it would be a great help here to post a code snipped for this.
Thanks,
Kelly
Find more posts tagged with
Comments
Migrateduser
I don't think there is a way you can set the DCR file name without setting the directory that the DCR will be written to. If you know what directory, I can send you some sample code that names the DCR based on data in the DCT (actually I think it is already posted here somewhere).
On the output files, I usually disable the generate button and the prompt to regenerate, then have workflow name the output files for the user.
Johnny
hmmm just out of curiosity,
what was your method for disabling the generate button and that annoying regenerate prompt (which actually doesn't regenerate... it does a generate with the file dialog box!!).
I try not to hack the system too much, so I disabled the generate button by putting a regex in templating.cfg that cannot be met.
EG <directory dir-regex="Preview_only_then_submit" />
Which isn't very user friendly, but its within the IWOV boundaries.
How bout this regenerate question.... is that configurable somewhere?...
do i need to roll up the sleeves for more hack time?
John Cuiuli
Consultant
Sydney, Australia
Migrateduser
I am not sure there is any good way. I did something with FormAPI onSave that checks which button was pressed, alerts and returns false if they pressed generate. I can send you the code if you want, but if they save, then press generate, that doesn't work (because onSave is triggered onSave, not onGenerate). There was a really good post a while ago about removing the generate button completely. But then you have to maintain that with every patch, and they patch frequently. I have an onClose event on all templates that does this to disable the prompt to regenerate:
function abortGenerate()
{
parent.frames.datacapture_buttonframe.regenerateNeedsTobeDone = false;
return( true );
}
I also do the regex thing in templating.cfg - just in case.
Edited by john on 04/22/03 03:52 PM (server time).
Johnny
Thanks John.
I saw those posts too. Interesting but I want to stay away from that sort of stuff.
Thanks for the regen abort code!... that will be useful
Cheers
John Cuiuli
Consultant
Sydney, Australia
kellyrmilligan
yes, could you send me that sample code? I will also look for it, but sometimes the search functionality in these forums doesn't work so well...
Migrateduser
Code
Additionally you can use an onSaveNameSpecified function to validate the file name (if it is not the required value throw an alert to tell the user what to name it and return false).
kellyrmilligan
yes, but where does this code go? sorry, I am a newbie, but sometimes the teamsite documentation and what not falls a little short. the code seems straightforward, but I am not sure where it would go.
Thanks again,
Kelly
Migrateduser
I put all of the functions that are not specific to a certain templating type in a file I created called IWHOME/httpd/iw/formAPIfunctions.js. This includes:
function getWorkarea()
function retrieveDCRName()
function getCategoryAndType()
Then in each DCT I include that script file:
<script language="javascript" location="webserver" src="/iw/formAPIfunctions.js"/>
Also in each DCT I have the functions and event handler registrations that are specific to that template:
<script><![CDATA[
var dcrName = retrieveDCRName();
function determineFileName( button )
{
...
}
IWEventRegistry.addFormHandler( "onSaveValid", determineFileName );
]]></script>
kellyrmilligan
you rock! I will look at this very closely, would it be possible to get one full dct that you do this in? I just want to see a more complete example. I think I can figure it out, but a working example always helps best.
Thanks again,
Kelly
Migrateduser
If you you send an email to
mailto:interwoven@jpw3.com
I will send you all the code.
kellyrmilligan
john, I have everything working, thanks for the help. just one more thing, and if its not possible, thats fine. I am reading through the formapi documentation, and am trying to get a workaround for generating the htm file if the user selects the generate button, to do the same thing as the save functionality there. I see you have something called Generate.jsp referenced, but it is commented out in the code, did this ever work?
Migrateduser
It is commented out in the Policy DCT because I moved it to the inline that generates the templating code shared to all templates. Note also that the commented code in the DCT is older - I found I had to add a JavaScript timeout to get generation to work right. But generate is something I wrote - not something that ships with TeamSite - so it could be pretty hard to get it working in your environment (though you could do a similar thing with a Perl CGI relatively easily). It just generates the output files for the given DCR based on templating.cfg. I can send you the code if you want, but getting everything configured in your environment could be a problem. Tthere is too much stuff in the code that is specific to my current project anyway.