[opencms-dev] adding item to opencms globalheader that is only visible to admin -- work like PUBLISH

Desjardins, Joseph Joseph.Desjardins at tdsecurities.com
Wed Oct 6 23:39:41 CEST 2004


Hello,

Running opencms 5.01.

Trying to have a link to a tool that only appears when admin is logging in.  I've been working with the  /system/workplace/templates/head template.  I can easily place an item in the global nav but would like it to act the publish button --ie only there when admin logs in.   

I see that in com.opencms.workplace.CmsWpMain.java that the publish button is enabled (see below) but when i try to do the same it breaks.    Are the button vars --  publish, HELP, SYNC,etc -- predefined somewhere?   I'm not having much luck figuring out how to get this done.


// set the publishProject Button to enable if user has the right to publish the project
		if (templateFile.equalsIgnoreCase(CmsXmlTemplateFile.C_TEMPLATEPATH + "head")) {
			if ((cms.isAdmin() || cms.isManagerOfProject()) && (!reqCont.currentProject().isOnlineProject())) {
				xmlTemplateDocument.setData("publish", xmlTemplateDocument.getProcessedDataValue("PUBLISH_ENABLED", this));
				//new global button
				xmlTemplateDocument.setData("NEWGLOBAL", xmlTemplateDocument.getProcessedDataValue("NEWGLOBAL_ENABLED", this));
				
			}
			else {
				xmlTemplateDocument.setData("publish", xmlTemplateDocument.getProcessedDataValue("PUBLISH_DISABLED", this));
	xmlTemplateDocument.setData("NEWGLOBAL", xmlTemplateDocument.getProcessedDataValue("NEWGLOBAL_DISABLED", this));
			}
		}

And here is the code from the head template:

<PROCESS>NEWGLOBAL</PROCESS>

<NEWGLOBAL_ENABLED>
<![CDATA[<td class=dialogtxt>]]><BUTTON href="#" action="javascript:opennewglobal();" name="newglobal" alt="help"/><![CDATA[</td>]]>
</NEWGLOBAL_ENABLED>

<NEWGLOBAL_DISABLED>
<![CDATA[<td></td>]]>
</NEWGLOBAL_DISABLED>


tks
Joseph  



More information about the opencms-dev mailing list