[opencms-dev] R: R: Re: How to get publish date of a resource

DAVID RODRIGUEZ MERINO david.rodriguez.merino at uva.es
Fri Jan 25 13:06:15 CET 2013


You can get it with this code in a jsp page:

<%
CmsJspActionElement cms = new CmsJspActionElement(pageContext, request,
response);
CmsContextInfo cms2= new CmsContextInfo();
Locale cambiarLocale;
<%

    CmsJspNavBuilder nav = cms.getNavigation();
	String filename = cms.getRequestContext().getUri();
	String lm =
org.opencms.util.CmsDateUtil.getDateShort(cms.getCmsObject().readFile(filename).getDateLastModified());
	CmsResource res=cms.getCmsObject().readFile(filename);
	int tipo=res.getTypeId();

	if(lm != null && res != null){
		CmsUUID uuid=res.getUserLastModified();
		CmsUser user=cms.getCmsObject().readUser(uuid);

		// Getting the groups of the users
		//String grupos=" ";
		String grupos="";
		List groups = cms.getCmsObject().getGroupsOfUser(user.getName(),false);
		Iterator it= groups.iterator();
		while (it.hasNext()) {
			CmsGroup cmsGroup = (CmsGroup) it.next();
			//grupos=grupos+cmsGroup.getName()+" ";
			grupos = grupos + cmsGroup.getName();
		}
		out.println("<div id='cargada_por'>INFORMACIÓN CARGADA POR:
"+user.getName()+" ("+grupos+") el "+lm+" "+tipo+"</div>");
	}

%>

> I need also to get the username of the user that published the resource.
>
> I can get the user that modified the resource, but i don't need that,
> because
> a user should also publish a resourced that has been modified by another
> user.
>
> thanks
>
>>----Messaggio originale----
>>Da: gnorrus at libero.it
>>Data: 25-gen-2013 12.33
>>A: <opencms-dev at opencms.org>
>>Ogg: [opencms-dev] R: Re:  How to get publish date of a resource
>>
>>Thanks!
>>
>>>----Messaggio originale----
>>>Da: arturo.martin.llado at gmail.com
>>>Data: 25-gen-2013 10.04
>>>A: "The OpenCms mailing list"<opencms-dev at opencms.org>
>>>Ogg: Re: [opencms-dev] How to get publish date of a resource
>>>
>>>Hi,
>>>
>>>You'll find the answer to your question here:
>>>http://stackoverflow.com/questions/14338306/how-to-get-last-published-date-
>>from-a-cmsresource-in-opencms
>>>
>>>Cheers,
>>>
>>>Arturo.
>>>
>>>2013/1/25 gnorrus at libero.it <gnorrus at libero.it>:
>>>> Hi
>>>>
>>>> Is it possible to get the publish date of a resource?
>>>>
>>>> thanks
>>>> _______________________________________________
>>>> This mail is sent to you from the opencms-dev mailing list
>>>> To change your list options, or to unsubscribe from the list, please
>>>> visit
>>>> http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev
>>>>
>>>>
>>>>
>>>_______________________________________________
>>>This mail is sent to you from the opencms-dev mailing list
>>>To change your list options, or to unsubscribe from the list, please
>>> visit
>>>http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev
>>>
>>>
>>>
>>>
>>
>>
>>_______________________________________________
>>This mail is sent to you from the opencms-dev mailing list
>>To change your list options, or to unsubscribe from the list, please
>> visit
>>http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev
>>
>>
>>
>>
>
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev
>
>
>
>




More information about the opencms-dev mailing list