37 protected \ILIAS\DI\UIServices
$ui;
44 public function __construct($a_id = 0, $a_id_type = self::REPOSITORY_NODE_ID, $a_parent_node_id = 0)
49 $this->
lng = $DIC->language();
50 $this->
help = $DIC[
"ilHelp"];
51 $this->tpl = $DIC->ui()->mainTemplate();
52 $this->
user = $DIC->user();
53 $this->
tabs = $DIC->tabs();
54 $this->
ctrl = $DIC->ctrl();
55 $this->
ui = $DIC->ui();
57 $this->repo_gui_service = $DIC->repository()->gui();
71 $this->requested_sortation = $this->std_request->getSortation();
73 $this->
lng->loadLanguageModule(
"cntr");
81 protected function setTabs(
bool $a_show_settings =
true): void
88 $this->
ctrl->setParameter($this,
"wsp_id", $this->node_id);
90 $this->tabs_gui->addTab(
93 $this->
ctrl->getLinkTarget($this,
"")
96 $this->
ctrl->setParameterByClass(
97 "ilObjWorkspaceRootFolderGUI",
102 $this->tabs_gui->addTab(
105 $this->
ctrl->getLinkTargetByClass(
"ilObjWorkspaceRootFolderGUI",
"shareFilter")
108 $this->tabs_gui->addTab(
110 $lng->
txt(
"wsp_tab_ownership"),
111 $this->
ctrl->getLinkTargetByClass(array(
"ilObjWorkspaceRootFolderGUI",
"ilObjectOwnershipManagementGUI"),
"listObjects")
114 if (!$this->
ctrl->getNextClass($this)) {
115 if (stristr($this->
ctrl->getCmd(),
"share")) {
116 $this->tabs_gui->activateTab(
"share");
118 $this->tabs_gui->activateTab(
"wsp");
146 $this->tabs_gui->addSubTab(
149 $this->
ctrl->getLinkTarget($this,
"edit")
163 $this->
ctrl->redirect($this,
"");
169 $this->
ctrl->redirect($this,
"");
174 $next_class = $this->
ctrl->getNextClass($this);
175 $cmd = $this->
ctrl->getCmd();
177 switch ($next_class) {
178 case "ilcommonactiondispatchergui":
180 $this->
ctrl->forwardCommand($gui);
183 case "ilobjectownershipmanagementgui":
185 $this->tabs_gui->activateTab(
"ownership");
186 $gui = $this->repo_gui_service->ownershipManagementGUI();
187 $this->
ctrl->forwardCommand($gui);
192 if ($this->type !=
"wsrt") {
212 $this->session_repo->clearClipboard();
223 $this->
ctrl->getLinkTargetByClass(array(
"ilcommonactiondispatchergui",
"iltagginggui"),
"",
"",
true,
false)
234 $this->obj_definition,
236 $this->user_folder_settings
242 $exp->setSelectableTypes(array(
"wsrt",
"wfld"));
243 $exp->setLinkToNodeClass(
true);
244 $exp->setActivateHighlighting(
true);
245 if ($exp->handleCommand()) {
248 $left = $exp->getHTML();
257 $this->tabs_gui->activateTab(
"wsp");
258 $this->tabs_gui->activateSubTab(
"settings");
265 $this->tabs_gui->activateTab(
"wsp");
266 $this->tabs_gui->activateSubTab(
"settings");
269 public function cut(): void
271 $item_ids = $this->std_request->getItemIds();
272 if (count($item_ids) == 0) {
273 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"no_checkbox"),
true);
274 $this->
ctrl->redirect($this);
279 $repo_switch_allowed =
true;
280 foreach ($item_ids as $item_id) {
281 foreach ($this->tree->getSubTree($this->tree->getNodeData($item_id)) as $node) {
283 $repo_switch_allowed =
false;
287 $no_cut[$node[
"wsp_id"]] = $obj->getTitle();
292 if (count($no_cut)) {
293 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"msg_no_perm_cut") .
" " . implode(
',', $no_cut),
true);
294 $this->
ctrl->redirect($this);
298 $this->session_repo->setClipboardSourceIds($item_ids);
299 $this->session_repo->setClipboardCmd(
'cut');
306 $this->session_repo->setClipboardWsp2Repo(
true);
312 $this->session_repo->setClipboardWsp2Repo(
false);
320 $item_ids = $this->std_request->getItemIds();
321 if (count($item_ids) == 0) {
322 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"no_checkbox"),
true);
323 $this->
ctrl->redirect($this);
327 $this->
ctrl->setParameter($this,
"wsp_id", $this->node_id);
329 $repo_switch_allowed =
true;
330 foreach ($item_ids as $item_id) {
331 $node = $this->tree->getNodeData($item_id);
333 $repo_switch_allowed =
false;
335 $current_node = $item_id;
336 $owner = $this->tree->lookupOwner($current_node);
337 if ($owner != $ilUser->getId()) {
338 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'),
true);
339 $this->
ctrl->redirect($this);
344 $this->session_repo->setClipboardSourceIds($item_ids);
345 $this->session_repo->setClipboardCmd(
'copy');
352 $ids = $this->std_request->getItemIds();
353 if (count($ids) != 1) {
354 $this->
ctrl->redirect($this,
"share");
357 $current_node = current($ids);
360 if (
$handler->checkAccess(
"read",
"", $current_node)) {
362 $this->session_repo->setClipboardSourceIds([$current_node]);
363 $this->session_repo->setClipboardCmd(
'copy');
364 $this->session_repo->setClipboardShared(
true);
368 $perms =
$handler->getPermissions($current_node);
375 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'permission_denied'),
true);
376 $this->
ctrl->redirect($this,
"share");
381 $this->session_repo->setClipboardWsp2Repo(
true);
387 $this->session_repo->setClipboardWsp2Repo(
false);
396 $ilTabs->clearTargets();
398 if (!$this->session_repo->getClipboardShared()) {
399 $ilTabs->setBackTarget(
400 $this->
lng->txt(
'back'),
401 $this->
ctrl->getLinkTarget($this)
404 $ilTabs->setBackTarget(
405 $this->
lng->txt(
'back'),
406 $this->
ctrl->getLinkTarget($this,
'share')
410 $mode = $this->session_repo->getClipboardCmd();
412 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'msg_' . $mode .
'_clipboard'));
414 $this->tpl->addBlockFile(
417 'tpl.paste_into_multiple_objects.html',
418 "components/ILIAS/WorkspaceFolder" 422 if (!$this->session_repo->getClipboardWsp2Repo()) {
425 $exp->setSelectableTypes(array(
"wsrt",
"wfld"));
426 $exp->setSelectMode(
"node",
false);
427 if ($exp->handleCommand()) {
430 $this->tpl->setVariable(
'OBJECT_TREE', $exp->getHTML());
433 if ($repo_switch_allowed) {
434 $switch_cmd = ($mode ==
"cut")
435 ?
"cut_for_repository" 436 :
"copy_to_repository";
437 $this->tpl->setCurrentBlock(
"switch_button");
438 $this->tpl->setVariable(
'CMD_SWITCH', $switch_cmd);
439 $this->tpl->setVariable(
'TXT_SWITCH', $this->
lng->txt(
'wsp_switch_to_repo_tree'));
440 $this->tpl->parseCurrentBlock();
442 foreach ($this->std_request->getItemIds() as
$id) {
443 $this->tpl->setCurrentBlock(
"hidden");
444 $this->tpl->setVariable(
'VALUE', (
string)
$id);
445 $this->tpl->parseCurrentBlock();
454 'paste_' . $mode .
'_repexpand' 456 $exp->setTargetGet(
'ref_id');
458 if ($this->std_request->getPasteExpand($mode) ==
'') {
461 $expanded = $this->std_request->getPasteExpand($mode);
463 $exp->setCheckedItems(array($this->std_request->getNode()));
464 $exp->setExpandTarget($this->
ctrl->getLinkTarget($this,
'showMoveIntoObjectTree'));
465 $exp->setPostVar(
'node');
466 $exp->setExpand($expanded);
468 $this->tpl->setVariable(
'OBJECT_TREE', $exp->getOutput());
470 if (in_array($mode, [
"copy",
"cut"])) {
471 $switch_cmd = ($mode ==
"cut")
472 ?
"cut_for_workspace" 473 :
"copy_to_workspace";
474 $this->tpl->setCurrentBlock(
"switch_button");
475 $this->tpl->setVariable(
'CMD_SWITCH', $switch_cmd);
476 $this->tpl->setVariable(
'TXT_SWITCH', $this->
lng->txt(
'wsp_switch_to_wsp_tree'));
477 $this->tpl->parseCurrentBlock();
479 foreach ($this->std_request->getItemIds() as
$id) {
480 $this->tpl->setCurrentBlock(
"hidden");
481 $this->tpl->setVariable(
'VALUE', (
string)
$id);
482 $this->tpl->parseCurrentBlock();
490 $this->tpl->setVariable(
'FORM_TARGET',
'_top');
491 $this->tpl->setVariable(
493 $this->
ctrl->getFormAction($this,
'performPasteIntoMultipleObjects')
496 $this->tpl->setVariable(
'CMD_SUBMIT',
'performPasteIntoMultipleObjects');
497 $this->tpl->setVariable(
'TXT_SUBMIT', $this->
lng->txt(
'paste'));
504 $mode = $this->session_repo->getClipboardCmd();
505 $source_node_ids = $this->session_repo->getClipboardSourceIds();
506 $target_node_id = $this->std_request->getNode();
508 if (!is_array($source_node_ids) || count($source_node_ids) == 0) {
509 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_at_least_one_object'),
true);
510 $this->
ctrl->redirect($this);
512 if (!$target_node_id) {
513 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'select_at_least_one_object'),
true);
514 $this->
ctrl->redirect($this,
"showMoveIntoObjectTree");
517 if (!$this->session_repo->getClipboardWsp2Repo()) {
518 $target_obj_id = $this->tree->lookupObjectId($target_node_id);
525 foreach ($source_node_ids as $source_node_id) {
527 $source_obj_id = $this->tree->lookupObjectId($source_node_id);
532 if ($source_node_id == $target_node_id) {
534 $this->
lng->txt(
'msg_obj_exists_in_folder'),
535 $source_object->getTitle(),
536 $target_object->getTitle()
540 if (!in_array($source_object->getType(), array_keys($target_object->getPossibleSubObjects()))) {
542 $this->
lng->txt(
'msg_obj_may_not_contain_objects_of_type'),
543 $target_object->getTitle(),
544 $source_object->getType()
549 $owner = $this->tree->lookupOwner($source_node_id);
550 if ($mode ==
"copy" && $ilUser->getId() == $owner && !$this->
checkPermissionBool(
'copy',
'',
'', $source_node_id)) {
551 $fail[] = $this->
lng->txt(
'permission_denied');
554 if (!$this->session_repo->getClipboardWsp2Repo()) {
555 if ($mode ==
"cut" && $this->tree->isGrandChild($source_node_id, $target_node_id)) {
557 $this->
lng->txt(
'msg_paste_object_not_in_itself'),
558 $source_object->getTitle()
563 if ($this->session_repo->getClipboardWsp2Repo() ==
true) {
565 if (!$ilAccess->checkAccess(
"create",
"", $target_node_id, $source_object->getType())) {
567 $this->
lng->txt(
'msg_no_perm_paste_object_in_folder'),
568 $source_object->getTitle(),
569 $target_object->getTitle()
573 if (!$this->
checkPermissionBool(
'create',
'', $source_object->getType(), $target_node_id)) {
575 $this->
lng->txt(
'msg_no_perm_paste_object_in_folder'),
576 $source_object->getTitle(),
577 $target_object->getTitle()
584 $this->tpl->setOnScreenMessage(
'failure', implode(
"<br />", $fail),
true);
585 $this->
ctrl->redirect($this);
588 foreach ($source_node_ids as $source_node_id) {
590 if ($ilUser->getId() != $owner && $mode ==
"copy") {
593 $node_data = $source_tree->getNodeData($source_node_id);
597 if ($mode ==
"cut") {
598 if (!$this->session_repo->getClipboardWsp2Repo()) {
599 $this->tree->moveTree($source_node_id, $target_node_id);
601 $parent_id = $this->tree->getParentId($source_node_id);
605 $this->tree->deleteReference($source_node_id);
606 $source_node = $this->tree->getNodeData($source_node_id);
607 $this->tree->deleteTree($source_node);
610 $source_object->createReference();
611 $source_object->putInTree($target_node_id);
612 $source_object->setPermissions($target_node_id);
617 elseif ($mode ==
"copy") {
620 $this->wsp_log->debug(
"Copy ID: " . $copy_id .
", Source Node: " . $source_node_id
621 .
", source object: " . $source_object->getId());
622 if (!$this->session_repo->getClipboardWsp2Repo()) {
623 $wizard_options->disableTreeCopy();
625 $wizard_options->saveOwner($ilUser->getId());
626 $wizard_options->saveRoot($source_node_id);
627 $wizard_options->read();
629 $new_obj = $source_object->cloneObject($target_node_id, $copy_id);
631 if ($new_obj && !$this->session_repo->getClipboardWsp2Repo()) {
632 $this->wsp_log->debug(
"New Obj ID: " . $new_obj->getId());
633 $new_obj_node_id = $this->tree->insertObject($target_node_id, $new_obj->getId());
634 $this->
getAccessHandler()->setPermissions($target_node_id, $new_obj_node_id);
637 $wizard_options->deleteAll();
642 if (!$this->session_repo->getClipboardWsp2Repo()) {
650 $this->session_repo->clearClipboard();
653 if ($mode ==
'cut') {
654 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'msg_cut_copied'),
true);
656 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'msg_cloned'),
true);
659 $this->
ctrl->setParameter($this,
"wsp_id", $redirect_node);
660 $this->
ctrl->redirect($this);
668 public function share(
bool $a_load_data =
true): void
680 $tbl->writeFilterToSession();
703 $ilTabs->clearTargets();
704 $ilTabs->setBackTarget(
706 $this->
ctrl->getLinkTarget($this,
"share")
721 $this->
ctrl->setParameter($this,
"item_ref_id", $a_node_id);
723 $object_data = $this->
getAccessHandler()->getObjectDataFromNode($a_node_id);
726 $form->setFormAction($ilCtrl->getFormAction($this,
"checkPassword"));
727 $form->setTitle(
$lng->
txt(
"wsp_password_for") .
": " . $object_data[
"title"]);
731 $password->setRequired(
true);
732 $password->setSkipSyntaxCheck(
true);
733 $form->addItem($password);
735 $form->addCommandButton(
"checkPassword",
$lng->
txt(
"submit"));
736 $form->addCommandButton(
"share",
$lng->
txt(
"cancel"));
745 $ids = $this->std_request->getItemIds();
746 if (count($ids) != 1) {
747 $this->
ctrl->redirect($this,
"share");
752 if ($form->checkInput()) {
754 $input = md5($form->getInput(
"password"));
755 if ($input == $password) {
759 $this->
ctrl->setParameter($this,
"item_ref_id",
$node_id);
760 $this->
ctrl->redirect($this,
"copyShared");
762 $item = $form->getItemByPostVar(
"password");
763 $item->setAlert(
$lng->
txt(
"wsp_invalid_password"));
764 $this->tpl->setOnScreenMessage(
'failure',
$lng->
txt(
"form_input_not_valid"));
768 $form->setValuesByPost();
772 public static function _goto(
string $a_target): void
775 $ctrl = $DIC->ctrl();
776 $id = explode(
"_", $a_target);
778 "ilsharedresourceGUI",
790 $tbl->writeFilterToSession();
801 $item_ids = $this->std_request->getItemIds();
803 if (count($item_ids) == 0) {
804 $this->tpl->setOnScreenMessage(
'failure',
$lng->
txt(
"no_checkbox"),
true);
805 $this->
ctrl->redirect($this,
"");
813 $cgui->setHeaderText(
$lng->
txt(
"info_delete_sure") .
"<br/>" .
814 $lng->
txt(
"info_delete_warning_no_trash"));
816 $cgui->setFormAction($this->
ctrl->getFormAction($this));
817 $cgui->setCancel(
$lng->
txt(
"cancel"),
"cancelDeletion");
818 $cgui->setConfirm(
$lng->
txt(
"confirm"),
"confirmedDelete");
821 $children = $this->tree->getSubTree($this->tree->getNodeData($node_id));
822 foreach ($children as $child) {
823 $node_id = $child[
"wsp_id"];
824 $obj_id = $this->tree->lookupObjectId($node_id);
830 $this->tpl->setOnScreenMessage(
'failure',
$lng->
txt(
"msg_no_perm_delete") .
" " . $title,
true);
831 $this->
ctrl->redirect($this);
849 $this->session_repo->clearClipboard();
850 parent::cancelDelete();
864 $main_tpl = $DIC->ui()->mainTemplate();
868 if (!$this->session_repo->isClipboardEmpty()) {
870 $main_tpl->setPageFormAction($this->
ctrl->getFormAction($this));
873 $this->
ctrl->setParameter($this,
"type",
"");
874 $this->
ctrl->setParameter($this,
"item_ref_id",
"");
877 $this->
lng->txt(
'paste_clipboard_items'),
882 $this->
lng->txt(
'clear_clipboard'),
886 $main_tpl->addAdminPanelToolbar(
$toolbar,
true,
false);
889 $main_tpl->setPageFormAction($this->
ctrl->getFormAction($this));
892 $this->
ctrl->setParameter($this,
"type",
"");
893 $this->
ctrl->setParameter($this,
"item_ref_id",
"");
895 if ($this->
object->gotItems($this->node_id)) {
901 $this->
lng->txt(
'delete_selected_items'),
905 $this->
lng->txt(
'move_selected_items'),
909 $this->
lng->txt(
'copy_selected_items'),
913 $this->
lng->txt(
'download_selected_items'),
919 $main_tpl->addAdminPanelToolbar(
921 $this->
object->gotItems($this->node_id) && $this->session_repo->isClipboardEmpty(),
922 ($this->
object->gotItems($this->node_id) && $this->session_repo->isClipboardEmpty())
926 if ($this->
object->gotItems($this->node_id)) {
927 $main_tpl->setPageFormAction($this->
ctrl->getFormAction($this));
939 $this->
ctrl->redirect($this,
"");
946 $initiated_by_folder_action =
false;
948 $ids = $this->std_request->getItemIds();
950 if (count($ids) == 0) {
951 $this->
ctrl->redirect($this,
"");
957 if ($download_job->run()) {
958 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'msg_bt_download_started'),
true);
960 $this->
ctrl->redirect($this);
967 $title = $this->
lng->txt(
'personal_resources');
981 $filtered_object_types = [];
982 foreach (array_keys($object_types) as
$type) {
983 if (isset($settings_map[$type])
984 && $this->
settings->get(
"disable_wsp_" . $settings_map[$type])) {
991 return $filtered_object_types;
996 $icon = $this->ui_factory->symbol()->icon()->custom(
1001 $this->
ctrl->setParameterByClass(self::class,
'new_type', $type);
1003 AddNewItemElementTypes::Object,
1004 $this->
lng->txt(
'wsp_type_' . $type),
1006 new \ILIAS\Data\URI(ILIAS_HTTP_PATH .
'/' . $this->
ctrl->getLinkTargetByClass(self::class,
'create'))
1008 $this->
ctrl->clearParameterByClass(self::class,
'new_type', $type);
buildAvailableObjectTypes()
static get(string $a_var)
__construct($a_id=0, $a_id_type=self::REPOSITORY_NODE_ID, $a_parent_node_id=0)
setAdministrationPanel(bool $active)
static _getIcon(int $obj_id=0, string $size="big", string $type="", bool $offline=false)
Get icon for repository item.
static getLogger(string $a_component_id)
Get component logger.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
Class ilObjWorkspaceFolderGUI.
New implementation of ilObjectGUI.
passwordForm(int $a_node_id, ?ilPropertyFormGUI $form=null)
const PERMISSION_ALL_PASSWORD
static getSharedNodePassword(int $a_node_id)
isActiveAdministrationPanel()
setTabs(bool $a_show_settings=true)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
activateSubTab(string $a_id)
setTypeWhiteList(array $a_val)
Set type white list.
getLinkTarget(object $a_gui_obj, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
setContent(string $a_html)
Sets content for standard template.
setParameterByClass(string $a_class, string $a_parameter, $a_value)
prepareOutput(bool $show_sub_objects=true)
setTitle(string $a_title, bool $hidden=false)
Sets title in standard template.
loadLanguageModule(string $a_module)
Load language module.
ilPasteIntoMultipleItemsExplorer Explorer
Background task for downloads.
redirectByClass( $a_class, ?string $a_cmd=null, ?string $a_anchor=null, bool $is_async=false)
static _goto(string $a_target)
initPasswordForm(int $a_node_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setSortation()
Set sortation.
static _lookupObjId(int $ref_id)
static getASCIIFilename(string $a_filename)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
Workspace share handler table GUI class.
addSubTab(string $a_id, string $a_text, string $a_link, string $a_frame="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $node_id=null)
setScreenIdComponent(string $a_comp)
static keepSharedSessionPassword(int $a_node_id, string $a_password)
Explorer for selecting a personal workspace item.
ilGlobalTemplateInterface $tpl
showAdministrationPanel()
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static _allocateCopyId()
Allocate a copy for further entries.
ilWorkspaceFolderUserSettings $user_folder_settings
setLeftNavContent(string $a_content)
Sets content of left navigation column.
buildObjectType(string $type)
static getClassByType(string $obj_type)
performPasteIntoMultipleObjects()
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
showMoveIntoObjectTree(bool $repo_switch_allowed=false)
setDescription(string $a_descr)
Sets description below title in standard template.
Render add new item selector.
static prepareJsLinks(string $redraw_url, string $notes_url, string $tags_url, ?ilGlobalTemplateInterface $tpl=null)
Insert js/ajax links into template.
WorkspaceSessionRepository $session_repo
__construct(Container $dic, ilPlugin $plugin)
share(bool $a_load_data=true)
listSharedResourcesOfOtherUser()
Workspace clipboard session repository.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
StandardGUIRequest $std_request
ILIAS Repository ExternalGUIService $repo_gui_service
static _getInstance(int $a_copy_id)
addContentSubTabs(bool $a_show_settings)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupType(int $id, bool $reference=false)
addHeaderAction()
Add header action menu.
static set(string $a_var, $a_val)
Set a value.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call