blob: 730aca5f153a11fcdbd9e652ee8fcbd30a76443c [file] [log] [blame]
<!--
Copyright (c) 2010, 2018 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0, which is available at
http://www.eclipse.org/legal/epl-2.0.
This Source Code may also be made available under the following Secondary
Licenses when the conditions for such availability set forth in the
Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
version 2 with the GNU Classpath Exception, which is available at
https://www.gnu.org/software/classpath/license.html.
SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
-->
<h:form id="tagPanelForm">
<!beforeCreate
setPageSessionAttribute(key="guiTitle" value="#{guiTitle}");
if ("!#{pageSession.guiTitle}") {
setPageSessionAttribute(key="guiTitle" value="Untitled");
}
setPageSessionAttribute(key="tagViewId" value="#{tagViewId}");
if ("!#{pageSession.tagViewId}") {
// Page did not specify a tagViewId! Use default (viewId)
setPageSessionAttribute(key="tagViewId" value="#{view.viewId}");
}
gf.normalizeTagViewId(viewId="#{pageSession.tagViewId}" tagViewId=>$pageSession{tagViewId});
gf.queryTags(tagViewId="#{pageSession.tagViewId}" results=>$pageSession{pageTags});
if ("!#{pageSession.pageTags}") {
setPageSessionAttribute(key="pageTags" value={});
}
if ("!#{sessionScope.tagResults}") {
// FIXME: Disable initial search until 2 bugs are fixed:
// 1) Remove duplicate pages (i.e. same page, different tags)
// 2) Limit result set to a reasonable # (or allow results to scroll)
// gf.queryTags(results=>$session{tagResults});
}
/>
<h:inputHidden id="tagViewId" value="#{pageSession.tagViewId}" />
"<div class="tagDiv">
"<h2>'#{guiTitle}' Page Tags</h2>
"<ul class="tagList">
<foreach key="_tag" list="#{pageSession.pageTags}">
<!-- FIXME: I need this to loop at create time, it's looping at render-time (messes up id's) -->
"<li>
<h:commandLink styleClass="tagLink" href="#{request.contextPath}/#{_tag.tagViewId}">
<f:param name="tagName" value="#{_tag.tagName}" />
<h:outputText escape="true" value="#{_tag.tagName}" />
<!command
getRequestValue(key="tagName" value="#{requestScope.tagName}" );
setSessionAttribute(key="queryTag", value="#{requestScope.tagName}");
gf.queryTags(tagName="#{requestScope.tagName}", results=>$session{tagResults});
redirect("#{request.contextPath}/#{pageSession.tagViewId}");
/>
</h:commandLink>
<h:commandLink id="delTag" styleClass="removeTag" value="X" title="Delete Tag">
<f:param name="tagToDel" value="#{_tag.tagName}" />
<!command
getRequestValue(key="tagToDel" value="#{requestScope.tagToDel}" );
gf.removeTag(tagName="#{requestScope.tagToDel}", tagViewId="#{pageSession.tagViewId}");
redirect("#{request.contextPath}/#{pageSession.tagViewId}");
/>
</h:commandLink>
"</li>
</foreach>
"</ul>
"<p>&nbsp;</p>
<!-- Add Tag -->
<sun:textField id="newTagField" value="#{requestScope.newTagName}" columns="17" />
<sun:button id="newTagButton" value="Add Tag">
<!-- FIXME: Enable Ajax -->
<!command
gf.addTag(tagName="#{requestScope.newTagName}", tagViewId="#{pageSession.tagViewId}", displayName="#{pageSession.guiTitle}");
redirect("#{request.contextPath}/#{pageSession.tagViewId}");
/>
</sun:button>
"<br /><p>&nbsp;</p>
"<h2>Related Pages</h2>
"<ul class="tagList">
<foreach key="_pageTag" list="#{pageSession.pageTags}">
<staticText value="">
<!beforeEncode
gf.queryTags(tagName="#{_pageTag.tagName}", results=>$pageSession{relatedPages});
println("###########Encoding for #{_pageTag.tagName} results: $pageSession{relatedPages}");
/>
</staticText>
<!if "$pageSession{relatedPages}">
<foreach key="_tag" list="#{pageSession.relatedPages}">
"<li><a href="#{request.contextPath}/#{_tag.tagViewId}" class="tagLink">#{_tag.displayName}</a></li>
</foreach>
</if>
</foreach>
"</ul>
/*
<!-- Search Tags -->
<sun:textField id="queryTagField" value="#{sessionScope.queryTag}" columns="17" />
<sun:button id="queryTagButton" value="Search">
<!-- FIXME: Enable Ajax -->
<!command
if ("#{requestScope.queryMe}") {
setAttribute(key="qUser", value="#{request.principalUser}");
}
if ("!#{requestScope.queryMe}") {
setAttribute(key="qUser", value="#{null}");
}
gf.queryTags(tagName="#{sessionScope.queryTag}", user="#{requestScope.qUser}", results=>$session{tagResults});
redirect("#{request.contextPath}/#{pageSession.tagViewId}");
/>
</sun:button>
"<br />&nbsp;&nbsp;&nbsp;
<sun:checkbox id="onlyMe" value="#{requestScope.queryMe}" label=" Query only my tags." />
*/
"<p>&nbsp;</p>
<!-- Search Results -->
<if condition="#{sessionScope.tagResults}">
"<h2>Pages Tagged "#{sessionScope.queryTag}"</h2>
"<ul class="tagList">
<foreach key="_tag" list="#{sessionScope.tagResults}">
"<li><a href="#{request.contextPath}/#{_tag.tagViewId}" class="tagLink">#{_tag.displayName}</a></li>
</foreach>
"</ul>
</if>
"<p>&nbsp;</p>
<sun:button id="queryTagButton" value="Show All Tags">
<!-- FIXME: Enable Ajax -->
<!command
if ("#{requestScope.queryMe}") {
setAttribute(key="qUser", value="#{request.principalUser}");
}
if ("!#{requestScope.queryMe}") {
setAttribute(key="qUser", value="#{null}");
}
setSessionAttribute(key="queryTag" value="(all)");
gf.queryTags(user="#{requestScope.qUser}", results=>$session{tagResults});
redirect("#{request.contextPath}/#{pageSession.tagViewId}");
/>
</sun:button>
"</div>
</h:form>