From: <man...@us...> - 2009-12-08 13:09:30
|
Revision: 1335 http://j-trac.svn.sourceforge.net/j-trac/?rev=1335&view=rev Author: manfredwolff Date: 2009-12-08 13:09:21 +0000 (Tue, 08 Dec 2009) Log Message: ----------- Commit for future use (individual head panel). Added Paths: ----------- trunk/jtrac/src/main/java/info/jtrac/wicket/IndividualHeadPanel.html trunk/jtrac/src/main/java/info/jtrac/wicket/IndividualHeadPanel.java Added: trunk/jtrac/src/main/java/info/jtrac/wicket/IndividualHeadPanel.html =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/IndividualHeadPanel.html (rev 0) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/IndividualHeadPanel.html 2009-12-08 13:09:21 UTC (rev 1335) @@ -0,0 +1,8 @@ +<wicket:panel> + <table width="100%" class="jtrac alt" padding="4"> + <tr> + <td width="2%" align="left"><img height="55px" wicket:id="icon"/></td> + <td align="left"><b><div wicket:id="message">[text goes here]</div></b></td> + </tr> + </table> +</wicket:panel> \ No newline at end of file Added: trunk/jtrac/src/main/java/info/jtrac/wicket/IndividualHeadPanel.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/IndividualHeadPanel.java (rev 0) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/IndividualHeadPanel.java 2009-12-08 13:09:21 UTC (rev 1335) @@ -0,0 +1,65 @@ +/* + * Copyright 2002-2005 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package info.jtrac.wicket; + +import java.util.Map; + +import org.apache.wicket.AttributeModifier; +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.html.image.Image; +import org.apache.wicket.model.AbstractReadOnlyModel; + + +/** + * header navigation + */ +public class IndividualHeadPanel extends BasePanel { + + /** + * Default serialVersionID. + */ + private static final long serialVersionUID = 1L; + + /** + * Constructor. + */ + public IndividualHeadPanel() { + super("individuel"); + + final Map<String, String> configMap = getJtrac().loadAllConfig(); + Image img= new Image( "icon"); + img.add(new AttributeModifier("src", true, new AbstractReadOnlyModel() { + private static final long serialVersionUID = 1L; + public final Object getObject() { + // based on some condition return the image source + String url = configMap.get("jtrac.header.picture"); + if ((url == null) ||("".equals(url))) + return "../resources/jtrac-logo.gif"; + else + return url; + } + })); + add(img); + String message = configMap.get("jtrac.header.text"); + if ((message == null) ||("".equals(message))) + add(new Label("message", "JTrac - Open Source Issue Tracking System")); + else if ((message != null) && ("no".equals(message))) + add(new Label("message", "")); + else + add(new Label("message", message)); + } +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <man...@us...> - 2009-12-08 15:06:14
|
Revision: 1339 http://j-trac.svn.sourceforge.net/j-trac/?rev=1339&view=rev Author: manfredwolff Date: 2009-12-08 15:06:08 +0000 (Tue, 08 Dec 2009) Log Message: ----------- HTML and Java changes for individual head line. Modified Paths: -------------- trunk/jtrac/src/main/java/info/jtrac/wicket/BasePage.html trunk/jtrac/src/main/java/info/jtrac/wicket/BasePage.java trunk/jtrac/src/main/java/info/jtrac/wicket/IndividualHeadPanel.java trunk/jtrac/src/main/java/info/jtrac/wicket/LoginPage.html trunk/jtrac/src/main/java/info/jtrac/wicket/LoginPage.java trunk/jtrac/src/main/java/info/jtrac/wicket/LogoutPage.html trunk/jtrac/src/main/java/info/jtrac/wicket/LogoutPage.java Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/BasePage.html =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/BasePage.html 2009-12-08 15:05:04 UTC (rev 1338) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/BasePage.html 2009-12-08 15:06:08 UTC (rev 1339) @@ -6,7 +6,8 @@ <link rel="shortcut icon" type="image/x-icon" href="favicon.ico"/> <link rel="icon" type="image/x-icon" href="favicon.ico"/> </head> - <body> + <body> + <span wicket:id="individuel"></span><br/> <span wicket:id="header"></span><br/> <div style="clear:both"><br/></div> <wicket:child/> Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/BasePage.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/BasePage.java 2009-12-08 15:05:04 UTC (rev 1338) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/BasePage.java 2009-12-08 15:06:08 UTC (rev 1339) @@ -76,6 +76,7 @@ } public BasePage() { + add(new IndividualHeadPanel().setRenderBodyOnly(true)); add(new HeaderPanel().setRenderBodyOnly(true)); String jtracVersion = getJtrac().getReleaseVersion(); add(new Label("version", jtracVersion)); Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/IndividualHeadPanel.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/IndividualHeadPanel.java 2009-12-08 15:05:04 UTC (rev 1338) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/IndividualHeadPanel.java 2009-12-08 15:06:08 UTC (rev 1339) @@ -46,9 +46,10 @@ private static final long serialVersionUID = 1L; public final Object getObject() { // based on some condition return the image source + String urlbase = configMap.get("jtrac.url.base"); String url = configMap.get("jtrac.header.picture"); if ((url == null) ||("".equals(url))) - return "../resources/jtrac-logo.gif"; + return urlbase + "/resources/jtrac-logo.gif"; else return url; } Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/LoginPage.html =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/LoginPage.html 2009-12-08 15:05:04 UTC (rev 1338) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/LoginPage.html 2009-12-08 15:06:08 UTC (rev 1339) @@ -6,6 +6,7 @@ <link rel="shortcut icon" type="image/x-icon" href="favicon.ico"/> </head> <body> + <span wicket:id="individuel"></span><br/> <table width="100%" class="jtrac alt"> <tr> <td><a href="app"><wicket:message key="login.home"/></a></td> Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/LoginPage.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/LoginPage.java 2009-12-08 15:05:04 UTC (rev 1338) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/LoginPage.java 2009-12-08 15:06:08 UTC (rev 1339) @@ -43,6 +43,7 @@ public LoginPage() { setVersioned(false); + add(new IndividualHeadPanel().setRenderBodyOnly(true)); add(new Label("title", getLocalizer().getString("login.title", null))); add(new LoginForm("form")); String jtracVersion = JtracApplication.get().getJtrac().getReleaseVersion(); Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/LogoutPage.html =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/LogoutPage.html 2009-12-08 15:05:04 UTC (rev 1338) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/LogoutPage.html 2009-12-08 15:06:08 UTC (rev 1339) @@ -7,6 +7,7 @@ <link rel="icon" type="image/x-icon" href="favicon.ico"/> </head> <body> + <span wicket:id="individuel"></span><br/> <table width="100%" class="jtrac alt"> <tr> <td><a href="app"><wicket:message key="logout.home"/></a></td> Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/LogoutPage.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/LogoutPage.java 2009-12-08 15:05:04 UTC (rev 1338) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/LogoutPage.java 2009-12-08 15:06:08 UTC (rev 1339) @@ -36,6 +36,7 @@ getRequestCycle().getSession().setLocale(StringUtils.parseLocaleString(locale)); } setVersioned(false); + add(new IndividualHeadPanel().setRenderBodyOnly(true)); add(new Label("title", getLocalizer().getString("logout.title", null))); String jtracVersion = JtracApplication.get().getJtrac().getReleaseVersion(); add(new Label("version", jtracVersion)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ma...@us...> - 2011-09-15 11:42:48
|
Revision: 1368 http://j-trac.svn.sourceforge.net/j-trac/?rev=1368&view=rev Author: magog96 Date: 2011-09-15 11:42:42 +0000 (Thu, 15 Sep 2011) Log Message: ----------- -minor indention changes (removed spaces at line ends) Modified Paths: -------------- trunk/jtrac/src/main/java/info/jtrac/wicket/ConfigFormPage.html trunk/jtrac/src/main/java/info/jtrac/wicket/ConfigFormPage.java Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/ConfigFormPage.html =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/ConfigFormPage.html 2011-05-18 13:45:20 UTC (rev 1367) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/ConfigFormPage.html 2011-09-15 11:42:42 UTC (rev 1368) @@ -5,16 +5,16 @@ <div wicket:id="heading" class="heading"></div> <table class="jtrac"> <tr> - <td wicket:id="param" class="label"></td> - <td> + <td wicket:id="param" class="label"></td> + <td> <input wicket:id="value"/> - <input type="submit" wicket:message="value:submit"/> + <input type="submit" wicket:message="value:submit"/> </td> - </tr> + </tr> </table> <p/> <a href="#" wicket:id="cancel"><img src="resources/cancel.gif" class="nav-link"/><wicket:message key="cancel"/></a> </form> </wicket:extend> </body> -</html> +</html> \ No newline at end of file Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/ConfigFormPage.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/ConfigFormPage.java 2011-05-18 13:45:20 UTC (rev 1367) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/ConfigFormPage.java 2011-09-15 11:42:42 UTC (rev 1368) @@ -26,32 +26,32 @@ /** * config value edit form */ -public class ConfigFormPage extends BasePage { +public class ConfigFormPage extends BasePage { - public ConfigFormPage(String param, String value) { + public ConfigFormPage(String param, String value) { add(new ConfigForm("form", param, value)); } /** * wicket form */ - private class ConfigForm extends Form { + private class ConfigForm extends Form { private String param; private String value; - + public String getValue() { return value; } - + public void setValue(String value) { this.value = value; - } + } public ConfigForm(String id, final String param, final String value) { - super(id); + super(id); this.param = param; this.value = value; @@ -61,23 +61,21 @@ add(new Label("heading", localize("config." + param))); add(new Label("param", param)); - + add(new TextField("value")); // cancel ========================================================== add(new Link("cancel") { public void onClick() { setResponsePage(new ConfigListPage(param)); - } - }); + } + }); } - + @Override - protected void onSubmit() { + protected void onSubmit() { getJtrac().storeConfig(new Config(param, value)); setResponsePage(new ConfigListPage(param)); - } - - } - -} + } + } +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ma...@us...> - 2011-09-15 13:22:02
|
Revision: 1369 http://j-trac.svn.sourceforge.net/j-trac/?rev=1369&view=rev Author: magog96 Date: 2011-09-15 13:21:52 +0000 (Thu, 15 Sep 2011) Log Message: ----------- -added special form for password editing where the entered value is hidden (Note: The value is still visible in the list of configuration parameters) Modified Paths: -------------- trunk/jtrac/src/main/java/info/jtrac/wicket/ConfigFormPage.java trunk/jtrac/src/main/java/info/jtrac/wicket/ConfigListPage.java Added Paths: ----------- trunk/jtrac/src/main/java/info/jtrac/wicket/ConfigPasswordFormPage.html trunk/jtrac/src/main/java/info/jtrac/wicket/ConfigPasswordFormPage.java Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/ConfigFormPage.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/ConfigFormPage.java 2011-09-15 11:42:42 UTC (rev 1368) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/ConfigFormPage.java 2011-09-15 13:21:52 UTC (rev 1369) @@ -27,7 +27,12 @@ * config value edit form */ public class ConfigFormPage extends BasePage { - + /** + * Constructor + * + * @param param + * @param value + */ public ConfigFormPage(String param, String value) { add(new ConfigForm("form", param, value)); } @@ -61,7 +66,6 @@ add(new Label("heading", localize("config." + param))); add(new Label("param", param)); - add(new TextField("value")); // cancel ========================================================== Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/ConfigListPage.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/ConfigListPage.java 2011-09-15 11:42:42 UTC (rev 1368) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/ConfigListPage.java 2011-09-15 13:21:52 UTC (rev 1369) @@ -27,11 +27,17 @@ import org.apache.wicket.markup.html.list.ListView; /** - * config list + * This class is responsible to list all configuration parameters. + * It also declares which edit forms will be called to modify the + * configuration parameters. */ public class ConfigListPage extends BasePage { - - public ConfigListPage(final String selectedParam) { + /** + * Constructor + * + * @param selectedParam + */ + public ConfigListPage(final String selectedParam) { final Map<String, String> configMap = getJtrac().loadAllConfig(); @@ -43,22 +49,34 @@ protected void populateItem(ListItem listItem) { final String param = (String) listItem.getModelObject(); final String value = configMap.get(param); + if (param.equals(selectedParam)) { listItem.add(new SimpleAttributeModifier("class", "selected")); } else if(listItem.getIndex() % 2 == 1) { listItem.add(sam); - } + } + listItem.add(new Label("param", param)); listItem.add(new Label("value", value)); - listItem.add(new Link("link") { - public void onClick() { - setResponsePage(new ConfigFormPage(param, value)); - } - }); + + if (param.toLowerCase().indexOf("password") != -1) { + // Password value to be edited + listItem.add(new Link("link") { + public void onClick() { + setResponsePage(new ConfigPasswordFormPage(param, value)); + } + }); + } else { + // Normal text value to be edited + listItem.add(new Link("link") { + public void onClick() { + setResponsePage(new ConfigFormPage(param, value)); + } + }); + } listItem.add(new Label("description", localize("config." + param))); } }); } - -} +} \ No newline at end of file Added: trunk/jtrac/src/main/java/info/jtrac/wicket/ConfigPasswordFormPage.html =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/ConfigPasswordFormPage.html (rev 0) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/ConfigPasswordFormPage.html 2011-09-15 13:21:52 UTC (rev 1369) @@ -0,0 +1,20 @@ +<html> + <body> + <wicket:extend> + <form wicket:id="form"> + <div wicket:id="heading" class="heading"></div> + <table class="jtrac"> + <tr> + <td wicket:id="param" class="label"></td> + <td> + <input type="password" wicket:id="value"/> + <input type="submit" wicket:message="value:submit"/> + </td> + </tr> + </table> + <p/> + <a href="#" wicket:id="cancel"><img src="resources/cancel.gif" class="nav-link"/><wicket:message key="cancel"/></a> + </form> + </wicket:extend> + </body> +</html> \ No newline at end of file Property changes on: trunk/jtrac/src/main/java/info/jtrac/wicket/ConfigPasswordFormPage.html ___________________________________________________________________ Added: svn:mime-type + text/plain Added: trunk/jtrac/src/main/java/info/jtrac/wicket/ConfigPasswordFormPage.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/ConfigPasswordFormPage.java (rev 0) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/ConfigPasswordFormPage.java 2011-09-15 13:21:52 UTC (rev 1369) @@ -0,0 +1,85 @@ +/* + * Copyright 2002-2005 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package info.jtrac.wicket; + +import info.jtrac.domain.Config; +import org.apache.wicket.markup.html.basic.Label; +import org.apache.wicket.markup.html.form.Form; +import org.apache.wicket.markup.html.form.PasswordTextField; +import org.apache.wicket.markup.html.link.Link; +import org.apache.wicket.model.BoundCompoundPropertyModel; + +/** + * config value edit form + */ +public class ConfigPasswordFormPage extends BasePage { + /** + * Constructor + * + * @param param + * @param value + */ + public ConfigPasswordFormPage(String param, String value) { + add(new ConfigPasswordForm("form", param, value)); + } + + /** + * wicket form + */ + private class ConfigPasswordForm extends Form { + + private String param; + + private String value; + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public ConfigPasswordForm(String id, final String param, final String value) { + + super(id); + + this.param = param; + this.value = value; + + final BoundCompoundPropertyModel model = new BoundCompoundPropertyModel(this); + setModel(model); + + add(new Label("heading", localize("config." + param))); + add(new Label("param", param)); + add(new PasswordTextField("value")); + + // cancel ========================================================== + add(new Link("cancel") { + public void onClick() { + setResponsePage(new ConfigListPage(param)); + } + }); + } + + @Override + protected void onSubmit() { + getJtrac().storeConfig(new Config(param, value)); + setResponsePage(new ConfigListPage(param)); + } + } +} \ No newline at end of file Property changes on: trunk/jtrac/src/main/java/info/jtrac/wicket/ConfigPasswordFormPage.java ___________________________________________________________________ Added: svn:mime-type + text/plain This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ma...@us...> - 2011-10-27 15:44:01
|
Revision: 1370 http://j-trac.svn.sourceforge.net/j-trac/?rev=1370&view=rev Author: magog96 Date: 2011-10-27 15:43:54 +0000 (Thu, 27 Oct 2011) Log Message: ----------- -added JavaDoc comments -updated inline comments -reformatted source code -added log output for failed login attempts (see LoginPage.java) Modified Paths: -------------- trunk/jtrac/src/main/java/info/jtrac/wicket/JtracApplication.java trunk/jtrac/src/main/java/info/jtrac/wicket/LoginPage.java Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/JtracApplication.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/JtracApplication.java 2011-09-15 13:21:52 UTC (rev 1369) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/JtracApplication.java 2011-10-27 15:43:54 UTC (rev 1370) @@ -57,229 +57,348 @@ import org.springframework.beans.factory.NoSuchBeanDefinitionException; /** - * main wicket application for jtrac - * holds singleton service layer instance pulled from spring + * <p> + * Main Wicket application for jtrac. + * </p> + * <p> + * It holds singleton service layer instance pulled from Spring. + * </p> */ -public class JtracApplication extends WebApplication { - +public class JtracApplication extends WebApplication { + /** + * Logger object + */ private final static Logger logger = LoggerFactory.getLogger(JtracApplication.class); private Jtrac jtrac; - private ApplicationContext applicationContext; - private JtracCasProxyTicketValidator jtracCasProxyTicketValidator; + private ApplicationContext applicationContext; + private JtracCasProxyTicketValidator jtracCasProxyTicketValidator; public Jtrac getJtrac() { return jtrac; } - + public ApplicationContext getApplicationContext() { return applicationContext; } - // used only by CasLoginPage + /** + * This method will the login URL and is used only by CasLoginPage. + * + * @return Returns login URL. + */ public String getCasLoginUrl() { - if(jtracCasProxyTicketValidator == null) { + if (jtracCasProxyTicketValidator == null) { return null; } return jtracCasProxyTicketValidator.getLoginUrl(); } - // used only by logout link in HeaderPanel + /** + * This method will the logout URL and is used only by logout link + * in HeaderPanel. + * + * @return Returns logout URL. + */ public String getCasLogoutUrl() { - if(jtracCasProxyTicketValidator == null) { + if (jtracCasProxyTicketValidator == null) { return null; } return jtracCasProxyTicketValidator.getLogoutUrl(); - } + } + /** + * This method will return the main JtracApplication object. + * + * @return Returns JtracApplication object. + */ public static JtracApplication get() { return (JtracApplication) Application.get(); - } + } + /* (non-Javadoc) + * @see org.apache.wicket.protocol.http.WebApplication#init() + */ @Override public void init() { - super.init(); - // get hold of spring managed service layer (see BasePage, BasePanel etc for how it is used) + /* + * Get hold of spring managed service layer (see BasePage, BasePanel, + * etc. for how it is used). + */ ServletContext sc = getServletContext(); - applicationContext = WebApplicationContextUtils.getWebApplicationContext(sc); + applicationContext = WebApplicationContextUtils + .getWebApplicationContext(sc); jtrac = (Jtrac) applicationContext.getBean("jtrac"); - // check if acegi-cas authentication is being used, get reference to object to be used - // by wicket authentication to redirect to right pages for login / logout + /* + * Check if acegi-cas authentication is being used, get reference to + * object to be used by Wicket authentication to redirect to right + * pages for login/logout. + */ try { - jtracCasProxyTicketValidator = (JtracCasProxyTicketValidator) applicationContext.getBean("casProxyTicketValidator"); - logger.info("casProxyTicketValidator retrieved from application context: " + jtracCasProxyTicketValidator); - } catch(NoSuchBeanDefinitionException nsbde) { + jtracCasProxyTicketValidator = (JtracCasProxyTicketValidator) + applicationContext.getBean("casProxyTicketValidator"); + logger.info("casProxyTicketValidator retrieved from application " + + "context: " + jtracCasProxyTicketValidator); + } catch (NoSuchBeanDefinitionException nsbde) { logger.debug(nsbde.getMessage()); - logger.info("casProxyTicketValidator not found in application context, CAS single-sign-on is not being used"); - } + logger.info("casProxyTicketValidator not found in application " + + "context, CAS single-sign-on is not being used"); + } - // delegate wicket i18n support to spring i18n - getResourceSettings().addStringResourceLoader(new IStringResourceLoader() { - public String loadStringResource(Class clazz, String key, Locale locale, String style) { - try { - return applicationContext.getMessage(key, null, locale == null ? Session.get().getLocale() : locale); - } catch(Exception e) { - // for performance, wicket expects null instead of throwing an exception - // and wicket may try to re-resolve using prefixed variants of the key - return null; - } - } - public String loadStringResource(Component component, String key) { - String value = loadStringResource(null, key, component == null ? null : component.getLocale(), null); - if(logger.isDebugEnabled() && value == null) { - logger.debug("i18n failed for key: '" + key + "', component: " + component); - } - return value; - } - }); - - getSecuritySettings().setAuthorizationStrategy(new IAuthorizationStrategy() { - public boolean isActionAuthorized(Component c, Action a) { - return true; - } - public boolean isInstantiationAuthorized(Class clazz) { - if (BasePage.class.isAssignableFrom(clazz)) { - if (JtracSession.get().isAuthenticated()) { - return true; - } - if(jtracCasProxyTicketValidator != null) { - // attempt CAS authentication ========================== - logger.debug("checking if context contains CAS authentication"); - Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); - if(authentication != null && authentication.isAuthenticated()) { - logger.debug("security context contains CAS authentication, initializing session"); - JtracSession.get().setUser((User) authentication.getPrincipal()); - return true; + /* + * Delegate Wicket i18n support to spring i18n + */ + getResourceSettings().addStringResourceLoader( + new IStringResourceLoader() { + /* (non-Javadoc) + * @see org.apache.wicket.resource.loader.IStringResourceLoader#loadStringResource(java.lang.Class, java.lang.String, java.util.Locale, java.lang.String) + */ + public String loadStringResource(Class clazz, String key, + Locale locale, String style) { + try { + return applicationContext.getMessage(key, null, + locale == null ? Session.get().getLocale() : locale); + } catch (Exception e) { + /* + * For performance, Wicket expects null instead of + * throwing an exception and Wicket may try to + * re-resolve using prefixed variants of the key. + */ + return null; } } - // attempt remember-me auto login ========================== - if(attemptRememberMeAutoLogin()) { + + /* (non-Javadoc) + * @see org.apache.wicket.resource.loader.IStringResourceLoader#loadStringResource(org.apache.wicket.Component, java.lang.String) + */ + public String loadStringResource(Component component, + String key) { + String value = loadStringResource(null, key, + component == null ? null : component.getLocale(), null); + if (logger.isDebugEnabled() && value == null) { + logger.debug("i18n failed for key: '" + key + "', component: " + component); + } + return value; + } + }); + + getSecuritySettings().setAuthorizationStrategy( + new IAuthorizationStrategy() { + /* (non-Javadoc) + * @see org.apache.wicket.authorization.IAuthorizationStrategy#isActionAuthorized(org.apache.wicket.Component, org.apache.wicket.authorization.Action) + */ + public boolean isActionAuthorized(Component c, Action a) { return true; } - // attempt guest access if there are "public" spaces ======= - List<Space> spaces = getJtrac().findSpacesWhereGuestAllowed(); - if (spaces.size() > 0) { - logger.debug(spaces.size() + " public space(s) available, initializing guest user"); - User guestUser = new User(); - guestUser.setLoginName("guest"); - guestUser.setName("Guest"); - for (Space space : spaces) { - guestUser.addSpaceWithRole(space, Role.ROLE_GUEST); + + /* (non-Javadoc) + * @see org.apache.wicket.authorization.IAuthorizationStrategy#isInstantiationAuthorized(java.lang.Class) + */ + public boolean isInstantiationAuthorized(Class clazz) { + if (BasePage.class.isAssignableFrom(clazz)) { + if (JtracSession.get().isAuthenticated()) { + return true; + } + if (jtracCasProxyTicketValidator != null) { + /* + * ============================================ + * Attempt CAS authentication + * ============================================ + */ + logger.debug("checking if context contains CAS authentication"); + Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); + if (authentication != null && authentication.isAuthenticated()) { + logger.debug("security context contains CAS authentication, initializing session"); + JtracSession.get().setUser((User) authentication.getPrincipal()); + return true; + } + } + + /* + * ================================================ + * Attempt remember-me auto login + * ================================================ + */ + if (attemptRememberMeAutoLogin()) { + return true; + } + + /* + * ================================================= + * Attempt guest access if there are "public" spaces + * ================================================= + */ + List<Space> spaces = getJtrac().findSpacesWhereGuestAllowed(); + if (spaces.size() > 0) { + logger.debug(spaces.size() + + " public space(s) available, initializing guest user"); + User guestUser = new User(); + guestUser.setLoginName("guest"); + guestUser.setName("Guest"); + for (Space space : spaces) { + guestUser.addSpaceWithRole(space, Role.ROLE_GUEST); + } + + JtracSession.get().setUser(guestUser); + // and proceed + return true; + } + + /* + * Not authenticated, go to login page. + */ + logger.debug("not authenticated, forcing login, " + + "page requested was " + clazz.getName()); + if (jtracCasProxyTicketValidator != null) { + String serviceUrl = jtracCasProxyTicketValidator.getServiceProperties().getService(); + String loginUrl = jtracCasProxyTicketValidator.getLoginUrl(); + logger.debug("cas authentication: service URL: " + serviceUrl); + String redirectUrl = loginUrl + "?service=" + serviceUrl; + logger.debug("attempting to redirect to: " + redirectUrl); + throw new RestartResponseAtInterceptPageException( + new RedirectPage(redirectUrl)); + } else { + throw new RestartResponseAtInterceptPageException( + LoginPage.class); + } } - JtracSession.get().setUser(guestUser); - // and proceed return true; } - // not authenticated, go to login page - logger.debug("not authenticated, forcing login, page requested was " + clazz.getName()); - if(jtracCasProxyTicketValidator != null) { - String serviceUrl = jtracCasProxyTicketValidator.getServiceProperties().getService(); - String loginUrl = jtracCasProxyTicketValidator.getLoginUrl(); - logger.debug("cas authentication: service URL: " + serviceUrl); - String redirectUrl = loginUrl + "?service=" + serviceUrl; - logger.debug("attempting to redirect to: " + redirectUrl); - throw new RestartResponseAtInterceptPageException(new RedirectPage(redirectUrl)); - } else { - throw new RestartResponseAtInterceptPageException(LoginPage.class); - } - } - return true; - } - }); + }); - // friendly urls for selected pages - if(jtracCasProxyTicketValidator != null) { + /* + * Friendly URLs for selected pages + */ + if (jtracCasProxyTicketValidator != null) { mountBookmarkablePage("/login", CasLoginPage.class); - // this matches the value set in WEB-INF/applicationContext-acegi-cas.xml - mountBookmarkablePage("/cas/error", CasLoginErrorPage.class); + /* + * This matches the value set in: + * WEB-INF/applicationContext-acegi-cas.xml + */ + mountBookmarkablePage("/cas/error", CasLoginErrorPage.class); } else { mountBookmarkablePage("/login", LoginPage.class); - } + } + mountBookmarkablePage("/logout", LogoutPage.class); mountBookmarkablePage("/svn", SvnStatsPage.class); mountBookmarkablePage("/options", OptionsPage.class); - mountBookmarkablePage("/item/form", ItemFormPage.class); - // bookmarkable url for search and search results - mount(new QueryStringUrlCodingStrategy("/item/search", ItemSearchFormPage.class)); - mount(new QueryStringUrlCodingStrategy("/item/list", ItemListPage.class)); - // bookmarkable url for viewing items - mount(new IndexedParamUrlCodingStrategy("/item", ItemViewPage.class)); - } + mountBookmarkablePage("/item/form", ItemFormPage.class); + + /* + * Bookmarkable URL for search and search results + */ + mount(new QueryStringUrlCodingStrategy("/item/search", + ItemSearchFormPage.class)); + mount(new QueryStringUrlCodingStrategy("/item/list", ItemListPage.class)); + + /* + * Bookmarkable URL for viewing items + */ + mount(new IndexedParamUrlCodingStrategy("/item", ItemViewPage.class)); + } + /* (non-Javadoc) + * @see org.apache.wicket.protocol.http.WebApplication#newSession(org.apache.wicket.Request, org.apache.wicket.Response) + */ @Override - public JtracSession newSession(Request request, Response response) { - return new JtracSession(request); + public JtracSession newSession(Request request, Response response) { + return new JtracSession(request); } + /* (non-Javadoc) + * @see org.apache.wicket.protocol.http.WebApplication#newSessionStore() + */ @Override protected ISessionStore newSessionStore() { - if(getConfigurationType().equalsIgnoreCase(DEVELOPMENT)) { + if (getConfigurationType().equalsIgnoreCase(DEVELOPMENT)) { logger.warn("wicket development mode, using custom debug http session store"); - // the default second level cache session store does not play well with - // our custom reloading filter so we use a custom session store + + /* + * The default second level cache session store does not play well + * with our custom reloading filter so we use a custom session store. + */ return new DebugHttpSessionStore(this); } else { ISessionStore sessionStore = super.newSessionStore(); logger.info("wicket production mode, using: " + sessionStore); return sessionStore; } - - } + } + /* (non-Javadoc) + * @see org.apache.wicket.Application#getHomePage() + */ public Class<? extends Page> getHomePage() { return DashboardPage.class; - } + } - public User authenticate(String loginName, String password) { - UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(loginName, password); + /** + * The method handles the user authentication using the login name and + * password. + * + * @param loginName The login name of the user + * @param password The password of the user + * @return Returns the User object or null in case of an Exception. + */ + public User authenticate(String loginName, String password) { + UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken( + loginName, password); AuthenticationManager am = (AuthenticationManager) applicationContext.getBean("authenticationManager"); try { Authentication authentication = am.authenticate(token); return (User) authentication.getPrincipal(); - } catch(AuthenticationException ae) { + } catch (AuthenticationException ae) { logger.debug("acegi authentication failed: " + ae); return null; } } + /** + * This method will try to identify the user by using cookies and tries to + * auto login the user. + * + * @return Returns <code>true</code> on successful identification otherwise <code>false</code>. + */ private boolean attemptRememberMeAutoLogin() { logger.debug("checking cookies for remember-me auto login"); - Cookie[] cookies = ((WebRequest) RequestCycle.get().getRequest()).getCookies(); - if(cookies == null) { + Cookie[] cookies = ((WebRequest) RequestCycle.get().getRequest()) + .getCookies(); + if (cookies == null) { logger.debug("no cookies found"); return false; - } + } + for (Cookie c : cookies) { - if(logger.isDebugEnabled()) { + if (logger.isDebugEnabled()) { logger.debug("examining cookie: " + WebUtils.getDebugStringForCookie(c)); } if (!c.getName().equals("jtrac")) { continue; - } + } String value = c.getValue(); logger.debug("found jtrac cookie: " + value); - if(value == null) { + if (value == null) { continue; - } + } int index = value.indexOf(':'); - if(index == -1) { + if (index == -1) { continue; - } + } String loginName = value.substring(0, index); String encodedPassword = value.substring(index + 1); logger.debug("valid cookie, attempting authentication"); User user = (User) getJtrac().loadUserByUsername(loginName); if (encodedPassword.equals(user.getPassword())) { JtracSession.get().setUser(user); - logger.debug("remember me login success"); + logger.debug("remember me login success"); return true; - } - } + } + } // end for // no valid cookies were found return false; - } - -} + } +} \ No newline at end of file Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/LoginPage.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/LoginPage.java 2011-09-15 13:21:52 UTC (rev 1369) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/LoginPage.java 2011-10-27 15:43:54 UTC (rev 1370) @@ -35,55 +35,108 @@ import org.slf4j.LoggerFactory; /** - * login page + * The JTrac login page. */ -public class LoginPage extends WebPage { +public class LoginPage extends WebPage { + /** + * Logger object + */ + private static final Logger logger = LoggerFactory.getLogger(LoginPage.class); - private static final Logger logger = LoggerFactory.getLogger(LoginPage.class); - + /** + * Default constructor + */ public LoginPage() { setVersioned(false); add(new IndividualHeadPanel().setRenderBodyOnly(true)); add(new Label("title", getLocalizer().getString("login.title", null))); add(new LoginForm("form")); String jtracVersion = JtracApplication.get().getJtrac().getReleaseVersion(); - add(new Label("version", jtracVersion)); + add(new Label("version", jtracVersion)); } /** - * wicket form - */ - private class LoginForm extends StatelessForm { + * Wicket form for the login (inner class) + */ + private class LoginForm extends StatelessForm { + /** + * The login name of the user. + */ + private String loginName; - private String loginName; + /** + * The password of the user. + */ private String password; + + /** + * The flag indicating if the user wants to be remembered or not. + */ private boolean rememberMe; - + + /** + * This method will return the login name of the user. + * + * @return The login name of the user. + */ public String getLoginName() { return loginName; } - + + /** + * This method allows to set the login name entered in the form. + * + * @param loginName The login name to set. + */ public void setLoginName(String loginName) { this.loginName = loginName; } - + + /** + * This method will return the password of the user. + * + * @return The password of the user. + */ public String getPassword() { return password; } - + + /** + * This method allows to set the password entered in the form. + * + * @param password The password to set. + */ public void setPassword(String password) { this.password = password; - } - + } + + /** + * This method will return the flag indicating if the user + * want's to be remembered as chosen on the form. + * + * @return The flag indicating if the user wants to be remembered + * (<code>true</code>) or not (<code>false</code>). + */ public boolean isRememberMe() { return rememberMe; } - + + /** + * This method allows to set the boolean flag to be remembered as + * checked on the form. + * + * @param rememberMe The boolean flag to set. + */ public void setRememberMe(boolean rememberMe) { this.rememberMe = rememberMe; - } + } - public LoginForm(String id) { + /** + * Constructor for the login form. + * + * @param id + */ + public LoginForm(String id) { super(id); add(new WebMarkupContainer("hide") { @Override @@ -91,7 +144,7 @@ return !LoginForm.this.hasError(); } }); - add(new FeedbackPanel("feedback")); + add(new FeedbackPanel("feedback")); setModel(new BoundCompoundPropertyModel(this)); final TextField loginNameField = new TextField("loginName"); loginNameField.setOutputMarkupId(true); @@ -100,7 +153,10 @@ passwordField.setRequired(false); passwordField.setOutputMarkupId(true); add(passwordField); - // intelligently set focus on the appropriate textbox + + /* + * Intelligently set focus on the appropriate textbox. + */ add(new HeaderContributor(new IHeaderContributor() { public void renderHead(IHeaderResponse response) { String markupId; @@ -108,43 +164,69 @@ markupId = loginNameField.getMarkupId(); } else { markupId = passwordField.getMarkupId(); - } + } response.renderOnLoadJavascript("document.getElementById('" + markupId + "').focus()"); } - })); + })); add(new CheckBox("rememberMe")); - - } - + } // end LoginForm(String) + + /** + * This method will process the login after the user hits the submit + * button to login. + */ @Override - protected void onSubmit() { + protected void onSubmit() { if(loginName == null || password == null) { - logger.debug("login failed - login name or password is null"); - error(getLocalizer().getString("login.error", null)); + logger.error("login failed - login name " + + (loginName!=null ? "is set (trimmed length=" + + loginName.trim().length()+")" : "is null") + + " and password " + + (password!=null ? "is set" : "is null") + "."); + error(getLocalizer().getString("login.error", null)); return; - } - User user = JtracApplication.get().authenticate(loginName, password); - if (user == null) { // login failed - error(getLocalizer().getString("login.error", null)); - } else { // login success - // remember me cookie - if(rememberMe) { - Cookie cookie = new Cookie("jtrac", loginName + ":" + JtracApplication.get().getJtrac().encodeClearText(password)); + } + + User user = JtracApplication.get().authenticate(loginName, password); + if (user == null) { + /* + * ================================ + * Login failed! + * ================================ + */ + logger.error("login failed - Authentication for login name '"+ + loginName + "' not successful"); + error(getLocalizer().getString("login.error", null)); + } else { + /* + * ================================ + * Login success! + * ================================ + */ + + /* + * Set Remember me cookie if checkbox is checked on page. + */ + if(rememberMe) { + Cookie cookie = new Cookie("jtrac", loginName + ":" + JtracApplication.get().getJtrac().encodeClearText(password)); cookie.setMaxAge(30 * 24 * 60 * 60); // 30 days in seconds String path = getWebRequestCycle().getWebRequest().getHttpServletRequest().getContextPath(); cookie.setPath(path); getWebRequestCycle().getWebResponse().addCookie(cookie); logger.debug("remember me requested, cookie added, " + WebUtils.getDebugStringForCookie(cookie)); } - // setup session with principal + + /* + * Setup session with principal + */ JtracSession.get().setUser(user); - // proceed to bookmarkable page or default dashboard + /* + * Proceed to bookmarkable page or default dashboard + */ if (!continueToOriginalDestination()) { setResponsePage(DashboardPage.class); - } - } - } - - } - + } + } + } // end onSubmit() + } // end inner class LoginForm } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ma...@us...> - 2011-10-27 19:59:56
|
Revision: 1371 http://j-trac.svn.sourceforge.net/j-trac/?rev=1371&view=rev Author: magog96 Date: 2011-10-27 19:59:49 +0000 (Thu, 27 Oct 2011) Log Message: ----------- -added JavaDoc comments -updated inline comments -reformatted source code as well as HTML code Modified Paths: -------------- trunk/jtrac/src/main/java/info/jtrac/wicket/CustomFieldsFormPanel.java trunk/jtrac/src/main/java/info/jtrac/wicket/ItemFormPage.html trunk/jtrac/src/main/java/info/jtrac/wicket/ItemFormPage.java Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/CustomFieldsFormPanel.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/CustomFieldsFormPanel.java 2011-10-27 15:43:54 UTC (rev 1370) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/CustomFieldsFormPanel.java 2011-10-27 19:59:49 UTC (rev 1371) @@ -37,74 +37,113 @@ import org.apache.wicket.model.PropertyModel; /** - * panel for custom fields that can be reused in the ite-create / item-view forms + * This class is responsible for the panel of custom fields that + * can be reused in the item-create/item-view forms. */ -public class CustomFieldsFormPanel extends BasePanel { - +public class CustomFieldsFormPanel extends BasePanel { + /** + * Constructor + * + * @param id + * @param model + * @param space + */ public CustomFieldsFormPanel(String id, BoundCompoundPropertyModel model, Space space) { super(id); List<Field> fields = space.getMetadata().getFieldList(); addComponents(model, fields, true); - } + } + /** + * Constructor + * + * @param id + * @param model + * @param item + * @param user + */ public CustomFieldsFormPanel(String id, BoundCompoundPropertyModel model, Item item, User user) { super(id); List<Field> fields = item.getEditableFieldList(user); addComponents(model, fields, false); } + /** + * This method allows to add components (custom fields). + * + * @param model + * @param fields + * @param isEditMode + */ private void addComponents(final BoundCompoundPropertyModel model, List<Field> fields, final boolean isEditMode) { ListView listView = new ListView("fields", fields) { - protected void populateItem(ListItem listItem) { + protected void populateItem(ListItem listItem) { final Field field = (Field) listItem.getModelObject(); - boolean isRequired = isEditMode ? false : !field.isOptional(); + boolean isRequired = isEditMode ? false : !field.isOptional(); listItem.add(new Label("label", field.getLabel())); listItem.add(new Label("star", isRequired ? "*" : " ").setEscapeModelStrings(false)); - if (field.isDropDownType()) { + if (field.isDropDownType()) { Fragment f = new Fragment("field", "dropDown", CustomFieldsFormPanel.this); final Map<String, String> options = field.getOptions(); List<String> keys; // bound value - if(options != null) { - keys = new ArrayList(options.keySet()); + if (options != null) { + keys = new ArrayList(options.keySet()); } else { keys = new ArrayList<String>(); - } + } DropDownChoice choice = new DropDownChoice("field", keys, new IChoiceRenderer() { public Object getDisplayValue(Object o) { return options.get(o); }; + public String getIdValue(Object o, int i) { return o.toString(); }; }); - choice.setNullValid(true); - choice.setLabel(new Model(field.getLabel())); + choice.setNullValid(true); + choice.setLabel(new Model(field.getLabel())); choice.setRequired(isRequired); WebMarkupContainer border = new WebMarkupContainer("border"); f.add(border); border.add(new ErrorHighlighter(choice)); - border.add(model.bind(choice, field.getName().getText())); + border.add(model.bind(choice, field.getName().getText())); listItem.add(f); - } else if (field.isDatePickerType()) { - YuiCalendar calendar = new YuiCalendar("field", new PropertyModel(model, field.getName().getText()), isRequired); + } else if (field.isDatePickerType()) { + /* + * ====================================== + * Date picker + * ====================================== + */ + YuiCalendar calendar = new YuiCalendar("field", + new PropertyModel(model, field.getName().getText()), isRequired); listItem.add(calendar); calendar.setLabel(new Model(field.getLabel())); } else { + /* + * ====================================== + * Text field + * ====================================== + */ Fragment f = new Fragment("field", "textField", CustomFieldsFormPanel.this); TextField textField = new TextField("field"); + + /* + * Check if the field is used to display/edit + * Double values. + */ if (field.isDecimalNumberType()) { textField.setType(Double.class); } - textField.add(new ErrorHighlighter()); - textField.setRequired(isRequired); - textField.setLabel(new Model(field.getLabel())); + + textField.add(new ErrorHighlighter()); + textField.setRequired(isRequired); + textField.setLabel(new Model(field.getLabel())); f.add(model.bind(textField, field.getName().getText())); listItem.add(f); } } }; listView.setReuseItems(true); - add(listView); - } - -} + add(listView); + } // end method addComponents(...) +} \ No newline at end of file Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/ItemFormPage.html =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/ItemFormPage.html 2011-10-27 15:43:54 UTC (rev 1370) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/ItemFormPage.html 2011-10-27 19:59:49 UTC (rev 1371) @@ -1,29 +1,29 @@ <html> - <body> - <wicket:extend> - <form wicket:id="form"> - <span wicket:id="feedback"></span> + <body> + <wicket:extend> + <form wicket:id="form"> + <span wicket:id="feedback"></span> <table class="bdr-collapse"> <tr> <td colspan="2"> <table class="jtrac"> - <tr> + <tr> <td class="label"> <wicket:message key="item_form.summary"/> <font color="red">*</font> - </td> + </td> <td> <input wicket:id="summary" style="width:49.7em" maxlength="255"/> - <input type="submit" wicket:id="delete" wicket:message="value:delete"/> + <input type="submit" wicket:id="delete" wicket:message="value:delete"/> </td> </tr> - <tr> + <tr> <td class="label"> <wicket:message key="item_form.detail"/> <font color="red">*</font> - </td> + </td> <td> - <textarea wicket:id="detail" rows="10" style="width:51em"></textarea> + <textarea wicket:id="detail" rows="10" style="width:51em"></textarea> </td> </tr> </table> @@ -33,16 +33,16 @@ <td> <table class="jtrac"> <span wicket:id="fields"></span> - <tr wicket:id="hideAssignedTo"> + <tr wicket:id="hideAssignedTo"> <td class="label"> <wicket:message key="item_form.assignTo"/> <font color="red">*</font> - </td> + </td> <td> <div wicket:id="border"><select wicket:id="assignedTo"/></div> </td> </tr> - <tr wicket:id="hideEditReason"> + <tr wicket:id="hideEditReason"> <td class="label"> <wicket:message key="item_form.editReason"/> <font color="red">*</font> @@ -50,13 +50,13 @@ <td> <textarea wicket:id="editReason" rows="5" cols="40"></textarea> </td> - </tr> + </tr> <tr> <td/> <td> - <input type="submit" wicket:message="value:submit"/> + <input type="submit" wicket:message="value:submit"/> <input type="checkbox" wicket:id="sendNotifications"/> - <wicket:message key="item_form.sendNotifications"/> + <wicket:message key="item_form.sendNotifications"/> </td> </tr> <tr> @@ -64,7 +64,7 @@ <a href="#" wicket:id="cancel"><img src="resources/cancel.gif" class="nav-link"/><wicket:message key="cancel"/></a> </td> </tr> - </table> + </table> </td> <td align="right" wicket:id="hideNotifyList"> <table class="jtrac"> @@ -82,11 +82,11 @@ <input wicket:id="file" size="15" type="file"/> </td> </tr> - </table> + </table> </td> - </tr> + </tr> </table> </form> </wicket:extend> </body> -</html> +</html> \ No newline at end of file Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/ItemFormPage.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/ItemFormPage.java 2011-10-27 15:43:54 UTC (rev 1370) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/ItemFormPage.java 2011-10-27 19:59:49 UTC (rev 1371) @@ -49,48 +49,65 @@ /** * Create / Edit item form page */ -public class ItemFormPage extends BasePage { - - public ItemFormPage() { +public class ItemFormPage extends BasePage { + /** + * Default constructor + */ + public ItemFormPage() { Item item = new Item(); item.setSpace(getCurrentSpace()); - item.setStatus(State.NEW); + item.setStatus(State.NEW); add(new ItemForm("form", item)); } - public ItemFormPage(long itemId) { - Item item = getJtrac().loadItem(itemId); + /** + * Constructor with provided item id. + * + * @param itemId The + */ + public ItemFormPage(long itemId) { + Item item = getJtrac().loadItem(itemId); add(new ItemForm("form", item)); - } + } /** - * wicket form - */ + * Wicket form + */ private class ItemForm extends Form { - private JtracFeedbackMessageFilter filter; private FileUploadField fileUploadField = new FileUploadField("file"); private boolean editMode; - private int version; + private int version; + /** + * Constructor + * + * @param id + * @param item + */ public ItemForm(String id, final Item item) { super(id); setMultiPart(true); FeedbackPanel feedback = new FeedbackPanel("feedback"); filter = new JtracFeedbackMessageFilter(); feedback.setFilter(filter); - add(feedback); + add(feedback); version = item.getVersion(); - if(item.getId() > 0) { - editMode = true; + + if (item.getId() > 0) { + editMode = true; } + BoundCompoundPropertyModel model = null; - if(editMode) { - // this ensures that the model object is re-loaded as part of the - // form submission workflow before form binding and avoids - // hibernate lazy loading issues during the whole update transaction + if (editMode) { + /* + * This ensures that the model object is re-loaded as part + * of the form submission workflow before form binding and + * avoids hibernate lazy loading issues during the whole + * update transaction. + */ LoadableDetachableModel itemModel = new LoadableDetachableModel() { - protected Object load() { + protected Object load() { logger.debug("attaching existing item " + item.getId()); return getJtrac().loadItem(item.getId()); } @@ -99,8 +116,13 @@ } else { model = new BoundCompoundPropertyModel(item); } - setModel(model); - // summary ========================================================= + setModel(model); + + /* + * =================================================== + * Summary + * =================================================== + */ final TextField summaryField = new TextField("summary"); summaryField.setRequired(true); summaryField.add(new ErrorHighlighter()); @@ -108,58 +130,83 @@ add(summaryField); add(new HeaderContributor(new IHeaderContributor() { public void renderHead(IHeaderResponse response) { - response.renderOnLoadJavascript("document.getElementById('" + summaryField.getMarkupId() + "').focus()"); + response.renderOnLoadJavascript("document.getElementById('" + + summaryField.getMarkupId() + "').focus()"); } })); - // delete button =================================================== + + /* + * =================================================== + * Delete button + * =================================================== + */ Button delete = new Button("delete") { @Override public void onSubmit() { String heading = localize("item_delete.confirm"); String warning = localize("item_delete.line2"); - String line1 = localize("item_delete.line1"); - ConfirmPage confirm = new ConfirmPage(ItemFormPage.this, heading, warning, new String[] {line1}) { + String line1 = localize("item_delete.line1"); + ConfirmPage confirm = new ConfirmPage(ItemFormPage.this, heading, warning, new String[] { line1 }) { public void onConfirm() { // avoid lazy init problem getJtrac().removeItem(getJtrac().loadItem(item.getId())); ItemSearch itemSearch = JtracSession.get().getItemSearch(); - if(itemSearch != null) { + if (itemSearch != null) { setResponsePage(new ItemListPage(itemSearch)); } else { setResponsePage(DashboardPage.class); } - } + } }; - setResponsePage(confirm); + setResponsePage(confirm); } }; + delete.setDefaultFormProcessing(false); add(delete); - if(!editMode) { + if (!editMode) { delete.setVisible(false); } - // detail ========================================================== + + /* + * =================================================== + * Detail + * =================================================== + */ add(new TextArea("detail").setRequired(true).add(new ErrorHighlighter())); - // custom fields =================================================== - if(editMode) { + + /* + * =================================================== + * Custom fields + * =================================================== + */ + if (editMode) { add(new CustomFieldsFormPanel("fields", model, item.getSpace()).setRenderBodyOnly(true)); } else { add(new CustomFieldsFormPanel("fields", model, item, getPrincipal()).setRenderBodyOnly(true)); } - // hide some components if editing item + + /* + * Hide some components if editing item + */ WebMarkupContainer hideAssignedTo = new WebMarkupContainer("hideAssignedTo"); WebMarkupContainer hideNotifyList = new WebMarkupContainer("hideNotifyList"); WebMarkupContainer hideEditReason = new WebMarkupContainer("hideEditReason"); add(hideAssignedTo); add(hideNotifyList); add(hideEditReason); - if(editMode) { + if (editMode) { hideAssignedTo.setVisible(false); hideNotifyList.setVisible(false); hideEditReason.add(new TextArea("editReason").setRequired(true).add(new ErrorHighlighter())); } else { hideEditReason.setVisible(false); - // assigned to ================================================= + + /* + * =================================================== + * Assigned to + * =================================================== + */ Space space = item.getSpace(); List<UserSpaceRole> userSpaceRoles = getJtrac().findUserRolesForSpace(space.getId()); List<User> assignable = UserUtils.filterUsersAbleToTransitionFrom(userSpaceRoles, space, State.OPEN); @@ -167,69 +214,104 @@ public Object getDisplayValue(Object o) { return ((User) o).getName(); } + public String getIdValue(Object o, int i) { return ((User) o).getId() + ""; - } + } }); + choice.setNullValid(true); choice.setRequired(true); WebMarkupContainer border = new WebMarkupContainer("border"); border.add(choice); border.add(new ErrorHighlighter(choice)); hideAssignedTo.add(border); - // notify list ================================================= + + /* + * =================================================== + * Notify list + * =================================================== + */ List<ItemUser> choices = UserUtils.convertToItemUserList(userSpaceRoles); - ListMultipleChoice itemUsers = new JtracCheckBoxMultipleChoice("itemUsers", choices, new IChoiceRenderer() { - public Object getDisplayValue(Object o) { - return ((ItemUser) o).getUser().getName(); - } - public String getIdValue(Object o, int i) { - return ((ItemUser) o).getUser().getId() + ""; - } - }, true); + ListMultipleChoice itemUsers = new JtracCheckBoxMultipleChoice("itemUsers", choices, + new IChoiceRenderer() { + public Object getDisplayValue(Object o) { + return ((ItemUser) o).getUser().getName(); + } + + public String getIdValue(Object o, int i) { + return ((ItemUser) o).getUser().getId() + ""; + } + }, true); hideNotifyList.add(itemUsers); - // attachment ================================================== + + /* + * =================================================== + * Attachment + * =================================================== + */ hideNotifyList.add(fileUploadField); setMaxSize(Bytes.megabytes(getJtrac().getAttachmentMaxSizeInMb())); } - // send notifications ========================================== + + /* + * =================================================== + * Send notifications + * =================================================== + */ add(new CheckBox("sendNotifications")); - // cancel ========================================================== + + /* + * =================================================== + * Cancel + * =================================================== + */ add(new Link("cancel") { public void onClick() { setResponsePage(ItemViewPage.class, new PageParameters("0=" + item.getRefId())); - } - }.setVisible(editMode && JtracSession.get().getItemSearch() != null)); + } + }.setVisible(editMode && JtracSession.get().getItemSearch() != null)); } + /* (non-Javadoc) + * @see org.apache.wicket.markup.html.form.Form#validate() + */ @Override protected void validate() { - filter.reset(); - Item item = (Item) getModelObject(); - if(editMode && item.getVersion() != version) { - // user must have used back button after edit - error(localize("item_form.error.version")); - } - super.validate(); - } + filter.reset(); + Item item = (Item) getModelObject(); + if (editMode && item.getVersion() != version) { + /* + * User must have used back button after edit + */ + error(localize("item_form.error.version")); + } + super.validate(); + } + /* (non-Javadoc) + * @see org.apache.wicket.markup.html.form.Form#onSubmit() + */ @Override protected void onSubmit() { final FileUpload fileUpload = fileUploadField.getFileUpload(); - Item item = (Item) getModelObject(); - User user = getPrincipal(); - if(editMode) { - getJtrac().updateItem(item, user); + Item item = (Item) getModelObject(); + User user = getPrincipal(); + if (editMode) { + getJtrac().updateItem(item, user); } else { item.setLoggedBy(user); - item.setStatus(State.OPEN); - getJtrac().storeItem(item, fileUpload); - } - // on creating an item, clear any search filter (especially the related item) from session + item.setStatus(State.OPEN); + getJtrac().storeItem(item, fileUpload); + } + + /* + * On creating an item, clear any search filter (especially + * the related item) from session. + */ JtracSession.get().setItemSearch(null); setResponsePage(ItemViewPage.class, new PageParameters("0=" + item.getRefId())); } - } - -} + } // end inner class ItemForm +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ma...@us...> - 2011-10-28 15:56:22
|
Revision: 1372 http://j-trac.svn.sourceforge.net/j-trac/?rev=1372&view=rev Author: magog96 Date: 2011-10-28 15:56:16 +0000 (Fri, 28 Oct 2011) Log Message: ----------- -added JavaDoc comments -updated inline comments -reformatted source code as well as HTML code Modified Paths: -------------- trunk/jtrac/src/main/java/info/jtrac/wicket/ItemViewPage.html trunk/jtrac/src/main/java/info/jtrac/wicket/ItemViewPanel.html trunk/jtrac/src/main/java/info/jtrac/wicket/ItemViewPanel.java Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/ItemViewPage.html =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/ItemViewPage.html 2011-10-27 19:59:49 UTC (rev 1371) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/ItemViewPage.html 2011-10-28 15:56:16 UTC (rev 1372) @@ -1,5 +1,5 @@ <html> - <body> + <body> <wicket:extend> <span wicket:id="relate"></span> <table class="jtrac" width="100%"> @@ -14,12 +14,12 @@ <wicket:enclosure> <img src="resources/edit.gif" class="nav-link"/> <a href="#" wicket:id="edit"><wicket:message key="edit"/></a> - </wicket:enclosure> + </wicket:enclosure> </td> </tr> - </table> - <div wicket:id="itemViewPanel"></div> + </table> + <div wicket:id="itemViewPanel"></div> <div wicket:id="itemViewFormPanel" style="margin-top:1em"></div> </wicket:extend> </body> -</html> +</html> \ No newline at end of file Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/ItemViewPanel.html =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/ItemViewPanel.html 2011-10-27 19:59:49 UTC (rev 1371) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/ItemViewPanel.html 2011-10-28 15:56:16 UTC (rev 1372) @@ -1,25 +1,25 @@ -<wicket:panel> +<wicket:panel> <table class="jtrac jtrac-view" width="100%"> <tr class="alt" valign="top"> <td class="label"><wicket:message key="item_view.id"/></td> <td wicket:id="refId"></td> <td class="label"> <wicket:message key="item_view.relatedItems"/> - <a href="#" wicket:id="relate" wicket:message="title:item_view_form.addRelatedItem"><img src="resources/add.gif"/></a> + <a href="#" wicket:id="relate" wicket:message="title:item_view_form.addRelatedItem"><img src="resources/add.gif"/></a> </td> <td colspan="3"> <span wicket:id="relatedItems"> <span wicket:id="message"></span> <span wicket:id="link"><a href="#" wicket:id="refId"></a></span> - <a href="#" wicket:id="remove" wicket:message="title:item_view.remove"><img src="resources/remove.gif"/></a> + <a href="#" wicket:id="remove" wicket:message="title:item_view.remove"><img src="resources/remove.gif"/></a> <br/> - </span> - <span wicket:id="relatingItems"> + </span> + <span wicket:id="relatingItems"> <span wicket:id="link"><a href="#" wicket:id="refId"></a></span> <span wicket:id="message"></span> - <a href="#" wicket:id="remove" wicket:message="title:item_view.remove"><img src="resources/remove.gif"/></a> + <a href="#" wicket:id="remove" wicket:message="title:item_view.remove"><img src="resources/remove.gif"/></a> <br/> - </span> + </span> </td> </tr> <tr> @@ -37,12 +37,12 @@ <tr> <td class="label" valign="top"><wicket:message key="item_view.detail"/></td> <td wicket:id="detail" colspan="5"></td> - </tr> + </tr> <tr wicket:id="fields"> <td class="label" wicket:id="label"></td> <td wicket:id="value" colspan="5"></td> </tr> - </table> + </table> <br/><div class="space-below"> <b><wicket:message key="item_view.history"/></b></div> @@ -64,4 +64,4 @@ <td wicket:id="fields"><span wicket:id="field"></span></td> </tr> </table> -</wicket:panel> +</wicket:panel> \ No newline at end of file Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/ItemViewPanel.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/ItemViewPanel.java 2011-10-27 19:59:49 UTC (rev 1371) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/ItemViewPanel.java 2011-10-28 15:56:16 UTC (rev 1372) @@ -38,58 +38,87 @@ import org.apache.wicket.model.PropertyModel; /** - * panel for showing the item read-only view + * This class is responsible the panel showing the item + * read-only view. */ -public class ItemViewPanel extends BasePanel { - +public class ItemViewPanel extends BasePanel { + /** + * Boolean flags to hide links. + */ private boolean hideLinks; - public ItemViewPanel(String id, long itemId) { + /** + * Constructor + * + * @param id + * @param itemId + */ + public ItemViewPanel(String id, long itemId) { super(id); addComponents(getJtrac().loadItem(itemId)); - } + } - public ItemViewPanel(String id, final Item item, boolean hideLinks) { + /** + * Constructor + * + * @param id + * @param item + * @param hideLinks + */ + public ItemViewPanel(String id, final Item item, boolean hideLinks) { super(id); this.hideLinks = hideLinks; addComponents(item); } - private void addComponents(final Item item) { - + /** + * This method allows to add components (items). + * + * @param item The {@link Item} to add. + */ + private void addComponents(final Item item) { add(new Label("refId", new PropertyModel(item, "refId"))); add(new Link("relate") { public void onClick() { - // TODO choose specific space for search + /* + * TODO choose specific space for search + */ ItemSearch itemSearch = new ItemSearch(getPrincipal()); itemSearch.setRelatingItemRefId(item.getRefId()); setResponsePage(new ItemSearchFormPage(itemSearch)); } - }.setVisible(!hideLinks)); + }.setVisible(!hideLinks)); - if(item.getRelatedItems() != null) { - add(new ListView("relatedItems", new ArrayList(item.getRelatedItems())) { + if (item.getRelatedItems() != null) { + add(new ListView("relatedItems", new ArrayList(item.getRelatedItems())) { + /* (non-Javadoc) + * @see org.apache.wicket.markup.html.list.ListView#populateItem(org.apache.wicket.markup.html.list.ListItem) + */ protected void populateItem(ListItem listItem) { final ItemItem itemItem = (ItemItem) listItem.getModelObject(); String message = null; - if(itemItem.getType() == DUPLICATE_OF) { + + if (itemItem.getType() == DUPLICATE_OF) { message = localize("item_view.duplicateOf"); } else if (itemItem.getType() == DEPENDS_ON) { message = localize("item_view.dependsOn"); - } else if (itemItem.getType() == RELATED){ - message = localize("item_view.relatedTo"); + } else if (itemItem.getType() == RELATED) { + message = localize("item_view.relatedTo"); } + final String refId = itemItem.getRelatedItem().getRefId(); - if(hideLinks) { + if (hideLinks) { message = message + " " + refId; } + listItem.add(new Label("message", message)); Link link = new Link("link") { public void onClick() { setResponsePage(ItemViewPage.class, new PageParameters("0=" + refId)); } }; + link.add(new Label("refId", refId)); link.setVisible(!hideLinks); listItem.add(link); @@ -104,31 +133,41 @@ add(new WebMarkupContainer("relatedItems").setVisible(false)); } - if(item.getRelatingItems() != null) { - add(new ListView("relatingItems", new ArrayList(item.getRelatingItems())) { + if (item.getRelatingItems() != null) { + add(new ListView("relatingItems", new ArrayList(item.getRelatingItems())) { + /* (non-Javadoc) + * @see org.apache.wicket.markup.html.list.ListView#populateItem(org.apache.wicket.markup.html.list.ListItem) + */ protected void populateItem(ListItem listItem) { final ItemItem itemItem = (ItemItem) listItem.getModelObject(); - // this looks very similar to related items block above - // but the display strings could be different and in future handling of the - // inverse of the bidirectional link could be different as well + + /* + * This looks very similar to related items block above + * but the display strings could be different and in + * future handling of the inverse of the bidirectional + * link could be different as well. + */ String message = null; - if(itemItem.getType() == DUPLICATE_OF) { + if (itemItem.getType() == DUPLICATE_OF) { message = localize("item_view.duplicateOfThis"); } else if (itemItem.getType() == DEPENDS_ON) { message = localize("item_view.dependsOnThis"); - } else if (itemItem.getType() == RELATED){ - message = localize("item_view.relatedToThis"); + } else if (itemItem.getType() == RELATED) { + message = localize("item_view.relatedToThis"); } + final String refId = itemItem.getItem().getRefId(); - if(hideLinks) { + if (hideLinks) { message = refId + " " + message; - } + } + listItem.add(new Label("message", message)); Link link = new Link("link") { public void onClick() { setResponsePage(ItemViewPage.class, new PageParameters("0=" + refId)); } }; + link.add(new Label("refId", refId)); link.setVisible(!hideLinks); listItem.add(link); @@ -136,7 +175,7 @@ public void onClick() { setResponsePage(new ItemRelateRemovePage(item.getId(), itemItem)); } - }.setVisible(!hideLinks)); + }.setVisible(!hideLinks)); } }); } else { @@ -147,58 +186,72 @@ add(new Label("loggedBy", new PropertyModel(item, "loggedBy.name"))); add(new Label("assignedTo", new PropertyModel(item, "assignedTo.name"))); add(new Label("summary", new PropertyModel(item, "summary"))); - add(new Label("detail", ItemUtils.fixWhiteSpace(item.getDetail())).setEscapeModelStrings(false)); + add(new Label("detail", ItemUtils.fixWhiteSpace(item.getDetail())).setEscapeModelStrings(false)); final SimpleAttributeModifier sam = new SimpleAttributeModifier("class", "alt"); final Map<Field.Name, Field> fields = item.getSpace().getMetadata().getFields(); add(new ListView("fields", item.getSpace().getMetadata().getFieldOrder()) { + /* (non-Javadoc) + * @see org.apache.wicket.markup.html.list.ListView#populateItem(org.apache.wicket.markup.html.list.ListItem) + */ protected void populateItem(ListItem listItem) { - if(listItem.getIndex() % 2 == 0) { + if (listItem.getIndex() % 2 == 0) { listItem.add(sam); } + Field.Name fieldName = (Field.Name) listItem.getModelObject(); Field field = fields.get(fieldName); listItem.add(new Label("label", field.getLabel())); listItem.add(new Label("value", item.getCustomValue(fieldName))); - } + } }); final List<Field> editable = item.getSpace().getMetadata().getEditableFields(); + add(new ListView("labels", editable) { + /* (non-Javadoc) + * @see org.apache.wicket.markup.html.list.ListView#populateItem(org.apache.wicket.markup.html.list.ListItem) + */ protected void populateItem(ListItem listItem) { Field field = (Field) listItem.getModelObject(); listItem.add(new Label("label", field.getLabel())); - } + } }); - + if (item.getHistory() != null) { List<History> history = new ArrayList(item.getHistory()); add(new ListView("history", history) { + /* (non-Javadoc) + * @see org.apache.wicket.markup.html.list.ListView#populateItem(org.apache.wicket.markup.html.list.ListItem) + */ protected void populateItem(ListItem listItem) { - if(listItem.getIndex() % 2 != 0) { + if (listItem.getIndex() % 2 != 0) { listItem.add(sam); - } + } + final History h = (History) listItem.getModelObject(); listItem.add(new Label("loggedBy", new PropertyModel(h, "loggedBy.name"))); listItem.add(new Label("status", new PropertyModel(h, "statusValue"))); listItem.add(new Label("assignedTo", new PropertyModel(h, "assignedTo.name"))); - WebMarkupContainer comment = new WebMarkupContainer("comment"); + WebMarkupContainer comment = new WebMarkupContainer("comment"); comment.add(new AttachmentLinkPanel("attachment", h.getAttachment())); comment.add(new Label("comment", ItemUtils.fixWhiteSpace(h.getComment())).setEscapeModelStrings(false)); listItem.add(comment); listItem.add(new Label("timeStamp", DateUtils.formatTimeStamp(h.getTimeStamp()))); listItem.add(new ListView("fields", editable) { + /* (non-Javadoc) + * @see org.apache.wicket.markup.html.list.ListView#populateItem(org.apache.wicket.markup.html.list.ListItem) + */ protected void populateItem(ListItem listItem) { Field field = (Field) listItem.getModelObject(); listItem.add(new Label("field", h.getCustomValue(field.getName()))); - } + } }); - } - }); + } + }); } - } - -} + } // end method addComponents(Item) +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <udi...@us...> - 2022-01-12 17:01:08
|
Revision: 1426 http://sourceforge.net/p/j-trac/code/1426 Author: udittmer Date: 2022-01-12 17:01:00 +0000 (Wed, 12 Jan 2022) Log Message: ----------- apply markdown to item details on search results page Modified Paths: -------------- trunk/jtrac/src/main/java/info/jtrac/wicket/BasePanel.java trunk/jtrac/src/main/java/info/jtrac/wicket/ItemListPanel.java trunk/jtrac/src/main/java/info/jtrac/wicket/ItemViewPanel.java Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/BasePanel.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/BasePanel.java 2021-12-14 15:29:09 UTC (rev 1425) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/BasePanel.java 2022-01-12 17:01:00 UTC (rev 1426) @@ -64,5 +64,10 @@ StringResourceModel m = new StringResourceModel(key, null, null, params); m.setLocalizer(getLocalizer()); return m.getString(); - } + } + + protected boolean renderMarkdown() { + String markdown = JtracApplication.get().getJtrac().loadConfig("markdown.enabled"); + return markdown != null && markdown.equalsIgnoreCase("true"); + } } Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/ItemListPanel.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/ItemListPanel.java 2021-12-14 15:29:09 UTC (rev 1425) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/ItemListPanel.java 2022-01-12 17:01:00 UTC (rev 1426) @@ -268,6 +268,7 @@ protected void populateItem(ListItem listItem) { ColumnHeading ch = (ColumnHeading) listItem.getModelObject(); IModel value = null; + boolean dontEscape = false; if(ch.isField()) { value = new Model(item.getCustomValue(ch.getField().getName())); } else { @@ -310,6 +311,10 @@ listItem.add(detailFrag); return; } else { + if (renderMarkdown()) { + item.setDetail(ItemUtils.renderMarkdown(item.getDetail())); + dontEscape = true; + } value = new PropertyModel(item, "detail"); } break; @@ -349,6 +354,8 @@ } Label label = new Label("column", value); label.setRenderBodyOnly(true); + if (dontEscape) + label.setEscapeModelStrings(false); listItem.add(label); } }; Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/ItemViewPanel.java =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/ItemViewPanel.java 2021-12-14 15:29:09 UTC (rev 1425) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/ItemViewPanel.java 2022-01-12 17:01:00 UTC (rev 1426) @@ -73,11 +73,6 @@ addComponents(item); } - protected boolean renderMarkdown() { - String markdown = JtracApplication.get().getJtrac().loadConfig("markdown.enabled"); - return markdown != null && markdown.equalsIgnoreCase("true"); - } - /** * This method allows to add components (items). * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <udi...@us...> - 2022-07-06 11:23:54
|
Revision: 1453 http://sourceforge.net/p/j-trac/code/1453 Author: udittmer Date: 2022-07-06 11:23:52 +0000 (Wed, 06 Jul 2022) Log Message: ----------- enlarge text input fields Modified Paths: -------------- trunk/jtrac/src/main/java/info/jtrac/wicket/ItemFormPage.html trunk/jtrac/src/main/java/info/jtrac/wicket/ItemViewFormPanel.html Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/ItemFormPage.html =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/ItemFormPage.html 2022-07-06 10:24:17 UTC (rev 1452) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/ItemFormPage.html 2022-07-06 11:23:52 UTC (rev 1453) @@ -23,7 +23,7 @@ <font color="red">*</font> </td> <td> - <textarea wicket:id="detail" rows="10" style="width:51em"></textarea> + <textarea wicket:id="detail" rows="15" style="width: 60em"></textarea> </td> </tr> </table> @@ -48,7 +48,7 @@ <font color="red">*</font> </td> <td> - <textarea wicket:id="editReason" rows="5" cols="40"></textarea> + <textarea wicket:id="editReason" rows="4" cols="80"></textarea> </td> </tr> <tr> @@ -89,4 +89,4 @@ </form> </wicket:extend> </body> -</html> \ No newline at end of file +</html> Modified: trunk/jtrac/src/main/java/info/jtrac/wicket/ItemViewFormPanel.html =================================================================== --- trunk/jtrac/src/main/java/info/jtrac/wicket/ItemViewFormPanel.html 2022-07-06 10:24:17 UTC (rev 1452) +++ trunk/jtrac/src/main/java/info/jtrac/wicket/ItemViewFormPanel.html 2022-07-06 11:23:52 UTC (rev 1453) @@ -26,7 +26,7 @@ <wicket:message key="item_view_form.comment"/> <font color="red">*</font> </td> - <td><textarea wicket:id="comment" rows="8" cols="80"></textarea></td> + <td><textarea wicket:id="comment" rows="8" cols="100"></textarea></td> </tr> <tr> <td/> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |