4 require_once
"./Services/Object/classes/class.ilObject2GUI.php";
5 require_once
"./Modules/File/classes/class.ilObjFile.php";
6 require_once
"./Modules/File/classes/class.ilObjFileAccess.php";
36 $next_class = $this->ctrl->getNextClass($this);
37 $cmd = $this->ctrl->getCmd();
42 if(IS_PAYMENT_ENABLED)
44 include_once
'./Services/Payment/classes/class.ilPaymentObject.php';
45 if(ANONYMOUS_USER_ID == $ilUser->getId() && isset(
$_GET[
'transaction']))
47 $transaction =
$_GET[
'transaction'];
48 include_once
'./Services/Payment/classes/class.ilPaymentBookings.php';
53 ?
$_GET[
'purchasetype'] : NULL) ))
56 $this->tpl->getStandardTemplate();
58 include_once
'./Services/Payment/classes/class.ilShopPurchaseGUI.php';
60 $ret = $this->ctrl->forwardCommand($pp);
64 else if($this->id_type == self::REPOSITORY_NODE_ID
67 $ilCtrl->setParameterByClass(
"ilrepositorygui",
"ref_id", $this->node_id);
68 $link = $ilCtrl->getLinkTargetByClass(
"ilrepositorygui",
"infoScreen");
69 $ilCtrl->setParameterByClass(
"ilrepositorygui",
"ref_id",
$_GET[
"ref_id"]);
72 $ilNavigationHistory->addItem($this->node_id,
81 case "ilinfoscreengui":
88 $ilErr->raiseError($this->lng->txt(
'permission_denied'),$ilErr->WARNING);
91 $ilTabs->activateTab(
"id_meta");
93 include_once
'Services/MetaData/classes/class.ilMDEditorGUI.php';
95 $md_gui =&
new ilMDEditorGUI($this->object->getId(), 0, $this->
object->getType());
96 $md_gui->
addObserver($this->
object,
'MDUpdateListener',
'General');
99 $md_gui->addObserver($this->
object,
'MDUpdateListener',
'Technical');
101 $this->ctrl->forwardCommand($md_gui);
105 case 'ilpermissiongui':
106 $ilTabs->activateTab(
"id_permissions");
107 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
109 $ret =& $this->ctrl->forwardCommand($perm_gui);
113 $ilTabs->activateTab(
"export");
114 include_once(
"./Services/Export/classes/class.ilExportGUI.php");
116 $exp_gui->addFormat(
"xml");
117 $ret = $this->ctrl->forwardCommand($exp_gui);
120 case 'ilobjectcopygui':
121 include_once
'./Services/Object/classes/class.ilObjectCopyGUI.php';
123 $cp->setType(
'file');
124 $this->ctrl->forwardCommand($cp);
128 case "ilworkspaceaccessgui";
129 $ilTabs->activateTab(
"id_permissions");
130 include_once(
'./Services/PersonalWorkspace/classes/class.ilWorkspaceAccessGUI.php');
132 $this->ctrl->forwardCommand($wspacc);
136 case "ilcommonactiondispatchergui":
137 include_once(
"Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
139 $this->ctrl->forwardCommand($gui);
144 if($this->id_type == self::WORKSPACE_NODE_ID)
151 $ilCtrl->setCmd(
"infoScreen");
153 $ilTabs->clearTargets();
176 if($this->id_type != self::WORKSPACE_NODE_ID)
191 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
193 $single_form_gui->setMultipart(
true);
197 $in_title->
setInfo($this->lng->txt(
"if_no_title_then_filename"));
198 $in_title->setMaxLength(128);
199 $in_title->setSize(40);
200 $single_form_gui->addItem($in_title);
204 $single_form_gui->addItem($in_descr);
209 $single_form_gui->addItem($in_file);
211 $single_form_gui->addCommandButton(
"save", $this->lng->txt($this->type.
"_add"));
212 $single_form_gui->addCommandButton(
"saveAndMeta", $this->lng->txt(
"file_add_and_metadata"));
213 $single_form_gui->addCommandButton(
"cancel", $lng->txt(
"cancel"));
215 $single_form_gui->setTableWidth(
"600px");
217 $single_form_gui->setTitle($this->lng->txt($this->type.
"_new"));
218 $single_form_gui->setTitleIcon(
ilUtil::getImagePath(
'icon_file.png'), $this->lng->txt(
'obj_file'));
220 $this->ctrl->setParameter($this,
"new_type",
"file");
222 $single_form_gui->setFormAction($this->ctrl->getFormAction($this,
"save"));
224 return $single_form_gui;
238 $this->ilErr->raiseError($this->lng->txt(
"permission_denied"),$this->ilErr->MESSAGE);
243 if ($single_form_gui->checkInput())
245 $title = $single_form_gui->getInput(
"title");
246 $description = $single_form_gui->getInput(
"description");
247 $upload_file = $single_form_gui->getInput(
"upload_file");
251 $title = $upload_file[
"name"];
258 if ($titleExtension != $fileExtension && strlen($fileExtension) > 0)
260 $title .=
'.'.$fileExtension;
266 include_once(
"./Modules/File/classes/class.ilObjFile.php");
268 $fileObj->setTitle(
$title);
269 $fileObj->setDescription($description);
270 $fileObj->setFileName($upload_file[
"name"]);
272 include_once(
"./Services/Utilities/classes/class.ilMimeTypeUtil.php");
274 "", $upload_file[
"name"], $upload_file[
"type"]));
275 $fileObj->setFileSize($upload_file[
"size"]);
276 $this->object_id = $fileObj->create();
281 $fileObj->createDirectory();
282 $fileObj->getUploadFile($upload_file[
"tmp_name"],
283 $upload_file[
"name"]);
286 require_once(
'Services/Tracking/classes/class.ilChangeEvent.php');
292 if ($this->ctrl->getCmd() ==
"saveAndMeta")
294 $this->ctrl->setParameter($this,
"new_type",
"");
295 $target = $this->ctrl->getLinkTargetByClass(array(
"ilobjfilegui",
"ilmdeditorgui"),
"listSection",
"",
false,
false);
300 $this->ctrl->returnToParent($this);
305 $single_form_gui->setValuesByPost();
306 $this->tpl->setContent($single_form_gui->getHTML());
327 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
329 $zip_form_gui->setMultipart(
true);
334 $in_file->setSuffixes(array(
"zip"));
335 $zip_form_gui->addItem($in_file);
338 $in_str =
new ilCheckboxInputGUI($this->lng->txt(
"take_over_structure"),
"adopt_structure");
339 $in_str->
setInfo($this->lng->txt(
"take_over_structure_info"));
340 $zip_form_gui->addItem($in_str);
342 $zip_form_gui->addCommandButton(
"saveUnzip", $this->lng->txt($this->type.
"_add"));
343 $zip_form_gui->addCommandButton(
"cancel", $lng->txt(
"cancel"));
345 $zip_form_gui->setTableWidth(
"600px");
347 $zip_form_gui->setTitle($this->lng->txt(
"header_zip"));
348 $zip_form_gui->setTitleIcon(
ilUtil::getImagePath(
'icon_file.png'), $this->lng->txt(
'obj_file'));
350 $this->ctrl->setParameter($this,
"new_type",
"file");
352 $zip_form_gui->setFormAction($this->ctrl->getFormAction($this,
"saveUnzip"));
354 return $zip_form_gui;
368 if ($zip_form_gui->checkInput())
370 $zip_file = $zip_form_gui->getInput(
"zip_file");
371 $adopt_structure = $zip_form_gui->getInput(
"adopt_structure");
373 include_once (
"Services/Utilities/classes/class.ilFileUtils.php");
380 if($this->id_type != self::WORKSPACE_NODE_ID)
397 $containerType =
"WorkspaceFolder";
406 $containerType =
"Category";
412 $containerType =
"Folder";
425 $zip_file[
"tmp_name"],
426 ($adopt_structure && $permission),
439 $this->ctrl->returnToParent($this);
443 $zip_form_gui->setValuesByPost();
444 $this->tpl->setContent($zip_form_gui->getHTML());
449 $this->ilErr->raiseError($this->lng->txt(
"permission_denied"),$this->ilErr->MESSAGE);
463 if(!$form->checkInput())
465 $ilTabs->activateTab(
"settings");
466 $form->setValuesByPost();
467 $this->tpl->setContent($form->getHTML());
471 $data = $form->getInput(
'file');
474 while (substr(
$data[
"name"],-1) ==
'/')
480 $title = $form->getInput(
'title');
481 if(strlen(trim(
$title)) == 0)
489 $this->
object->setTitle(
$title);
491 if (!empty(
$data[
"name"]))
493 switch($form->getInput(
'replace'))
496 $this->
object->deleteVersions();
497 $this->
object->clearDataDirectory();
498 $this->
object->replaceFile(
$data[
'tmp_name'],
$data[
'name']);
501 $this->
object->addFileVersion(
$data[
'tmp_name'],
$data[
'name']);
504 $this->
object->setFileName(
$data[
'name']);
505 include_once(
"./Services/Utilities/classes/class.ilMimeTypeUtil.php");
508 $this->
object->setFileSize(
$data[
'size']);
510 $this->
object->setDescription($form->getInput(
'description'));
511 $this->
update = $this->
object->update();
514 if (!empty(
$data[
"name"]))
516 require_once(
'Services/Tracking/classes/class.ilChangeEvent.php');
524 include_once
'Modules/File/classes/class.ilECSFileSettings.php';
526 $ecs->handleSettingsUpdate();
543 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"));
546 $ilTabs->activateTab(
"settings");
551 $val[
'title'] = $this->
object->getTitle();
552 $val[
'description'] = $this->
object->getLongDescription();
553 $form->setValuesByArray($val);
556 include_once
'Modules/File/classes/class.ilECSFileSettings.php';
558 $ecs->addSettingsToForm($form,
'file');
560 $this->tpl->setContent($form->getHTML());
571 include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
573 $this->lng->loadLanguageModule(
'file');
576 $form->setFormAction($this->ctrl->getFormAction($this),
'update');
577 $form->setTitle($this->lng->txt(
'file_edit'));
578 $form->addCommandButton(
'update',$this->lng->txt(
'save'));
579 $form->addCommandButton(
'cancel',$this->lng->txt(
'cancel'));
582 $title->setValue($this->object->getTitle());
583 $title->setInfo($this->lng->txt(
"if_no_title_then_filename"));
587 $file->setRequired(
false);
589 $form->addItem(
$file);
594 $replace =
new ilRadioOption($this->lng->txt(
'replace_file'),1);
595 $replace->
setInfo($this->lng->txt(
'replace_file_info'));
596 $group->addOption($replace);
599 $keep =
new ilRadioOption($this->lng->txt(
'file_new_version'),0);
600 $keep->
setInfo($this->lng->txt(
'file_new_version_info'));
601 $group->addOption($keep);
603 $file->addSubItem($group);
608 $form->addItem($desc);
617 if(ANONYMOUS_USER_ID == $ilUser->getId() && isset(
$_GET[
'transaction']) )
619 $this->
object->sendFile(
$_GET[
"hist_id"]);
625 require_once(
'Services/Tracking/classes/class.ilChangeEvent.php');
629 $this->
object->getId(), $ilUser->getId());
632 $this->
object->sendFile(
$_GET[
"hist_id"]);
636 $this->ilErr->raiseError($this->lng->txt(
"permission_denied"),$this->ilErr->MESSAGE);
651 $ilTabs->activateTab(
"id_versions");
655 $this->ilErr->raiseError($this->lng->txt(
"permission_denied"),$this->ilErr->MESSAGE);
658 require_once(
"./Services/History/classes/class.ilHistoryGUI.php");
665 array(
"ref_id" => $this->node_id,
"cmd" =>
"versions",
666 "cmdClass" =>
$_GET[
"cmdClass"],
"cmdNode" =>
$_GET[
"cmdNode"]));
668 $this->tpl->setVariable(
"ADM_CONTENT", $hist_html);
678 $this->ctrl->setCmd(
"showSummary");
679 $this->ctrl->setCmdClass(
"ilinfoscreengui");
690 $ilTabs->activateTab(
"id_info");
694 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_read"));
697 include_once(
"./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
703 $this->lng->loadLanguageModule(
"file");
704 $info->addButton($this->lng->txt(
"file_download"), $this->ctrl->getLinkTarget($this,
"sendfile"));
707 $info->enablePrivateNotes();
715 $info->enableNewsEditing(
false);
719 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
721 if ($enable_internal_rss)
723 $info->setBlockProperty(
"news",
"settings",
true);
724 $info->setBlockProperty(
"news",
"public_notifications_option",
true);
730 $info->addMetaDataSections($this->object->getId(),0, $this->
object->getType());
732 $info->addSection($this->lng->txt(
"file_info"));
733 $info->addProperty($this->lng->txt(
"filename"),
734 $this->
object->getFileName());
736 $info->addProperty($this->lng->txt(
"type"),
737 $this->
object->guessFileType());
739 $info->addProperty($this->lng->txt(
"size"),
741 $info->addProperty($this->lng->txt(
"version"),
742 $this->
object->getVersion());
744 include_once
"./Services/History/classes/class.ilHistory.php";
746 $uploader = array_shift($uploader);
747 $uploader = $uploader[
"user_id"];
749 $this->lng->loadLanguageModule(
"file");
750 include_once
"Services/User/classes/class.ilUserUtil.php";
753 if($this->id_type == self::WORKSPACE_NODE_ID)
761 $this->ctrl->forwardCommand($info);
768 global $ilTabs,
$lng, $ilHelp;
770 $ilHelp->setScreenIdComponent(
"file");
772 $this->ctrl->setParameter($this,
"ref_id",$this->node_id);
776 $ilTabs->addTab(
"id_info",
777 $lng->txt(
"info_short"),
778 $this->ctrl->getLinkTargetByClass(array(
"ilobjfilegui",
"ilinfoscreengui"),
"showSummary"));
783 $ilTabs->addTab(
"settings",
785 $this->ctrl->getLinkTarget($this,
"edit"));
790 $ilTabs->addTab(
"id_versions",
791 $lng->txt(
"versions"),
792 $this->ctrl->getLinkTarget($this,
"versions"));
798 $ilTabs->addTab(
"id_meta",
799 $lng->txt(
"meta_data"),
800 $this->ctrl->getLinkTargetByClass(array(
'ilobjfilegui',
'ilmdeditorgui'),
'listSection'));
806 $ilTabs->addTab(
"export",
808 $this->ctrl->getLinkTargetByClass(
"ilexportgui",
""));
815 function _goto($a_target, $a_additional = null)
819 if($a_additional && substr($a_additional, -3) ==
"wsp")
821 $_GET[
"baseClass"] =
"ilsharedresourceGUI";
822 $_GET[
"wsp_id"] = $a_target;
823 include(
"ilias.php");
829 if ($ilAccess->checkAccess(
"visible",
"", $a_target))
833 else if ($ilAccess->checkAccess(
"read",
"", ROOT_FOLDER_ID))
840 $ilErr->raiseError($lng->txt(
"msg_no_perm_read"), $ilErr->FATAL);
850 if (is_object($this->
object))
852 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this,
""),
"",
$this->node_id);