diff --git a/application/libraries/SignatureLib.php b/application/libraries/SignatureLib.php
index b8c4374a3..132545219 100644
--- a/application/libraries/SignatureLib.php
+++ b/application/libraries/SignatureLib.php
@@ -33,16 +33,13 @@ class SignatureLib
*/
public static function list($inputFileName)
{
- // Generic error occurred
- $resultList = 'Generic error occurred';
-
try
{
// Get the content of the given file
$inputFileContent = file_get_contents($inputFileName);
if ($inputFileContent === false) // if failed
{
- $resultList = 'An error occurred while getting the content from: '.$inputFileName;
+ error_log('An error occurred while getting the content from: '.$inputFileName);
}
else
{
@@ -57,20 +54,22 @@ class SignatureLib
}
catch(\Httpful\Exception\ConnectionErrorException $cee) // Httpful exception
{
- $resultList = $cee->getMessage();
+ error_log($cee->getMessage());
}
catch (Exception $e) // any other exception
{
- $resultList = $e->getMessage();
+ error_log($e->getMessage());
}
// If the response is fine
- if (isset($resultPost->body) && is_object($resultPost->body) && isset($resultPost->body->retval))
+ if (isset($resultPost->body) && is_object($resultPost->body)
+ && isset($resultPost->body->retval) && is_array($resultPost->body->retval))
{
return $resultPost->body->retval;
}
- return $resultList;
+ // Otherwise return a null as error
+ return null;
}
}
diff --git a/cis/private/lehre/abgabe_lektor_details.php b/cis/private/lehre/abgabe_lektor_details.php
index a508de098..e1b47369d 100644
--- a/cis/private/lehre/abgabe_lektor_details.php
+++ b/cis/private/lehre/abgabe_lektor_details.php
@@ -37,6 +37,7 @@ require_once('../../../include/phrasen.class.php');
require_once('../../../include/projektarbeit.class.php');
require_once('../../../include/projektbetreuer.class.php');
require_once('../../../include/sancho.inc.php');
+require_once('../../../application/libraries/SignatureLib.php');
if (!$db = new basis_db())
$db=false;
@@ -642,7 +643,29 @@ $result=@$db->db_query($qry);
}
if(file_exists(PAABGABE_PATH.$row->paabgabe_id.'_'.$uid.'.pdf'))
{
- $htmlstr .= "
paabgabe_id."&uid=$uid' target='_blank'> | ";
+ $uploadedDocumentSigned = null;
+
+ // Check if the document is signed
+ $signList = SignatureLib::list(PAABGABE_PATH.$row->paabgabe_id.'_'.$uid.'.pdf');
+ if (is_array($signList) && count($signList) > 0)
+ {
+ // The document is signed
+ }
+ elseif ($signList === null)
+ {
+ $uploadedDocumentSigned = 'WARNING: signature server error';
+ }
+ else
+ {
+ $uploadedDocumentSigned = $p->t('abgabetool/uploadedDocumentNotSigned');
+ }
+
+ $htmlstr .= "
+ paabgabe_id."&uid=$uid' target='_blank'>
+
+
+ ".$uploadedDocumentSigned."
+ | ";
}
else
{
diff --git a/cis/private/lehre/abgabe_student_details.php b/cis/private/lehre/abgabe_student_details.php
index 29d74ab66..b8a8f158e 100644
--- a/cis/private/lehre/abgabe_student_details.php
+++ b/cis/private/lehre/abgabe_student_details.php
@@ -36,6 +36,7 @@ require_once('../../../include/phrasen.class.php');
require_once('../../../include/projektarbeit.class.php');
require_once('../../../include/projektbetreuer.class.php');
require_once('../../../include/sancho.inc.php');
+require_once('../../../application/libraries/SignatureLib.php');
$anzeigesprache = getSprache();
$p = new phrasen($anzeigesprache);
@@ -111,6 +112,7 @@ $titel = $projektarbeit_obj->titel;
$person = new person();
$person->load($bid);
$betreuer = $person->titelpre.' '.$person->vorname.' '.$person->nachname.' '.$person->titelpost;
+$uploadedDocumentSigned = null;
if($uid!=$user)
{
@@ -286,15 +288,20 @@ if($command=="update" && $error!=true)
move_uploaded_file($_FILES['datei']['tmp_name'], PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf');
if(file_exists(PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf'))
{
- exec('chmod 640 "'.PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf'.'"');
-
- $qry="UPDATE campus.tbl_paabgabe SET
- abgabedatum = now(),
- updatevon = ".$db->db_add_param($user).",
- updateamum = now()
- WHERE paabgabe_id=".$db->db_add_param($paabgabe_id, FHC_INTEGER);
- $result=$db->db_query($qry);
- echo $p->t('global/dateiErfolgreichHochgeladen');
+ // Check if the document is signed
+ $signList = SignatureLib::list(PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf');
+ if (is_array($signList) && count($signList) > 0)
+ {
+ // The document is signed
+ }
+ elseif ($signList === null)
+ {
+ $uploadedDocumentSigned = 'WARNING: signature server error';
+ }
+ else
+ {
+ $uploadedDocumentSigned = $p->t('abgabetool/uploadedDocumentNotSigned');
+ }
}
else
{
@@ -311,6 +318,21 @@ if($command=="update" && $error!=true)
}
if(file_exists(PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf'))
{
+ // Check if the document is signed
+ $signList = SignatureLib::list(PAABGABE_PATH.$paabgabe_id.'_'.$uid.'.pdf');
+ if (is_array($signList) && count($signList) > 0)
+ {
+ // The document is signed
+ }
+ elseif ($signList === null)
+ {
+ $uploadedDocumentSigned = 'WARNING: signature server error';
+ }
+ else
+ {
+ $uploadedDocumentSigned = $p->t('abgabetool/uploadedDocumentNotSigned');
+ }
+
/*$qry="UPDATE campus.tbl_paabgabe SET
abgabedatum = now(),
updatevon = '".$user."',
@@ -339,6 +361,15 @@ if($command=="update" && $error!=true)
$htmlstr .= ''."\n";
$htmlstr .= ''."\n";
$htmlstr .= ''."\n";
+
+ // If there are info about the signed document
+ if ($uploadedDocumentSigned != null)
+ {
+ $htmlstr .= "\n";
+ $htmlstr .= "| ".$uploadedDocumentSigned." | ";
+ $htmlstr .= "
\n";
+ }
+
$htmlstr .= "\n";
$htmlstr .= "| ".$p->t('abgabetool/spracheDerArbeit').": | ";
$sprache = @$db->db_query("SELECT sprache FROM public.tbl_sprache");
diff --git a/locale/de-AT/abgabetool.php b/locale/de-AT/abgabetool.php
index c4b17318b..6d1eb923f 100644
--- a/locale/de-AT/abgabetool.php
+++ b/locale/de-AT/abgabetool.php
@@ -91,4 +91,5 @@ $this->phrasen['abgabetool/projektbeurteilungDownload']='Projektbeurteilung heru
$this->phrasen['abgabetool/projektbeurteilungErstDownload']='Erst-/Begutachter';
$this->phrasen['abgabetool/projektbeurteilungZweitDownload']='Zweitbegutachter';
$this->phrasen['abgabetool/fehlerErmittelnEndabgabeProjektarbeit']='Fehler beim Ermitteln des Enduplaods der Projektarbeit';
+$this->phrasen['abgabetool/uploadedDocumentNotSigned']='The uploaded document is not signed DE';
?>
diff --git a/locale/en-US/abgabetool.php b/locale/en-US/abgabetool.php
index b05456faa..c782dedcc 100644
--- a/locale/en-US/abgabetool.php
+++ b/locale/en-US/abgabetool.php
@@ -91,4 +91,5 @@ $this->phrasen['abgabetool/projektbeurteilungDownload']='Thesis-Assessment downl
$this->phrasen['abgabetool/projektbeurteilungErstDownload']='First-/Assessor';
$this->phrasen['abgabetool/projektbeurteilungZweitDownload']='Second Assessor';
$this->phrasen['abgabetool/fehlerErmittelnEndabgabeProjektarbeit']='Error when getting endupload of project work';
+$this->phrasen['abgabetool/uploadedDocumentNotSigned']='The uploaded document is not signed EN';
?>
|