git-svn-id: https://svn.coded.pt/svn/SIPRP@2012 bb69d46d-e84e-40c8-a05a-06db0d633741

0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
Carlos Roque 11 years ago
parent 7ec64febd1
commit 3eeb734ac6

@ -144,5 +144,6 @@
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/> <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v7.0 - Java 7"/>
<classpathentry kind="output" path="build"/> <classpathentry kind="output" path="build"/>
</classpath> </classpath>

@ -2,38 +2,9 @@
{ {
$scope.globals = globals; $scope.globals = globals;
$scope.globals = globals;
$scope.showList = true; $scope.showList = true;
$scope.showEdit = false; $scope.showEdit = false;
var documentos = [
{
id: 1,
nome: 'documento 1'
},
{
id: 2,
nome: 'documento 2'
},
{
id: 3,
nome: 'documento 3'
},
{
id: 4,
nome: 'documento 4'
},
{
id: 5,
nome: 'documento 5'
},
{
id: 6,
nome: 'documento 6'
}
];
$scope.storeDocuments = new globals.dataService.store({ $scope.storeDocuments = new globals.dataService.store({
model: null, model: null,
serviceBase: window.evoapp.DOCPATH, serviceBase: window.evoapp.DOCPATH,
@ -92,9 +63,9 @@
if(isValid) if(isValid)
{ {
//TODO: store upsert
$scope.uploadDocument(); $scope.uploadDocument();
$scope.list(); $scope.list();
$rootScope.$emit('ondocumentsave');
} }
}; };
@ -130,7 +101,7 @@
}; };
$scope.download = function(item){ $scope.download = function(item){
window.location.assign( window.evoapp.DOCPATH + "documentos/getDocumento?documentoID=" + encodeURIComponent( item.id ) ); window.location.assign( window.evoapp.DOCPATH + "documento?documentoID=" + encodeURIComponent( item.id ) );
}; };
$scope.uploadDocument = function(){ $scope.uploadDocument = function(){

@ -15,7 +15,7 @@
</thead>--> </thead>-->
<tbody> <tbody>
<tr ng-repeat="item in storeDocuments.items"> <tr ng-repeat="item in storeDocuments.items">
<td style="width:80%;">{{item.nome}}</td> <td style="width:80%;" data-ng-bind="item.detalhe">N/A</td>
<td style="width:20%"> <td style="width:20%">
<button data-toggle="tooltip" data-placement="left" title="Download do Documento" ng-click="download(item)" class="btn btn-xs btn-default pull-right m-r-5"> <button data-toggle="tooltip" data-placement="left" title="Download do Documento" ng-click="download(item)" class="btn btn-xs btn-default pull-right m-r-5">
<i class="glyphicon glyphicon-download-alt"></i> <i class="glyphicon glyphicon-download-alt"></i>

@ -150,7 +150,6 @@
{ {
}); });
} }
}; };
@ -237,6 +236,20 @@
}); });
} }
}; };
var unbind = $rootScope.$on('ondocumentsave', function(event, args)
{
$scope.numDocumentos.extraParams = {
trabalhadorID: selectedRecord.id
};
$scope.numDocumentos.get( function(response)
{
});
});
$scope.$on('$destroy', unbind);
$scope.$on('afterrender', function(event, args){ $scope.$on('afterrender', function(event, args){

@ -53,7 +53,7 @@ public class DocumentosLogic
result.setSuccess(false); result.setSuccess(false);
EvoMessageBean msg = new EvoMessageBean(); EvoMessageBean msg = new EvoMessageBean();
msg.setType(EvoMessageTypeBean.SESSIONTIMEOUT); msg.setType(EvoMessageTypeBean.SESSIONTIMEOUT);
msg.setMessageData("Utilizador asssociado \u00e0 sess\u00e3o inv\u00e1lido/inexistente!"); msg.setMessageData("Utilizador asssociado a sess\u00e3o inv\u00e1lida/inexistente!");
result.addMessage(msg); result.addMessage(msg);
} }
return result; return result;
@ -103,7 +103,7 @@ public class DocumentosLogic
result.setSuccess(false); result.setSuccess(false);
EvoMessageBean msg = new EvoMessageBean(); EvoMessageBean msg = new EvoMessageBean();
msg.setType(EvoMessageTypeBean.SESSIONTIMEOUT); msg.setType(EvoMessageTypeBean.SESSIONTIMEOUT);
msg.setMessageData("Utilizador asssociado \u00e0 sess\u00e3o inv\u00e1lido/inexistente!"); msg.setMessageData("Utilizador asssociado a sess\u00e3o inv\u00e1lida/inexistente!");
result.addMessage(msg); result.addMessage(msg);
} }
return result; return result;
@ -120,7 +120,7 @@ public class DocumentosLogic
if(doc != null) if(doc != null)
{ {
response = Response.ok(doc.getFile_data(),doc.getMime_type()).header("Content-Disposition", "inline; filename=\""+doc.getName()+"\"").build(); response = Response.ok(doc.getFile_data(), doc.getMime_type()).header("Content-Disposition", "attachment; filename=\""+doc.getName()+"\"").build();
} }
else else
{ {
@ -148,6 +148,7 @@ public class DocumentosLogic
{ {
try try
{ {
System.out.println(documentoUploadBean.getTrabalhadorId());
if( documentosProvider.trabalhadorExists( documentoUploadBean.getTrabalhadorId() ) ) if( documentosProvider.trabalhadorExists( documentoUploadBean.getTrabalhadorId() ) )
{ {
documentosProvider.saveDocumento( documentoUploadBean ); documentosProvider.saveDocumento( documentoUploadBean );
@ -182,7 +183,7 @@ public class DocumentosLogic
result.setSuccess(false); result.setSuccess(false);
EvoMessageBean msg = new EvoMessageBean(); EvoMessageBean msg = new EvoMessageBean();
msg.setType(EvoMessageTypeBean.SESSIONTIMEOUT); msg.setType(EvoMessageTypeBean.SESSIONTIMEOUT);
msg.setMessageData("Utilizador asssociado \u00e0 sess\u00e3o inv\u00e1lido/inexistente!"); msg.setMessageData("Utilizador asssociado a sess\u00e3o inv\u00e1lida/inexistente!");
result.addMessage(msg); result.addMessage(msg);
} }
return result; return result;
@ -205,7 +206,7 @@ public class DocumentosLogic
responseBean.setSuccess(true); responseBean.setSuccess(true);
EvoMessageBean msg = new EvoMessageBean(); EvoMessageBean msg = new EvoMessageBean();
msg.setType( EvoMessageTypeBean.INFO ); msg.setType( EvoMessageTypeBean.INFO );
msg.setMessageData( "Remo\u00e7\u00e3o do documento bem sucedida" ); msg.setMessageData( "Remoção do documento bem sucedida" );
responseBean.addMessage( msg ); responseBean.addMessage( msg );
} }
@ -214,7 +215,7 @@ public class DocumentosLogic
responseBean.setSuccess(false); responseBean.setSuccess(false);
EvoMessageBean msg = new EvoMessageBean(); EvoMessageBean msg = new EvoMessageBean();
msg.setType(EvoMessageTypeBean.ERROR); msg.setType(EvoMessageTypeBean.ERROR);
msg.setMessageData("O documento dado n\u00e3o \u00e9 v\u00e0lido."); msg.setMessageData("O documento dado não é válido.");
responseBean.addMessage(msg); responseBean.addMessage(msg);
} }
} }
@ -233,7 +234,7 @@ public class DocumentosLogic
responseBean.setSuccess(false); responseBean.setSuccess(false);
EvoMessageBean msg = new EvoMessageBean(); EvoMessageBean msg = new EvoMessageBean();
msg.setType(EvoMessageTypeBean.SESSIONTIMEOUT); msg.setType(EvoMessageTypeBean.SESSIONTIMEOUT);
msg.setMessageData("Utilizador asssociado \u00e0 sess\u00e3o inv\u00e1lido/inexistente!"); msg.setMessageData("Utilizador asssociado a sess\u00e3o inv\u00e1lida/inexistente!");
responseBean.addMessage(msg); responseBean.addMessage(msg);
} }
return responseBean; return responseBean;

@ -76,7 +76,9 @@ public class DocumentosDataProvider
{ {
Select sel = new Select2( TrabalhadoresData.TABLENAME, new Field( TrabalhadoresData.ID_FULL ).isEqual( trabalhadorID ), "count(*)" ); Select sel = new Select2( TrabalhadoresData.TABLENAME, new Field( TrabalhadoresData.ID_FULL ).isEqual( trabalhadorID ), "count(*)" );
Virtual2DArray array = siprpProvidersBean.getDBMANAGER().getSharedExecuter( this ).executeQuery( sel ); Virtual2DArray array = siprpProvidersBean.getDBMANAGER().getSharedExecuter( this ).executeQuery( sel );
return array.rowCount() > 0 && array.get( 0, 0 ).equals( 1 ); System.out.println(array.rowCount());
System.out.println( array.rowCount() > 0 ? (Long) array.get(0, 0) : 0l);
return array.rowCount() > 0 && ( (Long) array.get( 0, 0 ) ).equals( 1l );
} }
public void saveDocumento( DocumentoUploadBean documentoUploadBean ) throws Exception public void saveDocumento( DocumentoUploadBean documentoUploadBean ) throws Exception
@ -106,6 +108,7 @@ public class DocumentosDataProvider
fileData.refresh(); fileData.refresh();
FilFileTrabalhadorData fileTrabalhadorData = new FilFileTrabalhadorData(); FilFileTrabalhadorData fileTrabalhadorData = new FilFileTrabalhadorData();
fileTrabalhadorData.setProvider( siprpProvidersBean.getENTITY_PROVIDER() );
fileTrabalhadorData.setFile_id( fileData.getId() ); fileTrabalhadorData.setFile_id( fileData.getId() );
fileTrabalhadorData.setOnline( true ); fileTrabalhadorData.setOnline( true );
fileTrabalhadorData.setTrabalhador_id( documentoUploadBean.getTrabalhadorId() ); fileTrabalhadorData.setTrabalhador_id( documentoUploadBean.getTrabalhadorId() );

@ -80,7 +80,7 @@ public class DocumentosImpl {
String desc = multiPart.getField( "nome" ).getValue(); String desc = multiPart.getField( "nome" ).getValue();
String nome = documento.getContentDisposition().getFileName(); String nome = documento.getContentDisposition().getFileName();
Long size = documento.getContentDisposition().getSize(); Long size = documento.getContentDisposition().getSize();
String mime = documento.getContentDisposition().getType(); String mime = documento.getMediaType().toString();
InputStream inputStream = documento.getValueAs( InputStream.class ); InputStream inputStream = documento.getValueAs( InputStream.class );
Integer trabalhadorID = Integer.parseInt( multiPart.getField( "trabalhador_id" ).getValue() ); Integer trabalhadorID = Integer.parseInt( multiPart.getField( "trabalhador_id" ).getValue() );

Loading…
Cancel
Save