[jboss-cvs] jboss-seam/examples/wiki/view/includes ...
Christian Bauer
christian at hibernate.org
Mon Sep 24 04:23:21 EDT 2007
User: cbauer
Date: 07/09/24 04:23:21
Modified: examples/wiki/view/includes breadcrumb.xhtml
wikiTextEditor.xhtml userControl.xhtml
popupDialog.xhtml commentForm.xhtml
Added: examples/wiki/view/includes wikiTextPreview.xhtml
helpPopupButton.xhtml helpPopup.xhtml
Log:
New help system and improved wiki text editor
Revision Changes Path
1.6 +1 -1 jboss-seam/examples/wiki/view/includes/breadcrumb.xhtml
(In the diff below, changes in quantity of whitespace are not shown.)
Index: breadcrumb.xhtml
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/view/includes/breadcrumb.xhtml,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- breadcrumb.xhtml 3 Sep 2007 10:36:44 -0000 1.5
+++ breadcrumb.xhtml 24 Sep 2007 08:23:21 -0000 1.6
@@ -8,7 +8,7 @@
<h:panelGroup styleClass="breadcrumbPanel">
- <h:outputLink value="#{wiki:renderURL(node)}" styleClass="itemLink breadcrumbRoot">
+ <h:outputLink value="#{wiki:renderURL(wikiRoot)}" styleClass="itemLink breadcrumbRoot">
<h:outputText value="#{wiki:truncateString(wikiRoot.name, 25, '...')}"/>
</h:outputLink>
<h:outputText styleClass="itemSeparator breadcrumbRoot" value="·"/>
1.4 +94 -165 jboss-seam/examples/wiki/view/includes/wikiTextEditor.xhtml
(In the diff below, changes in quantity of whitespace are not shown.)
Index: wikiTextEditor.xhtml
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/view/includes/wikiTextEditor.xhtml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- wikiTextEditor.xhtml 31 Aug 2007 15:18:26 -0000 1.3
+++ wikiTextEditor.xhtml 24 Sep 2007 08:23:21 -0000 1.4
@@ -6,9 +6,29 @@
xmlns:a="https://ajax4jsf.dev.java.net/ajax"
xmlns:wiki="http://jboss.com/products/seam/wiki">
-<!-- TODO: Most of this Javascript could be made generic and not rendered for each and every text editor... -->
+<!-- TODO: Most of this Javascript could be made generic and not rendered for each and every
+ text editor on the page (luckily we usually have just one)... -->
+
+<script type="text/javascript" src="#{wikiPreferences.baseUrl}/seam/resource/remoting/resource/remote.js"></script>
+<script type="text/javascript" src="#{wikiPreferences.baseUrl}/seam/resource/remoting/interface.js?wikiTextEditor"></script>
+<script type="text/javascript">
+ /* Set text area resize on backing bean */
+ Seam.Remoting.displayLoadingMessage = function() {};
+ Seam.Remoting.hideLoadingMessage = function() {};
+ Seam.Remoting.getContext().setConversationId('#{conversation.id}');
+
+ var wikiTextEditor = Seam.Component.getInstance("wikiTextEditor");
+ function storeTextAreaRows(editorId, textAreaRows) {
+ wikiTextEditor.setTextAreaRows(editorId, textAreaRows, noopCallback);
+ }
+ function noopCallback() {}
+</script>
+
+<s:div styleClass="entry" id="#{textEditorId}TextEditor" style="margin-bottom:10px;">
+
+ <script type="text/javascript">
+ if(!jQuery.browser.safari && !jQuery.browser.msie){
-<script type="text/javascript">if (!$.browser.safari && !$.browser.msie) {
/* Assign resize handle to text area */
jQuery(function() {
jQuery("##{namingContainer}\\:#{textEditorId}TextEditDiv").Resizable({
@@ -17,43 +37,35 @@
s: '##{namingContainer}\\:#{textEditorId}TextEditResizeHandle'
},
onResize: function(size) {
+ jQuery("##{namingContainer}\\:#{textEditorId}TextArea").attr("rows", Math.floor(size.height/15));
jQuery("##{namingContainer}\\:#{textEditorId}TextArea").css({ height: size.height + "px" });
+ },
+ onStop: function() {
+ storeTextAreaRows('#{textEditorId}', jQuery("##{namingContainer}\\:#{textEditorId}TextArea").attr('rows'));
}
});
jQuery("##{namingContainer}\\:#{textEditorId}TextEditResizeHandle").show();
})
-}
-;
-jQuery(function() {
- /* Switch access keys to currently active text editor and preview window when the user tabs through several editors */
- jQuery("##{namingContainer}\\:#{textEditorId}TextArea").focus(
- function() {
- jQuery(".closeDialog", "##{namingContainer}\\:#{textEditorId}Preview").attr("accesskey", "C");
- jQuery('##{namingContainer}\\:#{textEditorId}PreviewTrigger').attr("accesskey", "O");
- }
- );
-});
-</script>
+ };
+ </script>
-<div class="entry">
+ <s:span id="#{textEditorId}MessageLabel">
<s:div id="#{textEditorId}Message" styleClass="#{wiki:hasMessage(namingContainer, wiki:concat(textEditorId, 'TextArea'))?'errorDiv':''}">
<h:panelGrid columns="2" rendered="#{wiki:hasMessage(namingContainer, wiki:concat(textEditorId, 'TextArea'))}">
<h:graphicImage value="/themes/#{wikiPreferences.themeName}/img/attention.gif"
width="18" height="18"
styleClass="attentionImage"/>
- <s:span styleClass="attentionMessage"> <h:message for="#{textEditorId}TextArea"/></s:span>
+ <s:span styleClass="attentionMessage"> <span id="#{textEditorId}MessageText"><h:message for="#{textEditorId}TextArea"/></span></s:span>
</h:panelGrid>
</s:div>
<div class="label">
-
<s:div id="#{textEditorId}TabErrors">
-
<s:div rendered="#{!empty tabId}">
<s:span rendered="#{wiki:hasMessage(namingContainer, wiki:concat(textEditorId, 'TextArea'))}">
<script type="text/javascript">jQuery(function() {
- formTabRaiseError("#{tabId}", "#{textEditorId}TextArea", '#{label}:  <h:message for="#{textEditorId}TextArea"/>');
+ formTabRaiseError("#{tabId}", "#{textEditorId}TextArea", '#{label}: ' + jQuery("##{textEditorId}MessageText").html());
});</script>
</s:span>
<s:span rendered="#{!wiki:hasMessage(namingContainer, wiki:concat(textEditorId, 'TextArea'))}">
@@ -65,135 +77,52 @@
</s:div>
<s:div id="#{textEditorId}Label" styleClass="#{wiki:hasMessage(namingContainer, wiki:concat(textEditorId, 'TextArea'))?'errorDiv':''}">
- #{label} (#{valueMaxLength - wiki:length(valueBinding)} wiki text characters):
- </s:div>
-
- <s:div id="#{textEditorId}PreviewTriggerContainer">
- <a:commandLink id="#{textEditorId}PreviewTrigger" onclick="setPreviewPopupPosition#{textEditorId}()"
- status="#{namingContainer}:status"
- reRender="#{textEditorId}Label, #{textEditorId}Message, #{textEditorId}TabErrors, #{textEditorId}PreviewContent"
- styleClass="buttonNonpersistent" tabindex="1"><span class="buttonLabel"><u>O</u>pen Preview</span></a:commandLink>
+ <ui:decorate template="helpPopupButton.xhtml">
+ <ui:param name="label" value="?"/>
+ <ui:param name="width" value="550"/>
+ <ui:param name="height" value="350"/>
+ <ui:param name="top" value="100"/>
+ <ui:param name="left" value="100"/>
+ <ui:param name="helpDocument" value="Wiki Text Markup"/>
+ </ui:decorate>
+ <h:outputText value="#{label}:"/>
+ <s:fragment rendered="#{not empty textPreviewId}">
+ <br/>
+ <h:outputText value="(#{valueMaxLength - wiki:length(valueBinding)} characters left)"/>
+ </s:fragment>
</s:div>
</div>
- <script type="text/javascript">
- function setPreviewPopupPosition#{textEditorId}() {
-
- /* Set the default or custom position of the preview popup */
-
- var defaultTopOffset = jQuery('##{namingContainer}\\:#{textEditorId}TextEditDiv').position().top + 30;
- var defaultLeftOffset = jQuery('##{namingContainer}\\:#{textEditorId}TextEditDiv').position().left - 100;
-
- var customOffsetTop = "#{previewOffsetTop}";
- var customOffsetLeft = "#{previewOffsetLeft}";
-
- var topOffset = (customOffsetTop.length > 0 ? customOffsetTop : defaultTopOffset) + "px";
- var leftOffset = (customOffsetLeft.length > 0 ? customOffsetLeft : defaultLeftOffset) + "px";
-
- jsf('#{textEditorId}PreviewPopup').css({
- top: topOffset,
- left: leftOffset
- });
- }
- </script>
+ </s:span>
<div class="input">
<s:validateAll>
- <s:div id="#{textEditorId}TextEditDiv" styleClass="textEditResizable wideLabels">
- <h:inputTextarea tabindex="1"
+ <s:div id="#{textEditorId}TextEditDiv" styleClass="textEditResizable">
+ <h:inputTextarea id="#{textEditorId}TextArea"
+ style="line-height: 15px"
+ tabindex="1"
+ validator="seamTextValidator"
cols="#{empty textEditorColumns ? '58' : textEditorColumns}"
- rows="#{empty textEditorRows ? 5 : textEditorRows}"
- id="#{textEditorId}TextArea"
+ rows="#{not empty wikiTextEditor.getTextAreaRows(textEditorId)
+ ? wikiTextEditor.getTextAreaRows(textEditorId)
+ : textEditorRows}"
required="#{valueRequired}"
value="#{valueBinding}">
- <!-- TODO: Ideally this should only fire when the preview popup is open... maybe use jquery.bind()/unbind() event handling-->
- <a:support event="onkeyup" reRender="#{textEditorId}Label, #{textEditorId}Message, #{textEditorId}TabErrors, #{textEditorId}PreviewContent"
+ <a:support event="onkeyup"
+ reRender="#{textEditorId}MessageLabel, #{textPreviewId}"
status="#{namingContainer}:status"
- requestDelay="3000" ajaxSingle="true"
- eventsQueue="editKeyPress"/>
+ requestDelay="5000"
+ ajaxSingle="true"
+ eventsQueue="textEditKeyPress"
+ rendered="#{not empty textPreviewId}"/>
</h:inputTextarea>
<s:div id="#{textEditorId}TextEditResizeHandle" styleClass="textEditResizeHandle" style="display:none;"/>
</s:div>
</s:validateAll>
</div>
-</div>
-
-
-<ui:decorate template="popupDialog.xhtml"
- xmlns:s="http://jboss.com/products/seam/taglib"
- xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:a="https://ajax4jsf.dev.java.net/ajax"
- xmlns:wiki="http://jboss.com/products/seam/wiki">
-
- <ui:param name="dialogId" value="#{textEditorId}Preview"/>
- <ui:param name="hideCancelButton" value="true"/>
-
- <ui:define name="dialogInit">
- <script type="text/javascript">jQuery(function() {
-
- /* Create the preview popup and assign the open/close triggers */
-
- var defaultWidth = 350;
- var defaultHeight = 350;
- var customWidth = "#{previewWidth}";
- var customHeight = "#{previewHeight}";
- var width = (customWidth.length > 0 ? customWidth : defaultWidth) + "px";
- var height = (customHeight.length > 0 ? customHeight: defaultHeight) + "px";
-
- var showPopupAndHideTrigger = function(hash) {
- hash.w.show();
- jQuery("##{namingContainer}\\:#{textEditorId}PreviewTriggerContainer").hide();
- jQuery("##{namingContainer}\\:#{textEditorId}TextArea").focus();
- };
-
- var hidePopupAndShowTrigger = function(hash) {
- hash.w.hide();
- jQuery("##{namingContainer}\\:#{textEditorId}PreviewTriggerContainer").show();
- jQuery('##{namingContainer}\\:#{textEditorId}TextArea').focus();
- };
-
- jsf('#{textEditorId}PreviewPopup')
- .css({
- minWidth: height, width: width,
- minHeight: jQuery("##{namingContainer}\\:#{textEditorId}PreviewContent").height() + 115 + "px",
- height: jQuery("##{namingContainer}\\:#{textEditorId}PreviewContent").height() + 115 + "px",
- })
- .jqm({
- trigger: jQuery("##{namingContainer}\\:#{textEditorId}PreviewTrigger"),
- closeClass: "closeDialog",
- onShow: showPopupAndHideTrigger,
- onHide: hidePopupAndShowTrigger,
- overlay: 0
- });
- });</script>
- </ui:define>
- <ui:define name="dialogTitle">Automatic Preview: #{label}</ui:define>
- <ui:define name="dialogContent">
- <wiki:formattedText value="#{valueBinding}"
- linkStyleClass="regularLink"
- brokenLinkStyleClass="brokenLink"
- attachmentLinkStyleClass="regularLink"
- thumbnailLinkStyleClass="regularLink"
- renderBaseDocument="#{previewBaseDocument}"
- renderBaseDirectory="#{previewBaseDirectory}"
- enablePlugins="false"/>
- <script type="text/javascript">jQuery(function() {
- jsf('#{textEditorId}PreviewPopup').css({
- minHeight: jQuery("##{namingContainer}\\:#{textEditorId}PreviewContent").height() + 115 + "px",
- height: jQuery("##{namingContainer}\\:#{textEditorId}PreviewContent").height() + 115 + "px"
- })
- });</script>
- <s:div rendered="#{empty valueBinding}" style="text-align:center">(Please enter some wiki markup, this preview window will refresh automatically.)</s:div>
- </ui:define>
- <ui:define name="dialogControls">
- <h:outputLink styleClass="buttonNonpersistent closeDialog" tabindex="1"><span class="buttonLabel"><u>C</u>lose Preview</span></h:outputLink>
- </ui:define>
-
-</ui:decorate>
+</s:div>
</s:fragment>
1.14 +1 -0 jboss-seam/examples/wiki/view/includes/userControl.xhtml
(In the diff below, changes in quantity of whitespace are not shown.)
Index: userControl.xhtml
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/view/includes/userControl.xhtml,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- userControl.xhtml 4 Sep 2007 09:33:19 -0000 1.13
+++ userControl.xhtml 24 Sep 2007 08:23:21 -0000 1.14
@@ -20,6 +20,7 @@
rendered="#{userManagementPreferences.properties['enableRegistration']}"><u>R</u>egister
</s:link>
+
<s:link styleClass="userControlLink" tabindex="50" accesskey="M" view="/userList_#{skin}.xhtml" propagation="none"><u>M</u>embers</s:link>
</h:panelGroup>
1.5 +1 -1 jboss-seam/examples/wiki/view/includes/popupDialog.xhtml
(In the diff below, changes in quantity of whitespace are not shown.)
Index: popupDialog.xhtml
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/view/includes/popupDialog.xhtml,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- popupDialog.xhtml 17 Aug 2007 13:00:25 -0000 1.4
+++ popupDialog.xhtml 24 Sep 2007 08:23:21 -0000 1.5
@@ -35,5 +35,5 @@
</h:panelGroup>
</s:div>
- <div class="popupDialogResizeHandle" id="#{dialogId}ResizeHandle"/>
+ <s:div styleClass="popupDialogResizeHandle" id="#{dialogId}ResizeHandle" rendered="#{not disableResize}"/>
</s:div>
1.11 +13 -2 jboss-seam/examples/wiki/view/includes/commentForm.xhtml
(In the diff below, changes in quantity of whitespace are not shown.)
Index: commentForm.xhtml
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/view/includes/commentForm.xhtml,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- commentForm.xhtml 1 Sep 2007 08:42:48 -0000 1.10
+++ commentForm.xhtml 24 Sep 2007 08:23:21 -0000 1.11
@@ -56,15 +56,26 @@
<ui:include src="wikiTextEditor.xhtml">
<ui:param name="textEditorId" value="comment"/>
+ <ui:param name="textPreviewId" value="commentPreview"/>
<ui:param name="namingContainer" value="commentForm"/>
<ui:param name="label" value="Comment"/>
<ui:param name="valueBinding" value="#{commentHome.comment.text}"/>
<ui:param name="valueMaxLength" value="8000"/>
<ui:param name="valueRequired" value="true"/>
- <ui:param name="previewBaseDocument" value="#{documentHome.instance}"/>
- <ui:param name="previewBaseDirectory" value="#{documentHome.instance.parent}"/>
+ <ui:param name="textEditorColumns" value="50"/>
+ <ui:param name="textEditorRows" value="10"/>
</ui:include>
+ <s:div styleClass="wideMarginLeft">
+ <ui:include src="wikiTextPreview.xhtml">
+ <ui:param name="textPreviewId" value="commentPreview"/>
+ <ui:param name="valueBinding" value="#{commentHome.comment.text}"/>
+ <ui:param name="enablePlugins" value="false"/>
+ <ui:param name="baseDocument" value="#{documentHome.instance}"/>
+ <ui:param name="baseDirectory" value="#{documentHome.instance.parent}"/>
+ </ui:include>
+ </s:div>
+
<s:div rendered="#{!identity.loggedIn}">
<s:div styleClass="entry">
<div class="label">Verification question:</div>
1.1 date: 2007/09/24 08:23:21; author: cbauer; state: Exp;jboss-seam/examples/wiki/view/includes/wikiTextPreview.xhtml
Index: wikiTextPreview.xhtml
===================================================================
<s:fragment
xmlns:s="http://jboss.com/products/seam/taglib"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:a="https://ajax4jsf.dev.java.net/ajax"
xmlns:wiki="http://jboss.com/products/seam/wiki">
<s:div id="#{textPreviewId}" styleClass="entry">
<s:div styleClass="textPreview input" rendered="#{not empty valueBinding}">
<wiki:formattedText value="#{valueBinding}"
linkStyleClass="regularLink"
brokenLinkStyleClass="brokenLink"
attachmentLinkStyleClass="regularLink"
thumbnailLinkStyleClass="regularLink"
renderBaseDocument="#{baseDocument}"
renderBaseDirectory="#{baseDirectory}"
enablePlugins="false"/>
</s:div>
</s:div>
</s:fragment>
1.1 date: 2007/09/24 08:23:21; author: cbauer; state: Exp;jboss-seam/examples/wiki/view/includes/helpPopupButton.xhtml
Index: helpPopupButton.xhtml
===================================================================
<a:commandLink
xmlns:a="https://ajax4jsf.dev.java.net/ajax"
ajaxSingle="true"
oncomplete="showHelpPopup( '#{width}', '#{height}', '#{top}', '#{left}' )"
reRender="dialogHelpContent"
action="#{help.selectDocumentByName(helpDocument)}"
styleClass="buttonNonpersistent"><span class="buttonLabel">#{label}</span></a:commandLink>
1.1 date: 2007/09/24 08:23:21; author: cbauer; state: Exp;jboss-seam/examples/wiki/view/includes/helpPopup.xhtml
Index: helpPopup.xhtml
===================================================================
<ui:decorate template="popupDialog.xhtml"
xmlns:s="http://jboss.com/products/seam/taglib"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:a="https://ajax4jsf.dev.java.net/ajax"
xmlns:wiki="http://jboss.com/products/seam/wiki">
<ui:param name="dialogId" value="dialogHelp"/>
<ui:param name="hideCancelButton" value="true"/>
<ui:param name="disableResize" value="true"/>
<ui:define name="dialogInit">
<script type="text/javascript">
function showHelpPopup(width, height, top, left) {
jsf('dialogHelpPopup')
.css({
width: width + "px",
minWidth: width + "px",
maxWidth: width + "px",
height: height + "px",
minHeight: height + "px",
maxHeight: height + "px",
top: top + "px",
left: left + "px"
})
.jqm({
closeClass: "closeDialog",
overlay: 0
});
// Fix for Firefox iframe scrollbar rendering bug (wrong z-index, scrollbars are hidden)
jQuery('#dialogHelp').css('position', 'fixed')
jQuery(".closeDialog").attr("accesskey", "H");
jsf('dialogHelpPopup').jqmShow();
};</script>
</ui:define>
<ui:define name="dialogTitle">Help</ui:define>
<ui:define name="dialogContent">
<s:div id="helpSelector">
<h:panelGrid columns="3" styleClass="fullWidth"
columnClasses="alignLeft fivePercentColumn, alignLeft defaultColumn, alignRight tenPercentColumn">
<h:outputText value="Browse:"/>
<h:form id="helpSelectorForm">
<h:selectOneMenu
value="#{help.selectedNode}"
converter="#{nestedSetNodeWrapperRestrictedEntityConverter}">
<s:selectItems value="#{help.root.wrappedChildren}"
var="helpNode"
label="#{wiki:repeatString(' ',helpNode.level)}#{wiki:isDocument(helpNode.wrappedNode) ? '·' : '' }#{wiki:truncateString(helpNode.wrappedNode.name, 40, '...')}"
noSelectionLabel="#{help.root.wrappedNode.name}"/>
<a:support event="onchange" reRender="helpContent,helpSelector"/>
</h:selectOneMenu>
</h:form>
<h:panelGroup>
<h:outputLink value="#{wiki:renderURL(help.selectedNode.wrappedNode)}"
rendered="#{not empty help.selectedNode}"
styleClass="buttonNonpersistent"
tabindex="1"><span class="buttonLabel">Open Fullscreen</span></h:outputLink>
<h:outputLink styleClass="buttonNonpersistent closeDialog"
tabindex="1"><span class="buttonLabel">Close <u>H</u>elp</span></h:outputLink>
</h:panelGroup>
</h:panelGrid>
</s:div>
<s:div id="helpContent">
<s:fragment rendered="#{empty help.selectedDocument and not empty help.selectedDirectory}">
<iframe id="helpContentFrame" src="#{wiki:renderPlainURL(help.selectedDirectory)}"
frameborder="0">
</iframe>
</s:fragment>
<s:fragment rendered="#{not empty help.selectedDocument}">
<iframe id="helpContentFrame" src="#{wiki:renderPlainURL(help.selectedDocument)}"
frameborder="0">
</iframe>
</s:fragment>
<s:fragment rendered="#{not empty help.selectedDocument or not empty help.selectedDirectory}">
<script type="text/javascript">
jQuery(function() {
jQuery("#helpContentFrame").width( jQuery("#dialogHelp").width()-10 );
jQuery("#helpContentFrame").height( jQuery("#dialogHelp").height()-62 );
});
</script>
</s:fragment>
</s:div>
</ui:define>
<ui:define name="dialogControls">
</ui:define>
</ui:decorate>
More information about the jboss-cvs-commits
mailing list