[jboss-svn-commits] JBL Code SVN: r9541 - in labs/jbosslabs/trunk/portal-extensions: forge-portal-attr/src/java/org/jboss/forge/portal and 1 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Feb 15 17:50:52 EST 2007


Author: szimano
Date: 2007-02-15 17:50:52 -0500 (Thu, 15 Feb 2007)
New Revision: 9541

Added:
   labs/jbosslabs/trunk/portal-extensions/forge-portal-attr/src/java/org/jboss/forge/portal/InjectLoginLinks.java
Removed:
   labs/jbosslabs/trunk/portal-extensions/jbosswiki/forge-wiki/src/web/views/posting_new_body.xhtml
Modified:
   labs/jbosslabs/trunk/portal-extensions/configuration/to-copy/server/default/deploy/jboss-portal.sar/portal-server.war/WEB-INF/web.xml
Log:
login links injection

Modified: labs/jbosslabs/trunk/portal-extensions/configuration/to-copy/server/default/deploy/jboss-portal.sar/portal-server.war/WEB-INF/web.xml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/configuration/to-copy/server/default/deploy/jboss-portal.sar/portal-server.war/WEB-INF/web.xml	2007-02-15 21:29:16 UTC (rev 9540)
+++ labs/jbosslabs/trunk/portal-extensions/configuration/to-copy/server/default/deploy/jboss-portal.sar/portal-server.war/WEB-INF/web.xml	2007-02-15 22:50:52 UTC (rev 9541)
@@ -101,6 +101,16 @@
       <filter-name>titleAndTimestampFilter</filter-name>
       <url-pattern>/*</url-pattern>
    </filter-mapping>
+   
+   <filter>
+      <filter-name>injectLoginLinkFilter</filter-name>
+      <filter-class>org.jboss.forge.portal.InjectLoginLinks</filter-class>
+   </filter>
+   
+   <filter-mapping>
+      <filter-name>injectLoginLinkFilter</filter-name>
+      <url-pattern>/*</url-pattern>
+   </filter-mapping>
 
    <filter>
 	<filter-name>autologinFilter</filter-name>

Added: labs/jbosslabs/trunk/portal-extensions/forge-portal-attr/src/java/org/jboss/forge/portal/InjectLoginLinks.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-portal-attr/src/java/org/jboss/forge/portal/InjectLoginLinks.java	                        (rev 0)
+++ labs/jbosslabs/trunk/portal-extensions/forge-portal-attr/src/java/org/jboss/forge/portal/InjectLoginLinks.java	2007-02-15 22:50:52 UTC (rev 9541)
@@ -0,0 +1,133 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.forge.portal;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.security.Principal;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jboss.logging.Logger;
+
+/**
+ * InjectLoginLinks.java
+ * 
+ * @author <a href="mailto:tomasz.szymanski at jboss.com">Tomasz Szymanski</a>
+ */
+
+public class InjectLoginLinks implements Filter {
+
+	private final static Logger log = Logger.getLogger(InjectLoginLinks.class);
+
+	private static final String LOGIN_TAG = "<!--&PLACE_LOGIN_HERE&-->";
+
+	private static final String AUTH_LINK = "authsec";
+
+	private static final String AUTH_LINK2 = "auth";
+
+	private static final String PORTAL = "/portal";
+
+	public void destroy() {
+
+	}
+
+	public void doFilter(ServletRequest request, ServletResponse response,
+			FilterChain chain) throws IOException, ServletException {
+
+		HttpServletRequest hReq = (HttpServletRequest) request;
+
+		StringBuffer buffer = new StringBuffer(hReq.getRequestURI());
+
+		if (hReq.getQueryString() != null) {
+			buffer.append("?").append(hReq.getQueryString());
+		}
+		String uri = buffer.toString();
+
+		log.info(uri);
+
+		CharResponseWrapper wrapper = new CharResponseWrapper(
+				(HttpServletResponse) response);
+		chain.doFilter(request, wrapper);
+
+		if (wrapper.getContentType() != null
+				&& wrapper.getContentType().startsWith("text/html")) {
+
+			PrintWriter out = response.getWriter();
+
+			out.write(injectLoginLink(wrapper.toString(), uri, hReq
+					.getUserPrincipal()));
+
+			out.close();
+		}
+	}
+
+	private String injectLoginLink(String content, String uri,
+			Principal principal) {
+		int loginIndx = content.indexOf(LOGIN_TAG);
+		int loginEnd = loginIndx + LOGIN_TAG.length();
+
+		if (loginIndx != -1) {
+
+			StringBuffer newUri = new StringBuffer();
+			newUri.append("<a href='").append(uri).append("'>Login</a>");
+			
+			if (uri.equals("/")) {
+				newUri.append(AUTH_LINK);
+			} else if (newUri.indexOf(AUTH_LINK) == -1
+					&& newUri.indexOf(AUTH_LINK2) == -1) {
+				// add AUTH_LINK
+				int p = newUri.indexOf(PORTAL);
+				newUri.insert(p, "/").insert(p, AUTH_LINK);
+			} else if (principal != null) {
+				// user is logged in
+				newUri = new StringBuffer("<span class='wlcmBox'><b>").append(
+						principal.getName()).append(
+						"</b> | <a href='/portal/logout'>Logout</a> </span>");
+			}
+
+			StringBuffer newContent = new StringBuffer();
+			newContent.append(content.substring(0, loginIndx)).append(
+					newUri.toString()).append(
+					content.substring(loginEnd, content.length() - 1));
+
+			return newContent.toString();
+
+		} else {
+			return content;
+		}
+
+	}
+
+	public void init(FilterConfig arg0) throws ServletException {
+
+	}
+
+}

Deleted: labs/jbosslabs/trunk/portal-extensions/jbosswiki/forge-wiki/src/web/views/posting_new_body.xhtml
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jbosswiki/forge-wiki/src/web/views/posting_new_body.xhtml	2007-02-15 21:29:16 UTC (rev 9540)
+++ labs/jbosslabs/trunk/portal-extensions/jbosswiki/forge-wiki/src/web/views/posting_new_body.xhtml	2007-02-15 22:50:52 UTC (rev 9541)
@@ -1,651 +0,0 @@
-<!--
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* 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.
-*/
--->
-
-<div  xmlns="http://www.w3.org/1999/xhtml"
-      xmlns:ui="http://java.sun.com/jsf/facelets"
-      xmlns:c="http://java.sun.com/jstl/core"
-      xmlns:h="http://java.sun.com/jsf/html"      
-      xmlns:f="http://java.sun.com/jsf/core"
-      xmlns:t="http://myfaces.apache.org/tomahawk"
-      xmlns:forums="http://www.jboss.com/products/jbossportal/forums"
-      class="bb"
->
-<ui:composition template="/views/common/common.xhtml">
-<ui:define name="mainContent">
-
-
-<script language="JavaScript" type="text/javascript">
-&lt;!--
-// bbCode control by
-// subBlue design
-// www.subBlue.com
-
-// Startup variables
-var imageTag = false;
-var theSelection = false;
-
-// Check for Browser &amp; Platform for PC &amp; IE specific bits
-// More details from: http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html
-var clientPC = navigator.userAgent.toLowerCase(); // Get client info
-var clientVer = parseInt(navigator.appVersion); // Get browser version
-
-var is_ie = ((clientPC.indexOf("msie") != -1) &amp;&amp; (clientPC.indexOf("opera") == -1));
-var is_nav = ((clientPC.indexOf('mozilla')!=-1) &amp;&amp; (clientPC.indexOf('spoofer')==-1)
-                &amp;&amp; (clientPC.indexOf('compatible') == -1) &amp;&amp; (clientPC.indexOf('opera')==-1)
-                &amp;&amp; (clientPC.indexOf('webtv')==-1) &amp;&amp; (clientPC.indexOf('hotjava')==-1));
-var is_moz = 0;
-
-var is_win = ((clientPC.indexOf("win")!=-1) || (clientPC.indexOf("16bit") != -1));
-var is_mac = (clientPC.indexOf("mac")!=-1);
-
-// Helpline messages
-b_help = "${resource.bbcode_b_help}";
-i_help = "${resource.bbcode_i_help}";
-u_help = "${resource.bbcode_u_help}";
-q_help = "${resource.bbcode_q_help}";
-c_help = "${resource.bbcode_c_help}";
-l_help = "${resource.bbcode_l_help}";
-o_help = "${resource.bbcode_o_help}";
-p_help = "${resource.bbcode_p_help}";
-w_help = "${resource.bbcode_w_help}";
-a_help = "${resource.bbcode_a_help}";
-s_help = "${resource.bbcode_s_help}";
-f_help = "${resource.bbcode_f_help}";
-
-// Define the bbCode tags
-bbcode = new Array();
-bbtags = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[quote]','[/quote]','[code]','[/code]','[list]','[/list]','[list=]','[/list]','[img]','[/img]','[url]','[/url]');
-imageTag = false;
-
-// Shows the help messages in the helpline window
-function helpline(help) {
-	document.post.helpbox.value = eval(help + "_help");
-}
-
-
-// Replacement for arrayname.length property
-function getarraysize(thearray) {
-	for (i = 0; i &lt; thearray.length; i++) {
-		if ((thearray[i] == "undefined") || (thearray[i] == "") || (thearray[i] == null))
-			return i;
-		}
-	return thearray.length;
-}
-
-// Replacement for arrayname.push(value) not implemented in IE until version 5.5
-// Appends element to the array
-function arraypush(thearray,value) {
-	thearray[ getarraysize(thearray) ] = value;
-}
-
-// Replacement for arrayname.pop() not implemented in IE until version 5.5
-// Removes and returns the last element of an array
-function arraypop(thearray) {
-	thearraysize = getarraysize(thearray);
-	retval = thearray[thearraysize - 1];
-	delete thearray[thearraysize - 1];
-	return retval;
-}
-
-
-function checkForm() {
-
-	formErrors = false;    
-
-	if (document.post["post:message"].value.length &lt; 2) {
-		formErrors = "${resource.Empty_message}";
-	}
-
-	if (formErrors) {
-		alert(formErrors);
-		return false;
-	} else {
-		bbstyle(-1);
-		//formObj.preview.disabled = true;
-		//formObj.submit.disabled = true;
-		return true;
-	}
-}
-
-function emoticon(text) {
-	var txtarea = document.post["post:message"];
-	text = ' ' + text + ' ';
-	if (txtarea.createTextRange &amp;&amp; txtarea.caretPos) {
-		var caretPos = txtarea.caretPos;
-		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
-		txtarea.focus();
-	} else {
-		txtarea.value  += text;
-		txtarea.focus();
-	}
-}
-
-function bbfontstyle(bbopen, bbclose) {
-	var txtarea = document.post["post:message"];
-
-	if ((clientVer &gt;= 4) &amp;&amp; is_ie &amp;&amp; is_win) {
-		theSelection = document.selection.createRange().text;
-		if (!theSelection) {
-			txtarea.value += bbopen + bbclose;
-			txtarea.focus();
-			return;
-		}
-		document.selection.createRange().text = bbopen + theSelection + bbclose;
-		txtarea.focus();
-		return;
-	}
-	else if (txtarea.selectionEnd &amp;&amp; (txtarea.selectionEnd - txtarea.selectionStart &gt; 0))
-	{
-		mozWrap(txtarea, bbopen, bbclose);
-		return;
-	}
-	else
-	{
-		txtarea.value += bbopen + bbclose;
-		txtarea.focus();
-	}
-	storeCaret(txtarea);
-}
-
-
-function bbstyle(bbnumber) {
-	var txtarea = document.post["post:message"];
-
-	txtarea.focus();
-	donotinsert = false;
-	theSelection = false;
-	bblast = 0;
-
-	if (bbnumber == -1) { // Close all open tags &amp; default button names
-		while (bbcode[0]) {
-			butnumber = arraypop(bbcode) - 1;
-			txtarea.value += bbtags[butnumber + 1];
-			buttext = eval('document.post.addbbcode' + butnumber + '.value');
-			eval('document.post.addbbcode' + butnumber + '.value ="' + buttext.substr(0,(buttext.length - 1)) + '"');
-		}
-		imageTag = false; // All tags are closed including image tags :D
-		txtarea.focus();
-		return;
-	}
-
-	if ((clientVer &gt;= 4) &amp;&amp; is_ie &amp;&amp; is_win)
-	{
-		theSelection = document.selection.createRange().text; // Get text selection
-		if (theSelection) {
-			// Add tags around selection
-			document.selection.createRange().text = bbtags[bbnumber] + theSelection + bbtags[bbnumber+1];
-			txtarea.focus();
-			theSelection = '';
-			return;
-		}
-	}
-	else if (txtarea.selectionEnd &amp;&amp; (txtarea.selectionEnd - txtarea.selectionStart &gt; 0))
-	{
-		mozWrap(txtarea, bbtags[bbnumber], bbtags[bbnumber+1]);
-		return;
-	}
-	
-	// Find last occurance of an open tag the same as the one just clicked
-	for (i = 0; i &lt; bbcode.length; i++) {
-		if (bbcode[i] == bbnumber+1) {
-			bblast = i;
-			donotinsert = true;
-		}
-	}
-
-	if (donotinsert) {		// Close all open tags up to the one just clicked &amp; default button names
-		while (bbcode[bblast]) {
-				butnumber = arraypop(bbcode) - 1;
-				txtarea.value += bbtags[butnumber + 1];
-				buttext = eval('document.post.addbbcode' + butnumber + '.value');
-				eval('document.post.addbbcode' + butnumber + '.value ="' + buttext.substr(0,(buttext.length - 1)) + '"');
-				imageTag = false;
-			}
-			txtarea.focus();
-			return;
-	} else { // Open tags
-	
-		if (imageTag &amp;&amp; (bbnumber != 14)) {		// Close image tag before adding another
-			txtarea.value += bbtags[15];
-			lastValue = arraypop(bbcode) - 1;	// Remove the close image tag from the list
-			document.post.addbbcode14.value = "Img";	// Return button back to normal state
-			imageTag = false;
-		}
-		
-		// Open tag
-		txtarea.value += bbtags[bbnumber];
-		if ((bbnumber == 14) &amp;&amp; (imageTag == false)) imageTag = 1; // Check to stop additional tags after an unclosed image tag
-		arraypush(bbcode,bbnumber+1);
-		eval('document.post.addbbcode'+bbnumber+'.value += "*"');
-		txtarea.focus();
-		return;
-	}
-	storeCaret(txtarea);
-}
-
-// From http://www.massless.org/mozedit/
-function mozWrap(txtarea, open, close)
-{
-	var selLength = txtarea.textLength;
-	var selStart = txtarea.selectionStart;
-	var selEnd = txtarea.selectionEnd;
-	if (selEnd == 1 || selEnd == 2) 
-		selEnd = selLength;
-
-	var s1 = (txtarea.value).substring(0,selStart);
-	var s2 = (txtarea.value).substring(selStart, selEnd)
-	var s3 = (txtarea.value).substring(selEnd, selLength);
-	txtarea.value = s1 + open + s2 + close + s3;
-	return;
-}
-
-// Insert at Claret position. Code from
-// http://www.faqts.com/knowledge_base/view.phtml/aid/1052/fid/130
-function storeCaret(textEl) {
-	if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
-}
-
-function selectOption(optionVal)
-{
-	document.post.o.value = optionVal;
-}
-
-function selectAttachment(attachmentVal)
-{
-	document.post.ATTACHMENT.value = attachmentVal;
-}
-
-//--&gt;
-</script>
-
-	<c:if test="#{newTopic.preview}">
-   			<ui:include src="/views/topics/posting_new_preview.xhtml"/>
-   			<br clear="all"/>
-	</c:if>
-
-
-<table border="0" cellpadding="3" cellspacing="1" width="100%" class="forumline">
-	<h:form id="post" enctype="multipart/form-data">		
-	    <!-- keeps the forum where this topic is being created in context, this is a control parameter -->
-		<input type="hidden" name="f" value="#{newTopic.forumId}"/>	      	
-				
-	    <!-- add Subject -->
-		<tr>
-	   		<td class="row1" width="22%">
-	   			<span class="gen">
-	   				<b>${resource.Subject}</b>
-	   			</span>
-	   		</td>
-	   		<td class="row2" width="78%">
-	   			<span class="gen">					
-					<h:inputText value="#{newTopic.subject}" size="45" maxlength="200" style="width:450px" tabindex="2" styleClass="post"/>
-				</span>
-	   		</td>
-		</tr>
-		
-		
-		<!-- Add Message -->
-		<tr>
-			<td class="row1" valign="top">
-			   <table width="100%" border="0" cellspacing="0" cellpadding="1">
-			      <tr>
-			         <td><span class="gen"><b>${resource.Message_body}</b></span></td>
-			      </tr>
-			      <tr>
-			         <td valign="middle" align="center"><br/>
-			            <table width="100" border="0" cellspacing="0" cellpadding="5">
-			               <tr align="center">
-			                  <td colspan="" class="gensmall"><b></b></td>
-			               </tr>			               			               
-			            </table>
-			         </td>
-			      </tr>
-			   </table>
-			</td>
-			<td class="row2" valign="top"><span class="gen"> <span class="genmed"> 
-			</span>
-			<table width="450" border="0" cellspacing="0" cellpadding="2">
-	         <tr align="center" valign="middle">
-	            <td><span class="genmed">
-				  <input type="button" class="button" accesskey="b" name="addbbcode0" value=" B "
-	                  style="font-weight:bold; width: 30px" onClick="bbstyle(0)" onMouseOver="helpline('b')"/>
-				  </span></td>
-	            <td><span class="genmed">
-				  <input type="button" class="button" accesskey="i" name="addbbcode2" value=" i "
-	                  style="font-style:italic; width: 30px" onClick="bbstyle(2)" onMouseOver="helpline('i')"/>
-				  </span></td>
-	            <td><span class="genmed">
-				  <input type="button" class="button" accesskey="u" name="addbbcode4" value=" u "
-	                  style="text-decoration: underline; width: 30px" onClick="bbstyle(4)" onMouseOver="helpline('u')"/>
-				  </span></td>
-	            <td><span class="genmed">
-				  <input type="button" class="button" accesskey="q" name="addbbcode6" value="Quote" style="width: 50px"
-	                  onClick="bbstyle(6)" onMouseOver="helpline('q')"/>
-				  </span></td>
-	            <td><span class="genmed">
-				  <input type="button" class="button" accesskey="c" name="addbbcode8" value="Code" style="width: 40px"
-	                  onClick="bbstyle(8)" onMouseOver="helpline('c')"/>
-				  </span></td>
-	            <td><span class="genmed">
-				  <input type="button" class="button" accesskey="l" name="addbbcode10" value="List" style="width: 40px"
-	                  onClick="bbstyle(10)" onMouseOver="helpline('l')"/>
-				  </span></td>
-	            <td><span class="genmed">
-				  <input type="button" class="button" accesskey="o" name="addbbcode12" value="List=" style="width: 40px"
-	                  onClick="bbstyle(12)" onMouseOver="helpline('o')"/>
-				  </span></td>
-	            <td><span class="genmed">
-				  <input type="button" class="button" accesskey="p" name="addbbcode14" value="Img" style="width: 40px"
-	                  onClick="bbstyle(14)" onMouseOver="helpline('p')"/>
-				  </span></td>
-	            <td><span class="genmed">
-				  <input type="button" class="button" accesskey="w" name="addbbcode16" value="URL"
-	                  style="text-decoration: underline; width: 40px" onClick="bbstyle(16)" onMouseOver="helpline('w')"/>
-				  </span></td>
-	         </tr>
-	         <tr>
-	            <td colspan="9">
-	               <table width="100%" border="0" cellspacing="0" cellpadding="0">
-	                  <tr>
-	                     <td><span class="genmed"> &#160;${resource.Font_color}:
-						<select name="addbbcode18"
-	                       onChange="bbfontstyle('[color=' + this.form.addbbcode18.options[this.form.addbbcode18.selectedIndex].value + ']', '[/color]');this.selectedIndex=0;"
-	                       onMouseOver="helpline('s')">
-	                  <option style="color:black; background-color: " value=""
-	                          class="genmed">${resource.color_default}</option>
-	                  <option style="color:darkred; background-color: " value="darkred"
-	                          class="genmed">${resource.color_dark_red}</option>
-	                  <option style="color:red; background-color: " value="red"
-	                          class="genmed">${resource.color_red}</option>
-	                  <option style="color:orange; background-color: " value="orange"
-	                          class="genmed">${resource.color_orange}</option>
-	                  <option style="color:brown; background-color: " value="brown"
-	                          class="genmed">${resource.color_brown}</option>
-	                  <option style="color:yellow; background-color: " value="yellow"
-	                          class="genmed">${resource.color_yellow}</option>
-	                  <option style="color:green; background-color: " value="green"
-	                          class="genmed">${resource.color_green}</option>
-	                  <option style="color:olive; background-color: " value="olive"
-	                          class="genmed">${resource.color_olive}</option>
-	                  <option style="color:cyan; background-color: " value="cyan"
-	                          class="genmed">${resource.color_cyan}</option>
-	                  <option style="color:blue; background-color: " value="blue"
-	                          class="genmed">${resource.color_blue}</option>
-	                  <option style="color:darkblue; background-color: " value="darkblue"
-	                          class="genmed">${resource.color_dark_blue}</option>
-	                  <option style="color:indigo; background-color: " value="indigo"
-	                          class="genmed">${resource.color_indigo}</option>
-	                  <option style="color:violet; background-color: " value="violet"
-	                          class="genmed">${resource.color_violet}</option>
-	                  <option style="color:white; background-color: " value="white"
-	                          class="genmed">${resource.color_white}</option>
-	                  <option style="color:black; background-color: " value="black"
-	                          class="genmed">${resource.color_black}</option>
-	                  </select> &#160;${resource.Font_size}:<select name="addbbcode20"
-	                                                              onChange="bbfontstyle('[size=' + this.form.addbbcode20.options[this.form.addbbcode20.selectedIndex].value + ']', '[/size]')"
-	                                                              onMouseOver="helpline('f')">
-	                        <option value="7" class="genmed">${resource.font_tiny}</option>
-	                        <option value="9" class="genmed">${resource.font_small}</option>
-	                        <option value="12" class="genmed" selected="true">${resource.font_normal}</option>
-	                        <option value="18" class="genmed">${resource.font_large}</option>
-	                        <option value="24" class="genmed">${resource.font_huge}</option>
-	                     </select>
-						</span></td>
-	                     <td nowrap="nowrap" align="right"><span class="gensmall"><a href="javascript:bbstyle(-1)"
-	                                                                                 class="genmed"
-	                                                                                 onMouseOver="helpline('a')">${resource.Close_Tags}</a></span>
-	                     </td>
-	                  </tr>
-	               </table>
-	            </td>
-	         </tr>
-	         <tr>
-	            <td colspan="9"><span class="gensmall">
-				  <input type="text" name="helpbox" size="45" maxlength="100" style="width:450px; font-size:10px"
-	                  class="helpline" value="${resource.Styles_tip}"/>
-				  </span></td>
-	         </tr>
-	         <tr>
-	            <td colspan="9">
-	              <span class="gen">
-					  <h:inputTextarea id="message" value="#{newTopic.message}" rows="15" cols="35" 
-					  style="width:450px" 
-					  tabindex="3" styleClass="post"
-		              onselect="storeCaret(this);" onkeyup="storeCaret(this);" onclick="storeCaret(this);">			              	
-		              </h:inputTextarea>	              
-				  </span>
-				</td>
-	         </tr>
-	      </table>
-		  </span>
-		 </td>
-	</tr>
-	
-	<!-- Add Options -->
-	<tr>
-	   <td class="row1" valign="top">
-	   	<span class="gen">
-	   		<b>${resource.Options}</b>
-	   	</span>
-	   </td>
-	   <td class="row2"><span class="gen"> </span>
-	      <table cellspacing="0" cellpadding="1" border="0">		         		         		         		         		         		         	         
-	            <tr>
-	               <td></td>
-	               <td>
-	               <span class="gen">
-	         	    	<span class="gen">${resource.Post_topic_as}:
-	         	    	    <h:selectOneRadio value="#{newTopic.topicType}" styleClass="gen">
-			            		<f:selectItem itemValue="0" itemLabel="Normal">
-			            			<f:verbatim>&#160;&#160;&#160;</f:verbatim>
-			            		</f:selectItem>			            		
-			            		<f:selectItem itemValue="1" itemLabel="Sticky">
-			            			<f:verbatim>&#160;&#160;&#160;</f:verbatim>
-			            		</f:selectItem>			            		
-			            		<f:selectItem itemValue="2" itemLabel="Announcement">
-			            			<f:verbatim>&#160;&#160;&#160;</f:verbatim>
-			            		</f:selectItem>			            		
-		            		</h:selectOneRadio>
-		            	</span>
-		            </span>
-	         	   </td>
-	            </tr>	         
-	      </table>
-	   </td>
-	</tr>
-
-
-	<!-- poll ui -->		
-	<forums:isAllowed fragment="acl://managePoll">	
-	<tr>
-   		<th class="thHead" colspan="2">${resource.Add_poll}</th>
-		</tr>
-		<tr>
-		   <td class="row1" colspan="2"><span class="gensmall">${resource.Add_poll_explain}</span></td>
-		</tr>
-		
-		
-		<!-- setup poll question -->
-		<tr>
-		   <td class="row1"><span class="gen"><b>${resource.Poll_question}</b></span></td>
-		   <td class="row2">
-		   		<span class="genmed">   			
-		   			<h:inputText value="#{newTopic.question}" size="50" maxlength="255" styleClass="post"/>
-		   		</span>
-		   </td>
-		</tr>
-		
-		
-		<!-- update poll options already added -->
-		<input type="hidden" name="o"/>
-		<c:forEach items="${newTopic.options}" var="optionRow" varStatus="idx">
-		   <tr>
-		      <td class="row1"><span class="gen"><b>${resource.Poll_option}</b></span></td>
-		      <td class="row2">
-		      		<span class="genmed">
-			            <input type="text" id="option_${idx.index}" name="option_${idx.index}" value="${optionRow}" size="50" class="post" maxlength="255"/>
-		            </span>&#160;            
-		            <h:commandButton action="#{newTopic.updateOption}" value="${resource.Update}" styleClass="liteoption"
-                            onclick="selectOption(${idx.index});"/>
-		            <h:commandButton action="#{newTopic.deleteOption}" value="${resource.Delete}" styleClass="liteoption"
-		            onclick="selectOption(${idx.index});"/>            
-		      </td>
-		   </tr>
-		</c:forEach>
-		
-		
-		<!-- add poll options -->
-		<tr>
-		   <td class="row1"><span class="gen"><b>${resource.Poll_option}</b></span></td>
-		   <td class="row2">
-		   	<span class="genmed">   		
-		   		<h:inputText value="#{newTopic.option}" size="50" maxlength="255" styleClass="post"/>
-		   	</span> &#160;   	
-		   	<h:commandButton action="#{newTopic.addOption}" value="${resource.Add_option}" styleClass="liteoption"/>
-		   </td>
-		</tr>
-		
-		
-		<!-- setup poll duration -->
-		<tr>
-		   <td class="row1">
-		   	<span class="gen"><b>${resource.Poll_for}</b></span>
-		   </td>
-		   <td class="row2">
-		   	<span class="genmed">   		
-		   		<h:inputText value="#{newTopic.activeDuration}" size="3" maxlength="3" styleClass="post"/>
-		   	</span>&#160;
-		    <span class="gen"><b>${resource.Days}</b></span> &#160; <span class="gensmall">${resource.Poll_for_explain}</span>
-		   </td>
-		</tr>
-		</forums:isAllowed>
-		
-	
-		<!-- attachment ui -->	
-		<forums:isAllowed fragment="acl://managePostAttachments">				
-		<tr>
-   			<th class="thHead" colspan="2">${resource.Add_attachment_title}</th>
-		</tr>
-		
-		<tr>
-		   <td class="row1" colspan="2">
-		   	<span class="gensmall">
-		   		${resource.Add_attachment_explain}<br/>
-		   	</span>
-		   </td>
-		</tr>
-		
-		
-		<!-- upload button -->
-		<tr>
-		   <td class="row1"><span class="gen"><b>${resource.File_name}</b></span></td>
-		   <td class="row2">
-		   	<span class="genmed">   		
-		   		<t:inputFileUpload value="#{newTopic.attachment}" size="40" styleClass="post"/>
-		   	</span>
-		   </td>
-		</tr>
-		
-		
-		<!-- comment -->
-		<tr>
-		   <td class="row1"><span class="gen"><b>${resource.File_comment}</b></span></td>
-		   <td class="row2">
-		   	<span class="genmed">   		
-		   		<h:inputTextarea value="#{newTopic.attachmentComment}" rows="3" cols="35" styleClass="post"/>
-		   	</span>
-		    <span class="gen">    	
-		    	<h:commandButton action="#{newTopic.addAttachment}" value="${resource.Add_attachment}" styleClass="liteoption"/>
-		    </span>
-		   </td>
-		</tr>
-		
-		<c:if test="#{newTopic.numberOfAttachments>0}">
-
-		<tr>
-		   <th class="thHead" colspan="2">${resource.Posted_attachments}</th>
-		</tr>
-		
-		<!-- uploaded list of attachments -->
-		<input type="hidden" name="ATTACHMENT"/>
-		<c:forEach items="#{newTopic.attachments}" var="attachRow" varStatus="idx">
-		   <tr>
-		      <td class="row1"><span class="gen"><b>${resource.File_name}</b></span></td>
-		      <td class="row2"><span class="gen">${attachRow.fileName}</span></td>
-		   </tr>
-		   <tr>
-		      <td class="row1"><span class="gen"><b>${resource.File_comment}</b></span></td>
-		      <td class="row2">
-			      <span class="genmed">	      	
-			      	<h:inputTextarea id="attachment_${idx.index}" value="#{attachRow.comment}" rows="3" cols="35" styleClass="post"/>   			
-			      </span>
-		      </td>
-		   </tr>
-		   <tr>
-		      <td class="row1"><span class="gen"><b>${resource.Options}</b></span></td>
-		      <td class="row2"><span class="genmed">			 	   	
-					&#160; 			
-					<h:commandButton action="#{newTopic.updateAttachment}" value="${resource.Update_comment}" styleClass="liteoption"
-                                        onclick="selectAttachment('${idx.index}');"/>	
-					&#160; 			
-					<h:commandButton action="#{newTopic.deleteAttachment}" value="${resource.Delete_attachment}" styleClass="liteoption" 
-					onclick="selectAttachment('${idx.index}');"/>            		
-		       </span>
-		      </td>
-		   </tr>   
-		</c:forEach>		
-		</c:if>	   	
-		</forums:isAllowed>
-	
-	
-	  <!-- hookup the buttons -->	
-	  <tr>
-	   <td class="catBottom" colspan="2" align="center" height="28"> 	   	  
-	      <h:commandButton action="#{newTopic.preview}" value="${resource.Preview}" 
-	      onclick="return checkForm(this.parentNode)" 
-	      styleClass="mainoption"
-	      tabindex="5"/>
-	      &#160;
-	      <!--TODO: Missing execution of javascript checking form - onclick="return checkForm(this.parentNode)" -->
-	      <h:commandButton action="#{newTopic.execute}" value="${resource.Submit}" 	      
-	      styleClass="mainoption"
-	      accesskey="s" tabindex="6"/>	      	
-	      &#160;
-	      <h:commandButton action="#{newTopic.cancel}" value="${resource.Cancel}" accesskey="c" tabindex="7" styleClass="mainoption"/>	      
-	   </td>
-	</tr>
-	
-	<table width="100%" cellspacing="2" border="0" align="center" cellpadding="2">
-	   <tr>
-	      <td align="right" valign="top"><span class="gensmall"></span></td>
-	   </tr>
-	</table>
-	
-</h:form>
-</table>
-
-</ui:define>
-</ui:composition>
-
-</div>
\ No newline at end of file




More information about the jboss-svn-commits mailing list