[opencms-dev] setUserLastmodified

bub habub japorami at yahoo.com
Wed Jul 20 14:18:02 CEST 2005


hi,
is it possible to change the userlastmodified when
logged in as admin?

or can't i do that. my intention is to set the
userlast modified as someone else this should be done
automatically through a website. means the website
visitor won't really know that he is creating a new
file in the opencms directory. still i would like to
relate this file to someone external by creating a
user external who should be then the person that last
modified the page, or can i change the owner and the
user lastmodified. so far it is not working. i copy a
file and then would like to set the userlastmodified
of the copy as the external person.
how can i achieve this:
my code looks like this:

n how can i best access the cvs repository and look at
the .java classes. then i could get some insight and
don't have to search as much and ask so often, hihi?

so now the code and as always you are a great help for
me as a beginner. very happy about the help
thanks a lot 

jap

<%@ page import="org.opencms.file.*,
org.opencms.file.collectors.*, java.util.*,
org.opencms.jsp.*, org.opencms.flex.*,
org.opencms.util.CmsUUID" %>
<%@ taglib prefix="cms"
uri="http://www.opencms.org/taglib/cms" %>
<%

CmsJspActionElement cms = new
CmsJspActionElement(pageContext, request, response);
CmsObject cmsobject =
CmsFlexController.getCmsObject(request);
String uname = request.getParameter("uname");
out.println(uname);
CmsUser user  = cmsobject.readUser(uname);
CmsUUID userid = user.getId();
//outprintln(userid);


String destination =
"/system/modules/com.authentication/elements/";
String title = request.getParameter("title");
out.println(title);
String internalfilename = destination + title; 
out.println(internalfilename);
int filetype = 1 ;    //request.getParameter("type");






	boolean exists; 
	

	if(cmsobject.existsResource(internalfilename))
	{
		//????, redirect to page with error explanation 
		out.println("big error" +""+ title);
	}
	
	else
	{	
	
cmsobject.copyResource("/system/modules/com.authentication/elements/registration_form.html",internalfilename,
CmsResource.COPY_AS_NEW);
		String resourcename =
CmsResource.getName(internalfilename);
		out.println(resourcename + "" + "===" +
internalfilename);
		cmsobject.lockResource(internalfilename);
		CmsFile myfile =
cmsobject.readFile(internalfilename);
		cmsobject.writeFile(myfile);
		myfile.setUserLastModified(userid);
		cmsobject.unlockResource(internalfilename);
		cmsobject.publishResource(internalfilename);
		// redirect to the same file
	}



%>

  


		
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 



More information about the opencms-dev mailing list