dotCMS - Open Source Content Management System, Ondemand CMS, and Professional Support

Document Search

Article Information

Since Version: 1.7
Tags: plugins
Updated: 5/8/2009 12:24:26 PM
By: Jason Tesser
Doc id: 172218
Print Page: Export to PDF

Modifing dotCMS JSPS

If you need to create a plugin that modify some dotcms jsp, like the edit_contentlet.jsp for example, you could do this:
1. In your plugin org.dotcms.XXXXX, add a folder called "dotcms_jsp". Inside that folder copy the jsp you modify using the same folders structure you have in dotcms.
For example in the edit_contentlet.jsp case should be : org.dotcms.XXXXX/dotcms_jsp/html/portlet/ext/contentlet/edit_contentlet.jsp
2. in your plugin org.dotcms.XXXXX/build.xml file use this script below.
An example for this type of plugin you could see it on https://svn.dotcms.org/plugins/org.dotcms.editcontent

<project name="Edit Content plugin" default="build">
	<import file="../common.xml" />

	<property name="temp.jsp" value="temp_jsp" />
	<property name="temp.jsp.src" value="temp_jsp_src" />
	
	<property name="default.jsp" value="../../dotCMS/" />
	<property name="dotcms.jsp" value="dotcms_jsp" />
	<target name="jsp">
		 <taskdef classname="com.dotmarketing.util.jasper.DotJasperTask" name="jasper2" > 
						      <classpath id="jspc.classpath"> 
						      	<pathelement path="${build.classes}" />				   
						        <pathelement location="${java.home}/../lib/tools.jar"/> 
						       
						      	<fileset dir="../../lib">
						      				<include name="**/*.jar" />
						      			</fileset>
						      	
						      			<fileset dir="../../common/lib">
						      				<include name="**/*.jar" />
						      			</fileset>
						      	
						      			<fileset dir="../../bin">
			      							<include name="**/*.jar" />
			      						</fileset>
						      	 
						      			<fileset dir="../../dotCMS/WEB-INF/lib">
						      				<include name="**/*.jar" />
						      			</fileset>
						    	<pathelement path="../../build/classes" />
						      			
						      </classpath>
						</taskdef> 
		
		<delete dir="${temp.jsp.src}" failonerror="false"/>
		<delete dir="${temp.jsp}" failonerror="false"/>
		
		<mkdir dir="${temp.jsp}" />
		<mkdir dir="${temp.jsp.src}" />
		
		<copy todir="${temp.jsp}">
			<fileset dir="${default.jsp}">
				<include name="**/*.jsp" />
				<exclude name="html/plugins/**"/>
			</fileset>

		</copy>
		<copy todir="${temp.jsp}/WEB-INF/" >
			<fileset dir="${default.jsp}/WEB-INF/"/>
		</copy>
		
		
		<copy todir="${temp.jsp}" overwrite="true">
			<fileset dir="${dotcms.jsp}">
				<include name="**/*.jsp" />
			</fileset>
		</copy>
		
		<jasper2
	             validateXml="false" 
	             uriroot="${temp.jsp}" 
	             javaEncoding="UTF-8"
	             webXmlFragment="${temp.jsp}/generated_web.xml" 
	             outputDir="${temp.jsp.src}/">

			</jasper2>
		
		<fileset id="dotcms.jsp.contents" dir="${dotcms.jsp}"/>
		<property name="prop.dotcms.jsp.contents" refid="dotcms.jsp.contents"/>
		<echo file="${temp.jsp}/file_list">${prop.dotcms.jsp.contents}</echo>
		<!-- Break up in multiple lines -->		 
		<replace file="${temp.jsp}/file_list" token=";" value="${line.separator}"/>
		<replace file="${temp.jsp}/file_list" token="_" value="_005f"/>
		<replaceregexp file="${temp.jsp}/file_list"
		                         match=".jsp$"
		                         replace="_jsp.java"
		                         byline="true"/>
		<replaceregexp file="${temp.jsp}/file_list"
			                         match="^"
			                         replace="org/apache/jsp/"
			                         byline="true"/>
		<!-- Delete what we do not need -->
		<delete>
    		<fileset dir="${temp.jsp.src}" >				
    			<excludesfile name="${temp.jsp}/file_list"/>
			</fileset>			
		</delete>
				
		<javac debug="true" debuglevel="lines,vars,source" 
			fork="true" srcdir="${temp.jsp.src}" destdir="${build.classes}" source="1.5" 
			target="1.5" compiler="javac1.5" nowarn="true" optimize="true" 
			memoryinitialsize="256m" memorymaximumsize="512m">
			<classpath refid="files-classpath" />
		</javac>		
	</target>
</project>



Post a Comment


Add Comments

   

 
Post