1<?php
2
3/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5require_once "./Services/Object/classes/class.ilObject2GUI.php";
6
7/**
8* Class ilObjWorkspaceFolderGUI
9*
10* @author Alex Killing <alex.killing@gmx.de>
11* @author Stefan Hecken <stefan.hecken@concepts-and-training.de>
12* $Id: class.ilObjFolderGUI.php 25134 2010-08-13 14:22:11Z smeyer $
13*
14* @ilCtrl_Calls ilObjWorkspaceFolderGUI: ilCommonActionDispatcherGUI, ilObjectOwnershipManagementGUI
15*
16* @extends ilObject2GUI
17*/
18class ilObjWorkspaceFolderGUI extends ilObject2GUI
19{
20    /**
21     * @var ilHelpGUI
22     */
23    protected $help;
24
25    /**
26     * @var ilTabsGUI
27     */
28    protected $tabs;
29
30
31    /**
32     * Constructor
33     */
34    public function __construct($a_id = 0, $a_id_type = self::REPOSITORY_NODE_ID, $a_parent_node_id = 0)
35    {
36        global $DIC;
37        parent::__construct($a_id, $a_id_type, $a_parent_node_id);
38
39        $this->lng = $DIC->language();
40        $this->help = $DIC["ilHelp"];
41        $this->tpl = $DIC["tpl"];
42        $this->user = $DIC->user();
43        $this->tabs = $DIC->tabs();
44        $this->ctrl = $DIC->ctrl();
45    }
46
47    public function getType()
48    {
49        return "wfld";
50    }
51
52    public function setTabs($a_show_settings = true)
53    {
54        $lng = $this->lng;
55        $ilHelp = $this->help;
56
57        $ilHelp->setScreenIdComponent("wfld");
58
59        $this->ctrl->setParameter($this, "wsp_id", $this->node_id);
60
61        $this->tabs_gui->addTab(
62            "wsp",
63            $lng->txt("wsp_tab_personal"),
64            $this->ctrl->getLinkTarget($this, "")
65        );
66
67        $this->ctrl->setParameterByClass(
68            "ilObjWorkspaceRootFolderGUI",
69            "wsp_id",
70            $this->getAccessHandler()->getTree()->getRootId()
71        );
72
73        $this->tabs_gui->addTab(
74            "share",
75            $lng->txt("wsp_tab_shared"),
76            $this->ctrl->getLinkTargetByClass("ilObjWorkspaceRootFolderGUI", "shareFilter")
77        );
78
79        $this->tabs_gui->addTab(
80            "ownership",
81            $lng->txt("wsp_tab_ownership"),
82            $this->ctrl->getLinkTargetByClass(array("ilObjWorkspaceRootFolderGUI", "ilObjectOwnershipManagementGUI"), "listObjects")
83        );
84
85        if (!$this->ctrl->getNextClass($this)) {
86            if (stristr($this->ctrl->getCmd(), "share")) {
87                $this->tabs_gui->activateTab("share");
88            } else {
89                $this->tabs_gui->activateTab("wsp");
90
91                if ($a_show_settings) {
92                    if ($this->checkPermissionBool("read")) {
93                        $this->tabs_gui->addSubTab(
94                            "content",
95                            $lng->txt("content"),
96                            $this->ctrl->getLinkTarget($this, "")
97                        );
98                    }
99
100                    if ($this->checkPermissionBool("write")) {
101                        $this->tabs_gui->addSubTab(
102                            "settings",
103                            $lng->txt("settings"),
104                            $this->ctrl->getLinkTarget($this, "edit")
105                        );
106                    }
107                }
108            }
109        }
110    }
111
112    public function executeCommand()
113    {
114        $next_class = $this->ctrl->getNextClass($this);
115        $cmd = $this->ctrl->getCmd();
116
117        switch ($next_class) {
118            case "ilcommonactiondispatchergui":
119                include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
120                $gui = ilCommonActionDispatcherGUI::getInstanceFromAjaxCall();
121                $this->ctrl->forwardCommand($gui);
122                break;
123
124            case "ilobjectownershipmanagementgui":
125                $this->prepareOutput();
126                $this->tabs_gui->activateTab("ownership");
127                include_once("Services/Object/classes/class.ilObjectOwnershipManagementGUI.php");
128                $gui = new ilObjectOwnershipManagementGUI();
129                $this->ctrl->forwardCommand($gui);
130                break;
131
132            default:
133                $this->prepareOutput();
134                if ($this->type != "wsrt") {
135                    $this->addHeaderAction();
136                }
137                if (!$cmd) {
138                    $cmd = "render";
139                }
140                $this->$cmd();
141                break;
142        }
143
144        return true;
145    }
146
147    protected function initCreationForms($a_new_type)
148    {
149        $forms = array(
150            self::CFORM_NEW => $this->initCreateForm($a_new_type)
151            );
152
153        return $forms;
154    }
155
156    /**
157    * Render folder
158    */
159    public function render()
160    {
161        $tpl = $this->tpl;
162        $ilUser = $this->user;
163        $ilTabs = $this->tabs;
164        $ilCtrl = $this->ctrl;
165
166        unset($_SESSION['clipboard']['wsp2repo']);
167
168        // add new item
169        include_once "Services/Object/classes/class.ilObjectAddNewItemGUI.php";
170        $gui = new ilObjectAddNewItemGUI($this->node_id);
171        $gui->setMode(ilObjectDefinition::MODE_WORKSPACE);
172        $gui->setCreationUrl($ilCtrl->getLinkTarget($this, "create"));
173        $gui->render();
174
175        include_once "Services/Object/classes/class.ilObjectListGUI.php";
176        ilObjectListGUI::prepareJsLinks(
177            "",
178            $this->ctrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "ilnotegui"), "", "", true, false),
179            $this->ctrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "iltagginggui"), "", "", true, false)
180        );
181
182        include_once "Modules/WorkspaceFolder/classes/class.ilObjWorkspaceFolderTableGUI.php";
183        $table = new ilObjWorkspaceFolderTableGUI($this, "render", $this->node_id, $this->getAccessHandler());
184        $tpl->setContent($table->getHTML());
185
186        include_once("./Services/PersonalWorkspace/classes/class.ilWorkspaceExplorerGUI.php");
187        $exp = new ilWorkspaceExplorerGUI($ilUser->getId(), $this, "render", $this, "", "wsp_id");
188        $exp->setTypeWhiteList(array("wsrt", "wfld"));
189        $exp->setSelectableTypes(array("wsrt", "wfld"));
190        $exp->setLinkToNodeClass(true);
191        $exp->setActivateHighlighting(true);
192        if ($exp->handleCommand()) {
193            return;
194        }
195        $left = $exp->getHTML();
196
197        $tpl->setLeftNavContent($left);
198    }
199
200    public function edit()
201    {
202        parent::edit();
203
204        $this->tabs_gui->activateTab("wsp");
205        $this->tabs_gui->activateSubTab("settings");
206    }
207
208    public function update()
209    {
210        parent::update();
211
212        $this->tabs_gui->activateTab("wsp");
213        $this->tabs_gui->activateSubTab("settings");
214    }
215
216    /**
217     * Move node preparation
218     *
219     * cut object(s) out from a container and write the information to clipboard
220     */
221    public function cut()
222    {
223        if (!$_REQUEST["item_ref_id"]) {
224            ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
225            $this->ctrl->redirect($this);
226        }
227
228        $current_node = $_REQUEST["item_ref_id"];
229        $parent_node = $this->tree->getParentId($current_node);
230
231        // on cancel or fail we return to parent node
232        $this->ctrl->setParameter($this, "wsp_id", $parent_node);
233
234        // check permission
235        $no_cut = array();
236        foreach ($this->tree->getSubTree($this->tree->getNodeData($current_node)) as $node) {
237            if (!$this->checkPermissionBool("delete", "", "", $node["wsp_id"])) {
238                $obj = ilObjectFactory::getInstanceByObjId($node["obj_id"]);
239                $no_cut[$node["wsp_id"]] = $obj->getTitle();
240                unset($obj);
241            }
242        }
243        if (count($no_cut)) {
244            ilUtil::sendFailure($this->lng->txt("msg_no_perm_cut") . " " . implode(',', $no_cut), true);
245            $this->ctrl->redirect($this);
246        }
247
248        // open current position
249        // using the explorer session storage directly is basically a hack
250        // as we do not use setExpanded() [see below]
251        $_SESSION['paste_cut_wspexpand'] = array();
252        foreach ((array) $this->tree->getPathId($parent_node) as $node_id) {
253            $_SESSION['paste_cut_wspexpand'][] = $node_id;
254        }
255
256        // remember source node
257        $_SESSION['clipboard']['source_id'] = $current_node;
258        $_SESSION['clipboard']['cmd'] = 'cut';
259
260        return $this->showMoveIntoObjectTree();
261    }
262
263    /**
264     * Move node preparation (to repository)
265     *
266     * cut object(s) out from a container and write the information to clipboard
267     */
268    public function cut_for_repository()
269    {
270        $_SESSION['clipboard']['wsp2repo'] = true;
271        $this->cut();
272    }
273
274    /**
275     * Copy node preparation
276     *
277     * cioy object(s) out from a container and write the information to clipboard
278     */
279    public function copy()
280    {
281        $ilUser = $this->user;
282
283        if (!$_REQUEST["item_ref_id"]) {
284            ilUtil::sendFailure($this->lng->txt("no_checkbox"), true);
285            $this->ctrl->redirect($this);
286        }
287
288        $current_node = $_REQUEST["item_ref_id"];
289        $owner = $this->tree->lookupOwner($current_node);
290        if ($owner == $ilUser->getId()) {
291            $parent_node = $this->tree->getParentId($current_node);
292
293            // on cancel or fail we return to parent node
294            $this->ctrl->setParameter($this, "wsp_id", $parent_node);
295
296            // open current position
297            // using the explorer session storage directly is basically a hack
298            // as we do not use setExpanded() [see below]
299            $_SESSION['paste_copy_wspexpand'] = array();
300            foreach ((array) $this->tree->getPathId($parent_node) as $node_id) {
301                $_SESSION['paste_copy_wspexpand'][] = $node_id;
302            }
303        } else {
304            // see copyShared()
305            ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
306            $this->ctrl->redirect($this);
307        }
308
309        // remember source node
310        $_SESSION['clipboard']['source_id'] = $current_node;
311        $_SESSION['clipboard']['cmd'] = 'copy';
312
313        return $this->showMoveIntoObjectTree();
314    }
315
316    public function copyShared()
317    {
318        if (!$_REQUEST["item_ref_id"]) {
319            $this->ctrl->redirect($this, "share");
320        }
321
322        $current_node = $_REQUEST["item_ref_id"];
323        $handler = $this->getAccessHandler();
324
325        // see ilSharedRessourceGUI::hasAccess()
326        if ($handler->checkAccess("read", "", $current_node)) {
327            // remember source node
328            $_SESSION['clipboard']['source_id'] = $current_node;
329            $_SESSION['clipboard']['cmd'] = 'copy';
330            $_SESSION['clipboard']['shared'] = true;
331
332            return $this->showMoveIntoObjectTree();
333        } else {
334            $perms = $handler->getPermissions($current_node);
335            if (in_array(ilWorkspaceAccessGUI::PERMISSION_ALL_PASSWORD, $perms)) {
336                return $this->passwordForm($current_node);
337            }
338        }
339
340        ilUtil::sendFailure($this->lng->txt('permission_denied'), true);
341        $this->ctrl->redirect($this, "share");
342    }
343
344    /**
345     * Copy node preparation (to repository)
346     *
347     * copy object(s) out from a container and write the information to clipboard
348     */
349    public function copy_to_repository()
350    {
351        $_SESSION['clipboard']['wsp2repo'] = true;
352        $this->copy();
353    }
354
355    /**
356     * Move node: select target (via explorer)
357     */
358    public function showMoveIntoObjectTree()
359    {
360        $ilTabs = $this->tabs;
361        $tree = $this->tree;
362
363        $ilTabs->clearTargets();
364
365        if (!$_SESSION['clipboard']['shared']) {
366            $ilTabs->setBackTarget(
367                $this->lng->txt('back'),
368                $this->ctrl->getLinkTarget($this)
369            );
370        } else {
371            $ilTabs->setBackTarget(
372                $this->lng->txt('back'),
373                $this->ctrl->getLinkTarget($this, 'share')
374            );
375        }
376
377        $mode = $_SESSION['clipboard']['cmd'];
378
379        ilUtil::sendInfo($this->lng->txt('msg_' . $mode . '_clipboard'));
380
381        $this->tpl->addBlockfile(
382            'ADM_CONTENT',
383            'adm_content',
384            'tpl.paste_into_multiple_objects.html',
385            "Services/Object"
386        );
387
388        // move/copy in personal workspace
389        if (!$_SESSION['clipboard']['wsp2repo']) {
390            include_once("./Services/PersonalWorkspace/classes/class.ilWorkspaceExplorerGUI.php");
391            $exp = new ilWorkspaceExplorerGUI($this->user->getId(), $this, "showMoveIntoObjectTree", $this, "");
392            $exp->setTypeWhiteList(array("wsrt", "wfld"));
393            $exp->setSelectableTypes(array("wsrt", "wfld"));
394            $exp->setSelectMode("node", false);
395            if ($exp->handleCommand()) {
396                return;
397            }
398            $this->tpl->setVariable('OBJECT_TREE', $exp->getHTML());
399        }
400        // move/copy to repository
401        else {
402            require_once './Services/Object/classes/class.ilPasteIntoMultipleItemsExplorer.php';
403            $exp = new ilPasteIntoMultipleItemsExplorer(
404                ilPasteIntoMultipleItemsExplorer::SEL_TYPE_RADIO,
405                '',
406                'paste_' . $mode . '_repexpand'
407            );
408            $exp->setTargetGet('ref_id');
409
410            if ($_GET['paste_' . $mode . '_repexpand'] == '') {
411                $expanded = $tree->readRootId();
412            } else {
413                $expanded = $_GET['paste_' . $mode . '_repexpand'];
414            }
415            $exp->setCheckedItems(array((int) $_POST['node']));
416            $exp->setExpandTarget($this->ctrl->getLinkTarget($this, 'showMoveIntoObjectTree'));
417            $exp->setPostVar('node');
418            $exp->setExpand($expanded);
419            $exp->setOutput(0);
420            $this->tpl->setVariable('OBJECT_TREE', $exp->getOutput());
421        }
422
423
424        unset($exp);
425
426        $this->tpl->setVariable('FORM_TARGET', '_top');
427        $this->tpl->setVariable(
428            'FORM_ACTION',
429            $this->ctrl->getFormAction($this, 'performPasteIntoMultipleObjects')
430        );
431
432        $this->tpl->setVariable('CMD_SUBMIT', 'performPasteIntoMultipleObjects');
433        $this->tpl->setVariable('TXT_SUBMIT', $this->lng->txt('paste'));
434    }
435
436    /**
437     * Move node: target has been selected, execute
438     */
439    public function performPasteIntoMultipleObjects()
440    {
441        $ilUser = $this->user;
442
443        $mode = $_SESSION['clipboard']['cmd'];
444        $source_node_id = $_SESSION['clipboard']['source_id'];
445        $target_node_id = $_REQUEST['node'];
446
447        if (!$source_node_id) {
448            ilUtil::sendFailure($this->lng->txt('select_at_least_one_object'), true);
449            $this->ctrl->redirect($this);
450        }
451        if (!$target_node_id) {
452            ilUtil::sendFailure($this->lng->txt('select_at_least_one_object'), true);
453            $this->ctrl->redirect($this, "showMoveIntoObjectTree");
454        }
455
456        // object instances
457        $source_obj_id = $this->tree->lookupObjectId($source_node_id);
458        $source_object = ilObjectFactory::getInstanceByObjId($source_obj_id);
459
460        if (!$_SESSION['clipboard']['wsp2repo']) {
461            $target_obj_id = $this->tree->lookupObjectId($target_node_id);
462        } else {
463            $target_obj_id = ilObject::_lookupObjId($target_node_id);
464        }
465        $target_object = ilObjectFactory::getInstanceByObjId($target_obj_id);
466
467
468        // sanity checks
469
470        $fail = array();
471
472        if ($source_node_id == $target_node_id) {
473            $fail[] = sprintf(
474                $this->lng->txt('msg_obj_exists_in_folder'),
475                $source_object->getTitle(),
476                $target_object->getTitle()
477            );
478        }
479
480        if (!in_array($source_object->getType(), array_keys($target_object->getPossibleSubObjects()))) {
481            $fail[] = sprintf(
482                $this->lng->txt('msg_obj_may_not_contain_objects_of_type'),
483                $target_object->getTitle(),
484                $source_object->getType()
485            );
486        }
487
488        // if object is shared permission to copy has been checked above
489        $owner = $this->tree->lookupOwner($source_node_id);
490        if ($mode == "copy" && $ilUser->getId() == $owner && !$this->checkPermissionBool('copy', '', '', $source_node_id)) {
491            $fail[] = $this->lng->txt('permission_denied');
492        }
493
494        if (!$_SESSION['clipboard']['wsp2repo']) {
495            if ($mode == "cut" && $this->tree->isGrandChild($source_node_id, $target_node_id)) {
496                $fail[] = sprintf(
497                    $this->lng->txt('msg_paste_object_not_in_itself'),
498                    $source_object->getTitle()
499                );
500            }
501        }
502
503        if ($_SESSION['clipboard']['wsp2repo'] == true) {		// see #22959
504            global $ilAccess;
505            if (!$ilAccess->checkAccess("create", "", $target_node_id, $source_object->getType())) {
506                $fail[] = sprintf(
507                    $this->lng->txt('msg_no_perm_paste_object_in_folder'),
508                    $source_object->getTitle(),
509                    $target_object->getTitle()
510                );
511            }
512        } else {
513            if (!$this->checkPermissionBool('create', '', $source_object->getType(), $target_node_id)) {
514                $fail[] = sprintf(
515                    $this->lng->txt('msg_no_perm_paste_object_in_folder'),
516                    $source_object->getTitle(),
517                    $target_object->getTitle()
518                );
519            }
520        }
521
522        if (sizeof($fail)) {
523            ilUtil::sendFailure(implode("<br />", $fail), true);
524            $this->ctrl->redirect($this);
525        }
526
527
528        // move the node
529        if ($mode == "cut") {
530            if (!$_SESSION['clipboard']['wsp2repo']) {
531                $this->tree->moveTree($source_node_id, $target_node_id);
532            } else {
533                $parent_id = $this->tree->getParentId($source_node_id);
534
535                // remove from personal workspace
536                $this->getAccessHandler()->removePermission($source_node_id);
537                $this->tree->deleteReference($source_node_id);
538                $source_node = $this->tree->getNodeData($source_node_id);
539                $this->tree->deleteTree($source_node);
540
541                // add to repository
542                $source_object->createReference();
543                $source_object->putInTree($target_node_id);
544                $source_object->setPermissions($target_node_id);
545
546                $source_node_id = $parent_id;
547            }
548        }
549        // copy the node
550        elseif ($mode == "copy") {
551            include_once('Services/CopyWizard/classes/class.ilCopyWizardOptions.php');
552            $copy_id = ilCopyWizardOptions::_allocateCopyId();
553            $wizard_options = ilCopyWizardOptions::_getInstance($copy_id);
554
555            if (!$_SESSION['clipboard']['wsp2repo']) {
556                $wizard_options->disableTreeCopy();
557            }
558            $wizard_options->saveOwner($ilUser->getId());
559            $wizard_options->saveRoot($source_node_id);
560            $wizard_options->read();
561
562            $new_obj = $source_object->cloneObject($target_node_id, $copy_id);
563
564            // insert into workspace tree
565            if ($new_obj && !$_SESSION['clipboard']['wsp2repo']) {
566                $new_obj_node_id = $this->tree->insertObject($target_node_id, $new_obj->getId());
567                $this->getAccessHandler()->setPermissions($target_node_id, $new_obj_node_id);
568            }
569
570            $wizard_options->deleteAll();
571        }
572
573        // redirect to target if not repository
574        if (!$_SESSION['clipboard']['wsp2repo']) {
575            $redirect_node = $target_node_id;
576        } else {
577            // reload current folder
578            $redirect_node = $this->node_id;
579        }
580
581        unset($_SESSION['clipboard']['cmd']);
582        unset($_SESSION['clipboard']['source_id']);
583        unset($_SESSION['clipboard']['wsp2repo']);
584        unset($_SESSION['clipboard']['shared']);
585
586        // #17746
587        if ($mode == 'cut') {
588            ilUtil::sendSuccess($this->lng->txt('msg_cut_copied'), true);
589        } else {
590            ilUtil::sendSuccess($this->lng->txt('msg_cloned'), true);
591        }
592
593        $this->ctrl->setParameter($this, "wsp_id", $redirect_node);
594        $this->ctrl->redirect($this);
595    }
596
597    public function shareFilter()
598    {
599        $this->share(false);
600    }
601
602    public function share($a_load_data = true)
603    {
604        $tpl = $this->tpl;
605
606        include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceShareTableGUI.php";
607        $tbl = new ilWorkspaceShareTableGUI($this, "share", $this->getAccessHandler(), $this->node_id, $a_load_data);
608        $tpl->setContent($tbl->getHTML());
609    }
610
611    public function applyShareFilter()
612    {
613        include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceShareTableGUI.php";
614        $tbl = new ilWorkspaceShareTableGUI($this, "share", $this->getAccessHandler(), $this->node_id);
615        $tbl->resetOffset();
616        $tbl->writeFilterToSession();
617
618        $this->share();
619    }
620
621    public function resetShareFilter()
622    {
623        include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceShareTableGUI.php";
624        $tbl = new ilWorkspaceShareTableGUI($this, "share", $this->getAccessHandler(), $this->node_id);
625        $tbl->resetOffset();
626        $tbl->resetFilter();
627
628        $this->shareFilter();
629    }
630
631    protected function passwordForm($a_node_id, $form = null)
632    {
633        $tpl = $this->tpl;
634        $lng = $this->lng;
635        $ilTabs = $this->tabs;
636
637        $tpl->setTitle($lng->txt("wsp_password_protected_resource"));
638        $tpl->setDescription($lng->txt("wsp_password_protected_resource_info"));
639
640        $ilTabs->clearTargets();
641        $ilTabs->setBackTarget(
642            $lng->txt("back"),
643            $this->ctrl->getLinkTarget($this, "share")
644        );
645
646        if (!$form) {
647            $form = $this->initPasswordForm($a_node_id);
648        }
649
650        $tpl->setContent($form->getHTML());
651    }
652
653    protected function initPasswordForm($a_node_id)
654    {
655        $ilCtrl = $this->ctrl;
656        $lng = $this->lng;
657
658        $this->ctrl->setParameter($this, "item_ref_id", $a_node_id);
659
660        $object_data = $this->getAccessHandler()->getObjectDataFromNode($a_node_id);
661
662        include_once "Services/Form/classes/class.ilPropertyFormGUI.php";
663        $form = new ilPropertyFormGUI();
664        $form->setFormAction($ilCtrl->getFormAction($this, "checkPassword"));
665        $form->setTitle($lng->txt("wsp_password_for") . ": " . $object_data["title"]);
666
667        $password = new ilPasswordInputGUI($lng->txt("password"), "password");
668        $password->setRetype(false);
669        $password->setRequired(true);
670        $password->setSkipSyntaxCheck(true);
671        $form->addItem($password);
672
673        $form->addCommandButton("checkPassword", $lng->txt("submit"));
674        $form->addCommandButton("share", $lng->txt("cancel"));
675
676        return $form;
677    }
678
679    protected function checkPassword()
680    {
681        $lng = $this->lng;
682
683        $node_id = $_REQUEST["item_ref_id"];
684        if (!$node_id) {
685            $this->ctrl->redirect($this, "share");
686        }
687
688        $form = $this->initPasswordForm($node_id);
689        if ($form->checkInput()) {
690            include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
691            $password = ilWorkspaceAccessHandler::getSharedNodePassword($node_id);
692            $input = md5($form->getInput("password"));
693            if ($input == $password) {
694                // we save password and start over
695                ilWorkspaceAccessHandler::keepSharedSessionPassword($node_id, $input);
696
697                $this->ctrl->setParameter($this, "item_ref_id", $node_id);
698                $this->ctrl->redirect($this, "copyShared");
699            } else {
700                $item = $form->getItemByPostVar("password");
701                $item->setAlert($lng->txt("wsp_invalid_password"));
702                ilUtil::sendFailure($lng->txt("form_input_not_valid"));
703            }
704        }
705
706        $form->setValuesByPost();
707        $this->passwordForm($node_id, $form);
708    }
709
710    /**
711     * Deep link
712     *
713     * @param string $a_target
714     */
715    public static function _goto($a_target)
716    {
717        $id = explode("_", $a_target);
718
719        $_GET["baseClass"] = "ilsharedresourceGUI";
720        $_GET["wsp_id"] = $id[0];
721        include("ilias.php");
722        exit;
723    }
724
725    /**
726     * Entry point for awareness tool
727     */
728    public function listSharedResourcesOfOtherUser()
729    {
730        $ilCtrl = $this->ctrl;
731
732        include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceShareTableGUI.php";
733        $tbl = new ilWorkspaceShareTableGUI($this, "share", $this->getAccessHandler(), $this->node_id);
734        $tbl->resetOffset();
735        $tbl->resetFilter();
736        $_POST["user"] = $_GET["user"];
737        $tbl->writeFilterToSession();
738        $this->share();
739    }
740}
741