<%-- ## menu-editlist.jsp 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) linkmodule- name of link module containing menu (default is links) 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 pageid- link manager recordid of currently selected page (default is none) linksfilter- filter used to select links record (default uses sectionid argument) 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 before 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 appended to page folder for uploaded documents (default uploads) (TODO: currently always set to "uploads") linknewsection- list of templates that can create new sections (rz:link attribute) *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 assumed) 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 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) 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 NOTES: RZ.set value from edit this list button is passed to link manager on new and edit buttons. *********************************************************************** 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"; %> <%@ page import="revize.data.*,revize.publish.*,revize.store.*" %> <%-- --%> Revize Multi-level Menu: <%=rz.webspace%> <%--#RevizeProperties: USE REVIZE MENU (DOCUMENT PROPERTIES) TO EDIT DATA BELOW: status=edit server=secure.interactive-innovations.net projectName=cityofsouthbend label= location=webspace_links-editlist.jsp version= docType=editpage subType=list moduleName= fieldName= channels=| description= --%> <%! String linkmodule = ""; String[] linkrecords = new String[99]; String[] linkdisplays = new String[99]; String folder = ""; boolean showconsole = false; String debugMsg = ""; /** * Determine folder for prior level section (if new button) * or current record section (if edit button) * * arg prior link level for new button; recordid for edit button * type type of button: "new" or "edit" * * linkrecords[level] is the record used to determine the level tosection * (i.e. the first record encountered at the prior level) */ String getFolder(RZTagSupport rz, int arg, String linkpathname, String type) { String folderValue = ""; String filter = ""; String recordid = ""; String tosectionid = ""; //----- If folder is not used if (folder.equals("*none*") || folder.equals("/")) return "/"; //----- no folder if arg is less than zero (top level) else if (arg < 0) return folder; else if (folder.equals("*prompt*") && type.equals("edit")) folderValue = linkpathname; else if (type.equals("edit")) //if edit action, arg is recordid... recordid = "" + arg; //...used to lookup folder name // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * \\ // From this point on the type argument is "new" else if (!folder.equals("") //if folder is not blank and does... && folder.indexOf("*") != 0) //...not start with *, use it return folder; else if (arg < linkrecords.length) //if new action and arg is within... recordid = linkrecords[arg]; //...range, it is valid prior level else //otherwise assume invalid prior level return "_revize_folder_menu_level_too_high (" + arg + ")"; //----- return if setFolder will prompt for folder if (folder.equals("*prompt*")) return folder; if (recordid == null) //recordid for arg level undefined return "_revize_folder_menu_level_invalid (" + arg + ")"; if (StringUtils.toInt(recordid,-9999) < 0) //recordid invalid return "_revize_folder_links._recordid_invalid (recordid=" + recordid + ")"; //----- Look up section folder based on current or parent recordid // (recordid is current record for edit or parent if new item) if (rz.isvalidfield(linkmodule,"linktosectionid") && rz.isvalidmodule("sections")) { tosectionid = rz.fetch(linkmodule,"linktosectionid","report,recordid="+recordid); if (rz.nodata) //no record returned from fetch return "_revize_folder_links._recordid_not_found (recordid=" + recordid + ")" + "\n--where=" + filter + "\n--" + tosectionid; if (StringUtils.toInt(tosectionid,-999) < 0) //sectionid invalid return "_revize_folder_sections.sectionid_invalid (sectionid=" + tosectionid + ")" + "\n--where=" + filter; if (rz.isvalidfield(linkmodule,"linktosectionid") && rz.isvalidfield("sections","folder")) { filter = "sections.sectionid=" + tosectionid; //sections filter folderValue = rz.fetch("sections","folder","",filter); if (rz.nodata) //section record not found return "_revize_folder_sections.sectionid_not_found (sectionid=" + tosectionid + ")" + "\n--where=" + filter + "\n--" + folderValue; } } else //determine folder based on parent folder passed as linkpathname { folderValue = linkpathname; } return folderValue; } %> <%@ 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); } 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"); String linksfilter = StringUtils.getParameter(request,"linksfilter"); String pageid = StringUtils.getParameter(request,"pageid"); pageid = rz.getmenurecordid(pageid); String displaylevel = StringUtils.getParameter(request,"displaylevel"); int toplevel = StringUtils.toInt(StringUtils.getParameter(request,"toplevel")); int bottomlevel = StringUtils.toInt(StringUtils.getParameter(request,"bottomlevel"),99); 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("")) linknewsection = rz.config("menu_newsection"); /* Now needs to be passed as jsp parameter // custom portal code for top nav levels // TODO: (consider adding to sections module as optional fields) linknewsection = "content"; if (sectionsfilter.length() > 0) linknewsection = "*"; //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 filelocation = "/uploads"; if (folder.length() > 0) filelocation = "/" + folder + "/uploads"; } String nexturl = StringUtils.getParameter(request,"nexturl"); if (nexturl.equals("")) nexturl = rz.config("menu_nexturl"); boolean showsectionids = ( StringUtils.getParameter(request,"showsectionids").equals("true") ); boolean showrecordid = ( StringUtils.getParameter(request,"showrecordid").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") ); String menu_system = rz.config("menu_system"); boolean isWebGen = (menu_system.equals("") || menu_system.indexOf("webgen") != -1); %> <% 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 (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 (sortfield.equals("linkseq")) { %> <% columns_before_display++; // link name column also counted %> <% } %> <% if (showstyle) { %> <% } %> <% int pos = 0; debugMsg = ""; //clear class variable; String filter = ""; String options = "deletedrecords"; if (linksfilter.length() > 0 && !linksfilter.equals("*none*")) { filter = linksfilter; } 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 if linkrte!=on) filter = "linkrte!=X 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; int[] countActive = new int[0]; int[] countOrphan = new int[0]; %> <%@ page import = "revize.taglib.content.*,revize.taglib.content.data.*" %> <% //----- process menu items /* new call format */ String menuopts = "sectionid=" + sectionid + ",pageid=" + pageid + ",displaylevel=" + displaylevel + ",sortfield=" + sortfield; if (showorphan) menuopts += ",showall"; rz.menusorter(menuopts); HashMap menuStyle = rz.menu.menuStyle; countActive = rz.menu.countActive; countOrphan = rz.menu.countOrphan; HashMap linkOwner = rz.menu.linkOwner; 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]; countActive = (int[])menuProperties[1]; countOrphan = (int[])menuProperties[2]; 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 = ""; String recordid = ""; String linkid = ""; int parentid = 0; int linkparentid = 0; String linkpageid = ""; String linksectionid = ""; String linktosectionid = ""; String rootsectionid = ""; String linkfilename = ""; String linkpathname = ""; String linkscript = ""; String linkfolder = ""; String linkoptions = "showurl,none,template,url"; if (!sortfield.equals("linkseq")) linkoptions += ",noseq"; String[] parentkeys = new String[99]; String[] linkparentids = new String[99]; String[] linksectionids = new String[99]; String[] linktosectionids = new String[99]; String[] linkpathnames = new String[99]; boolean showButton = false; //----- loop through all menu items plus 1 extra pass to close levels if (showconsole) debugMsg += "rz.listlimit: " + rz.listlimit + " filter=" + filter + "\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) { %> <% recordid = rz.recordid; linkdisplay = rz.content; linktype = rz.linktype; linkurl = rz.url; linkscript = rz.script; //only run for items with new button 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"); linkparentid = StringUtils.toInt( rz.fetch(rz.listmodule,"linkparentid","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); if (rz.tracestack.length() > 0) break; //quit if errors } //----- 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) { debugMsg +="\nlistindex: " + StringUtils.right("000"+rz.listindex,3) + " rec(" + StringUtils.right("000"+rz.listitemid(),3) +") " + " menu_level=" + menu_level + " " + linkdisplay + "\n" + " parentid=" + parentid + " linkparentid=" + linkparentid + " linkpageid=" + linkpageid + "\n"; } if (!style.equals("")) stylePriorItem = style; //String linkOwner = (String)rz.menuProperties.linkOwner.get(rz.listitemid()); 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) && !linkOwner.equals("parent") //not placed on last page && !linkOwner.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)rz.menuProperties.menuStyle.get(rz.listitemid()); style = (String)menuStyle.get(rz.listitemid()); if (style == null) style = "menuUnknown"; styleReturn = style; linkrte = rz.fetch(rz.listmodule,"linkrte","raw"); 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 +="\n*linklevel: " + linklevel + " linksectionids:" + linksectionids[linklevel] + " linktosectionids:" + linktosectionids[linklevel] + " linkpathnames:" + linkpathnames[linklevel] + "\n"; } //----- Determine next level if (rz.listindex < rz.listlimit && !styleReturn.equals("menuOrphan")) next_level = Integer.parseInt(rz.groupnextvalue); 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; if (menu_level == 0 || stylePriorItem.equals("menuSelectedItem") || stylePriorItem.equals("menuSelectedParent")) showButton = true; if (menu_level < toplevel || menu_level > bottomlevel) showButton = false; if (sectionid.equals("-999")) showButton = false; if (showButton) { selected_level[menu_level] = true; String alt = "Create New Item at same level "; if (menu_level == 0) alt += "(TOP) "; alt += "as:\\n" + linkdisplays[menu_level] + " (level " + menu_level + ")"; %> <% if (showstyle) { %> <% } %> <% if (false) { //fake out DW; add TD that spans all the potentially hidden columns %> <% } %> <% } // end if style == menuSelectedItem } // 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 (showparentid) { %> <% } %> <% if (showparentkey) { %> <% } %> <% if (showpagekey) { %> <% } %> <% if (showlevel) { %> <% } %> <% if (showbuttons) { %> <% } //end button column %> <% if (sortfield.equals("linkseq")) { %> <% } %> <% if (showstyle) { %> <% } %> <% showButton = false; // next level is not same as this level and this item selected if (menu_level >= next_level && style.equals("menuSelectedItem")) showButton = true; // center list if (menu_level >= toplevel //not current page && !linkpageid.equals("0") //not left nav && !linkpageid.equals("-999")) //not top nav showButton = false; //must be center list // embedded link if (linkrte.equals("yes")) showButton = false; // 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 /* 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; 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 String parentkey = rz.fetch(linkmodule,"linkparent","report"); // 12-15-2005 DO TODO: For ventura this was needed to correctly set (or fix?) // the linkparent when not using tosection field. Needs further analysis // (may only be appropriate when not using tosectionid or when repairing linkparent) // parentkey = rz.fetch(linkmodule,"linkpage","report") + "[" + linkid + "]"; if (!linksectionid.equals(linktosectionid)) //link starts new section { linktype = rz.fetch(linkmodule,"linktype","report"); // template or urltemplate if (linktype.indexOf("template") != -1) { String linkpage = rz.fetch(linkmodule,"linkpage","report"); if (linkid.equals("-999")) //unique parentkey = linkpage + "[]"; else //dependent parentkey = rz.fetch(linkmodule,"linkpage","report") + "[" + linkid + "]"; //----- 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 (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
tosectionid
recordid
linkid
parentidlinkparent
(LM module)
pagekey
(derived)
Level1Actions Seq 
<%-- #BeginRZ-ActionImage --%> <%-- Option:type=EditListExitImage --%> <%-- Option:forwardURL= --%> <%-- Option:imageSrcURL=images/edit/exit.gif --%> <%-- #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) debugMsg +="\ntop new button same level menu_level:"+(menu_level-1) + " parenttosection:" + linktosectionids[menu_level-1] + "\n sectionid:" + StringUtils.sub(sectionid+" ",0,2) + " newtosectionid:" + newtosectionid + "\n"; } %> <%-- #BeginRZ-ActionImage --%> <%-- Option:type=EditListInsertImage --%> <%-- Option:imageSrcURL=images/edit/new_sm_parent.gif --%> <%-- #EndRZ-ActionImage --%>  
       <% if (rz.isvalidfield(linkmodule,"linktosectionid")){ %> <% } %>       <% String tooltip = "linktype: " + linktype + "\nlinkfilename: " + linkfilename + ""; %> <%=recordid%>    <%=linkid%>  <%=linkparentid%> <% if (linktype.indexOf("template") != -1 //if template || linktype.indexOf("noneXXX") != -1) //or none (future) { rz.fetch( rz.listmodule, "linkpage" ); rz.content += "[" + linkid + "]"; } else rz.content = "...N/A..."; %> <%=rz.content%>  <%=linklevel%>  <% 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 //&& linkOwner.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 (linkOwner.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 <% } else { // start EDIT button display %> <%-- #BeginRZ-ActionImage --%> <%-- Option:type=EditListEditImage --%> <%-- Option:imageSrcURL=images/edit/edit_sm.gif --%> <%-- #EndRZ-ActionImage --%> <% if (next_level > linklevel) { // 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=images/edit/delete_sm.gif --%> <%-- #EndRZ-ActionImage --%> <% if (rz.isvalidfield(linkmodule,"linkvisible")) { %> <%-- #BeginRZ-ActionImage --%> <%-- Option:type=ForwardEditFormImage --%> <%-- Option:imageSrcURL=images/edit/eye-open.png --%> <%-- #EndRZ-ActionImage --%> <% } // end invisible %> <% } // end active delete button %> <% } // end button display %> ">    "> <% for (int i=0; i<(indentlevel*2); i++) { %> <% } String icon = "space"; if (next_level > linklevel) //lower level items { icon = "plus"; if (showhidden || style.indexOf("SelectedItem") != -1 || style.indexOf("SelectedParent") != -1 ) icon = "minus"; } String deletedFlag = ""; if (rz.record.isMarkedForDeletion() && showdebug) { deletedFlag = "+"; isDeletedNote = true; } //----- rz:link tag needed below to set permissions properties %> <%=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=images/edit/new_sm.gif --%> <%-- #EndRZ-ActionImage --%>  
<% } else { out.println("");} %> 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) { %> <% } %>

<% if (showdebug) { %>
<% } %>
<%= rz.tracestack %>
<%= debugMsg %>