[opencms-dev] modified files

bub habub japorami at yahoo.com
Tue Jul 26 14:48:14 CEST 2005


hi,

i've been trying for one week by now to change the
user who has modified a file or a resource to his id
bu in the explorer view only the admin is shown as
user last modified. need to do this to get later on
the person who created the file.

had now two approaches and both didn't work.

first i just copied one file and then wanted to
setuserlastmodified to some user.

copying the file and so on works well but still then
the man who lastmodified the resource is still admin.

my other apporach was to login with a different user
and then create the file. but also this doesn;t work.
the file is created but the owner is still admin. how
can i change this.
here is my code:

<%@ 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" %>
<jsp:useBean id="cmslogin"
class="org.opencms.jsp.CmsJspLoginBean">
<% cmslogin.init(pageContext, request, response); %>
</jsp:useBean>
<%

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);
String password = user.getPassword();
out.println(password);
CmsUUID userid = user.getId();
String uid = userid.toString();
out.println(uid);


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))
	{
		
org.opencms.util.CmsRequestUtil.forwardRequest("/system/modules/com.authentication/elements/registration_form.html",
request,  response);
			//out.println("big error" +""+ title);
	}
	
	else
	{	
		//cmslogin.logout();
		
		cmslogin.login(uname, password);
		
		out.println(uname + "=="+password);
	
//cmsobject.copyResource("/system/modules/com.authentication/elements/registration_form.html",internalfilename,
CmsResource.COPY_AS_NEW);
		addProperty("display", display);

	
cmsobject.createResource(internalfilename,,content,properties);


		cmsobject.lockResource(internalfilename);
		CmsResource resource =
cmsobject.readResource(internalfilename);
		resource.setUserLastModified(userid);
				String resourcename =
CmsResource.getName(internalfilename);
		out.println(resourcename + "" + "===" +
internalfilename);
		
		CmsFile myfile =
cmsobject.readFile(internalfilename);
				//CmsUUID uid2 = myfile.getUserLastModified();
		//String who = uid2.toString();
		//out.println(uid+"========="+who);
		//out.println(who);
		//out.println(uid);
		
		myfile.setUserLastModified(userid);
		cmsobject.writeFile(myfile);

		cmsobject.unlockResource(internalfilename);
		cmsobject.publishResource(internalfilename);
		
		//cmslogin.logout();

		//response.sendRedirect(internalfilename);
	
//org.opencms.util.CmsRequestUtil.forwardRequest(internalfilename,request,
 response);
		%>
		<jsp:forward page="request_input_form.jsp" />
		<%
	}



%>

thanks for help.

jap

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the opencms-dev mailing list