<% String VERSION = "07-24-2012"; boolean numberoflevelsActive = true; String linkplacementFields = "linkplacement,linklocation"; //TODO: not yet used int offset = 0; %><%-- __________________________________________________________________________________________ Revize multi-level menu manager Parameters are passed on url as jsp arguments. All parameters are optional. ---------- Parameters: ---------- onoff on or off; if specified, sets publishing to specified value (no changes made to publishing status if not supplied) pageid link manager recordid of currently selected page (default is none) sectionid sectionid of menu to operate on sectionname sectionname to retrieve ??? sectionsfilter filter used to read sections module; if not specified, sections module is not processed linksfilter filter used to select links records (default uses sectionid argument) if contains "::", template filter is before & Menu Manager is after linkmodule name of link module containing menu (default is links) displaylevel number of menu levels always displayed (default is 1) toplevel lowest level menu item displayed (default is 0) bottomlevel highest level menu item displayed (default is 99) (custom portal code if sectionsfilter supplied - see code) sortfield indicates field to use for sorting (default is linkseq) folder folder for new pages or one of the following methods of determining: *none* or / Does not use (folder can be specified in link manager) *prompt* prompts for foldername when new level created default Determines from sections module or parent link item prompts if folder can not be determined for new page TODO: Ideally prompt should be in link manager only if template link filelocation folder for uploaded documents (default /uploads) if starts with / it specifies an absolute location from channel folder appended to page folder when it does not start with slash (TODO: currently always set to "uploads") linknewsection list of templates that can create new sections (rz:link attribute) *all* if any template can create a new section *none* No new sections allowed *prompt* prompts if link will create a new section BEFORE calling the link manager list of templates that permit a new section (preceed template name with * if new section is default) linkoptions specifies options passed to link manager. Examples: (none, template, url, file) newpagebutton specifies when new page button should appear as follows: before only appears before items at same level (default) after only appears after items at same level both appears before and after same level items number if positive only appears at bottom if the number of items is equal or greater than number Note: The new subpage (which STARTS a new level) will always appear only once after the item under which the sub pages will be created. TODO: get code from rochester hills; upgrade and merge popupwidth width of next url editform popuphieght hieght of next url editform nexturl follow on edit form passed to link manager templates if specified, list of available templates (default is all) showsectionids if true, display linksectionid & linktosectionid (default false) showrecordid if true, display recordid (default false) showplacement if true, display linkplacement or linklocation(default false) showparentid if true, display linkparentid(default false) showparentkey if true, display linkparent (default false) showpagekey if true, display page permissions pagekey (default false) showsortkey if true, display linksortkey calculated by rz.menusort (default false) showlevel if true, display linklevel (default false) showstyle if true, display linkstyle calculated by rz.menusort (default false) showhidden if true, display hidden links as calculated by rz.menusort (default false) showorphan if true, display orphan links as calculated by rz.menusort (default false) showbuttons if true, display new, edit and delete button (default true) showdebug if true, display debugging information (default false) showconsole if true, display detailed debugging information (default false) repair if true, sets RZ.repair to true for link manager (default false) auto if true, automatically edit next menu item (default false) used to update link manager and page permission databases linkmanagertest if true, use test linkmananger_select.work.jsp NOTES: RZ.set value from edit this list button is passed to link manager on new and edit buttons. Correct linkparentid=0 and linklevel=0 when linksectionid>0 (Build 189) *********************************************************************** TODO: review lines containing "custom portal code" for non-portal usage *********************************************************************** __________________________________________________________________________________________ --%><%-- #BeginRZ-PageHeader --%><%@ page language="java" %><%@ include file = "/util/setup_editlist_header.jsp" %><%-- #EndRZ-PageHeader --%> <% //rz.pageoptions = "cache"; %> <%-- #RevizeProperties USE REVIZE MENU (DOCUMENT PROPERTIES) TO EDIT DATA BELOW: status=edit options=@@options@@ server=cms3.revize.com projectName=atwatercountynewdemo label= location=webspace_links-editlist.jsp version= docType=editpage subType=list moduleName= fieldName= channels=| description= --%> <%@ page import="revize.data.*,revize.publish.*,revize.store.*" %> <% try { %> Revize Multi-level Menu: <%=rz.webspace%> <%! String linkmodule = ""; String[] linkrecords = new String[99]; String[] linkdisplays = new String[99]; String folder = ""; boolean showconsole = false; String debugMsg = ""; void showlistitems(RZTagSupport rz) { rz.revize_list_save(rz, "menulist"); for (int i=0;i <%@ include file="/util/setup_editlist_javascript.jsp" %>
Menu Manager
<% String onoff = request.getParameter("onoff"); if (onoff != null) { boolean onoffValue = Boolean.valueOf(onoff).booleanValue(); PublishingEngine.getInstance(rz.webspace).setAcceptingPublishEvents(onoffValue); } boolean showsectionids = ( StringUtils.getParameter(request,"showsectionids").equals("true") ); boolean showrecordid = ( StringUtils.getParameter(request,"showrecordid").equals("true") ); boolean showplacement = ( StringUtils.getParameter(request,"showplacement").equals("true") ); boolean showparentid = ( StringUtils.getParameter(request,"showparentid").equals("true") ); boolean showparentkey = ( StringUtils.getParameter(request,"showparentkey").equals("true") ); boolean showpagekey = ( StringUtils.getParameter(request,"showpagekey").equals("true") ); boolean showsortkey = ( StringUtils.getParameter(request,"showsortkey").equals("true") ); boolean showlevel = ( StringUtils.getParameter(request,"showlevel").equals("true") ); boolean showstyle = ( StringUtils.getParameter(request,"showstyle").equals("true") ); boolean showhidden = ( StringUtils.getParameter(request,"showhidden").equals("true") ); //default false boolean showorphan = ( StringUtils.getParameter(request,"showorphan").equals("true") ); boolean showbuttons = ( !StringUtils.getParameter(request,"showbuttons").equals("off") ); //default true boolean showdebug = ( StringUtils.getParameter(request,"showdebug").equals("true") ); showconsole = ( StringUtils.getParameter(request,"showconsole").equals("true") ); boolean repair = ( StringUtils.getParameter(request,"repair").equals("true") ); boolean auto = ( StringUtils.getParameter(request,"auto").equals("true") ); boolean linkmanagertest = ( StringUtils.getParameter(request,"linkmanagertest").equals("true") ); String menu_system = rz.config("menu_system"); boolean isWebGen = rz.isvalidmodule("webgen_admin"); if (rz.isvalidmodule("webspace_config") && (menu_system.equals("") || menu_system.indexOf("webgen") != -1)) isWebGen = true; String sectionidfield = ""; linkmodule = StringUtils.getParameter(request,"linkmodule"); if (linkmodule.equals("")) linkmodule="links"; String sectionid = StringUtils.getParameter(request,"sectionid"); //if (sectionid.equals("")) sectionid="0"; String sectionname = StringUtils.getParameter(request,"sectionname"); String sectionsfilter = StringUtils.getParameter(request,"sectionsfilter"); // if filter before and after :: use filter after String linksfilter = StringUtils.getParameter(request,"linksfilter"); String linksfilterOrig = linksfilter; offset = linksfilter.indexOf("::"); if (offset != -1) linksfilter = linksfilter.substring(offset+2); String filelocation = StringUtils.getParameter(request,"filelocation"); String pageid = StringUtils.getParameter(request,"pageid"); pageid = rz.getmenurecordid(pageid); String displaylevel = StringUtils.getParameter(request,"displaylevel"); int toplevel = StringUtils.toInt(StringUtils.getParameter(request,"toplevel"),-1); int bottomlevel = StringUtils.toInt(StringUtils.getParameter(request,"bottomlevel"),-1); //if (!numberoflevelsActive) //{ if (toplevel < 0) toplevel = 0; if (bottomlevel < 0) bottomlevel = 99; //} int numberoflevels = StringUtils.toInt(request.getParameter("numberoflevels"),1); String sortfield = StringUtils.getParameter(request,"sortfield"); if (sortfield.equals("")) sortfield="linkseq"; String templates = StringUtils.getParameter(request,"templates"); String linknewsection = StringUtils.getParameter(request,"linknewsection"); if (linknewsection.equals("") && !repair) //do not default in repair mode linknewsection = rz.config("menu_newsection"); String linkoptions = StringUtils.getParameter(request,"linkoptions"); if (linkoptions.equals("")) linkoptions = "none,template,url"; String popupwidth = StringUtils.getParameter(request,"popupwidth"); String popuphieght = StringUtils.getParameter(request,"popuphieght"); // uncommented: may cause issues for old sites (DCO version 188a) if (isWebGen) { // custom portal code for top nav levels linknewsection = "content"; if (sectionsfilter.length() > 0) linknewsection = "*all*"; //force newsection=yes for top nav } // custom portal code for top nav levels if (bottomlevel < 99) { if (StringUtils.toInt(sectionid) <= -3) bottomlevel = 0; else if (StringUtils.toInt(sectionid) < 0) bottomlevel = 1; } folder = StringUtils.getParameter(request,"folder"); if (!folder.equals("") && !folder.equals("/") && !folder.equals("*none*") && !folder.equals("*prompt*")) { if (folder.startsWith("/")) folder = folder.substring(1); folder = StringUtils.toFilename(folder,"folders"); } String nexturl = StringUtils.getParameter(request,"nexturl"); if (nexturl.equals("")) nexturl = rz.config("menu_nexturl"); %> <% Iterator itr; int displayedItems = 0; String selectedParentHash = ""; int columns_before_display = 0; //----- Check for required parameters, modules and field String errorMsg = ""; boolean isPublishing = PublishingEngine.getInstance(rz.webspace).isAcceptingPublishEvents(); if (!rz.isvalidmodule(linkmodule)) errorMsg += "
" + linkmodule + " module does not exist " + "(default is links) use \"linkmodule\" parameter on url to specify different module"; else { // Validate required fields String fieldMsg = ""; if (!rz.isvalidfield(linkmodule,"linkdisplay")) fieldMsg += ", " + "linkdisplay"; if (!rz.isvalidfield(linkmodule,"linkparent")) fieldMsg += ", " + "linkparent"; if (!rz.isvalidfield(linkmodule,"linkparentid")) fieldMsg += ", " + "linkparentid"; if (!rz.isvalidfield(linkmodule,"linklevel")) fieldMsg += ", " + "linklevel"; if (!rz.isvalidfield(linkmodule,"linkstyle")) fieldMsg += ", " + "linkstyle"; if (!rz.isvalidfield(linkmodule,"linksortkey")) fieldMsg += ", " + "linksortkey"; if (fieldMsg.length() > 0) errorMsg += "
" + linkmodule + " module does not contain the following required field(s): " + fieldMsg.substring(2); if (rz.isvalidfield(linkmodule,"linksectionid")) sectionidfield = "linksectionid"; else if (rz.isvalidfield(linkmodule,"sectionid")) //backward compatiblity sectionidfield = "sectionid"; if (sectionid.length() > 0 || sectionsfilter.length() > 0) { if (sectionidfield.equals("")) errorMsg += "
sectionid url parameter specified but " + linkmodule + " module does not contain linksectionid field"; } if (errorMsg.length() == 0 && !isPublishing) errorMsg = "Publishing is Disabled"; } // display message if (errorMsg.length() > 0) { %>
<%=errorMsg%>
<% } %>
<% if (showsectionids) { %> <% columns_before_display += 3; %> <% } %> <% if (showrecordid) { %> <% columns_before_display += 4; %> <% } %> <% if (showplacement) { %> <% columns_before_display++; %> <% } %> <% if (showparentid) { %> <% columns_before_display++; %> <% } %> <% if (showparentkey) { %> <% columns_before_display++; %> <% } %> <% if (showpagekey) { %> <% columns_before_display++; %> <% } %> <% if (showlevel) { %> <% columns_before_display++; %> <% } %> <% if (showbuttons) { %> <% columns_before_display++; %> <% } %> <% if (showstyle) { %> <% } %> <% int pos = 0; debugMsg = ""; //clear class variable; String filter = ""; String options = "deletedrecords"; //may be canceled in filter logic below HashMap linkseqMap = new HashMap(); if (linksfilter.length() > 0 && !linksfilter.equals("*none*")) { filter = linksfilter; //----- Prepend linkrte filter with AND if (filter.indexOf("linkrte") == -1) { if (filter.length() > 0) filter = "linkrte!=X and " + filter; else filter = "linkrte!=X"; } } else if (isWebGen) //Below is some what custom portal code { // filter used when NOT top nav // do not allow top nav if home page (sectionid==0) if (sectionid.length() > 0) filter = sectionidfield + "=" + sectionid; //only this section links... if (!sectionid.equals("0") //...or top nav pointing to this section && rz.isvalidfield(linkmodule,"linktosectionid")) { if (rz.isvalidfield(linkmodule,"linktosectionid")) filter += " or linktosectionid=" + sectionid; //plus pointed to section if (rz.isvalidfield(linkmodule,"rootsectionid")) filter += " or rootsectionid=" + sectionid; //plus root section } // include rte links (override default for linkrte) and omit top nav filter = "linkrte!=X and linksectionid>=0 and (" + filter + ")"; // allow all RTE & non-RTE links when section not specified if (sectionid.equals("")) filter = "linkrte!=X"; // filter and options used for top nav if (StringUtils.sub(sectionid,0,1).equals("-")) { filter = sectionidfield + "=" + sectionid; if (!showdebug) options = ""; //no deleted records } } else { //----- If sectionid specified, use for filter if (sectionid.length() > 0) { filter = sectionidfield + "=" + sectionid; //only this section links... if (rz.isvalidfield(linkmodule,"linktosectionid")) { if (rz.isvalidfield(linkmodule,"linktosectionid")) filter += " or linktosectionid=" + sectionid; //plus pointed to section if (rz.isvalidfield(linkmodule,"rootsectionid")) filter += " or rootsectionid=" + sectionid; //plus root section if (pageid.length() > 0) filter += " or linkparentid=" + pageid; //plus current selection children } if (filter.length() > 0) filter = "(" + filter + ")"; } //----- Prepend linkrte filter with AND if (filter.indexOf("linkrte") == -1) { if (filter.length() > 0) filter = "linkrte!=X and " + filter; else filter = "linkrte!=X"; } } String newPageId = "0"; if (StringUtils.sub(sectionid,0,1).equals("-")) newPageId = "-999"; boolean isEditOnlyNote = false; boolean isThisPageNote = false; boolean isRteLinkNote = false; boolean isCenterListNote = false; boolean isLastPageNote = false; boolean isNextPageNote = false; boolean isDeletedNote = false; boolean haveItem = false; boolean isEmbeddedLink = false; boolean isHomeSection = false; int noLinks = 0; if (numberoflevelsActive) options = "numberoflevels=" + numberoflevels + "," + options; %> <%@ page import = "revize.taglib.content.*" %> <% if (numberoflevelsActive && rz.listlength > 0) { toplevel = rz.listminlevel; bottomlevel = rz.listmaxlevel; //toplevel=0; //bottomlevel=99; } if (showconsole) { debugMsg += "filter=" + filter + "\n"; debugMsg += rz.listlength + " items after rz:list\n"; showlistitems(rz); } //----- get prior forceparentid if not first call to menu manager String forceparentid = ""; String RZeditListReturnUrl = rz.getcookie("RZeditListReturnUrl"); if (session.getAttribute("RZmenucaller") != null && (session.getAttribute("RZmenucaller")+"").equals(RZeditListReturnUrl)) { forceparentid = (String)session.getAttribute("RZmenuforceparentid"); } else { session.setAttribute("RZmenucaller",RZeditListReturnUrl); session.setAttribute("RZmenuforceparentid",forceparentid); } //----- process menu items String menuopts = "sectionid=" + sectionid + ",pageid=" + pageid + ",displaylevel=" + displaylevel + ",sortfield=" + sortfield // + ",nokeeprte" //comment to disable keeping top level rte links /* * webspace_menu-editlist.js version 189 * Automatically include parent record when excluded by list filter * * Prior versions of menu manager could create child links with both * linkparentid=0 and linklevel=0 because the parent link was excluded * by the filter. This option now derives the linkparentid & linklevel * from the linksectionid. In order to get the "new page" button to * appear it was then necessary to set toplevel=0 and bottomlevel=0. * This options also now returns updated values consistant with the * derived linklevel values. */ + ",forceparent" //comment to disable logic as explained above + ",forceparentid=" + forceparentid + ",toplevel=" + toplevel + ",bottomlevel=" + bottomlevel + ""; //if linkrte in specified filter, show them (may need parameter to over-ride this assumption) if (filter.indexOf("linkrte") != -1) menuopts += ",showrte"; if (showorphan) menuopts += ",showall"; else if (!showhidden) menuopts += ",omithidden"; if (showconsole) debugMsg += "menuopts: " + menuopts + "\n"; rz.menusorter(menuopts); session.setAttribute("RZmenuforceparentid",rz.menu.forceparentid); // when linkparentid=0 and linklevel=0 and linksection>0 call to menu-editlist // had to specify toplevel=0 and bottomlevel=0 to get new page button to appear. // Below resets to these the highest values of active links other than sectionhome // pages and the corrected levels when both set to 0 as described above. if (rz.menu.levelschanged) { toplevel = rz.menu.toplevel; bottomlevel = rz.menu.bottomlevel; } HashMap menuStyle = rz.menu.menuStyle; HashMap lastpage = rz.menu.lastpage; HashMap nextpage = rz.menu.nextpage; /* old calling formats; keep for testing backward compatibility of menusorter() //Object[] menuProperties = rz.menusort(rz.listRecords,pageid,displaylevel); Object[] menuProperties = rz.menusort("pageid=" + pageid + ",displaylevel=" + displaylevel); HashMap menuStyle = (HashMap)menuProperties[0]; HashMap lastpage = (HashMap)menuProperties[3]; HashMap nextpage = (HashMap)menuProperties[4]; */ String style = ""; String stylePriorItem = ""; String styleReturn = ""; int indentlevel = 0; int menu_level = -1; //initialize with or w/o any links int next_level = 1; //skip next level new button int linklevel = 0; boolean[] selected_level = new boolean[99]; for (int i=0; i<99; i++) selected_level[i] = false; String linkdisplay = ""; String linkrte = ""; String linktype = ""; String linkurl = ""; Record record = null; String recordid = ""; String linkid = ""; int parentid = 0; int linkparentid = 0; String linkpage = ""; String linkpageid = ""; String linkseq = ""; String linksectionid = ""; String linktosectionid = ""; String rootsectionid = ""; String linkfilename = ""; String linkpathname = ""; String linkplacement = ""; RZTagSupport.LinkProperties linkProperties = null; String pagekey = rz.permissions_parent; String prior_pagekey = ""; String linkfolder = ""; if ( linkoptions.indexOf("activeurl") == -1 ) linkoptions = "activeurl," + linkoptions; if ( !sortfield.equals("linkseq") ) linkoptions += ",noseq"; String[] linkparentids = new String[99]; String[] linksectionids = new String[99]; String[] linktosectionids = new String[99]; String[] linkpathnames = new String[99]; boolean showButton = false; String showReason = ""; noLinks = rz.listlength; //may not be accurate, if showall or hidden links displayed //----- loop through all menu items plus 1 extra pass to close levels if (showconsole) { debugMsg += rz.listlength + " items after menusorter" + " (check show hidden and show all to view)\n\n"; //showlistitems(rz); //think these show if hidden and show all checked debugMsg += "" + " folder=" + folder + " filelocation=" + filelocation + "\n" + " linkTopLevel=" + rz.menu.linkTopLevel + " linkMinLevel=" + rz.menu.linkMinLevel + " linkMaxLevel=" + rz.menu.linkMaxLevel + "\n" + "\n-----------------------------------------------" + "\n WHILE LOOP" + "\n-----------------------------------------------" + "\n"; } %> <% while (rz.listnext() || rz.listindex <= rz.listlimit+1) { //----- Get data for this link item (unless last pass to add bottom new button) // TODO: consider reseting on last pass when outside array bounds however // some logic may expect the most recent value for some varibles. if (rz.listindex>=0 && rz.listindex <= rz.listlimit) { %> <% record = rz.record; recordid = rz.recordid; linkdisplay = rz.content; linktype = rz.linktype; linkurl = rz.url; linkProperties = (RZTagSupport.LinkProperties)rz.menu.linkProperties.get(rz.recordid); // Run here to set initial properties (options, templates, etc) // (newsection, linkpathname and filelocation may be updated) %><% linkplacement = ""; if (rz.isvalidfield(linkmodule,"linkplacement")) linkplacement = rz.fetch(rz.listmodule,"linkplacement","report"); else if (rz.isvalidfield(linkmodule,"linklocation")) linkplacement = rz.fetch(rz.listmodule,"linklocation","report"); if (sectionidfield.length() > 0) linksectionid = rz.fetch(rz.listmodule,sectionidfield,"report"); if (rz.isvalidfield(linkmodule,"linktosectionid")) linktosectionid = rz.fetch(rz.listmodule,"linktosectionid","report"); if (rz.isvalidfield(linkmodule,"rootsectionid")) rootsectionid = rz.fetch(rz.listmodule,"rootsectionid","report"); linklevel = StringUtils.toInt( rz.fetch(rz.listmodule,"linklevel","report") ); linkid = rz.fetch(rz.listmodule,"linkid","report"); linkseq = rz.fetch(rz.listmodule,"linkseq","report"); linkparentid = StringUtils.toInt( rz.fetch(rz.listmodule,"linkparentid","report") ); linkpage = rz.fetch(rz.listmodule,"linkpage","report"); linkpageid = rz.fetch(rz.listmodule,"pageid","raw"); if (rz.nodata) linkpageid = "0"; linkfilename = rz.fetch(rz.listmodule,"linkfilename","raw"); pos = linkfilename.lastIndexOf("/"); if (pos == -1) linkpathname = ""; else linkpathname = linkfilename.substring(0,pos); prior_pagekey = pagekey; pagekey = "[" + recordid + "]"; //none or file type if (linktype.indexOf("template") != -1) //if template type { if (linktype.indexOf("urltemplate") != -1) //urltemplate { //use recordid as option to get deleted records rz.fetch(rz.listmodule,"linkpage","_recordid=" + linkid); if (rz.content.trim().length() > 0) linkpage = rz.content; } if (linkid.equals("-999")) //unique pagekey = linkpage + "[]"; else //dependent pagekey = linkpage + "[" + linkid + "]"; } if (rz.tracestack.length() > 0) break; //quit if errors reported } //----- Get prior level parentid (set to 999 if top level) parentid = 0; if (linklevel > 0 && linkrecords[linklevel-1] != null) parentid = StringUtils.toInt(linkrecords[linklevel-1]); if (parentid == 0) parentid = 999; if (showconsole) { String display = rz.listindex < 0 ? " "+ rz.listindex : StringUtils.right("000"+rz.listindex,3); debugMsg +="\n---------------------------------------------------------------------" + "\n" + linkdisplay + "\n---------------------------------------------------------------------" + "\nlistindex: " + display + " rec(" + StringUtils.right("000"+rz.listitemid(),3) +") " + " menu_level=" + menu_level + "\n parentid=" + parentid + " linkparentid=" + linkparentid + " linkpageid=" + linkpageid + "\n"; } if (!style.equals("")) stylePriorItem = style; if (rz.listindex < 0 || rz.listindex > rz.listlimit) { style = ""; //keeps item from displaying linklevel = 0; linkparentid = 0; } //**************************************************************** // Througly test when no menu items pass filter or test below // New button must appear so we can't execute break; //**************************************************************** else if ( sectionid.length() > 0 //sectionid url argument exists /* new menusort call format && !showorphan && !showorphan && !sectionid.equals(linksectionid) //link not created on this page && !sectionid.equals(linktosectionid) //link does not point to this page && !sectionid.equals(rootsectionid) && !linkOptions.equals("parent") //not placed on last page && !linkOptions.equals("child") //not placed on next page */ /* old menusort call format */ && !showorphan && !sectionid.equals(linksectionid) //link not created on this page && !sectionid.equals(linktosectionid) //link does not point to this page && !sectionid.equals(rootsectionid) && lastpage.get(rz.listitemid())==null //not placed on last page && nextpage.get(rz.listitemid())==null //not placed on next page //&& parentid != linkparentid //parent not displayed on this page ) { //then skip this item if (showconsole) { debugMsg +="skip: sectionid=" + sectionid + " linksectionid=" + linksectionid + " linktosectionid=" + linktosectionid + "\n"; } style = ""; //keeps item from displaying if (rz.listindex == rz.listlimit && rz.listlimit > 0) rz.listindex++; //bump loop counter if not at beg or end if (haveItem) continue; //can not continue if new button not displayed } else { style = (String)menuStyle.get(rz.listitemid()); if (style == null) style = "menuUnknown"; styleReturn = style; linkrte = rz.fetch(rz.listmodule,"linkrte","raw"); indentlevel = Math.max(linklevel-rz.menu.linkTopLevel,0); //DCO version 189 //indentlevel = linklevel; // '' //if (toplevel > 0) indentlevel = indentlevel-toplevel+1; // '' if (style.equals("menuOrphan")) indentlevel = 0; if (style.equals("menuHidden") && !showhidden) style=""; if (style.equals("menuOrphan") && !showorphan) style=""; if (style.equals("menuSelectedParent")) // && selectedParentHash.equals("")) selectedParentHash = recordid; linkrecords[linklevel] = recordid; //remember parent recordid linkdisplays[linklevel] = linkdisplay; //remember last item encountered } // link tag below used to define link manager properties including default folder // and page permission inheritance for buttons. // link tag needed here when no items; otherwise only call when items are visible // to prevent reset permission properties for hidden items. if (rz.listlimit < 0) { %> <% } linkparentids[linklevel] = new Integer(linkparentid).toString(); linksectionids[linklevel] = linksectionid; linktosectionids[linklevel] = linktosectionid; linkpathnames[linklevel] = linkpathname; if (showconsole) { debugMsg +="\nlinklevel: " + linklevel + " linksectionids:" + linksectionids[linklevel] + " linktosectionids:" + linktosectionids[linklevel] + " linkpathnames:" + linkpathnames[linklevel] + "\n"; } //----- Determine next level if (rz.listindex < rz.listlimit && !styleReturn.equals("menuOrphan")) next_level = StringUtils.toInt(rz.groupnextvalue,-1); else next_level = -1; //move all the way up if (showconsole) { debugMsg +="next_level:" + next_level + " style:" + styleReturn + " displayed:"+(style.length()>0) + "\n"; } %> <% //----- If moving down a level if (menu_level < linklevel && rz.listindex <= rz.listlimit) { // prior level folder (errors reported when button clicked) int tempLevel = menu_level; String tempFolder = ""; if (tempLevel >= 0) tempFolder = linkpathnames[tempLevel]; linkfolder = getFolder(rz,menu_level,tempFolder,"new"); if (showconsole) { debugMsg +="\nmove down("+(menu_level)+" --> "+linklevel + "): StylePriorItem:" + stylePriorItem + "\n" + " folder:" + linkfolder + "\n"; } menu_level = linklevel; // remember next level showButton = false; showReason = ""; if (menu_level == 0 || stylePriorItem.equals("menuSelectedItem") || stylePriorItem.equals("menuSelectedParent")) showButton = true; else if (stylePriorItem.equals("")) showReason += " only shows before first link if level 0 \n"; else showReason += " prior link not selected and link level not 0\n"; if (menu_level < toplevel || menu_level > bottomlevel) { showButton = false; showReason += " menu_level("+menu_level+") < toplevel("+toplevel+") or > bottomlevel("+bottomlevel+")\n"; } if (sectionid.equals("-999")) { showButton = false; showReason += " sectionid=-999 \n"; } // If Section Home (i.e. link not created on this page) if (sectionid.length() > 0 && !sectionid.equals(linksectionid)) { showButton = false; showReason += " section home link \n"; } if (showButton) { selected_level[menu_level] = true; String alt = "Create New Item at same level "; if (menu_level == 0) alt += "(TOP) "; alt += "as:\\n" + StringUtils.encodeSpecialChars(linkdisplays[menu_level]) + " (level " + menu_level + ")"; %> <%-- // TODO: A current behavior observed on henderson is that new buttons at the same // level do not appear when first link is a "child page" (i.e. created on the parent // link page as opposed to being created on the page that called menu-editlist) // This is a desirable behavior for the henderson menu system because when children // are added on page that called menu-editlist (e.g. departments), the parent link // converts to a title link (i.e. it is not active and only shows children) // DCO 06-25-2009: removed script that called RZlinkmanager() see notes below --%> <% if (showstyle) { %> <% } %> <% if (false) { //fake out DW; add TD that spans all the potentially hidden columns %> <% } %> <% } // end showButton if (showconsole && !showButton && showReason.length() > 0) { debugMsg += "\n" + "new button (same level): NOT shown for reasons below:\n" + showReason; } } // end of moving down a level /////////////////////////// START OF VALID MENU ITEM //////////////////////////// if (!style.equals("") && rz.listindex >= 0 && rz.listindex <= rz.listlimit) { haveItem = true; displayedItems++; //if (showconsole) debugMsg += " Valid Link:" + linkdisplay + "\n"; %> <% if (showsectionids) { %> <% } %> <% if (showrecordid) { %> <% } %> <% if (showplacement) { %> <% } %> <% if (showparentid) { %> <% } %> <% String pagekeyDisplay = pagekey; String permissions_parentkey = "*"; if (showparentkey || showpagekey) { if (pagekey.length() == 0) pagekeyDisplay = "...N/A..."; else { permissions_parentkey = rz.fetch("webspace_page_permissions","parent_key","","page_key="+pagekey); if (rz.nodata || permissions_parentkey.trim().length() == 0) pagekeyDisplay += " ?"; } } %> <% if (showparentkey) { %> <% } %> <% if (showpagekey) { %> <% } %> <% if (showlevel) { %> <% } %> <% if (showbuttons) { %> <% } //end button column %> <% if (showstyle) { %> <% } %> <% showButton = false; showReason = ""; // next level is not same as this level and this item selected if (menu_level >= next_level && style.equals("menuSelectedItem")) showButton = true; else if (menu_level < next_level) showReason += " menu_level < next_level \n"; else if (!style.equals("menuSelectedItem")) showReason += " link not selected \n"; // center list (TODO: probably only applicable to webgen) if (isWebGen && menu_level >= toplevel //not current page && !linkpageid.equals("0") //not left nav && !linkpageid.equals("-999")) //not top nav { showButton = false; //must be center list showReason += " menu_level >= toplevel and linkpageid not 0 or -999 (webgen)\n"; } // embedded link does not show new button unless top level link if (linkrte.equals("yes") && !linkProperties.keepRTE && new Integer(linkProperties.level).intValue()==rz.menu.linkTopLevel) { showButton = false; showReason += " RTE link: linkrte==yes \n"; } // Don't show the next level new button on next page items. if (sectionid.length() > 0 && !sectionid.equals(linksectionid) //link not created on this page && !sectionid.equals(linktosectionid) //and not a link to this page && parentid == linkparentid) //and parent displayed on this page { showButton = false; //so "Last Page" or "Next Page" link showReason += " RTE link: linkrte==yes \n"; } /* TODO: not sure why this was added - may omit new button somewhere // linkto another section and not top nav if (!linktosectionid.equals(sectionid) && !StringUtils.sub(sectionid,0,1).equals("-")) showButton = false; */ // outside of top and bottom level ranges if (menu_level < (toplevel-1) || menu_level >= bottomlevel) { showButton = false; showReason += " menu_level("+menu_level+") < toplevel("+toplevel+") or > bottomlevel("+bottomlevel+")\n"; } if (showconsole && !showButton && showReason.length() > 0) { debugMsg += "\n" + "new button (next level): NOT shown for reasons below:\n" + showReason; } if (showButton) { // folder errors reported when new button clicked int tempLevel = linklevel; String tempFolder = ""; if (tempLevel >= 0) tempFolder = linkpathnames[tempLevel]; linkfolder = getFolder(rz,linklevel,tempFolder,"new"); if (showconsole) debugMsg += "\n" + "new subpage: linklevel=" + linklevel + "\n" + " folder:" + linkfolder + "\n"; //----- Determine parentkey for permissions & newtosectionid for section option String newtosectionid = "0"; //if parent is same as page section... //...let linkmanager define tosectionid if (linknewsection.equals("*none*")) newtosectionid = linktosectionids[linklevel]; if (!linksectionid.equals(linktosectionid)) //link starts new section { linktype = rz.fetch(linkmodule,"linktype","report"); // template or urltemplate if (linktype.indexOf("template") != -1) { //----- On webgen, if this link goes to a new section and it is a template link, // disallow newsection by setting newtosectionid to non-zero. // // This presented too big a challenge for indented links on a page starting // a new section when their parent also started a new section. if (isWebGen) { // if parent is template type, set tosectionid to parent recordid if (linktype.equals("template")) { newtosectionid = recordid; } // if urltemplate, then check referenced template // (leave newtosectionid=0 if template record not found) else { String whereopt = linkmodule + "recordid=" + linkid; rz.fetch(linkmodule,"linktosectionid","report,"+whereopt); newtosectionid = rz.content; } // Leave newtosectionid=0 for any other type of link } } } %> <% if (showstyle) { %> <% } %> <% if (false) { //fake out DW %> <% } %> <% } } //////////////////////////// END OF VALID MENU ITEM ///////////////////////////// //----- While moving up a level (next_level=-1 if this is last item) while (next_level < menu_level) { // folder errors reported when new button clicked int tempLevel = menu_level-1; String tempFolder = ""; if (tempLevel >= 0) tempFolder = linkpathnames[tempLevel]; linkfolder = getFolder(rz,menu_level-1,tempFolder,"new"); if (linkseq.length() > 0) linkseqMap.put(linklevel+"",new Integer( (int)(Float.parseFloat(linkseq)+1.5)) ); if (showconsole) { debugMsg +="\nmoving up("+menu_level+" --> "+ (menu_level-1) +"): rec(" + recordid + ") next_level:" + next_level + "\n" + " folder:" + linkfolder + "\n"; } showButton = false; if (haveItem && (menu_level == 0 || selected_level[menu_level])) showButton = true; if (menu_level < toplevel || menu_level > bottomlevel) showButton = false; if (showButton) { String alt = "Create New Item at "; if (menu_level == 0) alt += "TOP "; alt += "(" + linkdisplays[menu_level] + ") Level " + menu_level; selected_level[menu_level] = false; %> <% } menu_level--; // reduce group level } // end while menu_level > 0 %> <% if (rz.listindex >= rz.listlimit) rz.listindex++; //bump counter on last & extra pass } // end rz:list while %> <% if (false) { //fake out DW %> <% if (showstyle && false) { //should be needed but messes up when showstyle is true%> <% } %>
sectionid <% if (rz.isvalidfield(linkmodule,"linktosectionid")) { %>
tosectionid <% } %>
recordid
linkid
linkplacementparentidlinkparent
(LM module)
pagekey
(derived)
Level1Actions
<%-- #BeginRZ-ActionImage --%> <%-- Option:type=EditListExitImage --%> <%-- Option:forwardURL= --%> <%-- Option:imageSrcURL=/revize/images/edit/exit.jpg --%> <%-- #EndRZ-ActionImage --%>
 style
  <% for (int i=0; i<(indentlevel*2)+1; i++) { %> <% } //----- If newtosectionid is NOT zero, new section option is not available // (this code repeated for other new button at same level) String newtosectionid = linksectionids[linklevel]; //start with this level linksectionid if (menu_level > 0 && linktosectionids[menu_level-1] != null) //if there is a parent record newtosectionid = linktosectionids[menu_level-1]; //parent tosectionid if (!isWebGen || toplevel == menu_level || newtosectionid.equals(sectionid)) //if parent is not a new section... newtosectionid = "0"; //...allow new section option if (showconsole) { if (menu_level > 0) //may be redundant but does not hurt debugMsg +="\nnew button (same level) menu_level:" + menu_level + " parenttosection:" + linktosectionids[menu_level-1] + "\n sectionid:" + StringUtils.sub(sectionid+" ",0,2) + " newtosectionid:" + newtosectionid + "\n"; else debugMsg += " menu_level <= 0 \n"; } %> <%-- #BeginRZ-ActionImage --%> <%-- Option:type=EditListInsertImage --%> <%-- Option:imageSrcURL=/revize/images/edit/newpage_small.jpg --%> <%-- #EndRZ-ActionImage --%>  
       <% if (rz.isvalidfield(linkmodule,"linktosectionid")){ %> <% } %>       <% String tooltip = "linktype: " + linktype + "\nlinkfilename: " + linkfilename + ""; %> <%=recordid%>    <%=linkid%>  <%=linkplacement%> <%=linkparentid%><%=linkProperties.isFixedParentId?"#":" "%><% if (!rz.content.equals(permissions_parentkey) && !permissions_parentkey.equals("*")) { %> ?<% } %> <%=pagekeyDisplay%>  <%=linklevel%><%=linkProperties.isFixedLevel?"#":" "%> <% if (linkrte.equals("yes")) //added by rte { isRteLinkNote = true; %> RTE Link4 <% } else if (isWebGen && menu_level >= toplevel //not current page && !linkpageid.equals("0") //not left nav && !linkpageid.equals("-999")) //not top nav { isCenterListNote = true; %> Center List3 <% } else if (isWebGen && menu_level >= toplevel //&& linkOptions.equals("parent")) && lastpage.get(recordid) != null) { //link created on last page as indented link and must be edited there isLastPageNote = true; %> Parent Page2 <% } //TODO: This is desirable now on non webgen because children do not display // due to sectionid filter. //else if (linkOptions.equals("child")) else if (nextpage.get(recordid) != null) { //link created and only appears on next page and must be edited there isNextPageNote = true; %> Child Page2 <% } else if (sectionid.length() > 0 && !sectionid.equals(linksectionid)) //link not created on this page { //assume points to this page because it is not "Last Page" or "Next Page" isThisPageNote = true; %> Section Home2 <% } // following code added to prevent section home from being edited (DCO version 189) else if (!linksectionid.equals("0") && linklevel == rz.menu.linkTopLevel && !linksectionid.equals(linktosectionid) && recordid.equals(linktosectionid)) { isThisPageNote = true; %> Section Home2 <% } else { // start EDIT button display %> <%-- #BeginRZ-ActionImage --%> <%-- Option:type=EditListEditImage --%> <%-- Option:imageSrcURL=/revize/images/edit/edit_small.jpg --%> <%-- #EndRZ-ActionImage --%> <% if (next_level > linklevel || (rz.menu.linkOwner.get(recordid).equals("parent"))) { // display * footnote delete if lower level (child) items %> Parents with Childen cannot be deleted <% isEditOnlyNote = true; } else { // display active delete if NO lower level items %> <%-- #BeginRZ-ActionImage --%> <%-- Option:type=EditListDeleteImage --%> <%-- Option:forwardURL= --%> <%-- Option:imageSrcURL=/revize/images/edit/delete_small.jpg --%> <%-- #EndRZ-ActionImage --%> <% } // end active delete button %> <% if (rz.isvalidfield(linkmodule,"linkhidden")) { %> <%-- #BeginRZ-ActionImage --%> <%-- Option:type=ForwardEditFormImage --%> <%-- Option:imageSrcURL=/revize/images/edit/eye-open.png --%> <%-- #EndRZ-ActionImage --%> <% } // end invisible %> <% } // end button display %> "> <% for (int i=0; i<(indentlevel*2); i++) { %> <% } String icon = "space"; if (next_level > linklevel //lower level items || rz.menu.linkOwner.get(recordid).equals("parent")) { icon = "plus"; if (showhidden || style.indexOf("SelectedItem") != -1 || style.indexOf("SelectedParent") != -1 ) icon = "minus"; } String deletedFlag = ""; if (record.isMarkedForDeletion() && showdebug) { deletedFlag = "+"; isDeletedNote = true; } %> <% if (sortfield.equals("linkseq")) { %> <%=linkseq%>  <% } %> <%=linkdisplay%><%=deletedFlag%> <% if (showsortkey) { %>
sortkey: <% } %>
 <%=style%>
  <% for (int i=0; i<((indentlevel+1)*2)+3; i++) { %> <% } %> <% String alt = "Create New Item at Next Level (" + (linklevel+1) + ")"; %> <%-- #BeginRZ-ActionImage --%> <%-- Option:type=EditListInsertImage --%> <%-- Option:imageSrcURL=/revize/images/edit/new_subpage_small.jpg --%> <%-- #EndRZ-ActionImage --%>  
<% } else { out.println("");} %> Number in front of each link indicates order links are displayed at that level
(i.e. numbering only applies to links at level shown by indentation)
Click on New button add a link; <% if (haveItem) { %> Click on link name to create or view lower links
<% } %> Click on Exit button when done adding links

NOTES:

<% if (isEditOnlyNote) { %> Parents with Childen cannot be deleted Links with children can not be deleted
<% } %> <% if (isDeletedNote) { %> + These Links are marked as deleted but referenced by a url link
<% } %> <% if (showlevel) { %> 1) Depth within the site of page containing the link (Home page and top nav are level 0)
<% } %> <% if (isThisPageNote || isLastPageNote || isNextPageNote) { %> 2) These links must be edited on the page where they were added
<% } %> <% if (isCenterListNote) { %> 3) These links must be edited from the center of this page
<% } %> <% if (isRteLinkNote) { %> 4) These links must be edited within the Rich Text Editor
<% } %>
 
<% if(!showdebug) { %>
Advanced Options
<% } %>

<% if (showdebug) { %>
<% } %>
<%
} // end entire page try
catch (Exception e)
{
	e.printStackTrace();
	out.print( StringUtils.convertStackTraceToString(e) );
}
%>
<%= rz.tracestack %>
<%= debugMsg %>