ktlili 2005/10/12 13:34:49 CEST
Modified files:
war/src/java/org/jahia/clipbuilder/html/struts
SelectPartAction.java
SelectPartForm.java
war/src/java/org/jahia/clipbuilder/html/web/html/Impl/Dom
DomHTMLDocument.java
war/src/java/org/jahia/clipbuilder/html/web/html/Impl/ExtractorFilter
ChewExtractorFilter.java
war/src/java/org/jahia/clipbuilder/html/web/html/Impl/HTMLParser
ChewBuilderVisitor.java
HTMLParserDocument.java
war/src/java/org/jahia/clipbuilder/sql/bean QueryBean.java
war/src/webapp/WEB-INF applicationContext.xml
war/src/webapp/jsp/clipbuilder/html/actions
configureAction.jsp
selectPartAction.jsp
Log:
- fix bug: encoding whith chew, selescted tag whith chew
- add default configuration default values
Revision Changes Path
1.4 +1 -3
webclip_builder/war/src/java/org/jahia/clipbuilder/html/struts/SelectPartAction.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/org/jahia/clipbuilder/html/struts/SelectPartAction.java.diff?r1=1.3&r2=1.4&f=h
1.2 +2 -2
webclip_builder/war/src/java/org/jahia/clipbuilder/html/struts/SelectPartForm.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/org/jahia/clipbuilder/html/struts/SelectPartForm.java.diff?r1=1.1&r2=1.2&f=h
1.3 +1 -0
webclip_builder/war/src/java/org/jahia/clipbuilder/html/web/html/Impl/Dom/DomHTMLDocument.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/org/jahia/clipbuilder/html/web/html/Impl/Dom/DomHTMLDocument.java.diff?r1=1.2&r2=1.3&f=h
1.7 +4 -2
webclip_builder/war/src/java/org/jahia/clipbuilder/html/web/html/Impl/ExtractorFilter/ChewExtractorFilter.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/org/jahia/clipbuilder/html/web/html/Impl/ExtractorFilter/ChewExtractorFilter.java.diff?r1=1.6&r2=1.7&f=h
1.3 +4 -0
webclip_builder/war/src/java/org/jahia/clipbuilder/html/web/html/Impl/HTMLParser/ChewBuilderVisitor.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/org/jahia/clipbuilder/html/web/html/Impl/HTMLParser/ChewBuilderVisitor.java.diff?r1=1.2&r2=1.3&f=h
1.3 +1 -0
webclip_builder/war/src/java/org/jahia/clipbuilder/html/web/html/Impl/HTMLParser/HTMLParserDocument.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/org/jahia/clipbuilder/html/web/html/Impl/HTMLParser/HTMLParserDocument.java.diff?r1=1.2&r2=1.3&f=h
1.3 +119 -120
webclip_builder/war/src/java/org/jahia/clipbuilder/sql/bean/QueryBean.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/java/org/jahia/clipbuilder/sql/bean/QueryBean.java.diff?r1=1.2&r2=1.3&f=h
1.5 +10 -5
webclip_builder/war/src/webapp/WEB-INF/applicationContext.xml
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/webapp/WEB-INF/applicationContext.xml.diff?r1=1.4&r2=1.5&f=h
1.5 +18 -18
webclip_builder/war/src/webapp/jsp/clipbuilder/html/actions/configureAction.jsp
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/webapp/jsp/clipbuilder/html/actions/configureAction.jsp.diff?r1=1.4&r2=1.5&f=h
1.4 +9 -5
webclip_builder/war/src/webapp/jsp/clipbuilder/html/actions/selectPartAction.jsp
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/webclip_builder/war/src/webapp/jsp/clipbuilder/html/actions/selectPartAction.jsp.diff?r1=1.3&r2=1.4&f=h
Index: SelectPartAction.java
===================================================================
RCS file:
/home/cvs/repository/webclip_builder/war/src/java/org/jahia/clipbuilder/html/struts/SelectPartAction.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SelectPartAction.java 17 Aug 2005 08:54:36 -0000 1.3
+++ SelectPartAction.java 12 Oct 2005 11:34:47 -0000 1.4
@@ -10,9 +10,7 @@
import org.jahia.clipbuilder.html.web.html.*;
import org.jahia.clipbuilder.html.web.html.Impl.ExtractorFilter.*;
import org.apache.struts.action.*;
-import org.jahia.clipbuilder.html.util.ClassUtilities;
-import org.jahia.clipbuilder.html.web.Url.UrlEncoderIF;
-import org.jahia.clipbuilder.html.web.Url.UrlEncoderFactory;
+
/**
* Description of the Class
Index: SelectPartForm.java
===================================================================
RCS file:
/home/cvs/repository/webclip_builder/war/src/java/org/jahia/clipbuilder/html/struts/SelectPartForm.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SelectPartForm.java 28 Jul 2005 09:26:51 -0000 1.1
+++ SelectPartForm.java 12 Oct 2005 11:34:47 -0000 1.2
@@ -19,9 +19,9 @@
private String selectedContent;
private String webClippingTypeContent;
private String webClippingPartHashCode;
- private String webClippingTagName ;
+ private String webClippingTagName;
private String webClippingXPath = "//form";
- private String webClippingShowCss;
+ private String webClippingShowCss = "true";
private String webClippingShowJavascript;
Index: DomHTMLDocument.java
===================================================================
RCS file:
/home/cvs/repository/webclip_builder/war/src/java/org/jahia/clipbuilder/html/web/html/Impl/Dom/DomHTMLDocument.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DomHTMLDocument.java 23 Aug 2005 07:08:01 -0000 1.2
+++ DomHTMLDocument.java 12 Oct 2005 11:34:48 -0000 1.3
@@ -7,6 +7,7 @@
import org.jahia.clipbuilder.html.web.*;
import org.jahia.clipbuilder.html.web.html.*;
import org.w3c.dom.*;
+import org.jahia.clipbuilder.html.web.Constant.WebConstants;
/**
* Implementation of HTMLDocument whith xerces
Index: ChewExtractorFilter.java
===================================================================
RCS file:
/home/cvs/repository/webclip_builder/war/src/java/org/jahia/clipbuilder/html/web/html/Impl/ExtractorFilter/ChewExtractorFilter.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- ChewExtractorFilter.java 30 Sep 2005 15:08:48 -0000 1.6
+++ ChewExtractorFilter.java 12 Oct 2005 11:34:48 -0000 1.7
@@ -72,9 +72,10 @@
*/
public String getSelectedPart(HTMLDocument doc) {
String selectedPart = "";
+ String encoded = "";
//String html = doc.getTransformedDocumentAsString();
String html = doc.getUserDocumentAsString();
- String encoded = doc.getCharEncoding();
+
Parser parser = Parser.createParser(html, encoded);
try {
@@ -102,10 +103,11 @@
selectedPart = selectedPart
+chewVisitor.getFirstNode().toHtml();
String charSet = doc.getCharEncoding();
if (charSet == null) {
- charSet =
WebConstants.ENCODING_UTF;
+ charSet =
WebConstants.ENCODING_ISO;
logger.warn("Encoding not
found");
}
encoded = new
String(selectedPart.getBytes(), charSet);
+ encoded = selectedPart;
logger.debug("end build selected part");
}
Index: ChewBuilderVisitor.java
===================================================================
RCS file:
/home/cvs/repository/webclip_builder/war/src/java/org/jahia/clipbuilder/html/web/html/Impl/HTMLParser/ChewBuilderVisitor.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ChewBuilderVisitor.java 30 Sep 2005 15:08:48 -0000 1.2
+++ ChewBuilderVisitor.java 12 Oct 2005 11:34:48 -0000 1.3
@@ -89,6 +89,10 @@
if (tag.getTagName().equalsIgnoreCase(getTagName())) {
logger.debug("Visit Table Tag");
NodeList list = tag.getChildren();
+ if (list == null) {
+ list = new NodeList();
+ }
+
// Add link tag
LinkTag link = new LinkTag();
link.setAttribute(HTML.Attribute.TARGET.toString(),
"_top");
Index: HTMLParserDocument.java
===================================================================
RCS file:
/home/cvs/repository/webclip_builder/war/src/java/org/jahia/clipbuilder/html/web/html/Impl/HTMLParser/HTMLParserDocument.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- HTMLParserDocument.java 23 Aug 2005 07:08:01 -0000 1.2
+++ HTMLParserDocument.java 12 Oct 2005 11:34:48 -0000 1.3
@@ -4,6 +4,7 @@
import org.jahia.clipbuilder.html.bean.*;
import org.jahia.clipbuilder.html.web.*;
import org.jahia.clipbuilder.html.web.html.*;
+import org.jahia.clipbuilder.html.web.Constant.WebConstants;
/**
* Implementation of HTMLDocument interface based on org.htmlparser.*
package
Index: QueryBean.java
===================================================================
RCS file:
/home/cvs/repository/webclip_builder/war/src/java/org/jahia/clipbuilder/sql/bean/QueryBean.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- QueryBean.java 30 Sep 2005 15:08:49 -0000 1.2
+++ QueryBean.java 12 Oct 2005 11:34:48 -0000 1.3
@@ -20,126 +20,125 @@
*/
public class QueryBean {
- List queryData;
- String[] queryColumns;
+ List queryData;
+ String[] queryColumns;
- /**
- * Designated Logger for this class.
- */
- private final Log log = LogFactory.getLog(getClass().getName());
-
-
- /**
- * Constructor for the QueryBean object
- */
- public QueryBean() {
- try {
- Class.forName(DbProps.DRIVER);
- }
- catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
-
- /**
- * Setter for property queryData.
- *
- [EMAIL PROTECTED] queryData New value of property queryData.
- */
- public void setQueryData(java.util.List queryData) {
- this.queryData = queryData;
- }
-
-
- /**
- * Setter for property queryColumns.
- *
- [EMAIL PROTECTED] queryColumns New value of property queryColumns.
- */
- public void setQueryColumns(java.lang.String[] queryColumns) {
- this.queryColumns = queryColumns;
- }
-
-
- /**
- * Getter for property queryData.
- *
- [EMAIL PROTECTED] Value of property queryData.
- */
- public java.util.List getQueryData() {
- return queryData;
- }
-
-
- /**
- * Getter for property queryColumns.
- *
- [EMAIL PROTECTED] Value of property queryColumns.
- */
- public java.lang.String[] getQueryColumns() {
- return this.queryColumns;
- }
-
-
- /**
- * Returns a query's results.
- *
- [EMAIL PROTECTED] queryString Description of Parameter
- */
- public void executeQuery(String queryString) {
- Connection conn = null;
- PreparedStatement psmt = null;
- ResultSet rs = null;
- ResultSetMetaData rsm = null;
-
- log.info("Executing QueryBean's executeQuery method. (New
SQL to parse)");
- try {
- conn = DriverManager.getConnection(DbProps.URL,
DbProps.USERNAME, DbProps.PASSWORD);
- psmt = conn.prepareStatement(queryString);
-
- if (log.isDebugEnabled()) {
- log.debug("QueryBean.executeQuery.
queryString : " + queryString);
- }
-
- rs = psmt.executeQuery();
-
- rsm = rs.getMetaData();
- int sqlType = 0;
- int colCount = rsm.getColumnCount();
-
- this.queryData = new ArrayList();
- //All data are Strings.
- while (rs.next()) {
- String[] record = new String[colCount];
- this.queryColumns = new String[colCount];
-
- for (int i = 1; i <= colCount; i++) {
- queryColumns[i - 1] =
rsm.getColumnLabel(i);
- sqlType = rsm.getColumnType(i);
- //For this simple example, I'm only
checking 2 types...
-
- record[i - 1] =
rs.getObject(i).toString();
- /* switch (sqlType) {
- case java.sql.Types.INTEGER:
- record[i - 1] = new
Integer(rs.getInt(i)).toString();
- break;
-
-
-
- case java.sql.Types.VARCHAR:
- record[i - 1] =
rs.getString(i);
- break;
- }*/
- }
-
- queryData.add(record);
- }
- }
- catch (Exception e) {
- e.printStackTrace();
- throw new RuntimeException(e);
- }
- }
+ /**
+ * Designated Logger for this class.
+ */
+ private final Log log = LogFactory.getLog(getClass().getName());
+
+
+ /**
+ * Constructor for the QueryBean object
+ */
+ public QueryBean() {
+ try {
+ Class.forName(DbProps.DRIVER);
+ }
+ catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+
+ /**
+ * Setter for property queryData.
+ *
+ [EMAIL PROTECTED] queryData New value of property queryData.
+ */
+ public void setQueryData(java.util.List queryData) {
+ this.queryData = queryData;
+ }
+
+
+ /**
+ * Setter for property queryColumns.
+ *
+ [EMAIL PROTECTED] queryColumns New value of property queryColumns.
+ */
+ public void setQueryColumns(java.lang.String[] queryColumns) {
+ this.queryColumns = queryColumns;
+ }
+
+
+ /**
+ * Getter for property queryData.
+ *
+ [EMAIL PROTECTED] Value of property queryData.
+ */
+ public java.util.List getQueryData() {
+ return queryData;
+ }
+
+
+ /**
+ * Getter for property queryColumns.
+ *
+ [EMAIL PROTECTED] Value of property queryColumns.
+ */
+ public java.lang.String[] getQueryColumns() {
+ return this.queryColumns;
+ }
+
+
+ /**
+ * Returns a query's results.
+ *
+ [EMAIL PROTECTED] queryString Description of Parameter
+ */
+ public void executeQuery(String queryString) {
+ Connection conn = null;
+ PreparedStatement psmt = null;
+ ResultSet rs = null;
+ ResultSetMetaData rsm = null;
+
+ log.info("Executing QueryBean's executeQuery method. (New SQL
to parse)");
+ try {
+ conn = DriverManager.getConnection(DbProps.URL,
DbProps.USERNAME, DbProps.PASSWORD);
+ psmt = conn.prepareStatement(queryString);
+
+ if (log.isDebugEnabled()) {
+ log.debug("QueryBean.executeQuery. queryString
: " + queryString);
+ }
+
+ rs = psmt.executeQuery();
+
+ rsm = rs.getMetaData();
+ int sqlType = 0;
+ int colCount = rsm.getColumnCount();
+
+ this.queryData = new ArrayList();
+ //All data are Strings.
+ while (rs.next()) {
+ String[] record = new String[colCount];
+ this.queryColumns = new String[colCount];
+
+ for (int i = 1; i <= colCount; i++) {
+ queryColumns[i - 1] =
rsm.getColumnLabel(i);
+ sqlType = rsm.getColumnType(i);
+ //For this simple example, I'm only
checking 2 types...
+
+ record[i - 1] =
rs.getObject(i).toString();
+ /*
+ * switch (sqlType) {
+ * case java.sql.Types.INTEGER:
+ * record[i - 1] = new
Integer(rs.getInt(i)).toString();
+ * break;
+ * case java.sql.Types.VARCHAR:
+ * record[i - 1] = rs.getString(i);
+ * break;
+ * }
+ */
+ }
+
+ queryData.add(record);
+ }
+ }
+ catch (Exception e) {
+ //e.printStackTrace();
+ throw new RuntimeException(e);
+ }
+ }
}
Index: applicationContext.xml
===================================================================
RCS file:
/home/cvs/repository/webclip_builder/war/src/webapp/WEB-INF/applicationContext.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- applicationContext.xml 6 Sep 2005 12:34:27 -0000 1.4
+++ applicationContext.xml 12 Oct 2005 11:34:49 -0000 1.5
@@ -4,16 +4,20 @@
<beans>
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName">
- <value>com.mysql.jdbc.Driver</value>
+ <!--value>com.mysql.jdbc.Driver</value-->
+ <value>org.hsqldb.jdbcDriver</value>
</property>
<property name="url">
- <value>jdbc:mysql://localhost:3306/test</value>
+ <!--value>jdbc:mysql://localhost:3306/test</value-->
+ <value>jdbc:hsqldb:test</value>
</property>
<property name="username">
- <value>root</value>
+ <!--value>root</value-->
+ <value>sa</value>
</property>
<property name="password">
- <value>root1234</value>
+ <!--value>root1234</value-->
+ <value></value>
</property>
</bean>
<!-- Hibernate SessionFactory -->
@@ -29,7 +33,8 @@
</property>
<property name="hibernateProperties">
<props>
- <prop
key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
+ <!--prop
key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop-->
+ <prop
key="hibernate.dialect">org.hibernate.dialect.HSQLDialect</prop>
<prop key="hibernate.hbm2ddl.auto">create</prop>
</props>
</property>
Index: configureAction.jsp
===================================================================
RCS file:
/home/cvs/repository/webclip_builder/war/src/webapp/jsp/clipbuilder/html/actions/configureAction.jsp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- configureAction.jsp 30 Sep 2005 15:08:58 -0000 1.4
+++ configureAction.jsp 12 Oct 2005 11:34:49 -0000 1.5
@@ -127,15 +127,15 @@
</td>
<td class="leftlevel2 waInput">
<html:select property="browserJavascriptCode" size="1">
+ <html:option value="2">
+ <bean:message
key="configuration.browser.javascript.code.nothing"/>
+ </html:option>
<html:option value="0">
<bean:message
key="configuration.browser.javascript.code.remove"/>
</html:option>
<html:option value="1">
<bean:message
key="configuration.browser.javascript.code.refactor"/>
</html:option>
- <html:option value="2">
- <bean:message
key="configuration.browser.javascript.code.nothing"/>
- </html:option>
</html:select>
</td>
</tr>
@@ -146,15 +146,15 @@
</td>
<td class="leftlevel2 waInput">
<html:select property="browserJavascriptEvent"
size="1">
+ <html:option value="2">
+ <bean:message
key="configuration.browser.javascript.event.nothing"/>
+ </html:option>
<html:option value="0">
<bean:message
key="configuration.browser.javascript.event.remove"/>
</html:option>
<html:option value="1">
<bean:message
key="configuration.browser.javascript.event.refactor"/>
</html:option>
- <html:option value="2">
- <bean:message
key="configuration.browser.javascript.event.nothing"/>
- </html:option>
</html:select>
</td>
</tr>
@@ -184,12 +184,12 @@
</td>
<td class="leftlevel2 waInput">
<html:select property="client" size="1">
- <html:option value="0">
- <bean:message key="client.type.htmlunit"/>
- </html:option>
<html:option value="1">
<bean:message key="client.type.httpClient"/>
</html:option>
+ <html:option value="0">
+ <bean:message key="client.type.htmlunit"/>
+ </html:option>
</html:select>
</td>
</tr>
@@ -238,12 +238,12 @@
<td class="leftlevel2 waInput">
<!-- See HTMLDocument class for value-->
<html:select property="htmlDocument" size="1">
- <html:option value="0">
- <bean:message key="htmlDocument.type.dom"/>
- </html:option>
<html:option value="1">
<bean:message key="htmlDocument.type.htmlparser"/>
</html:option>
+ <html:option value="0">
+ <bean:message key="htmlDocument.type.dom"/>
+ </html:option>
</html:select>
</td>
</tr>
@@ -316,18 +316,18 @@
<td class="leftlevel2 waInput">
<!-- See HTMLDocument class for value-->
<html:select property="portletContinualClipping"
size="1">
- <html:option value="1">
- <bean:message
key="portlet.config.clipbuilder.iframe.actif"/>
- </html:option>
- <html:option value="2">
- <bean:message
key="portlet.config.clipbuilder.iframe.passif"/>
- </html:option>
<html:option value="3">
<bean:message
key="portlet.config.clipbuilder.popup.actif"/>
</html:option>
<html:option value="4">
<bean:message
key="portlet.config.clipbuilder.popup.passif"/>
</html:option>
+ <html:option value="1">
+ <bean:message
key="portlet.config.clipbuilder.iframe.actif"/>
+ </html:option>
+ <html:option value="2">
+ <bean:message
key="portlet.config.clipbuilder.iframe.passif"/>
+ </html:option>
</html:select>
</td>
</tr>
Index: selectPartAction.jsp
===================================================================
RCS file:
/home/cvs/repository/webclip_builder/war/src/webapp/jsp/clipbuilder/html/actions/selectPartAction.jsp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- selectPartAction.jsp 29 Jul 2005 09:33:20 -0000 1.3
+++ selectPartAction.jsp 12 Oct 2005 11:34:49 -0000 1.4
@@ -52,10 +52,14 @@
</script><%
String options = "\n";
javax.swing.text.html.HTML.Tag[] tags =
javax.swing.text.html.HTML.getAllTags();
+ String selectedTagValue = request.getParameter("webClippingTagName");
+ if (selectedTagValue == null) {
+ selectedTagValue = "table";
+ }
for (int i = 0; i < tags.length; i++) {
String name = tags[i].toString();
options = options + "\n" + "<option value=" + name;
- if (name.equalsIgnoreCase("table")) {
+ if (name.equalsIgnoreCase(selectedTagValue)) {
options = options + " selected=selected" + " ";
}
options = options + " > " + name + "</option>";
@@ -116,10 +120,10 @@
<html:option value="3">
<bean:message key="select.clipbuilderMethod.form"/>
</html:option>
- <html:option value="4">
+ <html:option value="4">
<bean:message key="select.clipbuilderMethod.xPath"/>
</html:option>
- <html:option value="5">
+ <html:option value="5">
<bean:message key="select.clipbuilderMethod.all"/>
</html:option>
<html:option value="0">
@@ -158,8 +162,8 @@
</logic:equal>
<!-- all cases-->
<td class="topmenugreen bold waBG">
- <bean:message key="select.showCss"/>
- <html:checkbox property="webClippingShowCss"/>
+ <bean:message key="select.showCss"/>
+ <html:checkbox property="webClippingShowCss"/>
</td>
</tr>
</table>