%@ page language="java" %>
<% String rzmodule = ""; %>
<%@ include file="/util/setup_editform_header.jsp" %>
<%@ page import="revize.db.LinkManager" %>
<%
/* * * * * * * * * * * * * * * LINK MANAGER PROCESSING * * * * * * * * * * * * * *
===============
Input Arguments
===============
Some arguments are passed on the url; others are passed as link properties
of the the RZ.link. object of the window opener (as of build 82).
See RZsetLinkManagerProperties() in snippet_helper.js for details.
==========
HTML Forms
==========
3 forms are required to properly hide the filename input field on Netscape.
The XMLForm is always the first form and contains the linkmanager fields.
The filenameForm is next and only defined if at least one of the specified
templates permits user specified filenames. It is hidden unless the
selected template permits user specified filenames (If the window is resized
in Netscape, the form must always be displayed because older versions of
Netscape lose layer properties after resizing).
The controlForm is last and always defined. It contains the continue and
cancel buttons as well as additional working fields. Link properties are
initially stored there in case the calling window is closed or refreshed.
---------------------------------------------------------------------------*/
String validfilecharacters = "~!@#$%()+-"; //DCO 07-05-2009
String defaultFileExt = System.getProperty(RevizeProperties.PUBLISHER_DEFAULT_FILE_EXTENSION);
String linkoptions = "," + StringUtils.getParameter(request,"linkoptions") + ",";
String linkname = StringUtils.getParameter(request,"linkname");
String listModule = StringUtils.getParameter(request,"module");
String urlModule = StringUtils.getParameter(request,"urlmodule");
String linkType = StringUtils.getParameter(request,"linktype");
String recordId = StringUtils.getParameter(request,"recordid");
String urlRecord = StringUtils.getParameter(request,"urlrecord");
String templateLabel = StringUtils.getParameter(request,"templatename");
String linkfilename = "";
String href = java.net.URLDecoder.decode(StringUtils.getParameter(request,"href"));
if( !rz.isvalidmodule(listModule) )
{
linkoptions = ",url,";
listModule = "";
}
if( linkoptions.indexOf(",template,") > 0 && listModule.length() == 0)
linkoptions = StringUtils.replaceAll(linkoptions,",template,", ",");
boolean isRTE = StringUtils.getParameterBoolean(request,"rte");
boolean isTinyMCE = StringUtils.getParameter(request,"rte").equals("tinymce");
boolean isExistingTemplate = false;
//----- Get List Module and Link field names - were specified as url parameters
// but now are now hard coded names.
String linkIdField = "linkid";
String linkTypeField = "linktype";
String linkFileField = "linkfile";
String linkPageField = "linkpage";
String linkDisplayField = "linkdisplay";
String linkSeqField = "linkseq";
String appendOther="";
if (linkoptions.indexOf(",noseq,") != -1) linkSeqField = ""; //seq number suppressed
String linkId = rz.fetch( listModule, linkIdField, "raw" );
if (rz.editaction.equals("create")) linkId = "-1";
if(!isRTE)
linkType = rz.fetch( listModule, linkTypeField, "raw" );
String linkPageRaw = rz.fetch( listModule, linkPageField, "raw" );
String linkPage = StringUtils.convertStringForSource(linkPageRaw);
// If mega-menu
if (linkPageRaw.equals("revize_mega_menu"))
linkType = "template";
// If it's a url link and a revize managed page
if(linkType.equals("urltemplate"))
{
String linkurl = rz.gettemplateinstanceurl(linkPageRaw,"",new Integer(linkId).intValue());
// Aray started
if (rz.fieldtype( listModule, "other" ) != -1)
{
appendOther = rz.fetch( listModule, "other", "" ).trim();
linkurl = linkurl + appendOther;
}
// Aray finished
linkPage = StringUtils.convertStringForSource(linkurl);
linkType = "url";
}
else if(linkType.equals("url") && !urlModule.equals(""))
{
String linkurl = rz.gettemplateinstanceurl(templateLabel,urlModule,new Integer(urlRecord).intValue());
linkPage = StringUtils.convertStringForSource(linkurl);
}
else if(isRTE && linkType.equals("url"))
{
linkPage = StringUtils.convertStringForSource(href);
}
//----- if existing template link, no other link type choices are displayed
else if(linkType.equals("template"))
{
isExistingTemplate = true;
linkoptions = ",template,";
}
// link reference file retrieved in XMLform field
String linkDisplay = rz.fetch( listModule, linkDisplayField, "raw" );
linkDisplay = StringUtils.convertStringForSource(linkDisplay);
String linkFilename = rz.fetch( listModule, "linkfilename", "raw" );
String linkRTE = rz.fetch( listModule, "linkrte", "raw" );
if (linkRTE.indexOf("Unknown Field") != -1) linkRTE="";
String linkStatus = "";
//TODO: linkStatus is new field needed for future rollback when RTE is canceled
//linkStatus = rz.fetch( listModule, "linkstatus", "raw" );
String linkLevel = rz.fetch( listModule, "linklevel", "raw" );
String linkParent = rz.fetch( listModule, "linkparent", "raw" );
String linkTarget = rz.fetch( listModule, "linktarget", "raw" );
String linkSortKey = ""; //original value used to populate form field
if (rz.isvalidfield(listModule,"linksortkey"))
{
rz.fetch( listModule, "linksortkey", "raw" ).trim();
if (!rz.nodata) linkSortKey = rz.content;
}
String linkSectionId = "";
String linkToSectionId = "0";
String sectionFolder = "";
if (rz.isvalidfield(listModule,"linksectionid"))
{
linkSectionId = rz.fetch(listModule,"linksectionid","raw,report");
if (rz.isvalidfield(listModule,"linktosectionid"))
{
linkToSectionId = rz.fetch(listModule,"linktosectionid","raw,report");
if (rz.editaction.equals("update")
&& linkType.equals("template")
&& !linkLevel.equals("0")
&& !linkSectionId.equals("0")
&& linkToSectionId.equals("0"))
rz.setTrace( "Warning: linktosectionid should not be zero\n"
+ " unless linksectionid is not zero.\n"
+ "Contact your Revize Administrator.");
}
//----- Get sections folder if field defined
if (rz.isvalidfield("sections","folder"))
{
rz.fetch("sections","folder","raw,report","sections.sectionid="+linkSectionId);
if (rz.nodata)
rz.setTrace("No section properties found (sectionid="+linkSectionId+").");
else
sectionFolder = rz.content.trim();
}
}
//----- Get the parent as defined in the webspace_permissions_table
String repair_page_key = "";
String repair_parent_key = "";
if (rz.editaction.equals("update")
&& rz.permissions_module.length() > 0
&& !linkPage.equals(""))
{
repair_page_key = linkPageRaw + "[" + linkId + "]";
String repair_where = rz.permissions_module+".page_key=" + repair_page_key;
rz.fetch(rz.permissions_module,"parent_key","raw",repair_where);
if (!rz.nodata) repair_parent_key = rz.content;
// For urltemplate, breadcrumb parent is the real template's linkparent
if (linkType.indexOf("urltemplate") == 0)
{
String repair_options = "raw,report,recordid=" + linkId;
repair_parent_key = rz.fetch(rz.pagemodule,"linkparent",repair_options);
}
}
//----- Get list of templates
rz.string = StringUtils.getParameter(request,"linktemplate");
String [] linkTemplates = StringUtils.split(rz.string,",");
for (int i=0; i<%@ include file="/util/setup_editform_javascript.jsp" %>
<% if(usePathFilename){%>
<%}//end usePathFilename%>
<% if (linkoptions.indexOf(",template,") != -1){%>
Starting a new section creates a new folder for the page created by this link.
All subsequent links created under this link will reside in the new folder.
New sections also reset the left navigation which means a new set of links can
be created on the new page and any pages created under this link until another
new section is created. This option can not be changed once the link is created.