Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
fixed rename & delete for ilias 6
Browse files Browse the repository at this point in the history
  • Loading branch information
Theodor Truffer committed Mar 5, 2021
1 parent 5232b76 commit 128ee16
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
19 changes: 19 additions & 0 deletions classes/Util/exodUtil.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php
use srag\DIC\OneDrive\Version\Version;
/**
* Class exodUtil
* @author Theodor Truffer <[email protected]>
*/
class exodUtil
{
public static function getSystemMessageHTML(string $a_txt, string $a_type = "info") : string
{
global $DIC;
$version = new Version();
if ($version->is6()) {
return ilUtil::getSystemMessageHTML($a_txt, $a_type);
} else {
return $DIC->ui()->mainTemplate()->getMessageHTML($a_txt, $a_type);
}
}
}
6 changes: 3 additions & 3 deletions classes/class.ilOneDriveActionListGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ protected function addItemsBefore()
$this->selection_list->addItem(
ilOneDrivePlugin::getInstance()->txt('asl_rename'),
'rn',
"javascript:il.OneDriveList.rename(\'" . $this->node->getId() . "\', \'" . $title . "\');"
"javascript:il.OneDriveList.rename('" . $this->node->getId() . "', '" . $title . "');"
);
}
}
Expand Down Expand Up @@ -175,7 +175,7 @@ protected function rename()
$form = $this->buildForm();
if (!$form->checkInput()) {
$response->success = false;
$response->message = $DIC->ui()->mainTemplate()->getMessageHTML($this->txt('msg_invalid_input'), "failure");
$response->message = exodUtil::getSystemMessageHTML($this->txt('msg_invalid_input'), "failure");
echo json_encode($response);
exit;
}
Expand All @@ -197,7 +197,7 @@ protected function rename()
$title,
ObjectType::fromExodItem($exoItem)
);
$response->message = $DIC->ui()->mainTemplate()->getMessageHTML($this->txt("msg_renamed"), "success");
$response->message = exodUtil::getSystemMessageHTML($this->txt("msg_renamed"), "success");
$response->success = true;
} catch (Exception $e) {
$response->message = $DIC->ui()->mainTemplate()->getMessageHTML($e->getMessage(), "failure");
Expand Down
4 changes: 2 additions & 2 deletions classes/class.ilOneDriveDeleteGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function deleteItem()
$file_tree = ilCloudFileTree::getFileTreeFromSession();
$node = $file_tree->getNodeFromId($_POST["id"]);
$file_tree->deleteFromService($node->getId());
$response->message = $tpl->getMessageHTML($lng->txt("cld_file_deleted"), "success");
$response->message = exodUtil::getSystemMessageHTML($lng->txt("cld_file_deleted"), "success");
$response->success = true;
EventLogger::logObjectDeleted(
$DIC->user()->getId(),
Expand All @@ -35,7 +35,7 @@ public function deleteItem()
ObjectType::fromExodItem(exodItemCache::get($node->getId()))
);
} catch (Exception $e) {
$response->message = $tpl->getMessageHTML($e->getMessage(), "failure");
$response->message = exodUtil::getSystemMessageHTML($e->getMessage(), "failure");
}
}
echo "<script type='text/javascript'>window.parent.il.CloudFileList.afterDeleteItem(" . ilJsonUtil::encode($response)
Expand Down

0 comments on commit 128ee16

Please sign in to comment.