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)
session value in pt
GodBlessMe
Hi . I want to get the login session value (iw_session value) in a presentation template. Any clues?
Thanks.
Find more posts tagged with
Comments
akshathp
I tried the method of reading the cookie and fetching values. Not sure if there is any other way for it at present.
Hope this helps!
Akshat Pramod Sharma
Interwoven Inc.
GodBlessMe
Can you please tell me how to read the cookies from within a presentation template? I tried using $ENV{HTTP_COOKIE}. But it didnt work.
Thanks
akshathp
I used the following code:
<iw_perl><![CDATA[
my $user_name = $ENV{HTTP_COOKIE};
my($iui, $jsession, $user, $role, $domain, $auth, $prox) = split (/\;/,$user_name,7);
]]>
</iw_perl>
It will give you name/value pairs in each variable. You could infact have all of them split into an array rather then individual varaible and run it in a for loop to fetch the desired name/value group. Once you get that then you can split them further to fetch the value only.
Hope this helps!
Akshat Pramod Sharma
Interwoven Inc.
GodBlessMe
if i put the same code in my pt i'm getting
"Use of uninitialized value at (eval 33) line 97." error .....
Thanks
akshathp
Can you please post your pt as an attachment?
Thanks!
Akshat Pramod Sharma
Interwoven Inc.
GodBlessMe
<?xml version="1.0" encoding="UTF-8"?>
<iw_pt name="workflowConfig">
<iw_load_dcr var='wfConfigDCR' file='/templatedata/sysAdmin/workflowConfiguration/data/workflowConfig.xml' mode='docroot'/>
<iw_perl>
<![CDATA[
use lib '/app/teamsite/iw-home/local/bin';
use HTML::Entities;
use TeamSite::Config;
use cws;
use TeamSite:
T::iw_perl;
$iwhome = TeamSite::Config::iwgethome();
my $url = get_base_url();
my $url_image = $url . "/iw/cpb/images";
my $url_web = $url . "/iw/webdesk";
my $url_styles = $url . "/iw/cpb/styles";
my $user_name = $ENV{HTTP_COOKIE};
my($iui, $jsession, $user, $role, $domain, $auth, $prox) = split (/\;/,$user_name,7);
sub get_base_url
{
my ($iwcfg) = "$iwhome/bin/iwconfig iwwebd";
(my $proto = `$iwcfg default_protocol`) =~ s/\n$//;
(my $hostname = `$iwcfg host`) =~ s/\n$//;
(my $port = `$iwcfg ${proto}_port`) =~ s/\n$//;
my($url) = "$proto://" . $hostname;
if (($proto eq "http" && ($port != 80 && $port ne ""))
|| ($proto eq "https" && ($port != 443 && $port ne ""))) {
$url .= ":$port";
}
return $url;
}
#cws::escape_html()
$curr_workarea = iwpt_get_flag_param('-iw_include-location');
$curr_workarea =~ tr/\.//d;
#my $MetaDCRDIR = iwpt_get_dcr_name('dirname');
#$MetaDCRDIR =~ tr/\.//d;
#my $MetaDCRFILE = iwpt_get_dcr_name('basename');
#my $MetaDCR = $MetaDCRDIR."/".$MetaDCRFILE;
#my $metaDCR_area = $MetaDCR;
#$metaDCR_area =~ s{$curr_workarea}{};
my $OutPutFileDIR = iwpt_get_ofile_name('dirname');
$OutPutFileDIR =~ tr/\.//d;
my $OutPutFileNAME = iwpt_get_ofile_name('basename');
$OutPutFile = $OutPutFileDIR."/".$OutPutFileNAME;
my $OutPutFileArea = $OutPutFile;
$OutPutFileArea =~ s{$curr_workarea}{};
my $gen_prev = iwpt_get_flag_param('-oprefix');
]]>
</iw_perl>
<iw_if expr='$gen_prev eq ""'>
<iw_then>
<iw_ostream file_val='$OutPutFileArea'>
<p>Temporary Output to set some needed ext attribs for deployment</p>
</iw_ostream>
</iw_then>
</iw_if>
<![CDATA[
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>TeamSite Workflow</TITLE>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<LINK href="<iw_value name="$url_styles"/>/styles.css" type=text/css rel=stylesheet>
<SCRIPT language=JavaScript>
<!--
function sizeScreen()
{
window.resizeTo(650,550);
}
//}
//-->
</SCRIPT>
<META content="MSHTML 5.50.4926.2500" name=GENERATOR></HEAD>
<BODY text=#000000 bgColor=#ffffff onload=javascript:sizeScreen();>
<P class=hnews><IMG height=19 src="<iw_value name="$url_image"/>/pblogosm.gif" width=60 align=right>TeamSite Workflow</P>
<FORM name=iwwft_instantiator action=/iw-bin/iwwft_instantiator.cgi method=post>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD class=bl>
<TABLE cellSpacing=1 cellPadding=2 width="100%" border=0>
<TBODY>
<TR class=bldk>
<TD class=txtw colSpan=2 height=18>Editor Assign Work to Author with Editor Review</TD></TR>
<TR vAlign=top>
<TD class=txt vAlign=top noWrap bgColor=#ffffff colSpan=2>
<TABLE cellSpacing=0 cellPadding=1 width="100%" border=0>
<TBODY>
<TR>
<TD bgColor=#003366>
<TABLE cellSpacing=0 cellPadding=5 width="100%" border=0>
<TBODY>
<TR vAlign=top bgColor=#ffffff>
<TD class=txt bgColor=#ffffff colSpan=2>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD bgColor=#003366>
<TABLE cellSpacing=1 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD class=bl width=11><IMG height=9 hspace=3 src="<iw_value name="$url_image"/>/arrow-light.gif" width=5 align=absMiddle></TD>
<TD class=hsmall width="100%" bgColor=#ffffff> Add Job Details</TD></TR></TBODY></TABLE></TR></TBODY></TABLE></TD></TR>
<TR vAlign=top bgColor=#ffffff>
<TD class=txt bgColor=#ffffff colSpan=2>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD bgColor=#ccccff>
<TABLE cellSpacing=1 cellPadding=3 width="100%" border=0>
<TBODY>
<TR vAlign=top align=left bgColor=#ffffff>
<TD class=blltnt noWrap>Who should <SPAN class=hblack>author</SPAN> the work for this Job?</TD>
<TD class=txt noWrap>
<SELECT class=txt name='iw_author'>
<OPTION selected>
]]>
<iw_iterate iteration='author' list='wfConfigDCR.workflow-config.Authors' var='authors'>
<![CDATA[
<OPTION><iw_value name="authors"/></OPTION>
]]>
</iw_iterate>
<![CDATA[
</SELECT>
</TD>
<TD class=blltnt noWrap>
<SPAN class=hblack>Priority</SPAN>:</TD>
<TD class=txt noWrap>
<SELECT class=txt name=iw_priority>
<OPTION selected></OPTION>
<OPTION value=Low>Low</OPTION>
<OPTION value=Medium>Medium</OPTION>
<OPTION value=High>High</OPTION>
<OPTION value=Urgent>Urgent</OPTION>
</SELECT>
</TD></TR>
<TR vAlign=top align=left bgColor=#ffffff>
<TD class=blltnt noWrap>Who will <SPAN
class=hblack>review</SPAN> the work in this
Job?</TD>
<TD class=txt noWrap>
<SELECT class=txt name=selected_reviewer_1>
<OPTION selected></OPTION>
]]>
<iw_iterate iteration='editor' list='wfConfigDCR.workflow-config.Editors' var='editors'>
<![CDATA[
<OPTION><iw_value name="editors"/></OPTION>
]]>
</iw_iterate>
<![CDATA[
</SELECT> </TD>
<TD class=txt noWrap colSpan=2> </TD></TR>
<TR vAlign=top align=left bgColor=#ffffff>
<TD class=blltnt noWrap><SPAN
class=hblack>Description</SPAN>:</TD>
<TD class=txt noWrap colSpan=3>
<TEXTAREA class=txt name=iw_desc rows=4 cols=50></TEXTAREA>
</TD></TR>
<TR vAlign=top align=left bgColor=#ffffff>
<TD class=blltnt noWrap>
<SPAN class=hblack>Publish Dynamic Pages:</SPAN></TD>
<TD class=txt noWrap colSpan=3>
<SELECT multiple size=5 name=dynFiles>
]]>
<iw_iterate iteration='dyn' list='wfConfigDCR.workflow-config.dyn-pages.DynamicPages' var='dynpages'>
<![CDATA[
<OPTION><iw_value name="dynpages"/></OPTION>
]]>
</iw_iterate>
<![CDATA[
</SELECT> </TD></TR>
<TR vAlign=top align=left bgColor=#ffffff>
<TD class=blltnt noWrap><SPAN class=hblack>Would you like to add Documents to this task?</SPAN>:</TD>
<TD class=txt noWrap colSpan=3>
<INPUT type=checkbox value=checkbox name=addFiles>Yes
</TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR>
<TR vAlign=top bgColor=#eeeeee>
<TD class=txt><INPUT class=button onclick=window.close() type=button value=Cancel name=button2>
</TD>
<TD class=txt align=right><INPUT class=button type=submit value="Initiate Job " name=submit2>
</TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<input type=hidden name=iw_use_defaults value='true'>
<input type=hidden name=iw_home value='/app/teamsite/iw-home'>
<input type=hidden name=iw_branch value='/default/main/CWS'>
<input type=hidden name=iw_template_file value='test/configurable_deployment.wft'>
<input type=hidden name=iw_template_name value='Configurable Metadata Deploy and OpenDeploy '>
<input type=hidden name=iw_workarea value=<iw_value name="$curr_workarea"/>>
<input type=hidden name=template_file value='test/configurable_deployment.wft#!#Configurable Metadata Deploy and OpenDeploy '>
<input type=hidden name=iw_user value=<iw_value name="user123"/>>
</FORM></BODY></HTML>
]]>
</iw_pt>
james1
This method will (for obvious reasons) not do what you want when the PT is compiled from the command line (i.e., iwgen, iwregen, or iwpt_compile.ipl). I do not know how you could prevent your users (and your scripts) from ever running these command line tools.
Additionally, from the UI, I'm not even sure that you are guaranteed to have access to the cookie environment variable from within the PT. It may work, on some versions, under some circumstances. But it probably will not work on other versions, under other circumstances. It certainly isn't documented that this is something you can or should do, so I would caution against you depending on it working.
-- James
--
James H Koh
Interwoven Engineering