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)
dynamic initial-dir not working under ts6.1sp2
daveyt
Hi,
I have a dcr in which I called a form api script that dynamically set the ceiling-dir of a browser item
This was set by clicking a check-box and worked fine under under 5.5.2 on w2k.
We have since upgraded to 6.1 sp2 build 45436 on w2k3 and I have amended the script to set the initial-dir as this is the required parameter for r6.1.
However, setting the intitial-dir does not direct the browser to open in the correct directory as it did in 5.5.2.
Any one any ideas ?
Thanks,
Dave
The dcr is
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE data-capture-requirements SYSTEM "datacapture5.0.dtd">
<data-capture-requirements type="content" name="NavigationLHSMenu">
<ruleset name="CommunityOutcomes">
<description>
Community Outcome Reporting Index
</description>
<item name="type">
<radio required="t">
<option selected="t" value="challenge" label="Challenge" />
<option value="indicator" label="Key Indicator" />
</radio>
</item>
<item name="outcome" colspan="4">
<label>Outcome</label>
<description>Select Outcome title. This is a required field. </description>
<database deploy-column="f" searchable="f" data-type="VARCHAR(150)" />
<select required="t">
<option label="Overall Quality of the City" selected="t" />
<option label="A City with a Sustainable Natural Environment" />
<option label="A Learning City" />
<option label="A Prosperity City" />
<option label="A Well Governed City" />
<option label="A City of Inclusive and Diverse Communities" />
<option label="A City of Healthy and Active People" />
<option label="A Safe City" />
<option label="A Cultural and Fun City" />
<option label="A Liveable City" />
<option label="Demographic Summary" />
</select>
</item>
<item name="challenges">
<label>Challenge</label>
<database deploy-column="f" />
<replicant name="challengeitem" min="1" max="10">
<item name="challengedetail">
<label> Challenge details (max 250 chars)</label>
<text size="100" maxlength="250" />
</item>
<item name="indicators">
<label> Indicator </label>'
<replicant min="1" max="10" name="indicatoritem">
<item name="indicatordetail">
<label>Indicator details(max length 150 chars)</label>
<text size="100" maxlength="150" />
</item>
<item name="measures">
<label> Measure </label>
<replicant min="1" max="10" name="measureitem">
<item name="measuredetail">
<label> Measure details (max length 300 chars) </label>
<text size="100" maxlength="300" />
</item>
<item name="setdirpath">
<label> Set dir path</label>
<checkbox>
<option value="true" label="Set link directory path" />
</checkbox>
</item>
<item name="filetitle" >
<label> Link file title </label>
<browser required="f" initial-dir="zzz" ceiling-dir="htdocs/Ltccp/CommunityOutcomes/Monitoring" extns="" size="80" maxlength="250"/>
</item>
</replicant>
</item>
</replicant>
</item>
</replicant>
</item>
<script location="template-type" src="outcomedetails.js"/>
</ruleset>
</data-capture-requirements>
The script is
//-----------------------------------------------------------------------------
// File OutcomeDetails.js
// Userscript for the 'OutcomeDetails' Template.
//
//-----------------------------------------------------------------------------
function init() {
IWEventRegistry.addItemHandler("/challenges/indicators/measures/setdirpath", "onItemChange", setDirPath);
IWEventRegistry.addItemHandler("/challenges/indicators/measures/filetitle", "onItemChange", linkHandler);
IWDatacapture.redraw();
}
function setDirPath(linkItem){
//sets the dir path for link items based on type and outcome
var path="htdocs/Ltccp/CommunityOutcomes/Monitoring/";
//alert (path);
var type=IWDatacapture.getItem("/type");
type=type.getValue();
var outcome=IWDatacapture.getItem("/outcome");
outcome=outcome.getValue();
var itemName = linkItem.getName();
itemName=(itemName.substr(0,itemName.length-10)) + "filetitle";
alert (itemName);
alert (IWDatacapture.getItem(itemName).itemImpl.attributes.values['initial-dir']);
if (type=="0")
{
type="/Challenges";
}
if (type=="1")
{
type="/KeyIndicators";
}
switch (outcome)
{
case 0:
path=path + "OverallQuality" + type;
break
case 1:
path=path + "Sustainable" + type;
break
case 2:
path=path + "Learning" + type;
break
case 3:
path=path + "Prosperous" + type;
break
case 4:
path=path + "Governed" + type;
break
case 5:
path=path + "Inclusive" + type;
break
case 6:
path=path + "Healthy" + type;
break
case 7:
path=path + "Safe" + type;
break
case 8:
path=path + "Cultural" + type;
break
case 9:
path=path + "Liveable" + type;
break
case 10:
path=path + "Demographic" + type;
break
}
path="htdocs/";
IWDatacapture.getItem(itemName).itemImpl.attributes.values['initial-dir'] = path;
IWDatacapture.redraw()
}
// Handles links onItemChange event -- strips htdocs
function linkHandler(linkItem) {
var myLink = linkItem.getValue().toLowerCase(); // Get value into var
// Get rid of /htdocs/ prefix
if (myLink.indexOf("/htdocs") != -1) {
linkItem.setValue(myLink.substr(7,myLink.length - 7));
}
}
//Do the initialization...
init();
Find more posts tagged with
Comments
yanSi
I had the same problem. I found that if you call the event handler manually, the initial-dir will change but if the handler is called by the EventRegistry it won't work.
I posted my code in the the templating forum a few weeks ago and nobody has found what the problem is.