allow to set link type of related document

This commit is contained in:
Uwe Steinmann 2024-01-24 12:00:20 +01:00
parent d55ea00ea3
commit 049bc9da4c
2 changed files with 31 additions and 3 deletions

View File

@ -68,7 +68,16 @@ if (!is_object($doc)) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_doc_id"));
}
if (!$document->addDocumentLink($docid, $user->getID(), $public)){
if(!empty($_GET['linktype'])) {
$linktype = $dms->getLinkType($_GET['linktype']);
if (!is_object($linktype)) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_link_type"));
}
} else {
$linktype = null;
}
if (!$document->addDocumentLink($docid, $user->getID(), $public, $linktype)){
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("error_occured"));
}

View File

@ -1996,6 +1996,9 @@ $(document).ready( function() {
print getMLText("document_link_by")." ".htmlspecialchars($responsibleUser->getFullName());
if (($user->getID() == $responsibleUser->getID()) || ($document->getAccessMode($user) == M_ALL )) {
print "<br />".getMLText("document_link_public").": ".(($link->isPublic()) ? getMLText("yes") : getMLText("no"));
if($linktype = $link->getLinkType()) {
print "<br />".$linktype->getName();
}
print "<form action=\"".$this->params['settings']->_httpRoot."op/op.RemoveDocumentLink.php\" method=\"post\">".createHiddenFieldWithKey('removedocumentlink')."<input type=\"hidden\" name=\"documentid\" value=\"".$documentid."\" /><input type=\"hidden\" name=\"linkid\" value=\"".$link->getID()."\" /><button type=\"submit\" class=\"btn btn-danger btn-mini btn-sm\"><i class=\"fa fa-remove\"></i> ".getMLText("delete")."</button></form>";
}
print "</span></td>";
@ -2012,8 +2015,24 @@ $(document).ready( function() {
<input type="hidden" name="documentid" value="<?php print $documentid;?>">
<?php echo createHiddenFieldWithKey('adddocumentlink'); ?>
<?php $this->contentContainerStart(); ?>
<?php $this->formField(getMLText("add_document_link"), $this->getDocumentChooserHtml("form1")); ?>
<?php
<?php $this->formField(getMLText("linked_document"), $this->getDocumentChooserHtml("form1")); ?>
<?php
$options = [];
foreach($dms->getLinkTypes() as $linktype) {
$options[] = array($linktype->getID(), htmlspecialchars($linktype->getName()), $sellinktype && $linktype->getID()==$sellinktype->getID(), array(/*array('data-subtitle', $linktype->countDocumentLinksByType().' '.getMLText('documents'))*/));
}
$this->formField(
getMLText("global_link_types"),
array(
'element'=>'select',
'id'=>'linktype',
'name'=>'linktype',
'class'=>'chzn-select',
'options'=>$options,
'placeholder'=>getMLText('choose_link_type'),
'allow_empty'=>true,
)
);
if ($document->getAccessMode($user) >= M_READWRITE) {
$this->formField(
getMLText("document_link_public"),