Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Dynamically loading new DCT
lazybee26
Env - 6.5 on Solaris.
This is all in design phase. I'm trying to come up with the best soln.
I have a teamsite menu driven search UI (not the teamsite search), that queries the DB and HTMLs some results depending on the query. when I click on one of the links of search results, I want to open a DCT, prepopulating it with values from the DB. And the values from DB that I use to populate the DCT, will depend on the link I click.
So basically, I need to dynamically pass a value to my callserver, that will eventually query the DB again, and return values to prepopulate the DCT. But how do i do that? The only way I can think of is .....When I click on the link in search results
1. Set a session cookie with an ID to use when querying DB
2. Call the "edit DCT" url
3. In form api, read the cookie and pass the value to Call server
4. Call server will call CGI to query database for record matching the id passed in
5. I populate the DCT with values from DB
Is this is a good approach? Is there any other soln I can try?
btw, I don't want to give the search interface, within the DCT itself. It needs to be outside the DCT for some other reasons.
Thanks
Lazy
Find more posts tagged with
Comments
Adam Stoller
If the results of the search are to be used to construct a DCR you could do the entire thing at the file parsing level.
Create a "shell" of the DCR that would be created by the DCT (essentially fill in required fields, save it, edit the DCR to remove the content and perhaps put place-holders in there to make it easy to do simple regex replacements later on) and copy this "shell" someplace safe.
When you get the results of your query - make a copy of the shell in the location where you want it (within the correct templatedata/cateogory/data-type/data/ directory) with whatever name you want to give it and then do either XML processing or regex processing to insert the values retured from the DB into the DCR. When done, call Edit DCR on the file and you should see a fully pre-populated DCR.
An example of a shell of a DCR might be something like:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE record SYSTEM "dcr4.5.dtd">
<record name="article_shell.xml" type="content">
<item name="General Info"><value>
<item name="Title"><value>
__TITLE__
</value></item>
<item name="Subtitle"><value>
__SUBTITLE__
</value></item>
<item name="Description"><value>
__DESCRIPTION__
</value></item></value>
</item>
<item name="Date"><value>
__DATE__
</value></item>
<item name="Article Section"><value>
<item name="Section Header"><value>
__HEADER__
</value></item>
<item name="Section Body"><value>
__BODY__
</value></item>
</item>
</record>
Where the
__****__
pieces are optional but allow you to do something like:
...
my $dcr_content = ;
$dcr_content =~ s|__TITLE__|$title_from_db|gsm;
$dcr_content =~ s|__DATE__|$date_from_db|gsm;
...
which could be much simpler than parsing the XML, inserting nodes and then writing it back out again.
Of course, if you need to account for replicant sections, you'll have to provide some code to generate the XML for the replicant to insert in the proper location (you might be able to do that with demarkations in the shell that provide BEGIN/END blocks of text to be replicated and which get removed before you actually save the DCR [just thinking on the fly here]).
Hope that helps.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com
lazybee26
Thanks for such a detailed reply. Appreciate it.
I'm going to try both approaches and see which ones easier to develop.
Thanks again.