Commit 5056d324 by Nilu

company logo and client logo. Add, remove, replace functionalities

parent 1b6efacd
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
<column name="object_last_updated_date" type="Date" nullable="false" length="22"/> <column name="object_last_updated_date" type="Date" nullable="false" length="22"/>
<column name="object_created_date" type="Date" nullable="false" length="22"/> <column name="object_created_date" type="Date" nullable="false" length="22"/>
<column name="company_name" type="String" nullable="false" length="100"/> <column name="company_name" type="String" nullable="false" length="100"/>
<column name="company_logo" type="BLOB" nullable="true"/>
<column name="hiring_team_type" type="String" nullable="true" length="200"/> <column name="hiring_team_type" type="String" nullable="true" length="200"/>
<column name="industry" type="String" nullable="true" length="200"/> <column name="industry" type="String" nullable="true" length="200"/>
<column name="time_zone" type="String" nullable="true" length="200"/> <column name="time_zone" type="String" nullable="true" length="200"/>
......
...@@ -9,6 +9,7 @@ CREATE TABLE tl_company ( ...@@ -9,6 +9,7 @@ CREATE TABLE tl_company (
object_created_date datetime DEFAULT getdate() NOT NULL object_created_date datetime DEFAULT getdate() NOT NULL
, ,
company_name varchar(100) NOT NULL, company_name varchar(100) NOT NULL,
company_logo image NULL,
hiring_team_type varchar(200) NULL, hiring_team_type varchar(200) NULL,
industry varchar(200) NULL, industry varchar(200) NULL,
time_zone varchar(200) NULL, time_zone varchar(200) NULL,
......
...@@ -10,6 +10,7 @@ CREATE TABLE tl_company ( ...@@ -10,6 +10,7 @@ CREATE TABLE tl_company (
object_created_date date DEFAULT SYSDATE NOT NULL object_created_date date DEFAULT SYSDATE NOT NULL
, ,
company_name varchar2(100) NOT NULL, company_name varchar2(100) NOT NULL,
company_logo blob NULL,
hiring_team_type varchar2(200) NULL, hiring_team_type varchar2(200) NULL,
industry varchar2(200) NULL, industry varchar2(200) NULL,
time_zone varchar2(200) NULL, time_zone varchar2(200) NULL,
......
...@@ -10,6 +10,7 @@ CREATE TABLE tl_company ( ...@@ -10,6 +10,7 @@ CREATE TABLE tl_company (
object_created_date timestamp DEFAULT NOW() NOT NULL object_created_date timestamp DEFAULT NOW() NOT NULL
, ,
company_name varchar(100) NOT NULL, company_name varchar(100) NOT NULL,
company_logo bytea NULL,
hiring_team_type varchar(200) NULL, hiring_team_type varchar(200) NULL,
industry varchar(200) NULL, industry varchar(200) NULL,
time_zone varchar(200) NULL, time_zone varchar(200) NULL,
......
package performa.form;
import java.util.Map;
import oneit.logging.LogLevel;
import oneit.logging.LogMgr;
import oneit.objstore.StorageException;
import oneit.servlets.forms.SubmissionDetails;
import oneit.servlets.forms.SuccessfulResult;
import oneit.servlets.process.ORMProcessState;
import oneit.servlets.process.SaveFP;
import oneit.utils.BusinessException;
import oneit.utils.CollectionUtils;
import performa.orm.Client;
public class SaveClientFP extends SaveFP
{
@Override
public SuccessfulResult processForm(ORMProcessState process, SubmissionDetails submission, Map params) throws BusinessException, StorageException
{
Client client = (Client) process.getAttribute("Client");
LogMgr.log(Client.LOG, LogLevel.PROCESSING1,"In SaveClientFP saving client : ", client );
if(CollectionUtils.equals(client.getIsLogoDeleted(), Boolean.TRUE))
{
client.setClientLogo(null);
LogMgr.log(Client.LOG, LogLevel.PROCESSING1,"In SaveClientFP setting client logo to null of client : ", client );
}
return super.processForm(process, submission, params);
}
}
\ No newline at end of file
package performa.form;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import oneit.logging.LogLevel;
import oneit.logging.LogMgr;
import oneit.objstore.StorageException;
import oneit.servlets.forms.SubmissionDetails;
import oneit.servlets.forms.SuccessfulResult;
import oneit.servlets.process.ORMProcessState;
import oneit.servlets.process.SaveFP;
import oneit.utils.BusinessException;
import oneit.utils.CollectionUtils;
import performa.orm.Company;
public class SaveCompanyFP extends SaveFP
{
@Override
public SuccessfulResult processForm(ORMProcessState process, SubmissionDetails submission, Map params) throws BusinessException, StorageException
{
HttpServletRequest request = submission.getRequest();
Company company = process.getAttribute("Company") != null ? (Company) process.getAttribute("Company") : (Company) request.getAttribute("Company");
LogMgr.log(Company.LOG, LogLevel.PROCESSING1,"In SaveCompanyFP saving company : ", company );
if(CollectionUtils.equals(company.getIsLogoDeleted(), Boolean.TRUE))
{
company.setCompanyLogo(null);
LogMgr.log(Company.LOG, LogLevel.PROCESSING1,"In SaveCompanyFP setting comany logo to null of company : ", company );
}
return super.processForm(process, submission, params);
}
}
\ No newline at end of file
package performa.orm; package performa.orm;
import oneit.logging.LoggingArea;
import oneit.objstore.rdbms.filters.EqualsFilter; import oneit.objstore.rdbms.filters.EqualsFilter;
import oneit.utils.filter.Filter; import oneit.utils.filter.Filter;
import performa.orm.types.JobStatus; import performa.orm.types.JobStatus;
...@@ -9,6 +10,8 @@ public class Client extends BaseClient ...@@ -9,6 +10,8 @@ public class Client extends BaseClient
{ {
private static final long serialVersionUID = 0L; private static final long serialVersionUID = 0L;
public static LoggingArea LOG = LoggingArea.createLoggingArea("Client");
// This constructor should not be called // This constructor should not be called
public Client () public Client ()
{ {
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
<MULTIPLEREFERENCE name="Jobs" type="Job" backreferenceName="Client" /> <MULTIPLEREFERENCE name="Jobs" type="Job" backreferenceName="Client" />
<TRANSIENT name="IsLogoDeleted" type="Boolean" defaultValue="Boolean.FALSE"/>
<TABLE name="tl_client" tablePrefix="object"> <TABLE name="tl_client" tablePrefix="object">
<ATTRIB name="ClientName" type="String" dbcol="client_name" mandatory="true" length="100"/> <ATTRIB name="ClientName" type="String" dbcol="client_name" mandatory="true" length="100"/>
......
package performa.orm; package performa.orm;
import oneit.logging.LoggingArea;
public class Company extends BaseCompany public class Company extends BaseCompany
{ {
private static final long serialVersionUID = 0L; private static final long serialVersionUID = 0L;
public static LoggingArea LOG = LoggingArea.createLoggingArea("Company");
// This constructor should not be called // This constructor should not be called
public Company () public Company ()
{ {
......
...@@ -15,10 +15,12 @@ ...@@ -15,10 +15,12 @@
<TRANSIENT name="FirstName" type="String"/> <TRANSIENT name="FirstName" type="String"/>
<TRANSIENT name="LastName" type="String"/> <TRANSIENT name="LastName" type="String"/>
<TRANSIENT name="RoleType" type="RoleType" defaultValue="RoleType.STANDARD" attribHelper="EnumeratedAttributeHelper"/> <TRANSIENT name="RoleType" type="RoleType" defaultValue="RoleType.STANDARD" attribHelper="EnumeratedAttributeHelper"/>
<TRANSIENT name="IsLogoDeleted" type="Boolean" defaultValue="Boolean.FALSE"/>
<TABLE name="tl_company" tablePrefix="object"> <TABLE name="tl_company" tablePrefix="object">
<ATTRIB name="CompanyName" type="String" dbcol="company_name" mandatory="true" length="100" /> <ATTRIB name="CompanyName" type="String" dbcol="company_name" mandatory="true" length="100" />
<ATTRIB name="CompanyLogo" type="BinaryContent" dbcol="company_logo" mandatory="false" binaryHandler="loggedin" attribHelper="BLOBAttributeHelper" attribHelperInstance="BLOBAttributeHelper.INSTANCE" />
<ATTRIB name="HiringTeamType" type="HiringTeamType" dbcol="hiring_team_type" mandatory="false" attribHelper="EnumeratedAttributeHelper"/> <ATTRIB name="HiringTeamType" type="HiringTeamType" dbcol="hiring_team_type" mandatory="false" attribHelper="EnumeratedAttributeHelper"/>
<ATTRIB name="Industry" type="Industry" dbcol="industry" mandatory="false" attribHelper="EnumeratedAttributeHelper"/> <ATTRIB name="Industry" type="Industry" dbcol="industry" mandatory="false" attribHelper="EnumeratedAttributeHelper"/>
<ATTRIB name="TimeZone" type="TimeZone" dbcol="time_zone" mandatory="false" attribHelper="EnumeratedAttributeHelper"/> <ATTRIB name="TimeZone" type="TimeZone" dbcol="time_zone" mandatory="false" attribHelper="EnumeratedAttributeHelper"/>
......
...@@ -44,6 +44,8 @@ ...@@ -44,6 +44,8 @@
<InvitationEmailer factory="Participant" class="oneit.email.ConfigurableArticleTemplateEmailer" templateShortcut="InvitationMail"/> <InvitationEmailer factory="Participant" class="oneit.email.ConfigurableArticleTemplateEmailer" templateShortcut="InvitationMail"/>
</FORM> </FORM>
<FORM name="*.saveUserDetails" factory="Participant" class="performa.form.SaveUserDetailsFP"/> <FORM name="*.saveUserDetails" factory="Participant" class="performa.form.SaveUserDetailsFP"/>
<FORM name="*.saveClient" factory="Participant" class="performa.form.SaveClientFP"/>
<FORM name="*.saveCompany" factory="Participant" class="performa.form.SaveCompanyFP"/>
</NODE> </NODE>
<NODE name="job_assessment_criteria_add_jsp" factory="Participant"> <NODE name="job_assessment_criteria_add_jsp" factory="Participant">
......
...@@ -24,36 +24,20 @@ ...@@ -24,36 +24,20 @@
String nextPage = WebUtils.getSamePageInRenderMode(request, "Page"); String nextPage = WebUtils.getSamePageInRenderMode(request, "Page");
%> %>
<script> <script>
$(document).ready(function() $(document).ready(function()
{
recalcFunction = setupRecalc ($("form"), {'recalcOnError':true});
$("#upload").change(function(){
readURL(this);
});
$("#remove-logo").click(function(){
$('#client-logo').attr('src', '');
var input = $("#upload");
input.replaceWith(input.val('').clone(true));
});
});
function readURL(input) {
if (input.files && input.files[0])
{ {
var reader = new FileReader(); recalcFunction = setupRecalc ($("form"), {'recalcOnError':true});
reader.onload = function (e) { $("#upload").change(function(){
$('#client-logo').attr('src', e.target.result); readURL(this);
} });
reader.readAsDataURL(input.files[0]); $("#remove-logo").click(function(){
} removeLogo();
} });
</script> });
</script>
<div class="container-fluid"> <div class="container-fluid">
<div class="row content"> <div class="row content">
<div class="main-content-area"> <div class="main-content-area">
...@@ -70,23 +54,23 @@ ...@@ -70,23 +54,23 @@
<div class="form-group"> <div class="form-group">
<label><oneit:ormlabel obj="<%= client %>" field="ClientLogo" /></label> <label><oneit:ormlabel obj="<%= client %>" field="ClientLogo" /></label>
<div class="main-upload-logo"> <div class="main-upload-logo">
<span class="u-img-tag"> <span class="u-img-tag" style="<%= client.getClientLogo() != null ? "" : "display: none" %>">
<tagfile:img src="<%= ThumbnailUtils.filterImage(DiskFileBinaryContent.getRelativeURL(client.getClientLogo()), "KEEP", new ScaleWithin (0,0)) %>" <tagfile:img src="<%= ThumbnailUtils.filterImage(DiskFileBinaryContent.getRelativeURL(client.getClientLogo()), "KEEP", new ScaleWithin (0,90)) %>"
class="upload-img-w-h" id="client-logo"/> class="upload-img-w-h" id="client-logo"/>
<span class="remove-logo-btn"> <span class="remove-logo-btn">
<img src="images/logo-remove-btn.png" id="remove-logo"> <img src="images/logo-remove-btn.png" id="remove-logo">
<oneit:ormInput obj="<%= client %>" type="text" attributeName="IsLogoDeleted" style="display:none;" />
</span> </span>
</span> </span>
<span class="up-rep-btn"> <span class="up-rep-btn">
<oneit:ormInput obj="<%= client %>" type="file" attributeName="ClientLogo" accept="image/*" id="upload" <oneit:ormInput obj="<%= client %>" type="file" attributeName="ClientLogo" accept="image/*" id="upload"
style="visibility: hidden; width: 1px; height: 1px"/> style="visibility: hidden; width: 1px; height: 1px"/>
<a href="javascript:void(0)" onclick="document.getElementById('upload').click(); return false"> <a href="javascript:void(0)" onclick="document.getElementById('upload').click(); return false" id="replace-btn">
Replace <%= client.getClientLogo() != null ? "Replace" : "Upload" %>
</a> </a>
</span> </span>
</div> </div>
</div> </div>
<div class="form-brack-line-sub"></div> <div class="form-brack-line-sub"></div>
...@@ -137,7 +121,7 @@ ...@@ -137,7 +121,7 @@
</div> </div>
</div> </div>
<div class="text-center form-group"> <div class="text-center form-group">
<oneit:button value="Save Updates" name="save" cssClass="btn btn-primary largeBtn" <oneit:button value="Save Updates" name="saveClient" cssClass="btn btn-primary largeBtn"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", nextPage).toMap() %>" /> requestAttribs="<%= CollectionUtils.mapEntry("nextPage", nextPage).toMap() %>" />
</div> </div>
</oneit:form> </oneit:form>
......
...@@ -31,3 +31,4 @@ Company.UserEmail = Email Address ...@@ -31,3 +31,4 @@ Company.UserEmail = Email Address
Company.FirstName = First Name Company.FirstName = First Name
Company.LastName = Last Name Company.LastName = Last Name
Company.RoleType = Role Company.RoleType = Role
Company.CompanyLogo = Company Logo
...@@ -15,11 +15,20 @@ ...@@ -15,11 +15,20 @@
String nextPage = WebUtils.getSamePageInRenderMode(request, "Page"); String nextPage = WebUtils.getSamePageInRenderMode(request, "Page");
%> %>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function(){ $(document).ready(function()
{
recalcFunction = setupRecalc ($("form"), {'recalcOnError':true}); recalcFunction = setupRecalc ($("form"), {'recalcOnError':true});
$("#upload").change(function(){
readURL(this);
});
$("#remove-logo").click(function(){
removeLogo();
});
}); });
</script> </script>
<div class="container-fluid"> <div class="container-fluid">
<div class="row content"> <div class="row content">
<div class="main-content-area"> <div class="main-content-area">
...@@ -38,6 +47,27 @@ ...@@ -38,6 +47,27 @@
<label><oneit:label GUIName="Company Name" /></label> <label><oneit:label GUIName="Company Name" /></label>
<oneit:ormInput obj="<%= company %>" type="text" attributeName="CompanyName" cssClass="form-control" /> <oneit:ormInput obj="<%= company %>" type="text" attributeName="CompanyName" cssClass="form-control" />
</div> </div>
<div class="form-group">
<label><oneit:ormlabel obj="<%= company %>" field="CompanyLogo" /></label>
<div class="main-upload-logo">
<span class="u-img-tag" style="<%= company.getCompanyLogo() != null ? "" : "display: none" %>">
<tagfile:img src="<%= ThumbnailUtils.filterImage(DiskFileBinaryContent.getRelativeURL(company.getCompanyLogo()), "KEEP", new ScaleWithin (0,90)) %>"
class="upload-img-w-h" id="client-logo"/>
<span class="remove-logo-btn">
<img src="images/logo-remove-btn.png" id="remove-logo">
<oneit:ormInput obj="<%= company %>" type="text" attributeName="IsLogoDeleted" style="display:none;" />
</span>
</span>
<span class="up-rep-btn">
<oneit:ormInput obj="<%= company %>" type="file" attributeName="CompanyLogo" accept="image/*" id="upload"
style="visibility: hidden; width: 1px; height: 1px"/>
<a href="javascript:void(0)" onclick="document.getElementById('upload').click(); return false" id="replace-btn">
<%= company.getCompanyLogo() != null ? "Replace" : "Upload" %>
</a>
</span>
</div>
</div>
<div class="form-group row"> <div class="form-group row">
<div class="col-md-6"> <div class="col-md-6">
<label><oneit:label GUIName="Industry" /></label> <label><oneit:label GUIName="Industry" /></label>
...@@ -83,8 +113,10 @@ ...@@ -83,8 +113,10 @@
</div> </div>
</div> </div>
<div class="text-center form-group"> <div class="text-center form-group">
<oneit:button value="Save Updates" name="save" cssClass="btn btn-primary largeBtn" <oneit:button value="Save Updates" name="saveCompany" cssClass="btn btn-primary largeBtn"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", nextPage).toMap() %>" /> requestAttribs="<%= CollectionUtils.mapEntry("nextPage", nextPage)
.mapEntry("Company", company)
.toMap() %>" />
</div> </div>
</div> </div>
</div> </div>
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
<MAP code="Candidate" class="performa.orm.Candidate"/> <MAP code="Candidate" class="performa.orm.Candidate"/>
<MAP code="CompanyUser" class="performa.orm.CompanyUser"/> <MAP code="CompanyUser" class="performa.orm.CompanyUser"/>
<MAP code="Client" class="performa.orm.Client"/> <MAP code="Client" class="performa.orm.Client"/>
<MAP code="Company" class="performa.orm.Company"/>
</NODE> </NODE>
<NODE name="CONFIG.GLOBAL::Performa"> <NODE name="CONFIG.GLOBAL::Performa">
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- @AutoRun -->
<OBJECTS name="" xmlns:oneit="http://www.1iT.com.au">
<NODE name="Script" factory="Vector">
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.RedefineTableOperation">
<tableName factory="String">tl_company</tableName>
<column name="company_logo" type="BLOB" nullable="true"/>
</NODE>
</NODE>
</OBJECTS>
\ No newline at end of file
...@@ -83,3 +83,27 @@ $(window).resize(function () { ...@@ -83,3 +83,27 @@ $(window).resize(function () {
equalheight('.eq-height'); equalheight('.eq-height');
equalheight('.eq-second-height'); equalheight('.eq-second-height');
}); });
function readURL(input) {
if (input.files && input.files[0])
{
var reader = new FileReader();
reader.onload = function (e) {
$('#client-logo').attr('src', e.target.result);
$('#client-logo').removeAttr("width");
$('#client-logo').attr("height", "90");
$('input[name$=IsLogoDeleted]').val('false').change();
$('.u-img-tag').show();
$('#replace-btn').text('Replace');
}
reader.readAsDataURL(input.files[0]);
}
}
function removeLogo() {
$('#client-logo').removeAttr("src");
$('input[name$=IsLogoDeleted]').val('true').change();
$('.u-img-tag').hide();
$('#replace-btn').text('Upload');
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment