function initialize (result) {
-// ----------------------------
var state = search.state.value;
if (state == "inWORK" || state == "inDRAFT" || state == "inCHECK") {
}
function setState () {
-// --------------------
var state = search.state.value;
if (state == "inWORK" || state == "inDRAFT" || state == "inCHECK") {
}
function changeFilter () {
-// ------------------------
var result = document.getElementById("resulist");
search.elements[0].value = "0"; // Marks the result obsolete
}
function removeContext (index) {
-// ------------------------------
search.elements[0].value = index;
search.submit();
}
function cancel () {
-// ------------------
search.elements[0].value = "-1";
search.submit();
}
\ No newline at end of file
%>
<s:url id="undo" namespace="/study" action="step-study"></s:url>
+<input type=hidden name=knowledgeType value="<%=typenumber%>"/>
<table width=100% cellpadding=0 cellspacing=0 border=0 class=text>
- <input type=hidden name=knowledgeType value="<%=typenumber%>"/>
<%
for (Iterator<AbstractOpenObject.KnowledgeIterator> knowtypes = knowlist.iterator(); knowtypes.hasNext(); ) {
AbstractOpenObject.KnowledgeIterator type = knowtypes.next();
<%
if (todo == Action.editKnowledge && kelm.getIndex().equals(typenumber)) {
%> <td>
- <input type=hidden name=text>
<script language='JavaScript' type='text/javascript'>
<% out.print("displayTextEditor('knowledgeValue', '" + kelm.getFullValue() + "', 450, 150);");
%> </script>
</table>
</td>
<td>
- <input type=hidden name=text>
<script language='JavaScript' type='text/javascript'>
<% out.print("displayTextEditor('knowledgeValue', '<p> </p>', 450, 150);");
%> </script>
<tr class="error">
<td colspan=2><s:text name="%{errorCode}" /></td>
</tr>
- <s:set var="valid">
- <s:text name="menu.login" />
- </s:set>
- <s:textfield id="username" name="username" key="field.username" required="true" />
+ <s:textfield id="username" name="username" key="field.username"
+ required="true" />
<s:password name="password" key="field.password" />
<s:hidden name="backMenu" value="%{#parameters.backMenu}" />
- <s:submit type="button" value="%{valid}" />
+ <s:submit type="button" key="menu.login" />
</s:form></td>
</tr>
<tr height=10>
<%@ taglib prefix="s" uri="/struts-tags"%>
<script>
$(document).ready(function () {
- $("#bring #documentName").focus();
+ $("#bring input[name='documentName']").focus();
+ <s:if test="%{reference != null}">
+ // if versioning then the document name and state can not be modified.
+ $("#bring input[name='documentName']").attr("disabled","disabled");
+ $("#bring input[name='documentState']").attr("disabled","disabled");
+ </s:if>
});
</script>
<!-- Import dialog
=============================================================================================================================
-->
-<div id=article-box>
-<div id=section><s:text name="title.import" /></div>
-<div id=article-body class=text>
-<table width=100% cellpadding=0 cellspacing=0 border=0 class=text>
- <tr height=25 valign=middle>
+<div id="article-box">
+<div id="section"><s:text name="title.import" /></div>
+<div id="article-body" class="text">
+<table width="100%" cellpadding="0" cellspacing="0" border="0"
+ class="text">
+ <tr height="25" valign="middle">
<td><s:text name="message.upload">
<s:param>
<s:property value="%{fileName}" />
</s:param>
</s:text></td>
</tr>
- <tr height=1 bgcolor=#AAAAAA>
+ <tr height="1" bgcolor="#AAAAAA">
<td></td>
</tr>
</table>
<form name="bring" id="bring" action="valid-import" method="post">
-<s:hidden name="fileName" value="%{fileName}" /> <s:hidden
- name="reference" value="%{reference}" /> <s:hidden
+<s:hidden name="fileName" /> <s:hidden name="reference" /> <s:hidden
name="documentTitle" value="%{documentName}" /> <s:hidden
name="defaultDocumentType" value="%{documentType}" /> <s:hidden
name="defaultDocumentState" value="%{documentState}" /> <s:hidden
- name="version" value="%{version}" /> <s:hidden name="documentDate"
- value="%{documentDate}" />
-<table cellpadding=0 cellspacing=0 border=0 class=text>
- <tr height=15>
+ name="version" /> <s:hidden name="documentDate" />
+<table cellpadding="0" cellspacing="0" border="0" class="text">
+ <tr height="15">
<td></td>
</tr>
<tr>
- <td align=right><s:text name="field.documentype" /> </td>
- <td align=left> <s:text name="field.documentitle" /></td>
+ <td align="right"><s:text name="field.documentype" /> </td>
+ <td align="left"> <s:text name="field.documentitle" /></td>
</tr>
<tr>
- <td>
- <s:select theme="simple" name="documentType" list="documentTypes"
- listKey="index" listValue="%{getText('type.document.' + getName())}" />
- </td>
- <td><s:set var="setname" value="%{''}" /> <s:if
- test="%{reference != null}">
- <s:set var="setname" value="%{'disabled'}" />
- </s:if> <input type="text" name="documentName" id="documentName" size="60"
- value="<s:property value="documentName"/>"
- <s:property value="%{#setname}"/> /></td>
+ <td><s:select theme="simple" name="documentType"
+ list="documentTypes" listKey="index"
+ listValue="%{getText('type.document.' + getName())}" /> </td>
+ <td><s:if test="%{reference != null}">
+ <s:textfield theme="simple" id="documentName" name="documentName"
+ disabled="" />
+ </s:if> <s:else>
+ <s:textfield theme="simple" id="documentName" name="documentName" />
+ </s:else></td>
</tr>
<s:if test="defaultDocumentUses.size > 0">
<tr>
- <td align=right><s:text name="label.uses" />:</td>
+ <td align="right"><s:text name="label.uses" />:</td>
</tr>
<s:iterator value="defaultDocumentUses">
<tr>
- <td align=right><input type="checkbox" name="uses"
+ <td align="right"><input type="checkbox" name="uses"
value="<s:property value="index"/>" checked></td>
<td><s:property value="title" /></td>
</tr>
</s:iterator>
</s:if>
- <tr height=10>
+ <tr height="10">
<td></td>
</tr>
<tr>
- <td align=right><input type="submit" name="cancel"
- value="<s:text name="button.cancel"/>" /> </td>
- <td align=left><input type="submit" name="save"
- value="<s:text name="button.import"/>" /> <select
- name="documentState" <s:property value="%{#setname}"/>>
- <s:if test="documentState == 'EXTERN'">
- <option value="inWORK"><s:text name="label.inWORK" /></option>
- <option value="inDRAFT"><s:text name="label.inDRAFT" /></option>
- <option value="EXTERN" selected><s:text name="label.EXTERN" /></option>
- </s:if>
- <s:elseif test="documentState == 'inDRAFT'">
- <option value="inWORK"><s:text name="label.inWORK" /></option>
- <option value="inDRAFT" selected><s:text
- name="label.inDRAFT" /></option>
- <option value="EXTERN"><s:text name="label.EXTERN" /></option>
- </s:elseif>
- <s:else>
- <option value="inWORK" selected><s:text name="label.inWORK" /></option>
- <option value="inDRAFT"><s:text name="label.inDRAFT" /></option>
- <option value="EXTERN"><s:text name="label.EXTERN" /></option>
- </s:else>
- </select></td>
+ <td align="right"><s:submit theme="simple" name="cancel"
+ key="button.cancel" /> </td>
+ <td align="left"><s:submit theme="simple" name="save"
+ key="button.import" /> <s:select theme="simple" id="documentState"
+ name="documentState" list="documentStates" listKey="value"
+ listValue="%{getText(key)}">
+ </s:select></td>
</tr>
</table>
</form>
<%@page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"
%>
-<%@page import="org.splat.som.ApplicationRights"%>
-<%@page import="java.util.ResourceBundle"%>
-<%@page import="java.text.SimpleDateFormat"%>
-<%@page import="org.splat.simer.Action"%>
-<%@page import="com.opensymphony.xwork2.ActionContext"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<!-- Initialization of the context
=============================================================================================================================
-->
-<%
- ApplicationRights rights = (ApplicationRights)session.getAttribute("user.rights");
- Action anAction = (Action)ActionContext.getContext().getActionInvocation().getAction();
- ResourceBundle locale = ResourceBundle.getBundle("som",
- anAction.getApplicationSettings().getCurrentLocale());
- String format = locale.getString("date.format");
- SimpleDateFormat tostring = new SimpleDateFormat(format);
- String result = "uptodate";
- boolean connected = false;
-
- if (rights.getUser() != null) connected = true;
- if (session.getAttribute("search.result") == null) result = "obsolete";
-%>
-
-<s:set var="user"><%=connected%></s:set>
-<s:set var="format"><%=format%></s:set>
-<s:set var="today"><%=tostring.format(java.util.Calendar.getInstance().getTime())%></s:set>
<script language="JavaScript" type="text/javascript" src="../js/search.js"></script>
<script>
$(document).ready(function () {
- initialize('<%=result%>');
+ initialize('<s:property value="resultState"/>');
});
</script>
<div id=section><s:text name="title.criteria"/></div>
<div id="article-body">
<form name="search" action="refresh-knowledge" method="post">
- <input type=hidden name="contextIndex" />
+ <input type="hidden" name="contextIndex" />
<s:set var="match1" value="criteriaMatch"/>
<s:set var="match2" value="contextMatch"/>
<s:set var="type" value="state"/>
<s:set var="him" value="author"/>
- <table width=100% cellpadding=0 cellspacing=0 border=0 class=text>
- <tr height=20>
- <td width=40%>
+ <table width="100%" cellpadding="0" cellspacing="0" border="0" class="text">
+ <tr height="20">
+ <td width="40%">
<b><s:text name="field.among"/></b>
<s:if test="%{#match1 == 'all'}">
- <input type=radio name="criteriaMatch" value="all" checked onClick="changeFilter()"><s:text name="field.matchall"/>
+ <input type="radio" name="criteriaMatch" value="all" checked onClick="changeFilter()"><s:text name="field.matchall"/>
- <input type=radio name="criteriaMatch" value="any" onClick="changeFilter()"><s:text name="field.matchany"/>
+ <input type="radio" name="criteriaMatch" value="any" onClick="changeFilter()"><s:text name="field.matchany"/>
</s:if><s:else>
- <input type=radio name="criteriaMatch" value="all" onClick="changeFilter()"><s:text name="field.matchall"/>
+ <input type="radio" name="criteriaMatch" value="all" onClick="changeFilter()"><s:text name="field.matchall"/>
- <input type=radio name="criteriaMatch" value="any" checked onClick="changeFilter()"><s:text name="field.matchany"/>
+ <input type="radio" name="criteriaMatch" value="any" checked onClick="changeFilter()"><s:text name="field.matchany"/>
</s:else>
</td>
- <td width=60%>|
+ <td width="60%">|
<b><s:text name="field.context"/></b>
<s:if test="%{#match2 == 'all'}">
- <input type=radio name="contextMatch" value="all" checked onClick="changeFilter()"><s:text name="field.matchall"/>
+ <input type="radio" name="contextMatch" value="all" checked onClick="changeFilter()"><s:text name="field.matchall"/>
- <input type=radio name="contextMatch" value="any" onClick="changeFilter()"><s:text name="field.matchany"/>
+ <input type="radio" name="contextMatch" value="any" onClick="changeFilter()"><s:text name="field.matchany"/>
</s:if><s:else>
- <input type=radio name="contextMatch" value="all" onClick="changeFilter()"><s:text name="field.matchall"/>
+ <input type="radio" name="contextMatch" value="all" onClick="changeFilter()"><s:text name="field.matchall"/>
- <input type=radio name="contextMatch" value="any" checked onClick="changeFilter()"><s:text name="field.matchany"/>
+ <input type="radio" name="contextMatch" value="any" checked onClick="changeFilter()"><s:text name="field.matchany"/>
</s:else>
</td>
</tr>
- <tr height=1 bgcolor=#AAAAAA><td colspan=2></td></tr>
+ <tr height="1" bgcolor="#AAAAAA"><td colspan="2"></td></tr>
</table>
- <table width=100% cellpadding=0 cellspacing=0 border=0 class=text>
- <tr valign=top>
- <td width=40%>
- <table cellpadding=0 cellspacing=0 border=0 class=text>
+ <table width="100%" cellpadding="0" cellspacing="0" border="0" class="text">
+ <tr valign="top">
+ <td width="40%">
+ <table cellpadding="0" cellspacing="0" border="0" class="text">
<tr>
- <td colspan=2><s:text name="criterion.knowledge"/> </td>
- <td colspan=3 align=center>
+ <td colspan="2"><s:text name="criterion.knowledge"/> </td>
+ <td colspan="3" align="center">
<select name="state" style="width: <s:text name="size.search.select"/>" onChange="changeFilter()">
<s:iterator value="knowledgeTypes">
<s:if test="%{index == #type}">
</td>
</tr>
<tr>
- <td colspan=2><s:text name="criterion.author"/> </td>
- <td colspan=3 align=center>
+ <td colspan="2"><s:text name="criterion.author"/> </td>
+ <td colspan="3" align="center">
<select name="author" style="width: <s:text name="size.search.select"/>" onChange="changeFilter()">
<option value="0"><s:text name="criterion.anybody" /></option>
<s:iterator value="candidates">
<tr>
<s:set var="tipdate">
<s:text name="help.search.date">
- <s:param><s:text name="%{#format}"/></s:param>
- <s:param><s:text name="%{#today}"/></s:param>
+ <s:param><s:text name="%{format}"/></s:param>
+ <s:param><s:text name="%{today}"/></s:param>
</s:text>
</s:set>
<td><s:text name="field.credate"/> </td>
<td><s:text name="field.after"/> </td>
- <td><input type=text name=after size=7 onKeydown="changeFilter()" title="<s:property value="%{#tipdate}"/>" /> </td>
+ <td><input type="text" name="after" size="7" onKeydown="changeFilter()" title="<s:property value="%{#tipdate}"/>" /> </td>
<td><s:text name="field.before"/> </td>
- <td><input type=text name=before size=7 onKeydown="changeFilter()" title="<s:property value="%{#tipdate}"/>" /></td>
+ <td><input type="text" name="before" size="7" onKeydown="changeFilter()" title="<s:property value="%{#tipdate}"/>" /></td>
</tr>
<tr height=26><td></td></tr>
</table>
- <table cellpadding=0 cellspacing=0 border=0 class=text>
+ <table cellpadding="0" cellspacing="0" border="0" class="text">
<tr>
<td><s:text name="field.contain"/>: </td>
- <td><input type=text name=words style="width: <s:text name="size.search.input"/>" value="<s:property value="%{words}"/>" onKeydown="changeFilter()" title="<s:text name="help.search.title"/>" /></td>
+ <td><input type="text" name="words" style="width: <s:text name="size.search.input"/>" value="<s:property value="%{words}"/>" onKeydown="changeFilter()" title="<s:text name="help.search.title"/>" /></td>
</tr><tr>
<td><s:text name="field.reference"/>: </td>
- <td><input type=text name="reference" style="width: <s:text name="size.search.input"/>" value="<s:property value="%{reference}"/>" onKeydown="changeFilter()" title="<s:text name="help.search.refid"/>" /></td>
+ <td><input type="text" name="reference" style="width: <s:text name="size.search.input"/>" value="<s:property value="%{reference}"/>" onKeydown="changeFilter()" title="<s:text name="help.search.refid"/>" /></td>
</tr>
</table>
</td>
- <td width=60%>
- <table cellpadding=0 cellspacing=0 border=0 class=text>
+ <td width="60%">
+ <table cellpadding="0" cellspacing="0" border="0" class="text">
<s:iterator value="simulationContexts">
<tr>
- <td><input type=checkbox checked onClick="removeContext('<s:property value="index"/>')"> </td>
+ <td><input type="checkbox" checked onClick="removeContext('<s:property value="index"/>')"> </td>
<td>
<s:if test="%{type.isApproved()}"><s:text name="type.context.%{type.name}"/>: </s:if>
<s:else><s:property value="%{type.name}"/>: </s:else>
</tr>
</table>
- <table width=100% cellpadding=0 cellspacing=0 border=0 class=text>
+ <table width="100%" cellpadding="0" cellspacing="0" border="0" class="text">
<tr>
- <td width=40%></td>
- <td width=60% align=left><input type="submit" name="refresh" value="<s:text name="button.result"/>" disabled/></td>
+ <td width="40%"></td>
+ <td width="60%" align="left"><input type="submit" name="refresh" value="<s:text name="button.result"/>" disabled/></td>
</tr>
</table>
<!-- Result list
=============================================================================================================================
-->
- <div id=resulist>
- <div id=article-box>
- <div id=section><s:text name="title.result"/></div>
- <div id=article-body class=text>
+ <div id="resulist">
+ <div id="article-box">
+ <div id="section"><s:text name="title.result"/></div>
+ <div id="article-body" class="text">
<s:if test="result.size > 0">
- <table width=100% cellpadding=0 cellspacing=0 border=0 class=text>
- <tr height=20 valign=bottom>
- <td width=20></td>
- <td width=80><s:text name="label.reference"/></td>
+ <table width=100% cellpadding="0" cellspacing="0" border="0" class="text">
+ <tr height="20" valign="bottom">
+ <td width="20"></td>
+ <td width="80"><s:text name="label.reference"/></td>
<td><s:text name="label.title"/><img src="<s:url value="/skin/icon.sortup.png"/>" border="none"/></td>
- <td width=150><s:text name="label.author"/></td>
+ <td width="150"><s:text name="label.author"/></td>
</tr>
- <tr height=1 bgcolor=#AAAAAA><td colspan=4></td></tr>
+ <tr height="1" bgcolor="#AAAAAA"><td colspan="4"></td></tr>
<s:iterator value="result">
<tr>
- <td><img src="<s:url value="/skin/icon.%{progressState}.png"/>" width=12 height=12 border="none" title=""/></td>
+ <td><img src="<s:url value="/skin/icon.%{progressState}.png"/>" width="12" height="12" border="none" title=""/></td>
<td><s:property value="reference"/></td>
<td>
<s:url id="open" namespace="/study" action="open-knowledge?selection=0">
<%@page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"
%>
-<%@page import="org.splat.som.ApplicationRights"%>
-<%@page import="java.util.ResourceBundle"%>
-<%@page import="java.text.SimpleDateFormat"%>
-<%@page import="org.splat.simer.Action"%>
-<%@page import="com.opensymphony.xwork2.ActionContext"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<!-- Initialization of the context
=============================================================================================================================
-->
-<%
- ApplicationRights rights = (ApplicationRights)session.getAttribute("user.rights");
- Action anAction = (Action)ActionContext.getContext().getActionInvocation().getAction();
- ResourceBundle locale = ResourceBundle.getBundle("som",
- anAction.getApplicationSettings().getCurrentLocale());
- String format = locale.getString("date.format");
- SimpleDateFormat tostring = new SimpleDateFormat(format);
- String result = "uptodate";
- boolean connected = false;
-
- if (rights.getUser() != null) connected = true;
- if (session.getAttribute("search.result") == null) result = "obsolete";
-%>
-
-<s:set var="user"><%=connected%></s:set>
-<s:set var="format"><%=format%></s:set>
-<s:set var="today"><%=tostring.format(java.util.Calendar.getInstance().getTime())%></s:set>
<script language="JavaScript" type="text/javascript" src="../js/search.js"></script>
<script>
$(document).ready(function () {
- initialize('<%=result%>');
+ initialize('<s:property value="resultState"/>');
});
</script>
<!-- Search criteria section
=============================================================================================================================
-->
- <div id=article-box>
- <div id=section><s:text name="title.criteria"/></div>
+ <div id="article-box">
+ <div id="section"><s:text name="title.criteria"/></div>
<div id="article-body">
<form name="search" action="refresh-study" method="post">
- <input type=hidden name="contextIndex" />
+ <input type="hidden" name="contextIndex" />
<s:set var="match1" value="criteriaMatch"/>
<s:set var="match2" value="contextMatch"/>
<s:set var="him" value="author"/>
- <table width=100% cellpadding=0 cellspacing=0 border=0 class=text>
- <tr height=20>
- <td width=40%>
+ <table width="100%" cellpadding="0" cellspacing="0" border="0" class="text">
+ <tr height="20">
+ <td width="40%">
<b><s:text name="field.among"/></b>
<s:if test="%{#match1 == 'all'}">
- <input type=radio name="criteriaMatch" value="all" checked onClick="changeFilter()"><s:text name="field.matchall"/>
+ <input type="radio" name="criteriaMatch" value="all" checked onClick="changeFilter()"><s:text name="field.matchall"/>
- <input type=radio name="criteriaMatch" value="any" onClick="changeFilter()"><s:text name="field.matchany"/>
+ <input type="radio" name="criteriaMatch" value="any" onClick="changeFilter()"><s:text name="field.matchany"/>
</s:if><s:else>
- <input type=radio name="criteriaMatch" value="all" onClick="changeFilter()"><s:text name="field.matchall"/>
+ <input type="radio" name="criteriaMatch" value="all" onClick="changeFilter()"><s:text name="field.matchall"/>
- <input type=radio name="criteriaMatch" value="any" checked onClick="changeFilter()"><s:text name="field.matchany"/>
+ <input type="radio" name="criteriaMatch" value="any" checked onClick="changeFilter()"><s:text name="field.matchany"/>
</s:else>
</td>
- <td width=60%>|
+ <td width="60%">|
<b><s:text name="field.context"/></b>
<s:if test="%{#match2 == 'all'}">
- <input type=radio name="contextMatch" value="all" checked onClick="changeFilter()"><s:text name="field.matchall"/>
+ <input type="radio" name="contextMatch" value="all" checked onClick="changeFilter()"><s:text name="field.matchall"/>
- <input type=radio name="contextMatch" value="any" onClick="changeFilter()"><s:text name="field.matchany"/>
+ <input type="radio" name="contextMatch" value="any" onClick="changeFilter()"><s:text name="field.matchany"/>
</s:if><s:else>
- <input type=radio name="contextMatch" value="all" onClick="changeFilter()"><s:text name="field.matchall"/>
+ <input type="radio" name="contextMatch" value="all" onClick="changeFilter()"><s:text name="field.matchall"/>
- <input type=radio name="contextMatch" value="any" checked onClick="changeFilter()"><s:text name="field.matchany"/>
+ <input type="radio" name="contextMatch" value="any" checked onClick="changeFilter()"><s:text name="field.matchany"/>
</s:else>
</td>
</tr>
- <tr height=1 bgcolor=#AAAAAA><td colspan=2></td></tr>
+ <tr height="1" bgcolor="#AAAAAA"><td colspan="2"></td></tr>
</table>
- <table width=100% cellpadding=0 cellspacing=0 border=0 class=text>
- <tr valign=top>
- <td width=40%>
- <table cellpadding=0 cellspacing=0 border=0 class=text>
+ <table width="100%" cellpadding="0" cellspacing="0" border="0" class="text">
+ <tr valign="top">
+ <td width="40%">
+ <table cellpadding="0" cellspacing="0" border="0" class="text">
<tr>
- <td colspan=2><s:text name="criterion.study"/> </td>
- <td colspan=3 align=center>
+ <td colspan="2"><s:text name="criterion.study"/> </td>
+ <td colspan="3" align="center">
<select name="state" style="width: <s:text name="size.search.select"/>" onChange="setState()">
<s:if test="state == 'ANY'"> <option value="ANY" selected><s:text name="criterion.any" /></option></s:if>
<s:else> <option value="ANY" ><s:text name="criterion.any" /></option></s:else>
- <s:if test="#user">
+ <s:if test="connectedUser != null">
<s:if test="state == 'inWORK'"> <option value="inWORK" selected><s:text name="criterion.inwork" /></option></s:if>
<s:else> <option value="inWORK" ><s:text name="criterion.inwork" /></option></s:else>
<s:if test="state == 'inDRAFT'"> <option value="inDRAFT" selected><s:text name="criterion.indraft" /></option></s:if>
</td>
</tr>
<tr>
- <td colspan=2><s:text name="criterion.author"/> </td>
- <td colspan=3 align=center>
+ <td colspan="2"><s:text name="criterion.author"/> </td>
+ <td colspan="3" align="center">
<select name="author" style="width: <s:text name="size.search.select"/>" onChange="changeFilter()">
<option value="0"><s:text name="criterion.anybody" /></option>
<s:iterator value="candidates">
<tr>
<s:set var="tipdate">
<s:text name="help.search.date">
- <s:param><s:text name="%{#format}"/></s:param>
- <s:param><s:text name="%{#today}"/></s:param>
+ <s:param><s:text name="%{format}"/></s:param>
+ <s:param><s:text name="%{today}"/></s:param>
</s:text>
</s:set>
<td><s:text name="field.credate"/> </td>
<td><s:text name="field.after"/> </td>
- <td><input type=text name=after size=7 onKeydown="changeFilter()" title="<s:property value="%{#tipdate}"/>" /> </td>
+ <td><input type="text" name=after size=7 onKeydown="changeFilter()" title="<s:property value="%{#tipdate}"/>" /> </td>
<td><s:text name="field.before"/> </td>
- <td><input type=text name=before size=7 onKeydown="changeFilter()" title="<s:property value="%{#tipdate}"/>" /></td>
+ <td><input type="text" name=before size=7 onKeydown="changeFilter()" title="<s:property value="%{#tipdate}"/>" /></td>
</tr><tr>
<td><s:text name="field.lasdate"/> </td>
<td><s:text name="field.after"/> </td>
- <td><input type=text name=after size=7 onKeydown="changeFilter()" title="<s:property value="%{#tipdate}"/>" /> </td>
+ <td><input type="text" name=after size=7 onKeydown="changeFilter()" title="<s:property value="%{#tipdate}"/>" /> </td>
<td><s:text name="field.before"/> </td>
- <td><input type=text name="before" size=7 onKeydown="changeFilter()" title="<s:property value="%{#tipdate}"/>" /></td>
+ <td><input type="text" name="before" size=7 onKeydown="changeFilter()" title="<s:property value="%{#tipdate}"/>" /></td>
</tr>
</table>
- <table cellpadding=0 cellspacing=0 border=0 class=text>
+ <table cellpadding="0" cellspacing="0" border="0" class="text">
<tr>
<td><s:text name="field.contain"/>: </td>
- <td><input type=text name=words style="width: <s:text name="size.search.input"/>" value="<s:property value="%{words}"/>" onKeydown="changeFilter()" title="<s:text name="help.search.title"/>" /></td>
+ <td><input type="text" name=words style="width: <s:text name="size.search.input"/>" value="<s:property value="%{words}"/>" onKeydown="changeFilter()" title="<s:text name="help.search.title"/>" /></td>
</tr><tr>
<td><s:text name="field.reference"/>: </td>
- <td><input type=text name="reference" style="width: <s:text name="size.search.input"/>" value="<s:property value="%{reference}"/>" onKeydown="changeFilter()" title="<s:text name="help.search.refid"/>" /></td>
+ <td><input type="text" name="reference" style="width: <s:text name="size.search.input"/>" value="<s:property value="%{reference}"/>" onKeydown="changeFilter()" title="<s:text name="help.search.refid"/>" /></td>
</tr>
</table>
</td>
- <td width=60%>
- <table cellpadding=0 cellspacing=0 border=0 class=text>
+ <td width="60%">
+ <table cellpadding="0" cellspacing="0" border="0" class="text">
<s:iterator value="simulationContexts">
<tr>
- <td><input type=checkbox checked onClick="removeContext('<s:property value="index"/>')"> </td>
+ <td><input type="checkbox" checked onClick="removeContext('<s:property value="index"/>')"> </td>
<td>
<s:if test="%{type.isApproved()}"><s:text name="type.context.%{type.name}"/>: </s:if>
<s:else><s:property value="%{type.name}"/>: </s:else>
</tr>
</table>
- <table width=100% cellpadding=0 cellspacing=0 border=0 class=text>
+ <table width="100%" cellpadding="0" cellspacing="0" border="0" class="text">
<tr>
- <td width=40%></td>
- <td width=60% align=left><input type="submit" name="refresh" value="<s:text name="button.result"/>" disabled/></td>
+ <td width="40%"></td>
+ <td width="60%" align="left"><input type="submit" name="refresh" value="<s:text name="button.result"/>" disabled/></td>
</tr>
</table>
<!-- Result list
=============================================================================================================================
-->
- <div id=resulist>
- <div id=article-box>
- <div id=section><s:text name="title.result"/></div>
- <div id=article-body class=text>
+ <div id="resulist">
+ <div id="article-box">
+ <div id="section"><s:text name="title.result"/></div>
+ <div id="article-body" class="text">
<s:if test="result.size > 0">
- <table width=100% cellpadding=0 cellspacing=0 border=0 class=text>
- <tr height=20 valign=bottom>
- <td width=20></td>
- <td width=80><s:text name="label.reference"/></td>
+ <table width="100%" cellpadding="0" cellspacing="0" border="0" class="text">
+ <tr height="20" valign="bottom">
+ <td width="20"></td>
+ <td width="80"><s:text name="label.reference"/></td>
<td><s:text name="label.title"/><img src="<s:url value="/skin/icon.sortup.png"/>" border="none"/></td>
- <td width=150><s:text name="label.manager"/></td>
+ <td width="150"><s:text name="label.manager"/></td>
</tr>
- <tr height=1 bgcolor=#AAAAAA><td colspan=4></td></tr>
+ <tr height="1" bgcolor="#AAAAAA"><td colspan="4"></td></tr>
<s:iterator value="result">
<tr>
<td><img src="<s:url value="/skin/icon.%{progressState}.png"/>" width=12 height=12 border="none" title=""/></td>
package org.splat.simer;
+import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import org.splat.service.technical.ProjectSettingsService;
import org.splat.som.ApplicationRights;
+/**
+ * Base search action class used for searching studies and knowledge.
+ *
+ * @author <a href="mailto:roman.kozlov@opencascade.com">Roman Kozlov (RKV)</a>
+ */
public abstract class AbstractSearchBaseAction extends Action {
/**
* Current contexts search criteria.
*/
protected transient List<SimulationContext> _context;
+ /**
+ * List of found objects.
+ */
protected transient List<Proxy> _result;
/**
* Injected simulation context service.
*/
private UserService _userService;
+ /**
+ * Search action modes enumeration.
+ */
enum UserAction {
refreshResult, selectContextType, selectContextValue, cancelSelect, removeContext
}
// Action methods
// ==============================================================================================================================
+ /**
+ * Perform actions according to the current mode.
+ *
+ * @return action result or ERROR if failed
+ */
public String doSubmitForm() {
// Identification of the user action
UserAction action = UserAction.refreshResult;
return done;
}
+ /**
+ * Add a selected context type to the search filter. Obsolete the current result if necessary.
+ *
+ * @return "selectype"
+ */
@SuppressWarnings("unchecked")
protected String doSelectContextType() {
SimulationContext.Properties sprop = new SimulationContext.Properties();
if (_cindex.length() > 0 && Integer.valueOf(_cindex) == 0) {
getSession().remove(RESULT_KEY);
} else {
- _result = (List<Proxy>) getSession().get(RESULT_KEY); // We keep the previous result search, if valid
+ // We keep the previous result search, if valid
+ _result = (List<Proxy>) getSession().get(RESULT_KEY);
}
return "selectype";
}
+ /**
+ * Add a selected context to the search filter. Obsolete the current result.
+ *
+ * @return "refresh"
+ */
protected String doAddContext() {
SimulationContext selected = getSimulationContextService()
.selectSimulationContext(Integer.valueOf(_cvalue));
return "refresh";
}
+ /**
+ * Remove context from the search filter.
+ *
+ * @return "refresh"
+ */
protected String doRemoveContext() {
int index = Integer.valueOf(_cindex);
for (Iterator<SimulationContext> selected = _context.iterator(); selected
return "refresh";
}
+ /**
+ *
+ * @return
+ */
@SuppressWarnings("unchecked")
protected String doCancel() {
_result = (List<Proxy>) getSession().get(RESULT_KEY); // Current result search
// Getters
// ==============================================================================================================================
+ /**
+ * Get date format string.
+ *
+ * @return date format string
+ */
+ public String getFormat() {
+ return getText("date.format");
+ }
+
+ /**
+ * Get formatted today date as a string.
+ *
+ * @return current date as a string
+ */
+ public String getToday() {
+ SimpleDateFormat tostring = new SimpleDateFormat(getFormat(),
+ getApplicationSettings().getCurrentLocale());
+ return tostring.format(java.util.Calendar.getInstance().getTime());
+ }
+
+ /**
+ * Get search result state.
+ *
+ * @return "obsolete" if there is no results in the session, otherwise "uptodate"
+ */
+ public String getResultState() {
+ String result;
+ if (getSession().get(RESULT_KEY) == null) {
+ result = "obsolete";
+ } else {
+ result = "uptodate";
+ }
+ return result;
+ }
+
public String getAuthor() {
return _author;
}
return _context;
}
+ /**
+ * Get list of found objects.
+ *
+ * @return list of found objects
+ */
public List<Proxy> getResult() {
return _result;
}
}
}
+ /**
+ * Build available context types list with localized names.
+ *
+ * @param critext
+ * context types already used in the search filter
+ */
protected void setContextTypeOptions(
final List<SimulationContextType> critext) {
for (Iterator<SimulationContext> i = _context.iterator(); i.hasNext();) {
*/
private static final long serialVersionUID = 2587822564883588556L;
+ /**
+ * Sorted list of document types for the selected study step.
+ */
private transient List<DocumentType> _documentTypes = null;
+ /**
+ * The selected document type.
+ */
private long _documentType = 0;
/**
* Reference extracted from the imported file, if exist.
// Set the document type by default
deftype = getApplicationSettings().getDefaultDocumentType(step, filext);
if (deftype != null) {
- setDefaultDocumentType(Long.toString(deftype.getIndex()));
+ setDefaultDocumentType(deftype.getIndex());
}
defuses = new ArrayList<Document>();
state = ProgressState.inWORK;
ResourceBundle locale = ResourceBundle.getBundle("som",
getApplicationSettings().getCurrentLocale());
SimpleDateFormat check = new SimpleDateFormat(locale
- .getString("date.format"));
+ .getString("date.format"),
+ getApplicationSettings().getCurrentLocale());
try {
check.parse(_documentDate);
} catch (ParseException e) {
* @return SUCCESS if ok, "cancel" - if canceled, ERROR - if error
*/
public String doImport() {
+ String result = ERROR;
initializationScreenContext(Constants.STUDY_MENU, Constants.STUDY_MENU,
Constants.TRUE);
if (action == ToDo.cancel) {
- return "cancel";
- }
- if (_documentType == 0) {
+ result = "cancel";
+ } else if (_documentType == 0) {
setErrorCode("message.error.import.type");
initializationFullScreenContext(Constants.STUDY_MENU,
Constants.STUDY_MENU, Constants.TRUE, Constants.NONE,
Constants.STUDY_MENU);
-
- return ERROR;
- }
- try {
- // Getting user inputs
- mystudy = getOpenStudy();
- User user = getConnectedUser();
- Step step = mystudy.getSelectedStep();
- Date docdate = null;
- if (_documentDate.length() > 0) {
- ResourceBundle locale = ResourceBundle.getBundle("som",
- getApplicationSettings().getCurrentLocale());
- SimpleDateFormat get = new SimpleDateFormat(locale
- .getString("date.format"));
- docdate = get.parse(_documentDate);
- }
- // Creation of uses relations
- List<Long> uses = new ArrayList<Long>();
- if (docuses != null) {
- String[] list = docuses.split(",");
- for (int i = 0; i < list.length; i++) {
- uses.add(Long.valueOf(list[i].trim()));
+ } else {
+ try {
+ // Getting user inputs
+ mystudy = getOpenStudy();
+ User user = getConnectedUser();
+ Step step = mystudy.getSelectedStep();
+ Date docdate = null;
+ if (_documentDate.length() > 0) {
+ ResourceBundle locale = ResourceBundle.getBundle("som",
+ getApplicationSettings().getCurrentLocale());
+ SimpleDateFormat get = new SimpleDateFormat(locale
+ .getString("date.format"), getApplicationSettings()
+ .getCurrentLocale());
+ docdate = get.parse(_documentDate);
}
- }
- if (LOG.isDebugEnabled()) {
- LOG
- .debug("Document to be imported uses documents with following ids:");
- for (Long usesId : uses) {
- LOG.debug("#" + usesId);
+ // Creation of uses relations
+ List<Long> uses = new ArrayList<Long>();
+ if (docuses != null) {
+ String[] list = docuses.split(",");
+ for (int i = 0; i < list.length; i++) {
+ uses.add(Long.valueOf(list[i].trim()));
+ }
}
- }
- Publication addoc = getPublicationService().createDoc(
- mystudy.getIndex(), step, _documentType, user.getIndex(),
- filename, docname, state, _reference, _version, docdate,
- uses);
+ if (LOG.isDebugEnabled()) {
+ LOG
+ .debug("Document to be imported uses documents with following ids:");
+ for (Long usesId : uses) {
+ LOG.debug("#" + usesId);
+ }
+ }
+ Publication addoc = getPublicationService().createDoc(
+ mystudy.getIndex(), step, _documentType,
+ user.getIndex(), filename, docname, state, _reference,
+ _version, docdate, uses);
- if (_reference.length() > 0) { // Importation of a not foreign document
- mystudy.updateSimulationContexts(); // In case of simulation contexts extracted from the imported document
+ if (_reference.length() > 0) { // Importation of a not foreign document
+ mystudy.updateSimulationContexts(); // In case of simulation contexts extracted from the imported document
+ }
+
+ // Creation of derived the document formats
+ // Document ndoc = addoc.value();
+ // Converter send = getApplicationSettings().getConverter(ndoc.getType(), ndoc.getFormat());
+ //
+ // if (send != null) send.converts(addoc); // Asynchronous process
+
+ mystudy.add(addoc); // Updates the presentation
+ result = SUCCESS;
+ } catch (FileNotFoundException error) {
+ LOG.error("Reason:", error);
+ setErrorCode("message.error.import.file");
+ } catch (Exception error) {
+ LOG.error("Reason:", error);
+ setErrorCode("message.error.internal");
}
- // Creation of derived the document formats
- // Document ndoc = addoc.value();
- // Converter send = getApplicationSettings().getConverter(ndoc.getType(), ndoc.getFormat());
- //
- // if (send != null) send.converts(addoc); // Asynchronous process
-
- mystudy.add(addoc); // Updates the presentation
- return SUCCESS;
- } catch (FileNotFoundException error) {
- LOG.error("Reason:", error);
- setErrorCode("message.error.import.file");
- } catch (Exception error) {
- LOG.error("Reason:", error);
- setErrorCode("message.error.internal");
+ if (!SUCCESS.equals(result)) {
+ initializationFullScreenContext(Constants.STUDY_MENU,
+ Constants.STUDY_MENU, Constants.TRUE, Constants.NONE,
+ Constants.STUDY_MENU);
+ }
}
- initializationFullScreenContext(Constants.STUDY_MENU,
- Constants.STUDY_MENU, Constants.TRUE, Constants.NONE,
- Constants.STUDY_MENU);
-
- return ERROR;
+ return result;
}
// ==============================================================================================================================
return _documentDate;
}
+ /**
+ * Get sorted list of document types valid for the selected study step.
+ *
+ * @return sorted list of document types
+ */
public List<DocumentType> getDocumentTypes() {
return _documentTypes;
}
this.docname = name; // Name entered by the user if enabled
}
+ /**
+ * Set the default title if no title was defined.
+ *
+ * @param name
+ * the default document title
+ */
public void setDocumentTitle(final String name) { // Called even if DocumentName is enabled
if (this.docname == null) {
this.docname = name;
* @param value
* the id as string
*/
- public void setDocumentType(final String value) {
- this._documentType = Integer.valueOf(value);
+ public void setDocumentType(final Long value) {
+ this._documentType = value;
}
+ /**
+ * Set the default state if no state was selected.
+ *
+ * @param state
+ * the default state
+ */
public void setDefaultDocumentState(final String state) { // Called even if DocumentState is enabled
if (this.state == null) {
this.state = ProgressState.valueOf(state);
}
}
- public void setDefaultDocumentType(final String value) { // Called even if DocumentType is enabled
+ /**
+ * Set the default type if no type was selected.
+ *
+ * @param value
+ * the default document type id
+ */
+ public void setDefaultDocumentType(final Long value) { // Called even if DocumentType is enabled
if (this._documentType == 0) {
- this._documentType = Integer.valueOf(value);
+ this._documentType = value;
}
}
final DocumentTypeService documentTypeService) {
_documentTypeService = documentTypeService;
}
+
+ /**
+ * Get sorted list of available document states.
+ *
+ * @return the documentStates
+ */
+ public List<ProgressState> getDocumentStates() {
+ List<ProgressState> states = new ArrayList<ProgressState>();
+ states.add(ProgressState.inWORK);
+ states.add(ProgressState.inDRAFT);
+ states.add(ProgressState.EXTERN);
+ return states;
+ }
}
\ No newline at end of file