Weld SVN: r6443 - examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-06-16 09:49:30 -0400 (Wed, 16 Jun 2010)
New Revision: 6443
Modified:
examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/urlrewrite.xml
Log:
remove dtd (all seem broken), use 6 character hashcode
Modified: examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/urlrewrite.xml
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/urlrewrite.xml 2010-06-16 13:43:01 UTC (rev 6442)
+++ examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/urlrewrite.xml 2010-06-16 13:49:30 UTC (rev 6443)
@@ -1,6 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 3.0//EN"
- "http://tuckey.org/res/dtds/urlrewrite3.0.dtd">
<!--
@@ -13,7 +11,7 @@
<!-- first construct nice address (ending with number, e.g. /0532106545) and show it in URL field-->
<rule>
- <from>^/(\w{40})\.jsf$</from>
+ <from>^/(\w{6})\.jsf$</from>
<to type="redirect" last="true">/weld-pastecode/$1</to>
</rule>
@@ -24,7 +22,7 @@
<!-- then forward to appropriate page without changing displayed URL -->
<rule>
- <from>^/(\w{40})$</from>
+ <from>^/(\w{6})$</from>
<to type="forward" last="true">display.jsf?id=$1</to>
</rule>
13 years, 10 months
Weld SVN: r6442 - in examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode: session and 1 other directory.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-06-16 09:43:01 -0400 (Wed, 16 Jun 2010)
New Revision: 6442
Added:
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/EEProducers.java
Removed:
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/CodeEntity.java
Modified:
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/CodeFragment.java
Log:
merge in shane's changes
Deleted: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/CodeEntity.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/CodeEntity.java 2010-06-16 13:35:18 UTC (rev 6441)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/CodeEntity.java 2010-06-16 13:43:01 UTC (rev 6442)
@@ -1,208 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.weld.examples.pastecode.model;
-
-import java.io.Serializable;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.persistence.GenerationType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Column;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-import javax.persistence.Lob;
-import javax.persistence.Transient;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-/**
- * The persistent class for the code database table.
- *
- */
-@Entity
-@Table(name = "code")
-public class CodeEntity implements Serializable, Cloneable
-{
- private static final long MS_PER_SECOND = 1000;
- private static final long MS_PER_MINUTE = 60 * MS_PER_SECOND;
- private static final long MS_PER_HOUR = 60 * MS_PER_MINUTE;
- private static final long MS_PER_DAY = 24 * MS_PER_HOUR;
-
- private static final SimpleDateFormat df = new SimpleDateFormat("d MMM");
-
- private static final long serialVersionUID = 1L;
- private int id;
- private Date datetime;
- private String language;
- private String note;
- private String text;
- private String user;
- private String hash;
-
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- @Column(name = "id")
- public int getId()
- {
- return id;
- }
-
- public void setId(int id)
- {
- this.id = id;
- }
-
- @Column(name = "hash")
- public String getHash()
- {
- return hash;
- }
-
- public void setHash(String hash)
- {
- this.hash = hash;
- }
-
- public CodeEntity()
- {
- this.language = "";
- this.note = "";
- this.text = "";
- this.user = "";
- this.hash = null;
- this.datetime = null;
- }
-
- @Temporal(TemporalType.TIMESTAMP)
- @Column(name = "datetime")
- public Date getDatetime()
- {
- return this.datetime;
- }
-
- public void setDatetime(Date datetime)
- {
- this.datetime = datetime;
- }
-
- @Transient
- public String getFriendlyDate()
- {
- if (getDatetime() == null) return "unknown";
-
- Date now = new Date();
-
- long age = now.getTime() - getDatetime().getTime();
-
- long days = (long) Math.floor(age / MS_PER_DAY);
- age -= (days * MS_PER_DAY);
- long hours = (long) Math.floor(age / MS_PER_HOUR);
- age -= (hours * MS_PER_HOUR);
- long minutes = (long) Math.floor(age / MS_PER_MINUTE);
-
- if (days < 7)
- {
- StringBuilder sb = new StringBuilder();
-
- if (days > 0)
- {
- sb.append(days);
- sb.append(days > 1 ? " days " : " day ");
- }
-
- if (hours > 0)
- {
- sb.append(hours);
- sb.append(hours > 1 ? " hrs " : " hr ");
- }
-
- if (minutes > 0)
- {
- sb.append(minutes);
- sb.append(minutes > 1 ? " minutes " : " minute ");
- }
-
- if (hours == 0 && minutes == 0)
- {
- sb.append("just now");
- }
- else
- {
- sb.append("ago");
- }
-
- return sb.toString();
- }
- else
- {
- return df.format(getDatetime());
- }
- }
-
- @Column(name = "language")
- public String getLanguage()
- {
- return this.language;
- }
-
- public void setLanguage(String language)
- {
- this.language = language;
- }
-
- @Lob()
- @Column(name = "note")
- public String getNote()
- {
- return this.note;
- }
-
- public void setNote(String note)
- {
- this.note = note;
- }
-
- @Lob()
- @Column(name = "text")
- public String getText()
- {
- return this.text;
- }
-
- public void setText(String text)
- {
- this.text = text;
- }
-
- @Column(name = "user")
- public String getUser()
- {
- return this.user;
- }
-
- public void setUser(String user)
- {
- this.user = user;
- }
-}
\ No newline at end of file
Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/CodeFragment.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/CodeFragment.java 2010-06-16 13:35:18 UTC (rev 6441)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/CodeFragment.java 2010-06-16 13:43:01 UTC (rev 6442)
@@ -23,6 +23,7 @@
import static javax.persistence.GenerationType.AUTO;
+import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
@@ -46,6 +47,13 @@
public class CodeFragment
{
+ private static final long MS_PER_SECOND = 1000;
+ private static final long MS_PER_MINUTE = 60 * MS_PER_SECOND;
+ private static final long MS_PER_HOUR = 60 * MS_PER_MINUTE;
+ private static final long MS_PER_DAY = 24 * MS_PER_HOUR;
+
+ private static final SimpleDateFormat df = new SimpleDateFormat("d MMM");
+
@Id
@GeneratedValue(strategy = AUTO)
@Column(name = "id")
@@ -107,6 +115,60 @@
this.datetime = datetime;
}
+ public String getFriendlyDate()
+ {
+ if (getDatetime() == null)
+ return "unknown";
+
+ Date now = new Date();
+
+ long age = now.getTime() - getDatetime().getTime();
+
+ long days = (long) Math.floor(age / MS_PER_DAY);
+ age -= (days * MS_PER_DAY);
+ long hours = (long) Math.floor(age / MS_PER_HOUR);
+ age -= (hours * MS_PER_HOUR);
+ long minutes = (long) Math.floor(age / MS_PER_MINUTE);
+
+ if (days < 7)
+ {
+ StringBuilder sb = new StringBuilder();
+
+ if (days > 0)
+ {
+ sb.append(days);
+ sb.append(days > 1 ? " days " : " day ");
+ }
+
+ if (hours > 0)
+ {
+ sb.append(hours);
+ sb.append(hours > 1 ? " hrs " : " hr ");
+ }
+
+ if (minutes > 0)
+ {
+ sb.append(minutes);
+ sb.append(minutes > 1 ? " minutes " : " minute ");
+ }
+
+ if (hours == 0 && minutes == 0)
+ {
+ sb.append("just now");
+ }
+ else
+ {
+ sb.append("ago");
+ }
+
+ return sb.toString();
+ }
+ else
+ {
+ return df.format(getDatetime());
+ }
+ }
+
public Language getLanguage()
{
return language;
Added: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/EEProducers.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/EEProducers.java (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/EEProducers.java 2010-06-16 13:43:01 UTC (rev 6442)
@@ -0,0 +1,15 @@
+package org.jboss.weld.examples.pastecode.session;
+
+import javax.enterprise.inject.Produces;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+public class EEProducers
+{
+
+ @SuppressWarnings("unused")
+ @PersistenceContext(unitName = "pastecodeDatabase")
+ @Produces
+ private EntityManager em;
+
+}
Property changes on: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/EEProducers.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
13 years, 10 months
Weld SVN: r6441 - in examples/trunk/jsf/pastecode: src/main/java/org/jboss/weld/examples/pastecode/model and 5 other directories.
by weld-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-06-16 09:35:18 -0400 (Wed, 16 Jun 2010)
New Revision: 6441
Added:
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/AccessLog.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/CodeFragment.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/Language.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManager.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManagerImpl.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/LanguageManager.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Theme.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/ThemeManager.java
Removed:
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/LargeCodeLog.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Code.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeBean.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Data.java
Modified:
examples/trunk/jsf/pastecode/
examples/trunk/jsf/pastecode/pom.xml
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/servlets/DownloadServlet.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/HashComputer.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/History.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/LargeCodeDecorator.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Paster.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/PopulateDatabaseBean.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/QueryInfo.java
examples/trunk/jsf/pastecode/src/main/resources/data.sql
examples/trunk/jsf/pastecode/src/main/webapp/
examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/
examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/web.xml
examples/trunk/jsf/pastecode/src/main/webapp/display.xhtml
examples/trunk/jsf/pastecode/src/main/webapp/history.xhtml
examples/trunk/jsf/pastecode/src/main/webapp/home.xhtml
Log:
large number of updates to example, possibly not working right now 100% ;-)
Property changes on: examples/trunk/jsf/pastecode
___________________________________________________________________
Name: svn:ignore
+ target
.classpath
.settings
.project
Modified: examples/trunk/jsf/pastecode/pom.xml
===================================================================
--- examples/trunk/jsf/pastecode/pom.xml 2010-06-16 10:26:18 UTC (rev 6440)
+++ examples/trunk/jsf/pastecode/pom.xml 2010-06-16 13:35:18 UTC (rev 6441)
@@ -1,74 +1,80 @@
<?xml version="1.0"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
-
+
<parent>
<groupId>org.jboss.weld.examples</groupId>
<artifactId>weld-examples-parent</artifactId>
<version>1.0.2-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
-
+
<groupId>org.jboss.weld.examples.jsf.pastecode</groupId>
<artifactId>weld-jsf-pastecode</artifactId>
<packaging>war</packaging>
<name>Weld Examples: PasteCode</name>
-
+
<dependencies>
-
+
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<scope>test</scope>
<classifier>jdk15</classifier>
</dependency>
-
+
<dependency>
<groupId>javax.faces</groupId>
<artifactId>jsf-api</artifactId>
<scope>provided</scope>
</dependency>
-
+
<dependency>
<groupId>org.tuckey</groupId>
<artifactId>urlrewritefilter</artifactId>
<version>3.1.0</version>
<scope>compile</scope>
</dependency>
-
+
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
-
+
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<scope>provided</scope>
</dependency>
-
+
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<scope>provided</scope>
</dependency>
-
+
<dependency>
<groupId>org.jboss.ejb3</groupId>
- <artifactId>jboss-ejb3_1</artifactId>
- <version>1.0.8-alpha-1</version>
+ <artifactId>jboss-ejb3-api</artifactId>
<scope>provided</scope>
</dependency>
-
+
<dependency>
+ <groupId>javax.annotation</groupId>
+ <artifactId>jsr250-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
<version>1.1</version>
<scope>provided</scope>
</dependency>
-
+
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>el-impl</artifactId>
@@ -79,49 +85,51 @@
</exclusion>
</exclusions>
</dependency>
-
+
</dependencies>
-
+
<build>
<finalName>weld-pastecode</finalName>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-war-plugin</artifactId>
- <configuration>
- <warSourceExcludes>WEB-INF/classes/**,WEB-INF/lib/**</warSourceExcludes>
- </configuration>
- </plugin>
- <plugin>
- <groupId>com.pyx4j</groupId>
- <artifactId>maven-junction-plugin</artifactId>
- <executions>
- <execution>
- <id>unlink</id>
- <phase>clean</phase>
- <goals>
- <goal>unlink</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <links>
- <!-- link src/main/webapp -> war/ for IDEs -->
- <link>
- <dst>${basedir}/war</dst>
- <src>${basedir}/src/main/webapp</src>
- </link>
- </links>
- </configuration>
- </plugin>
- </plugins>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <warSourceExcludes>WEB-INF/classes/**,WEB-INF/lib/**</warSourceExcludes>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>com.pyx4j</groupId>
+ <artifactId>maven-junction-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unlink</id>
+ <phase>clean</phase>
+ <goals>
+ <goal>unlink</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <links>
+ <!-- link src/main/webapp -> war/ for IDEs -->
+ <link>
+ <dst>${basedir}/war</dst>
+ <src>${basedir}/src/main/webapp</src>
+ </link>
+ </links>
+ </configuration>
+ </plugin>
+ </plugins>
</build>
-
- <!-- <scm>
+
+ <!--
+ <scm>
<connection>scm:svn:http://anonsvn.jboss.org/repos/weld/examples/trunk/jsf/pastecode</connection>
<developerConnection>scm:svn:https://svn.jboss.org/repos/weld/examples/trunk/jsf/pastecode</developerConnection>
- <url>http://fisheye.jboss.org/browse/weld/examples/trunk/jsf/pastecode</url>
- </scm> -->
-
+ <url>http://fisheye.jboss.org/browse/weld/examples/trunk/jsf/pastecode</url>
+ </scm>
+ -->
+
</project>
Copied: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/AccessLog.java (from rev 6434, examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/LargeCodeLog.java)
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/AccessLog.java (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/AccessLog.java 2010-06-16 13:35:18 UTC (rev 6441)
@@ -0,0 +1,97 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.weld.examples.pastecode.model;
+
+import static javax.persistence.GenerationType.AUTO;
+
+import java.util.Date;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.ManyToOne;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+@Entity
+public class AccessLog
+{
+
+ @Id @GeneratedValue(strategy = AUTO)
+ private int id;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date datetime;
+
+ @ManyToOne
+ private CodeFragment codeFragment;
+
+ private String access;
+
+ public AccessLog(CodeFragment codeFragment, Date dateTime, String access)
+ {
+ this.codeFragment = codeFragment;
+ this.datetime = dateTime;
+ this.access = access;
+ }
+
+ public int getId()
+ {
+ return id;
+ }
+
+ public void setId(int id)
+ {
+ this.id = id;
+ }
+
+ public CodeFragment getCodeFragment()
+ {
+ return codeFragment;
+ }
+
+ public void setCodeFragment(CodeFragment codeFragment)
+ {
+ this.codeFragment = codeFragment;
+ }
+
+ public String getAccess()
+ {
+ return access;
+ }
+
+ public void setAccess(String access)
+ {
+ this.access = access;
+ }
+
+ public Date getDatetime()
+ {
+ return this.datetime;
+ }
+
+ public void setDatetime(Date datetime)
+ {
+ this.datetime = datetime;
+ }
+
+}
Copied: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/CodeFragment.java (from rev 6434, examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/CodeEntity.java)
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/CodeFragment.java (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/CodeFragment.java 2010-06-16 13:35:18 UTC (rev 6441)
@@ -0,0 +1,159 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.weld.examples.pastecode.model;
+
+import static javax.persistence.GenerationType.AUTO;
+
+import java.util.Date;
+import java.util.List;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Lob;
+import javax.persistence.OneToMany;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+/**
+ * The entity class for the pasted code "fragment". This is the main entity
+ * class in the application.
+ */
+@Entity
+public class CodeFragment
+{
+
+ @Id
+ @GeneratedValue(strategy = AUTO)
+ @Column(name = "id")
+ private int id;
+
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date datetime;
+
+ @Enumerated(EnumType.STRING)
+ private Language language;
+
+ @Lob
+ private String note;
+
+ @Lob
+ private String text;
+
+ private String user;
+
+ private String hash;
+
+ @OneToMany(mappedBy = "codeFragment", cascade = CascadeType.REMOVE)
+ List<AccessLog> largeCodeFragmentAccessLog;
+
+ public CodeFragment()
+ {
+ this.note = "";
+ this.text = "";
+ this.user = "";
+ }
+
+ public int getId()
+ {
+ return id;
+ }
+
+ public void setId(int id)
+ {
+ this.id = id;
+ }
+
+ public String getHash()
+ {
+ return hash;
+ }
+
+ public void setHash(String hash)
+ {
+ this.hash = hash;
+ }
+
+ public Date getDatetime()
+ {
+ return this.datetime;
+ }
+
+ public void setDatetime(Date datetime)
+ {
+ this.datetime = datetime;
+ }
+
+ public Language getLanguage()
+ {
+ return language;
+ }
+
+ public void setLanguage(Language language)
+ {
+ this.language = language;
+ }
+
+ public String getNote()
+ {
+ return this.note;
+ }
+
+ public void setNote(String note)
+ {
+ this.note = note;
+ }
+
+ public String getText()
+ {
+ return this.text;
+ }
+
+ public void setText(String text)
+ {
+ this.text = text;
+ }
+
+ public String getUser()
+ {
+ return this.user;
+ }
+
+ public void setUser(String user)
+ {
+ this.user = user;
+ }
+
+ public List<AccessLog> getLargeCodeFragmentAccessLog()
+ {
+ return largeCodeFragmentAccessLog;
+ }
+
+ public void setLargeCodeFragmentAccessLog(List<AccessLog> largeCodeFragmentAccessLog)
+ {
+ this.largeCodeFragmentAccessLog = largeCodeFragmentAccessLog;
+ }
+}
\ No newline at end of file
Added: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/Language.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/Language.java (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/Language.java 2010-06-16 13:35:18 UTC (rev 6441)
@@ -0,0 +1,57 @@
+/**
+ *
+ */
+package org.jboss.weld.examples.pastecode.model;
+
+
+public enum Language
+{
+
+ TEXT("txt", "Plain text", "text" ),
+ AS3("as3", "AS3", "as3" ),
+ BASH("sh", "Bash", "bash"),
+ CSHARP("cs", "C#", "csharp"),
+ COLD_FUSION("cf", "Cold Fusion", "coldfusion"), CPLUSPLUS("cpp", "C++", "cpp"),
+ CSS("css", "CSS", "css"),
+ DELPHI("pas", "Delphi", "pas"),
+ DIFF("diff", "Diff", "diff"), ERLANG("erl", "Erlang", "erl"),
+ GROOVY("groovy", "Groovy", "groovy"),
+ JAVASCRIPT("js", "JavaScript", "js"),
+ JAVA("java", "Java", "java"),
+ JAVAFX("fx", "JavaFX", "javafx"),
+ PERL("perl", "Perl", "perl"),
+ PHP("php", "PHP", "php"),
+ POWER_SHELL("ps1", "Power Shell", "powershell"),
+ PYTHON("py", "Python", "py"),
+ RUBY("rb", "Ruby", "rb"),
+ SCALA("scl", "Scala", "scala"),
+ SQL("sql", "Sql", "sql"),
+ VISUAL_BASIC("vb", "Visual Basic", "vb"),
+ XML("xml", "XML", "xml");
+
+ private final String extension;
+ private final String name;
+ private final String brush;
+
+ Language(String extension, String name, String brush)
+ {
+ this.extension = extension;
+ this.name = name;
+ this.brush = brush;
+ }
+
+ public String getBrush()
+ {
+ return brush;
+ }
+
+ public String getExtension()
+ {
+ return extension;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+}
\ No newline at end of file
Property changes on: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/Language.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Deleted: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/LargeCodeLog.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/LargeCodeLog.java 2010-06-16 10:26:18 UTC (rev 6440)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/LargeCodeLog.java 2010-06-16 13:35:18 UTC (rev 6441)
@@ -1,97 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.weld.examples.pastecode.model;
-
-import java.io.Serializable;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.persistence.GenerationType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Column;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-import java.util.Date;
-
-@Entity
-@Table(name = "largecodelog")
-public class LargeCodeLog implements Serializable
-{
- private static final long serialVersionUID = 1L;
- private int id;
- private Date datetime;
- private int codeId;
- private String access;
-
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- @Column(name = "id")
- public int getId()
- {
- return id;
- }
-
- public void setId(int id)
- {
- this.id = id;
- }
-
- public LargeCodeLog(int codeId, Date dateTime, String access)
- {
- this.codeId = codeId;
- this.datetime = dateTime;
- this.access = access;
- }
-
- public int getCodeId()
- {
- return codeId;
- }
-
- public void setCodeId(int codeId)
- {
- this.codeId = codeId;
- }
-
- public String getAccess()
- {
- return access;
- }
-
- public void setAccess(String access)
- {
- this.access = access;
- }
-
- @Temporal(TemporalType.TIMESTAMP)
- @Column(name = "datetime")
- public Date getDatetime()
- {
- return this.datetime;
- }
-
- public void setDatetime(Date datetime)
- {
- this.datetime = datetime;
- }
-
-}
Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/servlets/DownloadServlet.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/servlets/DownloadServlet.java 2010-06-16 10:26:18 UTC (rev 6440)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/servlets/DownloadServlet.java 2010-06-16 13:35:18 UTC (rev 6441)
@@ -21,35 +21,38 @@
*/
package org.jboss.weld.examples.pastecode.servlets;
-import java.io.*;
+import java.io.IOException;
+
+import javax.enterprise.inject.Instance;
+import javax.inject.Inject;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.jboss.weld.examples.pastecode.model.CodeEntity;
-import org.jboss.weld.examples.pastecode.session.Code;
-import javax.enterprise.inject.Instance;
-import javax.inject.Inject;
+import org.jboss.weld.examples.pastecode.model.CodeFragment;
+import org.jboss.weld.examples.pastecode.session.CodeFragmentManager;
+
public class DownloadServlet extends HttpServlet
{
private static final long serialVersionUID = 1L;
@Inject
- Instance<Code> eaoIn;
- Code eao;
+ Instance<CodeFragmentManager> eaoIn;
+ CodeFragmentManager eao;
public DownloadServlet()
{
}
+ @Override
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
this.eao = eaoIn.get();
- String id = (String) request.getParameter("id");
- CodeEntity c = eao.getCode(id);
+ String id = request.getParameter("id");
+ CodeFragment c = eao.getCodeFragment(id);
String fileName = c.getUser() + "." + c.getLanguage();
String txt = c.getText();
Deleted: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Code.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Code.java 2010-06-16 10:26:18 UTC (rev 6440)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Code.java 2010-06-16 13:35:18 UTC (rev 6441)
@@ -1,36 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.weld.examples.pastecode.session;
-
-import java.util.List;
-import org.jboss.weld.examples.pastecode.model.CodeEntity;
-
-public interface Code
-{
- public String addCode(CodeEntity code, boolean secured);
-
- public CodeEntity getCode(String id);
-
- public List<CodeEntity> recentCodes();
-
- public List<CodeEntity> searchCodes(CodeEntity code, int page, QueryInfo info);
-}
Deleted: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeBean.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeBean.java 2010-06-16 10:26:18 UTC (rev 6440)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeBean.java 2010-06-16 13:35:18 UTC (rev 6441)
@@ -1,211 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.weld.examples.pastecode.session;
-
-import java.security.NoSuchAlgorithmException;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import javax.annotation.Resource;
-import javax.ejb.EJBContext;
-import javax.ejb.EJBException;
-import javax.ejb.Stateless;
-import javax.ejb.TransactionAttribute;
-import javax.ejb.TransactionAttributeType;
-import javax.persistence.*;
-import org.jboss.weld.examples.pastecode.model.CodeEntity;
-import javax.inject.*;
-import java.util.*;
-
-/**
- * Session Bean implementation class CodeEAOBean
- */
-@Stateless
-@Named("codeEAOBean")
-public class CodeBean implements Code
-{
-
- @PersistenceContext(unitName = "pastecodeDatabase")
- private EntityManager em;
-
- @Resource
- EJBContext ctx;
-
- @Inject
- private HashComputer hashComp;
-
- private int MAX_CODES = 7;
-
- private int PAGE_SIZE = 2;
-
- public CodeBean()
- {
- }
-
- public String addCode(CodeEntity code, boolean secured)
- {
- String result;
- if (code.getDatetime() == null)
- {
- code.setDatetime(Calendar.getInstance().getTime());
- }
-
- if (code.getUser().trim().isEmpty())
- {
- code.setUser("Anonymous");
- }
-
- /* compute hash value and return it if secured flag has been set */
- if (secured)
- {
- try
- {
- String hashValue = hashComp.getHashValue(code);
- code.setHash(hashValue);
- result = hashValue;
- em.persist(code);
- }
- catch (NoSuchAlgorithmException e)
- {
- e.printStackTrace();
- return null;
- }
- }
- else
- {
- em.persist(code);
- result = new Integer(code.getId()).toString();
- }
-
- // System.out.println("Result: " + result);
-
- return result;
- }
-
- public CodeEntity getCode(String id)
- {
- boolean secured = true;
-
- try
- {
- Integer.parseInt(id);
- secured = false; /*
- * if it is possible to convert to number -> not
- * secured, otherwise -> secured
- */
- }
- catch (NumberFormatException e)
- {
- }
-
- if (secured)
- {
- Query q = em.createQuery("SELECT c FROM CodeEntity c WHERE hash = :hash");
- q.setParameter("hash", id);
- return (CodeEntity) q.getSingleResult();
- }
- else
- {
- CodeEntity c = em.find(CodeEntity.class, Integer.parseInt(id));
- /*
- * if somebody is trying to guess Id of secured code paste he cannot
- * pass
- */
- if (c.getHash() == null)
- {
- return c;
- }
- else
- {
- throw new EJBException("Access denied");
- }
- }
- }
-
- public List<CodeEntity> recentCodes()
- {
- Query q = em.createQuery("SELECT c FROM CodeEntity c WHERE hash=null ORDER BY datetime DESC ");
- q.setMaxResults(MAX_CODES);
- List<CodeEntity> codes = q.getResultList();
- return codes;
- }
-
- /**
- * getting codes from database needs new transaction so that we can further
- * modify returned Codes without affecting database (when we call this
- * function from another session bean
- */
- @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
- public List<CodeEntity> searchCodes(CodeEntity code, int page, QueryInfo info)
- {
- StringBuilder sb = new StringBuilder();
-
- String delim = "";
- if (!code.getUser().trim().equals(""))
- {
- sb.append("c.user = \'" + code.getUser().trim().toLowerCase() + "\'");
- delim = " AND";
- }
- if (!code.getLanguage().trim().equals(""))
- {
- sb.append(delim).append(" c.language = \'" + code.getLanguage().trim().toLowerCase() + "\'");
- delim = " AND";
- }
- if (!code.getNote().trim().equals(""))
- {
- sb.append(delim).append(" c.note LIKE \'%" + code.getNote().trim().toLowerCase() + "%\'");
- delim = " AND";
- }
- if (!code.getText().trim().equals(""))
- {
- sb.append(delim).append(" c.text LIKE \'%" + code.getText().toLowerCase() + "%\'");
- delim = " AND";
- }
- if (code.getDatetime() != null)
- {
- SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");
- Date date2 = new Date();
- date2.setTime(code.getDatetime().getTime() + 24 * 60 * 60 * 1000); // +1
- // day
-
- String formattedDate1 = formatter.format(code.getDatetime());
- String formattedDate2 = formatter.format(date2);
-
- sb.append(delim).append(" c.datetime between \'" + formattedDate1 + "\' and \'" + formattedDate2 + "\'");
- delim = " AND";
- }
-
- if (sb.toString().length() == 0)
- sb.append("1 = \'1\'");
-
- Query q = em.createQuery("SELECT c FROM CodeEntity c WHERE hash=null AND " + sb.toString() + " ORDER BY datetime DESC");
- int allRecords = q.getResultList().size();
- q.setFirstResult(page * PAGE_SIZE);
- q.setMaxResults(PAGE_SIZE);
- List<CodeEntity> codes = q.getResultList();
-
- info.setPage(page);
- info.setRecordsCount(allRecords);
- info.setPagesCount(allRecords / PAGE_SIZE);
-
- return codes;
- }
-}
Copied: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManager.java (from rev 6434, examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Code.java)
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManager.java (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManager.java 2010-06-16 13:35:18 UTC (rev 6441)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.weld.examples.pastecode.session;
+
+import java.util.List;
+
+import javax.ejb.Local;
+
+import org.jboss.weld.examples.pastecode.model.CodeFragment;
+
+@Local
+public interface CodeFragmentManager
+{
+ public String addCodeFragment(CodeFragment code, boolean privateFragment);
+
+ public CodeFragment getCodeFragment(String id);
+
+ public List<CodeFragment> getRecentCodeFragments();
+
+ public List<CodeFragment> searchCodeFragments(CodeFragment code, int page, QueryInfo info);
+}
Copied: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManagerImpl.java (from rev 6434, examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeBean.java)
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManagerImpl.java (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeFragmentManagerImpl.java 2010-06-16 13:35:18 UTC (rev 6441)
@@ -0,0 +1,216 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.weld.examples.pastecode.session;
+
+import java.security.NoSuchAlgorithmException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+import javax.ejb.Stateless;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+import javax.inject.Inject;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.Query;
+
+import org.jboss.weld.examples.pastecode.model.CodeFragment;
+
+@Stateless
+public class CodeFragmentManagerImpl implements CodeFragmentManager
+{
+
+ // The number of code fragments to return in our recentCodeFragments query
+ private static int MAX_RECENT_FRAGMENTS = 7;
+
+ // The number of code fragments to display per page
+ private static int PAGE_SIZE = 2;
+
+ @PersistenceContext(unitName = "pastecodeDatabase")
+ private EntityManager entityManager;
+
+ @Inject
+ private HashComputer hashComputer;
+
+ public String addCodeFragment(CodeFragment code, boolean privateFragment)
+ {
+ // Set the defaults
+ if (code.getDatetime() == null)
+ {
+ code.setDatetime(Calendar.getInstance().getTime());
+ }
+
+ if (code.getUser().trim().isEmpty())
+ {
+ code.setUser("Anonymous");
+ }
+
+ // compute hash value and return it if private flag has been set
+ if (privateFragment)
+ {
+ try
+ {
+ String hashValue = hashComputer.getHashValue(code);
+ code.setHash(hashValue);
+ entityManager.persist(code);
+ return hashValue;
+ }
+ catch (NoSuchAlgorithmException e)
+ {
+ e.printStackTrace();
+ return null;
+ }
+ }
+ // just return a non-hashed id
+ else
+ {
+ entityManager.persist(code);
+ return new Integer(code.getId()).toString();
+ }
+ }
+
+ public CodeFragment getCodeFragment(String id)
+ {
+ // If it's not an integer, it's a hash!
+ if (!isInteger(id))
+ {
+ Query query = entityManager.createQuery("SELECT c FROM CodeFragment c WHERE hash = :hash");
+ query.setParameter("hash", id);
+
+ @SuppressWarnings("unchecked")
+ List<CodeFragment> fragments = query.getResultList();
+
+ if (fragments.size() == 0)
+ {
+ throw new RuntimeException("No such fragment!");
+ }
+ else
+ {
+ return fragments.get(0);
+ }
+ }
+ else
+ {
+ CodeFragment c = entityManager.find(CodeFragment.class, Integer.parseInt(id));
+ if (c == null)
+ {
+ throw new RuntimeException("No such fragment!");
+ }
+ // If no hash was set, then this is not a private fragment, return it!
+ if (c.getHash() == null)
+ {
+ return c;
+ }
+ else
+ {
+ throw new RuntimeException("Access denied!");
+ }
+ }
+ }
+
+ private static boolean isInteger(String string)
+ {
+ try
+ {
+ Integer.parseInt(string);
+ return true;
+ }
+ catch (NumberFormatException e)
+ {
+ return false;
+ }
+ }
+
+ public List<CodeFragment> getRecentCodeFragments()
+ {
+ Query query = entityManager.createQuery("SELECT c FROM CodeFragment c WHERE hash=null ORDER BY datetime DESC ");
+ query.setMaxResults(MAX_RECENT_FRAGMENTS);
+
+ @SuppressWarnings("unchecked")
+ List<CodeFragment> codes = query.getResultList();
+
+ return codes;
+ }
+
+ /**
+ * getting codes from database needs new transaction so that we can further
+ * modify returned Codes without affecting database (when we call this
+ * function from another session bean
+ */
+ @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
+ public List<CodeFragment> searchCodeFragments(CodeFragment code, int page, QueryInfo info)
+ {
+ StringBuilder sb = new StringBuilder();
+
+ String delim = "";
+ if (!code.getUser().trim().equals(""))
+ {
+ sb.append("c.user = \'" + code.getUser().trim().toLowerCase() + "\'");
+ delim = " AND";
+ }
+ if (code.getLanguage() != null)
+ {
+ sb.append(delim).append(" c.language = \'" + code.getLanguage().name() + "\'");
+ delim = " AND";
+ }
+ if (!code.getNote().trim().equals(""))
+ {
+ sb.append(delim).append(" c.note LIKE \'%" + code.getNote().trim().toLowerCase() + "%\'");
+ delim = " AND";
+ }
+ if (!code.getText().trim().equals(""))
+ {
+ sb.append(delim).append(" c.text LIKE \'%" + code.getText().toLowerCase() + "%\'");
+ delim = " AND";
+ }
+ if (code.getDatetime() != null)
+ {
+ SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");
+ Date date2 = new Date();
+ date2.setTime(code.getDatetime().getTime() + 24 * 60 * 60 * 1000); // +1
+ // day
+
+ String formattedDate1 = formatter.format(code.getDatetime());
+ String formattedDate2 = formatter.format(date2);
+
+ sb.append(delim).append(" c.datetime between \'" + formattedDate1 + "\' and \'" + formattedDate2 + "\'");
+ delim = " AND";
+ }
+
+ if (sb.toString().length() == 0)
+ sb.append("1 = \'1\'");
+
+ Query q = entityManager.createQuery("SELECT c FROM CodeFragment c WHERE hash=null AND " + sb.toString() + " ORDER BY datetime DESC");
+ int allRecords = q.getResultList().size();
+ q.setFirstResult(page * PAGE_SIZE);
+ q.setMaxResults(PAGE_SIZE);
+ List<CodeFragment> codes = q.getResultList();
+
+ info.setPage(page);
+ info.setRecordsCount(allRecords);
+ info.setPagesCount(allRecords / PAGE_SIZE);
+
+ return codes;
+ }
+}
Deleted: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Data.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Data.java 2010-06-16 10:26:18 UTC (rev 6440)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Data.java 2010-06-16 13:35:18 UTC (rev 6441)
@@ -1,81 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.weld.examples.pastecode.session;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.inject.Named;
-import java.io.Serializable;
-import javax.faces.model.SelectItem;
-import javax.enterprise.inject.Produces;
-import java.util.List;
-import java.util.ArrayList;
-
-@ApplicationScoped
-@Named("dataBean")
-public class Data implements Serializable
-{
- private static final long serialVersionUID = 991300443278089016L;
-
- private int LANG_EXTENSION = 0; // e.g. txt
- private int LANG_NAME = 1; // e.g. Plain text
- private int LANG_BRUSH = 2; // e.g. text
- private String languages[][] = { { "txt", "Plain text", "text" }, { "as3", "AS3", "as3" }, { "sh", "Bash", "bash" }, { "cs", "C#", "csharp" }, { "cf", "Cold Fusion", "coldfusion" }, { "cpp", "C++", "cpp" }, { "css", "CSS", "css" }, { "pas", "Delphi", "pas" }, { "diff", "Diff", "diff" }, { "erl", "Erlang", "erl" }, { "groovy", "Groovy", "groovy" }, { "js", "JavaScript", "js" }, { "java", "Java", "java" }, { "fx", "JavaFX", "javafx" }, { "perl", "Perl", "perl" }, { "php", "PHP", "php" }, { "ps1", "Power Shell", "powershell" }, { "py", "Python", "py" }, { "rb", "Ruby", "rb" }, { "scl", "Scala", "scala" }, { "sql", "Sql", "sql" }, { "vb", "Visual Basic", "vb" }, { "xml", "XML", "xml" } };
- private String themes[] = { "Default Theme", "Django Theme", "Eclipse Theme", "Emacs Theme", "Midnight Theme", "Dark Theme" };
-
- public Data()
- {
- }
-
- @Produces
- @Named("languageItems")
- public List<SelectItem> getLanguageItems()
- {
- List<SelectItem> items = new ArrayList<SelectItem>();
- for (int i = 0; i != languages.length; i++)
- {
- items.add(new SelectItem(languages[i][LANG_EXTENSION], languages[i][LANG_NAME]));
- }
- return items;
- }
-
- @Produces
- @Named("themeItems")
- public List<SelectItem> getThemeItems()
- {
- List<SelectItem> items = new ArrayList<SelectItem>();
- for (int i = 0; i != themes.length; i++)
- {
- items.add(new SelectItem(themes[i]));
- }
- return items;
- }
-
- public String getBrush(String language)
- {
- for (int i = 0; i != languages.length; i++)
- {
- if (languages[i][LANG_EXTENSION].equals(language))
- return languages[i][LANG_BRUSH];
- }
- return languages[0][LANG_BRUSH];
- }
-}
Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/HashComputer.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/HashComputer.java 2010-06-16 10:26:18 UTC (rev 6440)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/HashComputer.java 2010-06-16 13:35:18 UTC (rev 6441)
@@ -21,17 +21,16 @@
*/
package org.jboss.weld.examples.pastecode.session;
-import org.jboss.weld.examples.pastecode.model.CodeEntity;
+import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
-import java.security.MessageDigest;
+import org.jboss.weld.examples.pastecode.model.CodeFragment;
+
+// TODO @Stateless
public class HashComputer
{
- public HashComputer()
- {
- }
- public String getHashValue(CodeEntity code) throws NoSuchAlgorithmException
+ public String getHashValue(CodeFragment code) throws NoSuchAlgorithmException
{
String hashValue;
MessageDigest md = MessageDigest.getInstance("SHA-1");
@@ -43,15 +42,27 @@
private String asHex(byte buf[])
{
- StringBuffer strBuf = new StringBuffer(buf.length * 2);
+ StringBuilder strBuf = new StringBuilder(buf.length * 2);
+ // make sure it contains a letter!
+ strBuf.append("h");
+
for (int i = 0; i < buf.length; i++)
{
- if (((int) buf[i] & 0xff) < 0x10)
+ if ((buf[i] & 0xff) < 0x10)
+ {
strBuf.append("0");
- strBuf.append(Long.toString((int) buf[i] & 0xff, 16));
+ strBuf.append(Long.toString(buf[i] & 0xff, 16));
+ }
}
+ if (strBuf.length() <= 6)
+ {
+ while (strBuf.length() <= 6)
+ {
+ strBuf.append("0");
+ }
+ }
+ return strBuf.toString().substring(0, 6);
+ }
- return strBuf.toString();
- }
}
Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/History.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/History.java 2010-06-16 10:26:18 UTC (rev 6440)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/History.java 2010-06-16 13:35:18 UTC (rev 6441)
@@ -21,85 +21,75 @@
*/
package org.jboss.weld.examples.pastecode.session;
-import java.util.List;
-import javax.ejb.Stateful;
-import javax.annotation.PostConstruct;
-import org.jboss.weld.examples.pastecode.model.CodeEntity;
-import javax.inject.Named;
-import javax.inject.Inject;
import java.io.Serializable;
+import java.util.List;
+
import javax.enterprise.context.SessionScoped;
import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+import javax.inject.Named;
+import org.jboss.weld.examples.pastecode.model.CodeFragment;
+
/**
* Session Bean implementation class HistoryBean
*/
@SessionScoped
@Named("history")
-@Stateful
+//TODO @Stateful
public class History implements Serializable
{
private static final long serialVersionUID = 20L;
+
+ // The max length of the snippet we show
+ private static int TRIMMED_TEXT_LEN = 120;
- transient @Inject
- Code eao;
+ @Inject
+ private CodeFragmentManager codeFragmentManager;
private QueryInfo info;
- private List<CodeEntity> codes;
+ private List<CodeFragment> codes;
- private int TRIMMED_TEXT_LEN = 120;
+ // The Search we are conducting
+ private final CodeFragment codeFragmentPrototype;
- private CodeEntity searchItem;
-
private int page = 0;
public History()
{
+ this.codeFragmentPrototype = new CodeFragment();
}
- @PostConstruct
- public void initialize()
+ public List<CodeFragment> getCodes()
{
- this.searchItem = new CodeEntity();
- // this.info = new QueryInfo();
- }
-
- public List<CodeEntity> getCodes()
- {
return this.codes;
}
- public void setCodes(List<CodeEntity> codes)
+ @Produces @Named
+ public CodeFragment getCodeFragmentPrototype()
{
- this.codes = codes;
+ return codeFragmentPrototype;
}
- @Produces
- @Named("searchItem")
- public CodeEntity getSearchItem()
- {
- return searchItem;
- }
-
- public void setSearchItem(CodeEntity searchItem)
- {
- this.searchItem = searchItem;
- }
-
+ //Start a *new* search!
public String newSearch()
{
this.page = 0;
return "history";
}
+ // Do the search, called as a "page action"
public String search()
{
this.info = new QueryInfo();
this.codes = null;
- this.codes = eao.searchCodes(this.searchItem, this.page, this.info);
+
+ // Perform a seach
+
+ this.codes = codeFragmentManager.searchCodeFragments(this.codeFragmentPrototype, this.page, this.info);
for (int i = 0; i != this.codes.size(); i++)
{
Copied: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/LanguageManager.java (from rev 6434, examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Data.java)
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/LanguageManager.java (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/LanguageManager.java 2010-06-16 13:35:18 UTC (rev 6441)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.weld.examples.pastecode.session;
+
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+import org.jboss.weld.examples.pastecode.model.Language;
+
+public class LanguageManager
+{
+
+ @Produces
+ @Named
+ public Language[] getLanguages()
+ {
+ return Language.values();
+ }
+
+}
Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/LargeCodeDecorator.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/LargeCodeDecorator.java 2010-06-16 10:26:18 UTC (rev 6440)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/LargeCodeDecorator.java 2010-06-16 13:35:18 UTC (rev 6441)
@@ -22,6 +22,7 @@
package org.jboss.weld.examples.pastecode.session;
import java.util.Date;
+
import javax.annotation.Resource;
import javax.decorator.Decorator;
import javax.decorator.Delegate;
@@ -31,10 +32,11 @@
import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
-import org.jboss.weld.examples.pastecode.model.CodeEntity;
-import org.jboss.weld.examples.pastecode.model.LargeCodeLog;
import javax.transaction.UserTransaction;
+import org.jboss.weld.examples.pastecode.model.CodeFragment;
+import org.jboss.weld.examples.pastecode.model.AccessLog;
+
/**
* This Decorator performs logging of information about large
* transactions. A transaction is large if the pasted code has
@@ -47,10 +49,10 @@
*/
@Decorator
@TransactionManagement(TransactionManagementType.BEAN)
-public abstract class LargeCodeDecorator implements Code
+public abstract class LargeCodeDecorator implements CodeFragmentManager
{
/* injecting Delagation point - mandatory */
- @Inject @Delegate @Any Code eao;
+ @Inject @Delegate @Any CodeFragmentManager eao;
@PersistenceContext(unitName = "pastecodeDatabase")
private EntityManager em;
@@ -59,10 +61,10 @@
private long LARGE_CODE = 65536;
- public String addCode(CodeEntity code, boolean secured)
+ public String addCodeFragment(CodeFragment code, boolean secured)
{
- String codeId = eao.addCode(code, secured);
+ String codeId = eao.addCodeFragment(code, secured);
if (code.getText().length() > LARGE_CODE)
{
@@ -70,7 +72,7 @@
{
ut.begin();
em.joinTransaction();
- em.persist(new LargeCodeLog(code.getId(), code.getDatetime(), "w")); //writing large code
+ em.persist(new AccessLog(code, code.getDatetime(), "w")); //writing large code
ut.commit();
}
catch(Exception e)
@@ -89,9 +91,9 @@
return codeId;
}
- public CodeEntity getCode(String id)
+ public CodeFragment getCodeFragment(String id)
{
- CodeEntity code = eao.getCode(id);
+ CodeFragment code = eao.getCodeFragment(id);
if (code.getText().length() > LARGE_CODE)
{
@@ -99,7 +101,7 @@
{
ut.begin();
em.joinTransaction();
- em.persist(new LargeCodeLog(code.getId(), new Date(), "r")); //reading large code
+ em.persist(new AccessLog(code, new Date(), "r")); //reading large code
ut.commit();
}
catch(Exception e)
Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Paster.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Paster.java 2010-06-16 10:26:18 UTC (rev 6440)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Paster.java 2010-06-16 13:35:18 UTC (rev 6441)
@@ -21,17 +21,21 @@
*/
package org.jboss.weld.examples.pastecode.session;
-import javax.inject.*;
+import java.util.List;
+
import javax.annotation.PostConstruct;
import javax.ejb.EJBException;
-import javax.enterprise.inject.*;
-import org.jboss.weld.examples.pastecode.model.*;
-import java.util.List;
+import javax.enterprise.inject.Model;
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+import javax.inject.Named;
+import org.jboss.weld.examples.pastecode.model.CodeFragment;
+
@Model
public class Paster
{
- private CodeEntity code;
+ private CodeFragment code;
private String codeId;
@@ -41,9 +45,9 @@
private boolean secured = false;
- @Inject Data data;
+ @Inject LanguageManager data;
- transient @Inject Code eao;
+ transient @Inject CodeFragmentManager eao;
public Paster()
{
@@ -52,37 +56,37 @@
@PostConstruct
public void postConstruct()
{
- this.code = new CodeEntity();
+ this.code = new CodeFragment();
this.theme = "shThemeDefault.css";
}
public String paste()
{
- this.codeId = eao.addCode(code, secured);
+ this.codeId = eao.addCodeFragment(code, secured);
return "success";
}
/* used for access from jsf page */
@Produces
@Named("code")
- public CodeEntity getPasterCodeInstance()
+ public CodeFragment getPasterCodeInstance()
{
return this.code;
}
public void loadCode()
{
- this.code = eao.getCode(codeId);
+ this.code = eao.getCodeFragment(codeId);
if (this.code == null)
throw new EJBException("Could not read entity with given id value");
- this.brush = data.getBrush(this.code.getLanguage());
+ this.brush = this.code.getLanguage().getBrush();
}
- public List<CodeEntity> getCodes()
+ public List<CodeFragment> getCodes()
{
- return eao.recentCodes();
+ return eao.getRecentCodeFragments();
}
public String getCodeId()
Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/PopulateDatabaseBean.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/PopulateDatabaseBean.java 2010-06-16 10:26:18 UTC (rev 6440)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/PopulateDatabaseBean.java 2010-06-16 13:35:18 UTC (rev 6441)
@@ -21,19 +21,21 @@
*/
package org.jboss.weld.examples.pastecode.session;
-import javax.enterprise.context.ApplicationScoped;
-import javax.inject.Named;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
-import javax.enterprise.inject.Instance;
import java.text.SimpleDateFormat;
import java.util.StringTokenizer;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Instance;
import javax.inject.Inject;
-import org.jboss.weld.examples.pastecode.model.CodeEntity;
-import com.sun.org.apache.xml.internal.serialize.LineSeparator;
+import javax.inject.Named;
+import org.jboss.weld.examples.pastecode.model.CodeFragment;
+import org.jboss.weld.examples.pastecode.model.Language;
+
/**
* This bean only populates database with preformatted data. This is due to need
* for Hypersonic database which doesn't allow multi-line inserts. Hypersonic
@@ -41,14 +43,15 @@
* external database to run this example.
*
*/
+// TODO Make into an EJB Singleton which executes at startup
@ApplicationScoped
@Named("database")
public class PopulateDatabaseBean
{
- private @Inject
- Instance<Code> eaoIn;
- private Code eao;
+ @Inject
+ private Instance<CodeFragmentManager> eaoIn;
+ private CodeFragmentManager eao;
private boolean secured = false;
private static final String file = "data.sql";
private boolean populated = false;
@@ -74,11 +77,11 @@
while (st.countTokens() > 1)
{
- CodeEntity c = new CodeEntity();
+ CodeFragment c = new CodeFragment();
st.nextToken();
c.setDatetime(formatter.parse(st.nextToken()));
st.nextToken();
- c.setLanguage(st.nextToken());
+ c.setLanguage(Language.valueOf(st.nextToken()));
st.nextToken();
c.setNote(st.nextToken());
st.nextToken();
@@ -86,7 +89,7 @@
st.nextToken();
c.setText(st.nextToken());
- eao.addCode(c, secured);
+ eao.addCodeFragment(c, secured);
}
}
@@ -108,7 +111,7 @@
while ((radek = br.readLine()) != null)
{
- sb.append(radek).append(LineSeparator.Web);
+ sb.append(radek).append("\n");
}
return new String(sb);
Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/QueryInfo.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/QueryInfo.java 2010-06-16 10:26:18 UTC (rev 6440)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/QueryInfo.java 2010-06-16 13:35:18 UTC (rev 6441)
@@ -21,11 +21,12 @@
*/
package org.jboss.weld.examples.pastecode.session;
+import java.util.ArrayList;
import java.util.List;
-import java.util.ArrayList;
public class QueryInfo
{
+
private int recordsCount = 0;
private int pagesCount = 0;
private int numLinks = 8;
Added: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Theme.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Theme.java (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Theme.java 2010-06-16 13:35:18 UTC (rev 6441)
@@ -0,0 +1,25 @@
+package org.jboss.weld.examples.pastecode.session;
+
+public enum Theme
+{
+
+ DEFAULT("Default Theme"),
+ DJANGO( "Django Theme"),
+ ECLIPSE("Eclipse Theme"),
+ EMACS("Emacs Theme"),
+ MIDNIGHT("Midnight Theme"),
+ DARK("Dark Theme");
+
+ private final String name;
+
+ private Theme(String name)
+ {
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+}
Property changes on: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Theme.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Added: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/ThemeManager.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/ThemeManager.java (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/ThemeManager.java 2010-06-16 13:35:18 UTC (rev 6441)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.weld.examples.pastecode.session;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Produces;
+import javax.inject.Named;
+
+@ApplicationScoped
+public class ThemeManager
+{
+
+ // The supported themes
+ private final List<String> THEMES = new ArrayList<String>();
+
+ @SuppressWarnings("unused")
+ @PostConstruct
+ private void populateThemes()
+ {
+ for (Theme theme : Theme.values())
+ {
+ THEMES.add(theme.getName());
+ }
+ }
+
+ @Produces @Named
+ public List<String> getThemes()
+ {
+ return Collections.unmodifiableList(THEMES);
+ }
+
+}
Property changes on: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/ThemeManager.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Name: svn:eol-style
+ native
Modified: examples/trunk/jsf/pastecode/src/main/resources/data.sql
===================================================================
--- examples/trunk/jsf/pastecode/src/main/resources/data.sql 2010-06-16 10:26:18 UTC (rev 6440)
+++ examples/trunk/jsf/pastecode/src/main/resources/data.sql 2010-06-16 13:35:18 UTC (rev 6441)
@@ -1,14 +1,14 @@
-insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (1, '2010-01-01 01:01:01', 'css', ' ', 'martin',
+insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (1, '2010-01-01 01:01:01', 'CSS', ' ', 'martin',
'div {
min-height: 500px;
height:auto !important;
height: 500px;
}');
-insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (2, '2009-01-02 01:01:01', 'css', ' ', 'peter',
+insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (2, '2009-01-02 01:01:01', 'CSS', ' ', 'peter',
'div {
height: expression( this.scrollHeight < 501 ? "500px" : "auto" );
}');
-insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (3, '2009-02-02 01:01:01', 'css', ' ', 'peter',
+insert into CodeFragment (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (3, '2009-02-02 01:01:01', 'CSS', ' ', 'peter',
'a.GlobalOrangeButton span {
background: transparent url(http://media-sprout.com/tutorials/web/CSSSprit-SlideButton/images/but... no-repeat 0 0;
display: block;
@@ -17,19 +17,19 @@
color: #fff;
}
');
-insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (4, '2009-02-02 01:01:01', 'js', ' ', 'john',
+insert into CodeFragment (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (4, '2009-02-02 01:01:01', 'JAVASCRIPT', ' ', 'john',
'var newPathname = "";
for ( i = 0; i pathArray.length; i++ ) {
newPathname += "/";
newPathname += pathArray[i];
}');
-insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (5, '2009-02-03 01:01:01', 'js', ' ', 'graham',
+insert into CodeFragment (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (5, '2009-02-03 01:01:01', 'JAVASCRIPT', ' ', 'graham',
'<script type="text/javascript">
<!--
function toggle_visibility(id) {
var e = document.getElementById(id);
');
-insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (6, '2009-02-04 01:01:01', 'js', ' ', 'martin',
+insert into CodeFragment (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (6, '2009-02-04 01:01:01', 'JAVASCRIPT', ' ', 'martin',
'var myArray = ["one", "two", "three"];
// console.log( myArray ) => ["one", "two", "three"]
@@ -37,7 +37,7 @@
myArray.length = 0;
// console.log( myArray ) => []');
-insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (7, '2009-02-04 01:01:01', 'js', ' ', 'crazyman',
+insert into CodeFragment (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (7, '2009-02-04 01:01:01', 'JAVASCRIPT', ' ', 'crazyman',
'function randRange(data) {
var newTime = data[Math.floor(data.length * Math.random())];
return newTime;
@@ -52,7 +52,7 @@
clearInterval(timer);
timer = setInterval(toggleSomething, randRange(timeArray));
');
-insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (8, '2009-02-05 01:01:01', 'java', ' ', 'peter',
+insert into CodeFragment (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (8, '2009-02-05 01:01:01', 'JAVA', ' ', 'peter',
'public List<code> recentcodes()
{
Query q = em.createQuery("SELECT c FROM code c WHERE hash=null ORDER BY datetime DESC ");
@@ -60,12 +60,12 @@
List<code> codes = q.getResultList();
return codes;
}');
-insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (9, '2009-02-05 01:01:01', 'java', ' ', 'graham',
+insert into CodeFragment (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (9, '2009-02-05 01:01:01', 'JAVA', ' ', 'graham',
' private void startOperation() throws HibernateException {
session = HibernateFactory.openSession();
tx = session.beginTransaction();
}');
-insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (10, '2009-01-06 01:01:01', 'java', ' ', 'martin',
+insert into CodeFragment (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (10, '2009-01-06 01:01:01', 'JAVA', ' ', 'martin',
'public List findAll() throws DataAccessLayerException{
List events = null;
try {
@@ -81,7 +81,7 @@
return events;
}
');
-insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (11, '2009-02-06 01:01:01', 'java', ' ', 'crazyman',
+insert into CodeFragment (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (11, '2009-02-06 01:01:01', 'JAVA', ' ', 'crazyman',
'public Event find(Long id) throws DataAccessLayerException {
Event event = null;
try {
@@ -95,7 +95,7 @@
}
return event;
}');
-insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (12, '2009-01-07 01:01:01', 'java', ' ', 'graham',
+insert into CodeFragment (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (12, '2009-01-07 01:01:01', 'JAVA', ' ', 'graham',
' public void delete(Event event) throws DataAccessLayerException {
try {
startOperation();
@@ -107,7 +107,7 @@
HibernateFactory.close(session);
}
}');
-insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (13, '2009-01-08 01:01:01', 'java', ' ', 'peter',
+insert into CodeFragment (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (13, '2009-01-08 01:01:01', 'JAVA', ' ', 'peter',
'public void create(Event event) throws DataAccessLayerException {
try {
startOperation();
@@ -119,7 +119,7 @@
HibernateFactory.close(session);
}
}');
-insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (14, '2009-01-09 01:01:01', 'php', ' ', 'martin',
+insert into CodeFragment (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (14, '2009-01-09 01:01:01', 'PHP', ' ', 'martin',
'function build_calendar($month,$year,$dateArray) {
// Create array containing abbreviations of days of week.
@@ -131,12 +131,12 @@
// How many days does this month contain?
$numberDays = date(t,$firstDayOfMonth);
}');
-insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (15, '2009-01-10 01:01:01', 'php', ' ', 'john',
+insert into CodeFragment (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (15, '2009-01-10 01:01:01', 'PHP', ' ', 'john',
'if ( !empty($_SERVER[HTTP_X_REQUESTED_WITH]) && strtolower($_SERVER[HTTP_X_REQUESTED_WITH]) == xmlhttprequest )
{
# Ex. check the query and serve requested data
}');
-insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (16, '2009-01-11 01:01:01', 'php', ' ', 'graham',
+insert into CodeFragment (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (16, '2009-01-11 01:01:01', 'PHP', ' ', 'graham',
'<?php
function getTwitterStatus($userid){
@@ -154,11 +154,11 @@
getTwitterStatus("kenrick1991");
?>');
-insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (17, '2009-01-11 01:01:01', 'php', ' ', 'peter',
+insert into CodeFragment (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (17, '2009-01-11 01:01:01', 'PHP', ' ', 'peter',
'<?php
header( Location: http://www.yoursite.com/new_page.html ) ;
?>');
-insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (18, '2009-01-12 01:01:01', 'php', ' ', 'martin',
+insert into CodeFragment (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (18, '2009-01-12 01:01:01', 'PHP', ' ', 'martin',
'function findexts ($filename) {
$filename = strtolower($filename) ;
@@ -172,14 +172,14 @@
return $exts;
}');
-insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (19, '2009-01-12 01:01:01', 'php', ' ', 'graham',
+insert into CodeFragment (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (19, '2009-01-12 01:01:01', 'PHP', ' ', 'graham',
'function fileRead($file){
$lines = file($file);
foreach ($lines as $line_num => $line) {
echo $line, </br>;
}
}');
-insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (20, '2009-02-12 01:01:01', 'java', ' ', 'peter',
+insert into CodeFragment (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (20, '2009-02-12 01:01:01', 'JAVA', ' ', 'peter',
'import java.util.*;
import org.hibernate.*;
@@ -210,7 +210,7 @@
}
}');
-insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (21, '2009-02-16 01:01:01', 'java', ' ', 'crazyman',
+insert into CodeFragment (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (21, '2009-02-16 01:01:01', 'JAVA', ' ', 'crazyman',
'import javax.swing.DefaultListModel;
import javax.swing.DropMode;
import javax.swing.JComboBox;
@@ -248,7 +248,7 @@
return true;
}
}');
-insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (22, '2009-02-15 01:01:01', 'java', ' ', 'martin',
+insert into CodeFragment (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (22, '2009-02-15 01:01:01', 'JAVA', ' ', 'martin',
'@Entity
public class Address {
@Id
@@ -306,7 +306,7 @@
}
}');
-insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (23, '2009-02-18 01:01:01', 'java', ' ', 'graham',
+insert into CodeFragment (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (23, '2009-02-18 01:01:01', 'JAVA', ' ', 'graham',
'import java.util.List;
import javax.persistence.EntityManager;
@@ -328,7 +328,7 @@
}
}');
-insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (24, '2009-02-19 01:01:01', 'java', ' ', 'crazyman',
+insert into CodeFragment (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (24, '2009-02-19 01:01:01', 'JAVA', ' ', 'crazyman',
'@Entity
public class Department {
@Id
@@ -358,7 +358,7 @@
}
}
');
-insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (25, '2009-02-01 01:01:01', 'java', ' ', 'graham',
+insert into CodeFragment (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (25, '2009-02-01 01:01:01', 'JAVA', ' ', 'graham',
'import java.io.Reader;
import java.sql.Connection;
import java.sql.DriverManager;
@@ -404,7 +404,7 @@
}
}');
-insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (26, '2009-02-01 01:01:01', 'java', 'Some note', 'martin',
+insert into CodeFragment (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (26, '2009-02-01 01:01:01', 'JAVA', 'Some note', 'martin',
'package org.jboss.weld.examples.pastie.session;
import java.util.List;
Property changes on: examples/trunk/jsf/pastecode/src/main/webapp
___________________________________________________________________
Name: svn:ignore
+ META-INF
Property changes on: examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF
___________________________________________________________________
Name: svn:ignore
+ lib
Modified: examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/web.xml
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/web.xml 2010-06-16 10:26:18 UTC (rev 6440)
+++ examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/web.xml 2010-06-16 13:35:18 UTC (rev 6441)
@@ -1,55 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
-<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
- version="2.5">
-
- <display-name>Weld PasteCode example</display-name>
-<!-- <distributable />-->
-
- <context-param>
- <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
- <param-value>.xhtml</param-value>
- </context-param>
-
- <session-config>
- <session-timeout>10</session-timeout>
- </session-config>
-
- <servlet>
- <servlet-name>Faces Servlet</servlet-name>
- <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
- <load-on-startup>1</load-on-startup>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>Faces Servlet</servlet-name>
- <url-pattern>*.jsf</url-pattern>
- <url-pattern>/faces/*</url-pattern>
- </servlet-mapping>
-
- <filter>
- <filter-name>UrlRewriteFilter</filter-name>
- <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
- </filter>
-
- <filter-mapping>
- <filter-name>UrlRewriteFilter</filter-name>
- <url-pattern>/*</url-pattern>
- <dispatcher>REQUEST</dispatcher>
- <dispatcher>FORWARD</dispatcher>
- </filter-mapping>
-
- <servlet>
- <description></description>
- <display-name>DownloadServlet</display-name>
- <servlet-name>DownloadServlet</servlet-name>
- <servlet-class>org.jboss.weld.examples.pastecode.servlets.DownloadServlet</servlet-class>
- </servlet>
-
- <servlet-mapping>
- <servlet-name>DownloadServlet</servlet-name>
- <url-pattern>/download</url-pattern>
- </servlet-mapping>
-
-</web-app>
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
+ <display-name>Weld PasteCode example</display-name>
+ <context-param>
+ <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
+ <param-value>.xhtml</param-value>
+ </context-param>
+ <session-config>
+ <session-timeout>10</session-timeout>
+ </session-config>
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.jsf</url-pattern>
+ <url-pattern>/faces/*</url-pattern>
+ </servlet-mapping>
+ <filter>
+ <filter-name>UrlRewriteFilter</filter-name>
+ <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>UrlRewriteFilter</filter-name>
+ <url-pattern>/*</url-pattern>
+ <dispatcher>REQUEST</dispatcher>
+ <dispatcher>FORWARD</dispatcher>
+ </filter-mapping>
+ <servlet>
+ <description></description>
+ <display-name>DownloadServlet</display-name>
+ <servlet-name>DownloadServlet</servlet-name>
+ <servlet-class>org.jboss.weld.examples.pastecode.servlets.DownloadServlet</servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>DownloadServlet</servlet-name>
+ <url-pattern>/download</url-pattern>
+ </servlet-mapping>
+</web-app>
\ No newline at end of file
Modified: examples/trunk/jsf/pastecode/src/main/webapp/display.xhtml
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/display.xhtml 2010-06-16 10:26:18 UTC (rev 6440)
+++ examples/trunk/jsf/pastecode/src/main/webapp/display.xhtml 2010-06-16 13:35:18 UTC (rev 6441)
@@ -42,7 +42,7 @@
<h:panelGroup>
<h:outputLabel for="theme" value="Choose theme: "/>
<h:selectOneMenu id="theme" value="#{paster.theme}" onchange="chooseStyle(this.value);"> <!-- this.form.submit() -->
- <f:selectItems value="#{dataBean.themeItems}"/>
+ <f:selectItems value="#{themes}"/>
</h:selectOneMenu>
<a href="download?id=#{code.hash == null ? code.id : code.hash}" style="text-decoration: none;"><input type="button" value="Download file" /></a>
</h:panelGroup>
Modified: examples/trunk/jsf/pastecode/src/main/webapp/history.xhtml
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/history.xhtml 2010-06-16 10:26:18 UTC (rev 6440)
+++ examples/trunk/jsf/pastecode/src/main/webapp/history.xhtml 2010-06-16 13:35:18 UTC (rev 6441)
@@ -1,98 +1,95 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
- xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:s="http://jboss.com/products/seam/taglib">
-
- <ui:composition template="template.xhtml">
- <ui:define name="viewMetadata">
- <f:metadata>
- <f:viewParam name="page" value="#{history.page}"/>
- <f:event type="preRenderView" listener="#{history.search}"/>
- </f:metadata>
- </ui:define>
-
- <ui:define name="themes">
- </ui:define>
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:s="http://jboss.com/products/seam/taglib">
- <ui:define name="mainarea">
- <div style="width: 100%; padding: 7px;">
-
- <div id="paging" style="width:98%; border-width:0px; background-color:#C1C1E8;"> <!-- height: 40px; -->
- <ui:include src="pagination.xhtml"></ui:include>
- </div>
- <br/>
- <h:dataTable value="#{history.codes}" var="varcode" width="99%">
- <h:column>
- <div id="searched">
- <h:panelGroup >
- <h:outputLabel for="user" value="User: "/>
- <h:outputLink id="user" value="#{ varcode.id}"> <!-- display.jsf?id= -->
- <h:outputText value="#{varcode.user}"></h:outputText>
- </h:outputLink>
- </h:panelGroup>
-
- <h:panelGroup>
- <h:outputLabel for="language" value="Language: "/>
- <h:outputText id="language" value="#{ varcode.language}"></h:outputText>
- </h:panelGroup>
-
- <h:panelGroup>
- <h:outputLabel for="datetime" value="Date: "/>
- <h:outputText id="datetime" value="#{ varcode.datetime}">
- <f:convertDateTime type="both" pattern="yyyy-MM-dd HH:mm:ss"/>
- </h:outputText>
- </h:panelGroup>
- </div>
- <br/>
- <h:outputText value="Code (truncated): "/>
- <div style="height:100px; width:99%; border: 1px solid #7F7F7F; overflow: auto; padding: 1px;">
- <pre>#{varcode.text}</pre>
- </div>
- <br/>
- <br/>
- </h:column>
- </h:dataTable>
- <br/>
- <div id="paging" style="width:98%; border-width:0px; background-color:#C1C1E8;"> <!-- height: 40px; -->
- <ui:include src="pagination.xhtml"></ui:include>
- </div>
- </div>
-
- </ui:define>
-
- <ui:define name="rightmenu">
-
- <div id="rightmenuhead" style="width:350px;">
- <strong>Search:</strong>
- </div>
-
- <div id="rightmenubody" style="width:350px;">
-
- <h:panelGrid cellpadding="0" cellspacing="0" columns="2" width="100%">
- <h:outputLabel for="user" value="User:"></h:outputLabel>
- <h:inputText id="user" maxlength="30" style="width:97%;" value="#{searchItem.user}"/>
- <h:outputLabel for="language" value="Language:"></h:outputLabel>
- <h:inputText id="language" maxlength="30" style="width:97%;" value="#{searchItem.language}"/>
- <h:outputLabel for="note" value="Note:"></h:outputLabel>
- <h:inputText id="note" maxlength="30" style="width:97%;" value="#{searchItem.note}"/>
- <h:outputLabel for="pasteDate" value="Date: "/>
- <h:inputText value="#{searchItem.datetime}" id="pasteDate" style="width:97%;" alt="yyyy-mm-dd" title="yyyy-mm-dd"
- converterMessage="Enter date formatted as yyyy-mm-dd !" >
- <f:convertDateTime type="date" pattern="yyyy-MM-dd"/>
- </h:inputText>
- <h:outputLabel for="code" value="Code:" style="width:100%;"></h:outputLabel>
- <h:inputTextarea id="code" maxlength="30" rows="2" style="width:97%;" value="#{searchItem.text}"/>
- </h:panelGrid>
- <div style="width:100%;text-align:right;">
- <h:commandButton value="Search" action="#{history.newSearch}"/>
- </div>
- <br/>
- <h:message for="pasteDate"/>
- </div>
-
- </ui:define>
-
- </ui:composition>
+<ui:composition template="template.xhtml">
+ <ui:define name="viewMetadata">
+ <f:metadata>
+ <f:viewParam name="page" value="#{history.page}" />
+ <f:event type="preRenderView" listener="#{history.search}" />
+ </f:metadata>
+ </ui:define>
+
+ <ui:define name="themes">
+ </ui:define>
+
+ <ui:define name="mainarea">
+ <div style="width: 100%; padding: 7px;">
+
+ <div id="paging"
+ style="width: 98%; border-width: 0px; background-color: #C1C1E8;">
+ <!-- height: 40px; --> <ui:include src="pagination.xhtml"></ui:include>
+ </div>
+ <br />
+ <h:dataTable value="#{history.codes}" var="codeFragment" width="99%">
+ <h:column>
+ <div id="searched"><h:panelGroup>
+ <h:outputLabel for="user" value="User: " />
+ <h:outputLink id="user" value="#{codeFragment.id}">
+ <!-- display.jsf?id= -->
+ <h:outputText value="#{codeFragment.user}"></h:outputText>
+ </h:outputLink>
+ </h:panelGroup> <h:panelGroup>
+ <h:outputLabel for="language" value="Language: " />
+ <h:outputText id="language" value="#{codeFragment.language.name}"></h:outputText>
+ </h:panelGroup> <h:panelGroup>
+ <h:outputLabel for="datetime" value="Date: " />
+ <h:outputText id="datetime" value="#{codeFragment.datetime}">
+ <f:convertDateTime type="both" pattern="yyyy-MM-dd HH:mm:ss" />
+ </h:outputText>
+ </h:panelGroup></div>
+ <br />
+ <h:outputText value="Code (truncated): " />
+ <div
+ style="height: 100px; width: 99%; border: 1px solid #7F7F7F; overflow: auto; padding: 1px;">
+ <pre>#{codeFragment.text}</pre></div>
+ <br />
+ <br />
+ </h:column>
+ </h:dataTable> <br />
+ <div id="paging"
+ style="width: 98%; border-width: 0px; background-color: #C1C1E8;">
+ <!-- height: 40px; --> <ui:include src="pagination.xhtml"></ui:include>
+ </div>
+ </div>
+
+ </ui:define>
+
+ <ui:define name="rightmenu">
+
+ <div id="rightmenuhead" style="width: 350px;"><strong>Search:</strong>
+ </div>
+
+ <div id="rightmenubody" style="width: 350px;"><h:panelGrid
+ cellpadding="0" cellspacing="0" columns="2" width="100%">
+ <h:outputLabel for="user" value="User:"></h:outputLabel>
+ <h:inputText id="user" maxlength="30" style="width:97%;"
+ value="#{codeFragmentPrototype.user}" />
+ <h:outputLabel for="language" value="Language:"></h:outputLabel>
+ <h:inputText id="language" maxlength="30" style="width:97%;"
+ value="#{codeFragmentPrototype.language}" />
+ <h:outputLabel for="note" value="Note:"></h:outputLabel>
+ <h:inputText id="note" maxlength="30" style="width:97%;"
+ value="#{codeFragmentPrototype.note}" />
+ <h:outputLabel for="pasteDate" value="Date: " />
+ <h:inputText value="#{codeFragmentPrototype.datetime}" id="pasteDate"
+ style="width:97%;" alt="yyyy-mm-dd" title="yyyy-mm-dd"
+ converterMessage="Enter date formatted as yyyy-mm-dd !">
+ <f:convertDateTime type="date" pattern="yyyy-MM-dd" />
+ </h:inputText>
+ <h:outputLabel for="code" value="Code:" style="width:100%;"></h:outputLabel>
+ <h:inputTextarea id="code" maxlength="30" rows="2" style="width:97%;"
+ value="#{codeFragmentPrototype.text}" />
+ </h:panelGrid>
+ <div style="width: 100%; text-align: right;"><h:commandButton
+ value="Search" action="#{history.newSearch}" /></div>
+ <br />
+ <h:message for="pasteDate" /></div>
+
+ </ui:define>
+
+</ui:composition>
</html>
Modified: examples/trunk/jsf/pastecode/src/main/webapp/home.xhtml
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/home.xhtml 2010-06-16 10:26:18 UTC (rev 6440)
+++ examples/trunk/jsf/pastecode/src/main/webapp/home.xhtml 2010-06-16 13:35:18 UTC (rev 6441)
@@ -24,7 +24,7 @@
<h:panelGroup>
<h:outputLabel for="language" value="Language: "/>
<h:selectOneMenu id="language" value="#{code.language}">
- <f:selectItems value="#{dataBean.languageItems}"/>
+ <f:selectItems value="#{languages}" var="language" itemLabel="#{language.name}" itemValue="#{language.extension}" />
</h:selectOneMenu>
</h:panelGroup>
<h:panelGroup style="text-align:right;">
13 years, 10 months
Weld SVN: r6440 - examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF.
by weld-commits@lists.jboss.org
Author: mgencur(a)redhat.com
Date: 2010-06-16 06:26:18 -0400 (Wed, 16 Jun 2010)
New Revision: 6440
Modified:
examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/urlrewrite.xml
Log:
get rid of weird urlrewriter parser error by changing dtd version to 3.0
Modified: examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/urlrewrite.xml
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/urlrewrite.xml 2010-06-16 06:30:58 UTC (rev 6439)
+++ examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/urlrewrite.xml 2010-06-16 10:26:18 UTC (rev 6440)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 3.2//EN"
- "http://tuckey.org/res/dtds/urlrewrite3.2.dtd">
+<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 3.0//EN"
+ "http://tuckey.org/res/dtds/urlrewrite3.0.dtd">
<!--
13 years, 10 months
Weld SVN: r6439 - in examples/trunk/jsf: permalink and 1 other directory.
by weld-commits@lists.jboss.org
Author: dan.j.allen
Date: 2010-06-16 02:30:58 -0400 (Wed, 16 Jun 2010)
New Revision: 6439
Modified:
examples/trunk/jsf/numberguess/pom.xml
examples/trunk/jsf/permalink/pom.xml
Log:
remove maven-cli-plugin in favor of Maven 3 shell
Modified: examples/trunk/jsf/numberguess/pom.xml
===================================================================
--- examples/trunk/jsf/numberguess/pom.xml 2010-06-16 03:26:00 UTC (rev 6438)
+++ examples/trunk/jsf/numberguess/pom.xml 2010-06-16 06:30:58 UTC (rev 6439)
@@ -731,24 +731,6 @@
</configuration>
</plugin>
- <plugin>
- <groupId>org.twdata.maven</groupId>
- <artifactId>maven-cli-plugin</artifactId>
- <configuration>
- <userAliases>
- <runjetty>compile
- org.apache.maven.plugins:maven-war-plugin:inplace
- org.mortbay.jetty:maven-jetty-plugin:run</runjetty>
- <runtomcat>compile
- org.apache.maven.plugins:maven-war-plugin:inplace
- org.codehaus.mojo:tomcat-maven-plugin:run</runtomcat>
- <explode>compile
- org.apache.maven.plugins:maven-war-plugin:inplace
- -o</explode>
- </userAliases>
- </configuration>
- </plugin>
-
</plugins>
</build>
Modified: examples/trunk/jsf/permalink/pom.xml
===================================================================
--- examples/trunk/jsf/permalink/pom.xml 2010-06-16 03:26:00 UTC (rev 6438)
+++ examples/trunk/jsf/permalink/pom.xml 2010-06-16 06:30:58 UTC (rev 6439)
@@ -160,38 +160,6 @@
</configuration>
</plugin>
- <plugin>
- <groupId>org.twdata.maven</groupId>
- <artifactId>maven-cli-plugin</artifactId>
- <configuration>
- <prompt>${project.artifactId}</prompt>
- <!-- userAliases are for cli:execute-phase -->
- <userAliases>
- <runjetty>compile
- org.mortbay.jetty:maven-jetty-plugin:run -Pjetty</runjetty>
- <stopjetty>org.mortbay.jetty:maven-jetty-plugin:stop
- -Pjetty</stopjetty>
- <runtomcat>compile
- org.apache.maven.plugins:maven-war-plugin:inplace
- org.codehaus.mojo:tomcat-maven-plugin:run -Ptomcat</runtomcat>
- <explode>compile -o</explode>
- <!-- tomcat requires use of war:inplace -->
- <tcexplode>compile
- org.apache.maven.plugins:maven-war-plugin:inplace
- -Ptomcat -o</tcexplode>
- <restart>org.apache.maven.plugins:maven-antrun-plugin:run
- -Prestart-embedded</restart>
- <profiles>org.apache.maven.plugins:maven-help-plugin:active-profiles
- -o</profiles>
- <pom>org.apache.maven.plugins:maven-help-plugin:effective-pom
- -o</pom>
- </userAliases>
- <!-- commands are for cli:execute -->
- <commands>
- </commands>
- </configuration>
- </plugin>
-
</plugins>
</build>
13 years, 10 months
Weld SVN: r6438 - in archetypes/branches/prototype: src and 17 other directories.
by weld-commits@lists.jboss.org
Author: sboscarine
Date: 2010-06-15 23:26:00 -0400 (Tue, 15 Jun 2010)
New Revision: 6438
Added:
archetypes/branches/prototype/pom.xml
archetypes/branches/prototype/readme.txt
archetypes/branches/prototype/src/
archetypes/branches/prototype/src/main/
archetypes/branches/prototype/src/main/java/
archetypes/branches/prototype/src/main/java/com/
archetypes/branches/prototype/src/main/java/com/mycompany/
archetypes/branches/prototype/src/main/java/com/mycompany/HelloWorld.java
archetypes/branches/prototype/src/main/java/com/mycompany/Widget.java
archetypes/branches/prototype/src/main/java/com/mycompany/WidgetListProducer.java
archetypes/branches/prototype/src/main/java/com/mycompany/WidgetRepository.java
archetypes/branches/prototype/src/main/java/com/mycompany/WidgetRepositoryProducer.java
archetypes/branches/prototype/src/main/resources/
archetypes/branches/prototype/src/main/resources/META-INF/
archetypes/branches/prototype/src/main/resources/META-INF/persistence.xml
archetypes/branches/prototype/src/main/resources/import.sql
archetypes/branches/prototype/src/main/webapp/
archetypes/branches/prototype/src/main/webapp/META-INF/
archetypes/branches/prototype/src/main/webapp/META-INF/MANIFEST.MF
archetypes/branches/prototype/src/main/webapp/META-INF/context.xml
archetypes/branches/prototype/src/main/webapp/WEB-INF/
archetypes/branches/prototype/src/main/webapp/WEB-INF/beans.xml
archetypes/branches/prototype/src/main/webapp/WEB-INF/faces-config.xml
archetypes/branches/prototype/src/main/webapp/WEB-INF/lib/
archetypes/branches/prototype/src/main/webapp/WEB-INF/templates/
archetypes/branches/prototype/src/main/webapp/WEB-INF/templates/default.xhtml
archetypes/branches/prototype/src/main/webapp/WEB-INF/web.xml
archetypes/branches/prototype/src/main/webapp/home.xhtml
archetypes/branches/prototype/src/main/webapp/index.jsp
archetypes/branches/prototype/src/main/webapp/resources/
archetypes/branches/prototype/src/main/webapp/resources/css/
archetypes/branches/prototype/src/main/webapp/resources/css/screen.css
archetypes/branches/prototype/src/main/webapp/resources/gfx/
archetypes/branches/prototype/src/main/webapp/resources/gfx/banner.png
archetypes/branches/prototype/src/main/webapp/resources/gfx/weld.png
archetypes/branches/prototype/src/test/
archetypes/branches/prototype/src/test/java/
archetypes/branches/prototype/src/test/java/com/
archetypes/branches/prototype/src/test/java/com/mycompany/
archetypes/branches/prototype/src/test/java/com/mycompany/HelloWorldTest.java
archetypes/branches/prototype/src/test/resources/
Modified:
archetypes/branches/prototype/
Log:
first round of archetypes revamp
Property changes on: archetypes/branches/prototype
___________________________________________________________________
Name: svn:ignore
+ .settings
target
.classpath
.project
Added: archetypes/branches/prototype/pom.xml
===================================================================
--- archetypes/branches/prototype/pom.xml (rev 0)
+++ archetypes/branches/prototype/pom.xml 2010-06-16 03:26:00 UTC (rev 6438)
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>com.mycompany</groupId>
+ <artifactId>myproject</artifactId>
+ <packaging>war</packaging>
+ <name>myproject</name>
+ <version>1.0.0-SNAPSHOT</version>
+
+ <properties>
+ <!--
+ Explicitly declaring the source encoding eliminates the following message: [WARNING] Using platform encoding
+ (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
+ -->
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <!--
+ Timestamp format for the maven.build.timestamp property; you can reference property in pom.xml or filtered
+ resources (must enable third-party plugin if using Maven < 2.1)
+ -->
+ <maven.build.timestamp.format>yyyyMMdd'T'HHmmss</maven.build.timestamp.format>
+ <!--
+ To set the jboss.home environment variable the Maven way, set the jboss.home property in an active profile in
+ the Maven 2 settings.xml file
+ -->
+ <jboss.home>${env.JBOSS_HOME}</jboss.home>
+ <jboss.domain>default</jboss.domain>
+ </properties>
+
+ <repositories>
+ <!-- Optional Repository. -->
+ <!-- Soon all required dependencies will be pushed to maven central. -->
+ <!-- In the mean time, we need to point this archetype to the JBoss Maven Repository -->
+ <repository>
+ <id>jboss-public-repository</id>
+ <name>JBoss Repository</name>
+ <url>https://repository.jboss.org/nexus/content/groups/public</url>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ <updatePolicy>daily</updatePolicy>
+ </snapshots>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <!-- GlassFish repository required for embedded-glassfish plugin -->
+ <pluginRepository>
+ <id>glassfish</id>
+ <name>GlassFish Maven 2 Repository</name>
+ <url>http://download.java.net/maven/glassfish</url>
+ </pluginRepository>
+ </pluginRepositories>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.spec</groupId>
+ <artifactId>jboss-javaee-6.0</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <scope>provided</scope>
+ <type>pom</type>
+ </dependency>
+ <!-- Bean Validation Implementation -->
+ <!-- Provides portable constraints such as @NotEmpty, @Email and @Url -->
+ <!-- Hibernate Validator is the only JSR-303 implementation at the moment, so we can assume it's provided -->
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-validator</artifactId>
+ <version>4.0.0.GA</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- Optional, but highly recommended. -->
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>5.11</version>
+ <scope>test</scope>
+ <classifier>jdk15</classifier>
+ </dependency>
+ </dependencies>
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <!-- Compiler plugin enforces Java 1.6 compatibility -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+
+ <!-- Eclipse plugin can force download of source and JavaDoc jars -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-eclipse-plugin</artifactId>
+ <configuration>
+ <downloadSources>true</downloadSources>
+ <downloadJavadocs>true</downloadJavadocs>
+ </configuration>
+ </plugin>
+
+ <!-- Configure the JBoss AS Maven deploy plugin -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jboss-maven-plugin</artifactId>
+ <configuration>
+ <jbossHome>${jboss.home}</jbossHome>
+ <serverName>${jboss.domain}</serverName>
+ <fileNames>
+ <fileName>${project.build.directory}/${build.finalName}.war</fileName>
+ </fileNames>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: archetypes/branches/prototype/readme.txt
===================================================================
--- archetypes/branches/prototype/readme.txt (rev 0)
+++ archetypes/branches/prototype/readme.txt 2010-06-16 03:26:00 UTC (rev 6438)
@@ -0,0 +1,138 @@
+
+ myproject
+
+ Source archetype: weld-jsf-jee
+
+ What is it?
+ ===========
+
+ This is your project! It's a sample, deployable Maven 2 project to help you
+ get your foot in the door developing with Java EE 6. This project is setup to
+ allow you to create a compliant Java EE 6 application using JSF 2.0, CDI 1.0,
+ EJB 3.1 and JPA 2.0) that can run on a certified application server (Complete
+ or Web Profile). It includes a persistence unit and some sample persistence
+ and transaction code to help you get your feet wet with database access in
+ enterprise Java.
+
+ System requirements
+ ===================
+
+ All you need to run this project is Java 5.0 (Java SDK 1.5) or greator and
+ Maven 2.0.10 or greater. This application is setup to be run on a Java EE 6
+ certified application server. It has been tested with GlassFish V3 and JBoss
+ AS 6.0.
+
+ If you want to deploy the application to a standalone Servlet Container, then
+ you will need to set one up. Alternatively, you can use a Maven command to run
+ the application in place on an embedded version of GlassFish V3.
+
+ Please note that Maven 2 project needs to use the JBoss Maven repository
+ because there are certain Java EE API JARs that are not yet publised to the
+ Maven Central Repository (see https://jira.jboss.org/jira/browse/WELD-222)
+
+ Deploying the application
+ =========================
+
+ To deploy the application to JBoss AS (standalone), first make sure that the
+ JBOSS_HOME environment variable points to a JBoss AS 6.0 installation.
+ Alternatively, you can set the location of JBoss AS using the following
+ profile defintion in the .m2/settings.xml file in your home directory:
+
+<?xml version="1.0" encoding="UTF-8"?>
+<settings
+ xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
+
+ <profiles>
+ <profile>
+ <id>environment</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <properties>
+ <jboss.home>/path/to/jboss-as-6.0.0.M1</jboss.home>
+ </properties>
+ </profile>
+ </profiles>
+
+</settings>
+
+ You can now deploy to JBoss AS by executing the following command:
+
+ mvn package jboss:hard-deploy
+
+ Start JBoss AS. The application will be running at the following URL:
+
+ http://localhost:8080/myproject
+
+ If you want to deploy to GlassFish V3 (standalone), you first need to change
+ the name of the DataSource used by the persistence unit! Open this file:
+
+ src/main/resources/META-INF/persistence.xml
+
+ Change the value of <jta-data-source> to the following:
+
+ <jta-data-source>jdbc/__default</jta-data-source>
+
+ This configuration uses the built-in default Derby DataSource in GlassFish.
+ Optionally, you can use an alternative DataSource of your choice.
+
+ Now, execute the command:
+
+ mvn package
+
+ There are several ways to deploy the archive to GlassFish V3. The recommended
+ approach is to open the project in NetBeans 6.8, right-click on the project
+ and select "Run" from the context menu. That starts JavaDB, GlassFish and
+ deploys the application.
+
+ You can also start GlassFish from the commandline. Change to the glassfish/bin
+ directory in the GlassFish install root and run these three commands:
+
+ asadmin start-database
+ asadmin start-domain domain1
+
+ Now you can either deploy the target/myproject.war through the web-based
+ GlassFish admininstration console, or you can again use asadmin:
+
+ asadmin /path/to/project/target/myproject.war
+
+ Unfortunately, the embedded GlassFish V3 application server does not bootstrap
+ the persistence unit(s), so you won't be able to leverage the Maven plugin to
+ run the application in place (like you can in a jee-minimal project).
+
+ Importing the project into an IDE
+ =================================
+
+ If you created the project using the Maven 2 archetype wizard in your IDE
+ (Eclipse, NetBeans or IntelliJ IDEA), then there is nothing to do. You should
+ already have an IDE project.
+
+ If you created the project from the commandline using archetype:generate, then
+ you need to bring the project into your IDE. If you are using NetBeans 6.8 or
+ IntelliJ IDEA 9, then all you have to do is open the project as an existing
+ project. Both of these IDEs recognize Maven 2 projects natively.
+
+ To import into Eclipse, you first need to install the m2eclipse plugin. To get
+ started, add the m2eclipse update site (http://m2eclipse.sonatype.org/update/)
+ to Eclipse and install the m2eclipse plugin and required dependencies. Once
+ that is installed, you'll be ready to import the project into Eclipse.
+
+ Select File > Import... and select "Import... > Maven Projects" and select
+ your project directory. m2eclipse should take it from there.
+
+ Once in the IDE, you can execute the Maven commands through the IDE controls
+ to run the application on an embedded Servlet Container.
+
+ Resources
+ =========
+
+ Weld archetypes:
+ - Quickstart: http://seamframework.org/Documentation/WeldQuickstartForMavenUsers
+ - Issue tracker: https://jira.jboss.org/jira/browse/WELDX
+ - Source code: http://anonsvn.jboss.org/repos/weld/archetypes
+ - Forums: http://seamframework.org/Community/WeldUsers
+ JSR-299 overview: http://seamframework.org/Weld
+ JSF community site: http://www.javaserverfaces.org
+
Added: archetypes/branches/prototype/src/main/java/com/mycompany/HelloWorld.java
===================================================================
--- archetypes/branches/prototype/src/main/java/com/mycompany/HelloWorld.java (rev 0)
+++ archetypes/branches/prototype/src/main/java/com/mycompany/HelloWorld.java 2010-06-16 03:26:00 UTC (rev 6438)
@@ -0,0 +1,74 @@
+package com.mycompany;
+
+import javax.annotation.PostConstruct;
+import javax.enterprise.inject.Model;
+import javax.validation.constraints.Digits;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Pattern;
+
+import org.hibernate.validator.constraints.Email;
+import org.hibernate.validator.constraints.NotEmpty;
+
+public @Model class HelloWorld
+{
+ private final String text = "Hello World!";
+
+ private String letters;
+
+ private String numbers;
+
+ private String email;
+
+ public HelloWorld() {}
+
+ @PostConstruct
+ public void initialize()
+ {
+ System.out.println(this.getClass().getSimpleName() + " was constructed");
+ }
+
+ public String getText()
+ {
+ return text;
+ }
+
+ @NotNull
+ @NotEmpty
+ @Pattern(regexp = "[A-Za-z]*", message = "must contain only letters")
+ public String getLetters()
+ {
+ return letters;
+ }
+
+ public void setLetters(String letters)
+ {
+ this.letters = letters;
+ }
+
+ @NotNull
+ @NotEmpty
+ @Digits(fraction = 0, integer = 2)
+ public String getNumbers()
+ {
+ return numbers;
+ }
+
+ public void setNumbers(String numbers)
+ {
+ this.numbers = numbers;
+ }
+
+ @NotNull
+ @NotEmpty
+ @Email
+ public String getEmail()
+ {
+ return email;
+ }
+
+ public void setEmail(String email)
+ {
+ this.email = email;
+ }
+
+}
Added: archetypes/branches/prototype/src/main/java/com/mycompany/Widget.java
===================================================================
--- archetypes/branches/prototype/src/main/java/com/mycompany/Widget.java (rev 0)
+++ archetypes/branches/prototype/src/main/java/com/mycompany/Widget.java 2010-06-16 03:26:00 UTC (rev 6438)
@@ -0,0 +1,64 @@
+package com.mycompany;
+
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+@Entity
+public class Widget implements Serializable
+{
+ private Long id;
+ private String partNumber;
+ private String name;
+ private String description;
+
+ @Id
+ @GeneratedValue
+ public Long getId()
+ {
+ return id;
+ }
+
+ public void setId(Long id)
+ {
+ this.id = id;
+ }
+
+ // demonstrates a column name override
+ @Column(name = "partno")
+ public String getPartNumber()
+ {
+ return partNumber;
+ }
+
+ public void setPartNumber(String partNumber)
+ {
+ this.partNumber = partNumber;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ public String getDescription()
+ {
+ return description;
+ }
+
+ public void setDescription(String description)
+ {
+ this.description = description;
+ }
+
+ /** Default value included to remove warning. Remove or modify at will. */
+ private static final long serialVersionUID = 1L;
+}
\ No newline at end of file
Added: archetypes/branches/prototype/src/main/java/com/mycompany/WidgetListProducer.java
===================================================================
--- archetypes/branches/prototype/src/main/java/com/mycompany/WidgetListProducer.java (rev 0)
+++ archetypes/branches/prototype/src/main/java/com/mycompany/WidgetListProducer.java 2010-06-16 03:26:00 UTC (rev 6438)
@@ -0,0 +1,22 @@
+package com.mycompany;
+
+import java.util.List;
+
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.persistence.EntityManager;
+
+public class WidgetListProducer
+{
+ @Inject @WidgetRepository EntityManager widgetRepository;
+
+ @Produces
+ @Named
+ @RequestScoped
+ @SuppressWarnings("unchecked")
+ List<Widget> getWidgets() {
+ return widgetRepository.createQuery("select w from Widget w order by w.name").getResultList();
+ }
+}
Added: archetypes/branches/prototype/src/main/java/com/mycompany/WidgetRepository.java
===================================================================
--- archetypes/branches/prototype/src/main/java/com/mycompany/WidgetRepository.java (rev 0)
+++ archetypes/branches/prototype/src/main/java/com/mycompany/WidgetRepository.java 2010-06-16 03:26:00 UTC (rev 6438)
@@ -0,0 +1,13 @@
+package com.mycompany;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import javax.inject.Qualifier;
+
+@Qualifier
+(a)Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
+(a)Retention(RetentionPolicy.RUNTIME)
+public @interface WidgetRepository {}
Added: archetypes/branches/prototype/src/main/java/com/mycompany/WidgetRepositoryProducer.java
===================================================================
--- archetypes/branches/prototype/src/main/java/com/mycompany/WidgetRepositoryProducer.java (rev 0)
+++ archetypes/branches/prototype/src/main/java/com/mycompany/WidgetRepositoryProducer.java 2010-06-16 03:26:00 UTC (rev 6438)
@@ -0,0 +1,19 @@
+package com.mycompany;
+
+import javax.enterprise.inject.Produces;
+import javax.enterprise.inject.Disposes;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+public class WidgetRepositoryProducer
+{
+ // NOTE cannot use producer field because Weld attempts to close EntityManager
+ // https://jira.jboss.org/jira/browse/WELD-341
+ @PersistenceContext EntityManager em;
+
+ public @Produces @WidgetRepository EntityManager retrieveEntityManager() {
+ return em;
+ }
+
+ public void disposeEntityManager(@Disposes @WidgetRepository EntityManager em) {}
+}
Added: archetypes/branches/prototype/src/main/resources/META-INF/persistence.xml
===================================================================
--- archetypes/branches/prototype/src/main/resources/META-INF/persistence.xml (rev 0)
+++ archetypes/branches/prototype/src/main/resources/META-INF/persistence.xml 2010-06-16 03:26:00 UTC (rev 6438)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence version="1.0"
+ xmlns="http://java.sun.com/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://java.sun.com/xml/ns/persistence
+ http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
+ <persistence-unit name="widgets">
+ <!-- You can force a non-default JPA provider using one of these declarations -->
+ <!--
+ <provider>org.hibernate.ejb.HibernatePersistence</provider>
+ <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
+ -->
+
+ <!-- Use this data source name for JBoss AS -->
+ <jta-data-source>java:/DefaultDS</jta-data-source>
+ <!-- Use this data source name for Glassfish -->
+ <!--
+ <jta-data-source>jdbc/__default</jta-data-source>
+ -->
+ <properties>
+ <!-- Properties for Hibernate (default provider for JBoss AS) -->
+ <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
+ <property name="hibernate.show_sql" value="true"/>
+ <property name="hibernate.format_sql" value="false"/>
+ <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
+
+ <!-- Properties for EclipseLink (default provider for GlassFish) -->
+ <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
+ <property name="eclipselink.logging.level" value="FINE"/>
+
+ </properties>
+ </persistence-unit>
+</persistence>
Added: archetypes/branches/prototype/src/main/resources/import.sql
===================================================================
--- archetypes/branches/prototype/src/main/resources/import.sql (rev 0)
+++ archetypes/branches/prototype/src/main/resources/import.sql 2010-06-16 03:26:00 UTC (rev 6438)
@@ -0,0 +1 @@
+insert into Widget (id, partno, name, description) values (1, 'AAA001', 'Portable Hole', 'A hole for when you need to disappear fast.')
Added: archetypes/branches/prototype/src/main/webapp/META-INF/MANIFEST.MF
===================================================================
--- archetypes/branches/prototype/src/main/webapp/META-INF/MANIFEST.MF (rev 0)
+++ archetypes/branches/prototype/src/main/webapp/META-INF/MANIFEST.MF 2010-06-16 03:26:00 UTC (rev 6438)
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path:
+
Added: archetypes/branches/prototype/src/main/webapp/META-INF/context.xml
===================================================================
--- archetypes/branches/prototype/src/main/webapp/META-INF/context.xml (rev 0)
+++ archetypes/branches/prototype/src/main/webapp/META-INF/context.xml 2010-06-16 03:26:00 UTC (rev 6438)
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Context>
+ <!-- disable storage of sessions across restarts -->
+ <Manager pathname=""/>
+</Context>
Added: archetypes/branches/prototype/src/main/webapp/WEB-INF/beans.xml
===================================================================
--- archetypes/branches/prototype/src/main/webapp/WEB-INF/beans.xml (rev 0)
+++ archetypes/branches/prototype/src/main/webapp/WEB-INF/beans.xml 2010-06-16 03:26:00 UTC (rev 6438)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
+ <alternatives/>
+ <decorators/>
+ <interceptors/>
+</beans>
Added: archetypes/branches/prototype/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- archetypes/branches/prototype/src/main/webapp/WEB-INF/faces-config.xml (rev 0)
+++ archetypes/branches/prototype/src/main/webapp/WEB-INF/faces-config.xml 2010-06-16 03:26:00 UTC (rev 6438)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This file is not required if you don't need any extra configuration. -->
+<faces-config version="2.0"
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd">
+
+ <!-- Write your navigation rules here. You are encouraged to use CDI for creating @Named managed beans. -->
+
+</faces-config>
Added: archetypes/branches/prototype/src/main/webapp/WEB-INF/templates/default.xhtml
===================================================================
--- archetypes/branches/prototype/src/main/webapp/WEB-INF/templates/default.xhtml (rev 0)
+++ archetypes/branches/prototype/src/main/webapp/WEB-INF/templates/default.xhtml 2010-06-16 03:26:00 UTC (rev 6438)
@@ -0,0 +1,52 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+ <h:head>
+ <title>Java EE 6 Starter Application</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <h:outputStylesheet name="css/screen.css"/>
+ </h:head>
+ <h:body>
+ <div id="container">
+ <div id="content">
+ <div id="sidebar">
+ <h3>Find out more</h3>
+ <p>
+ Explore JavaServer Faces.
+ </p>
+ <ul>
+ <li><a href="http://www.javaserverfaces.org">JSF community site</a></li>
+ </ul>
+ <p>
+ Learn more about Java EE 6 and the extensions provided by Weld and Seam.
+ </p>
+ <ul>
+ <li><a href="http://seamframework.org/Weld/JSR299AndWeldOverview">Overview</a></li>
+ <li><a href="http://seamframework.org">Project site</a></li>
+ <li><a href="http://seamframework.org/Documentation/SeamDocumentation#H-WeldReferenceD...">Documentation</a></li>
+ <li><a href="http://seamframework.org/Community/Forums">User forums</a></li>
+ <li><a href="http://seamframework.org/Community/MailingLists">Mailing lists</a></li>
+ <li><a href="https://jira.jboss.org/jira/browse/WELD">Issue tracker</a></li>
+ </ul>
+ <p>
+ If you have an add-on, please <a href="http://seamframework.org/Community/Forums">let us know</a> and
+ consider <a href="http://seamframework.org/Community/Contribute">contributing</a> it back to the
+ community!
+ </p>
+ </div>
+ <ui:insert name="content">
+ [Template content will be inserted here]
+ </ui:insert>
+ </div>
+ <div id="footer">
+ <h:graphicImage value="/resources/gfx/weld.png" alt="Weld logo"/>
+ <p>
+ This project was generated from a Maven archetype maintained by the Weld team.<br/>
+ Weld is the reference implementation of CDI, released under the Apache License, Version 2.0.<br/>
+ </p>
+ </div>
+ </div>
+ </h:body>
+</html>
Added: archetypes/branches/prototype/src/main/webapp/WEB-INF/web.xml
===================================================================
--- archetypes/branches/prototype/src/main/webapp/WEB-INF/web.xml (rev 0)
+++ archetypes/branches/prototype/src/main/webapp/WEB-INF/web.xml 2010-06-16 03:26:00 UTC (rev 6438)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
+
+ <!-- This is an optional parameter, but it makes troubleshooting errors much easier -->
+ <!-- You should delete it before final deployment -->
+ <context-param>
+ <param-name>javax.faces.PROJECT_STAGE</param-name>
+ <param-value>Development</param-value>
+ </context-param>
+
+ <!-- Activate the JSF 2.0 servlet -->
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <!-- Tell the context which URLs to process with JSF -->
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.jsf</url-pattern>
+ </servlet-mapping>
+
+</web-app>
Added: archetypes/branches/prototype/src/main/webapp/home.xhtml
===================================================================
--- archetypes/branches/prototype/src/main/webapp/home.xhtml (rev 0)
+++ archetypes/branches/prototype/src/main/webapp/home.xhtml 2010-06-16 03:26:00 UTC (rev 6438)
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui:composition xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ template="/WEB-INF/templates/default.xhtml">
+ <ui:define name="content">
+ <h1>Hello World!</h1>
+ <p>Your CDI bean <code>HelloWorld</code> says <span style="color: blue;">#{helloWorld.text}</span> using the Unified EL.</p>
+
+ <h:form id="bv">
+ <h2>Bean Validation examples</h2>
+ <p>Enforces annotation-based constraints defined on the model class.</p>
+ <table>
+ <tr>
+ <th style="text-align: right;">
+ <h:outputLabel for="letters" value="Letters:"/>
+ </th>
+ <td>
+ <h:inputText id="letters" value="#{helloWorld.letters}"/>
+ <h:message for="letters" errorClass="invalid"/>
+ </td>
+ </tr>
+ <tr>
+ <th style="text-align: right;">
+ <h:outputLabel for="numbers" value="Numbers:"/>
+ </th>
+ <td>
+ <h:inputText id="numbers" value="#{helloWorld.numbers}"/>
+ <h:message for="numbers" errorClass="invalid"/>
+ </td>
+ </tr>
+ <tr>
+ <th style="text-align: right;">
+ <h:outputLabel for="email" value="Email:"/>
+ </th>
+ <td>
+ <h:inputText id="email" value="#{helloWorld.email}"/>
+ <h:message for="email" errorClass="invalid"/>
+ </td>
+ </tr>
+ </table>
+ <p>
+ <h:commandButton id="check" action="check" value="Check values"/>
+ <h:outputText value=" All clear!" rendered="#{facesContext.postback and empty facesContext.messageList}" style="color: green;"/>
+ </p>
+ </h:form>
+ <h2>Widgets</h2>
+ <h:dataTable var="_widget" value="#{widgets}">
+ <h:column>
+ <f:facet name="header">Id</f:facet>
+ #{_widget.id}
+ </h:column>
+ <h:column>
+ <f:facet name="header">Part Number</f:facet>
+ #{_widget.partNumber}
+ </h:column>
+ <h:column>
+ <f:facet name="header">Name</f:facet>
+ #{_widget.name}
+ </h:column>
+ <h:column>
+ <f:facet name="header">Description</f:facet>
+ #{_widget.description}
+ </h:column>
+ </h:dataTable>
+ </ui:define>
+</ui:composition>
Added: archetypes/branches/prototype/src/main/webapp/index.jsp
===================================================================
--- archetypes/branches/prototype/src/main/webapp/index.jsp (rev 0)
+++ archetypes/branches/prototype/src/main/webapp/index.jsp 2010-06-16 03:26:00 UTC (rev 6438)
@@ -0,0 +1 @@
+<% response.sendRedirect("home.jsf"); %>
Added: archetypes/branches/prototype/src/main/webapp/resources/css/screen.css
===================================================================
--- archetypes/branches/prototype/src/main/webapp/resources/css/screen.css (rev 0)
+++ archetypes/branches/prototype/src/main/webapp/resources/css/screen.css 2010-06-16 03:26:00 UTC (rev 6438)
@@ -0,0 +1,39 @@
+body {
+ margin: 0;
+ padding: 0;
+ background-color: #EAECEE;
+ font-family: Verdana, sans-serif;
+ font-size: 0.9em;
+}
+#container {
+ margin: 0 auto;
+ padding: 0 20px 10px 20px;
+ border: 1px solid #666666;
+ width: 865px; /* subtract 40px from banner width for padding */
+ background: #FFFFFF url(#{request.contextPath}/resources/gfx/banner.png) no-repeat;
+ padding-top: 110px;
+}
+#sidebar {
+ font-size: 0.9em;
+ width: 225px;
+ float: right;
+ border: 1px solid #666666;
+ background: #EAECEE;
+ padding: 0 15px 5px 15px;
+}
+#sidebar ul {
+ padding-left: 30px;
+}
+#footer {
+ clear: both;
+ text-align: center;
+ color: #666666;
+ font-size: 0.85em;
+}
+code {
+ font-size: 1.1em;
+}
+span.invalid {
+ padding-left: 3px;
+ color: red;
+}
\ No newline at end of file
Added: archetypes/branches/prototype/src/main/webapp/resources/gfx/banner.png
===================================================================
(Binary files differ)
Property changes on: archetypes/branches/prototype/src/main/webapp/resources/gfx/banner.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: archetypes/branches/prototype/src/main/webapp/resources/gfx/weld.png
===================================================================
(Binary files differ)
Property changes on: archetypes/branches/prototype/src/main/webapp/resources/gfx/weld.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: archetypes/branches/prototype/src/test/java/com/mycompany/HelloWorldTest.java
===================================================================
--- archetypes/branches/prototype/src/test/java/com/mycompany/HelloWorldTest.java (rev 0)
+++ archetypes/branches/prototype/src/test/java/com/mycompany/HelloWorldTest.java 2010-06-16 03:26:00 UTC (rev 6438)
@@ -0,0 +1,12 @@
+package com.mycompany;
+
+import org.testng.annotations.Test;
+
+public class HelloWorldTest
+{
+ @Test
+ public void testGetText() {
+ HelloWorld fixture = new HelloWorld();
+ assert "Hello World!".equals(fixture.getText());
+ }
+}
13 years, 10 months
Weld SVN: r6437 - archetypes/trunk/jsf/jee/src/main/resources/archetype-resources.
by weld-commits@lists.jboss.org
Author: sboscarine
Date: 2010-06-15 23:25:29 -0400 (Tue, 15 Jun 2010)
New Revision: 6437
Modified:
archetypes/trunk/jsf/jee/src/main/resources/archetype-resources/pom.xml
Log:
first round of archetypes revamp
Modified: archetypes/trunk/jsf/jee/src/main/resources/archetype-resources/pom.xml
===================================================================
--- archetypes/trunk/jsf/jee/src/main/resources/archetype-resources/pom.xml 2010-06-16 02:34:46 UTC (rev 6436)
+++ archetypes/trunk/jsf/jee/src/main/resources/archetype-resources/pom.xml 2010-06-16 03:25:29 UTC (rev 6437)
@@ -14,12 +14,13 @@
<properties>
<!--
- Explicitly declaring the source encoding eliminates the following message:
- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
+ Explicitly declaring the source encoding eliminates the following message: [WARNING] Using platform encoding
+ (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
-->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!--
- Timestamp format for the maven.build.timestamp property; you can reference property in pom.xml or filtered resources (must enable third-party plugin if using Maven < 2.1)
+ Timestamp format for the maven.build.timestamp property; you can reference property in pom.xml or filtered
+ resources (must enable third-party plugin if using Maven < 2.1)
-->
<maven.build.timestamp.format>yyyyMMdd'T'HHmmss</maven.build.timestamp.format>
<!--
@@ -29,16 +30,25 @@
<jboss.home>${expr_start}env.JBOSS_HOME${expr_end}</jboss.home>
<jboss.domain>default</jboss.domain>
</properties>
+
<repositories>
- <!-- Several key Java EE APIs and RIs are missing from the Maven Central Repository -->
- <!-- The goal is to eventually eliminate the reliance on the JBoss repository -->
- <repository>
- <id>repository.jboss.org</id>
- <name>JBoss Repository</name>
- <url>http://repository.jboss.org/maven2</url>
- </repository>
+ <!-- Optional Repository. -->
+ <!-- Soon all required dependencies will be pushed to maven central. -->
+ <!-- In the mean time, we need to point this archetype to the JBoss Maven Repository -->
+ <repository>
+ <id>jboss-public-repository</id>
+ <name>JBoss Repository</name>
+ <url>https://repository.jboss.org/nexus/content/groups/public</url>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ <updatePolicy>daily</updatePolicy>
+ </snapshots>
+ </repository>
</repositories>
-
<pluginRepositories>
<!-- GlassFish repository required for embedded-glassfish plugin -->
<pluginRepository>
@@ -51,7 +61,7 @@
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-6.0</artifactId>
- <version>1.0.0.Beta4</version>
+ <version>1.0.0-SNAPSHOT</version>
<scope>provided</scope>
<type>pom</type>
</dependency>
@@ -69,7 +79,7 @@
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
- <version>5.10</version>
+ <version>5.11</version>
<scope>test</scope>
<classifier>jdk15</classifier>
</dependency>
@@ -106,7 +116,7 @@
<serverName>${expr_start}jboss.domain${expr_end}</serverName>
<fileNames>
<fileName>${expr_start}project.build.directory${expr_end}/${expr_start}build.finalName${expr_end}.war</fileName>
- </fileNames>
+ </fileNames>
</configuration>
</plugin>
</plugins>
13 years, 10 months
Weld SVN: r6436 - archetypes/branches.
by weld-commits@lists.jboss.org
Author: sboscarine
Date: 2010-06-15 22:34:46 -0400 (Tue, 15 Jun 2010)
New Revision: 6436
Added:
archetypes/branches/prototype/
Log:
13 years, 10 months
Weld SVN: r6435 - in examples/trunk/jsf/pastecode/src/main: webapp and 1 other directories.
by weld-commits@lists.jboss.org
Author: shane.bryzak(a)jboss.com
Date: 2010-06-15 20:24:00 -0400 (Tue, 15 Jun 2010)
New Revision: 6435
Modified:
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/CodeEntity.java
examples/trunk/jsf/pastecode/src/main/webapp/rightMenuDefault.xhtml
examples/trunk/jsf/pastecode/src/main/webapp/style/style.css
Log:
started on style changes
Modified: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/CodeEntity.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/CodeEntity.java 2010-06-15 07:22:26 UTC (rev 6434)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/CodeEntity.java 2010-06-16 00:24:00 UTC (rev 6435)
@@ -31,6 +31,9 @@
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Lob;
+import javax.persistence.Transient;
+
+import java.text.SimpleDateFormat;
import java.util.Date;
/**
@@ -41,6 +44,13 @@
@Table(name = "code")
public class CodeEntity implements Serializable, Cloneable
{
+ private static final long MS_PER_SECOND = 1000;
+ private static final long MS_PER_MINUTE = 60 * MS_PER_SECOND;
+ private static final long MS_PER_HOUR = 60 * MS_PER_MINUTE;
+ private static final long MS_PER_DAY = 24 * MS_PER_HOUR;
+
+ private static final SimpleDateFormat df = new SimpleDateFormat("d MMM");
+
private static final long serialVersionUID = 1L;
private int id;
private Date datetime;
@@ -95,6 +105,60 @@
{
this.datetime = datetime;
}
+
+ @Transient
+ public String getFriendlyDate()
+ {
+ if (getDatetime() == null) return "unknown";
+
+ Date now = new Date();
+
+ long age = now.getTime() - getDatetime().getTime();
+
+ long days = (long) Math.floor(age / MS_PER_DAY);
+ age -= (days * MS_PER_DAY);
+ long hours = (long) Math.floor(age / MS_PER_HOUR);
+ age -= (hours * MS_PER_HOUR);
+ long minutes = (long) Math.floor(age / MS_PER_MINUTE);
+
+ if (days < 7)
+ {
+ StringBuilder sb = new StringBuilder();
+
+ if (days > 0)
+ {
+ sb.append(days);
+ sb.append(days > 1 ? " days " : " day ");
+ }
+
+ if (hours > 0)
+ {
+ sb.append(hours);
+ sb.append(hours > 1 ? " hrs " : " hr ");
+ }
+
+ if (minutes > 0)
+ {
+ sb.append(minutes);
+ sb.append(minutes > 1 ? " minutes " : " minute ");
+ }
+
+ if (hours == 0 && minutes == 0)
+ {
+ sb.append("just now");
+ }
+ else
+ {
+ sb.append("ago");
+ }
+
+ return sb.toString();
+ }
+ else
+ {
+ return df.format(getDatetime());
+ }
+ }
@Column(name = "language")
public String getLanguage()
Modified: examples/trunk/jsf/pastecode/src/main/webapp/rightMenuDefault.xhtml
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/rightMenuDefault.xhtml 2010-06-15 07:22:26 UTC (rev 6434)
+++ examples/trunk/jsf/pastecode/src/main/webapp/rightMenuDefault.xhtml 2010-06-16 00:24:00 UTC (rev 6435)
@@ -5,38 +5,19 @@
xmlns:ui="http://java.sun.com/jsf/facelets">
<ui:composition>
-
- <div id="rightmenuhead" style="width:230px;">
- <strong>Last Pastes:</strong>
- </div>
- <div id="rightmenubody" style="width:230px;">
- <h:dataTable value="#{paster.codes}" var="varcode">
- <h:column>
- <h:panelGroup>
- <h:outputLabel for="user" value="User: "/>
- <h:outputLink id="user" value="#{ varcode.id}"> <!-- display.jsf?id= -->
- <h:outputText value="#{varcode.user}"></h:outputText>
- </h:outputLink>
- </h:panelGroup>
- <br/>
- <h:panelGroup>
- <h:outputLabel for="datetime" value="Date: "/>
- <h:outputText id="datetime" value="#{ varcode.datetime}">
- <f:convertDateTime type="both" pattern="yyyy-MM-dd HH:mm:ss"/>
- </h:outputText>
- </h:panelGroup>
- <br/>
- <h:panelGroup>
- <h:outputLabel for="language" value="Language: "/>
- <h:outputText id="language" value="#{ varcode.language}"></h:outputText>
- </h:panelGroup>
- <br/>
- <br/>
- </h:column>
- </h:dataTable>
+ <div class="recentPastes">
+ <div class="recentPastesHeader">Recent pastes</div>
+
+ <ui:repeat value="#{paster.codes}" var="varcode">
+ <div class="recentPaste">
+ <h:outputLink id="user" value="#{varcode.id}">#{varcode.user}</h:outputLink>
+ <span class="recentPasteLang">#{varcode.language}</span><span> | </span>#{varcode.friendlyDate}
+ </div>
+ </ui:repeat>
+
</div>
</ui:composition>
-</html>
\ No newline at end of file
+</html>
Modified: examples/trunk/jsf/pastecode/src/main/webapp/style/style.css
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/style/style.css 2010-06-15 07:22:26 UTC (rev 6434)
+++ examples/trunk/jsf/pastecode/src/main/webapp/style/style.css 2010-06-16 00:24:00 UTC (rev 6435)
@@ -2,7 +2,8 @@
margin: 0px;
padding: 0px;
border-width: 0px;
- background-color: #FFFFFF;
+ background-color: #cccccc;
+ font-family:trebuchet MS, Lucida Sans Unicode, Lucida Sans, Sans-Serif;
}
table {
@@ -52,17 +53,6 @@
text-align: center;
}
-div#rightmenuhead {
- background-color:#C1C1E8;
- border-color:#8784C6;
- border-width:1px;
- padding:2px;
-}
-
-div#rightmenubody {
- padding:2px;
-}
-
span#menuitem {
margin: 2px;
padding-left: 7px;
@@ -100,6 +90,46 @@
}
+/** Recent pastes styles */
+div.recentPastes {
+ width: 230px;
+ background-color: #ffffff;
+ padding: 0px;
+ border: 0px;
+}
+div.recentPastesHeader {
+ background-color: #bbbbbb;
+ color: #000000;
+ font-weight: bold;
+ padding: 4px;
+ border: 0px;
+}
+div.recentPaste {
+ border-bottom: 1px dotted #aaaaaa;
+ border-left: 0px;
+ border-right: 0px;
+ color: #aaaaaa;
+ padding: 2px;
+}
+
+div.recentPaste a, div.recentPaste a:visited {
+ color: #ff0000;
+ text-decoration: none;
+ display: block;
+}
+
+div.recentPaste a:hover {
+ color: #aaaaaa;
+ text-decoration: none;
+ display: block;
+}
+
+span.recentPasteLang {
+ color: #000000;
+}
+
+
+
13 years, 10 months
Weld SVN: r6434 - in examples/trunk/jsf: pastecode and 21 other directories.
by weld-commits@lists.jboss.org
Author: mgencur(a)redhat.com
Date: 2010-06-15 03:22:26 -0400 (Tue, 15 Jun 2010)
New Revision: 6434
Added:
examples/trunk/jsf/pastecode/
examples/trunk/jsf/pastecode/build.xml
examples/trunk/jsf/pastecode/pom.xml
examples/trunk/jsf/pastecode/readme.txt
examples/trunk/jsf/pastecode/src/
examples/trunk/jsf/pastecode/src/main/
examples/trunk/jsf/pastecode/src/main/java/
examples/trunk/jsf/pastecode/src/main/java/org/
examples/trunk/jsf/pastecode/src/main/java/org/jboss/
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/CodeEntity.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/LargeCodeLog.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/servlets/
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/servlets/DownloadServlet.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Code.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeBean.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Data.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/HashComputer.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/History.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/LargeCodeDecorator.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Paster.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/PopulateDatabaseBean.java
examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/QueryInfo.java
examples/trunk/jsf/pastecode/src/main/resources/
examples/trunk/jsf/pastecode/src/main/resources/META-INF/
examples/trunk/jsf/pastecode/src/main/resources/META-INF/persistence.xml
examples/trunk/jsf/pastecode/src/main/resources/data.sql
examples/trunk/jsf/pastecode/src/main/webapp/
examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/
examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/beans.xml
examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/faces-config.xml
examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/urlrewrite.xml
examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/web.xml
examples/trunk/jsf/pastecode/src/main/webapp/display.xhtml
examples/trunk/jsf/pastecode/src/main/webapp/functions.js
examples/trunk/jsf/pastecode/src/main/webapp/help.xhtml
examples/trunk/jsf/pastecode/src/main/webapp/history.xhtml
examples/trunk/jsf/pastecode/src/main/webapp/home.xhtml
examples/trunk/jsf/pastecode/src/main/webapp/img/
examples/trunk/jsf/pastecode/src/main/webapp/img/small.png
examples/trunk/jsf/pastecode/src/main/webapp/index.html
examples/trunk/jsf/pastecode/src/main/webapp/jsScripts.xhtml
examples/trunk/jsf/pastecode/src/main/webapp/pagination.xhtml
examples/trunk/jsf/pastecode/src/main/webapp/rightMenuDefault.xhtml
examples/trunk/jsf/pastecode/src/main/webapp/style/
examples/trunk/jsf/pastecode/src/main/webapp/style/style.css
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/LGPLv3.txt
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/clipboard.swf
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushAS3.js
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushBash.js
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushCSharp.js
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushColdFusion.js
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushCpp.js
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushCss.js
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushDelphi.js
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushDiff.js
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushErlang.js
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushGroovy.js
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushJScript.js
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushJava.js
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushJavaFX.js
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushPerl.js
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushPhp.js
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushPlain.js
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushPowerShell.js
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushPython.js
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushRuby.js
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushScala.js
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushSql.js
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushVb.js
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushXml.js
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shCore.js
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shLegacy.js
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/src/
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/src/shCore.js
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/src/shLegacy.js
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/help.png
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/magnifier.png
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/page_white_code.png
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/page_white_copy.png
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/printer.png
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/shCore.css
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/shThemeDefault.css
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/shThemeDjango.css
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/shThemeEclipse.css
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/shThemeEmacs.css
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/shThemeFadeToGrey.css
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/shThemeMidnight.css
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/shThemeRDark.css
examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/test.html
examples/trunk/jsf/pastecode/src/main/webapp/template.xhtml
examples/trunk/jsf/pastecode/weld-pastecode-ds.xml
Log:
commit of new WAR version of pastecode example
Added: examples/trunk/jsf/pastecode/build.xml
===================================================================
--- examples/trunk/jsf/pastecode/build.xml (rev 0)
+++ examples/trunk/jsf/pastecode/build.xml 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,8 @@
+<project basedir="." name="PasteCode Example Build" default="restart">
+
+ <property name="example.name" value="weld-pastecode" />
+ <property name="type" value="war" />
+
+ <import file="../../build.xml" />
+
+</project>
Added: examples/trunk/jsf/pastecode/pom.xml
===================================================================
--- examples/trunk/jsf/pastecode/pom.xml (rev 0)
+++ examples/trunk/jsf/pastecode/pom.xml 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,127 @@
+<?xml version="1.0"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.jboss.weld.examples</groupId>
+ <artifactId>weld-examples-parent</artifactId>
+ <version>1.0.2-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <groupId>org.jboss.weld.examples.jsf.pastecode</groupId>
+ <artifactId>weld-jsf-pastecode</artifactId>
+ <packaging>war</packaging>
+ <name>Weld Examples: PasteCode</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <scope>test</scope>
+ <classifier>jdk15</classifier>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.tuckey</groupId>
+ <artifactId>urlrewritefilter</artifactId>
+ <version>3.1.0</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.enterprise</groupId>
+ <artifactId>cdi-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.persistence</groupId>
+ <artifactId>persistence-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3_1</artifactId>
+ <version>1.0.8-alpha-1</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.transaction</groupId>
+ <artifactId>jta</artifactId>
+ <version>1.1</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.glassfish.web</groupId>
+ <artifactId>el-impl</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>weld-pastecode</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <warSourceExcludes>WEB-INF/classes/**,WEB-INF/lib/**</warSourceExcludes>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>com.pyx4j</groupId>
+ <artifactId>maven-junction-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unlink</id>
+ <phase>clean</phase>
+ <goals>
+ <goal>unlink</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <links>
+ <!-- link src/main/webapp -> war/ for IDEs -->
+ <link>
+ <dst>${basedir}/war</dst>
+ <src>${basedir}/src/main/webapp</src>
+ </link>
+ </links>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <!-- <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/weld/examples/trunk/jsf/pastecode</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/weld/examples/trunk/jsf/pastecode</developerConnection>
+ <url>http://fisheye.jboss.org/browse/weld/examples/trunk/jsf/pastecode</url>
+ </scm> -->
+
+</project>
+
Added: examples/trunk/jsf/pastecode/readme.txt
===================================================================
--- examples/trunk/jsf/pastecode/readme.txt (rev 0)
+++ examples/trunk/jsf/pastecode/readme.txt 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,65 @@
+Weld PasteCode Example
+======================
+
+This example demonstrates the use of Weld in Java EE Environment. Contextual
+state management and dependency injection are handled by JSR-299. Transaction
+and persistence context management is handled by the EJB 3 container. No
+alterations are required to be made to the Servlet container. All services
+are self-contained within the deployment.
+
+-------Weld Features Covered (the list will increase)-------
+- injecting into POJO, EJB (SFSB), Servlet
+- @ApplicationScoped, @Model, @SessionScoped annotations
+- producer named methods
+- Decorators
+
+This example uses a Maven 2 build. Execute the following command to build the
+WAR. The WAR will be located in the target directory after completion of
+the build.
+
+ mvn
+
+Now you are ready to deploy. A configuration is prepared for JBoss AS regarding
+access to database. If you want to run in different Java EE container you will
+have to change configuration in persistence.xml and define your own database
+connection.
+
+== Deploying to JBoss AS
+
+If you run a normal Maven build, the artifact it produces is deployable to JBoss
+AS by default:
+
+ mvn package
+
+Just copy target/weld-pastecode.war to the JBoss AS deploy directory (since
+JBoss 6.0.0.M2 to server/all configuration) along with weld-pastecode-ds.xml
+datasource.
+
+Open this local URL to access the running application:
+
+ http://localhost:8080/weld-pastecode
+
+Alternatively, run "ant restart" to have the app copied to your ${jboss.home}.
+The ant target will deploy datasource file as well.
+
+= Importing the project into Eclipse
+
+The recommended way to setup a Weld example in Eclipse is to use the m2eclipse
+plugin. This plugin derives the build classpath from the dependencies listed in
+the pom.xml file. It also has direct integration with Maven build commands.
+
+To get started open Eclipse and import the project by selecting "Maven
+Projects" and browsing to the project folder. You can now develop the project
+in Eclipse just like any other project.
+
+You could also prepare the Eclipse project before hand, then import the project
+into Eclipse. First, transform the pom.xml into an m2eclipse Eclipse project
+using this command:
+
+ mvn eclipse:m2eclipse
+
+Now go into Eclipse an import the project by selecting "Existing projects into
+workspace" and selecting the project folder. Both approaches use the Eclipse
+project configuration defined in the pom.xml file.
+
+vim:tw=80
Added: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/CodeEntity.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/CodeEntity.java (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/CodeEntity.java 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,144 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.weld.examples.pastecode.model;
+
+import java.io.Serializable;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.GenerationType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Column;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.persistence.Lob;
+import java.util.Date;
+
+/**
+ * The persistent class for the code database table.
+ *
+ */
+@Entity
+@Table(name = "code")
+public class CodeEntity implements Serializable, Cloneable
+{
+ private static final long serialVersionUID = 1L;
+ private int id;
+ private Date datetime;
+ private String language;
+ private String note;
+ private String text;
+ private String user;
+ private String hash;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name = "id")
+ public int getId()
+ {
+ return id;
+ }
+
+ public void setId(int id)
+ {
+ this.id = id;
+ }
+
+ @Column(name = "hash")
+ public String getHash()
+ {
+ return hash;
+ }
+
+ public void setHash(String hash)
+ {
+ this.hash = hash;
+ }
+
+ public CodeEntity()
+ {
+ this.language = "";
+ this.note = "";
+ this.text = "";
+ this.user = "";
+ this.hash = null;
+ this.datetime = null;
+ }
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name = "datetime")
+ public Date getDatetime()
+ {
+ return this.datetime;
+ }
+
+ public void setDatetime(Date datetime)
+ {
+ this.datetime = datetime;
+ }
+
+ @Column(name = "language")
+ public String getLanguage()
+ {
+ return this.language;
+ }
+
+ public void setLanguage(String language)
+ {
+ this.language = language;
+ }
+
+ @Lob()
+ @Column(name = "note")
+ public String getNote()
+ {
+ return this.note;
+ }
+
+ public void setNote(String note)
+ {
+ this.note = note;
+ }
+
+ @Lob()
+ @Column(name = "text")
+ public String getText()
+ {
+ return this.text;
+ }
+
+ public void setText(String text)
+ {
+ this.text = text;
+ }
+
+ @Column(name = "user")
+ public String getUser()
+ {
+ return this.user;
+ }
+
+ public void setUser(String user)
+ {
+ this.user = user;
+ }
+}
\ No newline at end of file
Added: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/LargeCodeLog.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/LargeCodeLog.java (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/model/LargeCodeLog.java 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,97 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.weld.examples.pastecode.model;
+
+import java.io.Serializable;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.GenerationType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Column;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import java.util.Date;
+
+@Entity
+@Table(name = "largecodelog")
+public class LargeCodeLog implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+ private int id;
+ private Date datetime;
+ private int codeId;
+ private String access;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name = "id")
+ public int getId()
+ {
+ return id;
+ }
+
+ public void setId(int id)
+ {
+ this.id = id;
+ }
+
+ public LargeCodeLog(int codeId, Date dateTime, String access)
+ {
+ this.codeId = codeId;
+ this.datetime = dateTime;
+ this.access = access;
+ }
+
+ public int getCodeId()
+ {
+ return codeId;
+ }
+
+ public void setCodeId(int codeId)
+ {
+ this.codeId = codeId;
+ }
+
+ public String getAccess()
+ {
+ return access;
+ }
+
+ public void setAccess(String access)
+ {
+ this.access = access;
+ }
+
+ @Temporal(TemporalType.TIMESTAMP)
+ @Column(name = "datetime")
+ public Date getDatetime()
+ {
+ return this.datetime;
+ }
+
+ public void setDatetime(Date datetime)
+ {
+ this.datetime = datetime;
+ }
+
+}
Added: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/servlets/DownloadServlet.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/servlets/DownloadServlet.java (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/servlets/DownloadServlet.java 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.weld.examples.pastecode.servlets;
+
+import java.io.*;
+import javax.servlet.ServletException;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.jboss.weld.examples.pastecode.model.CodeEntity;
+import org.jboss.weld.examples.pastecode.session.Code;
+import javax.enterprise.inject.Instance;
+import javax.inject.Inject;
+
+public class DownloadServlet extends HttpServlet
+{
+ private static final long serialVersionUID = 1L;
+
+ @Inject
+ Instance<Code> eaoIn;
+ Code eao;
+
+ public DownloadServlet()
+ {
+ }
+
+ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
+ {
+
+ this.eao = eaoIn.get();
+ String id = (String) request.getParameter("id");
+ CodeEntity c = eao.getCode(id);
+ String fileName = c.getUser() + "." + c.getLanguage();
+ String txt = c.getText();
+
+ response.setContentType("text/plain");
+ response.addHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
+ response.setContentLength(txt.length());
+
+ ServletOutputStream out = response.getOutputStream();
+ try
+ {
+ out.print(txt);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ out.close();
+ }
+
+ }
+}
Added: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Code.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Code.java (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Code.java 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.weld.examples.pastecode.session;
+
+import java.util.List;
+import org.jboss.weld.examples.pastecode.model.CodeEntity;
+
+public interface Code
+{
+ public String addCode(CodeEntity code, boolean secured);
+
+ public CodeEntity getCode(String id);
+
+ public List<CodeEntity> recentCodes();
+
+ public List<CodeEntity> searchCodes(CodeEntity code, int page, QueryInfo info);
+}
Added: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeBean.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeBean.java (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/CodeBean.java 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,211 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.weld.examples.pastecode.session;
+
+import java.security.NoSuchAlgorithmException;
+import java.text.SimpleDateFormat;
+import java.util.Calendar;
+import javax.annotation.Resource;
+import javax.ejb.EJBContext;
+import javax.ejb.EJBException;
+import javax.ejb.Stateless;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+import javax.persistence.*;
+import org.jboss.weld.examples.pastecode.model.CodeEntity;
+import javax.inject.*;
+import java.util.*;
+
+/**
+ * Session Bean implementation class CodeEAOBean
+ */
+@Stateless
+@Named("codeEAOBean")
+public class CodeBean implements Code
+{
+
+ @PersistenceContext(unitName = "pastecodeDatabase")
+ private EntityManager em;
+
+ @Resource
+ EJBContext ctx;
+
+ @Inject
+ private HashComputer hashComp;
+
+ private int MAX_CODES = 7;
+
+ private int PAGE_SIZE = 2;
+
+ public CodeBean()
+ {
+ }
+
+ public String addCode(CodeEntity code, boolean secured)
+ {
+ String result;
+ if (code.getDatetime() == null)
+ {
+ code.setDatetime(Calendar.getInstance().getTime());
+ }
+
+ if (code.getUser().trim().isEmpty())
+ {
+ code.setUser("Anonymous");
+ }
+
+ /* compute hash value and return it if secured flag has been set */
+ if (secured)
+ {
+ try
+ {
+ String hashValue = hashComp.getHashValue(code);
+ code.setHash(hashValue);
+ result = hashValue;
+ em.persist(code);
+ }
+ catch (NoSuchAlgorithmException e)
+ {
+ e.printStackTrace();
+ return null;
+ }
+ }
+ else
+ {
+ em.persist(code);
+ result = new Integer(code.getId()).toString();
+ }
+
+ // System.out.println("Result: " + result);
+
+ return result;
+ }
+
+ public CodeEntity getCode(String id)
+ {
+ boolean secured = true;
+
+ try
+ {
+ Integer.parseInt(id);
+ secured = false; /*
+ * if it is possible to convert to number -> not
+ * secured, otherwise -> secured
+ */
+ }
+ catch (NumberFormatException e)
+ {
+ }
+
+ if (secured)
+ {
+ Query q = em.createQuery("SELECT c FROM CodeEntity c WHERE hash = :hash");
+ q.setParameter("hash", id);
+ return (CodeEntity) q.getSingleResult();
+ }
+ else
+ {
+ CodeEntity c = em.find(CodeEntity.class, Integer.parseInt(id));
+ /*
+ * if somebody is trying to guess Id of secured code paste he cannot
+ * pass
+ */
+ if (c.getHash() == null)
+ {
+ return c;
+ }
+ else
+ {
+ throw new EJBException("Access denied");
+ }
+ }
+ }
+
+ public List<CodeEntity> recentCodes()
+ {
+ Query q = em.createQuery("SELECT c FROM CodeEntity c WHERE hash=null ORDER BY datetime DESC ");
+ q.setMaxResults(MAX_CODES);
+ List<CodeEntity> codes = q.getResultList();
+ return codes;
+ }
+
+ /**
+ * getting codes from database needs new transaction so that we can further
+ * modify returned Codes without affecting database (when we call this
+ * function from another session bean
+ */
+ @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
+ public List<CodeEntity> searchCodes(CodeEntity code, int page, QueryInfo info)
+ {
+ StringBuilder sb = new StringBuilder();
+
+ String delim = "";
+ if (!code.getUser().trim().equals(""))
+ {
+ sb.append("c.user = \'" + code.getUser().trim().toLowerCase() + "\'");
+ delim = " AND";
+ }
+ if (!code.getLanguage().trim().equals(""))
+ {
+ sb.append(delim).append(" c.language = \'" + code.getLanguage().trim().toLowerCase() + "\'");
+ delim = " AND";
+ }
+ if (!code.getNote().trim().equals(""))
+ {
+ sb.append(delim).append(" c.note LIKE \'%" + code.getNote().trim().toLowerCase() + "%\'");
+ delim = " AND";
+ }
+ if (!code.getText().trim().equals(""))
+ {
+ sb.append(delim).append(" c.text LIKE \'%" + code.getText().toLowerCase() + "%\'");
+ delim = " AND";
+ }
+ if (code.getDatetime() != null)
+ {
+ SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss");
+ Date date2 = new Date();
+ date2.setTime(code.getDatetime().getTime() + 24 * 60 * 60 * 1000); // +1
+ // day
+
+ String formattedDate1 = formatter.format(code.getDatetime());
+ String formattedDate2 = formatter.format(date2);
+
+ sb.append(delim).append(" c.datetime between \'" + formattedDate1 + "\' and \'" + formattedDate2 + "\'");
+ delim = " AND";
+ }
+
+ if (sb.toString().length() == 0)
+ sb.append("1 = \'1\'");
+
+ Query q = em.createQuery("SELECT c FROM CodeEntity c WHERE hash=null AND " + sb.toString() + " ORDER BY datetime DESC");
+ int allRecords = q.getResultList().size();
+ q.setFirstResult(page * PAGE_SIZE);
+ q.setMaxResults(PAGE_SIZE);
+ List<CodeEntity> codes = q.getResultList();
+
+ info.setPage(page);
+ info.setRecordsCount(allRecords);
+ info.setPagesCount(allRecords / PAGE_SIZE);
+
+ return codes;
+ }
+}
Added: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Data.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Data.java (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Data.java 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.weld.examples.pastecode.session;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Named;
+import java.io.Serializable;
+import javax.faces.model.SelectItem;
+import javax.enterprise.inject.Produces;
+import java.util.List;
+import java.util.ArrayList;
+
+@ApplicationScoped
+@Named("dataBean")
+public class Data implements Serializable
+{
+ private static final long serialVersionUID = 991300443278089016L;
+
+ private int LANG_EXTENSION = 0; // e.g. txt
+ private int LANG_NAME = 1; // e.g. Plain text
+ private int LANG_BRUSH = 2; // e.g. text
+ private String languages[][] = { { "txt", "Plain text", "text" }, { "as3", "AS3", "as3" }, { "sh", "Bash", "bash" }, { "cs", "C#", "csharp" }, { "cf", "Cold Fusion", "coldfusion" }, { "cpp", "C++", "cpp" }, { "css", "CSS", "css" }, { "pas", "Delphi", "pas" }, { "diff", "Diff", "diff" }, { "erl", "Erlang", "erl" }, { "groovy", "Groovy", "groovy" }, { "js", "JavaScript", "js" }, { "java", "Java", "java" }, { "fx", "JavaFX", "javafx" }, { "perl", "Perl", "perl" }, { "php", "PHP", "php" }, { "ps1", "Power Shell", "powershell" }, { "py", "Python", "py" }, { "rb", "Ruby", "rb" }, { "scl", "Scala", "scala" }, { "sql", "Sql", "sql" }, { "vb", "Visual Basic", "vb" }, { "xml", "XML", "xml" } };
+ private String themes[] = { "Default Theme", "Django Theme", "Eclipse Theme", "Emacs Theme", "Midnight Theme", "Dark Theme" };
+
+ public Data()
+ {
+ }
+
+ @Produces
+ @Named("languageItems")
+ public List<SelectItem> getLanguageItems()
+ {
+ List<SelectItem> items = new ArrayList<SelectItem>();
+ for (int i = 0; i != languages.length; i++)
+ {
+ items.add(new SelectItem(languages[i][LANG_EXTENSION], languages[i][LANG_NAME]));
+ }
+ return items;
+ }
+
+ @Produces
+ @Named("themeItems")
+ public List<SelectItem> getThemeItems()
+ {
+ List<SelectItem> items = new ArrayList<SelectItem>();
+ for (int i = 0; i != themes.length; i++)
+ {
+ items.add(new SelectItem(themes[i]));
+ }
+ return items;
+ }
+
+ public String getBrush(String language)
+ {
+ for (int i = 0; i != languages.length; i++)
+ {
+ if (languages[i][LANG_EXTENSION].equals(language))
+ return languages[i][LANG_BRUSH];
+ }
+ return languages[0][LANG_BRUSH];
+ }
+}
Added: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/HashComputer.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/HashComputer.java (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/HashComputer.java 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.weld.examples.pastecode.session;
+
+import org.jboss.weld.examples.pastecode.model.CodeEntity;
+import java.security.NoSuchAlgorithmException;
+import java.security.MessageDigest;
+
+public class HashComputer
+{
+ public HashComputer()
+ {
+ }
+
+ public String getHashValue(CodeEntity code) throws NoSuchAlgorithmException
+ {
+ String hashValue;
+ MessageDigest md = MessageDigest.getInstance("SHA-1");
+ String combinedValue = code.getText() + code.getDatetime();
+ md.update(combinedValue.getBytes());
+ hashValue = asHex(md.digest());
+ return hashValue;
+ }
+
+ private String asHex(byte buf[])
+ {
+ StringBuffer strBuf = new StringBuffer(buf.length * 2);
+
+ for (int i = 0; i < buf.length; i++)
+ {
+ if (((int) buf[i] & 0xff) < 0x10)
+ strBuf.append("0");
+ strBuf.append(Long.toString((int) buf[i] & 0xff, 16));
+ }
+
+ return strBuf.toString();
+ }
+}
Added: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/History.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/History.java (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/History.java 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,131 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.weld.examples.pastecode.session;
+
+import java.util.List;
+import javax.ejb.Stateful;
+import javax.annotation.PostConstruct;
+import org.jboss.weld.examples.pastecode.model.CodeEntity;
+import javax.inject.Named;
+import javax.inject.Inject;
+import java.io.Serializable;
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.inject.Produces;
+
+/**
+ * Session Bean implementation class HistoryBean
+ */
+
+@SessionScoped
+@Named("history")
+@Stateful
+public class History implements Serializable
+{
+
+ private static final long serialVersionUID = 20L;
+
+ transient @Inject
+ Code eao;
+
+ private QueryInfo info;
+
+ private List<CodeEntity> codes;
+
+ private int TRIMMED_TEXT_LEN = 120;
+
+ private CodeEntity searchItem;
+
+ private int page = 0;
+
+ public History()
+ {
+ }
+
+ @PostConstruct
+ public void initialize()
+ {
+ this.searchItem = new CodeEntity();
+ // this.info = new QueryInfo();
+ }
+
+ public List<CodeEntity> getCodes()
+ {
+ return this.codes;
+ }
+
+ public void setCodes(List<CodeEntity> codes)
+ {
+ this.codes = codes;
+ }
+
+ @Produces
+ @Named("searchItem")
+ public CodeEntity getSearchItem()
+ {
+ return searchItem;
+ }
+
+ public void setSearchItem(CodeEntity searchItem)
+ {
+ this.searchItem = searchItem;
+ }
+
+ public String newSearch()
+ {
+ this.page = 0;
+ return "history";
+ }
+
+ public String search()
+ {
+ this.info = new QueryInfo();
+ this.codes = null;
+ this.codes = eao.searchCodes(this.searchItem, this.page, this.info);
+
+ for (int i = 0; i != this.codes.size(); i++)
+ {
+ String s = this.codes.get(i).getText();
+ this.codes.get(i).setText(s.substring(0, s.length() > TRIMMED_TEXT_LEN ? TRIMMED_TEXT_LEN : s.length()) + " .....");
+ }
+ return "history";
+ }
+
+ public int getPage()
+ {
+ return page;
+ }
+
+ public void setPage(int page)
+ {
+ this.page = page;
+ }
+
+ public QueryInfo getInfo()
+ {
+ return info;
+ }
+
+ public void setInfo(QueryInfo info)
+ {
+ this.info = info;
+ }
+}
Added: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/LargeCodeDecorator.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/LargeCodeDecorator.java (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/LargeCodeDecorator.java 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,120 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.weld.examples.pastecode.session;
+
+import java.util.Date;
+import javax.annotation.Resource;
+import javax.decorator.Decorator;
+import javax.decorator.Delegate;
+import javax.ejb.TransactionManagement;
+import javax.ejb.TransactionManagementType;
+import javax.enterprise.inject.Any;
+import javax.inject.Inject;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import org.jboss.weld.examples.pastecode.model.CodeEntity;
+import org.jboss.weld.examples.pastecode.model.LargeCodeLog;
+import javax.transaction.UserTransaction;
+
+/**
+ * This Decorator performs logging of information about large
+ * transactions. A transaction is large if the pasted code has
+ * more than 65kB. When such a transaction is performed the
+ * following pieces of information are being recorded:
+ * - id of the transaction,
+ * - time of the transaction
+ * - "w" - if it was written, "r" - if it was read
+ *
+ */
+@Decorator
+(a)TransactionManagement(TransactionManagementType.BEAN)
+public abstract class LargeCodeDecorator implements Code
+{
+ /* injecting Delagation point - mandatory */
+ @Inject @Delegate @Any Code eao;
+
+ @PersistenceContext(unitName = "pastecodeDatabase")
+ private EntityManager em;
+
+ @Resource UserTransaction ut;
+
+ private long LARGE_CODE = 65536;
+
+ public String addCode(CodeEntity code, boolean secured)
+ {
+
+ String codeId = eao.addCode(code, secured);
+
+ if (code.getText().length() > LARGE_CODE)
+ {
+ try
+ {
+ ut.begin();
+ em.joinTransaction();
+ em.persist(new LargeCodeLog(code.getId(), code.getDatetime(), "w")); //writing large code
+ ut.commit();
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ try
+ {
+ ut.rollback();
+ }
+ catch (Exception ex)
+ {
+ }
+ }
+ }
+
+ return codeId;
+ }
+
+ public CodeEntity getCode(String id)
+ {
+ CodeEntity code = eao.getCode(id);
+
+ if (code.getText().length() > LARGE_CODE)
+ {
+ try
+ {
+ ut.begin();
+ em.joinTransaction();
+ em.persist(new LargeCodeLog(code.getId(), new Date(), "r")); //reading large code
+ ut.commit();
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ try
+ {
+ ut.rollback();
+ }
+ catch (Exception ex)
+ {
+ }
+ }
+ }
+
+ return code;
+ }
+}
Added: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Paster.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Paster.java (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/Paster.java 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,127 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.weld.examples.pastecode.session;
+
+import javax.inject.*;
+import javax.annotation.PostConstruct;
+import javax.ejb.EJBException;
+import javax.enterprise.inject.*;
+import org.jboss.weld.examples.pastecode.model.*;
+import java.util.List;
+
+@Model
+public class Paster
+{
+ private CodeEntity code;
+
+ private String codeId;
+
+ private String brush;
+
+ private String theme;
+
+ private boolean secured = false;
+
+ @Inject Data data;
+
+ transient @Inject Code eao;
+
+ public Paster()
+ {
+ }
+
+ @PostConstruct
+ public void postConstruct()
+ {
+ this.code = new CodeEntity();
+ this.theme = "shThemeDefault.css";
+ }
+
+ public String paste()
+ {
+ this.codeId = eao.addCode(code, secured);
+ return "success";
+ }
+
+ /* used for access from jsf page */
+ @Produces
+ @Named("code")
+ public CodeEntity getPasterCodeInstance()
+ {
+ return this.code;
+ }
+
+ public void loadCode()
+ {
+ this.code = eao.getCode(codeId);
+
+ if (this.code == null)
+ throw new EJBException("Could not read entity with given id value");
+
+ this.brush = data.getBrush(this.code.getLanguage());
+ }
+
+ public List<CodeEntity> getCodes()
+ {
+ return eao.recentCodes();
+ }
+
+ public String getCodeId()
+ {
+ return codeId;
+ }
+
+ public void setCodeId(String codeId)
+ {
+ this.codeId = codeId;
+ }
+
+ public String getTheme()
+ {
+ return theme;
+ }
+
+ public void setTheme(String theme)
+ {
+ this.theme = theme;
+ }
+
+ public String getBrush()
+ {
+ return brush;
+ }
+
+ public void setBrush(String brush)
+ {
+ this.brush = brush;
+ }
+
+ public boolean isSecured()
+ {
+ return secured;
+ }
+
+ public void setSecured(boolean secured)
+ {
+ this.secured = secured;
+ }
+}
Added: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/PopulateDatabaseBean.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/PopulateDatabaseBean.java (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/PopulateDatabaseBean.java 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,116 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.weld.examples.pastecode.session;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Named;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import javax.enterprise.inject.Instance;
+import java.text.SimpleDateFormat;
+import java.util.StringTokenizer;
+import javax.inject.Inject;
+import org.jboss.weld.examples.pastecode.model.CodeEntity;
+import com.sun.org.apache.xml.internal.serialize.LineSeparator;
+
+/**
+ * This bean only populates database with preformatted data. This is due to need
+ * for Hypersonic database which doesn't allow multi-line inserts. Hypersonic
+ * database is embedded in JBoss AS and so there is no need to configure any
+ * external database to run this example.
+ *
+ */
+@ApplicationScoped
+@Named("database")
+public class PopulateDatabaseBean
+{
+
+ private @Inject
+ Instance<Code> eaoIn;
+ private Code eao;
+ private boolean secured = false;
+ private static final String file = "data.sql";
+ private boolean populated = false;
+
+ public PopulateDatabaseBean()
+ {
+ }
+
+ public void populate()
+ {
+ if (populated)
+ {
+ return;
+ }
+
+ eao = eaoIn.get();
+
+ try
+ {
+ String fileContent = readFileData(file);
+ StringTokenizer st = new StringTokenizer(fileContent, "'");
+ SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+ while (st.countTokens() > 1)
+ {
+ CodeEntity c = new CodeEntity();
+ st.nextToken();
+ c.setDatetime(formatter.parse(st.nextToken()));
+ st.nextToken();
+ c.setLanguage(st.nextToken());
+ st.nextToken();
+ c.setNote(st.nextToken());
+ st.nextToken();
+ c.setUser(st.nextToken());
+ st.nextToken();
+ c.setText(st.nextToken());
+
+ eao.addCode(c, secured);
+ }
+
+ }
+ catch (Exception e)
+ {
+ System.err.println("Unable to read all records from " + file + " file");
+ }
+
+ populated = true;
+ }
+
+ private String readFileData(String fileName) throws IOException
+ {
+ InputStream is = this.getClass().getClassLoader().getResourceAsStream(fileName);
+ BufferedReader br = new BufferedReader(new InputStreamReader(is));
+
+ String radek;
+ StringBuffer sb = new StringBuffer();
+
+ while ((radek = br.readLine()) != null)
+ {
+ sb.append(radek).append(LineSeparator.Web);
+ }
+
+ return new String(sb);
+ }
+}
Added: examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/QueryInfo.java
===================================================================
--- examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/QueryInfo.java (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/java/org/jboss/weld/examples/pastecode/session/QueryInfo.java 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,144 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.weld.examples.pastecode.session;
+
+import java.util.List;
+import java.util.ArrayList;
+
+public class QueryInfo
+{
+ private int recordsCount = 0;
+ private int pagesCount = 0;
+ private int numLinks = 8;
+ private int startIndex;
+ private int endIndex;
+ private int page = 0;
+ private List<Integer> indexes;
+
+ public int getNumLinks()
+ {
+ return numLinks;
+ }
+
+ public int getPage()
+ {
+ return page;
+ }
+
+ public void setPage(int page)
+ {
+ this.page = page;
+ }
+
+ public int getPagesCount()
+ {
+ return pagesCount;
+ }
+
+ public void setPagesCount(int pagesCount)
+ {
+ this.pagesCount = pagesCount;
+
+ if (pagesCount == 1)
+ {
+ this.setBoundedIndexes(0, 0);
+ }
+
+ if (this.page > (numLinks / 2))
+ {
+ this.setStartIndex(this.page - (numLinks / 2));
+ }
+ else
+ {
+ this.setStartIndex(0);
+ this.setEndIndex((numLinks > this.pagesCount) ? this.pagesCount : numLinks);
+ }
+
+ if (this.page + (numLinks / 2) >= this.pagesCount)
+ {
+ this.setEndIndex(this.pagesCount);
+ this.setStartIndex((this.pagesCount - numLinks) < 0 ? 0 : this.pagesCount - numLinks);
+ }
+ else
+ {
+ if (this.page < (numLinks / 2))
+ {
+ this.setEndIndex((numLinks > this.pagesCount) ? this.pagesCount : numLinks);
+ }
+ else
+ {
+ this.setEndIndex(this.page + (numLinks / 2));
+ }
+
+ }
+ this.setBoundedIndexes(this.startIndex, this.endIndex);
+ }
+
+ public void setBoundedIndexes(int startIndex, int endIndex)
+ {
+ this.indexes = new ArrayList(endIndex - startIndex);
+ for (int i = startIndex; i <= endIndex; i++)
+ {
+ this.indexes.add(new Integer(i));
+ }
+ }
+
+ public List<Integer> getIndexes()
+ {
+ return indexes;
+ }
+
+ public void setIndexes(List<Integer> indexes)
+ {
+ this.indexes = indexes;
+ }
+
+ public int getRecordsCount()
+ {
+ return recordsCount;
+ }
+
+ public void setRecordsCount(int recordsCount)
+ {
+ this.recordsCount = recordsCount;
+ }
+
+ public int getStartIndex()
+ {
+ return startIndex;
+ }
+
+ public void setStartIndex(int startIndex)
+ {
+ this.startIndex = startIndex;
+ }
+
+ public int getEndIndex()
+ {
+ return endIndex;
+ }
+
+ public void setEndIndex(int endIndex)
+ {
+ this.endIndex = endIndex;
+ }
+}
Added: examples/trunk/jsf/pastecode/src/main/resources/META-INF/persistence.xml
===================================================================
--- examples/trunk/jsf/pastecode/src/main/resources/META-INF/persistence.xml (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/resources/META-INF/persistence.xml 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
+ version="1.0">
+ <persistence-unit name="pastecodeDatabase">
+ <provider>org.hibernate.ejb.HibernatePersistence</provider>
+ <jta-data-source>java:/pastecodeDatasource</jta-data-source>
+ <properties>
+ <property name="hibernate.hbm2ddl.auto" value="create-drop"/> <!-- create-drop update-->
+ <property name="hibernate.show_sql" value="false"/>
+ </properties>
+ </persistence-unit>
+</persistence>
Added: examples/trunk/jsf/pastecode/src/main/resources/data.sql
===================================================================
--- examples/trunk/jsf/pastecode/src/main/resources/data.sql (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/resources/data.sql 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,530 @@
+insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (1, '2010-01-01 01:01:01', 'css', ' ', 'martin',
+'div {
+ min-height: 500px;
+ height:auto !important;
+ height: 500px;
+}');
+insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (2, '2009-01-02 01:01:01', 'css', ' ', 'peter',
+'div {
+ height: expression( this.scrollHeight < 501 ? "500px" : "auto" );
+}');
+insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (3, '2009-02-02 01:01:01', 'css', ' ', 'peter',
+'a.GlobalOrangeButton span {
+background: transparent url(http://media-sprout.com/tutorials/web/CSSSprit-SlideButton/images/but... no-repeat 0 0;
+display: block;
+line-height: 22px;
+padding: 7px 0 5px 18px;
+color: #fff;
+}
+');
+insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (4, '2009-02-02 01:01:01', 'js', ' ', 'john',
+'var newPathname = "";
+for ( i = 0; i pathArray.length; i++ ) {
+ newPathname += "/";
+ newPathname += pathArray[i];
+}');
+insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (5, '2009-02-03 01:01:01', 'js', ' ', 'graham',
+'<script type="text/javascript">
+<!--
+ function toggle_visibility(id) {
+ var e = document.getElementById(id);
+');
+insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (6, '2009-02-04 01:01:01', 'js', ' ', 'martin',
+'var myArray = ["one", "two", "three"];
+
+// console.log( myArray ) => ["one", "two", "three"]
+
+myArray.length = 0;
+
+// console.log( myArray ) => []');
+insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (7, '2009-02-04 01:01:01', 'js', ' ', 'crazyman',
+'function randRange(data) {
+ var newTime = data[Math.floor(data.length * Math.random())];
+ return newTime;
+}
+
+function toggleSomething() {
+ var timeArray = new Array(200, 300, 150, 250, 2000, 3000, 1000, 1500);
+
+ // do stuff, happens to use jQuery here (nothing else does)
+ $("#box").toggleClass("visible");
+
+ clearInterval(timer);
+ timer = setInterval(toggleSomething, randRange(timeArray));
+');
+insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (8, '2009-02-05 01:01:01', 'java', ' ', 'peter',
+'public List<code> recentcodes()
+ {
+ Query q = em.createQuery("SELECT c FROM code c WHERE hash=null ORDER BY datetime DESC ");
+ q.setMaxResults(MAX_codeS);
+ List<code> codes = q.getResultList();
+ return codes;
+ }');
+insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (9, '2009-02-05 01:01:01', 'java', ' ', 'graham',
+' private void startOperation() throws HibernateException {
+ session = HibernateFactory.openSession();
+ tx = session.beginTransaction();
+ }');
+insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (10, '2009-01-06 01:01:01', 'java', ' ', 'martin',
+'public List findAll() throws DataAccessLayerException{
+ List events = null;
+ try {
+ startOperation();
+ Query query = session.createQuery("from Event");
+ events = query.list();
+ tx.commit();
+ } catch (HibernateException e) {
+ handleException(e);
+ } finally {
+ HibernateFactory.close(session);
+ }
+ return events;
+ }
+');
+insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (11, '2009-02-06 01:01:01', 'java', ' ', 'crazyman',
+'public Event find(Long id) throws DataAccessLayerException {
+ Event event = null;
+ try {
+ startOperation();
+ event = (Event) session.load(Event.class, id);
+ tx.commit();
+ } catch (HibernateException e) {
+ handleException(e);
+ } finally {
+ HibernateFactory.close(session);
+ }
+ return event;
+ }');
+insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (12, '2009-01-07 01:01:01', 'java', ' ', 'graham',
+' public void delete(Event event) throws DataAccessLayerException {
+ try {
+ startOperation();
+ session.delete(event);
+ tx.commit();
+ } catch (HibernateException e) {
+ handleException(e);
+ } finally {
+ HibernateFactory.close(session);
+ }
+ }');
+insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (13, '2009-01-08 01:01:01', 'java', ' ', 'peter',
+'public void create(Event event) throws DataAccessLayerException {
+ try {
+ startOperation();
+ session.save(event);
+ tx.commit();
+ } catch (HibernateException e) {
+ handleException(e);
+ } finally {
+ HibernateFactory.close(session);
+ }
+ }');
+insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (14, '2009-01-09 01:01:01', 'php', ' ', 'martin',
+'function build_calendar($month,$year,$dateArray) {
+
+ // Create array containing abbreviations of days of week.
+ $daysOfWeek = array(S,M,T,W,T,F,S);
+
+ // What is the first day of the month in question?
+ $firstDayOfMonth = mktime(0,0,0,$month,1,$year);
+
+ // How many days does this month contain?
+ $numberDays = date(t,$firstDayOfMonth);
+}');
+insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (15, '2009-01-10 01:01:01', 'php', ' ', 'john',
+'if ( !empty($_SERVER[HTTP_X_REQUESTED_WITH]) && strtolower($_SERVER[HTTP_X_REQUESTED_WITH]) == xmlhttprequest )
+{
+ # Ex. check the query and serve requested data
+}');
+insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (16, '2009-01-11 01:01:01', 'php', ' ', 'graham',
+'<?php
+
+function getTwitterStatus($userid){
+$url = "http://twitter.com/statuses/user_timeline/$userid.xml?count=1";
+
+$xml = simplexml_load_file($url) or die("could not connect");
+
+ foreach($xml->status as $status){
+ $text = $status->text;
+ }
+ echo $text;
+ }
+
+//my user id kenrick1991
+getTwitterStatus("kenrick1991");
+
+?>');
+insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (17, '2009-01-11 01:01:01', 'php', ' ', 'peter',
+'<?php
+ header( Location: http://www.yoursite.com/new_page.html ) ;
+?>');
+insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (18, '2009-01-12 01:01:01', 'php', ' ', 'martin',
+'function findexts ($filename) {
+
+ $filename = strtolower($filename) ;
+
+ $exts = split("[/\\.]", $filename) ;
+
+ $n = count($exts)-1;
+
+ $exts = $exts[$n];
+
+ return $exts;
+
+}');
+insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (19, '2009-01-12 01:01:01', 'php', ' ', 'graham',
+'function fileRead($file){
+ $lines = file($file);
+ foreach ($lines as $line_num => $line) {
+ echo $line, </br>;
+ }
+}');
+insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (20, '2009-02-12 01:01:01', 'java', ' ', 'peter',
+'import java.util.*;
+
+import org.hibernate.*;
+import org.hibernate.criterion.*;
+
+public class Main {
+
+
+ public static void main(String[] args) {
+ HibernateUtil.setup("create table EVENTS ( uid int, name VARCHAR, start_Date date, duration int);");
+
+ // hibernate code start
+
+
+ SimpleEventDao eventDao = new SimpleEventDao();
+ Event event = new Event();
+ event.setName("Create an Event");
+
+ eventDao.create(event);
+
+ Event foundEvent = eventDao.find(/*event.getId()*/1L);
+
+ System.out.println(foundEvent.getName());
+
+
+ HibernateUtil.checkData("select uid, name from events");
+ // hibernate code end
+ }
+
+}');
+insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (21, '2009-02-16 01:01:01', 'java', ' ', 'crazyman',
+'import javax.swing.DefaultListModel;
+import javax.swing.DropMode;
+import javax.swing.JComboBox;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextField;
+import javax.swing.TransferHandler;
+
+public class DropModeON {
+ public static void main(String[] args) {
+ JPanel north = new JPanel();
+ north.add(new JLabel("Drag from here:"));
+ JTextField field = new JTextField(10);
+ field.setDragEnabled(true);
+ north.add(field);
+
+ final DefaultListModel listModel = new DefaultListModel();
+ listModel.addElement("first");
+ listModel.addElement("second");
+ final JList list = new JList(listModel);
+ list.setDragEnabled(true);
+
+ list.setTransferHandler(new TransferHandler() {
+ public boolean canImport(TransferHandler.TransferSupport support) {
+ if (!support.isDataFlavorSupported(DataFlavor.stringFlavor)) {
+ return false;
+ }
+ JList.DropLocation dl = (JList.DropLocation) support.getDropLocation();
+ if (dl.getIndex() == -1) {
+ return false;
+ } else {
+ return true;
+ }
+ }');
+insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (22, '2009-02-15 01:01:01', 'java', ' ', 'martin',
+'@Entity
+public class Address {
+ @Id
+ private int id;
+ private String street;
+ private String city;
+ private String state;
+ private String zip;
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getStreet() {
+ return street;
+ }
+
+ public void setStreet(String address) {
+ this.street = address;
+ }
+
+ public String getCity() {
+ return city;
+ }
+
+ public void setCity(String city) {
+ this.city = city;
+ }
+
+ public String getState() {
+ return state;
+ }
+
+ public void setState(String state) {
+ this.state = state;
+ }
+
+ public String getZip() {
+ return zip;
+ }
+
+ public void setZip(String zip) {
+ this.zip = zip;
+ }
+ public String toString() {
+ return "Address id: " + getId() +
+ ", street: " + getStreet() +
+ ", city: " + getCity() +
+ ", state: " + getState() +
+ ", zip: " + getZip();
+ }
+
+}');
+insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (23, '2009-02-18 01:01:01', 'java', ' ', 'graham',
+'import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+
+public class ProfessorService {
+ protected EntityManager em;
+
+ public ProfessorService(EntityManager em) {
+ this.em = em;
+ }
+
+ public List findWithAlias() {
+ Query query = em.createNativeQuery(
+ "SELECT emp.emp_id AS emp_id, name, salary, manager_id, dept_id, address_id, "
+ + "address.id, street, city, state, zip " + "FROM emp, address "
+ + "WHERE address_id = id", "ProfessorWithAddressColumnAlias");
+ return query.getResultList();
+ }
+
+}');
+insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (24, '2009-02-19 01:01:01', 'java', ' ', 'crazyman',
+'@Entity
+public class Department {
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ private int id;
+
+ private String name;
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String deptName) {
+ this.name = deptName;
+ }
+
+ public String toString() {
+ return "Department id: " + getId() + ", name: " + getName();
+ }
+}
+');
+insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (25, '2009-02-01 01:01:01', 'java', ' ', 'graham',
+'import java.io.Reader;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.Statement;
+
+public class JPAUtil {
+ Statement st;
+
+ public JPAUtil() throws Exception{
+ Class.forName("org.hsqldb.jdbcDriver");
+ System.out.println("Driver Loaded.");
+ String url = "jdbc:hsqldb:data/tutorial";
+
+ Connection conn = DriverManager.getConnection(url, "sa", "");
+ System.out.println("Got Connection.");
+ st = conn.createStatement();
+ }
+ public void executeSQLCommand(String sql) throws Exception {
+ st.executeUpdate(sql);
+ }
+ public void checkData(String sql) throws Exception {
+ ResultSet rs = st.executeQuery(sql);
+ ResultSetMetaData metadata = rs.getMetaData();
+
+ for (int i = 0; i < metadata.getColumnCount(); i++) {
+ System.out.print("\t"+ metadata.getColumnLabel(i + 1));
+ }
+ System.out.println("\n----------------------------------");
+
+ while (rs.next()) {
+ for (int i = 0; i < metadata.getColumnCount(); i++) {
+ Object value = rs.getObject(i + 1);
+ if (value == null) {
+ System.out.print("\t ");
+ } else {
+ System.out.print("\t"+value.toString().trim());
+ }
+ }
+ System.out.println("");
+ }
+ }
+}');
+
+insert into code (ID, DATETIME, LANGUAGE, NOTE, USER, TEXT) values (26, '2009-02-01 01:01:01', 'java', 'Some note', 'martin',
+'package org.jboss.weld.examples.pastie.session;
+
+import java.util.List;
+
+import javax.ejb.Stateful;
+import javax.annotation.PostConstruct;
+import javax.annotation.Resource;
+import java.io.Serializable;
+import javax.ejb.EJBContext;
+import javax.ejb.Stateless;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
+import javax.persistence.*;
+import org.jboss.weld.examples.pastie.model.code;
+import javax.inject.*;
+import javax.enterprise.context.SessionScoped;
+import javax.enterprise.inject.Produces;
+
+/**
+ * Session Bean implementation class HistoryBean
+ */
+
+@SessionScoped
+@Named("history")
+@Stateful
+public class HistoryBean implements History, Serializable
+{
+
+ private static final long serialVersionUID = 20L;
+
+ transient @Inject codeEAO eao;
+
+ transient private @Inject PastieUtils utils;
+
+ //transient private @Inject QueryInfo info;
+
+ private QueryInfo info;
+
+
+
+ private List<code> codes;
+
+ private boolean firstAccess = true;
+
+ private int TRIMMED_TEXT_LEN = 150;
+
+ private code searchItem;
+
+ private int page = 0;
+
+
+
+ public HistoryBean()
+ {
+ }
+
+ @PostConstruct
+ public void initialize()
+ {
+ this.searchItem = new code();
+ this.info = new QueryInfo();
+ }
+
+ public List<code> getcodes()
+ {
+ return this.codes;
+ }
+
+ public void loadcode()
+ {
+ if (firstAccess)
+ {
+ this.codes = eao.allcodes();
+
+ for(int i=0; i!=this.codes.size();i++)
+ {
+ String s = this.codes.get(i).getText();
+ //this.codes.get(i).setText(s.substring(0, s.length() > TRIMMED_TEXT_LEN ? TRIMMED_TEXT_LEN : s.length()));
+ }
+ firstAccess = false;
+ }
+ }
+
+ public void setcodes(List<code> codes) {
+ this.codes = codes;
+ }
+
+ @Produces @Named("searchItem")
+ public code getSearchItem() {
+ return searchItem;
+ }
+
+ public void setSearchItem(code searchItem) {
+ this.searchItem = searchItem;
+ }
+
+ public String search()
+ {
+ this.codes = eao.searchcodes(this.searchItem, this.page, this.info);
+
+ return "history";
+ }
+
+
+ public int getPage() {
+ return page;
+ }
+
+ public void setPage(int page) {
+ this.page = page;
+ }
+
+
+ public QueryInfo getInfo() {
+ return info;
+ }
+
+ public void setInfo(QueryInfo info) {
+ this.info = info;
+ }
+
+}
+')
Added: examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/beans.xml
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/beans.xml (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/beans.xml 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ The contents of this file is permitted to be empty.
+ The schema definition is provided for your convenience.
+-->
+<beans xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
+
+ <decorators>
+ <class>org.jboss.weld.examples.pastecode.session.LargeCodeDecorator</class>
+ </decorators>
+
+</beans>
Added: examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/faces-config.xml (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/faces-config.xml 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,24 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<faces-config version="2.0"
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd">
+
+<navigation-rule>
+ <from-view-id>/home.xhtml</from-view-id>
+ <navigation-case>
+ <from-action>#{paster.paste}</from-action>
+ <to-view-id>/#{paster.codeId}</to-view-id>
+ <redirect/>
+ </navigation-case>
+</navigation-rule>
+
+ <navigation-rule>
+ <from-view-id>/history.xhtml</from-view-id>
+ <navigation-case>
+ <from-action>#{history.newSearch}</from-action>
+ <to-view-id>/history.xhtml?page=#{history.page}</to-view-id>
+ </navigation-case>
+</navigation-rule>
+
+</faces-config>
Added: examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/urlrewrite.xml
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/urlrewrite.xml (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/urlrewrite.xml 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 3.2//EN"
+ "http://tuckey.org/res/dtds/urlrewrite3.2.dtd">
+
+<!--
+
+ Configuration file for UrlRewriteFilter
+ http://tuckey.org/urlrewrite/
+
+-->
+
+<urlrewrite>
+
+ <!-- first construct nice address (ending with number, e.g. /0532106545) and show it in URL field-->
+ <rule>
+ <from>^/(\w{40})\.jsf$</from>
+ <to type="redirect" last="true">/weld-pastecode/$1</to>
+ </rule>
+
+ <rule>
+ <from>^/(\d+)\.jsf$</from>
+ <to type="redirect">/weld-pastecode/$1</to>
+ </rule>
+
+ <!-- then forward to appropriate page without changing displayed URL -->
+ <rule>
+ <from>^/(\w{40})$</from>
+ <to type="forward" last="true">display.jsf?id=$1</to>
+ </rule>
+
+ <rule>
+ <from>^/(\d+)$</from>
+ <to type="forward">display.jsf?id=$1</to>
+ </rule>
+
+</urlrewrite>
+
Added: examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/web.xml
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/web.xml (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/WEB-INF/web.xml 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ version="2.5">
+
+ <display-name>Weld PasteCode example</display-name>
+<!-- <distributable />-->
+
+ <context-param>
+ <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
+ <param-value>.xhtml</param-value>
+ </context-param>
+
+ <session-config>
+ <session-timeout>10</session-timeout>
+ </session-config>
+
+ <servlet>
+ <servlet-name>Faces Servlet</servlet-name>
+ <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>Faces Servlet</servlet-name>
+ <url-pattern>*.jsf</url-pattern>
+ <url-pattern>/faces/*</url-pattern>
+ </servlet-mapping>
+
+ <filter>
+ <filter-name>UrlRewriteFilter</filter-name>
+ <filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>UrlRewriteFilter</filter-name>
+ <url-pattern>/*</url-pattern>
+ <dispatcher>REQUEST</dispatcher>
+ <dispatcher>FORWARD</dispatcher>
+ </filter-mapping>
+
+ <servlet>
+ <description></description>
+ <display-name>DownloadServlet</display-name>
+ <servlet-name>DownloadServlet</servlet-name>
+ <servlet-class>org.jboss.weld.examples.pastecode.servlets.DownloadServlet</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>DownloadServlet</servlet-name>
+ <url-pattern>/download</url-pattern>
+ </servlet-mapping>
+
+</web-app>
Added: examples/trunk/jsf/pastecode/src/main/webapp/display.xhtml
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/display.xhtml (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/display.xhtml 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,75 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:s="http://jboss.com/products/seam/taglib">
+
+ <ui:composition template="template.xhtml">
+ <ui:define name="viewMetadata">
+ <f:metadata>
+ <f:viewParam name="id" value="#{paster.codeId}"/>
+ <f:event type="preRenderView" listener="#{paster.loadCode}"/>
+ </f:metadata>
+ </ui:define>
+
+ <ui:define name="myscripts">
+ <!-- Include required JS files -->
+ <ui:include src="jsScripts.xhtml"/>
+ </ui:define>
+
+ <ui:define name="themes">
+ <link href="syntaxhighlighter/styles/shCore.css" rel="stylesheet" type="text/css" />
+ <link rel="stylesheet" href="syntaxhighlighter/styles/shThemeDefault.css" type="text/css" title="Default Theme" media="screen"/>
+ <link rel="alternate stylesheet" href="syntaxhighlighter/styles/shThemeEclipse.css" type="text/css" title="Eclipse Theme" media="screen"/>
+ <link rel="alternate stylesheet" href="syntaxhighlighter/styles/shThemeEmacs.css" type="text/css" title="Emacs Theme" media="screen"/>
+ <link rel="alternate stylesheet" href="syntaxhighlighter/styles/shThemeFadeToGray.css" type="text/css" title="FadeToGray Theme" media="screen"/>
+ <link rel="alternate stylesheet" href="syntaxhighlighter/styles/shThemeMidnight.css" type="text/css" title="Midnight Theme" media="screen"/>
+ <link rel="alternate stylesheet" href="syntaxhighlighter/styles/shThemeRDark.css" type="text/css" title="Dark Theme" media="screen"/>
+ <link rel="alternate stylesheet" href="syntaxhighlighter/styles/shThemeDjango.css" type="text/css" title="Django Theme" media="screen"/>
+ </ui:define>
+
+ <ui:define name="mainarea">
+ <div style="width: 100%; padding: 7px;">
+
+ <h:panelGrid columns="3" style="width: 80%; margin: 0px; padding: 0px;">
+
+ <h:panelGroup>
+ <h:outputLabel for="user" value="User: "/>
+ <h:outputText id="user" maxlength="30" size="30" value="#{code.user}"/>
+ </h:panelGroup>
+
+ <h:panelGroup>
+ <h:outputLabel for="theme" value="Choose theme: "/>
+ <h:selectOneMenu id="theme" value="#{paster.theme}" onchange="chooseStyle(this.value);"> <!-- this.form.submit() -->
+ <f:selectItems value="#{dataBean.themeItems}"/>
+ </h:selectOneMenu>
+ <a href="download?id=#{code.hash == null ? code.id : code.hash}" style="text-decoration: none;"><input type="button" value="Download file" /></a>
+ </h:panelGroup>
+
+ <h:panelGroup style="text-align:right;">
+ <h:outputLabel for="unwrap" value="Unwrap code: "/>
+ <h:selectBooleanCheckbox id="unwrap" onchange="unwrap('codearea');"/>
+ </h:panelGroup>
+
+ </h:panelGrid>
+
+ <h:outputText value="Pasted code: "/>
+ <div id="codearea" style="width:99%; border: 1px solid #7F7F7F; height:450px; overflow:scroll;">
+ <pre class="brush: #{paster.brush}">#{code.text}</pre>
+ </div>
+
+ <br/>
+ <h:outputLabel for="note" value="Note: "/>
+ <div >
+ <h:outputText id="note" value="#{code.note}"/>
+ </div>
+ </div>
+ </ui:define>
+
+ <ui:define name="rightmenu">
+ <ui:include src="rightMenuDefault.xhtml"/>
+ </ui:define>
+
+ </ui:composition>
+</html>
Added: examples/trunk/jsf/pastecode/src/main/webapp/functions.js
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/functions.js (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/functions.js 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,25 @@
+function chooseStyle(title) {
+ var i, curstyle, altsheets = [ "" ]
+ for (i = 0; (curstyle = document.getElementsByTagName("link")[i]); i++) {
+ if (curstyle.getAttribute("rel").toLowerCase() == "alternate stylesheet"
+ && curstyle.getAttribute("title")) {
+ curstyle.disabled = true
+ if (curstyle.getAttribute("title") == title)
+ curstyle.disabled = false
+ }
+ }
+}
+
+function unwrap(elementId) {
+ var vardiv = document.getElementById(elementId);
+ if (vardiv.style.overflow == "visible") {
+ vardiv.style.overflow = "scroll";
+ vardiv.style.height = "450px";
+ return false;
+ }
+ if (vardiv.style.overflow == "scroll") {
+ vardiv.style.overflow = "visible";
+ vardiv.style.height = null;
+ return false;
+ }
+}
Added: examples/trunk/jsf/pastecode/src/main/webapp/help.xhtml
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/help.xhtml (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/help.xhtml 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,53 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:s="http://jboss.com/products/seam/taglib">
+
+ <ui:composition template="template.xhtml">
+
+ <ui:define name="mainarea">
+ <div style="width: 100%; padding: 7px;">
+ <div id="paging" style="width:98%; border-width:0px; background-color:#C1C1E8;text-align:center;"> <!-- height: 40px; -->
+ <strong>Useful Information</strong>
+ </div>
+ <br/>
+ <strong>Paste Code:</strong><br/>
+ <ul>
+ <li>Enter your nick - This is optional, if it is not entered the code will be listed under "Anonymous" user</li>
+ <li>Choose a language of your code - This way you can define formatting of code after submitting the form</li>
+ <li>Choose if this code is private - When this option is chosen the application will generate a hash value of your code and will provide you with
+ a unique link (something like http://localhost:8080/weld-pastecode/582ad4b5ed409ec8b81c6e33ee8b72377890...). Furthemore your code will not be
+ listed in the right panel and cannot even be found through a search capability. </li>
+ <li>Enter your code and a note you would like to send with the code</li>
+ <li>Submit the form and forward the resulting link</li>
+ </ul>
+
+ <strong>Search Code:</strong><br/>
+ <ul>
+ <li>Go to a history page - Now you can see all the posts with pagination</li>
+ <li>Enter data for searching - You can combine all the data together.</li>
+ </ul>
+
+ <strong>Weld Features Covered:</strong><br/>
+
+ <ul>
+ <li>Injecting into POJO, EJB (SFSB), Servlet</li>
+ <li>Annotations @ApplicationScoped, @Model, @SessionScoped et al.</li>
+ <li>Producer named methods</li>
+ <li>Decorators - This feature is used to log transactions during which a code larger than 65kB is stored to a database</li>
+ </ul>
+ <br/><br/><strong>Enjoy work with WELD !</strong>
+
+ </div>
+ </ui:define>
+
+ <ui:define name="rightmenu">
+ <ui:include src="rightMenuDefault.xhtml"/>
+ </ui:define>
+
+ </ui:composition>
+
+</html>
+
Added: examples/trunk/jsf/pastecode/src/main/webapp/history.xhtml
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/history.xhtml (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/history.xhtml 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,98 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:s="http://jboss.com/products/seam/taglib">
+
+ <ui:composition template="template.xhtml">
+ <ui:define name="viewMetadata">
+ <f:metadata>
+ <f:viewParam name="page" value="#{history.page}"/>
+ <f:event type="preRenderView" listener="#{history.search}"/>
+ </f:metadata>
+ </ui:define>
+
+ <ui:define name="themes">
+ </ui:define>
+
+ <ui:define name="mainarea">
+ <div style="width: 100%; padding: 7px;">
+
+ <div id="paging" style="width:98%; border-width:0px; background-color:#C1C1E8;"> <!-- height: 40px; -->
+ <ui:include src="pagination.xhtml"></ui:include>
+ </div>
+ <br/>
+ <h:dataTable value="#{history.codes}" var="varcode" width="99%">
+ <h:column>
+ <div id="searched">
+ <h:panelGroup >
+ <h:outputLabel for="user" value="User: "/>
+ <h:outputLink id="user" value="#{ varcode.id}"> <!-- display.jsf?id= -->
+ <h:outputText value="#{varcode.user}"></h:outputText>
+ </h:outputLink>
+ </h:panelGroup>
+
+ <h:panelGroup>
+ <h:outputLabel for="language" value="Language: "/>
+ <h:outputText id="language" value="#{ varcode.language}"></h:outputText>
+ </h:panelGroup>
+
+ <h:panelGroup>
+ <h:outputLabel for="datetime" value="Date: "/>
+ <h:outputText id="datetime" value="#{ varcode.datetime}">
+ <f:convertDateTime type="both" pattern="yyyy-MM-dd HH:mm:ss"/>
+ </h:outputText>
+ </h:panelGroup>
+ </div>
+ <br/>
+ <h:outputText value="Code (truncated): "/>
+ <div style="height:100px; width:99%; border: 1px solid #7F7F7F; overflow: auto; padding: 1px;">
+ <pre>#{varcode.text}</pre>
+ </div>
+ <br/>
+ <br/>
+ </h:column>
+ </h:dataTable>
+ <br/>
+ <div id="paging" style="width:98%; border-width:0px; background-color:#C1C1E8;"> <!-- height: 40px; -->
+ <ui:include src="pagination.xhtml"></ui:include>
+ </div>
+ </div>
+
+ </ui:define>
+
+ <ui:define name="rightmenu">
+
+ <div id="rightmenuhead" style="width:350px;">
+ <strong>Search:</strong>
+ </div>
+
+ <div id="rightmenubody" style="width:350px;">
+
+ <h:panelGrid cellpadding="0" cellspacing="0" columns="2" width="100%">
+ <h:outputLabel for="user" value="User:"></h:outputLabel>
+ <h:inputText id="user" maxlength="30" style="width:97%;" value="#{searchItem.user}"/>
+ <h:outputLabel for="language" value="Language:"></h:outputLabel>
+ <h:inputText id="language" maxlength="30" style="width:97%;" value="#{searchItem.language}"/>
+ <h:outputLabel for="note" value="Note:"></h:outputLabel>
+ <h:inputText id="note" maxlength="30" style="width:97%;" value="#{searchItem.note}"/>
+ <h:outputLabel for="pasteDate" value="Date: "/>
+ <h:inputText value="#{searchItem.datetime}" id="pasteDate" style="width:97%;" alt="yyyy-mm-dd" title="yyyy-mm-dd"
+ converterMessage="Enter date formatted as yyyy-mm-dd !" >
+ <f:convertDateTime type="date" pattern="yyyy-MM-dd"/>
+ </h:inputText>
+ <h:outputLabel for="code" value="Code:" style="width:100%;"></h:outputLabel>
+ <h:inputTextarea id="code" maxlength="30" rows="2" style="width:97%;" value="#{searchItem.text}"/>
+ </h:panelGrid>
+ <div style="width:100%;text-align:right;">
+ <h:commandButton value="Search" action="#{history.newSearch}"/>
+ </div>
+ <br/>
+ <h:message for="pasteDate"/>
+ </div>
+
+ </ui:define>
+
+ </ui:composition>
+</html>
Added: examples/trunk/jsf/pastecode/src/main/webapp/home.xhtml
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/home.xhtml (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/home.xhtml 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,54 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:s="http://jboss.com/products/seam/taglib">
+
+ <ui:composition template="template.xhtml">
+ <ui:define name="viewMetadata">
+ <f:metadata>
+ <f:event type="preRenderView" listener="#{database.populate}"/>
+ </f:metadata>
+ </ui:define>
+
+ <ui:define name="mainarea">
+ <div style="width: 100%; padding: 7px;">
+
+ <h:panelGrid columns="3" style="width: 100%">
+ <h:panelGroup>
+ <h:outputLabel for="user" value="Your nick: "/>
+ <h:inputText id="user" maxlength="30" size="30" value="#{code.user}"/>
+ </h:panelGroup>
+
+ <h:panelGroup>
+ <h:outputLabel for="language" value="Language: "/>
+ <h:selectOneMenu id="language" value="#{code.language}">
+ <f:selectItems value="#{dataBean.languageItems}"/>
+ </h:selectOneMenu>
+ </h:panelGroup>
+ <h:panelGroup style="text-align:right;">
+ <h:outputLabel for="secured" value="Private: "/>
+ <h:selectBooleanCheckbox id="secured" value="#{paster.secured}"/>
+ </h:panelGroup>
+ </h:panelGrid>
+ <h:outputLabel for="text" value="Code: "/>
+ <h:inputTextarea id="text" style="width: 98%" cols="17" rows="18" value="#{code.text}"/>
+
+ <h:outputLabel for="note" value="Note: (optional) "/>
+ <h:inputTextarea style="width: 98%" cols="17" rows="4" id="note" value="#{code.note}"/>
+ <div style="width: 98%; text-align:right;">
+ <h:outputLabel for="send" value="Paste code: "/>
+ <h:commandButton action="#{paster.paste}" id="send" value=" Send "/>
+ </div>
+
+ </div>
+ </ui:define>
+
+ <ui:define name="rightmenu">
+ <ui:include src="rightMenuDefault.xhtml"/>
+ </ui:define>
+
+ </ui:composition>
+
+</html>
Added: examples/trunk/jsf/pastecode/src/main/webapp/img/small.png
===================================================================
(Binary files differ)
Property changes on: examples/trunk/jsf/pastecode/src/main/webapp/img/small.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: examples/trunk/jsf/pastecode/src/main/webapp/index.html
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/index.html (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/index.html 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,5 @@
+<html>
+<head>
+ <meta http-equiv="Refresh" content="0; URL=home.jsf">
+</head>
+</html>
\ No newline at end of file
Added: examples/trunk/jsf/pastecode/src/main/webapp/jsScripts.xhtml
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/jsScripts.xhtml (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/jsScripts.xhtml 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,41 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:mj="http://mojarra.dev.java.net/mojarra_ext"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+ <ui:composition>
+
+ <script type="text/javascript" src="syntaxhighlighter/src/shCore.js"></script>
+ <script type="text/javascript" src="syntaxhighlighter/scripts/shBrushJScript.js"></script>
+ <script type="text/javascript" src="syntaxhighlighter/scripts/shBrushJava.js"></script>
+ <script type="text/javascript" src="syntaxhighlighter/scripts/shBrushAS3.js"></script>
+ <script type="text/javascript" src="syntaxhighlighter/scripts/shBrushBash.js"></script>
+ <script type="text/javascript" src="syntaxhighlighter/scripts/shBrushCSharp.js"></script>
+ <script type="text/javascript" src="syntaxhighlighter/scripts/shBrushColdFusion.js"></script>
+ <script type="text/javascript" src="syntaxhighlighter/scripts/shBrushCss.js"></script>
+ <script type="text/javascript" src="syntaxhighlighter/scripts/shBrushCpp.js"></script>
+ <script type="text/javascript" src="syntaxhighlighter/scripts/shBrushDelphi.js"></script>
+ <script type="text/javascript" src="syntaxhighlighter/scripts/shBrushErlang.js"></script>
+ <script type="text/javascript" src="syntaxhighlighter/scripts/shBrushDiff.js"></script>
+ <script type="text/javascript" src="syntaxhighlighter/scripts/shBrushGroovy.js"></script>
+ <script type="text/javascript" src="syntaxhighlighter/scripts/shBrushJavaFX.js"></script>
+ <script type="text/javascript" src="syntaxhighlighter/scripts/shBrushPerl.js"></script>
+ <script type="text/javascript" src="syntaxhighlighter/scripts/shBrushPhp.js"></script>
+ <script type="text/javascript" src="syntaxhighlighter/scripts/shBrushPlain.js"></script>
+ <script type="text/javascript" src="syntaxhighlighter/scripts/shBrushPowerShell.js"></script>
+ <script type="text/javascript" src="syntaxhighlighter/scripts/shBrushPython.js"></script>
+ <script type="text/javascript" src="syntaxhighlighter/scripts/shBrushRuby.js"></script>
+ <script type="text/javascript" src="syntaxhighlighter/scripts/shBrushScala.js"></script>
+ <script type="text/javascript" src="syntaxhighlighter/scripts/shBrushSql.js"></script>
+ <script type="text/javascript" src="syntaxhighlighter/scripts/shBrushVB.js"></script>
+ <script type="text/javascript" src="syntaxhighlighter/scripts/shBrushXml.js"></script>
+ <script type="text/javascript" src="functions.js"/>
+ <script type="text/javascript">
+ SyntaxHighlighter.all()
+ </script>
+
+ </ui:composition>
+ b
+</html>
\ No newline at end of file
Added: examples/trunk/jsf/pastecode/src/main/webapp/pagination.xhtml
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/pagination.xhtml (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/pagination.xhtml 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,33 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+ <ui:composition>
+
+ <h:panelGroup rendered="#{history.info.pagesCount gt 1}">
+ <div id="paging" style="width:99%;text-align:center;">
+
+ <a href="history.jsf?page=#{(history.info.page-1)>=0?(history.info.page-1):0}" style="text-decoration:none;">
+ <span id="edgelink"><<</span>
+ </a>
+
+
+ <ui:repeat var="page" value="#{history.info.indexes}">
+ <a href="history.jsf?page=#{page}" style="text-decoration:none;">
+ <span id="normallink" style="width:23px;display: inline-block;}">#{(history.info.page eq page)?'(':''}#{page+1}#{(history.info.page eq page)?')':''}</span>
+ </a>
+ </ui:repeat>
+
+
+ <a href="history.jsf?page=#{(history.info.page+1)>history.info.pagesCount?history.info.pagesCount:(history.info.page+1)}" style="text-decoration:none;">
+ <span id="edgelink">>></span>
+ </a>
+
+ </div>
+ </h:panelGroup>
+
+ </ui:composition>
+
+</html>
\ No newline at end of file
Added: examples/trunk/jsf/pastecode/src/main/webapp/rightMenuDefault.xhtml
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/rightMenuDefault.xhtml (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/rightMenuDefault.xhtml 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,42 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+ <ui:composition>
+
+ <div id="rightmenuhead" style="width:230px;">
+ <strong>Last Pastes:</strong>
+ </div>
+
+ <div id="rightmenubody" style="width:230px;">
+ <h:dataTable value="#{paster.codes}" var="varcode">
+ <h:column>
+ <h:panelGroup>
+ <h:outputLabel for="user" value="User: "/>
+ <h:outputLink id="user" value="#{ varcode.id}"> <!-- display.jsf?id= -->
+ <h:outputText value="#{varcode.user}"></h:outputText>
+ </h:outputLink>
+ </h:panelGroup>
+ <br/>
+ <h:panelGroup>
+ <h:outputLabel for="datetime" value="Date: "/>
+ <h:outputText id="datetime" value="#{ varcode.datetime}">
+ <f:convertDateTime type="both" pattern="yyyy-MM-dd HH:mm:ss"/>
+ </h:outputText>
+ </h:panelGroup>
+ <br/>
+ <h:panelGroup>
+ <h:outputLabel for="language" value="Language: "/>
+ <h:outputText id="language" value="#{ varcode.language}"></h:outputText>
+ </h:panelGroup>
+ <br/>
+ <br/>
+ </h:column>
+ </h:dataTable>
+ </div>
+
+ </ui:composition>
+
+</html>
\ No newline at end of file
Added: examples/trunk/jsf/pastecode/src/main/webapp/style/style.css
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/style/style.css (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/style/style.css 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,105 @@
+body {
+ margin: 0px;
+ padding: 0px;
+ border-width: 0px;
+ background-color: #FFFFFF;
+}
+
+table {
+ border-width: 0px;
+ margin: 0px;
+ padding: 0px;
+}
+table tr td {
+ margin: 0px;
+ padding: 0px;
+}
+
+div#topseparator {
+ border-width: 0px;
+ height: 20px;
+ width: 100%;
+ background-color:#8784C6;
+}
+
+div#main {
+ width: 100%;
+}
+
+div#bottomseparator {
+ height: 20px;
+ width: 100%;
+ background-color:#8784C6;
+}
+
+div#header {
+ width:100%;
+ height:60px;
+ background-color:#8784C6;
+ background-image: url('../img/small.png');
+ background-repeat: repeat-x;
+ vertical-align: top;
+ margin: 0px;
+ padding: 0px;
+}
+
+div#footer {
+ width:100%;
+ height:50px;
+ background-color:#1E2580;
+ color: #CCDFFF;
+ vertical-align: top;
+ text-align: center;
+}
+
+div#rightmenuhead {
+ background-color:#C1C1E8;
+ border-color:#8784C6;
+ border-width:1px;
+ padding:2px;
+}
+
+div#rightmenubody {
+ padding:2px;
+}
+
+span#menuitem {
+ margin: 2px;
+ padding-left: 7px;
+ padding-right: 7px;
+ padding-top: 2px;
+ padding-bottom: 2px;
+ border: 1px solid black;
+ background-color:#E9E9F8;
+}
+
+div#code {
+ width: 99%;
+ height: 400px;
+ overflow: auto;
+ border: 1px solid #7F7F7F;
+}
+
+img#logo {
+ width: 150px;
+ height: 55px;
+ border: 1px solid black;
+}
+
+span#edgelink {
+ border-width: 0px;
+ margin:1px;
+ background-color:#8784C6;
+}
+
+span#normallink {
+ border-width: 1px;
+ margin-left:4px;
+ margin-right:4px;
+ background-color: #E9E9F8;
+}
+
+
+
+
+
Added: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/LGPLv3.txt
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/LGPLv3.txt (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/LGPLv3.txt 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
\ No newline at end of file
Added: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/clipboard.swf
===================================================================
(Binary files differ)
Property changes on: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/clipboard.swf
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushAS3.js
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushAS3.js (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushAS3.js 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,61 @@
+/**
+ * SyntaxHighlighter
+ * http://alexgorbatchev.com/
+ *
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
+ * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
+ *
+ * @version
+ * 2.1.364 (October 15 2009)
+ *
+ * @copyright
+ * Copyright (C) 2004-2009 Alex Gorbatchev.
+ *
+ * @license
+ * This file is part of SyntaxHighlighter.
+ *
+ * SyntaxHighlighter is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SyntaxHighlighter is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
+ */
+SyntaxHighlighter.brushes.AS3 = function()
+{
+ // Created by Peter Atoria @ http://iAtoria.com
+
+ var inits = 'class interface function package';
+
+ var keywords = '-Infinity ...rest Array as AS3 Boolean break case catch const continue Date decodeURI ' +
+ 'decodeURIComponent default delete do dynamic each else encodeURI encodeURIComponent escape ' +
+ 'extends false final finally flash_proxy for get if implements import in include Infinity ' +
+ 'instanceof int internal is isFinite isNaN isXMLName label namespace NaN native new null ' +
+ 'Null Number Object object_proxy override parseFloat parseInt private protected public ' +
+ 'return set static String super switch this throw true try typeof uint undefined unescape ' +
+ 'use void while with'
+ ;
+
+ this.regexList = [
+ { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments
+ { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
+ { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings
+ { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings
+ { regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers
+ { regex: new RegExp(this.getKeywords(inits), 'gm'), css: 'color3' }, // initializations
+ { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords
+ { regex: new RegExp('var', 'gm'), css: 'variable' }, // variable
+ { regex: new RegExp('trace', 'gm'), css: 'color1' } // trace
+ ];
+
+ this.forHtmlScript(SyntaxHighlighter.regexLib.scriptScriptTags);
+};
+
+SyntaxHighlighter.brushes.AS3.prototype = new SyntaxHighlighter.Highlighter();
+SyntaxHighlighter.brushes.AS3.aliases = ['actionscript3', 'as3'];
Added: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushBash.js
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushBash.js (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushBash.js 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,66 @@
+/**
+ * SyntaxHighlighter
+ * http://alexgorbatchev.com/
+ *
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
+ * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
+ *
+ * @version
+ * 2.1.364 (October 15 2009)
+ *
+ * @copyright
+ * Copyright (C) 2004-2009 Alex Gorbatchev.
+ *
+ * @license
+ * This file is part of SyntaxHighlighter.
+ *
+ * SyntaxHighlighter is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SyntaxHighlighter is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
+ */
+SyntaxHighlighter.brushes.Bash = function()
+{
+ var keywords = 'if fi then elif else for do done until while break continue case function return in eq ne gt lt ge le';
+ var commands = 'alias apropos awk basename bash bc bg builtin bzip2 cal cat cd cfdisk chgrp chmod chown chroot' +
+ 'cksum clear cmp comm command cp cron crontab csplit cut date dc dd ddrescue declare df ' +
+ 'diff diff3 dig dir dircolors dirname dirs du echo egrep eject enable env ethtool eval ' +
+ 'exec exit expand export expr false fdformat fdisk fg fgrep file find fmt fold format ' +
+ 'free fsck ftp gawk getopts grep groups gzip hash head history hostname id ifconfig ' +
+ 'import install join kill less let ln local locate logname logout look lpc lpr lprint ' +
+ 'lprintd lprintq lprm ls lsof make man mkdir mkfifo mkisofs mknod more mount mtools ' +
+ 'mv netstat nice nl nohup nslookup open op passwd paste pathchk ping popd pr printcap ' +
+ 'printenv printf ps pushd pwd quota quotacheck quotactl ram rcp read readonly renice ' +
+ 'remsync rm rmdir rsync screen scp sdiff sed select seq set sftp shift shopt shutdown ' +
+ 'sleep sort source split ssh strace su sudo sum symlink sync tail tar tee test time ' +
+ 'times touch top traceroute trap tr true tsort tty type ulimit umask umount unalias ' +
+ 'uname unexpand uniq units unset unshar useradd usermod users uuencode uudecode v vdir ' +
+ 'vi watch wc whereis which who whoami Wget xargs yes'
+ ;
+
+ this.findMatches = function(regexList, code)
+ {
+ code = code.replace(/>/g, '>').replace(/</g, '<');
+ this.code = code;
+ return SyntaxHighlighter.Highlighter.prototype.findMatches.apply(this, [regexList, code]);
+ };
+
+ this.regexList = [
+ { regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' }, // one line comments
+ { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings
+ { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings
+ { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords
+ { regex: new RegExp(this.getKeywords(commands), 'gm'), css: 'functions' } // commands
+ ];
+}
+
+SyntaxHighlighter.brushes.Bash.prototype = new SyntaxHighlighter.Highlighter();
+SyntaxHighlighter.brushes.Bash.aliases = ['bash', 'shell'];
Added: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushCSharp.js
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushCSharp.js (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushCSharp.js 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,67 @@
+/**
+ * SyntaxHighlighter
+ * http://alexgorbatchev.com/
+ *
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
+ * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
+ *
+ * @version
+ * 2.1.364 (October 15 2009)
+ *
+ * @copyright
+ * Copyright (C) 2004-2009 Alex Gorbatchev.
+ *
+ * @license
+ * This file is part of SyntaxHighlighter.
+ *
+ * SyntaxHighlighter is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SyntaxHighlighter is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
+ */
+SyntaxHighlighter.brushes.CSharp = function()
+{
+ var keywords = 'abstract as base bool break byte case catch char checked class const ' +
+ 'continue decimal default delegate do double else enum event explicit ' +
+ 'extern false finally fixed float for foreach get goto if implicit in int ' +
+ 'interface internal is lock long namespace new null object operator out ' +
+ 'override params private protected public readonly ref return sbyte sealed set ' +
+ 'short sizeof stackalloc static string struct switch this throw true try ' +
+ 'typeof uint ulong unchecked unsafe ushort using virtual void while';
+
+ function fixComments(match, regexInfo)
+ {
+ var css = (match[0].indexOf("///") == 0)
+ ? 'color1'
+ : 'comments'
+ ;
+
+ return [new SyntaxHighlighter.Match(match[0], match.index, css)];
+ }
+
+ this.regexList = [
+ { regex: SyntaxHighlighter.regexLib.singleLineCComments, func : fixComments }, // one line comments
+ { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
+ { regex: /@"(?:[^"]|"")*"/g, css: 'string' }, // @-quoted strings
+ { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings
+ { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings
+ { regex: /^\s*#.*/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion
+ { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // c# keyword
+ { regex: /\bpartial(?=\s+(?:class|interface|struct)\b)/g, css: 'keyword' }, // contextual keyword: 'partial'
+ { regex: /\byield(?=\s+(?:return|break)\b)/g, css: 'keyword' } // contextual keyword: 'yield'
+ ];
+
+ this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags);
+};
+
+SyntaxHighlighter.brushes.CSharp.prototype = new SyntaxHighlighter.Highlighter();
+SyntaxHighlighter.brushes.CSharp.aliases = ['c#', 'c-sharp', 'csharp'];
+
Added: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushColdFusion.js
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushColdFusion.js (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushColdFusion.js 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,102 @@
+/**
+ * SyntaxHighlighter
+ * http://alexgorbatchev.com/
+ *
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
+ * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
+ *
+ * @version
+ * 2.1.364 (October 15 2009)
+ *
+ * @copyright
+ * Copyright (C) 2004-2009 Alex Gorbatchev.
+ *
+ * @license
+ * This file is part of SyntaxHighlighter.
+ *
+ * SyntaxHighlighter is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SyntaxHighlighter is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
+ */
+SyntaxHighlighter.brushes.ColdFusion = function()
+{
+ // Contributed by Jen
+ // http://www.jensbits.com/2009/05/14/coldfusion-brush-for-syntaxhighlighter...
+
+ var funcs = 'Abs ACos AddSOAPRequestHeader AddSOAPResponseHeader AjaxLink AjaxOnLoad ArrayAppend ArrayAvg ArrayClear ArrayDeleteAt ' +
+ 'ArrayInsertAt ArrayIsDefined ArrayIsEmpty ArrayLen ArrayMax ArrayMin ArraySet ArraySort ArraySum ArraySwap ArrayToList ' +
+ 'Asc ASin Atn BinaryDecode BinaryEncode BitAnd BitMaskClear BitMaskRead BitMaskSet BitNot BitOr BitSHLN BitSHRN BitXor ' +
+ 'Ceiling CharsetDecode CharsetEncode Chr CJustify Compare CompareNoCase Cos CreateDate CreateDateTime CreateObject ' +
+ 'CreateODBCDate CreateODBCDateTime CreateODBCTime CreateTime CreateTimeSpan CreateUUID DateAdd DateCompare DateConvert ' +
+ 'DateDiff DateFormat DatePart Day DayOfWeek DayOfWeekAsString DayOfYear DaysInMonth DaysInYear DE DecimalFormat DecrementValue ' +
+ 'Decrypt DecryptBinary DeleteClientVariable DeserializeJSON DirectoryExists DollarFormat DotNetToCFType Duplicate Encrypt ' +
+ 'EncryptBinary Evaluate Exp ExpandPath FileClose FileCopy FileDelete FileExists FileIsEOF FileMove FileOpen FileRead ' +
+ 'FileReadBinary FileReadLine FileSetAccessMode FileSetAttribute FileSetLastModified FileWrite Find FindNoCase FindOneOf ' +
+ 'FirstDayOfMonth Fix FormatBaseN GenerateSecretKey GetAuthUser GetBaseTagData GetBaseTagList GetBaseTemplatePath ' +
+ 'GetClientVariablesList GetComponentMetaData GetContextRoot GetCurrentTemplatePath GetDirectoryFromPath GetEncoding ' +
+ 'GetException GetFileFromPath GetFileInfo GetFunctionList GetGatewayHelper GetHttpRequestData GetHttpTimeString ' +
+ 'GetK2ServerDocCount GetK2ServerDocCountLimit GetLocale GetLocaleDisplayName GetLocalHostIP GetMetaData GetMetricData ' +
+ 'GetPageContext GetPrinterInfo GetProfileSections GetProfileString GetReadableImageFormats GetSOAPRequest GetSOAPRequestHeader ' +
+ 'GetSOAPResponse GetSOAPResponseHeader GetTempDirectory GetTempFile GetTemplatePath GetTickCount GetTimeZoneInfo GetToken ' +
+ 'GetUserRoles GetWriteableImageFormats Hash Hour HTMLCodeFormat HTMLEditFormat IIf ImageAddBorder ImageBlur ImageClearRect ' +
+ 'ImageCopy ImageCrop ImageDrawArc ImageDrawBeveledRect ImageDrawCubicCurve ImageDrawLine ImageDrawLines ImageDrawOval ' +
+ 'ImageDrawPoint ImageDrawQuadraticCurve ImageDrawRect ImageDrawRoundRect ImageDrawText ImageFlip ImageGetBlob ImageGetBufferedImage ' +
+ 'ImageGetEXIFTag ImageGetHeight ImageGetIPTCTag ImageGetWidth ImageGrayscale ImageInfo ImageNegative ImageNew ImageOverlay ImagePaste ' +
+ 'ImageRead ImageReadBase64 ImageResize ImageRotate ImageRotateDrawingAxis ImageScaleToFit ImageSetAntialiasing ImageSetBackgroundColor ' +
+ 'ImageSetDrawingColor ImageSetDrawingStroke ImageSetDrawingTransparency ImageSharpen ImageShear ImageShearDrawingAxis ImageTranslate ' +
+ 'ImageTranslateDrawingAxis ImageWrite ImageWriteBase64 ImageXORDrawingMode IncrementValue InputBaseN Insert Int IsArray IsBinary ' +
+ 'IsBoolean IsCustomFunction IsDate IsDDX IsDebugMode IsDefined IsImage IsImageFile IsInstanceOf IsJSON IsLeapYear IsLocalHost ' +
+ 'IsNumeric IsNumericDate IsObject IsPDFFile IsPDFObject IsQuery IsSimpleValue IsSOAPRequest IsStruct IsUserInAnyRole IsUserInRole ' +
+ 'IsUserLoggedIn IsValid IsWDDX IsXML IsXmlAttribute IsXmlDoc IsXmlElem IsXmlNode IsXmlRoot JavaCast JSStringFormat LCase Left Len ' +
+ 'ListAppend ListChangeDelims ListContains ListContainsNoCase ListDeleteAt ListFind ListFindNoCase ListFirst ListGetAt ListInsertAt ' +
+ 'ListLast ListLen ListPrepend ListQualify ListRest ListSetAt ListSort ListToArray ListValueCount ListValueCountNoCase LJustify Log ' +
+ 'Log10 LSCurrencyFormat LSDateFormat LSEuroCurrencyFormat LSIsCurrency LSIsDate LSIsNumeric LSNumberFormat LSParseCurrency LSParseDateTime ' +
+ 'LSParseEuroCurrency LSParseNumber LSTimeFormat LTrim Max Mid Min Minute Month MonthAsString Now NumberFormat ParagraphFormat ParseDateTime ' +
+ 'Pi PrecisionEvaluate PreserveSingleQuotes Quarter QueryAddColumn QueryAddRow QueryConvertForGrid QueryNew QuerySetCell QuotedValueList Rand ' +
+ 'Randomize RandRange REFind REFindNoCase ReleaseComObject REMatch REMatchNoCase RemoveChars RepeatString Replace ReplaceList ReplaceNoCase ' +
+ 'REReplace REReplaceNoCase Reverse Right RJustify Round RTrim Second SendGatewayMessage SerializeJSON SetEncoding SetLocale SetProfileString ' +
+ 'SetVariable Sgn Sin Sleep SpanExcluding SpanIncluding Sqr StripCR StructAppend StructClear StructCopy StructCount StructDelete StructFind ' +
+ 'StructFindKey StructFindValue StructGet StructInsert StructIsEmpty StructKeyArray StructKeyExists StructKeyList StructKeyList StructNew ' +
+ 'StructSort StructUpdate Tan TimeFormat ToBase64 ToBinary ToScript ToString Trim UCase URLDecode URLEncodedFormat URLSessionFormat Val ' +
+ 'ValueList VerifyClient Week Wrap Wrap WriteOutput XmlChildPos XmlElemNew XmlFormat XmlGetNodeType XmlNew XmlParse XmlSearch XmlTransform ' +
+ 'XmlValidate Year YesNoFormat';
+
+ var keywords = 'cfabort cfajaximport cfajaxproxy cfapplet cfapplication cfargument cfassociate cfbreak cfcache cfcalendar ' +
+ 'cfcase cfcatch cfchart cfchartdata cfchartseries cfcol cfcollection cfcomponent cfcontent cfcookie cfdbinfo ' +
+ 'cfdefaultcase cfdirectory cfdiv cfdocument cfdocumentitem cfdocumentsection cfdump cfelse cfelseif cferror ' +
+ 'cfexchangecalendar cfexchangeconnection cfexchangecontact cfexchangefilter cfexchangemail cfexchangetask ' +
+ 'cfexecute cfexit cffeed cffile cfflush cfform cfformgroup cfformitem cfftp cffunction cfgrid cfgridcolumn ' +
+ 'cfgridrow cfgridupdate cfheader cfhtmlhead cfhttp cfhttpparam cfif cfimage cfimport cfinclude cfindex ' +
+ 'cfinput cfinsert cfinterface cfinvoke cfinvokeargument cflayout cflayoutarea cfldap cflocation cflock cflog ' +
+ 'cflogin cfloginuser cflogout cfloop cfmail cfmailparam cfmailpart cfmenu cfmenuitem cfmodule cfNTauthenticate ' +
+ 'cfobject cfobjectcache cfoutput cfparam cfpdf cfpdfform cfpdfformparam cfpdfparam cfpdfsubform cfpod cfpop ' +
+ 'cfpresentation cfpresentationslide cfpresenter cfprint cfprocessingdirective cfprocparam cfprocresult ' +
+ 'cfproperty cfquery cfqueryparam cfregistry cfreport cfreportparam cfrethrow cfreturn cfsavecontent cfschedule ' +
+ 'cfscript cfsearch cfselect cfset cfsetting cfsilent cfslider cfsprydataset cfstoredproc cfswitch cftable ' +
+ 'cftextarea cfthread cfthrow cftimer cftooltip cftrace cftransaction cftree cftreeitem cftry cfupdate cfwddx ' +
+ 'cfwindow cfxml cfzip cfzipparam';
+
+ var operators = 'all and any between cross in join like not null or outer some';
+
+ this.regexList = [
+ { regex: new RegExp('--(.*)$', 'gm'), css: 'comments' }, // one line and multiline comments
+ { regex: SyntaxHighlighter.regexLib.xmlComments, css: 'comments' }, // single quoted strings
+ { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings
+ { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings
+ { regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' }, // functions
+ { regex: new RegExp(this.getKeywords(operators), 'gmi'), css: 'color1' }, // operators and such
+ { regex: new RegExp(this.getKeywords(keywords), 'gmi'), css: 'keyword' } // keyword
+ ];
+}
+
+SyntaxHighlighter.brushes.ColdFusion.prototype = new SyntaxHighlighter.Highlighter();
+SyntaxHighlighter.brushes.ColdFusion.aliases = ['coldfusion','cf'];
\ No newline at end of file
Added: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushCpp.js
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushCpp.js (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushCpp.js 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,99 @@
+/**
+ * SyntaxHighlighter
+ * http://alexgorbatchev.com/
+ *
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
+ * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
+ *
+ * @version
+ * 2.1.364 (October 15 2009)
+ *
+ * @copyright
+ * Copyright (C) 2004-2009 Alex Gorbatchev.
+ *
+ * @license
+ * This file is part of SyntaxHighlighter.
+ *
+ * SyntaxHighlighter is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SyntaxHighlighter is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
+ */
+SyntaxHighlighter.brushes.Cpp = function()
+{
+ // Copyright 2006 Shin, YoungJin
+
+ var datatypes = 'ATOM BOOL BOOLEAN BYTE CHAR COLORREF DWORD DWORDLONG DWORD_PTR ' +
+ 'DWORD32 DWORD64 FLOAT HACCEL HALF_PTR HANDLE HBITMAP HBRUSH ' +
+ 'HCOLORSPACE HCONV HCONVLIST HCURSOR HDC HDDEDATA HDESK HDROP HDWP ' +
+ 'HENHMETAFILE HFILE HFONT HGDIOBJ HGLOBAL HHOOK HICON HINSTANCE HKEY ' +
+ 'HKL HLOCAL HMENU HMETAFILE HMODULE HMONITOR HPALETTE HPEN HRESULT ' +
+ 'HRGN HRSRC HSZ HWINSTA HWND INT INT_PTR INT32 INT64 LANGID LCID LCTYPE ' +
+ 'LGRPID LONG LONGLONG LONG_PTR LONG32 LONG64 LPARAM LPBOOL LPBYTE LPCOLORREF ' +
+ 'LPCSTR LPCTSTR LPCVOID LPCWSTR LPDWORD LPHANDLE LPINT LPLONG LPSTR LPTSTR ' +
+ 'LPVOID LPWORD LPWSTR LRESULT PBOOL PBOOLEAN PBYTE PCHAR PCSTR PCTSTR PCWSTR ' +
+ 'PDWORDLONG PDWORD_PTR PDWORD32 PDWORD64 PFLOAT PHALF_PTR PHANDLE PHKEY PINT ' +
+ 'PINT_PTR PINT32 PINT64 PLCID PLONG PLONGLONG PLONG_PTR PLONG32 PLONG64 POINTER_32 ' +
+ 'POINTER_64 PSHORT PSIZE_T PSSIZE_T PSTR PTBYTE PTCHAR PTSTR PUCHAR PUHALF_PTR ' +
+ 'PUINT PUINT_PTR PUINT32 PUINT64 PULONG PULONGLONG PULONG_PTR PULONG32 PULONG64 ' +
+ 'PUSHORT PVOID PWCHAR PWORD PWSTR SC_HANDLE SC_LOCK SERVICE_STATUS_HANDLE SHORT ' +
+ 'SIZE_T SSIZE_T TBYTE TCHAR UCHAR UHALF_PTR UINT UINT_PTR UINT32 UINT64 ULONG ' +
+ 'ULONGLONG ULONG_PTR ULONG32 ULONG64 USHORT USN VOID WCHAR WORD WPARAM WPARAM WPARAM ' +
+ 'char bool short int __int32 __int64 __int8 __int16 long float double __wchar_t ' +
+ 'clock_t _complex _dev_t _diskfree_t div_t ldiv_t _exception _EXCEPTION_POINTERS ' +
+ 'FILE _finddata_t _finddatai64_t _wfinddata_t _wfinddatai64_t __finddata64_t ' +
+ '__wfinddata64_t _FPIEEE_RECORD fpos_t _HEAPINFO _HFILE lconv intptr_t ' +
+ 'jmp_buf mbstate_t _off_t _onexit_t _PNH ptrdiff_t _purecall_handler ' +
+ 'sig_atomic_t size_t _stat __stat64 _stati64 terminate_function ' +
+ 'time_t __time64_t _timeb __timeb64 tm uintptr_t _utimbuf ' +
+ 'va_list wchar_t wctrans_t wctype_t wint_t signed';
+
+ var keywords = 'break case catch class const __finally __exception __try ' +
+ 'const_cast continue private public protected __declspec ' +
+ 'default delete deprecated dllexport dllimport do dynamic_cast ' +
+ 'else enum explicit extern if for friend goto inline ' +
+ 'mutable naked namespace new noinline noreturn nothrow ' +
+ 'register reinterpret_cast return selectany ' +
+ 'sizeof static static_cast struct switch template this ' +
+ 'thread throw true false try typedef typeid typename union ' +
+ 'using uuid virtual void volatile whcar_t while';
+
+ var functions = 'assert isalnum isalpha iscntrl isdigit isgraph islower isprint' +
+ 'ispunct isspace isupper isxdigit tolower toupper errno localeconv ' +
+ 'setlocale acos asin atan atan2 ceil cos cosh exp fabs floor fmod ' +
+ 'frexp ldexp log log10 modf pow sin sinh sqrt tan tanh jmp_buf ' +
+ 'longjmp setjmp raise signal sig_atomic_t va_arg va_end va_start ' +
+ 'clearerr fclose feof ferror fflush fgetc fgetpos fgets fopen ' +
+ 'fprintf fputc fputs fread freopen fscanf fseek fsetpos ftell ' +
+ 'fwrite getc getchar gets perror printf putc putchar puts remove ' +
+ 'rename rewind scanf setbuf setvbuf sprintf sscanf tmpfile tmpnam ' +
+ 'ungetc vfprintf vprintf vsprintf abort abs atexit atof atoi atol ' +
+ 'bsearch calloc div exit free getenv labs ldiv malloc mblen mbstowcs ' +
+ 'mbtowc qsort rand realloc srand strtod strtol strtoul system ' +
+ 'wcstombs wctomb memchr memcmp memcpy memmove memset strcat strchr ' +
+ 'strcmp strcoll strcpy strcspn strerror strlen strncat strncmp ' +
+ 'strncpy strpbrk strrchr strspn strstr strtok strxfrm asctime ' +
+ 'clock ctime difftime gmtime localtime mktime strftime time';
+
+ this.regexList = [
+ { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments
+ { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
+ { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings
+ { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings
+ { regex: /^ *#.*/gm, css: 'preprocessor' },
+ { regex: new RegExp(this.getKeywords(datatypes), 'gm'), css: 'color1 bold' },
+ { regex: new RegExp(this.getKeywords(functions), 'gm'), css: 'functions bold' },
+ { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword bold' }
+ ];
+};
+
+SyntaxHighlighter.brushes.Cpp.prototype = new SyntaxHighlighter.Highlighter();
+SyntaxHighlighter.brushes.Cpp.aliases = ['cpp', 'c'];
Added: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushCss.js
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushCss.js (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushCss.js 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,93 @@
+/**
+ * SyntaxHighlighter
+ * http://alexgorbatchev.com/
+ *
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
+ * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
+ *
+ * @version
+ * 2.1.364 (October 15 2009)
+ *
+ * @copyright
+ * Copyright (C) 2004-2009 Alex Gorbatchev.
+ *
+ * @license
+ * This file is part of SyntaxHighlighter.
+ *
+ * SyntaxHighlighter is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SyntaxHighlighter is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
+ */
+SyntaxHighlighter.brushes.CSS = function()
+{
+ function getKeywordsCSS(str)
+ {
+ return '\\b([a-z_]|)' + str.replace(/ /g, '(?=:)\\b|\\b([a-z_\\*]|\\*|)') + '(?=:)\\b';
+ };
+
+ function getValuesCSS(str)
+ {
+ return '\\b' + str.replace(/ /g, '(?!-)(?!:)\\b|\\b()') + '\:\\b';
+ };
+
+ var keywords = 'ascent azimuth background-attachment background-color background-image background-position ' +
+ 'background-repeat background baseline bbox border-collapse border-color border-spacing border-style border-top ' +
+ 'border-right border-bottom border-left border-top-color border-right-color border-bottom-color border-left-color ' +
+ 'border-top-style border-right-style border-bottom-style border-left-style border-top-width border-right-width ' +
+ 'border-bottom-width border-left-width border-width border bottom cap-height caption-side centerline clear clip color ' +
+ 'content counter-increment counter-reset cue-after cue-before cue cursor definition-src descent direction display ' +
+ 'elevation empty-cells float font-size-adjust font-family font-size font-stretch font-style font-variant font-weight font ' +
+ 'height left letter-spacing line-height list-style-image list-style-position list-style-type list-style margin-top ' +
+ 'margin-right margin-bottom margin-left margin marker-offset marks mathline max-height max-width min-height min-width orphans ' +
+ 'outline-color outline-style outline-width outline overflow padding-top padding-right padding-bottom padding-left padding page ' +
+ 'page-break-after page-break-before page-break-inside pause pause-after pause-before pitch pitch-range play-during position ' +
+ 'quotes right richness size slope src speak-header speak-numeral speak-punctuation speak speech-rate stemh stemv stress ' +
+ 'table-layout text-align top text-decoration text-indent text-shadow text-transform unicode-bidi unicode-range units-per-em ' +
+ 'vertical-align visibility voice-family volume white-space widows width widths word-spacing x-height z-index';
+
+ var values = 'above absolute all always aqua armenian attr aural auto avoid baseline behind below bidi-override black blink block blue bold bolder '+
+ 'both bottom braille capitalize caption center center-left center-right circle close-quote code collapse compact condensed '+
+ 'continuous counter counters crop cross crosshair cursive dashed decimal decimal-leading-zero default digits disc dotted double '+
+ 'embed embossed e-resize expanded extra-condensed extra-expanded fantasy far-left far-right fast faster fixed format fuchsia '+
+ 'gray green groove handheld hebrew help hidden hide high higher icon inline-table inline inset inside invert italic '+
+ 'justify landscape large larger left-side left leftwards level lighter lime line-through list-item local loud lower-alpha '+
+ 'lowercase lower-greek lower-latin lower-roman lower low ltr marker maroon medium message-box middle mix move narrower '+
+ 'navy ne-resize no-close-quote none no-open-quote no-repeat normal nowrap n-resize nw-resize oblique olive once open-quote outset '+
+ 'outside overline pointer portrait pre print projection purple red relative repeat repeat-x repeat-y rgb ridge right right-side '+
+ 'rightwards rtl run-in screen scroll semi-condensed semi-expanded separate se-resize show silent silver slower slow '+
+ 'small small-caps small-caption smaller soft solid speech spell-out square s-resize static status-bar sub super sw-resize '+
+ 'table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group teal '+
+ 'text-bottom text-top thick thin top transparent tty tv ultra-condensed ultra-expanded underline upper-alpha uppercase upper-latin '+
+ 'upper-roman url visible wait white wider w-resize x-fast x-high x-large x-loud x-low x-slow x-small x-soft xx-large xx-small yellow';
+
+ var fonts = '[mM]onospace [tT]ahoma [vV]erdana [aA]rial [hH]elvetica [sS]ans-serif [sS]erif [cC]ourier mono sans serif';
+
+ this.regexList = [
+ { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
+ { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings
+ { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings
+ { regex: /\#[a-fA-F0-9]{3,6}/g, css: 'value' }, // html colors
+ { regex: /(-?\d+)(\.\d+)?(px|em|pt|\:|\%|)/g, css: 'value' }, // sizes
+ { regex: /!important/g, css: 'color3' }, // !important
+ { regex: new RegExp(getKeywordsCSS(keywords), 'gm'), css: 'keyword' }, // keywords
+ { regex: new RegExp(getValuesCSS(values), 'g'), css: 'value' }, // values
+ { regex: new RegExp(this.getKeywords(fonts), 'g'), css: 'color1' } // fonts
+ ];
+
+ this.forHtmlScript({
+ left: /(<|<)\s*style.*?(>|>)/gi,
+ right: /(<|<)\/\s*style\s*(>|>)/gi
+ });
+};
+
+SyntaxHighlighter.brushes.CSS.prototype = new SyntaxHighlighter.Highlighter();
+SyntaxHighlighter.brushes.CSS.aliases = ['css'];
Added: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushDelphi.js
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushDelphi.js (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushDelphi.js 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,57 @@
+/**
+ * SyntaxHighlighter
+ * http://alexgorbatchev.com/
+ *
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
+ * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
+ *
+ * @version
+ * 2.1.364 (October 15 2009)
+ *
+ * @copyright
+ * Copyright (C) 2004-2009 Alex Gorbatchev.
+ *
+ * @license
+ * This file is part of SyntaxHighlighter.
+ *
+ * SyntaxHighlighter is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SyntaxHighlighter is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
+ */
+SyntaxHighlighter.brushes.Delphi = function()
+{
+ var keywords = 'abs addr and ansichar ansistring array as asm begin boolean byte cardinal ' +
+ 'case char class comp const constructor currency destructor div do double ' +
+ 'downto else end except exports extended false file finalization finally ' +
+ 'for function goto if implementation in inherited int64 initialization ' +
+ 'integer interface is label library longint longword mod nil not object ' +
+ 'of on or packed pansichar pansistring pchar pcurrency pdatetime pextended ' +
+ 'pint64 pointer private procedure program property pshortstring pstring ' +
+ 'pvariant pwidechar pwidestring protected public published raise real real48 ' +
+ 'record repeat set shl shortint shortstring shr single smallint string then ' +
+ 'threadvar to true try type unit until uses val var varirnt while widechar ' +
+ 'widestring with word write writeln xor';
+
+ this.regexList = [
+ { regex: /\(\*[\s\S]*?\*\)/gm, css: 'comments' }, // multiline comments (* *)
+ { regex: /{(?!\$)[\s\S]*?}/gm, css: 'comments' }, // multiline comments { }
+ { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line
+ { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings
+ { regex: /\{\$[a-zA-Z]+ .+\}/g, css: 'color1' }, // compiler Directives and Region tags
+ { regex: /\b[\d\.]+\b/g, css: 'value' }, // numbers 12345
+ { regex: /\$[a-zA-Z0-9]+\b/g, css: 'value' }, // numbers $F5D3
+ { regex: new RegExp(this.getKeywords(keywords), 'gmi'), css: 'keyword' } // keyword
+ ];
+};
+
+SyntaxHighlighter.brushes.Delphi.prototype = new SyntaxHighlighter.Highlighter();
+SyntaxHighlighter.brushes.Delphi.aliases = ['delphi', 'pascal', 'pas'];
Added: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushDiff.js
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushDiff.js (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushDiff.js 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,43 @@
+/**
+ * SyntaxHighlighter
+ * http://alexgorbatchev.com/
+ *
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
+ * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
+ *
+ * @version
+ * 2.1.364 (October 15 2009)
+ *
+ * @copyright
+ * Copyright (C) 2004-2009 Alex Gorbatchev.
+ *
+ * @license
+ * This file is part of SyntaxHighlighter.
+ *
+ * SyntaxHighlighter is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SyntaxHighlighter is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
+ */
+SyntaxHighlighter.brushes.Diff = function()
+{
+ this.regexList = [
+ { regex: /^\+\+\+.*$/gm, css: 'color2' },
+ { regex: /^\-\-\-.*$/gm, css: 'color2' },
+ { regex: /^\s.*$/gm, css: 'color1' },
+ { regex: /^@@.*@(a)$/gm, css: 'variable' },
+ { regex: /^\+[^\+]{1}.*$/gm, css: 'string' },
+ { regex: /^\-[^\-]{1}.*$/gm, css: 'comments' }
+ ];
+};
+
+SyntaxHighlighter.brushes.Diff.prototype = new SyntaxHighlighter.Highlighter();
+SyntaxHighlighter.brushes.Diff.aliases = ['diff', 'patch'];
Added: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushErlang.js
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushErlang.js (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushErlang.js 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,54 @@
+/**
+ * SyntaxHighlighter
+ * http://alexgorbatchev.com/
+ *
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
+ * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
+ *
+ * @version
+ * 2.1.364 (October 15 2009)
+ *
+ * @copyright
+ * Copyright (C) 2004-2009 Alex Gorbatchev.
+ *
+ * @license
+ * This file is part of SyntaxHighlighter.
+ *
+ * SyntaxHighlighter is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SyntaxHighlighter is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
+ */
+SyntaxHighlighter.brushes.Erlang = function()
+{
+ // Contributed by Jean-Lou Dupont
+ // http://jldupont.blogspot.com/2009/06/erlang-syntax-highlighter.html
+
+ // According to: http://erlang.org/doc/reference_manual/introduction.html#1.5
+ var keywords = 'after and andalso band begin bnot bor bsl bsr bxor '+
+ 'case catch cond div end fun if let not of or orelse '+
+ 'query receive rem try when xor'+
+ // additional
+ ' module export import define';
+
+ this.regexList = [
+ { regex: new RegExp("[A-Z][A-Za-z0-9_]+", 'g'), css: 'constants' },
+ { regex: new RegExp("\\%.+", 'gm'), css: 'comments' },
+ { regex: new RegExp("\\?[A-Za-z0-9_]+", 'g'), css: 'preprocessor' },
+ { regex: new RegExp("[a-z0-9_]+:[a-z0-9_]+", 'g'), css: 'functions' },
+ { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' },
+ { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' },
+ { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }
+ ];
+};
+
+SyntaxHighlighter.brushes.Erlang.prototype = new SyntaxHighlighter.Highlighter();
+SyntaxHighlighter.brushes.Erlang.aliases = ['erl', 'erlang'];
Added: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushGroovy.js
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushGroovy.js (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushGroovy.js 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,69 @@
+/**
+ * SyntaxHighlighter
+ * http://alexgorbatchev.com/
+ *
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
+ * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
+ *
+ * @version
+ * 2.1.364 (October 15 2009)
+ *
+ * @copyright
+ * Copyright (C) 2004-2009 Alex Gorbatchev.
+ *
+ * @license
+ * This file is part of SyntaxHighlighter.
+ *
+ * SyntaxHighlighter is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SyntaxHighlighter is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
+ */
+SyntaxHighlighter.brushes.Groovy = function()
+{
+ // Contributed by Andres Almiray
+ // http://jroller.com/aalmiray/entry/nice_source_code_syntax_highlighter
+
+ var keywords = 'as assert break case catch class continue def default do else extends finally ' +
+ 'if in implements import instanceof interface new package property return switch ' +
+ 'throw throws try while public protected private static';
+ var types = 'void boolean byte char short int long float double';
+ var constants = 'null';
+ var methods = 'allProperties count get size '+
+ 'collect each eachProperty eachPropertyName eachWithIndex find findAll ' +
+ 'findIndexOf grep inject max min reverseEach sort ' +
+ 'asImmutable asSynchronized flatten intersect join pop reverse subMap toList ' +
+ 'padRight padLeft contains eachMatch toCharacter toLong toUrl tokenize ' +
+ 'eachFile eachFileRecurse eachB yte eachLine readBytes readLine getText ' +
+ 'splitEachLine withReader append encodeBase64 decodeBase64 filterLine ' +
+ 'transformChar transformLine withOutputStream withPrintWriter withStream ' +
+ 'withStreams withWriter withWriterAppend write writeLine '+
+ 'dump inspect invokeMethod print println step times upto use waitForOrKill '+
+ 'getText';
+
+ this.regexList = [
+ { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments
+ { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
+ { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings
+ { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings
+ { regex: /""".*"""/g, css: 'string' }, // GStrings
+ { regex: new RegExp('\\b([\\d]+(\\.[\\d]+)?|0x[a-f0-9]+)\\b', 'gi'), css: 'value' }, // numbers
+ { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // goovy keyword
+ { regex: new RegExp(this.getKeywords(types), 'gm'), css: 'color1' }, // goovy/java type
+ { regex: new RegExp(this.getKeywords(constants), 'gm'), css: 'constants' }, // constants
+ { regex: new RegExp(this.getKeywords(methods), 'gm'), css: 'functions' } // methods
+ ];
+
+ this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags);
+}
+
+SyntaxHighlighter.brushes.Groovy.prototype = new SyntaxHighlighter.Highlighter();
+SyntaxHighlighter.brushes.Groovy.aliases = ['groovy'];
Added: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushJScript.js
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushJScript.js (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushJScript.js 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,52 @@
+/**
+ * SyntaxHighlighter
+ * http://alexgorbatchev.com/
+ *
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
+ * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
+ *
+ * @version
+ * 2.1.364 (October 15 2009)
+ *
+ * @copyright
+ * Copyright (C) 2004-2009 Alex Gorbatchev.
+ *
+ * @license
+ * This file is part of SyntaxHighlighter.
+ *
+ * SyntaxHighlighter is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SyntaxHighlighter is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
+ */
+SyntaxHighlighter.brushes.JScript = function()
+{
+ var keywords = 'break case catch continue ' +
+ 'default delete do else false ' +
+ 'for function if in instanceof ' +
+ 'new null return super switch ' +
+ 'this throw true try typeof var while with'
+ ;
+
+ this.regexList = [
+ { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments
+ { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
+ { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings
+ { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings
+ { regex: /\s*#.*/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion
+ { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // keywords
+ ];
+
+ this.forHtmlScript(SyntaxHighlighter.regexLib.scriptScriptTags);
+};
+
+SyntaxHighlighter.brushes.JScript.prototype = new SyntaxHighlighter.Highlighter();
+SyntaxHighlighter.brushes.JScript.aliases = ['js', 'jscript', 'javascript'];
Added: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushJava.js
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushJava.js (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushJava.js 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,59 @@
+/**
+ * SyntaxHighlighter
+ * http://alexgorbatchev.com/
+ *
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
+ * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
+ *
+ * @version
+ * 2.1.364 (October 15 2009)
+ *
+ * @copyright
+ * Copyright (C) 2004-2009 Alex Gorbatchev.
+ *
+ * @license
+ * This file is part of SyntaxHighlighter.
+ *
+ * SyntaxHighlighter is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SyntaxHighlighter is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
+ */
+SyntaxHighlighter.brushes.Java = function()
+{
+ var keywords = 'abstract assert boolean break byte case catch char class const ' +
+ 'continue default do double else enum extends ' +
+ 'false final finally float for goto if implements import ' +
+ 'instanceof int interface long native new null ' +
+ 'package private protected public return ' +
+ 'short static strictfp super switch synchronized this throw throws true ' +
+ 'transient try void volatile while';
+
+ this.regexList = [
+ { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments
+ { regex: /\/\*([^\*][\s\S]*)?\*\//gm, css: 'comments' }, // multiline comments
+ { regex: /\/\*(?!\*\/)\*[\s\S]*?\*\//gm, css: 'preprocessor' }, // documentation comments
+ { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings
+ { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings
+ { regex: /\b([\d]+(\.[\d]+)?|0x[a-f0-9]+)\b/gi, css: 'value' }, // numbers
+ { regex: /(?!\@interface\b)\@[\$\w]+\b/g, css: 'color1' }, // annotation @anno
+ { regex: /\@interface\b/g, css: 'color2' }, // @interface keyword
+ { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // java keyword
+ ];
+
+ this.forHtmlScript({
+ left : /(<|<)%[@!=]?/g,
+ right : /%(>|>)/g
+ });
+};
+
+SyntaxHighlighter.brushes.Java.prototype = new SyntaxHighlighter.Highlighter();
+SyntaxHighlighter.brushes.Java.aliases = ['java'];
Added: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushJavaFX.js
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushJavaFX.js (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushJavaFX.js 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,60 @@
+/**
+ * SyntaxHighlighter
+ * http://alexgorbatchev.com/
+ *
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
+ * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
+ *
+ * @version
+ * 2.1.364 (October 15 2009)
+ *
+ * @copyright
+ * Copyright (C) 2004-2009 Alex Gorbatchev.
+ *
+ * @license
+ * This file is part of SyntaxHighlighter.
+ *
+ * SyntaxHighlighter is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SyntaxHighlighter is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
+ */
+SyntaxHighlighter.brushes.JavaFX = function()
+{
+ // Contributed by Patrick Webster
+ // http://patrickwebster.blogspot.com/2009/04/javafx-brush-for-syntaxhighlig...
+ var datatypes = 'Boolean Byte Character Double Duration '
+ + 'Float Integer Long Number Short String Void'
+ ;
+
+ var keywords = 'abstract after and as assert at before bind bound break catch class '
+ + 'continue def delete else exclusive extends false finally first for from '
+ + 'function if import in indexof init insert instanceof into inverse last '
+ + 'lazy mixin mod nativearray new not null on or override package postinit '
+ + 'protected public public-init public-read replace return reverse sizeof '
+ + 'step super then this throw true try tween typeof var where while with '
+ + 'attribute let private readonly static trigger'
+ ;
+
+ this.regexList = [
+ { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' },
+ { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' },
+ { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' },
+ { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' },
+ { regex: /(-?\.?)(\b(\d*\.?\d+|\d+\.?\d*)(e[+-]?\d+)?|0x[a-f\d]+)\b\.?/gi, css: 'color2' }, // numbers
+ { regex: new RegExp(this.getKeywords(datatypes), 'gm'), css: 'variable' }, // datatypes
+ { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }
+ ];
+ this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags);
+};
+
+SyntaxHighlighter.brushes.JavaFX.prototype = new SyntaxHighlighter.Highlighter();
+SyntaxHighlighter.brushes.JavaFX.aliases = ['jfx', 'javafx'];
Added: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushPerl.js
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushPerl.js (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushPerl.js 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,74 @@
+/**
+ * SyntaxHighlighter
+ * http://alexgorbatchev.com/
+ *
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
+ * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
+ *
+ * @version
+ * 2.1.364 (October 15 2009)
+ *
+ * @copyright
+ * Copyright (C) 2004-2009 Alex Gorbatchev.
+ *
+ * @license
+ * This file is part of SyntaxHighlighter.
+ *
+ * SyntaxHighlighter is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SyntaxHighlighter is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
+ */
+SyntaxHighlighter.brushes.Perl = function()
+{
+ // Contributed by David Simmons-Duffin and Marty Kube
+
+ var funcs =
+ 'abs accept alarm atan2 bind binmode chdir chmod chomp chop chown chr ' +
+ 'chroot close closedir connect cos crypt defined delete each endgrent ' +
+ 'endhostent endnetent endprotoent endpwent endservent eof exec exists ' +
+ 'exp fcntl fileno flock fork format formline getc getgrent getgrgid ' +
+ 'getgrnam gethostbyaddr gethostbyname gethostent getlogin getnetbyaddr ' +
+ 'getnetbyname getnetent getpeername getpgrp getppid getpriority ' +
+ 'getprotobyname getprotobynumber getprotoent getpwent getpwnam getpwuid ' +
+ 'getservbyname getservbyport getservent getsockname getsockopt glob ' +
+ 'gmtime grep hex index int ioctl join keys kill lc lcfirst length link ' +
+ 'listen localtime lock log lstat map mkdir msgctl msgget msgrcv msgsnd ' +
+ 'oct open opendir ord pack pipe pop pos print printf prototype push ' +
+ 'quotemeta rand read readdir readline readlink readpipe recv rename ' +
+ 'reset reverse rewinddir rindex rmdir scalar seek seekdir select semctl ' +
+ 'semget semop send setgrent sethostent setnetent setpgrp setpriority ' +
+ 'setprotoent setpwent setservent setsockopt shift shmctl shmget shmread ' +
+ 'shmwrite shutdown sin sleep socket socketpair sort splice split sprintf ' +
+ 'sqrt srand stat study substr symlink syscall sysopen sysread sysseek ' +
+ 'system syswrite tell telldir time times tr truncate uc ucfirst umask ' +
+ 'undef unlink unpack unshift utime values vec wait waitpid warn write';
+
+ var keywords =
+ 'bless caller continue dbmclose dbmopen die do dump else elsif eval exit ' +
+ 'for foreach goto if import last local my next no our package redo ref ' +
+ 'require return sub tie tied unless untie until use wantarray while';
+
+ this.regexList = [
+ { regex: new RegExp('#[^!].*$', 'gm'), css: 'comments' },
+ { regex: new RegExp('^\\s*#!.*$', 'gm'), css: 'preprocessor' }, // shebang
+ { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' },
+ { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' },
+ { regex: new RegExp('(\\$|@|%)\\w+', 'g'), css: 'variable' },
+ { regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' },
+ { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }
+ ];
+
+ this.forHtmlScript(SyntaxHighlighter.regexLib.phpScriptTags);
+}
+
+SyntaxHighlighter.brushes.Perl.prototype = new SyntaxHighlighter.Highlighter();
+SyntaxHighlighter.brushes.Perl.aliases = ['perl', 'Perl', 'pl'];
\ No newline at end of file
Added: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushPhp.js
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushPhp.js (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushPhp.js 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,91 @@
+/**
+ * SyntaxHighlighter
+ * http://alexgorbatchev.com/
+ *
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
+ * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
+ *
+ * @version
+ * 2.1.364 (October 15 2009)
+ *
+ * @copyright
+ * Copyright (C) 2004-2009 Alex Gorbatchev.
+ *
+ * @license
+ * This file is part of SyntaxHighlighter.
+ *
+ * SyntaxHighlighter is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SyntaxHighlighter is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
+ */
+SyntaxHighlighter.brushes.Php = function()
+{
+ var funcs = 'abs acos acosh addcslashes addslashes ' +
+ 'array_change_key_case array_chunk array_combine array_count_values array_diff '+
+ 'array_diff_assoc array_diff_key array_diff_uassoc array_diff_ukey array_fill '+
+ 'array_filter array_flip array_intersect array_intersect_assoc array_intersect_key '+
+ 'array_intersect_uassoc array_intersect_ukey array_key_exists array_keys array_map '+
+ 'array_merge array_merge_recursive array_multisort array_pad array_pop array_product '+
+ 'array_push array_rand array_reduce array_reverse array_search array_shift '+
+ 'array_slice array_splice array_sum array_udiff array_udiff_assoc '+
+ 'array_udiff_uassoc array_uintersect array_uintersect_assoc '+
+ 'array_uintersect_uassoc array_unique array_unshift array_values array_walk '+
+ 'array_walk_recursive atan atan2 atanh base64_decode base64_encode base_convert '+
+ 'basename bcadd bccomp bcdiv bcmod bcmul bindec bindtextdomain bzclose bzcompress '+
+ 'bzdecompress bzerrno bzerror bzerrstr bzflush bzopen bzread bzwrite ceil chdir '+
+ 'checkdate checkdnsrr chgrp chmod chop chown chr chroot chunk_split class_exists '+
+ 'closedir closelog copy cos cosh count count_chars date decbin dechex decoct '+
+ 'deg2rad delete ebcdic2ascii echo empty end ereg ereg_replace eregi eregi_replace error_log '+
+ 'error_reporting escapeshellarg escapeshellcmd eval exec exit exp explode extension_loaded '+
+ 'feof fflush fgetc fgetcsv fgets fgetss file_exists file_get_contents file_put_contents '+
+ 'fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype '+
+ 'floatval flock floor flush fmod fnmatch fopen fpassthru fprintf fputcsv fputs fread fscanf '+
+ 'fseek fsockopen fstat ftell ftok getallheaders getcwd getdate getenv gethostbyaddr gethostbyname '+
+ 'gethostbynamel getimagesize getlastmod getmxrr getmygid getmyinode getmypid getmyuid getopt '+
+ 'getprotobyname getprotobynumber getrandmax getrusage getservbyname getservbyport gettext '+
+ 'gettimeofday gettype glob gmdate gmmktime ini_alter ini_get ini_get_all ini_restore ini_set '+
+ 'interface_exists intval ip2long is_a is_array is_bool is_callable is_dir is_double '+
+ 'is_executable is_file is_finite is_float is_infinite is_int is_integer is_link is_long '+
+ 'is_nan is_null is_numeric is_object is_readable is_real is_resource is_scalar is_soap_fault '+
+ 'is_string is_subclass_of is_uploaded_file is_writable is_writeable mkdir mktime nl2br '+
+ 'parse_ini_file parse_str parse_url passthru pathinfo readlink realpath rewind rewinddir rmdir '+
+ 'round str_ireplace str_pad str_repeat str_replace str_rot13 str_shuffle str_split '+
+ 'str_word_count strcasecmp strchr strcmp strcoll strcspn strftime strip_tags stripcslashes '+
+ 'stripos stripslashes stristr strlen strnatcasecmp strnatcmp strncasecmp strncmp strpbrk '+
+ 'strpos strptime strrchr strrev strripos strrpos strspn strstr strtok strtolower strtotime '+
+ 'strtoupper strtr strval substr substr_compare';
+
+ var keywords = 'and or xor array as break case ' +
+ 'cfunction class const continue declare default die do else ' +
+ 'elseif enddeclare endfor endforeach endif endswitch endwhile ' +
+ 'extends for foreach function include include_once global if ' +
+ 'new old_function return static switch use require require_once ' +
+ 'var while abstract interface public implements extends private protected throw';
+
+ var constants = '__FILE__ __LINE__ __METHOD__ __FUNCTION__ __CLASS__';
+
+ this.regexList = [
+ { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments
+ { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
+ { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings
+ { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings
+ { regex: /\$\w+/g, css: 'variable' }, // variables
+ { regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' }, // common functions
+ { regex: new RegExp(this.getKeywords(constants), 'gmi'), css: 'constants' }, // constants
+ { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // keyword
+ ];
+
+ this.forHtmlScript(SyntaxHighlighter.regexLib.phpScriptTags);
+};
+
+SyntaxHighlighter.brushes.Php.prototype = new SyntaxHighlighter.Highlighter();
+SyntaxHighlighter.brushes.Php.aliases = ['php'];
Added: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushPlain.js
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushPlain.js (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushPlain.js 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,35 @@
+/**
+ * SyntaxHighlighter
+ * http://alexgorbatchev.com/
+ *
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
+ * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
+ *
+ * @version
+ * 2.1.364 (October 15 2009)
+ *
+ * @copyright
+ * Copyright (C) 2004-2009 Alex Gorbatchev.
+ *
+ * @license
+ * This file is part of SyntaxHighlighter.
+ *
+ * SyntaxHighlighter is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SyntaxHighlighter is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
+ */
+SyntaxHighlighter.brushes.Plain = function()
+{
+};
+
+SyntaxHighlighter.brushes.Plain.prototype = new SyntaxHighlighter.Highlighter();
+SyntaxHighlighter.brushes.Plain.aliases = ['text', 'plain'];
Added: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushPowerShell.js
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushPowerShell.js (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushPowerShell.js 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,76 @@
+/**
+ * SyntaxHighlighter
+ * http://alexgorbatchev.com/
+ *
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
+ * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
+ *
+ * @version
+ * 2.1.364 (October 15 2009)
+ *
+ * @copyright
+ * Copyright (C) 2004-2009 Alex Gorbatchev.
+ *
+ * @license
+ * This file is part of SyntaxHighlighter.
+ *
+ * SyntaxHighlighter is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SyntaxHighlighter is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
+ */
+SyntaxHighlighter.brushes.PowerShell = function()
+{
+ // Contributes by B.v.Zanten, Getronics
+ // http://confluence.atlassian.com/display/CONFEXT/New+Code+Macro
+
+ var keywords = 'Add-Content Add-History Add-Member Add-PSSnapin Clear(-Content)? Clear-Item ' +
+ 'Clear-ItemProperty Clear-Variable Compare-Object ConvertFrom-SecureString Convert-Path ' +
+ 'ConvertTo-Html ConvertTo-SecureString Copy(-Item)? Copy-ItemProperty Export-Alias ' +
+ 'Export-Clixml Export-Console Export-Csv ForEach(-Object)? Format-Custom Format-List ' +
+ 'Format-Table Format-Wide Get-Acl Get-Alias Get-AuthenticodeSignature Get-ChildItem Get-Command ' +
+ 'Get-Content Get-Credential Get-Culture Get-Date Get-EventLog Get-ExecutionPolicy ' +
+ 'Get-Help Get-History Get-Host Get-Item Get-ItemProperty Get-Location Get-Member ' +
+ 'Get-PfxCertificate Get-Process Get-PSDrive Get-PSProvider Get-PSSnapin Get-Service ' +
+ 'Get-TraceSource Get-UICulture Get-Unique Get-Variable Get-WmiObject Group-Object ' +
+ 'Import-Alias Import-Clixml Import-Csv Invoke-Expression Invoke-History Invoke-Item ' +
+ 'Join-Path Measure-Command Measure-Object Move(-Item)? Move-ItemProperty New-Alias ' +
+ 'New-Item New-ItemProperty New-Object New-PSDrive New-Service New-TimeSpan ' +
+ 'New-Variable Out-Default Out-File Out-Host Out-Null Out-Printer Out-String Pop-Location ' +
+ 'Push-Location Read-Host Remove-Item Remove-ItemProperty Remove-PSDrive Remove-PSSnapin ' +
+ 'Remove-Variable Rename-Item Rename-ItemProperty Resolve-Path Restart-Service Resume-Service ' +
+ 'Select-Object Select-String Set-Acl Set-Alias Set-AuthenticodeSignature Set-Content ' +
+ 'Set-Date Set-ExecutionPolicy Set-Item Set-ItemProperty Set-Location Set-PSDebug ' +
+ 'Set-Service Set-TraceSource Set(-Variable)? Sort-Object Split-Path Start-Service ' +
+ 'Start-Sleep Start-Transcript Stop-Process Stop-Service Stop-Transcript Suspend-Service ' +
+ 'Tee-Object Test-Path Trace-Command Update-FormatData Update-TypeData Where(-Object)? ' +
+ 'Write-Debug Write-Error Write(-Host)? Write-Output Write-Progress Write-Verbose Write-Warning';
+ var alias = 'ac asnp clc cli clp clv cpi cpp cvpa diff epal epcsv fc fl ' +
+ 'ft fw gal gc gci gcm gdr ghy gi gl gm gp gps group gsv ' +
+ 'gsnp gu gv gwmi iex ihy ii ipal ipcsv mi mp nal ndr ni nv oh rdr ' +
+ 'ri rni rnp rp rsnp rv rvpa sal sasv sc select si sl sleep sort sp ' +
+ 'spps spsv sv tee cat cd cp h history kill lp ls ' +
+ 'mount mv popd ps pushd pwd r rm rmdir echo cls chdir del dir ' +
+ 'erase rd ren type % \\?';
+
+ this.regexList = [
+ { regex: /#.*$/gm, css: 'comments' }, // one line comments
+ { regex: /\$[a-zA-Z0-9]+\b/g, css: 'value' }, // variables $Computer1
+ { regex: /\-[a-zA-Z]+\b/g, css: 'keyword' }, // Operators -not -and -eq
+ { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings
+ { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings
+ { regex: new RegExp(this.getKeywords(keywords), 'gmi'), css: 'keyword' },
+ { regex: new RegExp(this.getKeywords(alias), 'gmi'), css: 'keyword' }
+ ];
+};
+
+SyntaxHighlighter.brushes.PowerShell.prototype = new SyntaxHighlighter.Highlighter();
+SyntaxHighlighter.brushes.PowerShell.aliases = ['powershell', 'ps'];
Added: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushPython.js
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushPython.js (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushPython.js 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,66 @@
+/**
+ * SyntaxHighlighter
+ * http://alexgorbatchev.com/
+ *
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
+ * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
+ *
+ * @version
+ * 2.1.364 (October 15 2009)
+ *
+ * @copyright
+ * Copyright (C) 2004-2009 Alex Gorbatchev.
+ *
+ * @license
+ * This file is part of SyntaxHighlighter.
+ *
+ * SyntaxHighlighter is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SyntaxHighlighter is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
+ */
+SyntaxHighlighter.brushes.Python = function()
+{
+ // Contributed by Gheorghe Milas and Ahmad Sherif
+
+ var keywords = 'and assert break class continue def del elif else ' +
+ 'except exec finally for from global if import in is ' +
+ 'lambda not or pass print raise return try yield while';
+
+ var funcs = '__import__ abs all any apply basestring bin bool buffer callable ' +
+ 'chr classmethod cmp coerce compile complex delattr dict dir ' +
+ 'divmod enumerate eval execfile file filter float format frozenset ' +
+ 'getattr globals hasattr hash help hex id input int intern ' +
+ 'isinstance issubclass iter len list locals long map max min next ' +
+ 'object oct open ord pow print property range raw_input reduce ' +
+ 'reload repr reversed round set setattr slice sorted staticmethod ' +
+ 'str sum super tuple type type unichr unicode vars xrange zip';
+
+ var special = 'None True False self cls class_';
+
+ this.regexList = [
+ { regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' },
+ { regex: /^\s*@\w+/gm, css: 'decorator' },
+ { regex: /(['\"]{3})([^\1])*?\1/gm, css: 'comments' },
+ { regex: /"(?!")(?:\.|\\\"|[^\""\n])*"/gm, css: 'string' },
+ { regex: /'(?!')(?:\.|(\\\')|[^\''\n])*'/gm, css: 'string' },
+ { regex: /\+|\-|\*|\/|\%|=|==/gm, css: 'keyword' },
+ { regex: /\b\d+\.?\w*/g, css: 'value' },
+ { regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'functions' },
+ { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' },
+ { regex: new RegExp(this.getKeywords(special), 'gm'), css: 'color1' }
+ ];
+
+ this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags);
+};
+
+SyntaxHighlighter.brushes.Python.prototype = new SyntaxHighlighter.Highlighter();
+SyntaxHighlighter.brushes.Python.aliases = ['py', 'python'];
Added: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushRuby.js
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushRuby.js (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushRuby.js 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,57 @@
+/**
+ * SyntaxHighlighter
+ * http://alexgorbatchev.com/
+ *
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
+ * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
+ *
+ * @version
+ * 2.1.364 (October 15 2009)
+ *
+ * @copyright
+ * Copyright (C) 2004-2009 Alex Gorbatchev.
+ *
+ * @license
+ * This file is part of SyntaxHighlighter.
+ *
+ * SyntaxHighlighter is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SyntaxHighlighter is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
+ */
+SyntaxHighlighter.brushes.Ruby = function()
+{
+ // Contributed by Erik Peterson.
+
+ var keywords = 'alias and BEGIN begin break case class def define_method defined do each else elsif ' +
+ 'END end ensure false for if in module new next nil not or raise redo rescue retry return ' +
+ 'self super then throw true undef unless until when while yield';
+
+ var builtins = 'Array Bignum Binding Class Continuation Dir Exception FalseClass File::Stat File Fixnum Fload ' +
+ 'Hash Integer IO MatchData Method Module NilClass Numeric Object Proc Range Regexp String Struct::TMS Symbol ' +
+ 'ThreadGroup Thread Time TrueClass';
+
+ this.regexList = [
+ { regex: SyntaxHighlighter.regexLib.singleLinePerlComments, css: 'comments' }, // one line comments
+ { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // double quoted strings
+ { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // single quoted strings
+ { regex: /\b[A-Z0-9_]+\b/g, css: 'constants' }, // constants
+ { regex: /:[a-z][A-Za-z0-9_]*/g, css: 'color2' }, // symbols
+ { regex: /(\$|@@|@)\w+/g, css: 'variable bold' }, // $global, @instance, and @@class variables
+ { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords
+ { regex: new RegExp(this.getKeywords(builtins), 'gm'), css: 'color1' } // builtins
+ ];
+
+ this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags);
+};
+
+SyntaxHighlighter.brushes.Ruby.prototype = new SyntaxHighlighter.Highlighter();
+SyntaxHighlighter.brushes.Ruby.aliases = ['ruby', 'rails', 'ror', 'rb'];
Added: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushScala.js
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushScala.js (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushScala.js 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,53 @@
+/**
+ * SyntaxHighlighter
+ * http://alexgorbatchev.com/
+ *
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
+ * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
+ *
+ * @version
+ * 2.1.364 (October 15 2009)
+ *
+ * @copyright
+ * Copyright (C) 2004-2009 Alex Gorbatchev.
+ *
+ * @license
+ * This file is part of SyntaxHighlighter.
+ *
+ * SyntaxHighlighter is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SyntaxHighlighter is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
+ */
+SyntaxHighlighter.brushes.Scala = function()
+{
+ // Contributed by Yegor Jbanov and David Bernard.
+
+ var keywords = 'val sealed case def true trait implicit forSome import match object null finally super ' +
+ 'override try lazy for var catch throw type extends class while with new final yield abstract ' +
+ 'else do if return protected private this package false';
+
+ var keyops = '[_:=><%#@]+';
+
+ this.regexList = [
+ { regex: SyntaxHighlighter.regexLib.singleLineCComments, css: 'comments' }, // one line comments
+ { regex: SyntaxHighlighter.regexLib.multiLineCComments, css: 'comments' }, // multiline comments
+ { regex: SyntaxHighlighter.regexLib.multiLineSingleQuotedString, css: 'string' }, // multi-line strings
+ { regex: SyntaxHighlighter.regexLib.multiLineDoubleQuotedString, css: 'string' }, // double-quoted string
+ { regex: SyntaxHighlighter.regexLib.singleQuotedString, css: 'string' }, // strings
+ { regex: /0x[a-f0-9]+|\d+(\.\d+)?/gi, css: 'value' }, // numbers
+ { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' }, // keywords
+ { regex: new RegExp(keyops, 'gm'), css: 'keyword' } // scala keyword
+ ];
+}
+
+SyntaxHighlighter.brushes.Scala.prototype = new SyntaxHighlighter.Highlighter();
+SyntaxHighlighter.brushes.Scala.aliases = ['scala'];
Added: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushSql.js
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushSql.js (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushSql.js 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,68 @@
+/**
+ * SyntaxHighlighter
+ * http://alexgorbatchev.com/
+ *
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
+ * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
+ *
+ * @version
+ * 2.1.364 (October 15 2009)
+ *
+ * @copyright
+ * Copyright (C) 2004-2009 Alex Gorbatchev.
+ *
+ * @license
+ * This file is part of SyntaxHighlighter.
+ *
+ * SyntaxHighlighter is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SyntaxHighlighter is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
+ */
+SyntaxHighlighter.brushes.Sql = function()
+{
+ var funcs = 'abs avg case cast coalesce convert count current_timestamp ' +
+ 'current_user day isnull left lower month nullif replace right ' +
+ 'session_user space substring sum system_user upper user year';
+
+ var keywords = 'absolute action add after alter as asc at authorization begin bigint ' +
+ 'binary bit by cascade char character check checkpoint close collate ' +
+ 'column commit committed connect connection constraint contains continue ' +
+ 'create cube current current_date current_time cursor database date ' +
+ 'deallocate dec decimal declare default delete desc distinct double drop ' +
+ 'dynamic else end end-exec escape except exec execute false fetch first ' +
+ 'float for force foreign forward free from full function global goto grant ' +
+ 'group grouping having hour ignore index inner insensitive insert instead ' +
+ 'int integer intersect into is isolation key last level load local max min ' +
+ 'minute modify move name national nchar next no numeric of off on only ' +
+ 'open option order out output partial password precision prepare primary ' +
+ 'prior privileges procedure public read real references relative repeatable ' +
+ 'restrict return returns revoke rollback rollup rows rule schema scroll ' +
+ 'second section select sequence serializable set size smallint static ' +
+ 'statistics table temp temporary then time timestamp to top transaction ' +
+ 'translation trigger true truncate uncommitted union unique update values ' +
+ 'varchar varying view when where with work';
+
+ var operators = 'all and any between cross in join like not null or outer some';
+
+ this.regexList = [
+ { regex: /--(.*)$/gm, css: 'comments' }, // one line and multiline comments
+ { regex: SyntaxHighlighter.regexLib.multiLineDoubleQuotedString, css: 'string' }, // double quoted strings
+ { regex: SyntaxHighlighter.regexLib.multiLineSingleQuotedString, css: 'string' }, // single quoted strings
+ { regex: new RegExp(this.getKeywords(funcs), 'gmi'), css: 'color2' }, // functions
+ { regex: new RegExp(this.getKeywords(operators), 'gmi'), css: 'color1' }, // operators and such
+ { regex: new RegExp(this.getKeywords(keywords), 'gmi'), css: 'keyword' } // keyword
+ ];
+};
+
+SyntaxHighlighter.brushes.Sql.prototype = new SyntaxHighlighter.Highlighter();
+SyntaxHighlighter.brushes.Sql.aliases = ['sql'];
+
Added: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushVb.js
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushVb.js (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushVb.js 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,58 @@
+/**
+ * SyntaxHighlighter
+ * http://alexgorbatchev.com/
+ *
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
+ * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
+ *
+ * @version
+ * 2.1.364 (October 15 2009)
+ *
+ * @copyright
+ * Copyright (C) 2004-2009 Alex Gorbatchev.
+ *
+ * @license
+ * This file is part of SyntaxHighlighter.
+ *
+ * SyntaxHighlighter is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SyntaxHighlighter is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
+ */
+SyntaxHighlighter.brushes.Vb = function()
+{
+ var keywords = 'AddHandler AddressOf AndAlso Alias And Ansi As Assembly Auto ' +
+ 'Boolean ByRef Byte ByVal Call Case Catch CBool CByte CChar CDate ' +
+ 'CDec CDbl Char CInt Class CLng CObj Const CShort CSng CStr CType ' +
+ 'Date Decimal Declare Default Delegate Dim DirectCast Do Double Each ' +
+ 'Else ElseIf End Enum Erase Error Event Exit False Finally For Friend ' +
+ 'Function Get GetType GoSub GoTo Handles If Implements Imports In ' +
+ 'Inherits Integer Interface Is Let Lib Like Long Loop Me Mod Module ' +
+ 'MustInherit MustOverride MyBase MyClass Namespace New Next Not Nothing ' +
+ 'NotInheritable NotOverridable Object On Option Optional Or OrElse ' +
+ 'Overloads Overridable Overrides ParamArray Preserve Private Property ' +
+ 'Protected Public RaiseEvent ReadOnly ReDim REM RemoveHandler Resume ' +
+ 'Return Select Set Shadows Shared Short Single Static Step Stop String ' +
+ 'Structure Sub SyncLock Then Throw To True Try TypeOf Unicode Until ' +
+ 'Variant When While With WithEvents WriteOnly Xor';
+
+ this.regexList = [
+ { regex: /'.*$/gm, css: 'comments' }, // one line comments
+ { regex: SyntaxHighlighter.regexLib.doubleQuotedString, css: 'string' }, // strings
+ { regex: /^\s*#.*$/gm, css: 'preprocessor' }, // preprocessor tags like #region and #endregion
+ { regex: new RegExp(this.getKeywords(keywords), 'gm'), css: 'keyword' } // vb keyword
+ ];
+
+ this.forHtmlScript(SyntaxHighlighter.regexLib.aspScriptTags);
+};
+
+SyntaxHighlighter.brushes.Vb.prototype = new SyntaxHighlighter.Highlighter();
+SyntaxHighlighter.brushes.Vb.aliases = ['vb', 'vbnet'];
Added: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushXml.js
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushXml.js (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shBrushXml.js 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,71 @@
+/**
+ * SyntaxHighlighter
+ * http://alexgorbatchev.com/
+ *
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
+ * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
+ *
+ * @version
+ * 2.1.364 (October 15 2009)
+ *
+ * @copyright
+ * Copyright (C) 2004-2009 Alex Gorbatchev.
+ *
+ * @license
+ * This file is part of SyntaxHighlighter.
+ *
+ * SyntaxHighlighter is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SyntaxHighlighter is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
+ */
+SyntaxHighlighter.brushes.Xml = function()
+{
+ function process(match, regexInfo)
+ {
+ var constructor = SyntaxHighlighter.Match,
+ code = match[0],
+ tag = new XRegExp('(<|<)[\\s\\/\\?]*(?<name>[:\\w-\\.]+)', 'xg').exec(code),
+ result = []
+ ;
+
+ if (match.attributes != null)
+ {
+ var attributes,
+ regex = new XRegExp('(?<name> [\\w:\\-\\.]+)' +
+ '\\s*=\\s*' +
+ '(?<value> ".*?"|\'.*?\'|\\w+)',
+ 'xg');
+
+ while ((attributes = regex.exec(code)) != null)
+ {
+ result.push(new constructor(attributes.name, match.index + attributes.index, 'color1'));
+ result.push(new constructor(attributes.value, match.index + attributes.index + attributes[0].indexOf(attributes.value), 'string'));
+ }
+ }
+
+ if (tag != null)
+ result.push(
+ new constructor(tag.name, match.index + tag[0].indexOf(tag.name), 'keyword')
+ );
+
+ return result;
+ }
+
+ this.regexList = [
+ { regex: new XRegExp('(\\<|<)\\!\\[[\\w\\s]*?\\[(.|\\s)*?\\]\\](\\>|>)', 'gm'), css: 'color2' }, // <![ ... [ ... ]]>
+ { regex: SyntaxHighlighter.regexLib.xmlComments, css: 'comments' }, // <!-- ... -->
+ { regex: new XRegExp('(<|<)[\\s\\/\\?]*(\\w+)(?<attributes>.*?)[\\s\\/\\?]*(>|>)', 'sg'), func: process }
+ ];
+};
+
+SyntaxHighlighter.brushes.Xml.prototype = new SyntaxHighlighter.Highlighter();
+SyntaxHighlighter.brushes.Xml.aliases = ['xml', 'xhtml', 'xslt', 'html'];
Added: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shCore.js
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shCore.js (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shCore.js 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,30 @@
+/**
+ * SyntaxHighlighter
+ * http://alexgorbatchev.com/
+ *
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
+ * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
+ *
+ * @version
+ * 2.1.364 (October 15 2009)
+ *
+ * @copyright
+ * Copyright (C) 2004-2009 Alex Gorbatchev.
+ *
+ * @license
+ * This file is part of SyntaxHighlighter.
+ *
+ * SyntaxHighlighter is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SyntaxHighlighter is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
+ */
+eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('c(!1q.2X){h 2X=l(){h p={6b:{"1s-R":"","84-2y":1,"83-2y-7W":I,"1I":v,"8d-89":I,"1H-2Q":4,"3g":I,"1w":I,"66":N,"8k-8l":I,"88":N,"5h-1p":I,"1L-1l":N},M:{4T:I,69:v,5l:16,5k:16,8B:N,8f:N,8s:"54",1f:{5q:"53 1g",5d:"9N 1g",5i:"9O 6q 6p",78:"9M C 9L 1V 9I 6p 9J",3t:"3t",6C:"?",1A:"2X\\n\\n",6T:"9K\'t 9P 2O D: ",7x:"9Q 9W\'t 9X D 1L-1l 9V: ",77:"<!9U 1L 9R \\"-//9S//6H 9T 1.0 9H//9G\\" \\"2s://5x.6x.6B/9v/6D/6H/6D-9w.9u\\"><1L 9t=\\"2s://5x.6x.6B/9s/9x\\"><6z><9y 2s-9E=\\"9F-9D\\" 63=\\"1X/1L; 9C=9z-8\\" /><3i>9A 2X</3i></6z><33 1m=\\"39-9Y:9Z,an,ao,am-al;ai-3f:#aj;3f:#ak;39-2Q:ap;1X-6G:6u;\\"><A 1m=\\"1X-6G:6u;6w-4w:aw;\\"><A 1m=\\"39-2Q:au-at;\\">2X</A><A 1!
m=\\"39-2Q:.as;6w-9p:ah;\\"><A>6O 2.1.ag (a5 15 6h)</A><A><a 27=\\"2s://6I.3k\\" a6=\\"4k\\" 1m=\\"3f:#6F;1X-6t:6L;\\">2s://6I.3k</a></A><A>a3 a0 a1 f 1l, a2 <a 27=\\"a7://5x.a8.3k/ae-af/ad?ac=a9-aa&ab=ax\\" 1m=\\"3f:#6F;1X-6t:6L;\\">8R</a> 6q 8Q 8O 8W!</A></A><A>8V C 8U 8X.</A><A>8K 8N-6h 8M 8S.</A></A></33></1L>"},8u:N},1r:{4Z:v,9o:v,3m:v,6f:{}},2d:{},8h:{9g:/\\/\\*[\\s\\S]*?\\*\\//3b,9d:/\\/\\/.*$/3b,9e:/#.*$/3b,9j:/"([^\\\\"\\n]|\\\\.)*"/g,9n:/\'([^\\\\\'\\n]|\\\\.)*\'/g,9m:/"([^\\\\"]|\\\\.)*"/g,8Y:/\'([^\\\\\']|\\\\.)*\'/g,9k:/(&X;|<)!--[\\s\\S]*?--(&Z;|>)/3b,43:/&X;\\w+:\\/\\/[\\w-.\\/?%&=@:;]*&Z;|\\w+:\\/\\/[\\w-.\\/?%&=@:;]*/g,9c:{G:/(&X;|<)\\?=?/g,1d:/\\?(&Z;|>)/g},93:{G:/(&X;|<)%=?/g,1d:/%(&Z;|>)/g},92:{G:/(&X;|<)\\s*1l.*?(&Z;|>)/4e,1d:/(&X;|<)\\/\\s*1l\\s*(&Z;|>)/4e}},1w:{1c:l(3O){h 3T=Q.22("3Y"),5s=p.1w.7d;3T.L="1w";D(h 30 1V 5s){h 6i=5s[30],5t=W 6i(3O),1Y=5t.1c();3O.6g[30]=5t;c(1Y==v){1J}c(7X(1Y)=="91"){1Y=p.1w.6m(1Y,3O.1k,30)}1Y.L+="5v "+30;3T.2p(1Y)}q 3T},6m!
:l(5L,7j,5K){h a=Q.22("a"),5N=a.1m,5D=p.M,5M=5D.5l,5J=5D.5k;a.!
27="#"+5
K;a.3i=5L;a.5j=7j;a.76=5K;a.1Q=5L;c(40(5M)==N){5N.26=5M+"75"}c(40(5J)==N){5N.2e=5J+"75"}a.9l=l(e){97{p.1w.6M(f,e||1q.6Y,f.5j,f.76)}98(e){p.B.1A(e.6n)}q N};q a},6M:l(7i,7g,7b,7h,7f){h 5G=p.1r.6f[7b],5H;c(5G==v||(5H=5G.6g[7h])==v){q v}q 5H.2z(7i,7g,7f)},7d:{5q:l(5b){f.1c=l(){c(5b.V("66")!=I){q}q p.M.1f.5q};f.2z=l(5c,8T,8P){h A=5b.A;5c.7y.4p(5c);A.L=A.L.E("5O","")}},5d:l(6R){f.1c=l(){q p.M.1f.5d};f.2z=l(b1,bU,bV){h 3J=p.B.3d(6R.5g).E(/</g,"&X;"),2A=p.B.4z("","4k",bT,bS,"bQ=0, bR=1, bW=0, 7a=1");3J=p.B.2T(3J);2A.Q.3D("<54>"+3J+"</54>");2A.Q.4o()}},5i:l(64){h 3C,c2,6a=64.1k;f.1c=l(){h 2V=p.M;c(2V.69==v){q v}l 1E(56){h 5m="";D(h 5f 1V 56){5m+="<c1 R=\'"+5f+"\' 24=\'"+56[5f]+"\'/>"}q 5m};l 2i(5n){h 5p="";D(h 5o 1V 5n){5p+=" "+5o+"=\'"+5n[5o]+"\'"}q 5p};h 67={26:2V.5l,2e:2V.5k,1k:6a+"bY",4r:"bZ/x-71-6V",3i:p.M.1f.5i},5V={bE:"ay",bD:"bC",bA:"5j="+6a,c4:"N"},5U=2V.69,3x;c(/bG/i.1R(6K.7k)){3x="<4h"+2i({bH:"bM:bN-bL-bK-bI-bJ",c3:"2s://ck.cj.3k/cm/71/c9/6V/c8.c7#6O=9,0,0,0"})+2i(67)+">"+!
1E(5V)+1E({c6:5U})+"</4h>"}F{3x="<ca"+2i(67)+2i(5V)+2i({cg:5U})+"/>"}3C=Q.22("A");3C.1Q=3x;q 3C};f.2z=l(cf,ce,62){h 7c=62.cd;6U(7c){2K"7q":h 61=p.B.2T(p.B.3d(64.5g).E(/&X;/g,"<").E(/&Z;/g,">").E(/&aT;/g,"&"));c(1q.74){1q.74.aU("1X",61)}F{q p.B.2T(61)}2K"aR":p.B.1A(p.M.1f.78);2h;2K"aP":p.B.1A(62.6n);2h}}},aV:l(65){f.1c=l(){q p.M.1f.3t};f.2z=l(aW,bz,b0){h 1Z=Q.22("aZ"),1N=v;c(p.1r.3m!=v){Q.33.4p(p.1r.3m)}p.1r.3m=1Z;1Z.1m.aX="aY:aO;26:6r;2e:6r;G:-6j;4w:-6j;";Q.33.2p(1Z);1N=1Z.5Q.Q;6J(1N,1q.Q);1N.3D("<A 1s=\\""+65.A.L.E("5O","")+" aD\\">"+65.A.1Q+"</A>");1N.4o();1Z.5Q.4F();1Z.5Q.3t();l 6J(6N,6E){h 2I=6E.4O("4n");D(h i=0;i<2I.u;i++){c(2I[i].6y.6P()=="6A"&&/aE\\.1a$/.1R(2I[i].27)){6N.3D("<4n 4r=\\"1X/1a\\" 6y=\\"6A\\" 27=\\""+2I[i].27+"\\"></4n>")}}}}},az:l(aA){f.1c=l(){q p.M.1f.6C};f.2z=l(aF,aG){h 2A=p.B.4z("","4k",aM,aK,"7a=0"),1N=2A.Q;1N.3D(p.M.1f.77);1N.4o();2A.4F()}}}},B:{Y:l(49,73,3y){3y=3e.aH(3y||0,0);D(h i=3y;i<49.u;i++){c(49[i]==73){q i}}q-1},6d:l(72){q 72+3e.aI(3e.b2()*!
b3).2u()},6c:l(51,4L){h 3h={},1W;D(1W 1V 51){3h[1W]=51[1W]}D(1!
W 1V 4L)
{3h[1W]=4L[1W]}q 3h},80:l(4J){6U(4J){2K"I":q I;2K"N":q N}q 4J},4z:l(43,6W,4B,4H,2N){h x=(6X.26-4B)/2,y=(6X.2e-4H)/2;2N+=", G="+x+", 4w="+y+", 26="+4B+", 2e="+4H;2N=2N.E(/^,/,"");h 4E=1q.bk(43,6W,2N);4E.4F();q 4E},7C:l(1G,1T,1U){c(1G.6Z){1G["e"+1T+1U]=1U;1G[1T+1U]=l(){1G["e"+1T+1U](1q.6Y)};1G.6Z("bw"+1T,1G[1T+1U])}F{1G.bv(1T,1U,N)}},1A:l(z){1A(p.M.1f.1A+z)},4u:l(4N,6Q){h 2r=p.1r.4Z,3V=v;c(2r==v){2r={};D(h 2L 1V p.2d){h 42=p.2d[2L].bu;c(42==v){1J}p.2d[2L].R=2L.6P();D(h i=0;i<42.u;i++){2r[42[i]]=2L}}p.1r.4Z=2r}3V=p.2d[2r[4N]];c(3V==v&&6Q!=N){p.B.1A(p.M.1f.6T+4N)}q 3V},46:l(z,6S){h 2E=z.1P("\\n");D(h i=0;i<2E.u;i++){2E[i]=6S(2E[i])}q 2E.5A("\\n")},8C:l(z){q z.E(/^[ ]*[\\n]+|[\\n]*[ ]*$/g,"")},8H:l(z){h 3X,45={},4P=W U("^\\\\[(?<4c>(.*?))\\\\]$"),7e=W U("(?<R>[\\\\w-]+)"+"\\\\s*:\\\\s*"+"(?<24>"+"[\\\\w-%#]+|"+"\\\\[.*?\\\\]|"+"\\".*?\\"|"+"\'.*?\'"+")\\\\s*;?","g");2j((3X=7e.T(z))!=v){h 2f=3X.24.E(/^[\'"]|[\'"]$/g,"");c(2f!=v&&4P.1R(2f)){h m=4P.T(2f);2f=m.4c.u>0?m.4c.1P(/\\s*,\\!
s*/):[]}45[3X.R]=2f}q 45},7K:l(z,1a){c(z==v||z.u==0||z=="\\n"){q z}z=z.E(/</g,"&X;");z=z.E(/ {2,}/g,l(m){h 4t="";D(h i=0;i<m.u-1;i++){4t+="&2B;"}q 4t+" "});c(1a!=v){z=p.B.46(z,l(2l){c(2l.u==0){q""}h 3W="";2l=2l.E(/^(&2B;| )+/,l(s){3W=s;q""});c(2l.u==0){q 3W}q 3W+"<C 1s=\\""+1a+"\\">"+2l+"</C>"})}q z},7V:l(6l,6o){h 32=6l.2u();2j(32.u<6o){32="0"+32}q 32},6k:l(){h 3w=Q.22("A"),3B,3o=0,44=Q.33,1k=p.B.6d("6k"),36="<A 1s=\\"",2Y="</A>",4U="</4G>";3w.1Q=36+"6e\\">"+36+"1p\\">"+36+"2y\\">"+36+"63"+"\\"><4G 1s=\\"b5\\"><4G 1k=\\""+1k+"\\">&2B;"+4U+4U+2Y+2Y+2Y+2Y;44.2p(3w);3B=Q.bb(1k);c(/bg/i.1R(6K.7k)){h 6v=1q.be(3B,v);3o=85(6v.bc("26"))}F{3o=3B.bd}44.4p(3w);q 3o},8b:l(79,6s){h 1H="";D(h i=0;i<6s;i++){1H+=" "}q 79.E(/\\t/g,1H)},8a:l(2Z,4f){h bF=2Z.1P("\\n"),1H="\\t",4d="";D(h i=0;i<50;i++){4d+=" "}l 8x(3s,18,8A){q 3s.29(0,18)+4d.29(0,8A)+3s.29(18+1,3s.u)};2Z=p.B.46(2Z,l(20){c(20.Y(1H)==-1){q 20}h 18=0;2j((18=20.Y(1H))!=-1){h 8w=4f-18%4f;20=8x(20,18,8w)}q 20});q 2Z!
},3d:l(z){h br=/<br\\s*\\/?>|&X;br\\s*\\/?&Z;/4e;c(p.M.8B==I){!
z=z.E(br
,"\\n")}c(p.M.8f==I){z=z.E(br,"")}q z},2G:l(z){q z.E(/^\\s+|\\s+$/g,"")},2T:l(z){h 21=p.B.3d(z).1P("\\n"),bf=W bh(),8D=/^\\s*/,2a=ba;D(h i=0;i<21.u&&2a>0;i++){h 4x=21[i];c(p.B.2G(4x).u==0){1J}h 4I=8D.T(4x);c(4I==v){q z}2a=3e.2a(4I[0].u,2a)}c(2a>0){D(h i=0;i<21.u;i++){21[i]=21[i].29(2a)}}q 21.5A("\\n")},82:l(35,31){c(35.H<31.H){q-1}F{c(35.H>31.H){q 1}F{c(35.u<31.u){q-1}F{c(35.u>31.u){q 1}}}}q 0},2D:l(8q,34){l 8n(4D,8r){q[W p.4v(4D[0],4D.H,8r.1a)]};h b4=0,4s=v,3L=[],8p=34.4X?34.4X:8n;2j((4s=34.3K.T(8q))!=v){3L=3L.2t(8p(4s,34))}q 3L},8m:l(8o){h X="&X;",Z="&Z;";q 8o.E(p.8h.43,l(m){h 4j="",47="";c(m.Y(X)==0){47=X;m=m.3U(X.u)}c(m.Y(Z)==m.u-Z.u){m=m.3U(0,m.u-Z.u);4j=Z}q 47+"<a 27=\\""+m+"\\">"+m+"</a>"+4j})},8v:l(){h 3N=Q.4O("1l"),4i=[];D(h i=0;i<3N.u;i++){c(3N[i].4r=="6e"){4i.K(3N[i])}}q 4i},8I:l(4b){h 4q="<![b6[",3S="]]>",1v=p.B.2G(4b),3R=N;c(1v.Y(4q)==0){1v=1v.3U(4q.u);3R=I}c(1v.Y(3S)==1v.u-3S.u){1v=1v.3U(0,1v.u-3S.u);3R=I}q 3R?1v:4b}},1I:l(8E,4R){l 8e(4g){h 4Q=[];D(h i=0;i<4g.u!
;i++){4Q.K(4g[i])}q 4Q};h 2q=4R?[4R]:8e(Q.4O(p.M.8s)),8J="1Q",2k=v,4S=p.M;c(4S.4T){2q=2q.2t(p.B.8v())}c(2q.u===0){q}D(h i=0;i<2q.u;i++){h 2M=2q[i],28=p.B.8H(2M.L),1D,2W,25;28=p.B.6c(8E,28);1D=28["2O"];c(1D==v){1J}c(28["1L-1l"]=="I"||p.6b["1L-1l"]==I){2k=W p.4a(1D);1D="b9"}F{h 3P=p.B.4u(1D);c(3P){1D=3P.R;2k=W 3P()}F{1J}}2W=2M[8J];c(4S.4T){2W=p.B.8I(2W)}28["2O-R"]=1D;2k.1I(2W,28);25=2k.A;c(p.M.8u){25=Q.22("bj");25.24=2k.A.1Q;25.1m.26="bt";25.1m.2e="bx"}2M.7y.bs(25,2M)}},bq:l(7H){p.B.7C(1q,"bl",l(){p.1I(7H)})}};p.4v=l(4A,7G,1a){f.24=4A;f.H=7G;f.u=4A.u;f.1a=1a;f.5Y=v};p.4v.14.2u=l(){q f.24};p.4a=l(4K){h 3z=p.B.4u(4K),2g,4W=W p.2d.bm(),bn=v;c(3z==v){q}2g=W 3z();f.4m=4W;c(2g.3I==v){p.B.1A(p.M.1f.7x+4K);q}4W.59.K({3K:2g.3I.C,4X:7p});l 3A(4Y,7w){D(h j=0;j<4Y.u;j++){4Y[j].H+=7w}};l 7p(19,bp){h 7n=19.C,1o=[],4M=2g.59,7l=19.H+19.G.u,2U=2g.3I,1n;D(h i=0;i<4M.u;i++){1n=p.B.2D(7n,4M[i]);3A(1n,7l);1o=1o.2t(1n)}c(2U.G!=v&&19.G!=v){1n=p.B.2D(19.G,2U.G);3A(1n,19.H);1o=1o.2t(1n)}c(2U.1d!=v&&1!
9.1d!=v){1n=p.B.2D(19.1d,2U.1d);3A(1n,19.H+19[0].bo(19.1d));1o!
=1o.2t(1
n)}D(h j=0;j<1o.u;j++){1o[j].5Y=3z.R}q 1o}};p.4a.14.1I=l(7t,7s){f.4m.1I(7t,7s);f.A=f.4m.A};p.7I=l(){};p.7I.14={V:l(7J,7Z){h 4l=f.1E[7J];q p.B.80(4l==v?7Z:4l)},1c:l(7Y){q Q.22(7Y)},8i:l(2F,81){h 3u=[];c(2F!=v){D(h i=0;i<2F.u;i++){c(7X(2F[i])=="4h"){3u=3u.2t(p.B.2D(81,2F[i]))}}}q 3u.aB(p.B.82)},86:l(){h 23=f.2C;D(h i=0;i<23.u;i++){c(23[i]===v){1J}h 2x=23[i],4V=2x.H+2x.u;D(h j=i+1;j<23.u&&23[i]!==v;j++){h 1S=23[j];c(1S===v){1J}F{c(1S.H>4V){2h}F{c(1S.H==2x.H&&1S.u>2x.u){f.2C[i]=v}F{c(1S.H>=2x.H&&1S.H<4V){f.2C[j]=v}}}}}}},8t:l(2H){h 3r=2H.1P(/\\n/g),3n=85(f.V("84-2y")),2v=f.V("83-2y-7W"),7N=f.V("1I",[]),7U=f.V("3g");2H="";c(2v==I){2v=(3n+3r.u-1).2u().u}F{c(40(2v)==I){2v=0}}D(h i=0;i<3r.u;i++){h 1x=3r[i],60=/^(&2B;|\\s)+/.T(1x),52="aN"+(i%2==0?1:2),7F=p.B.7V(3n+i,2v),7P=p.B.Y(7N,(3n+i).2u())!=-1,2S=v;c(60!=v){2S=60[0].2u();1x=1x.29(2S.u)}1x=p.B.2G(1x);c(1x.u==0){1x="&2B;"}c(7P){52+=" aQ"}2H+="<A 1s=\\"2y "+52+"\\">"+"<7L>"+"<7T>"+(7U?"<3F 1s=\\"aS\\"><C>"+7F+"</C></3F>":"")+"<3F 1!
s=\\"63\\">"+(2S!=v?"<C 1s=\\"by\\">"+2S.E(" ","&2B;")+"</C>":"")+1x+"</3F>"+"</7T>"+"</7L>"+"</A>"}q 2H},8y:l(5X,5T){h 18=0,3c="",3a=p.B.7K,5S=f.V("2O-R","");l 5W(5Z){h 5R=5Z?(5Z.5Y||5S):5S;q 5R?5R+" ":""};D(h i=0;i<5T.u;i++){h 1y=5T[i],3G;c(1y===v||1y.u===0){1J}3G=5W(1y);3c+=3a(5X.29(18,1y.H-18),3G+"7O")+3a(1y.24,3G+1y.1a);18=1y.H+1y.u}3c+=3a(5X.29(18),5W()+"7O");q 3c},1I:l(C,7E){h cb=p.M,1r=p.1r,A,ci,3Z,ch="cn";f.1E={};f.A=v;f.1p=v;f.C=v;f.1i=v;f.6g={};f.1k=p.B.6d("cl");1r.6f[f.1k]=f;c(C===v){C=""}f.1E=p.B.6c(p.6b,7E||{});c(f.V("88")==I){f.1E.1w=f.1E.3g=N}f.A=A=f.1c("3Y");f.1p=f.1c("3Y");f.1p.L="1p";L="6e";A.1k=f.1k;c(f.V("66")){L+=" 5O"}c(f.V("3g")==N){L+=" bB"}c(f.V("5h-1p")==N){f.1p.L+=" bO-5h"}L+=" "+f.V("1s-R");L+=" "+f.V("2O-R");A.L=L;f.5g=C;f.C=p.B.8C(C).E(/\\r/g," ");3Z=f.V("1H-2Q");f.C=f.V("8d-89")==I?p.B.8a(f.C,3Z):p.B.8b(f.C,3Z);f.C=p.B.2T(f.C);c(f.V("1w")){f.1i=f.1c("3Y");f.1i.L="1i";f.1i.2p(p.1w.1c(f));A.2p(f.1i);h 1i=f.1i;l 58(){1i.L=1i.L.E("53","")};A.c0=l!
(){58();1i.L+=" 53"};A.bX=l(){58()}}A.2p(f.1p);f.2C=f.8i(f.59,!
f.C);f.8
6();C=f.8y(f.C,f.2C);C=f.8t(p.B.2G(C));c(f.V("8k-8l")){C=p.B.8m(C)}f.1p.1Q=C},9f:l(z){z=z.E(/^\\s+|\\s+$/g,"").E(/\\s+/g,"|");q"\\\\b(?:"+z+")\\\\b"},9i:l(2J){f.3I={G:{3K:2J.G,1a:"1l"},1d:{3K:2J.1d,1a:"1l"},C:W U("(?<G>"+2J.G.1g+")"+"(?<C>.*?)"+"(?<1d>"+2J.1d.1g+")","96")}}};q p}()}c(!1q.U){(l(){h 2w={T:10.14.T,87:5I.14.87,E:5I.14.E,1P:5I.14.1P},1F={13:/(?:[^\\\\([#\\s.]+|\\\\(?!k<[\\w$]+>|[7z]{[^}]+})[\\S\\s]?|\\((?=\\?(?!#|<[\\w$]+>)))+|(\\()(?:\\?(?:(#)[^)]*\\)|<([$\\w]+)>))?|\\\\(?:k<([\\w$]+)>|[7z]{([^}]+)})|(\\[\\^?)|([\\S\\s])/g,99:/(?:[^$]+|\\$(?![1-9$&`\']|{[$\\w]+}))+|\\$(?:([1-9]\\d*|[$&`\'])|{([$\\w]+)})/g,37:/^(?:\\s+|#.*)+/,5B:/^(?:[?*+]|{\\d+(?:,\\d*)?})/,7Q:/&&\\[\\^?/g,7S:/]/g},7o=l(5C,5v,5u){D(h i=5u||0;i<5C.u;i++){c(5C[i]===5v){q i}}q-1},8G=/()??/.T("")[1]!==3j,3q={};U=l(1e,1O){c(1e 68 10){c(1O!==3j){3H 7r("4y\'t 4C 9a 8z 95 7u 10 5u 94")}q 1e.3E()}h 1O=1O||"",7R=1O.Y("s")>-1,7M=1O.Y("x")>-1,5z=N,3v=[],1b=[],13=1F.13,J,cc,38,3M,3p;13.O=0;2j(J=2w.T.2n(13,1e!
)){c(J[2]){c(!1F.5B.1R(1e.17(13.O))){1b.K("(?:)")}}F{c(J[1]){3v.K(J[3]||v);c(J[3]){5z=I}1b.K("(")}F{c(J[4]){3M=7o(3v,J[4]);1b.K(3M>-1?"\\\\"+(3M+1)+(40(1e.5w(13.O))?"":"(?:)"):J[0])}F{c(J[5]){1b.K(3q.7m?3q.7m.7q(J[5],J[0].5w(1)==="P"):J[0])}F{c(J[6]){c(1e.5w(13.O)==="]"){1b.K(J[6]==="["?"(?!)":"[\\\\S\\\\s]");13.O++}F{cc=U.8g("&&"+1e.17(J.H),1F.7Q,1F.7S,"",{7D:"\\\\"})[0];1b.K(J[6]+cc+"]");13.O+=cc.u+1}}F{c(J[7]){c(7R&&J[7]==="."){1b.K("[\\\\S\\\\s]")}F{c(7M&&1F.37.1R(J[7])){38=2w.T.2n(1F.37,1e.17(13.O-1))[0].u;c(!1F.5B.1R(1e.17(13.O-1+38))){1b.K("(?:)")}13.O+=38-1}F{1b.K(J[7])}}}F{1b.K(J[0])}}}}}}}3p=10(1b.5A(""),2w.E.2n(1O,/[9B]+/g,""));3p.1C={1g:1e,2m:5z?3v:v};q 3p};U.9q=l(R,o){3q[R]=o};10.14.T=l(z){h 1h=2w.T.2n(f,z),R,i,5y;c(1h){c(8G&&1h.u>1){5y=W 10("^"+f.1g+"$(?!\\\\s)",f.5E());2w.E.2n(1h[0],5y,l(){D(i=1;i<8j.u-2;i++){c(8j[i]===3j){1h[i]=3j}}})}c(f.1C&&f.1C.2m){D(i=1;i<1h.u;i++){R=f.1C.2m[i-1];c(R){1h[R]=1h[i]}}}c(f.3l&&f.O>(1h.H+1h[0].u)){f.O--}}q 1h}})()}10.14.5E=l(!
){q(f.3l?"g":"")+(f.av?"i":"")+(f.8F?"m":"")+(f.37?"x":"")+(f.!
a4?"y":"
")};10.14.3E=l(7A){h 5F=W U(f.1g,(7A||"")+f.5E());c(f.1C){5F.1C={1g:f.1C.1g,2m:f.1C.2m?f.1C.2m.17(0):v}}q 5F};10.14.2n=l(90,z){q f.T(z)};10.14.9b=l(9h,8c){q f.T(8c[0])};U.5P=l(57,5e){h 55="/"+57+"/"+(5e||"");q U.5P[55]||(U.5P[55]=W U(57,5e))};U.41=l(z){q z.E(/[-[\\]{}()*+?.\\\\^$|,#\\s]/g,"\\\\$&")};U.8g=l(z,G,11,1j,2R){h 2R=2R||{},2P=2R.7D,12=2R.c5,1j=1j||"",5r=1j.Y("g")>-1,70=1j.Y("i")>-1,7v=1j.Y("m")>-1,5a=1j.Y("y")>-1,1j=1j.E(/y/g,""),G=G 68 10?(G.3l?G:G.3E("g")):W U(G,"g"+1j),11=11 68 10?(11.3l?11:11.3E("g")):W U(11,"g"+1j),1M=[],2o=0,1u=0,1t=0,1z=0,2b,2c,1B,1K,3Q,48;c(2P){c(2P.u>1){3H aC("4y\'t 4C aL aJ 7u 41 7B")}c(7v){3H 7r("4y\'t 4C 41 7B 8z bi b8 8F b7")}3Q=U.41(2P);48=W 10("^(?:"+3Q+"[\\\\S\\\\s]|(?:(?!"+G.1g+"|"+11.1g+")[^"+3Q+"])+)+",70?"i":"")}2j(I){G.O=11.O=1t+(2P?(48.T(z.17(1t))||[""])[0].u:0);1B=G.T(z);1K=11.T(z);c(1B&&1K){c(1B.H<=1K.H){1K=v}F{1B=v}}c(1B||1K){1u=(1B||1K).H;1t=(1B?G:11).O}F{c(!2o){2h}}c(5a&&!2o&&1u>1z){2h}c(1B){c(!2o++){2b=1u;2c=1t}}F{c(1K&&2!
o){c(!--2o){c(12){c(12[0]&&2b>1z){1M.K([12[0],z.17(1z,2b),1z,2b])}c(12[1]){1M.K([12[1],z.17(2b,2c),2b,2c])}c(12[2]){1M.K([12[2],z.17(2c,1u),2c,1u])}c(12[3]){1M.K([12[3],z.17(1u,1t),1u,1t])}}F{1M.K(z.17(2c,1u))}1z=1t;c(!5r){2h}}}F{G.O=11.O=0;3H bP("8L aq 9r ar 8Z")}}c(1u===1t){1t++}}c(5r&&!5a&&12&&12[0]&&z.u>1z){1M.K([12[0],z.17(1z),1z,z.u])}G.O=11.O=0;q 1M};',62,768,'||||||||||||if|||this||var||||function||||sh|return||||length|null||||str|div|utils|code|for|replace|else|left|index|true|_121|push|className|config|false|lastIndex||document|name||exec|XRegExp|getParam|new|lt|indexOf|gt|RegExp|_139|vN|part|prototype|||slice|pos|_d3|css|_11f|create|right|_119|strings|source|_129|bar|_13a|id|script|style|_da|_d6|lines|window|vars|class|_145|_144|_b5|toolbar|_f4|_103|_146|alert|_149|_x|_c3|params|lib|obj|tab|highlight|continue|_14a|html|_142|doc|_11a|split|innerHTML|test|_ec|_5a|_5b|in|_4f|text|_8|_3c|_91|_98|createElement|_e7|value|_c5|width|href|_c2|substr|min|_147|_148|brushes!
|height|_6e|_cd|break|attributes|while|_be|_75|captureNames|ca!
ll|_143|
appendChild|_bc|_5f|http|concat|toString|_f0|real|_e9|line|execute|wnd|nbsp|matches|getMatches|_66|_e3|trim|_ed|_40|_10f|case|_61|_c1|_55|brush|_13c|size|_13b|_f9|unindent|_d9|_28|_c4|SyntaxHighlighter|_81|_88|_5|m2|_7a|body|_a2|m1|_80|extended|len|font|_fe|gm|_fd|fixInputString|Math|color|gutter|_4e|title|undefined|com|global|printFrame|_ef|_7d|_125|_118|_ee|_8e|print|_e5|_11e|_7b|_32|_49|_cc|offsetMatches|_7c|_25|write|addFlags|td|_104|throw|htmlScript|_22|regex|_a7|_124|_af|_2|_c6|_14b|_b6|_b4|_3|substring|_60|_76|_6a|DIV|_10b|isNaN|escape|_62|url|_7e|_6b|eachLine|_ae|esc|_47|HtmlScript|_b2|values|_8c|gi|_89|_b9|object|_b0|_ad|_blank|_e1|xmlBrush|link|close|removeChild|_b3|type|_a6|_73|findBrush|Match|top|_9d|can|popup|_c8|_53|supply|_a3|win|focus|span|_54|_9e|_50|_cb|_4d|_d7|_5d|getElementsByTagName|_6c|_ba|_b8|_bf|useScriptTags|_82|_ea|_ce|func|_d0|discoveredBrushes||_4c|_f6|show|pre|key|_29|_133|hide|regexList|_141|_19|_1a|viewSource|_134|_2b|originalCode|wrap|copyToCl!
ipboard|highlighterId|toolbarItemHeight|toolbarItemWidth|_2a|_2c|_2e|_2d|expandSource|_13e|_4|_7|from|item|charAt|www|r2|_11d|join|quantifier|_113|_e|getNativeFlags|_12e|_17|_18|String|_10|_b|_9|_f|_d|collapsed|cache|contentWindow|_101|_ff|_fb|swf|_30|getBrushNameCss|_fa|brushName|_100|_f5|_37|_35|content|_24|_38|collapse|_2f|instanceof|clipboardSwf|_27|defaults|merge|guid|syntaxhighlighter|highlighters|toolbarCommands|2009|_6|500px|measureSpace|_78|createButton|message|_79|clipboard|to|0px|_85|decoration|center|_83|margin|w3|rel|head|stylesheet|org|help|xhtml1|_3f|0099FF|align|DTD|alexgorbatchev|copyStyles|navigator|none|executeCommand|_3e|version|toLowerCase|_5e|_1e|_65|noBrush|switch|flash|_52|screen|event|attachEvent|_13f|shockwave|_4b|_48|clipboardData|px|commandName|aboutDialog|copyToClipboardConfirmation|_84|scrollbars|_14|_36|items|_6d|_16|_13|_15|_12|_a|userAgent|_d8|unicode|_d5|_112|process|get|TypeError|_de|_dd|one|_140|_d1|brushNotHtmlScript|parentNode|pP|_12d|c!
haracter|addEvent|escapeChar|_106|_f7|_c9|_c7|Highlighter|_df|!
decorate
|table|_11c|_f1|plain|_f8|classLeft|_11b|classRight|tr|_f2|padNumber|numbers|typeof|_e2|_e0|toBoolean|_e4|matchesSortCallback|pad|first|parseInt|removeNestedMatches|match|light|tabs|processSmartTabs|processTabs|args|smart|toArray|stripBrs|matchRecursive|regexLib|findMatches|arguments|auto|links|processUrls|defaultAdd|_a9|_a8|_a1|_a4|tagName|createDisplayLines|debug|getSyntaxHighlighterScriptTags|_93|insertSpaces|processMatches|when|_90|bloggerMode|trimFirstAndLastLines|_9a|_b7|multiline|_117|parseParams|stripCData|_bd|Copyright|subject|Alex|2004|development|_1c|keep|donate|Gorbatchev|_1b|syntax|JavaScript|active|highlighter|multiLineSingleQuotedString|delimiters|_12f|string|scriptScriptTags|aspScriptTags|another|constructing|sgi|try|catch|replaceVar|flags|apply|phpScriptTags|singleLineCComments|singleLinePerlComments|getKeywords|multiLineCComments|_131|forHtmlScript|doubleQuotedString|xmlComments|onclick|multiLineDoubleQuotedString|singleQuotedString|spaceWidth|bottom|addPlu!
gin|contains|1999|xmlns|dtd|TR|transitional|xhtml|meta|utf|About|sx|charset|Type|equiv|Content|EN|Transitional|your|now|Can|is|The|view|copy|find|Brush|PUBLIC|W3C|XHTML|DOCTYPE|option|wasn|configured|family|Geneva|you|like|please|If|sticky|October|target|https|paypal|_s|xclick|hosted_button_id|cmd|webscr|cgi|bin|364|4em|background|fff|000|serif|sans|Arial|Helvetica|1em|data|unbalanced|75em|large|xx|ignoreCase|3em|2930402|always|about|_42|sort|SyntaxError|printing|shCore|_43|_44|max|round|than|250|more|500|alt|absolute|error|highlighted|ok|number|amp|setData|printSource|_39|cssText|position|IFRAME|_3b|_1f|random|1000000|_a5|block|CDATA|flag|the|htmlscript|1000|getElementById|getPropertyValue|offsetWidth|getComputedStyle|_99|opera|Array|using|textarea|open|load|Xml|_cf|lastIndexOf|_d4|all||replaceChild|70em|aliases|addEventListener|on|30em|spaces|_3a|flashVars|nogutter|transparent|wmode|allowScriptAccess|_8a|msie|classid|96b8|444553540000|11cf|ae6d|clsid|d27cdb6e|no|Error|loc!
ation|resizable|400|750|_20|_21|menubar|onmouseout|_clipboard|!
applicat
ion|onmouseover|param|_26|codebase|menu|valueNames|movie|cab|swflash|cabs|embed|conf||command|_34|_33|src|_10c|_10a|macromedia|download|highlighter_|pub|important'.split('|'),0,{}))
Added: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shLegacy.js
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shLegacy.js (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/scripts/shLegacy.js 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,30 @@
+/**
+ * SyntaxHighlighter
+ * http://alexgorbatchev.com/
+ *
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
+ * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
+ *
+ * @version
+ * 2.1.364 (October 15 2009)
+ *
+ * @copyright
+ * Copyright (C) 2004-2009 Alex Gorbatchev.
+ *
+ * @license
+ * This file is part of SyntaxHighlighter.
+ *
+ * SyntaxHighlighter is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SyntaxHighlighter is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
+ */
+eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('1 y={d:{}};y.d={F:6(S,l,q,k,m,n){6 J(z,Y){1 V=16 15("^"+Y+"\\\\[(?<o>\\\\w+)\\\\]$","14"),x=2;h(1 i=0;i<z.g;i++){7((x=V.17(z[i]))!=2){4 x.o}}4 2};6 3(r,U){4 r!=2?r:U};6 9(s){4 s!=2?s.13():2};1 f=S.18(":"),E=f[0],c={},u={"p":"p"};C={"p":"1a"},v=2,5=d.5;h(1 i 19 f){c[f[i]]="p"}l=9(3(l,5.O));q=9(3(q,5.T));k=9(3(k,5.A));n=9(3(n,5.W));m=9(3(m,5["K-L"]));v={1b:E,O:3(C[c.12],l),T:3(C[c.1g],q),A:3(u[c.A],k),W:3(u[c.1t],n),"K-L":3(J(f,"1q"),m)};4 v},1x:6(B,I,D,H,N,M){6 Z(){1 a=1r;h(1 i=0;i<a.g;i++){7(a[i]===2){10}7(G(a[i])=="1s"&&a[i]!=""){4 a[i]+""}7(G(a[i])=="1c"&&a[i].o!=""){4 a[i].o+""}}4 2};6 t(Q,R,11){1 j=1w.1v(11);h(1 i=0;i<j.g;i++){7(j[i].1u("1p")==R)!
{Q.1n(j[i])}}};1 b=[],1o=2,1f={},1e="1d";t(b,B,"1h");t(b,B,"1i");7(b.g===0){4}h(1 i=0;i<b.g;i++){1 8=b[i],e=Z(8.X["1m"],8.1l,8.X["P"],8.P),1k="";7(e===2){10}e=y.d.F(e,I,D,H,N,M);d.1j(e,8)}}};',62,96,'|var|null|defaultValue|return|defaults|function|if|_26|asString||_21|_11|SyntaxHighlighter|_27|_f|length|for||_1f|_4|_2|_5|_6|value|true|_3|_c|_e|findTagsByName|_12|result||_a|dp|_7|collapse|_14|reverse|_16|_10|parseParams|typeof|_17|_15|getValue|first|line|_19|_18|gutter|language|_1c|_1d|_1|toolbar|_d|_9|ruler|attributes|_8|findValue|continue|_1e|nogutter|toString|gi|XRegExp|new|exec|split|in|false|brush|object|innerHTML|_24|_23|nocontrols|pre|textarea|highlight|_28|className|class|push|_22|name|firstline|arguments|string|showcolumns|getAttribute|getElementsByTagName|document|HighlightAll'.split('|'),0,{}))
Added: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/src/shCore.js
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/src/shCore.js (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/src/shCore.js 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,2077 @@
+/**
+ * SyntaxHighlighter
+ * http://alexgorbatchev.com/
+ *
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
+ * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
+ *
+ * @version
+ * 2.1.364 (October 15 2009)
+ *
+ * @copyright
+ * Copyright (C) 2004-2009 Alex Gorbatchev.
+ *
+ * @license
+ * This file is part of SyntaxHighlighter.
+ *
+ * SyntaxHighlighter is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SyntaxHighlighter is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
+ */
+//
+// Begin anonymous function. This is used to contain local scope variables without polutting global scope.
+//
+if (!window.SyntaxHighlighter) var SyntaxHighlighter = function() {
+
+// Shortcut object which will be assigned to the SyntaxHighlighter variable.
+// This is a shorthand for local reference in order to avoid long namespace
+// references to SyntaxHighlighter.whatever...
+var sh = {
+ defaults : {
+ /** Additional CSS class names to be added to highlighter elements. */
+ 'class-name' : '',
+
+ /** First line number. */
+ 'first-line' : 1,
+
+ /**
+ * Pads line numbers. Possible values are:
+ *
+ * false - don't pad line numbers.
+ * true - automaticaly pad numbers with minimum required number of leading zeroes.
+ * [int] - length up to which pad line numbers.
+ */
+ 'pad-line-numbers' : true,
+
+ /** Lines to highlight. */
+ 'highlight' : null,
+
+ /** Enables or disables smart tabs. */
+ 'smart-tabs' : true,
+
+ /** Gets or sets tab size. */
+ 'tab-size' : 4,
+
+ /** Enables or disables gutter. */
+ 'gutter' : true,
+
+ /** Enables or disables toolbar. */
+ 'toolbar' : true,
+
+ /** Forces code view to be collapsed. */
+ 'collapse' : false,
+
+ /** Enables or disables automatic links. */
+ 'auto-links' : true,
+
+ /** Gets or sets light mode. Equavalent to turning off gutter and toolbar. */
+ 'light' : false,
+
+ /** Enables or disables automatic line wrapping. */
+ 'wrap-lines' : true,
+
+ 'html-script' : false
+ },
+
+ config : {
+ /** Enables use of <SCRIPT type="syntaxhighlighter" /> tags. */
+ useScriptTags : true,
+
+ /** Path to the copy to clipboard SWF file. */
+ clipboardSwf : null,
+
+ /** Width of an item in the toolbar. */
+ toolbarItemWidth : 16,
+
+ /** Height of an item in the toolbar. */
+ toolbarItemHeight : 16,
+
+ /** Blogger mode flag. */
+ bloggerMode : false,
+
+ stripBrs : false,
+
+ /** Name of the tag that SyntaxHighlighter will automatically look for. */
+ tagName : 'pre',
+
+ strings : {
+ expandSource : 'show source',
+ viewSource : 'view source',
+ copyToClipboard : 'copy to clipboard',
+ copyToClipboardConfirmation : 'The code is in your clipboard now',
+ print : 'print',
+ help : '?',
+ alert: 'SyntaxHighlighter\n\n',
+ noBrush : 'Can\'t find brush for: ',
+ brushNotHtmlScript : 'Brush wasn\'t configured for html-script option: ',
+
+ // this is populated by the build script
+ aboutDialog : '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>About SyntaxHighlighter</title></head><body style="font-family:Geneva,Arial,Helvetica,sans-serif;background-color:#fff;color:#000;font-size:1em;text-align:center;"><div style="text-align:center;margin-top:3em;"><div style="font-size:xx-large;">SyntaxHighlighter</div><div style="font-size:.75em;margin-bottom:4em;"><div>version 2.1.364 (October 15 2009)</div><div><a href="http://alexgorbatchev.com" target="_blank" style="color:#0099FF;text-decoration:none;">http://alexgorbatchev.com</a></div><div>If you like this script, please <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2930402" style="color:#0099FF;text-decoration:none;">donate</a> to keep development active!</div></div><div>JavaSc!
ript code syntax highlighter.</div><div>Copyright 2004-2009 Alex Gorbatchev.</div></div></body></html>'
+ },
+
+ /** If true, output will show HTML produces instead. */
+ debug : false
+ },
+
+ /** Internal 'global' variables. */
+ vars : {
+ discoveredBrushes : null,
+ spaceWidth : null,
+ printFrame : null,
+ highlighters : {}
+ },
+
+ /** This object is populated by user included external brush files. */
+ brushes : {},
+
+ /** Common regular expressions. */
+ regexLib : {
+ multiLineCComments : /\/\*[\s\S]*?\*\//gm,
+ singleLineCComments : /\/\/.*$/gm,
+ singleLinePerlComments : /#.*$/gm,
+ doubleQuotedString : /"([^\\"\n]|\\.)*"/g,
+ singleQuotedString : /'([^\\'\n]|\\.)*'/g,
+ multiLineDoubleQuotedString : /"([^\\"]|\\.)*"/g,
+ multiLineSingleQuotedString : /'([^\\']|\\.)*'/g,
+ xmlComments : /(<|<)!--[\s\S]*?--(>|>)/gm,
+ url : /<\w+:\/\/[\w-.\/?%&=@:;]*>|\w+:\/\/[\w-.\/?%&=@:;]*/g,
+
+ /** <?= ?> tags. */
+ phpScriptTags : { left: /(<|<)\?=?/g, right: /\?(>|>)/g },
+
+ /** <%= %> tags. */
+ aspScriptTags : { left: /(<|<)%=?/g, right: /%(>|>)/g },
+
+ /** <script></script> tags. */
+ scriptScriptTags : { left: /(<|<)\s*script.*?(>|>)/gi, right: /(<|<)\/\s*script\s*(>|>)/gi }
+ },
+
+ toolbar : {
+ /**
+ * Creates new toolbar for a highlighter.
+ * @param {Highlighter} highlighter Target highlighter.
+ */
+ create : function(highlighter)
+ {
+ var div = document.createElement('DIV'),
+ items = sh.toolbar.items
+ ;
+
+ div.className = 'toolbar';
+
+ for (var name in items)
+ {
+ var constructor = items[name],
+ command = new constructor(highlighter),
+ element = command.create()
+ ;
+
+ highlighter.toolbarCommands[name] = command;
+
+ if (element == null)
+ continue;
+
+ if (typeof(element) == 'string')
+ element = sh.toolbar.createButton(element, highlighter.id, name);
+
+ element.className += 'item ' + name;
+ div.appendChild(element);
+ }
+
+ return div;
+ },
+
+ /**
+ * Create a standard anchor button for the toolbar.
+ * @param {String} label Label text to display.
+ * @param {String} highlighterId Highlighter ID that this button would belong to.
+ * @param {String} commandName Command name that would be executed.
+ * @return {Element} Returns an 'A' element.
+ */
+ createButton : function(label, highlighterId, commandName)
+ {
+ var a = document.createElement('a'),
+ style = a.style,
+ config = sh.config,
+ width = config.toolbarItemWidth,
+ height = config.toolbarItemHeight
+ ;
+
+ a.href = '#' + commandName;
+ a.title = label;
+ a.highlighterId = highlighterId;
+ a.commandName = commandName;
+ a.innerHTML = label;
+
+ if (isNaN(width) == false)
+ style.width = width + 'px';
+
+ if (isNaN(height) == false)
+ style.height = height + 'px';
+
+ a.onclick = function(e)
+ {
+ try
+ {
+ sh.toolbar.executeCommand(
+ this,
+ e || window.event,
+ this.highlighterId,
+ this.commandName
+ );
+ }
+ catch(e)
+ {
+ sh.utils.alert(e.message);
+ }
+
+ return false;
+ };
+
+ return a;
+ },
+
+ /**
+ * Executes a toolbar command.
+ * @param {Element} sender Sender element.
+ * @param {MouseEvent} event Original mouse event object.
+ * @param {String} highlighterId Highlighter DIV element ID.
+ * @param {String} commandName Name of the command to execute.
+ * @return {Object} Passes out return value from command execution.
+ */
+ executeCommand : function(sender, event, highlighterId, commandName, args)
+ {
+ var highlighter = sh.vars.highlighters[highlighterId],
+ command
+ ;
+
+ if (highlighter == null || (command = highlighter.toolbarCommands[commandName]) == null)
+ return null;
+
+ return command.execute(sender, event, args);
+ },
+
+ /** Collection of toolbar items. */
+ items : {
+ expandSource : function(highlighter)
+ {
+ this.create = function()
+ {
+ if (highlighter.getParam('collapse') != true)
+ return;
+
+ return sh.config.strings.expandSource;
+ };
+
+ this.execute = function(sender, event, args)
+ {
+ var div = highlighter.div;
+
+ sender.parentNode.removeChild(sender);
+ div.className = div.className.replace('collapsed', '');
+ };
+ },
+
+ /**
+ * Command to open a new window and display the original unformatted source code inside.
+ */
+ viewSource : function(highlighter)
+ {
+ this.create = function()
+ {
+ return sh.config.strings.viewSource;
+ };
+
+ this.execute = function(sender, event, args)
+ {
+ var code = sh.utils.fixInputString(highlighter.originalCode).replace(/</g, '<'),
+ wnd = sh.utils.popup('', '_blank', 750, 400, 'location=0, resizable=1, menubar=0, scrollbars=1')
+ ;
+
+ code = sh.utils.unindent(code);
+
+ wnd.document.write('<pre>' + code + '</pre>');
+ wnd.document.close();
+ };
+ },
+
+ /**
+ * Command to copy the original source code in to the clipboard.
+ * Uses Flash method if <code>clipboardSwf</code> is configured.
+ */
+ copyToClipboard : function(highlighter)
+ {
+ var flashDiv, flashSwf,
+ highlighterId = highlighter.id
+ ;
+
+ this.create = function()
+ {
+ var config = sh.config;
+
+ // disable functionality if running locally
+ if (config.clipboardSwf == null)
+ return null;
+
+ function params(list)
+ {
+ var result = '';
+
+ for (var name in list)
+ result += "<param name='" + name + "' value='" + list[name] + "'/>";
+
+ return result;
+ };
+
+ function attributes(list)
+ {
+ var result = '';
+
+ for (var name in list)
+ result += " " + name + "='" + list[name] + "'";
+
+ return result;
+ };
+
+ var args1 = {
+ width : config.toolbarItemWidth,
+ height : config.toolbarItemHeight,
+ id : highlighterId + '_clipboard',
+ type : 'application/x-shockwave-flash',
+ title : sh.config.strings.copyToClipboard
+ },
+
+ // these arguments are used in IE's <param /> collection
+ args2 = {
+ allowScriptAccess : 'always',
+ wmode : 'transparent',
+ flashVars : 'highlighterId=' + highlighterId,
+ menu : 'false'
+ },
+ swf = config.clipboardSwf,
+ html
+ ;
+
+ if (/msie/i.test(navigator.userAgent))
+ {
+ html = '<object'
+ + attributes({
+ classid : 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000',
+ codebase : 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#versi...'
+ })
+ + attributes(args1)
+ + '>'
+ + params(args2)
+ + params({ movie : swf })
+ + '</object>'
+ ;
+ }
+ else
+ {
+ html = '<embed'
+ + attributes(args1)
+ + attributes(args2)
+ + attributes({ src : swf })
+ + '/>'
+ ;
+ }
+
+ flashDiv = document.createElement('div');
+ flashDiv.innerHTML = html;
+
+ return flashDiv;
+ };
+
+ this.execute = function(sender, event, args)
+ {
+ var command = args.command;
+
+ switch (command)
+ {
+ case 'get':
+ var code = sh.utils.unindent(
+ sh.utils.fixInputString(highlighter.originalCode)
+ .replace(/</g, '<')
+ .replace(/>/g, '>')
+ .replace(/&/g, '&')
+ );
+
+ if(window.clipboardData)
+ // will fall through to the confirmation because there isn't a break
+ window.clipboardData.setData('text', code);
+ else
+ return sh.utils.unindent(code);
+
+ case 'ok':
+ sh.utils.alert(sh.config.strings.copyToClipboardConfirmation);
+ break;
+
+ case 'error':
+ sh.utils.alert(args.message);
+ break;
+ }
+ };
+ },
+
+ /** Command to print the colored source code. */
+ printSource : function(highlighter)
+ {
+ this.create = function()
+ {
+ return sh.config.strings.print;
+ };
+
+ this.execute = function(sender, event, args)
+ {
+ var iframe = document.createElement('IFRAME'),
+ doc = null
+ ;
+
+ // make sure there is never more than one hidden iframe created by SH
+ if (sh.vars.printFrame != null)
+ document.body.removeChild(sh.vars.printFrame);
+
+ sh.vars.printFrame = iframe;
+
+ // this hides the iframe
+ iframe.style.cssText = 'position:absolute;width:0px;height:0px;left:-500px;top:-500px;';
+
+ document.body.appendChild(iframe);
+ doc = iframe.contentWindow.document;
+
+ copyStyles(doc, window.document);
+ doc.write('<div class="' + highlighter.div.className.replace('collapsed', '') + ' printing">' + highlighter.div.innerHTML + '</div>');
+ doc.close();
+
+ iframe.contentWindow.focus();
+ iframe.contentWindow.print();
+
+ function copyStyles(destDoc, sourceDoc)
+ {
+ var links = sourceDoc.getElementsByTagName('link');
+
+ for(var i = 0; i < links.length; i++)
+ if(links[i].rel.toLowerCase() == 'stylesheet' && /shCore\.css$/.test(links[i].href))
+ destDoc.write('<link type="text/css" rel="stylesheet" href="' + links[i].href + '"></link>');
+ };
+ };
+ },
+
+ /** Command to display the about dialog window. */
+ about : function(highlighter)
+ {
+ this.create = function()
+ {
+ return sh.config.strings.help;
+ };
+
+ this.execute = function(sender, event)
+ {
+ var wnd = sh.utils.popup('', '_blank', 500, 250, 'scrollbars=0'),
+ doc = wnd.document
+ ;
+
+ doc.write(sh.config.strings.aboutDialog);
+ doc.close();
+ wnd.focus();
+ };
+ }
+ }
+ },
+
+ utils : {
+ /**
+ * Finds an index of element in the array.
+ * @ignore
+ * @param {Object} searchElement
+ * @param {Number} fromIndex
+ * @return {Number} Returns index of element if found; -1 otherwise.
+ */
+ indexOf : function(array, searchElement, fromIndex)
+ {
+ fromIndex = Math.max(fromIndex || 0, 0);
+
+ for (var i = fromIndex; i < array.length; i++)
+ if(array[i] == searchElement)
+ return i;
+
+ return -1;
+ },
+
+ /**
+ * Generates a unique element ID.
+ */
+ guid : function(prefix)
+ {
+ return prefix + Math.round(Math.random() * 1000000).toString();
+ },
+
+ /**
+ * Merges two objects. Values from obj2 override values in obj1.
+ * Function is NOT recursive and works only for one dimensional objects.
+ * @param {Object} obj1 First object.
+ * @param {Object} obj2 Second object.
+ * @return {Object} Returns combination of both objects.
+ */
+ merge: function(obj1, obj2)
+ {
+ var result = {}, name;
+
+ for (name in obj1)
+ result[name] = obj1[name];
+
+ for (name in obj2)
+ result[name] = obj2[name];
+
+ return result;
+ },
+
+ /**
+ * Attempts to convert string to boolean.
+ * @param {String} value Input string.
+ * @return {Boolean} Returns true if input was "true", false if input was "false" and value otherwise.
+ */
+ toBoolean: function(value)
+ {
+ switch (value)
+ {
+ case "true":
+ return true;
+
+ case "false":
+ return false;
+ }
+
+ return value;
+ },
+
+ /**
+ * Opens up a centered popup window.
+ * @param {String} url URL to open in the window.
+ * @param {String} name Popup name.
+ * @param {int} width Popup width.
+ * @param {int} height Popup height.
+ * @param {String} options window.open() options.
+ * @return {Window} Returns window instance.
+ */
+ popup: function(url, name, width, height, options)
+ {
+ var x = (screen.width - width) / 2,
+ y = (screen.height - height) / 2
+ ;
+
+ options += ', left=' + x +
+ ', top=' + y +
+ ', width=' + width +
+ ', height=' + height
+ ;
+ options = options.replace(/^,/, '');
+
+ var win = window.open(url, name, options);
+ win.focus();
+ return win;
+ },
+
+ /**
+ * Adds event handler to the target object.
+ * @param {Object} obj Target object.
+ * @param {String} type Name of the event.
+ * @param {Function} func Handling function.
+ */
+ addEvent: function(obj, type, func)
+ {
+ if (obj.attachEvent)
+ {
+ obj['e' + type + func] = func;
+ obj[type + func] = function()
+ {
+ obj['e' + type + func](window.event);
+ }
+ obj.attachEvent('on' + type, obj[type + func]);
+ }
+ else
+ {
+ obj.addEventListener(type, func, false);
+ }
+ },
+
+ /**
+ * Displays an alert.
+ * @param {String} str String to display.
+ */
+ alert: function(str)
+ {
+ alert(sh.config.strings.alert + str)
+ },
+
+ /**
+ * Finds a brush by its alias.
+ *
+ * @param {String} alias Brush alias.
+ * @param {Boolean} alert Suppresses the alert if false.
+ * @return {Brush} Returns bursh constructor if found, null otherwise.
+ */
+ findBrush: function(alias, alert)
+ {
+ var brushes = sh.vars.discoveredBrushes,
+ result = null
+ ;
+
+ if (brushes == null)
+ {
+ brushes = {};
+
+ // Find all brushes
+ for (var brush in sh.brushes)
+ {
+ var aliases = sh.brushes[brush].aliases;
+
+ if (aliases == null)
+ continue;
+
+ // keep the brush name
+ sh.brushes[brush].name = brush.toLowerCase();
+
+ for (var i = 0; i < aliases.length; i++)
+ brushes[aliases[i]] = brush;
+ }
+
+ sh.vars.discoveredBrushes = brushes;
+ }
+
+ result = sh.brushes[brushes[alias]];
+
+ if (result == null && alert != false)
+ sh.utils.alert(sh.config.strings.noBrush + alias);
+
+ return result;
+ },
+
+ /**
+ * Executes a callback on each line and replaces each line with result from the callback.
+ * @param {Object} str Input string.
+ * @param {Object} callback Callback function taking one string argument and returning a string.
+ */
+ eachLine: function(str, callback)
+ {
+ var lines = str.split('\n');
+
+ for (var i = 0; i < lines.length; i++)
+ lines[i] = callback(lines[i]);
+
+ return lines.join('\n');
+ },
+
+ /**
+ * This is a special trim which only removes first and last empty lines
+ * and doesn't affect valid leading space on the first line.
+ *
+ * @param {String} str Input string
+ * @return {String} Returns string without empty first and last lines.
+ */
+ trimFirstAndLastLines: function(str)
+ {
+ return str.replace(/^[ ]*[\n]+|[\n]*[ ]*$/g, '');
+ },
+
+ /**
+ * Parses key/value pairs into hash object.
+ *
+ * Understands the following formats:
+ * - name: word;
+ * - name: [word, word];
+ * - name: "string";
+ * - name: 'string';
+ *
+ * For example:
+ * name1: value; name2: [value, value]; name3: 'value'
+ *
+ * @param {String} str Input string.
+ * @return {Object} Returns deserialized object.
+ */
+ parseParams: function(str)
+ {
+ var match,
+ result = {},
+ arrayRegex = new XRegExp("^\\[(?<values>(.*?))\\]$"),
+ regex = new XRegExp(
+ "(?<name>[\\w-]+)" +
+ "\\s*:\\s*" +
+ "(?<value>" +
+ "[\\w-%#]+|" + // word
+ "\\[.*?\\]|" + // [] array
+ '".*?"|' + // "" string
+ "'.*?'" + // '' string
+ ")\\s*;?",
+ "g"
+ )
+ ;
+
+ while ((match = regex.exec(str)) != null)
+ {
+ var value = match.value
+ .replace(/^['"]|['"]$/g, '') // strip quotes from end of strings
+ ;
+
+ // try to parse array value
+ if (value != null && arrayRegex.test(value))
+ {
+ var m = arrayRegex.exec(value);
+ value = m.values.length > 0 ? m.values.split(/\s*,\s*/) : [];
+ }
+
+ result[match.name] = value;
+ }
+
+ return result;
+ },
+
+ /**
+ * Wraps each line of the string into <code/> tag with given style applied to it.
+ *
+ * @param {String} str Input string.
+ * @param {String} css Style name to apply to the string.
+ * @return {String} Returns input string with each line surrounded by <span/> tag.
+ */
+ decorate: function(str, css)
+ {
+ if (str == null || str.length == 0 || str == '\n')
+ return str;
+
+ str = str.replace(/</g, '<');
+
+ // Replace two or more sequential spaces with leaving last space untouched.
+ str = str.replace(/ {2,}/g, function(m)
+ {
+ var spaces = '';
+
+ for (var i = 0; i < m.length - 1; i++)
+ spaces += ' ';
+
+ return spaces + ' ';
+ });
+
+ // Split each line and apply <span class="...">...</span> to them so that
+ // leading spaces aren't included.
+ if (css != null)
+ str = sh.utils.eachLine(str, function(line)
+ {
+ if (line.length == 0)
+ return '';
+
+ var spaces = '';
+
+ line = line.replace(/^( | )+/, function(s)
+ {
+ spaces = s;
+ return '';
+ });
+
+ if (line.length == 0)
+ return spaces;
+
+ return spaces + '<code class="' + css + '">' + line + '</code>';
+ });
+
+ return str;
+ },
+
+ /**
+ * Pads number with zeros until it's length is the same as given length.
+ *
+ * @param {Number} number Number to pad.
+ * @param {Number} length Max string length with.
+ * @return {String} Returns a string padded with proper amount of '0'.
+ */
+ padNumber : function(number, length)
+ {
+ var result = number.toString();
+
+ while (result.length < length)
+ result = '0' + result;
+
+ return result;
+ },
+
+ /**
+ * Measures width of a single space character.
+ * @return {Number} Returns width of a single space character.
+ */
+ measureSpace : function()
+ {
+ var container = document.createElement('div'),
+ span,
+ result = 0,
+ body = document.body,
+ id = sh.utils.guid('measureSpace'),
+
+ // variable names will be compressed, so it's better than a plain string
+ divOpen = '<div class="',
+ closeDiv = '</div>',
+ closeSpan = '</span>'
+ ;
+
+ // we have to duplicate highlighter nested structure in order to get an acurate space measurment
+ container.innerHTML =
+ divOpen + 'syntaxhighlighter">'
+ + divOpen + 'lines">'
+ + divOpen + 'line">'
+ + divOpen + 'content'
+ + '"><span class="block"><span id="' + id + '"> ' + closeSpan + closeSpan
+ + closeDiv
+ + closeDiv
+ + closeDiv
+ + closeDiv
+ ;
+
+ body.appendChild(container);
+ span = document.getElementById(id);
+
+ if (/opera/i.test(navigator.userAgent))
+ {
+ var style = window.getComputedStyle(span, null);
+ result = parseInt(style.getPropertyValue("width"));
+ }
+ else
+ {
+ result = span.offsetWidth;
+ }
+
+ body.removeChild(container);
+
+ return result;
+ },
+
+ /**
+ * Replaces tabs with spaces.
+ *
+ * @param {String} code Source code.
+ * @param {Number} tabSize Size of the tab.
+ * @return {String} Returns code with all tabs replaces by spaces.
+ */
+ processTabs : function(code, tabSize)
+ {
+ var tab = '';
+
+ for (var i = 0; i < tabSize; i++)
+ tab += ' ';
+
+ return code.replace(/\t/g, tab);
+ },
+
+ /**
+ * Replaces tabs with smart spaces.
+ *
+ * @param {String} code Code to fix the tabs in.
+ * @param {Number} tabSize Number of spaces in a column.
+ * @return {String} Returns code with all tabs replaces with roper amount of spaces.
+ */
+ processSmartTabs : function(code, tabSize)
+ {
+ var lines = code.split('\n'),
+ tab = '\t',
+ spaces = ''
+ ;
+
+ // Create a string with 1000 spaces to copy spaces from...
+ // It's assumed that there would be no indentation longer than that.
+ for (var i = 0; i < 50; i++)
+ spaces += ' '; // 20 spaces * 50
+
+ // This function inserts specified amount of spaces in the string
+ // where a tab is while removing that given tab.
+ function insertSpaces(line, pos, count)
+ {
+ return line.substr(0, pos)
+ + spaces.substr(0, count)
+ + line.substr(pos + 1, line.length) // pos + 1 will get rid of the tab
+ ;
+ };
+
+ // Go through all the lines and do the 'smart tabs' magic.
+ code = sh.utils.eachLine(code, function(line)
+ {
+ if (line.indexOf(tab) == -1)
+ return line;
+
+ var pos = 0;
+
+ while ((pos = line.indexOf(tab)) != -1)
+ {
+ // This is pretty much all there is to the 'smart tabs' logic.
+ // Based on the position within the line and size of a tab,
+ // calculate the amount of spaces we need to insert.
+ var spaces = tabSize - pos % tabSize;
+ line = insertSpaces(line, pos, spaces);
+ }
+
+ return line;
+ });
+
+ return code;
+ },
+
+ /**
+ * Performs various string fixes based on configuration.
+ */
+ fixInputString : function(str)
+ {
+ var br = /<br\s*\/?>|<br\s*\/?>/gi;
+
+ if (sh.config.bloggerMode == true)
+ str = str.replace(br, '\n');
+
+ if (sh.config.stripBrs == true)
+ str = str.replace(br, '');
+
+ return str;
+ },
+
+ /**
+ * Removes all white space at the begining and end of a string.
+ *
+ * @param {String} str String to trim.
+ * @return {String} Returns string without leading and following white space characters.
+ */
+ trim: function(str)
+ {
+ return str.replace(/^\s+|\s+$/g, '');
+ },
+
+ /**
+ * Unindents a block of text by the lowest common indent amount.
+ * @param {String} str Text to unindent.
+ * @return {String} Returns unindented text block.
+ */
+ unindent: function(str)
+ {
+ var lines = sh.utils.fixInputString(str).split('\n'),
+ indents = new Array(),
+ regex = /^\s*/,
+ min = 1000
+ ;
+
+ // go through every line and check for common number of indents
+ for (var i = 0; i < lines.length && min > 0; i++)
+ {
+ var line = lines[i];
+
+ if (sh.utils.trim(line).length == 0)
+ continue;
+
+ var matches = regex.exec(line);
+
+ // In the event that just one line doesn't have leading white space
+ // we can't unindent anything, so bail completely.
+ if (matches == null)
+ return str;
+
+ min = Math.min(matches[0].length, min);
+ }
+
+ // trim minimum common number of white space from the begining of every line
+ if (min > 0)
+ for (var i = 0; i < lines.length; i++)
+ lines[i] = lines[i].substr(min);
+
+ return lines.join('\n');
+ },
+
+ /**
+ * Callback method for Array.sort() which sorts matches by
+ * index position and then by length.
+ *
+ * @param {Match} m1 Left object.
+ * @param {Match} m2 Right object.
+ * @return {Number} Returns -1, 0 or -1 as a comparison result.
+ */
+ matchesSortCallback: function(m1, m2)
+ {
+ // sort matches by index first
+ if(m1.index < m2.index)
+ return -1;
+ else if(m1.index > m2.index)
+ return 1;
+ else
+ {
+ // if index is the same, sort by length
+ if(m1.length < m2.length)
+ return -1;
+ else if(m1.length > m2.length)
+ return 1;
+ }
+
+ return 0;
+ },
+
+ /**
+ * Executes given regular expression on provided code and returns all
+ * matches that are found.
+ *
+ * @param {String} code Code to execute regular expression on.
+ * @param {Object} regex Regular expression item info from <code>regexList</code> collection.
+ * @return {Array} Returns a list of Match objects.
+ */
+ getMatches: function(code, regexInfo)
+ {
+ function defaultAdd(match, regexInfo)
+ {
+ return [new sh.Match(match[0], match.index, regexInfo.css)];
+ };
+
+ var index = 0,
+ match = null,
+ result = [],
+ func = regexInfo.func ? regexInfo.func : defaultAdd
+ ;
+
+ while((match = regexInfo.regex.exec(code)) != null)
+ result = result.concat(func(match, regexInfo));
+
+ return result;
+ },
+
+ processUrls: function(code)
+ {
+ var lt = '<',
+ gt = '>'
+ ;
+
+ return code.replace(sh.regexLib.url, function(m)
+ {
+ var suffix = '', prefix = '';
+
+ // We include < and > in the URL for the common cases like <http://google.com>
+ // The problem is that they get transformed into <http://google.com>
+ // Where as > easily looks like part of the URL string.
+
+ if (m.indexOf(lt) == 0)
+ {
+ prefix = lt;
+ m = m.substring(lt.length);
+ }
+
+ if (m.indexOf(gt) == m.length - gt.length)
+ {
+ m = m.substring(0, m.length - gt.length);
+ suffix = gt;
+ }
+
+ return prefix + '<a href="' + m + '">' + m + '</a>' + suffix;
+ });
+ },
+
+ /**
+ * Finds all <SCRIPT TYPE="syntaxhighlighter" /> elements.
+ * @return {Array} Returns array of all found SyntaxHighlighter tags.
+ */
+ getSyntaxHighlighterScriptTags: function()
+ {
+ var tags = document.getElementsByTagName('script'),
+ result = []
+ ;
+
+ for (var i = 0; i < tags.length; i++)
+ if (tags[i].type == 'syntaxhighlighter')
+ result.push(tags[i]);
+
+ return result;
+ },
+
+ /**
+ * Strips <![CDATA[]]> from <SCRIPT /> content because it should be used
+ * there in most cases for XHTML compliance.
+ * @param {String} original Input code.
+ * @return {String} Returns code without leading <![CDATA[]]> tags.
+ */
+ stripCData: function(original)
+ {
+ var left = '<![CDATA[',
+ right = ']]>',
+ // for some reason IE inserts some leading blanks here
+ copy = sh.utils.trim(original),
+ changed = false
+ ;
+
+ if (copy.indexOf(left) == 0)
+ {
+ copy = copy.substring(left.length);
+ changed = true;
+ }
+
+ if (copy.indexOf(right) == copy.length - right.length)
+ {
+ copy = copy.substring(0, copy.length - right.length);
+ changed = true;
+ }
+
+ return changed ? copy : original;
+ }
+ }, // end of utils
+
+ /**
+ * Shorthand to highlight all elements on the page that are marked as
+ * SyntaxHighlighter source code.
+ *
+ * @param {Object} globalParams Optional parameters which override element's
+ * parameters. Only used if element is specified.
+ *
+ * @param {Object} element Optional element to highlight. If none is
+ * provided, all elements in the current document
+ * are highlighted.
+ */
+ highlight : function(globalParams, element)
+ {
+ function toArray(source)
+ {
+ var result = [];
+
+ for (var i = 0; i < source.length; i++)
+ result.push(source[i]);
+
+ return result;
+ };
+
+ var elements = element ? [element] : toArray(document.getElementsByTagName(sh.config.tagName)),
+ propertyName = 'innerHTML',
+ highlighter = null,
+ conf = sh.config
+ ;
+
+ // support for <SCRIPT TYPE="syntaxhighlighter" /> feature
+ if (conf.useScriptTags)
+ elements = elements.concat(sh.utils.getSyntaxHighlighterScriptTags());
+
+ if (elements.length === 0)
+ return;
+
+ for (var i = 0; i < elements.length; i++)
+ {
+ var target = elements[i],
+ params = sh.utils.parseParams(target.className),
+ brushName,
+ code,
+ result
+ ;
+
+ // local params take precedence over globals
+ params = sh.utils.merge(globalParams, params);
+ brushName = params['brush'];
+
+ if (brushName == null)
+ continue;
+
+ // Instantiate a brush
+ if (params['html-script'] == 'true' || sh.defaults['html-script'] == true)
+ {
+ highlighter = new sh.HtmlScript(brushName);
+ brushName = 'htmlscript';
+ }
+ else
+ {
+ var brush = sh.utils.findBrush(brushName);
+
+ if (brush)
+ {
+ brushName = brush.name;
+ highlighter = new brush();
+ }
+ else
+ {
+ continue;
+ }
+ }
+
+ code = target[propertyName];
+
+ // remove CDATA from <SCRIPT/> tags if it's present
+ if (conf.useScriptTags)
+ code = sh.utils.stripCData(code);
+
+ params['brush-name'] = brushName;
+ highlighter.highlight(code, params);
+
+ result = highlighter.div;
+
+ if (sh.config.debug)
+ {
+ result = document.createElement('textarea');
+ result.value = highlighter.div.innerHTML;
+ result.style.width = '70em';
+ result.style.height = '30em';
+ }
+
+ target.parentNode.replaceChild(result, target);
+ }
+ },
+
+ /**
+ * Main entry point for the SyntaxHighlighter.
+ * @param {Object} params Optional params to apply to all highlighted elements.
+ */
+ all : function(params)
+ {
+ sh.utils.addEvent(
+ window,
+ 'load',
+ function() { sh.highlight(params); }
+ );
+ }
+}; // end of sh
+
+/**
+ * Match object.
+ */
+sh.Match = function(value, index, css)
+{
+ this.value = value;
+ this.index = index;
+ this.length = value.length;
+ this.css = css;
+ this.brushName = null;
+};
+
+sh.Match.prototype.toString = function()
+{
+ return this.value;
+};
+
+/**
+ * Simulates HTML code with a scripting language embedded.
+ *
+ * @param {String} scriptBrushName Brush name of the scripting language.
+ */
+sh.HtmlScript = function(scriptBrushName)
+{
+ var brushClass = sh.utils.findBrush(scriptBrushName),
+ scriptBrush,
+ xmlBrush = new sh.brushes.Xml(),
+ bracketsRegex = null
+ ;
+
+ if (brushClass == null)
+ return;
+
+ scriptBrush = new brushClass();
+ this.xmlBrush = xmlBrush;
+
+ if (scriptBrush.htmlScript == null)
+ {
+ sh.utils.alert(sh.config.strings.brushNotHtmlScript + scriptBrushName);
+ return;
+ }
+
+ xmlBrush.regexList.push(
+ { regex: scriptBrush.htmlScript.code, func: process }
+ );
+
+ function offsetMatches(matches, offset)
+ {
+ for (var j = 0; j < matches.length; j++)
+ matches[j].index += offset;
+ }
+
+ function process(match, info)
+ {
+ var code = match.code,
+ matches = [],
+ regexList = scriptBrush.regexList,
+ offset = match.index + match.left.length,
+ htmlScript = scriptBrush.htmlScript,
+ result
+ ;
+
+ // add all matches from the code
+ for (var i = 0; i < regexList.length; i++)
+ {
+ result = sh.utils.getMatches(code, regexList[i]);
+ offsetMatches(result, offset);
+ matches = matches.concat(result);
+ }
+
+ // add left script bracket
+ if (htmlScript.left != null && match.left != null)
+ {
+ result = sh.utils.getMatches(match.left, htmlScript.left);
+ offsetMatches(result, match.index);
+ matches = matches.concat(result);
+ }
+
+ // add right script bracket
+ if (htmlScript.right != null && match.right != null)
+ {
+ result = sh.utils.getMatches(match.right, htmlScript.right);
+ offsetMatches(result, match.index + match[0].lastIndexOf(match.right));
+ matches = matches.concat(result);
+ }
+
+ for (var j = 0; j < matches.length; j++)
+ matches[j].brushName = brushClass.name;
+
+ return matches;
+ }
+};
+
+sh.HtmlScript.prototype.highlight = function(code, params)
+{
+ this.xmlBrush.highlight(code, params);
+ this.div = this.xmlBrush.div;
+}
+
+/**
+ * Main Highlither class.
+ * @constructor
+ */
+sh.Highlighter = function()
+{
+};
+
+sh.Highlighter.prototype = {
+ /**
+ * Returns value of the parameter passed to the highlighter.
+ * @param {String} name Name of the parameter.
+ * @param {Object} defaultValue Default value.
+ * @return {Object} Returns found value or default value otherwise.
+ */
+ getParam : function(name, defaultValue)
+ {
+ var result = this.params[name];
+ return sh.utils.toBoolean(result == null ? defaultValue : result);
+ },
+
+ /**
+ * Shortcut to document.createElement().
+ * @param {String} name Name of the element to create (DIV, A, etc).
+ * @return {HTMLElement} Returns new HTML element.
+ */
+ create: function(name)
+ {
+ return document.createElement(name);
+ },
+
+ /**
+ * Applies all regular expression to the code and stores all found
+ * matches in the `this.matches` array.
+ * @param {Array} regexList List of regular expressions.
+ * @param {String} code Source code.
+ * @return {Array} Returns list of matches.
+ */
+ findMatches: function(regexList, code)
+ {
+ var result = [];
+
+ if (regexList != null)
+ for (var i = 0; i < regexList.length; i++)
+ // BUG: length returns len+1 for array if methods added to prototype chain (oising(a)gmail.com)
+ if (typeof (regexList[i]) == "object")
+ result = result.concat(sh.utils.getMatches(code, regexList[i]));
+
+ // sort the matches
+ return result.sort(sh.utils.matchesSortCallback);
+ },
+
+ /**
+ * Checks to see if any of the matches are inside of other matches.
+ * This process would get rid of highligted strings inside comments,
+ * keywords inside strings and so on.
+ */
+ removeNestedMatches: function()
+ {
+ var matches = this.matches;
+
+ // Optimized by Jose Prado (http://joseprado.com)
+ for (var i = 0; i < matches.length; i++)
+ {
+ if (matches[i] === null)
+ continue;
+
+ var itemI = matches[i],
+ itemIEndPos = itemI.index + itemI.length
+ ;
+
+ for (var j = i + 1; j < matches.length && matches[i] !== null; j++)
+ {
+ var itemJ = matches[j];
+
+ if (itemJ === null)
+ continue;
+ else if (itemJ.index > itemIEndPos)
+ break;
+ else if (itemJ.index == itemI.index && itemJ.length > itemI.length)
+ this.matches[i] = null;
+ else if (itemJ.index >= itemI.index && itemJ.index < itemIEndPos)
+ this.matches[j] = null;
+ }
+ }
+ },
+
+ /**
+ * Splits block of text into individual DIV lines.
+ * @param {String} code Code to highlight.
+ * @return {String} Returns highlighted code in HTML form.
+ */
+ createDisplayLines : function(code)
+ {
+ var lines = code.split(/\n/g),
+ firstLine = parseInt(this.getParam('first-line')),
+ padLength = this.getParam('pad-line-numbers'),
+ highlightedLines = this.getParam('highlight', []),
+ hasGutter = this.getParam('gutter')
+ ;
+
+ code = '';
+
+ if (padLength == true)
+ padLength = (firstLine + lines.length - 1).toString().length;
+ else if (isNaN(padLength) == true)
+ padLength = 0;
+
+ for (var i = 0; i < lines.length; i++)
+ {
+ var line = lines[i],
+ indent = /^( |\s)+/.exec(line),
+ lineClass = 'alt' + (i % 2 == 0 ? 1 : 2),
+ lineNumber = sh.utils.padNumber(firstLine + i, padLength),
+ highlighted = sh.utils.indexOf(highlightedLines, (firstLine + i).toString()) != -1,
+ spaces = null
+ ;
+
+ if (indent != null)
+ {
+ spaces = indent[0].toString();
+ line = line.substr(spaces.length);
+ }
+
+ line = sh.utils.trim(line);
+
+ if (line.length == 0)
+ line = ' ';
+
+ if (highlighted)
+ lineClass += ' highlighted';
+
+ code +=
+ '<div class="line ' + lineClass + '">'
+ + '<table>'
+ + '<tr>'
+ + (hasGutter ? '<td class="number"><code>' + lineNumber + '</code></td>' : '')
+ + '<td class="content">'
+ + (spaces != null ? '<code class="spaces">' + spaces.replace(' ', ' ') + '</code>' : '')
+ + line
+ + '</td>'
+ + '</tr>'
+ + '</table>'
+ + '</div>'
+ ;
+ }
+
+ return code;
+ },
+
+ /**
+ * Finds all matches in the source code.
+ * @param {String} code Source code to process matches in.
+ * @param {Array} matches Discovered regex matches.
+ * @return {String} Returns formatted HTML with processed mathes.
+ */
+ processMatches: function(code, matches)
+ {
+ var pos = 0,
+ result = '',
+ decorate = sh.utils.decorate, // make an alias to save some bytes
+ brushName = this.getParam('brush-name', '')
+ ;
+
+ function getBrushNameCss(match)
+ {
+ var result = match ? (match.brushName || brushName) : brushName;
+ return result ? result + ' ' : '';
+ };
+
+ // Finally, go through the final list of matches and pull the all
+ // together adding everything in between that isn't a match.
+ for (var i = 0; i < matches.length; i++)
+ {
+ var match = matches[i],
+ matchBrushName
+ ;
+
+ if (match === null || match.length === 0)
+ continue;
+
+ matchBrushName = getBrushNameCss(match);
+
+ result += decorate(code.substr(pos, match.index - pos), matchBrushName + 'plain')
+ + decorate(match.value, matchBrushName + match.css)
+ ;
+
+ pos = match.index + match.length;
+ }
+
+ // don't forget to add whatever's remaining in the string
+ result += decorate(code.substr(pos), getBrushNameCss() + 'plain');
+
+ return result;
+ },
+
+ /**
+ * Highlights the code and returns complete HTML.
+ * @param {String} code Code to highlight.
+ * @param {Object} params Parameters object.
+ */
+ highlight: function(code, params)
+ {
+ // using variables for shortcuts because JS compressor will shorten local variable names
+ var conf = sh.config,
+ vars = sh.vars,
+ div,
+ divClassName,
+ tabSize,
+ important = 'important'
+ ;
+
+ this.params = {};
+ this.div = null;
+ this.lines = null;
+ this.code = null;
+ this.bar = null;
+ this.toolbarCommands = {};
+ this.id = sh.utils.guid('highlighter_');
+
+ // register this instance in the highlighters list
+ vars.highlighters[this.id] = this;
+
+ if (code === null)
+ code = '';
+
+ // local params take precedence over defaults
+ this.params = sh.utils.merge(sh.defaults, params || {});
+
+ // process light mode
+ if (this.getParam('light') == true)
+ this.params.toolbar = this.params.gutter = false;
+
+ this.div = div = this.create('DIV');
+ this.lines = this.create('DIV');
+ this.lines.className = 'lines';
+
+ className = 'syntaxhighlighter';
+ div.id = this.id;
+
+ // make collapsed
+ if (this.getParam('collapse'))
+ className += ' collapsed';
+
+ // disable gutter
+ if (this.getParam('gutter') == false)
+ className += ' nogutter';
+
+ // disable line wrapping
+ if (this.getParam('wrap-lines') == false)
+ this.lines.className += ' no-wrap';
+
+ // add custom user style name
+ className += ' ' + this.getParam('class-name');
+
+ // add brush alias to the class name for custom CSS
+ className += ' ' + this.getParam('brush-name');
+
+ div.className = className;
+
+ this.originalCode = code;
+ this.code = sh.utils.trimFirstAndLastLines(code)
+ .replace(/\r/g, ' ') // IE lets these buggers through
+ ;
+
+ tabSize = this.getParam('tab-size');
+
+ // replace tabs with spaces
+ this.code = this.getParam('smart-tabs') == true
+ ? sh.utils.processSmartTabs(this.code, tabSize)
+ : sh.utils.processTabs(this.code, tabSize)
+ ;
+
+ this.code = sh.utils.unindent(this.code);
+
+ // add controls toolbar
+ if (this.getParam('toolbar'))
+ {
+ this.bar = this.create('DIV');
+ this.bar.className = 'bar';
+ this.bar.appendChild(sh.toolbar.create(this));
+ div.appendChild(this.bar);
+
+ // set up toolbar rollover
+ var bar = this.bar;
+ function hide() { bar.className = bar.className.replace('show', ''); }
+ div.onmouseover = function() { hide(); bar.className += ' show'; };
+ div.onmouseout = function() { hide(); }
+ }
+
+ div.appendChild(this.lines);
+
+ this.matches = this.findMatches(this.regexList, this.code);
+ this.removeNestedMatches();
+
+ code = this.processMatches(this.code, this.matches);
+
+ // finally, split all lines so that they wrap well
+ code = this.createDisplayLines(sh.utils.trim(code));
+
+ // finally, process the links
+ if (this.getParam('auto-links'))
+ code = sh.utils.processUrls(code);
+
+ this.lines.innerHTML = code;
+ },
+
+ /**
+ * Converts space separated list of keywords into a regular expression string.
+ * @param {String} str Space separated keywords.
+ * @return {String} Returns regular expression string.
+ */
+ getKeywords: function(str)
+ {
+ str = str
+ .replace(/^\s+|\s+$/g, '')
+ .replace(/\s+/g, '|')
+ ;
+
+ return '\\b(?:' + str + ')\\b';
+ },
+
+ /**
+ * Makes a brush compatible with the `html-script` functionality.
+ * @param {Object} regexGroup Object containing `left` and `right` regular expressions.
+ */
+ forHtmlScript: function(regexGroup)
+ {
+ this.htmlScript = {
+ left : { regex: regexGroup.left, css: 'script' },
+ right : { regex: regexGroup.right, css: 'script' },
+ code : new XRegExp(
+ "(?<left>" + regexGroup.left.source + ")" +
+ "(?<code>.*?)" +
+ "(?<right>" + regexGroup.right.source + ")",
+ "sgi"
+ )
+ };
+ }
+}; // end of Highlighter
+
+return sh;
+}(); // end of anonymous function
+
+
+/**
+ * XRegExp 0.6.1
+ * (c) 2007-2008 Steven Levithan
+ * <http://stevenlevithan.com/regex/xregexp/>
+ * MIT License
+ *
+ * provides an augmented, cross-browser implementation of regular expressions
+ * including support for additional modifiers and syntax. several convenience
+ * methods and a recursive-construct parser are also included.
+ */
+
+// prevent running twice, which would break references to native globals
+if (!window.XRegExp) {
+// anonymous function to avoid global variables
+(function () {
+// copy various native globals for reference. can't use the name ``native``
+// because it's a reserved JavaScript keyword.
+var real = {
+ exec: RegExp.prototype.exec,
+ match: String.prototype.match,
+ replace: String.prototype.replace,
+ split: String.prototype.split
+ },
+ /* regex syntax parsing with support for all the necessary cross-
+ browser and context issues (escapings, character classes, etc.) */
+ lib = {
+ part: /(?:[^\\([#\s.]+|\\(?!k<[\w$]+>|[pP]{[^}]+})[\S\s]?|\((?=\?(?!#|<[\w$]+>)))+|(\()(?:\?(?:(#)[^)]*\)|<([$\w]+)>))?|\\(?:k<([\w$]+)>|[pP]{([^}]+)})|(\[\^?)|([\S\s])/g,
+ replaceVar: /(?:[^$]+|\$(?![1-9$&`']|{[$\w]+}))+|\$(?:([1-9]\d*|[$&`'])|{([$\w]+)})/g,
+ extended: /^(?:\s+|#.*)+/,
+ quantifier: /^(?:[?*+]|{\d+(?:,\d*)?})/,
+ classLeft: /&&\[\^?/g,
+ classRight: /]/g
+ },
+ indexOf = function (array, item, from) {
+ for (var i = from || 0; i < array.length; i++)
+ if (array[i] === item) return i;
+ return -1;
+ },
+ brokenExecUndef = /()??/.exec("")[1] !== undefined,
+ plugins = {};
+
+/**
+ * Accepts a pattern and flags, returns a new, extended RegExp object.
+ * differs from a native regex in that additional flags and syntax are
+ * supported and browser inconsistencies are ameliorated.
+ * @ignore
+ */
+XRegExp = function (pattern, flags) {
+ if (pattern instanceof RegExp) {
+ if (flags !== undefined)
+ throw TypeError("can't supply flags when constructing one RegExp from another");
+ return pattern.addFlags(); // new copy
+ }
+
+ var flags = flags || "",
+ singleline = flags.indexOf("s") > -1,
+ extended = flags.indexOf("x") > -1,
+ hasNamedCapture = false,
+ captureNames = [],
+ output = [],
+ part = lib.part,
+ match, cc, len, index, regex;
+
+ part.lastIndex = 0; // in case the last XRegExp compilation threw an error (unbalanced character class)
+
+ while (match = real.exec.call(part, pattern)) {
+ // comment pattern. this check must come before the capturing group check,
+ // because both match[1] and match[2] will be non-empty.
+ if (match[2]) {
+ // keep tokens separated unless the following token is a quantifier
+ if (!lib.quantifier.test(pattern.slice(part.lastIndex)))
+ output.push("(?:)");
+ // capturing group
+ } else if (match[1]) {
+ captureNames.push(match[3] || null);
+ if (match[3])
+ hasNamedCapture = true;
+ output.push("(");
+ // named backreference
+ } else if (match[4]) {
+ index = indexOf(captureNames, match[4]);
+ // keep backreferences separate from subsequent literal numbers
+ // preserve backreferences to named groups that are undefined at this point as literal strings
+ output.push(index > -1 ?
+ "\\" + (index + 1) + (isNaN(pattern.charAt(part.lastIndex)) ? "" : "(?:)") :
+ match[0]
+ );
+ // unicode element (requires plugin)
+ } else if (match[5]) {
+ output.push(plugins.unicode ?
+ plugins.unicode.get(match[5], match[0].charAt(1) === "P") :
+ match[0]
+ );
+ // character class opening delimiter ("[" or "[^")
+ // (non-native unicode elements are not supported within character classes)
+ } else if (match[6]) {
+ if (pattern.charAt(part.lastIndex) === "]") {
+ // for cross-browser compatibility with ECMA-262 v3 behavior,
+ // convert [] to (?!) and [^] to [\S\s].
+ output.push(match[6] === "[" ? "(?!)" : "[\\S\\s]");
+ part.lastIndex++;
+ } else {
+ // parse the character class with support for inner escapes and
+ // ES4's infinitely nesting intersection syntax ([&&[^&&[]]]).
+ cc = XRegExp.matchRecursive("&&" + pattern.slice(match.index), lib.classLeft, lib.classRight, "", {escapeChar: "\\"})[0];
+ output.push(match[6] + cc + "]");
+ part.lastIndex += cc.length + 1;
+ }
+ // dot ("."), pound sign ("#"), or whitespace character
+ } else if (match[7]) {
+ if (singleline && match[7] === ".") {
+ output.push("[\\S\\s]");
+ } else if (extended && lib.extended.test(match[7])) {
+ len = real.exec.call(lib.extended, pattern.slice(part.lastIndex - 1))[0].length;
+ // keep tokens separated unless the following token is a quantifier
+ if (!lib.quantifier.test(pattern.slice(part.lastIndex - 1 + len)))
+ output.push("(?:)");
+ part.lastIndex += len - 1;
+ } else {
+ output.push(match[7]);
+ }
+ } else {
+ output.push(match[0]);
+ }
+ }
+
+ regex = RegExp(output.join(""), real.replace.call(flags, /[sx]+/g, ""));
+ regex._x = {
+ source: pattern,
+ captureNames: hasNamedCapture ? captureNames : null
+ };
+ return regex;
+};
+
+/**
+ * Barebones plugin support for now (intentionally undocumented)
+ * @ignore
+ * @param {Object} name
+ * @param {Object} o
+ */
+XRegExp.addPlugin = function (name, o) {
+ plugins[name] = o;
+};
+
+/**
+ * Adds named capture support, with values returned as ``result.name``.
+ *
+ * Also fixes two cross-browser issues, following the ECMA-262 v3 spec:
+ * - captured values for non-participating capturing groups should be returned
+ * as ``undefined``, rather than the empty string.
+ * - the regex's ``lastIndex`` should not be incremented after zero-length
+ * matches.
+ * @ignore
+ */
+RegExp.prototype.exec = function (str) {
+ var match = real.exec.call(this, str),
+ name, i, r2;
+ if (match) {
+ // fix browsers whose exec methods don't consistently return
+ // undefined for non-participating capturing groups
+ if (brokenExecUndef && match.length > 1) {
+ // r2 doesn't need /g or /y, but they shouldn't hurt
+ r2 = new RegExp("^" + this.source + "$(?!\\s)", this.getNativeFlags());
+ real.replace.call(match[0], r2, function () {
+ for (i = 1; i < arguments.length - 2; i++) {
+ if (arguments[i] === undefined) match[i] = undefined;
+ }
+ });
+ }
+ // attach named capture properties
+ if (this._x && this._x.captureNames) {
+ for (i = 1; i < match.length; i++) {
+ name = this._x.captureNames[i - 1];
+ if (name) match[name] = match[i];
+ }
+ }
+ // fix browsers that increment lastIndex after zero-length matches
+ if (this.global && this.lastIndex > (match.index + match[0].length))
+ this.lastIndex--;
+ }
+ return match;
+};
+})(); // end anonymous function
+} // end if(!window.XRegExp)
+
+/**
+ * intentionally undocumented
+ * @ignore
+ */
+RegExp.prototype.getNativeFlags = function () {
+ return (this.global ? "g" : "") +
+ (this.ignoreCase ? "i" : "") +
+ (this.multiline ? "m" : "") +
+ (this.extended ? "x" : "") +
+ (this.sticky ? "y" : "");
+};
+
+/**
+ * Accepts flags; returns a new XRegExp object generated by recompiling
+ * the regex with the additional flags (may include non-native flags).
+ * The original regex object is not altered.
+ * @ignore
+ */
+RegExp.prototype.addFlags = function (flags) {
+ var regex = new XRegExp(this.source, (flags || "") + this.getNativeFlags());
+ if (this._x) {
+ regex._x = {
+ source: this._x.source,
+ captureNames: this._x.captureNames ? this._x.captureNames.slice(0) : null
+ };
+ }
+ return regex;
+};
+
+/**
+ * Accepts a context object and string; returns the result of calling
+ * ``exec`` with the provided string. the context is ignored but is
+ * accepted for congruity with ``Function.prototype.call``.
+ * @ignore
+ */
+RegExp.prototype.call = function (context, str) {
+ return this.exec(str);
+};
+
+/**
+ * Accepts a context object and arguments array; returns the result of
+ * calling ``exec`` with the first value in the arguments array. the context
+ * is ignored but is accepted for congruity with ``Function.prototype.apply``.
+ * @ignore
+ */
+RegExp.prototype.apply = function (context, args) {
+ return this.exec(args[0]);
+};
+
+/**
+ * Accepts a pattern and flags; returns an XRegExp object. if the pattern
+ * and flag combination has previously been cached, the cached copy is
+ * returned, otherwise the new object is cached.
+ * @ignore
+ */
+XRegExp.cache = function (pattern, flags) {
+ var key = "/" + pattern + "/" + (flags || "");
+ return XRegExp.cache[key] || (XRegExp.cache[key] = new XRegExp(pattern, flags));
+};
+
+/**
+ * Accepts a string; returns the string with regex metacharacters escaped.
+ * the returned string can safely be used within a regex to match a literal
+ * string. escaped characters are [, ], {, }, (, ), -, *, +, ?, ., \, ^, $,
+ * |, #, [comma], and whitespace.
+ * @ignore
+ */
+XRegExp.escape = function (str) {
+ return str.replace(/[-[\]{}()*+?.\\^$|,#\s]/g, "\\$&");
+};
+
+/**
+ * Accepts a string to search, left and right delimiters as regex pattern
+ * strings, optional regex flags (may include non-native s, x, and y flags),
+ * and an options object which allows setting an escape character and changing
+ * the return format from an array of matches to a two-dimensional array of
+ * string parts with extended position data. returns an array of matches
+ * (optionally with extended data), allowing nested instances of left and right
+ * delimiters. use the g flag to return all matches, otherwise only the first
+ * is returned. if delimiters are unbalanced within the subject data, an error
+ * is thrown.
+ *
+ * This function admittedly pushes the boundaries of what can be accomplished
+ * sensibly without a "real" parser. however, by doing so it provides flexible
+ * and powerful recursive parsing capabilities with minimal code weight.
+ *
+ * Warning: the ``escapeChar`` option is considered experimental and might be
+ * changed or removed in future versions of XRegExp.
+ *
+ * unsupported features:
+ * - backreferences within delimiter patterns when using ``escapeChar``.
+ * - although providing delimiters as regex objects adds the minor feature of
+ * independent delimiter flags, it introduces other limitations and is only
+ * intended to be done by the ``XRegExp`` constructor (which can't call
+ * itself while building a regex).
+ *
+ * @ignore
+ */
+XRegExp.matchRecursive = function (str, left, right, flags, options) {
+ var options = options || {},
+ escapeChar = options.escapeChar,
+ vN = options.valueNames,
+ flags = flags || "",
+ global = flags.indexOf("g") > -1,
+ ignoreCase = flags.indexOf("i") > -1,
+ multiline = flags.indexOf("m") > -1,
+ sticky = flags.indexOf("y") > -1,
+ /* sticky mode has its own handling in this function, which means you
+ can use flag "y" even in browsers which don't support it natively */
+ flags = flags.replace(/y/g, ""),
+ left = left instanceof RegExp ? (left.global ? left : left.addFlags("g")) : new XRegExp(left, "g" + flags),
+ right = right instanceof RegExp ? (right.global ? right : right.addFlags("g")) : new XRegExp(right, "g" + flags),
+ output = [],
+ openTokens = 0,
+ delimStart = 0,
+ delimEnd = 0,
+ lastOuterEnd = 0,
+ outerStart, innerStart, leftMatch, rightMatch, escaped, esc;
+
+ if (escapeChar) {
+ if (escapeChar.length > 1) throw SyntaxError("can't supply more than one escape character");
+ if (multiline) throw TypeError("can't supply escape character when using the multiline flag");
+ escaped = XRegExp.escape(escapeChar);
+ /* Escape pattern modifiers:
+ /g - not needed here
+ /i - included
+ /m - **unsupported**, throws error
+ /s - handled by XRegExp when delimiters are provided as strings
+ /x - handled by XRegExp when delimiters are provided as strings
+ /y - not needed here; supported by other handling in this function
+ */
+ esc = new RegExp(
+ "^(?:" + escaped + "[\\S\\s]|(?:(?!" + left.source + "|" + right.source + ")[^" + escaped + "])+)+",
+ ignoreCase ? "i" : ""
+ );
+ }
+
+ while (true) {
+ /* advance the starting search position to the end of the last delimiter match.
+ a couple special cases are also covered:
+ - if using an escape character, advance to the next delimiter's starting position,
+ skipping any escaped characters
+ - first time through, reset lastIndex in case delimiters were provided as regexes
+ */
+ left.lastIndex = right.lastIndex = delimEnd +
+ (escapeChar ? (esc.exec(str.slice(delimEnd)) || [""])[0].length : 0);
+
+ leftMatch = left.exec(str);
+ rightMatch = right.exec(str);
+
+ // only keep the result which matched earlier in the string
+ if (leftMatch && rightMatch) {
+ if (leftMatch.index <= rightMatch.index)
+ rightMatch = null;
+ else leftMatch = null;
+ }
+
+ /* paths*:
+ leftMatch | rightMatch | openTokens | result
+ 1 | 0 | 1 | ...
+ 1 | 0 | 0 | ...
+ 0 | 1 | 1 | ...
+ 0 | 1 | 0 | throw
+ 0 | 0 | 1 | throw
+ 0 | 0 | 0 | break
+ * - does not include the sticky mode special case
+ - the loop ends after the first completed match if not in global mode
+ */
+
+ if (leftMatch || rightMatch) {
+ delimStart = (leftMatch || rightMatch).index;
+ delimEnd = (leftMatch ? left : right).lastIndex;
+ } else if (!openTokens) {
+ break;
+ }
+
+ if (sticky && !openTokens && delimStart > lastOuterEnd)
+ break;
+
+ if (leftMatch) {
+ if (!openTokens++) {
+ outerStart = delimStart;
+ innerStart = delimEnd;
+ }
+ } else if (rightMatch && openTokens) {
+ if (!--openTokens) {
+ if (vN) {
+ if (vN[0] && outerStart > lastOuterEnd)
+ output.push([vN[0], str.slice(lastOuterEnd, outerStart), lastOuterEnd, outerStart]);
+ if (vN[1]) output.push([vN[1], str.slice(outerStart, innerStart), outerStart, innerStart]);
+ if (vN[2]) output.push([vN[2], str.slice(innerStart, delimStart), innerStart, delimStart]);
+ if (vN[3]) output.push([vN[3], str.slice(delimStart, delimEnd), delimStart, delimEnd]);
+ } else {
+ output.push(str.slice(innerStart, delimStart));
+ }
+ lastOuterEnd = delimEnd;
+ if (!global)
+ break;
+ }
+ } else {
+ // reset lastIndex in case delimiters were provided as regexes
+ left.lastIndex = right.lastIndex = 0;
+ throw Error("subject data contains unbalanced delimiters");
+ }
+
+ // if the delimiter matched an empty string, advance delimEnd to avoid an infinite loop
+ if (delimStart === delimEnd)
+ delimEnd++;
+ }
+
+ if (global && !sticky && vN && vN[0] && str.length > lastOuterEnd)
+ output.push([vN[0], str.slice(lastOuterEnd), lastOuterEnd, str.length]);
+
+ // reset lastIndex in case delimiters were provided as regexes
+ left.lastIndex = right.lastIndex = 0;
+
+ return output;
+};
Added: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/src/shLegacy.js
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/src/shLegacy.js (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/src/shLegacy.js 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,172 @@
+/**
+ * SyntaxHighlighter
+ * http://alexgorbatchev.com/
+ *
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
+ * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
+ *
+ * @version
+ * 2.1.364 (October 15 2009)
+ *
+ * @copyright
+ * Copyright (C) 2004-2009 Alex Gorbatchev.
+ *
+ * @license
+ * This file is part of SyntaxHighlighter.
+ *
+ * SyntaxHighlighter is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SyntaxHighlighter is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
+ */
+var dp = {
+ SyntaxHighlighter : {}
+};
+
+dp.SyntaxHighlighter = {
+ parseParams: function(
+ input,
+ showGutter,
+ showControls,
+ collapseAll,
+ firstLine,
+ showColumns
+ )
+ {
+ function getValue(list, name)
+ {
+ var regex = new XRegExp('^' + name + '\\[(?<value>\\w+)\\]$', 'gi'),
+ match = null
+ ;
+
+ for (var i = 0; i < list.length; i++)
+ if ((match = regex.exec(list[i])) != null)
+ return match.value;
+
+ return null;
+ };
+
+ function defaultValue(value, def)
+ {
+ return value != null ? value : def;
+ };
+
+ function asString(value)
+ {
+ return value != null ? value.toString() : null;
+ };
+
+ var parts = input.split(':'),
+ brushName = parts[0],
+ options = {},
+ straight = { 'true' : 'true' }
+ reverse = { 'true' : 'false' },
+ result = null,
+ defaults = SyntaxHighlighter.defaults
+ ;
+
+ for (var i in parts)
+ options[parts[i]] = 'true';
+
+ showGutter = asString(defaultValue(showGutter, defaults.gutter));
+ showControls = asString(defaultValue(showControls, defaults.toolbar));
+ collapseAll = asString(defaultValue(collapseAll, defaults.collapse));
+ showColumns = asString(defaultValue(showColumns, defaults.ruler));
+ firstLine = asString(defaultValue(firstLine, defaults['first-line']));
+
+ result = {
+ brush : brushName,
+ gutter : defaultValue(reverse[options.nogutter], showGutter),
+ toolbar : defaultValue(reverse[options.nocontrols], showControls),
+ collapse : defaultValue(straight[options.collapse], collapseAll),
+ ruler : defaultValue(straight[options.showcolumns], showColumns),
+ 'first-line' : defaultValue(getValue(parts, 'firstline'), firstLine)
+ };
+
+ return result;
+ },
+
+ HighlightAll: function(
+ name,
+ showGutter /* optional */,
+ showControls /* optional */,
+ collapseAll /* optional */,
+ firstLine /* optional */,
+ showColumns /* optional */
+ )
+ {
+ function findValue()
+ {
+ var a = arguments;
+
+ for (var i = 0; i < a.length; i++)
+ {
+ if (a[i] === null)
+ continue;
+
+ if (typeof(a[i]) == 'string' && a[i] != '')
+ return a[i] + '';
+
+ if (typeof(a[i]) == 'object' && a[i].value != '')
+ return a[i].value + '';
+ }
+
+ return null;
+ };
+
+ function findTagsByName(list, name, tagName)
+ {
+ var tags = document.getElementsByTagName(tagName);
+
+ for (var i = 0; i < tags.length; i++)
+ if (tags[i].getAttribute('name') == name)
+ list.push(tags[i]);
+ }
+
+ var elements = [],
+ highlighter = null,
+ registered = {},
+ propertyName = 'innerHTML'
+ ;
+
+ // for some reason IE doesn't find <pre/> by name, however it does see them just fine by tag name...
+ findTagsByName(elements, name, 'pre');
+ findTagsByName(elements, name, 'textarea');
+
+ if (elements.length === 0)
+ return;
+
+ for (var i = 0; i < elements.length; i++)
+ {
+ var element = elements[i],
+ params = findValue(
+ element.attributes['class'], element.className,
+ element.attributes['language'], element.language
+ ),
+ language = ''
+ ;
+
+ if (params === null)
+ continue;
+
+ params = dp.SyntaxHighlighter.parseParams(
+ params,
+ showGutter,
+ showControls,
+ collapseAll,
+ firstLine,
+ showColumns
+ );
+
+ SyntaxHighlighter.highlight(params, element);
+ }
+ }
+};
Added: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/help.png
===================================================================
(Binary files differ)
Property changes on: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/help.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/magnifier.png
===================================================================
(Binary files differ)
Property changes on: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/magnifier.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/page_white_code.png
===================================================================
(Binary files differ)
Property changes on: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/page_white_code.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/page_white_copy.png
===================================================================
(Binary files differ)
Property changes on: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/page_white_copy.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/printer.png
===================================================================
(Binary files differ)
Property changes on: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/printer.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/shCore.css
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/shCore.css (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/shCore.css 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,330 @@
+/**
+ * SyntaxHighlighter
+ * http://alexgorbatchev.com/
+ *
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
+ * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
+ *
+ * @version
+ * 2.1.364 (October 15 2009)
+ *
+ * @copyright
+ * Copyright (C) 2004-2009 Alex Gorbatchev.
+ *
+ * @license
+ * This file is part of SyntaxHighlighter.
+ *
+ * SyntaxHighlighter is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SyntaxHighlighter is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
+ */
+.syntaxhighlighter,
+.syntaxhighlighter div,
+.syntaxhighlighter code,
+.syntaxhighlighter table,
+.syntaxhighlighter table td,
+.syntaxhighlighter table tr,
+.syntaxhighlighter table tbody
+{
+ margin: 0 !important;
+ padding: 0 !important;
+ border: 0 !important;
+ outline: 0 !important;
+ background: none !important;
+ text-align: left !important;
+ float: none !important;
+ vertical-align: baseline !important;
+ position: static !important;
+ left: auto !important;
+ top: auto !important;
+ right: auto !important;
+ bottom: auto !important;
+ height: auto !important;
+ width: auto !important;
+ line-height: 1.1em !important;
+ font-family: "Consolas", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace !important;
+ font-weight: normal !important;
+ font-style: normal !important;
+ font-size: 1em !important;
+ min-height: inherit !important; /* For IE8, FF & WebKit */
+ min-height: auto !important; /* For IE7 */
+}
+
+.syntaxhighlighter
+{
+ width: 99% !important; /* 99% fixes IE8 horizontal scrollbar */
+ margin: 1em 0 1em 0 !important;
+ padding: 1px !important; /* adds a little border on top and bottom */
+ position: relative !important;
+}
+
+.syntaxhighlighter .bold
+{
+ font-weight: bold !important;
+}
+
+.syntaxhighlighter .italic
+{
+ font-style: italic !important;
+}
+
+.syntaxhighlighter .line
+{
+}
+
+.syntaxhighlighter .no-wrap .line .content
+{
+ white-space: pre !important;
+}
+
+.syntaxhighlighter .line table
+{
+ border-collapse: collapse !important;
+}
+
+.syntaxhighlighter .line td
+{
+ vertical-align: top !important;
+}
+
+.syntaxhighlighter .line .number
+{
+ width: 3em !important;
+}
+
+.syntaxhighlighter .line .number code
+{
+ width: 2.7em !important;
+ padding-right: .3em !important;
+ text-align: right !important;
+ display: block !important;
+}
+
+.syntaxhighlighter .line .content
+{
+ padding-left: .5em !important;
+}
+
+.syntaxhighlighter .line .spaces
+{
+}
+
+/* Disable border and margin on the lines when no gutter option is set */
+.syntaxhighlighter.nogutter .line .content
+{
+ border-left: none !important;
+}
+
+.syntaxhighlighter .bar
+{
+ display: none !important;
+}
+
+.syntaxhighlighter .bar.show
+{
+ display: block !important;
+}
+
+.syntaxhighlighter.collapsed .bar
+{
+ display: block !important;
+}
+
+/* Adjust some properties when collapsed */
+
+.syntaxhighlighter.collapsed .lines
+{
+ display: none !important;
+}
+
+.syntaxhighlighter .lines.no-wrap
+{
+ overflow: auto !important;
+ overflow-y: hidden !important;
+}
+
+/* Styles for the toolbar */
+
+.syntaxhighlighter .toolbar
+{
+ position: absolute !important;
+ right: 0px !important;
+ top: 0px !important;
+ font-size: 1px !important;
+ padding: 8px 8px 8px 0 !important; /* in px because images don't scale with ems */
+}
+
+.syntaxhighlighter.collapsed .toolbar
+{
+ font-size: 80% !important;
+ padding: .2em 0 .5em .5em !important;
+ position: static !important;
+}
+
+.syntaxhighlighter .toolbar a.item,
+.syntaxhighlighter .toolbar .item
+{
+ display: block !important;
+ float: left !important;
+ margin-left: 8px !important;
+ background-repeat: no-repeat !important;
+ overflow: hidden !important;
+ text-indent: -5000px !important;
+}
+
+.syntaxhighlighter.collapsed .toolbar .item
+{
+ display: none !important;
+}
+
+.syntaxhighlighter.collapsed .toolbar .item.expandSource
+{
+ background-image: url(magnifier.png) !important;
+ display: inline !important;
+ text-indent: 0 !important;
+ width: auto !important;
+ float: none !important;
+ height: 16px !important;
+ padding-left: 20px !important;
+}
+
+.syntaxhighlighter .toolbar .item.viewSource
+{
+ background-image: url(page_white_code.png) !important;
+}
+
+.syntaxhighlighter .toolbar .item.printSource
+{
+ background-image: url(printer.png) !important;
+}
+
+.syntaxhighlighter .toolbar .item.copyToClipboard
+{
+ text-indent: 0 !important;
+ background: none !important;
+ overflow: visible !important;
+}
+
+.syntaxhighlighter .toolbar .item.about
+{
+ background-image: url(help.png) !important;
+}
+
+/**
+ * Print view.
+ * Colors are based on the default theme without background.
+ */
+
+.syntaxhighlighter.printing,
+.syntaxhighlighter.printing .line.alt1 .content,
+.syntaxhighlighter.printing .line.alt2 .content,
+.syntaxhighlighter.printing .line.highlighted .number,
+.syntaxhighlighter.printing .line.highlighted.alt1 .content,
+.syntaxhighlighter.printing .line.highlighted.alt2 .content,
+{
+ background: none !important;
+}
+
+/* Gutter line numbers */
+.syntaxhighlighter.printing .line .number
+{
+ color: #bbb !important;
+}
+
+/* Add border to the lines */
+.syntaxhighlighter.printing .line .content
+{
+ color: #000 !important;
+}
+
+/* Toolbar when visible */
+.syntaxhighlighter.printing .toolbar
+{
+ display: none !important;
+}
+
+.syntaxhighlighter.printing a
+{
+ text-decoration: none !important;
+}
+
+.syntaxhighlighter.printing .plain,
+.syntaxhighlighter.printing .plain a
+{
+ color: #000 !important;
+}
+
+.syntaxhighlighter.printing .comments,
+.syntaxhighlighter.printing .comments a
+{
+ color: #008200 !important;
+}
+
+.syntaxhighlighter.printing .string,
+.syntaxhighlighter.printing .string a
+{
+ color: blue !important;
+}
+
+.syntaxhighlighter.printing .keyword
+{
+ color: #069 !important;
+ font-weight: bold !important;
+}
+
+.syntaxhighlighter.printing .preprocessor
+{
+ color: gray !important;
+}
+
+.syntaxhighlighter.printing .variable
+{
+ color: #a70 !important;
+}
+
+.syntaxhighlighter.printing .value
+{
+ color: #090 !important;
+}
+
+.syntaxhighlighter.printing .functions
+{
+ color: #ff1493 !important;
+}
+
+.syntaxhighlighter.printing .constants
+{
+ color: #0066CC !important;
+}
+
+.syntaxhighlighter.printing .script
+{
+ font-weight: bold !important;
+}
+
+.syntaxhighlighter.printing .color1,
+.syntaxhighlighter.printing .color1 a
+{
+ color: #808080 !important;
+}
+
+.syntaxhighlighter.printing .color2,
+.syntaxhighlighter.printing .color2 a
+{
+ color: #ff1493 !important;
+}
+
+.syntaxhighlighter.printing .color3,
+.syntaxhighlighter.printing .color3 a
+{
+ color: red !important;
+}
Added: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/shThemeDefault.css
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/shThemeDefault.css (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/shThemeDefault.css 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,173 @@
+/**
+ * SyntaxHighlighter
+ * http://alexgorbatchev.com/
+ *
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
+ * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
+ *
+ * @version
+ * 2.1.364 (October 15 2009)
+ *
+ * @copyright
+ * Copyright (C) 2004-2009 Alex Gorbatchev.
+ *
+ * @license
+ * This file is part of SyntaxHighlighter.
+ *
+ * SyntaxHighlighter is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SyntaxHighlighter is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
+ */
+/************************************
+ * Default Syntax Highlighter theme.
+ *
+ * Interface elements.
+ ************************************/
+
+.syntaxhighlighter
+{
+ background-color: #fff !important;
+}
+
+/* Highlighed line number */
+.syntaxhighlighter .line.highlighted .number
+{
+ color: black !important;
+}
+
+/* Highlighed line */
+.syntaxhighlighter .line.highlighted.alt1,
+.syntaxhighlighter .line.highlighted.alt2
+{
+ background-color: #e0e0e0 !important;
+}
+
+/* Gutter line numbers */
+.syntaxhighlighter .line .number
+{
+ color: #afafaf !important;
+}
+
+/* Add border to the lines */
+.syntaxhighlighter .line .content
+{
+ border-left: 3px solid #6CE26C !important;
+ color: #000 !important;
+}
+
+.syntaxhighlighter.printing .line .content
+{
+ border: 0 !important;
+}
+
+/* First line */
+.syntaxhighlighter .line.alt1
+{
+ background-color: #fff !important;
+}
+
+/* Second line */
+.syntaxhighlighter .line.alt2
+{
+ background-color: #F8F8F8 !important;
+}
+
+.syntaxhighlighter .toolbar
+{
+ background-color: #F8F8F8 !important;
+ border: #E7E5DC solid 1px !important;
+}
+
+.syntaxhighlighter .toolbar a
+{
+ color: #a0a0a0 !important;
+}
+
+.syntaxhighlighter .toolbar a:hover
+{
+ color: red !important;
+}
+
+/************************************
+ * Actual syntax highlighter colors.
+ ************************************/
+.syntaxhighlighter .plain,
+.syntaxhighlighter .plain a
+{
+ color: #000 !important;
+}
+
+.syntaxhighlighter .comments,
+.syntaxhighlighter .comments a
+{
+ color: #008200 !important;
+}
+
+.syntaxhighlighter .string,
+.syntaxhighlighter .string a
+{
+ color: blue !important;
+}
+
+.syntaxhighlighter .keyword
+{
+ color: #069 !important;
+ font-weight: bold !important;
+}
+
+.syntaxhighlighter .preprocessor
+{
+ color: gray !important;
+}
+
+.syntaxhighlighter .variable
+{
+ color: #a70 !important;
+}
+
+.syntaxhighlighter .value
+{
+ color: #090 !important;
+}
+
+.syntaxhighlighter .functions
+{
+ color: #ff1493 !important;
+}
+
+.syntaxhighlighter .constants
+{
+ color: #0066CC !important;
+}
+
+.syntaxhighlighter .script
+{
+ background-color: yellow !important;
+}
+
+.syntaxhighlighter .color1,
+.syntaxhighlighter .color1 a
+{
+ color: #808080 !important;
+}
+
+.syntaxhighlighter .color2,
+.syntaxhighlighter .color2 a
+{
+ color: #ff1493 !important;
+}
+
+.syntaxhighlighter .color3,
+.syntaxhighlighter .color3 a
+{
+ color: red !important;
+}
Added: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/shThemeDjango.css
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/shThemeDjango.css (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/shThemeDjango.css 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,176 @@
+/**
+ * SyntaxHighlighter
+ * http://alexgorbatchev.com/
+ *
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
+ * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
+ *
+ * @version
+ * 2.1.364 (October 15 2009)
+ *
+ * @copyright
+ * Copyright (C) 2004-2009 Alex Gorbatchev.
+ *
+ * @license
+ * This file is part of SyntaxHighlighter.
+ *
+ * SyntaxHighlighter is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SyntaxHighlighter is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
+ */
+/**
+ * Django SyntaxHighlighter theme
+ */
+
+/************************************
+ * Interface elements.
+ ************************************/
+
+.syntaxhighlighter
+{
+ background-color: #0B2F20 !important;
+}
+
+/* Gutter line numbers */
+.syntaxhighlighter .line .number
+{
+ color: #497958 !important;
+}
+
+/* Add border to the lines */
+.syntaxhighlighter .line .content
+{
+ border-left: 3px solid #41A83E !important;
+ color: #B9BDB6 !important;
+}
+
+.syntaxhighlighter.printing .line .content
+{
+ border: 0 !important;
+}
+
+/* First line */
+.syntaxhighlighter .line.alt1
+{
+}
+
+/* Second line */
+.syntaxhighlighter .line.alt2
+{
+ background-color: #0a2b1d !important;
+}
+
+/* Highlighed line number */
+.syntaxhighlighter .line.highlighted .number
+{
+ background-color: #336442 !important;
+ color: #fff !important;
+}
+
+/* Highlighed line */
+.syntaxhighlighter .line.highlighted.alt1,
+.syntaxhighlighter .line.highlighted.alt2
+{
+ background-color: #336442 !important;
+}
+
+.syntaxhighlighter .toolbar
+{
+ background-color: #245032 !important;
+ border: #0B2F20 solid 1px !important;
+}
+
+.syntaxhighlighter .toolbar a
+{
+ color: #C4B14A !important;
+}
+
+.syntaxhighlighter .toolbar a:hover
+{
+ color: #FFE862 !important;
+}
+
+/************************************
+ * Actual syntax highlighter colors.
+ ************************************/
+.syntaxhighlighter .plain,
+.syntaxhighlighter .plain a
+{
+ color: #F8F8F8 !important;
+}
+
+.syntaxhighlighter .comments,
+.syntaxhighlighter .comments a
+{
+ color: #336442 !important;
+ font-style: italic !important;
+}
+
+.syntaxhighlighter .string,
+.syntaxhighlighter .string a
+{
+ color: #9DF39F !important;
+}
+
+.syntaxhighlighter .keyword
+{
+ color: #96DD3B !important;
+ font-weight: bold !important;
+}
+
+.syntaxhighlighter .preprocessor
+{
+ color: #91BB9E !important;
+}
+
+.syntaxhighlighter .variable
+{
+ color: #FFAA3E !important;
+}
+
+.syntaxhighlighter .value
+{
+ color: #F7E741 !important;
+}
+
+.syntaxhighlighter .functions
+{
+ color: #FFAA3E !important;
+}
+
+.syntaxhighlighter .constants
+{
+ color: #E0E8FF !important;
+}
+
+.syntaxhighlighter .script
+{
+ background-color: #497958 !important;
+}
+
+.syntaxhighlighter .color1,
+.syntaxhighlighter .color1 a
+{
+ color: #EB939A !important;
+}
+
+.syntaxhighlighter .color2,
+.syntaxhighlighter .color2 a
+{
+ color: #91BB9E !important;
+}
+
+.syntaxhighlighter .color3,
+.syntaxhighlighter .color3 a
+{
+ color: #EDEF7D !important;
+}
Added: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/shThemeEclipse.css
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/shThemeEclipse.css (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/shThemeEclipse.css 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,190 @@
+/**
+ * SyntaxHighlighter
+ * http://alexgorbatchev.com/
+ *
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
+ * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
+ *
+ * @version
+ * 2.1.364 (October 15 2009)
+ *
+ * @copyright
+ * Copyright (C) 2004-2009 Alex Gorbatchev.
+ *
+ * @license
+ * This file is part of SyntaxHighlighter.
+ *
+ * SyntaxHighlighter is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SyntaxHighlighter is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
+ */
+/**
+ * Eclipse IDE SyntaxHighlighter color theme
+ * (C) Code-House
+ * http://blog.code-house.org/2009/10/xml-i-adnotacje-kod-ogolnego-przeznacz...
+ */
+
+.syntaxhighlighter
+{
+ background-color: #fff !important;
+}
+
+/* Highlighed line number */
+.syntaxhighlighter .line.highlighted .number
+{
+ background-color: #c3defe !important;
+}
+
+/* Highlighed line */
+.syntaxhighlighter .line.highlighted.alt1,
+.syntaxhighlighter .line.highlighted.alt2
+{
+ background-color: #c3defe !important;
+}
+
+/* Gutter line numbers */
+.syntaxhighlighter .line .number
+{
+ color: #787878 !important;
+ background-color: #fff !important;
+}
+
+/* Add border to the lines */
+.syntaxhighlighter .line .content
+{
+ border-left: 1px solid #d4d0c8 !important;
+ color: #000 !important;
+}
+
+.syntaxhighlighter.printing .line .content
+{
+ border: 0 !important;
+}
+
+/* First line */
+.syntaxhighlighter .line.alt1
+{
+ background-color: #fff !important;
+}
+
+/* Second line */
+.syntaxhighlighter .line.alt2
+{
+ background-color: #fff !important;
+}
+
+.syntaxhighlighter .toolbar
+{
+ background-color: #F8F8F8 !important;
+ border: #E7E5DC solid 1px !important;
+}
+
+.syntaxhighlighter .toolbar a
+{
+ color: #a0a0a0 !important;
+}
+
+.syntaxhighlighter .toolbar a:hover
+{
+ color: red !important;
+}
+
+/************************************
+ * Actual syntax highlighter colors.
+ ************************************/
+.syntaxhighlighter .plain,
+.syntaxhighlighter .plain a
+{
+ color: #000 !important;
+}
+
+.syntaxhighlighter .comments,
+.syntaxhighlighter .comments a
+{
+ color: #3f5fbf !important;
+}
+
+.syntaxhighlighter .string,
+.syntaxhighlighter .string a
+{
+ color: #2a00ff !important;
+}
+
+.syntaxhighlighter .keyword
+{
+ color: #7f0055 !important;
+ font-weight: bold !important;
+}
+
+.syntaxhighlighter .preprocessor
+{
+ color: #646464 !important;
+}
+
+.syntaxhighlighter .variable
+{
+ color: #a70 !important;
+}
+
+.syntaxhighlighter .value
+{
+ color: #090 !important;
+}
+
+.syntaxhighlighter .functions
+{
+ color: #ff1493 !important;
+}
+
+.syntaxhighlighter .constants
+{
+ color: #0066CC !important;
+}
+
+.syntaxhighlighter .script
+{
+ background-color: yellow !important;
+}
+
+.syntaxhighlighter .color1,
+.syntaxhighlighter .color1 a
+{
+ color: #808080 !important;
+}
+
+.syntaxhighlighter .color2,
+.syntaxhighlighter .color2 a
+{
+ color: #ff1493 !important;
+}
+
+.syntaxhighlighter .color3,
+.syntaxhighlighter .color3 a
+{
+ color: red !important;
+}
+
+
+.xml .keyword {
+ color: #3f7f7f !important;
+ font-weight: normal !important;
+}
+
+.xml .color1,
+.xml .color1 a{
+ color: #7f007f !important;
+}
+
+.xml .string {
+ font-style: italic !important;
+ color: #2a00ff !important;
+}
\ No newline at end of file
Added: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/shThemeEmacs.css
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/shThemeEmacs.css (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/shThemeEmacs.css 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,175 @@
+/**
+ * SyntaxHighlighter
+ * http://alexgorbatchev.com/
+ *
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
+ * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
+ *
+ * @version
+ * 2.1.364 (October 15 2009)
+ *
+ * @copyright
+ * Copyright (C) 2004-2009 Alex Gorbatchev.
+ *
+ * @license
+ * This file is part of SyntaxHighlighter.
+ *
+ * SyntaxHighlighter is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SyntaxHighlighter is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
+ */
+/**
+ * Emacs SyntaxHighlighter theme based on theme by Joshua Emmons
+ * http://www.skia.net/
+ */
+
+/************************************
+ * Interface elements.
+ ************************************/
+
+.syntaxhighlighter
+{
+ background-color: #000000 !important;
+}
+
+/* Gutter line numbers */
+.syntaxhighlighter .line .number
+{
+ color: #D3D3D3 !important;
+}
+
+/* Add border to the lines */
+.syntaxhighlighter .line .content
+{
+ border-left: 3px solid #990000 !important;
+ color: #B9BDB6 !important;
+}
+
+.syntaxhighlighter.printing .line .content
+{
+ border: 0 !important;
+}
+
+/* First line */
+.syntaxhighlighter .line.alt1
+{
+}
+
+/* Second line */
+.syntaxhighlighter .line.alt2
+{
+ background-color: #0f0f0f !important;
+}
+
+/* Highlighed line number */
+.syntaxhighlighter .line.highlighted .number
+{
+ background-color: #435A5F !important;
+ color: #fff !important;
+}
+
+/* Highlighed line */
+.syntaxhighlighter .line.highlighted.alt1,
+.syntaxhighlighter .line.highlighted.alt2
+{
+ background-color: #435A5F !important;
+}
+
+.syntaxhighlighter .toolbar
+{
+ background-color: #000000 !important;
+ border: #000000 solid 1px !important;
+}
+
+.syntaxhighlighter .toolbar a
+{
+ color: #646763 !important;
+}
+
+.syntaxhighlighter .toolbar a:hover
+{
+ color: #9CCFF4 !important;
+}
+
+/************************************
+ * Actual syntax highlighter colors.
+ ************************************/
+.syntaxhighlighter .plain,
+.syntaxhighlighter .plain a
+{
+ color: #D3D3D3 !important;
+}
+
+.syntaxhighlighter .comments,
+.syntaxhighlighter .comments a
+{
+ color: #FF7D27 !important;
+}
+
+.syntaxhighlighter .string,
+.syntaxhighlighter .string a
+{
+ color: #FF9E7B !important;
+}
+
+.syntaxhighlighter .keyword
+{
+ color: #00FFFF !important;
+}
+
+.syntaxhighlighter .preprocessor
+{
+ color: #AEC4DE !important;
+}
+
+.syntaxhighlighter .variable
+{
+ color: #FFAA3E !important;
+}
+
+.syntaxhighlighter .value
+{
+ color: #090 !important;
+}
+
+.syntaxhighlighter .functions
+{
+ color: #81CEF9 !important;
+}
+
+.syntaxhighlighter .constants
+{
+ color: #FF9E7B !important;
+}
+
+.syntaxhighlighter .script
+{
+ background-color: #990000 !important;
+}
+
+.syntaxhighlighter .color1,
+.syntaxhighlighter .color1 a
+{
+ color: #EBDB8D !important;
+}
+
+.syntaxhighlighter .color2,
+.syntaxhighlighter .color2 a
+{
+ color: #FF7D27 !important;
+}
+
+.syntaxhighlighter .color3,
+.syntaxhighlighter .color3 a
+{
+ color: #AEC4DE !important;
+}
Added: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/shThemeFadeToGrey.css
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/shThemeFadeToGrey.css (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/shThemeFadeToGrey.css 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,177 @@
+/**
+ * SyntaxHighlighter
+ * http://alexgorbatchev.com/
+ *
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
+ * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
+ *
+ * @version
+ * 2.1.364 (October 15 2009)
+ *
+ * @copyright
+ * Copyright (C) 2004-2009 Alex Gorbatchev.
+ *
+ * @license
+ * This file is part of SyntaxHighlighter.
+ *
+ * SyntaxHighlighter is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SyntaxHighlighter is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
+ */
+/**
+ * Fade to Grey SyntaxHighlighter theme based on theme by Brasten Sager
+ * http://www.ibrasten.com/
+ */
+
+/************************************
+ * Interface elements.
+ ************************************/
+
+.syntaxhighlighter
+{
+ background-color: #121212 !important;
+}
+
+/* Gutter line numbers */
+.syntaxhighlighter .line .number
+{
+ color: #C3C3C3 !important;
+}
+
+/* Add border to the lines */
+.syntaxhighlighter .line .content
+{
+ border-left: 3px solid #3185B9 !important;
+ color: #B9BDB6 !important;
+}
+
+.syntaxhighlighter.printing .line .content
+{
+ border: 0 !important;
+}
+
+/* First line */
+.syntaxhighlighter .line.alt1
+{
+}
+
+/* Second line */
+.syntaxhighlighter .line.alt2
+{
+ background-color: #000000 !important;
+}
+
+/* Highlighed line number */
+.syntaxhighlighter .line.highlighted .number
+{
+ background-color: #3A3A00 !important;
+ color: #fff !important;
+}
+
+/* Highlighed line */
+.syntaxhighlighter .line.highlighted.alt1,
+.syntaxhighlighter .line.highlighted.alt2
+{
+ background-color: #3A3A00 !important;
+}
+
+.syntaxhighlighter .toolbar
+{
+ background-color: #000000 !important;
+ border: #000000 solid 1px !important;
+}
+
+.syntaxhighlighter .toolbar a
+{
+ color: #808080 !important;
+}
+
+.syntaxhighlighter .toolbar a:hover
+{
+ color: #96DAFF !important;
+}
+
+/************************************
+ * Actual syntax highlighter colors.
+ ************************************/
+.syntaxhighlighter .plain,
+.syntaxhighlighter .plain a
+{
+ color: #FFFFFF !important;
+}
+
+.syntaxhighlighter .comments,
+.syntaxhighlighter .comments a
+{
+ color: #696854 !important;
+}
+
+.syntaxhighlighter .string,
+.syntaxhighlighter .string a
+{
+ color: #E3E658 !important;
+}
+
+.syntaxhighlighter .keyword
+{
+ color: #D01D33 !important;
+}
+
+.syntaxhighlighter .preprocessor
+{
+ color: #435A5F !important;
+}
+
+.syntaxhighlighter .variable
+{
+ color: #898989 !important;
+}
+
+.syntaxhighlighter .value
+{
+ color: #090 !important;
+}
+
+.syntaxhighlighter .functions
+{
+ color: #AAAAAA !important;
+ font-weight: bold !important;
+}
+
+.syntaxhighlighter .constants
+{
+ color: #96DAFF !important;
+}
+
+.syntaxhighlighter .script
+{
+ background-color: #C3C3C3 !important;
+ color: #000 !important;
+}
+
+.syntaxhighlighter .color1,
+.syntaxhighlighter .color1 a
+{
+ color: #FFC074 !important;
+}
+
+.syntaxhighlighter .color2,
+.syntaxhighlighter .color2 a
+{
+ color: #4A8CDB !important;
+}
+
+.syntaxhighlighter .color3,
+.syntaxhighlighter .color3 a
+{
+ color: #96DAFF !important;
+}
Added: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/shThemeMidnight.css
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/shThemeMidnight.css (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/shThemeMidnight.css 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,175 @@
+/**
+ * SyntaxHighlighter
+ * http://alexgorbatchev.com/
+ *
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
+ * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
+ *
+ * @version
+ * 2.1.364 (October 15 2009)
+ *
+ * @copyright
+ * Copyright (C) 2004-2009 Alex Gorbatchev.
+ *
+ * @license
+ * This file is part of SyntaxHighlighter.
+ *
+ * SyntaxHighlighter is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SyntaxHighlighter is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
+ */
+/**
+ * Midnight SyntaxHighlighter theme based on theme by J.D. Myers
+ * http://webdesign.lsnjd.com/
+ */
+
+/************************************
+ * Interface elements.
+ ************************************/
+
+.syntaxhighlighter
+{
+ background-color: #0F192A !important;
+}
+
+/* Gutter line numbers */
+.syntaxhighlighter .line .number
+{
+ color: #38566F !important;
+}
+
+/* Add border to the lines */
+.syntaxhighlighter .line .content
+{
+ border-left: 3px solid #435A5F !important;
+ color: #B9BDB6 !important;
+}
+
+.syntaxhighlighter.printing .line .content
+{
+ border: 0 !important;
+}
+
+/* First line */
+.syntaxhighlighter .line.alt1
+{
+ background-color: #0F192A !important;
+}
+
+/* Second line */
+.syntaxhighlighter .line.alt2
+{
+ background-color: #0F192A !important;
+}
+
+/* Highlighed line number */
+.syntaxhighlighter .line.highlighted .number
+{
+ background-color: #253E5A !important;
+ color: #fff !important;
+}
+
+/* Highlighed line */
+.syntaxhighlighter .line.highlighted.alt1,
+.syntaxhighlighter .line.highlighted.alt2
+{
+ background-color: #253E5A !important;
+}
+
+.syntaxhighlighter .toolbar
+{
+ background-color: #0F192A !important;
+}
+
+.syntaxhighlighter .toolbar a
+{
+ color: #38566F !important;
+}
+
+.syntaxhighlighter .toolbar a:hover
+{
+ color: #8AA6C1 !important;
+}
+
+/************************************
+ * Actual syntax highlighter colors.
+ ************************************/
+.syntaxhighlighter .plain,
+.syntaxhighlighter .plain a
+{
+ color: #D1EDFF !important;
+}
+
+.syntaxhighlighter .comments,
+.syntaxhighlighter .comments a
+{
+ color: #428BDD !important;
+}
+
+.syntaxhighlighter .string,
+.syntaxhighlighter .string a
+{
+ color: #1DC116 !important;
+}
+
+.syntaxhighlighter .keyword
+{
+ color: #B43D3D !important;
+}
+
+.syntaxhighlighter .preprocessor
+{
+ color: #8AA6C1 !important;
+}
+
+.syntaxhighlighter .variable
+{
+ color: #FFAA3E !important;
+}
+
+.syntaxhighlighter .value
+{
+ color: #F7E741 !important;
+}
+
+.syntaxhighlighter .functions
+{
+ color: #FFAA3E !important;
+}
+
+.syntaxhighlighter .constants
+{
+ color: #E0E8FF !important;
+}
+
+.syntaxhighlighter .script
+{
+ background-color: #404040 !important;
+}
+
+.syntaxhighlighter .color1,
+.syntaxhighlighter .color1 a
+{
+ color: #F8BB00 !important;
+}
+
+.syntaxhighlighter .color2,
+.syntaxhighlighter .color2 a
+{
+ color: #FFFFFF !important;
+}
+
+.syntaxhighlighter .color3,
+.syntaxhighlighter .color3 a
+{
+ color: #FFAA3E !important;
+}
Added: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/shThemeRDark.css
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/shThemeRDark.css (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/styles/shThemeRDark.css 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,175 @@
+/**
+ * SyntaxHighlighter
+ * http://alexgorbatchev.com/
+ *
+ * SyntaxHighlighter is donationware. If you are using it, please donate.
+ * http://alexgorbatchev.com/wiki/SyntaxHighlighter:Donate
+ *
+ * @version
+ * 2.1.364 (October 15 2009)
+ *
+ * @copyright
+ * Copyright (C) 2004-2009 Alex Gorbatchev.
+ *
+ * @license
+ * This file is part of SyntaxHighlighter.
+ *
+ * SyntaxHighlighter is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * SyntaxHighlighter is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with SyntaxHighlighter. If not, see <http://www.gnu.org/copyleft/lesser.html>.
+ */
+/**
+ * RDark SyntaxHighlighter theme based on theme by Radu Dineiu
+ * http://www.vim.org/scripts/script.php?script_id=1732
+ */
+
+/************************************
+ * Interface elements.
+ ************************************/
+
+.syntaxhighlighter
+{
+ background-color: #1B2426 !important;
+}
+
+/* Gutter line numbers */
+.syntaxhighlighter .line .number
+{
+ color: #B9BDB6 !important;
+}
+
+/* Add border to the lines */
+.syntaxhighlighter .line .content
+{
+ border-left: 3px solid #435A5F !important;
+ color: #B9BDB6 !important;
+}
+
+.syntaxhighlighter.printing .line .content
+{
+ border: 0 !important;
+}
+
+/* First line */
+.syntaxhighlighter .line.alt1
+{
+ background-color: #1B2426 !important;
+}
+
+/* Second line */
+.syntaxhighlighter .line.alt2
+{
+ background-color: #1B2426 !important;
+}
+
+/* Highlighed line number */
+.syntaxhighlighter .line.highlighted .number
+{
+ background-color: #435A5F !important;
+ color: #fff !important;
+}
+
+/* Highlighed line */
+.syntaxhighlighter .line.highlighted.alt1,
+.syntaxhighlighter .line.highlighted.alt2
+{
+ background-color: #435A5F !important;
+}
+
+.syntaxhighlighter .toolbar
+{
+ background-color: #1B2426 !important;
+}
+
+.syntaxhighlighter .toolbar a
+{
+ color: #646763 !important;
+}
+
+.syntaxhighlighter .toolbar a:hover
+{
+ color: #E0E8FF !important;
+}
+
+/************************************
+ * Actual syntax highlighter colors.
+ ************************************/
+.syntaxhighlighter .plain,
+.syntaxhighlighter .plain a
+{
+ color: #B9BDB6 !important;
+}
+
+.syntaxhighlighter .comments,
+.syntaxhighlighter .comments a
+{
+ color: #878A85 !important;
+}
+
+.syntaxhighlighter .string,
+.syntaxhighlighter .string a
+{
+ color: #5CE638 !important;
+}
+
+.syntaxhighlighter .keyword
+{
+ color: #5BA1CF !important;
+}
+
+.syntaxhighlighter .preprocessor
+{
+ color: #435A5F !important;
+}
+
+.syntaxhighlighter .variable
+{
+ color: #FFAA3E !important;
+}
+
+.syntaxhighlighter .value
+{
+ color: #090 !important;
+}
+
+.syntaxhighlighter .functions
+{
+ color: #FFAA3E !important;
+}
+
+.syntaxhighlighter .constants
+{
+ color: #E0E8FF !important;
+}
+
+.syntaxhighlighter .script
+{
+ background-color: #435A5F !important;
+}
+
+.syntaxhighlighter .color1,
+.syntaxhighlighter .color1 a
+{
+ color: #E0E8FF !important;
+}
+
+.syntaxhighlighter .color2,
+.syntaxhighlighter .color2 a
+{
+ color: #FFFFFF !important;
+}
+
+.syntaxhighlighter .color3,
+.syntaxhighlighter .color3 a
+{
+ color: #FFAA3E !important;
+}
Added: examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/test.html
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/test.html (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/syntaxhighlighter/test.html 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,43 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <title>SyntaxHighlighter Build Test Page</title>
+ <script type="text/javascript" src="scripts/shCore.js"></script>
+ <script type="text/javascript" src="scripts/shBrushBash.js"></script>
+ <script type="text/javascript" src="scripts/shBrushCpp.js"></script>
+ <script type="text/javascript" src="scripts/shBrushCSharp.js"></script>
+ <script type="text/javascript" src="scripts/shBrushCss.js"></script>
+ <script type="text/javascript" src="scripts/shBrushDelphi.js"></script>
+ <script type="text/javascript" src="scripts/shBrushDiff.js"></script>
+ <script type="text/javascript" src="scripts/shBrushGroovy.js"></script>
+ <script type="text/javascript" src="scripts/shBrushJava.js"></script>
+ <script type="text/javascript" src="scripts/shBrushJScript.js"></script>
+ <script type="text/javascript" src="scripts/shBrushPhp.js"></script>
+ <script type="text/javascript" src="scripts/shBrushPlain.js"></script>
+ <script type="text/javascript" src="scripts/shBrushPython.js"></script>
+ <script type="text/javascript" src="scripts/shBrushRuby.js"></script>
+ <script type="text/javascript" src="scripts/shBrushScala.js"></script>
+ <script type="text/javascript" src="scripts/shBrushSql.js"></script>
+ <script type="text/javascript" src="scripts/shBrushVb.js"></script>
+ <script type="text/javascript" src="scripts/shBrushXml.js"></script>
+ <link type="text/css" rel="stylesheet" href="styles/shCore.css"/>
+ <link type="text/css" rel="stylesheet" href="styles/shThemeDefault.css"/>
+ <script type="text/javascript">
+ SyntaxHighlighter.config.clipboardSwf = 'scripts/clipboard.swf';
+ SyntaxHighlighter.all();
+ </script>
+</head>
+
+<body >
+<h1>SyntaxHihglighter Test</h1>
+<p>This is a test file to insure that everything is working well.</p>
+
+<pre class="brush: c-sharp;">
+function test() : String
+{
+ return 10;
+}
+</pre>
+</body>
+</html>
Added: examples/trunk/jsf/pastecode/src/main/webapp/template.xhtml
===================================================================
--- examples/trunk/jsf/pastecode/src/main/webapp/template.xhtml (rev 0)
+++ examples/trunk/jsf/pastecode/src/main/webapp/template.xhtml 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,98 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core">
+
+<f:view>
+ <ui:insert name="viewMetadata"/>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <title>PasteCode</title>
+ <link rel="stylesheet" href="style/style.css" type="text/css" media="screen" />
+
+ <ui:insert name="themes"/>
+ <ui:insert name="head"/>
+
+</head>
+
+<body>
+<h:form>
+
+<ui:insert name="myscripts"/>
+
+<div id="header">
+
+ <table height="100%" >
+ <tr valign="middle">
+ <td>
+ <div style="padding-left:20px;padding-right:20px;border-width:0px;"><h2>PasteCode</h2></div>
+ <!-- <img id="logo" src="img/logotransparent2.png" alt="Obrazek" width="230" height="65" style="border-width:0px;"/> -->
+
+ </td>
+ <td>
+
+ </td>
+ <td>
+ <a href="home.jsf" style="text-decoration:none;"><span id="menuitem">New</span></a>
+ <a href="history.jsf" style="text-decoration:none;"><span id="menuitem">History</span></a>
+ <a href="help.jsf" style="text-decoration:none;"><span id="menuitem">Help</span></a>
+ </td>
+ </tr>
+ </table>
+</div>
+
+<div id="topseparator">
+</div>
+
+<div id="main">
+<table width="100%" cellspacing="10" style="width:100%;">
+ <tr valign="top">
+ <!-- **************** MAIN AREA **************** -->
+ <td width="100%">
+ <table width="100%" cellpadding="10" cellspacing="0" bgcolor="#E9E9F8" bordercolor="#8784C6" border="1">
+ <tr valign="top">
+ <td bordercolor="#E9E9F8">
+
+ <ui:insert name="mainarea">
+ Main Area
+ </ui:insert>
+
+ <br/> <br/> <br/>
+ </td>
+ </tr>
+ </table>
+ </td>
+
+ <!-- **************** MENU RIGHT **************** -->
+ <td>
+ <table bgcolor="#E9E9F8">
+ <tr valign="top">
+ <td bordercolor="#E9E9F8" >
+
+ <ui:insert name="rightmenu">
+ Menu right
+ </ui:insert>
+
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+</div>
+
+
+<div id="bottomseparator"/>
+
+<div id="footer">
+ <ui:insert name="footer">
+ Powered by WELD (Context and Dependency Injection RI)
+ </ui:insert>
+</div>
+
+</h:form>
+</body>
+</f:view>
+</html>
Added: examples/trunk/jsf/pastecode/weld-pastecode-ds.xml
===================================================================
--- examples/trunk/jsf/pastecode/weld-pastecode-ds.xml (rev 0)
+++ examples/trunk/jsf/pastecode/weld-pastecode-ds.xml 2010-06-15 07:22:26 UTC (rev 6434)
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE datasources
+ PUBLIC "-//JBoss//DTD JBOSS JCA Config 1.5//EN"
+ "http://www.jboss.org/j2ee/dtd/jboss-ds_1_5.dtd">
+
+<datasources>
+ <local-tx-datasource>
+ <jndi-name>pastecodeDatasource</jndi-name>
+ <connection-url>jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}pastecode</connection-url>
+ <driver-class>org.hsqldb.jdbcDriver</driver-class>
+ <user-name>sa</user-name>
+ <password></password>
+ </local-tx-datasource>
+
+ <mbean code="org.jboss.jdbc.HypersonicDatabase"
+ name="jboss:service=Hypersonic,database=pastecode">
+ <attribute name="Database">pastecode</attribute>
+ <attribute name="InProcessMode">true</attribute>
+ </mbean>
+
+
+
+ <!-- <local-tx-datasource>
+ <jndi-name>pastecodeDatasource</jndi-name>
+ <connection-url>jdbc:mysql://localhost:3306/pastecode</connection-url>
+ <driver-class>com.mysql.jdbc.Driver</driver-class>
+ <user-name>root</user-name>
+ <password></password>
+ <exception-sorter-class-name>
+ org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter
+ </exception-sorter-class-name>
+
+ <metadata>
+ <type-mapping>mySQL</type-mapping>
+ </metadata>
+ </local-tx-datasource>
+ -->
+</datasources>
+
13 years, 10 months