diff --git a/src/php/AdminApps/Settings.php b/src/php/AdminApps/Settings.php index 087a417..3b3ab4a 100644 --- a/src/php/AdminApps/Settings.php +++ b/src/php/AdminApps/Settings.php @@ -90,10 +90,12 @@ public function run(array|bool $arr=TRUE):array{ private function settingsOverviewHtml():string { $template=array(); - $template['Logger']=array('selector'=>array('app'=>__CLASS__,'Source'=>'logger'),'description'=>'Here you find all the logs.'); + $template['Logger']=array('selector'=>array('app'=>__CLASS__,'Source'=>'logger'),'description'=>'Here you will find all the logs.'); $template['Logger errors']=array('selector'=>array('app'=>__CLASS__,'Source'=>'logger','Group'=>'error'),'description'=>'Error logs can be found here.'); $template['Job processing timimg']=array('selector'=>array('app'=>__CLASS__,'Source'=>'settings','Group'=>'Job processing','Folder'=>'All jobs','Name'=>'Timing'),'description'=>'Here you can access the timing of the job processing. Use "✎" (Edit) → Content to change the timing of a specific job'); $template['Entry presentation']=array('selector'=>array('app'=>__CLASS__,'Source'=>'settings','Group'=>'Presentation'),'description'=>'Here you can adjust the entry presentation which is based on the Class and Method used to present the entry. The method presemnting an entry is typically run() or for javascript calls presentEntry().'); + $template['Definitions']=array('selector'=>array('app'=>__CLASS__,'Source'=>'definitions','Group'=>'Templates'),'description'=>'Here you can adjust the entry definitions.'); + $template['Remote client definitions']=array('selector'=>array('app'=>__CLASS__,'Source'=>'remoteclient','EntryId'=>'%_definition'),'description'=>'Here you can delete the remote client definitions. It will be renewed when the client is connected'); // create html $matrix=array(); foreach($template as $key=>$def){ diff --git a/src/php/Foundation/DataExplorer.php b/src/php/Foundation/DataExplorer.php index 5572697..afd3c9c 100644 --- a/src/php/Foundation/DataExplorer.php +++ b/src/php/Foundation/DataExplorer.php @@ -41,50 +41,18 @@ class DataExplorer{ ), ); - private $tags=array('run'=>array('tag'=>'button','element-content'=>'✖','keep-element-content'=>TRUE,'style'=>array('font-size'=>'24px','color'=>'#fff;','background-color'=>'#0a0'),'showEditMode'=>TRUE,'type'=>'Cntr','Read'=>'ALL_CONTENTADMIN_R','title'=>'Close canvas editor'), - 'edit'=>array('tag'=>'button','element-content'=>'✎','keep-element-content'=>TRUE,'style'=>array('font-size'=>'24px','color'=>'#fff','background-color'=>'#a00'),'showEditMode'=>FALSE,'type'=>'Cntr','Read'=>'ALL_CONTENTADMIN_R','title'=>'Edit canvas'), + private $tags=array('run'=>array('tag'=>'button','element-content'=>'✖','keep-element-content'=>TRUE,'style'=>array('font-size'=>'24px','color'=>'#fff;','background-color'=>'#0a0'),'showEditMode'=>TRUE,'type'=>'Control','Read'=>'ALL_CONTENTADMIN_R','title'=>'Close canvas editor'), + 'edit'=>array('tag'=>'button','element-content'=>'✎','keep-element-content'=>TRUE,'style'=>array('font-size'=>'24px','color'=>'#fff','background-color'=>'#a00'),'showEditMode'=>FALSE,'type'=>'Control','Read'=>'ALL_CONTENTADMIN_R','title'=>'Edit canvas'), '⚙'=>array('tag'=>'button','element-content'=>'⚙','keep-element-content'=>TRUE,'class'=>'canvas-processor','showEditMode'=>TRUE,'type'=>'Elements','Read'=>'ALL_CONTENTADMIN_R','title'=>'Step processing'), 'Select'=>array('tag'=>'button','element-content'=>'Select','keep-element-content'=>TRUE,'class'=>'canvas-std','showEditMode'=>TRUE,'type'=>'Elements','Read'=>'ALL_CONTENTADMIN_R','title'=>'Database view'), 'Text'=>array('tag'=>'div','element-content'=>'Text','keep-element-content'=>TRUE,'class'=>'canvas-text','showEditMode'=>TRUE,'type'=>'Elements','Read'=>'ALL_CONTENTADMIN_R','title'=>'Text box'), - // - '⭠'=>array('tag'=>'div','element-content'=>'⭠','keep-element-content'=>TRUE,'class'=>'canvas-symbol','showEditMode'=>TRUE,'type'=>'Connectors','Read'=>'ALL_CONTENTADMIN_R'), - '⭡'=>array('tag'=>'div','element-content'=>'⭡','keep-element-content'=>TRUE,'class'=>'canvas-symbol','showEditMode'=>TRUE,'type'=>'Connectors','Read'=>'ALL_CONTENTADMIN_R'), - '⭢'=>array('tag'=>'div','element-content'=>'⭢','keep-element-content'=>TRUE,'class'=>'canvas-symbol','showEditMode'=>TRUE,'type'=>'Connectors','Read'=>'ALL_CONTENTADMIN_R'), - '⭣'=>array('tag'=>'div','element-content'=>'⭣','keep-element-content'=>TRUE,'class'=>'canvas-symbol','showEditMode'=>TRUE,'type'=>'Connectors','Read'=>'ALL_CONTENTADMIN_R'), - '⭤'=>array('tag'=>'div','element-content'=>'⭤','keep-element-content'=>TRUE,'class'=>'canvas-symbol','showEditMode'=>TRUE,'type'=>'Connectors','Read'=>'ALL_CONTENTADMIN_R'), - '⭥'=>array('tag'=>'div','element-content'=>'⭥','keep-element-content'=>TRUE,'class'=>'canvas-symbol','showEditMode'=>TRUE,'type'=>'Connectors','Read'=>'ALL_CONTENTADMIN_R'), - '⭦'=>array('tag'=>'div','element-content'=>'⭦','keep-element-content'=>TRUE,'class'=>'canvas-symbol','showEditMode'=>TRUE,'type'=>'Connectors','Read'=>'ALL_CONTENTADMIN_R'), - '⭧'=>array('tag'=>'div','element-content'=>'⭧','keep-element-content'=>TRUE,'class'=>'canvas-symbol','showEditMode'=>TRUE,'type'=>'Connectors','Read'=>'ALL_CONTENTADMIN_R'), - '⭨'=>array('tag'=>'div','element-content'=>'⭨','keep-element-content'=>TRUE,'class'=>'canvas-symbol','showEditMode'=>TRUE,'type'=>'Connectors','Read'=>'ALL_CONTENTADMIN_R'), - '⭩'=>array('tag'=>'div','element-content'=>'⭩','keep-element-content'=>TRUE,'class'=>'canvas-symbol','showEditMode'=>TRUE,'type'=>'Connectors','Read'=>'ALL_CONTENTADMIN_R'), - '⭪'=>array('tag'=>'div','element-content'=>'⭪','keep-element-content'=>TRUE,'class'=>'canvas-symbol','showEditMode'=>TRUE,'type'=>'Connectors','Read'=>'ALL_CONTENTADMIN_R'), - '⭫'=>array('tag'=>'div','element-content'=>'⭫','keep-element-content'=>TRUE,'class'=>'canvas-symbol','showEditMode'=>TRUE,'type'=>'Connectors','Read'=>'ALL_CONTENTADMIN_R'), - '⭬'=>array('tag'=>'div','element-content'=>'⭬','keep-element-content'=>TRUE,'class'=>'canvas-symbol','showEditMode'=>TRUE,'type'=>'Connectors','Read'=>'ALL_CONTENTADMIN_R'), - '⭭'=>array('tag'=>'div','element-content'=>'⭭','keep-element-content'=>TRUE,'class'=>'canvas-symbol','showEditMode'=>TRUE,'type'=>'Connectors','Read'=>'ALL_CONTENTADMIN_R'), - '➙'=>array('tag'=>'div','element-content'=>'➙','keep-element-content'=>TRUE,'class'=>'canvas-symbol','showEditMode'=>TRUE,'type'=>'Connectors','Read'=>'ALL_CONTENTADMIN_R'), - '➪'=>array('tag'=>'div','element-content'=>'➪','keep-element-content'=>TRUE,'class'=>'canvas-symbol','showEditMode'=>TRUE,'type'=>'Connectors','Read'=>'ALL_CONTENTADMIN_R'), - '➜'=>array('tag'=>'div','element-content'=>'➜','keep-element-content'=>TRUE,'class'=>'canvas-symbol','showEditMode'=>TRUE,'type'=>'Connectors','Read'=>'ALL_CONTENTADMIN_R'), - // - '⮠'=>array('tag'=>'div','element-content'=>'⮠','keep-element-content'=>TRUE,'class'=>'canvas-symbol','showEditMode'=>TRUE,'type'=>'Misc','Read'=>'ALL_CONTENTADMIN_R'), - '⮡'=>array('tag'=>'div','element-content'=>'⮡','keep-element-content'=>TRUE,'class'=>'canvas-symbol','showEditMode'=>TRUE,'type'=>'Misc','Read'=>'ALL_CONTENTADMIN_R'), - '⮢'=>array('tag'=>'div','element-content'=>'⮢','keep-element-content'=>TRUE,'class'=>'canvas-symbol','showEditMode'=>TRUE,'type'=>'Misc','Read'=>'ALL_CONTENTADMIN_R'), - '⮣'=>array('tag'=>'div','element-content'=>'⮣','keep-element-content'=>TRUE,'class'=>'canvas-symbol','showEditMode'=>TRUE,'type'=>'Misc','Read'=>'ALL_CONTENTADMIN_R'), - '⮤'=>array('tag'=>'div','element-content'=>'⮤','keep-element-content'=>TRUE,'class'=>'canvas-symbol','showEditMode'=>TRUE,'type'=>'Misc','Read'=>'ALL_CONTENTADMIN_R'), - '⮥'=>array('tag'=>'div','element-content'=>'⮥','keep-element-content'=>TRUE,'class'=>'canvas-symbol','showEditMode'=>TRUE,'type'=>'Misc','Read'=>'ALL_CONTENTADMIN_R'), - '⮦'=>array('tag'=>'div','element-content'=>'⮦','keep-element-content'=>TRUE,'class'=>'canvas-symbol','showEditMode'=>TRUE,'type'=>'Misc','Read'=>'ALL_CONTENTADMIN_R'), - '⮧'=>array('tag'=>'div','element-content'=>'⮧','keep-element-content'=>TRUE,'class'=>'canvas-symbol','showEditMode'=>TRUE,'type'=>'Misc','Read'=>'ALL_CONTENTADMIN_R'), - '|'=>array('tag'=>'div','element-content'=>'|','keep-element-content'=>TRUE,'class'=>'canvas-symbol','showEditMode'=>TRUE,'type'=>'Misc','Read'=>'ALL_CONTENTADMIN_R'), - '▁'=>array('tag'=>'div','element-content'=>'▁','keep-element-content'=>TRUE,'class'=>'canvas-symbol','showEditMode'=>TRUE,'type'=>'Misc','Read'=>'ALL_CONTENTADMIN_R'), - '○'=>array('tag'=>'div','element-content'=>'○','keep-element-content'=>TRUE,'class'=>'canvas-symbol','showEditMode'=>TRUE,'type'=>'Misc','Read'=>'ALL_CONTENTADMIN_R'), - '●'=>array('tag'=>'div','element-content'=>'●','keep-element-content'=>TRUE,'class'=>'canvas-symbol','showEditMode'=>TRUE,'type'=>'Misc','Read'=>'ALL_CONTENTADMIN_R'), - '◯'=>array('tag'=>'div','element-content'=>'◯','keep-element-content'=>TRUE,'class'=>'canvas-symbol','showEditMode'=>TRUE,'type'=>'Misc','Read'=>'ALL_CONTENTADMIN_R'), - '┄'=>array('tag'=>'div','element-content'=>'┄','keep-element-content'=>TRUE,'class'=>'canvas-symbol','showEditMode'=>TRUE,'type'=>'Misc','Read'=>'ALL_CONTENTADMIN_R'), - '┊'=>array('tag'=>'div','element-content'=>'┊','keep-element-content'=>TRUE,'class'=>'canvas-symbol','showEditMode'=>TRUE,'type'=>'Misc','Read'=>'ALL_CONTENTADMIN_R'), - '═'=>array('tag'=>'div','element-content'=>'═','keep-element-content'=>TRUE,'class'=>'canvas-symbol','showEditMode'=>TRUE,'type'=>'Misc','Read'=>'ALL_CONTENTADMIN_R'), - '║'=>array('tag'=>'div','element-content'=>'║','keep-element-content'=>TRUE,'class'=>'canvas-symbol','showEditMode'=>TRUE,'type'=>'Misc','Read'=>'ALL_CONTENTADMIN_R'), - '⮽'=>array('tag'=>'div','element-content'=>'⮽','keep-element-content'=>TRUE,'class'=>'canvas-symbol','showEditMode'=>TRUE,'type'=>'Misc','Read'=>'ALL_CONTENTADMIN_R'), ); + private $graphicElemnts=array('Connectors'=>array('❘','⟵','⟶','⟷','←','↑','→','↓','↔','↕','↖','↗','↘','↙','↩','↪','↺','↻','⇵','➜'), + 'Symbols'=>array('♪','♥','♦','♣','♯','♺','⚑','⚠','⚝','✂','✈','✉','✎','✔','✘','✚','❑','❖'), + 'Math'=>array('∅','∇','∄','∋','∈','∉','∑','∏','∐','∘','√','∝','∞','∟','∡','∩','∫','≈','≪','≫','⋘','⋙','≡'), + ); + private $processorOptions=array(); public function __construct(array $oc) @@ -102,6 +70,11 @@ public function __construct(array $oc) public function init() { $this->entryTemplate=$this->oc['SourcePot\Datapool\Foundation\Database']->getEntryTemplateCreateTable($this->entryTable,__CLASS__); + foreach($this->graphicElemnts as $category=>$htmlEntities){ + foreach($htmlEntities as $htmlEntity){ + $this->tags[$htmlEntity]=array('tag'=>'div','element-content'=>$htmlEntity,'keep-element-content'=>TRUE,'class'=>'canvas-symbol','showEditMode'=>TRUE,'type'=>$category,'Read'=>'ALL_CONTENTADMIN_R'); + } + } $this->completeDefintion(); } @@ -277,7 +250,9 @@ private function getCntrHtml(string $callingClass):array $matrix[$tag['type']]['Btn'].=$this->oc['SourcePot\Datapool\Foundation\Element']->element($btn); } $htmlArr=array('cntr'=>'','processor'=>''); - $htmlArr['cntr']=$this->oc['SourcePot\Datapool\Tools\HTMLbuilder']->table(array('matrix'=>$matrix,'keep-element-content'=>TRUE,'hideHeader'=>TRUE,'caption'=>'Canvas')); + $tableArr=array('matrix'=>$matrix,'keep-element-content'=>TRUE,'hideHeader'=>TRUE,'caption'=>'Canvas'); + if ($isEditMode){$tableArr['style']=array('min-width'=>'550px');} + $htmlArr['cntr']=$this->oc['SourcePot\Datapool\Tools\HTMLbuilder']->table($tableArr); $selectedCanvasElement=$this->oc['SourcePot\Datapool\Tools\NetworkTools']->getPageStateByKey(__CLASS__,'selectedCanvasElement'); $canvasElement=$this->oc['SourcePot\Datapool\Foundation\Database']->entryById($selectedCanvasElement); if ($isEditMode){ diff --git a/src/php/Foundation/Database.php b/src/php/Foundation/Database.php index 3d77dcf..8b8da64 100644 --- a/src/php/Foundation/Database.php +++ b/src/php/Foundation/Database.php @@ -942,43 +942,37 @@ public function moveEntryOverwriteTarget($sourceEntry,$targetSelector,$isSystemC } } else { // move or copy attached file to target - $fileRenameSuccess=TRUE; + $context['fileError']=FALSE; $sourceFile=$this->oc['SourcePot\Datapool\Foundation\Filespace']->selector2file($sourceEntry); $targetFile=$this->oc['SourcePot\Datapool\Foundation\Filespace']->selector2file($targetEntry); if (is_file($sourceFile) && !$isTestRun){ - if ($keepSource){ - $fileRenameSuccess=@copy($sourceFile,$targetFile); - $context['copyAttachedFile']=TRUE; - } else { - $fileRenameSuccess=@rename($sourceFile,$targetFile); - $context['movedAttachedFile']=TRUE; + try{ + $this->oc['SourcePot\Datapool\Foundation\Filespace']->addStatistic('inserted files',intval(copy($sourceFile,$targetFile))); + } catch(\Exception $e){ + $context['fileError']=$e->getMessage(); } } - // create target entry - if ($fileRenameSuccess){ - if (!$isTestRun){ - if (!$keepSource){ - $this->deleteEntries(array('Source'=>$sourceEntry['Source'],'EntryId'=>$sourceEntry['EntryId']),$isSystemCall); - } - $targetEntry=$this->updateEntry($targetEntry,$isSystemCall,FALSE,FALSE,$targetFile); - $context['attachedFileProcessed']=TRUE; - } + // update entry and delete source file if source is not kept + if ($isTestRun){ + $targetEntry=$sourceEntry; + } else if ($context['fileError']){ + $context['Name']=$targetEntry['Name']; + $context['sourceFile']=$sourceFile; + $context['action']=($keepSource)?'to copy':'to move'; + $this->oc['logger']->log('notice','Failed {action} file "{sourceFile}" with "{fileError}". The entry "{Name}" was not updated.',$context); } else { - // copying or renaming of attached file failed - if ($isTestRun){ - $targetEntry=$sourceEntry; + $targetEntry=$this->updateEntry($targetEntry,$isSystemCall); + if ($keepSource){ + $context['copyAttachedFile']=TRUE; } else { - $targetEntry=$this->updateEntry($sourceEntry,$isSystemCall); + $context['movedAttachedFile']=TRUE; + $this->deleteEntries(array('Source'=>$sourceEntry['Source'],'EntryId'=>$sourceEntry['EntryId']),$isSystemCall); } } } } else { // no write access - if ($isTestRun){ - $targetEntry=$sourceEntry; - } else { - $targetEntry=$this->updateEntry($sourceEntry,TRUE); - } + $targetEntry=$sourceEntry; $context['noWriteAccess']=TRUE; } $targetEntry[__FUNCTION__]=$context; diff --git a/src/php/Tools/FileContent.php b/src/php/Tools/FileContent.php index dc23d9b..a5779af 100644 --- a/src/php/Tools/FileContent.php +++ b/src/php/Tools/FileContent.php @@ -39,8 +39,10 @@ public function enrichEntry(array $entry):array if (isset($entry['Date'])){ $pageTimeZone=$this->oc['SourcePot\Datapool\Foundation\Backbone']->getSettings('pageTimeZone'); $dateWebPageTimeZone=\DateTime::createFromFormat('Y-m-d H:i:s',$entry['Date'],new \DateTimeZone(\SourcePot\Datapool\Root::DB_TIMEZONE)); - $dateWebPageTimeZone->setTimeZone(new \DateTimeZone($pageTimeZone)); - $entry['Date ('.$pageTimeZone.')']=$dateWebPageTimeZone->format('Y-m-d H:i:s'); + if ($dateWebPageTimeZone){ + $dateWebPageTimeZone->setTimeZone(new \DateTimeZone($pageTimeZone)); + $entry['Date ('.$pageTimeZone.')']=$dateWebPageTimeZone->format('Y-m-d H:i:s'); + } } $entry['currentUserId']=$currentUser['EntryId']; $entry['currentUser']=$currentUser['Content']['Contact details']['First name'].' '.$currentUser['Content']['Contact details']['Family name']; diff --git a/src/php/Tools/PdfTools.php b/src/php/Tools/PdfTools.php index 47aa14f..bc203f6 100644 --- a/src/php/Tools/PdfTools.php +++ b/src/php/Tools/PdfTools.php @@ -152,9 +152,9 @@ public function attachments2arrSmalot($file,array $entry=array()):array $pdfParser= new \Smalot\PdfParser\Parser(); $pdfContent=$pdfContent = file_get_contents($file); - $pdfParsed = $pdfParser->parseContent($pdfContent); try { $context['attachmentsFailed']=array(); + $pdfParsed = $pdfParser->parseContent($pdfContent); $filespecIndex=0; $filespecs = $pdfParsed->getObjectsByType('Filespec'); foreach ($filespecs as $filespec){