<commit_before><!--  
/*

Copyright (c) 2012 <NAME>. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

    (1) Redistributions of source code must retain the above copyright
    notice, this list of conditions and the following disclaimer. 

    (2) Redistributions in binary form must reproduce the above copyright
    notice, this list of conditions and the following disclaimer in
    the documentation and/or other materials provided with the
    distribution.  
    
    (3)The name of the author may not be used to
    endorse or promote products derived from this software without
    specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
 
 */

/*
 * @author R.Sicart
 */
-->

<%@include file="/jsp/init.jsp" %>



<%
 locale = request.getLocale();
 String language = locale.getLanguage();
 String country = locale.getCountry();

 ResourceBundle res = ResourceBundle.getBundle("content.Language-ext", new Locale(language, country));
 
 //get user data
 long groupId = themeDisplay.getLayout().getGroupId();
 long userId = themeDisplay.getUserId();
 Worker myWorker = WorkerLocalServiceUtil.findByG_U_First(groupId, userId, null);
 
 //portlet permissions
 String namePortlet = portletDisplay.getId(); //default value
 String primKeyPortlet = "projectportlet"; //portlet name
 
 //portlet actions available (see resource-actions/default.xml)
 String permAddProject = "ADD_PROJECT";
 String permUpdateProject = "UPDATE_PROJECT";
 String permDeleteProject = "DELETE_PROJECT";
 
 //bean initialization
 Project ftrProject = ProjectLocalServiceUtil.createProject(0);
 
 //get search filters if necessary
 String ftrName = "";
 String ftrType = "";
 String ftrDescShort = "";
 String ftrStatus = "";
 Date ftrStartDate = null;
 Date ftrEndDate = null;
 Double ftrCostEstimatedEuros = 0.0;
 long ftrTimeEstimatedHours = 0;
 boolean ftrCanSetWorkerHours = false; String canSet = null;
 String ftrComments = "";
 
 Calendar startDate = CalendarFactoryUtil.getCalendar();
 startDate.set(2009, 0, 13); //the magic number
 Calendar endDate = CalendarFactoryUtil.getCalendar();
 
 
 Enumeration<String> sessionParams = request.getSession().getAttributeNames();
 while(sessionParams.hasMoreElements()){
	 String attributeName = (String) sessionParams.nextElement();
	 String decodedName = PortletSessionUtil.decodeAttributeName(attributeName);
	 if(decodedName.equals("ftrName") && PortletSessionUtil.decodeScope(attributeName)==PortletSession.PORTLET_SCOPE){
		 ftrName = (String)session.getAttribute(attributeName);
	 }
	 if(decodedName.equals("ftrType") && PortletSessionUtil.decodeScope(attributeName)==PortletSession.PORTLET_SCOPE){
		 ftrType = (String)session.getAttribute(attributeName);
	 }
	 if(decodedName.equals("ftrDescShort") && PortletSessionUtil.decodeScope(attributeName)==PortletSession.PORTLET_SCOPE){
		 ftrDescShort = (String)session.getAttribute(attributeName);
	 }
	 if(decodedName.equals("ftrStatus") && PortletSessionUtil.decodeScope(attributeName)==PortletSession.PORTLET_SCOPE){
		 ftrStatus = (String)session.getAttribute(attributeName);
	 }
	 if(decodedName.equals("ftrStartDate") && PortletSessionUtil.decodeScope(attributeName)==PortletSession.PORTLET_SCOPE){
		 ftrStartDate = (Date)session.getAttribute(attributeName);
	 }
	 if(decodedName.equals("ftrEndDate") && PortletSessionUtil.decodeScope(attributeName)==PortletSession.PORTLET_SCOPE){
		 ftrEndDate = (Date)session.getAttribute(attributeName);
	 }
	 if(decodedName.equals("ftrCostEstimatedEuros") && PortletSessionUtil.decodeScope(attributeName)==PortletSession.PORTLET_SCOPE){
		 String cost = (String)session.getAttribute(attributeName);
		 if(cost != null && !cost.isEmpty() ){
		 	ftrCostEstimatedEuros = Double.valueOf( cost );
		 } else{
			ftrCostEstimatedEuros = 0.0;  
		 }
	 }
	 if(decodedName.equals("ftrTimeEstimatedHours") && PortletSessionUtil.decodeScope(attributeName)==PortletSession.PORTLET_SCOPE){
		 ftrTimeEstimatedHours = Long.valueOf( (String) session.getAttribute(attributeName) );
	 }
	 if(decodedName.equals("ftrCanSetWorkerHours") && PortletSessionUtil.decodeScope(attributeName)==PortletSession.PORTLET_SCOPE){
		 canSet = (String) session.getAttribute(attributeName);
		 ftrCanSetWorkerHours = Boolean.valueOf( (String) session.getAttribute(attributeName) );
	 }
	 if(decodedName.equals("ftrComments") && PortletSessionUtil.decodeScope(attributeName)==PortletSession.PORTLET_SCOPE){
		 ftrComments = (String)session.getAttribute(attributeName);
	 }
 }
 
 System.out.println("view.jsp Filtros recv ** ftrName:"+ftrName+"- ftrType:"+ftrType
		 +"- ftrDescShort:"+ftrDescShort+"- ftrStatus:"+ftrStatus+"- ftrCostEstimatedEuros:"+ftrCostEstimatedEuros
		 +"- ftrTimeEstimatedHours:"+ftrTimeEstimatedHours+"- ftrCanSetWorkerHours:"+ftrCanSetWorkerHours
		 +"- ftrComments:"+ftrComments);
 
 String error2 = "";
 try{
	 
	 //show filters to search projects
	 if(request.isUserInRole("administrator")){

	 %>
	<portlet:actionURL var="filterURL" name="getProjectsByFilters">
	   <portlet:param name="mvcPath" value="/jsp/view.jsp" />
	</portlet:actionURL>
	
	
			
	<aui:layout>
	
		<aui:form name="frm_list_projects" action="<%= filterURL %>" method="post">
	
		<aui:input type="hidden" name="redirectURL" value="<%= renderResponse.createRenderURL().toString() %>"/>
		
		<aui:column columnWidth="20" first="true">
		
		<aui:fieldset>
		
			<aui:input label='<%= res.getString("formlabel.name") %>' id="ftrname" name="ftrname" type="text" value="<%= ftrName %>">
				<!-- Only allow alphabetical characters -->
	     		<aui:validator name="alpha" />
			</aui:input>
	
			<aui:input label='<%= res.getString("formlabel.projectdescshort") %>' id="ftrdescshort" name="ftrdescshort" type="text" value="<%= ftrDescShort %>" >
				<aui:validator name="custom" errorMessage="error-character-not-valid">
				    function(val, fieldNode, ruleValue) { var patt=/[a-zA-Z0-9 ,'-]{0,100}/g; return (patt.test(val) ) }
				</aui:validator>
			</aui:input>
			
			<aui:input label='<%= res.getString("formlabel.projectcostestimated") %>' id="ftrcostestimatedeuros" name="ftrcostestimatedeuros" type="text" value="<%= ftrCostEstimatedEuros %>" >
	     		<aui:validator name="number" />
			</aui:input>
		    
		</aui:fieldset>
		
		</aui:column>
		
		<aui:column columnWidth="20">
		
		<aui:fieldset>
			
			<aui:select label='<%= res.getString("formlabel.projecttype") %>' id="ftrtype" name="ftrtype">
				<aui:option value="">
					<liferay-ui:message key="please-choose" />
				</aui:option>
				<aui:option value="project" selected='<%= ( ftrType != null && ftrType.equals("project") ? true : false ) %>'>
					<liferay-ui:message key="form-option-type-project" />
				</aui:option><commit_msg>Form validators updated.<commit_after><!--  
/*

Copyright (c) 2012 <NAME>. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

    (1) Redistributions of source code must retain the above copyright
    notice, this list of conditions and the following disclaimer. 

    (2) Redistributions in binary form must reproduce the above copyright
    notice, this list of conditions and the following disclaimer in
    the documentation and/or other materials provided with the
    distribution.  
    
    (3)The name of the author may not be used to
    endorse or promote products derived from this software without
    specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
 
 */

/*
 * @author R.Sicart
 */
-->

<%@include file="/jsp/init.jsp" %>



<%
 locale = request.getLocale();
 String language = locale.getLanguage();
 String country = locale.getCountry();

 ResourceBundle res = ResourceBundle.getBundle("content.Language-ext", new Locale(language, country));
 
 //get user data
 long groupId = themeDisplay.getLayout().getGroupId();
 long userId = themeDisplay.getUserId();
 Worker myWorker = WorkerLocalServiceUtil.findByG_U_First(groupId, userId, null);
 
 //portlet permissions
 String namePortlet = portletDisplay.getId(); //default value
 String primKeyPortlet = "projectportlet"; //portlet name
 
 //portlet actions available (see resource-actions/default.xml)
 String permAddProject = "ADD_PROJECT";
 String permUpdateProject = "UPDATE_PROJECT";
 String permDeleteProject = "DELETE_PROJECT";
 
 //bean initialization
 Project ftrProject = ProjectLocalServiceUtil.createProject(0);
 
 //get search filters if necessary
 String ftrName = "";
 String ftrType = "";
 String ftrDescShort = "";
 String ftrStatus = "";
 Date ftrStartDate = null;
 Date ftrEndDate = null;
 Double ftrCostEstimatedEuros = 0.0;
 long ftrTimeEstimatedHours = 0;
 boolean ftrCanSetWorkerHours = false; String canSet = null;
 String ftrComments = "";
 
 Calendar startDate = CalendarFactoryUtil.getCalendar();
 startDate.set(2009, 0, 13); //the magic number
 Calendar endDate = CalendarFactoryUtil.getCalendar();
 
 
 Enumeration<String> sessionParams = request.getSession().getAttributeNames();
 while(sessionParams.hasMoreElements()){
	 String attributeName = (String) sessionParams.nextElement();
	 String decodedName = PortletSessionUtil.decodeAttributeName(attributeName);
	 if(decodedName.equals("ftrName") && PortletSessionUtil.decodeScope(attributeName)==PortletSession.PORTLET_SCOPE){
		 ftrName = (String)session.getAttribute(attributeName);
	 }
	 if(decodedName.equals("ftrType") && PortletSessionUtil.decodeScope(attributeName)==PortletSession.PORTLET_SCOPE){
		 ftrType = (String)session.getAttribute(attributeName);
	 }
	 if(decodedName.equals("ftrDescShort") && PortletSessionUtil.decodeScope(attributeName)==PortletSession.PORTLET_SCOPE){
		 ftrDescShort = (String)session.getAttribute(attributeName);
	 }
	 if(decodedName.equals("ftrStatus") && PortletSessionUtil.decodeScope(attributeName)==PortletSession.PORTLET_SCOPE){
		 ftrStatus = (String)session.getAttribute(attributeName);
	 }
	 if(decodedName.equals("ftrStartDate") && PortletSessionUtil.decodeScope(attributeName)==PortletSession.PORTLET_SCOPE){
		 ftrStartDate = (Date)session.getAttribute(attributeName);
	 }
	 if(decodedName.equals("ftrEndDate") && PortletSessionUtil.decodeScope(attributeName)==PortletSession.PORTLET_SCOPE){
		 ftrEndDate = (Date)session.getAttribute(attributeName);
	 }
	 if(decodedName.equals("ftrCostEstimatedEuros") && PortletSessionUtil.decodeScope(attributeName)==PortletSession.PORTLET_SCOPE){
		 String cost = (String)session.getAttribute(attributeName);
		 if(cost != null && !cost.isEmpty() ){
		 	ftrCostEstimatedEuros = Double.valueOf( cost );
		 } else{
			ftrCostEstimatedEuros = 0.0;  
		 }
	 }
	 if(decodedName.equals("ftrTimeEstimatedHours") && PortletSessionUtil.decodeScope(attributeName)==PortletSession.PORTLET_SCOPE){
		 ftrTimeEstimatedHours = Long.valueOf( (String) session.getAttribute(attributeName) );
	 }
	 if(decodedName.equals("ftrCanSetWorkerHours") && PortletSessionUtil.decodeScope(attributeName)==PortletSession.PORTLET_SCOPE){
		 canSet = (String) session.getAttribute(attributeName);
		 ftrCanSetWorkerHours = Boolean.valueOf( (String) session.getAttribute(attributeName) );
	 }
	 if(decodedName.equals("ftrComments") && PortletSessionUtil.decodeScope(attributeName)==PortletSession.PORTLET_SCOPE){
		 ftrComments = (String)session.getAttribute(attributeName);
	 }
 }
 
 System.out.println("view.jsp Filtros recv ** ftrName:"+ftrName+"- ftrType:"+ftrType
		 +"- ftrDescShort:"+ftrDescShort+"- ftrStatus:"+ftrStatus+"- ftrCostEstimatedEuros:"+ftrCostEstimatedEuros
		 +"- ftrTimeEstimatedHours:"+ftrTimeEstimatedHours+"- ftrCanSetWorkerHours:"+ftrCanSetWorkerHours
		 +"- ftrComments:"+ftrComments);
 
 String error2 = "";
 try{
	 
	 //show filters to search projects
	 if(request.isUserInRole("administrator")){

	 %>
	<portlet:actionURL var="filterURL" name="getProjectsByFilters">
	   <portlet:param name="mvcPath" value="/jsp/view.jsp" />
	</portlet:actionURL>
	
	
			
	<aui:layout>
	
		<aui:form name="frm_list_projects" action="<%= filterURL %>" method="post">
	
		<aui:input type="hidden" name="redirectURL" value="<%= renderResponse.createRenderURL().toString() %>"/>
		
		<aui:column columnWidth="20" first="true">
		
		<aui:fieldset>
		
			<aui:input label='<%= res.getString("formlabel.name") %>' id="ftrname" name="ftrname" type="text" value="<%= ftrName %>">
				<!-- Only allow alphabetical characters -->
	     		<aui:validator name="custom" errorMessage="error-character-not-valid">
				    function(val, fieldNode, ruleValue) { var patt=/[a-zA-Z0-9 ,'-]{0,100}/g; return (patt.test(val) ) }
				</aui:validator>
			</aui:input>
	
			<aui:input label='<%= res.getString("formlabel.projectdescshort") %>' id="ftrdescshort" name="ftrdescshort" type="text" value="<%= ftrDescShort %>" >
				<aui:validator name="custom" errorMessage="error-character-not-valid">
				    function(val, fieldNode, ruleValue) { var patt=/[a-zA-Z0-9 ,'-]{0,100}/g; return (patt.test(val) ) }
				</aui:validator>
			</aui:input>
			
			<aui:input label='<%= res.getString("formlabel.projectcostestimated") %>' id="ftrcostestimatedeuros" name="ftrcostestimatedeuros" type="text" value="<%= ftrCostEstimatedEuros %>" >
	     		<aui:validator name="number" />
			</aui:input>
		    
		</aui:fieldset>
		
		</aui:column>
		
		<aui:column columnWidth="20">
		
		<aui:fieldset>
			
			<aui:select label='<%= res.getString("formlabel.projecttype") %>' id="ftrtype" name="ftrtype">
				<aui:option value="">
					<liferay-ui:message key="please-choose" />
				</aui:option>
				<aui:option value="project" selected='<%= ( ftrType != null && ftrType.equals("project") ? true : false ) %>'>
					<liferay-ui:message key="form-option-type-project" />
				</aui:option>
{'fraction_non_alphanumeric': 0.12929612771290983, 'fraction_numerical': 0.00448578402269279, 'mean_word_length': 5.359060402684563, 'pattern_counts': {'":': 0, '<': 94, '<?xml version=': 0, '>': 94, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '193284', 'n_tokens_mistral': 5055, 'n_tokens_neox': 4523, 'n_words': 1013}