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";
34 global $ilNavigationHistory,
$ilCtrl, $ilUser, $ilTabs;
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
68 $ilNavigationHistory->addItem($this->node_id,
69 "repository.php?cmd=infoScreen&ref_id=".$this->node_id,
"file");
77 case "ilinfoscreengui":
82 $ilTabs->activateTab(
"id_meta");
84 include_once
'Services/MetaData/classes/class.ilMDEditorGUI.php';
86 $md_gui =&
new ilMDEditorGUI($this->object->getId(), 0, $this->
object->getType());
87 $md_gui->
addObserver($this->
object,
'MDUpdateListener',
'General');
90 $md_gui->addObserver($this->
object,
'MDUpdateListener',
'Technical');
92 $this->ctrl->forwardCommand($md_gui);
96 case 'ilpermissiongui':
97 $ilTabs->activateTab(
"id_permissions");
98 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
100 $ret =& $this->ctrl->forwardCommand($perm_gui);
104 $ilTabs->activateTab(
"export");
105 include_once(
"./Services/Export/classes/class.ilExportGUI.php");
107 $exp_gui->addFormat(
"xml");
108 $ret = $this->ctrl->forwardCommand($exp_gui);
111 case 'ilobjectcopygui':
112 include_once
'./Services/Object/classes/class.ilObjectCopyGUI.php';
114 $cp->setType(
'file');
115 $this->ctrl->forwardCommand($cp);
119 case "ilworkspaceaccessgui";
120 $ilTabs->activateTab(
"id_permissions");
121 include_once(
'./Services/PersonalWorkspace/classes/class.ilWorkspaceAccessGUI.php');
123 $this->ctrl->forwardCommand($wspacc);
127 case "ilcommonactiondispatchergui":
128 include_once(
"Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
130 $this->ctrl->forwardCommand($gui);
135 if($this->id_type == self::WORKSPACE_NODE_ID)
142 $ilCtrl->setCmd(
"infoScreen");
144 $ilTabs->clearTargets();
167 if($this->id_type != self::WORKSPACE_NODE_ID)
182 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
184 $single_form_gui->setMultipart(
true);
188 $in_title->
setInfo($this->lng->txt(
"if_no_title_then_filename"));
189 $in_title->setMaxLength(128);
190 $in_title->setSize(40);
191 $single_form_gui->addItem($in_title);
195 $single_form_gui->addItem($in_descr);
200 $single_form_gui->addItem($in_file);
202 $single_form_gui->addCommandButton(
"save", $this->lng->txt($this->type.
"_add"));
203 $single_form_gui->addCommandButton(
"saveAndMeta", $this->lng->txt(
"file_add_and_metadata"));
204 $single_form_gui->addCommandButton(
"cancel", $lng->txt(
"cancel"));
206 $single_form_gui->setTableWidth(
"600px");
208 $single_form_gui->setTitle($this->lng->txt($this->type.
"_new"));
209 $single_form_gui->setTitleIcon(
ilUtil::getImagePath(
'icon_file.gif'), $this->lng->txt(
'obj_file'));
211 $this->ctrl->setParameter($this,
"new_type",
"file");
213 $single_form_gui->setFormAction($this->ctrl->getFormAction($this,
"save"));
215 return $single_form_gui;
229 $this->ilErr->raiseError($this->lng->txt(
"permission_denied"),$this->ilErr->MESSAGE);
234 if ($single_form_gui->checkInput())
236 $title = $single_form_gui->getInput(
"title");
237 $description = $single_form_gui->getInput(
"description");
238 $upload_file = $single_form_gui->getInput(
"upload_file");
242 $title = $upload_file[
"name"];
249 if ($titleExtension != $fileExtension && strlen($fileExtension) > 0)
251 $title .=
'.'.$fileExtension;
257 include_once(
"./Modules/File/classes/class.ilObjFile.php");
259 $fileObj->setTitle(
$title);
260 $fileObj->setDescription($description);
261 $fileObj->setFileName($upload_file[
"name"]);
263 include_once(
"./Services/Utilities/classes/class.ilMimeTypeUtil.php");
265 "", $upload_file[
"name"], $upload_file[
"type"]));
266 $fileObj->setFileSize($upload_file[
"size"]);
267 $this->object_id = $fileObj->create();
272 $fileObj->createDirectory();
273 $fileObj->getUploadFile($upload_file[
"tmp_name"],
274 $upload_file[
"name"]);
277 require_once(
'Services/Tracking/classes/class.ilChangeEvent.php');
283 if ($this->ctrl->getCmd() ==
"saveAndMeta")
285 $this->ctrl->setParameter($this,
"new_type",
"");
286 $target = $this->ctrl->getLinkTargetByClass(array(
"ilobjfilegui",
"ilmdeditorgui"),
"listSection",
"",
false,
false);
291 $this->ctrl->returnToParent($this);
296 $single_form_gui->setValuesByPost();
297 $this->tpl->setContent($single_form_gui->getHTML());
318 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
320 $zip_form_gui->setMultipart(
true);
325 $in_file->setSuffixes(array(
"zip"));
326 $zip_form_gui->addItem($in_file);
329 $in_str =
new ilCheckboxInputGUI($this->lng->txt(
"take_over_structure"),
"adopt_structure");
330 $in_str->
setInfo($this->lng->txt(
"take_over_structure_info"));
331 $zip_form_gui->addItem($in_str);
333 $zip_form_gui->addCommandButton(
"saveUnzip", $this->lng->txt($this->type.
"_add"));
334 $zip_form_gui->addCommandButton(
"cancel", $lng->txt(
"cancel"));
336 $zip_form_gui->setTableWidth(
"600px");
338 $zip_form_gui->setTitle($this->lng->txt(
"header_zip"));
339 $zip_form_gui->setTitleIcon(
ilUtil::getImagePath(
'icon_file.gif'), $this->lng->txt(
'obj_file'));
341 $this->ctrl->setParameter($this,
"new_type",
"file");
343 $zip_form_gui->setFormAction($this->ctrl->getFormAction($this,
"saveUnzip"));
345 return $zip_form_gui;
359 if ($zip_form_gui->checkInput())
361 $zip_file = $zip_form_gui->getInput(
"zip_file");
362 $adopt_structure = $zip_form_gui->getInput(
"adopt_structure");
364 include_once (
"Services/Utilities/classes/class.ilFileUtils.php");
371 if($this->id_type != self::WORKSPACE_NODE_ID)
387 $containerType =
"WorkspaceFolder";
396 $containerType =
"Category";
402 $containerType =
"Folder";
415 $zip_file[
"tmp_name"],
416 ($adopt_structure && $permission),
429 $this->ctrl->returnToParent($this);
433 $zip_form_gui->setValuesByPost();
434 $this->tpl->setContent($zip_form_gui->getHTML());
439 $this->ilErr->raiseError($this->lng->txt(
"permission_denied"),$this->ilErr->MESSAGE);
453 if(!$form->checkInput())
455 $ilTabs->activateTab(
"settings");
456 $form->setValuesByPost();
457 $this->tpl->setContent($form->getHTML());
461 $data = $form->getInput(
'file');
464 while (substr(
$data[
"name"],-1) ==
'/')
470 $title = $form->getInput(
'title');
471 if(strlen(trim(
$title)) == 0)
479 $this->
object->setTitle(
$title);
481 if (!empty(
$data[
"name"]))
483 switch($form->getInput(
'replace'))
486 $this->
object->deleteVersions();
487 $this->
object->clearDataDirectory();
488 $this->
object->replaceFile(
$data[
'tmp_name'],
$data[
'name']);
491 $this->
object->addFileVersion(
$data[
'tmp_name'],
$data[
'name']);
494 $this->
object->setFileName(
$data[
'name']);
495 include_once(
"./Services/Utilities/classes/class.ilMimeTypeUtil.php");
498 $this->
object->setFileSize(
$data[
'size']);
500 $this->
object->setDescription($form->getInput(
'description'));
501 $this->
update = $this->
object->update();
504 if (!empty(
$data[
"name"]))
506 require_once(
'Services/Tracking/classes/class.ilChangeEvent.php');
528 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_write"));
531 $ilTabs->activateTab(
"settings");
536 $val[
'title'] = $this->
object->getTitle();
537 $val[
'description'] = $this->
object->getLongDescription();
538 $form->setValuesByArray($val);
540 $this->tpl->setContent($form->getHTML());
551 include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
553 $this->lng->loadLanguageModule(
'file');
556 $form->setFormAction($this->ctrl->getFormAction($this),
'update');
557 $form->setTitle($this->lng->txt(
'file_edit'));
558 $form->addCommandButton(
'update',$this->lng->txt(
'save'));
559 $form->addCommandButton(
'cancel',$this->lng->txt(
'cancel'));
562 $title->setValue($this->object->getTitle());
563 $title->setInfo($this->lng->txt(
"if_no_title_then_filename"));
567 $file->setRequired(
false);
569 $form->addItem(
$file);
574 $replace =
new ilRadioOption($this->lng->txt(
'replace_file'),1);
575 $replace->
setInfo($this->lng->txt(
'replace_file_info'));
576 $group->addOption($replace);
579 $keep =
new ilRadioOption($this->lng->txt(
'file_new_version'),0);
580 $keep->
setInfo($this->lng->txt(
'file_new_version_info'));
581 $group->addOption($keep);
583 $file->addSubItem($group);
588 $form->addItem($desc);
597 if(ANONYMOUS_USER_ID == $ilUser->getId() && isset(
$_GET[
'transaction']) )
599 $this->
object->sendFile(
$_GET[
"hist_id"]);
605 require_once(
'Services/Tracking/classes/class.ilChangeEvent.php');
609 $this->
object->getId(), $ilUser->getId());
612 $this->
object->sendFile(
$_GET[
"hist_id"]);
616 $this->ilErr->raiseError($this->lng->txt(
"permission_denied"),$this->ilErr->MESSAGE);
631 $ilTabs->activateTab(
"id_versions");
635 $this->ilErr->raiseError($this->lng->txt(
"permission_denied"),$this->ilErr->MESSAGE);
638 require_once(
"classes/class.ilHistoryGUI.php");
643 array(
"ref_id" => $this->node_id,
"cmd" =>
"versions",
644 "cmdClass" =>
$_GET[
"cmdClass"],
"cmdNode" =>
$_GET[
"cmdNode"]),
645 false, array($this,
"getVersionsDownloadLink"));
647 $this->tpl->setVariable(
"ADM_CONTENT", $hist_html);
654 $ilCtrl->setParameter($this,
"hist_id", $a_history_id);
655 $link = $ilCtrl->getLinkTarget($this,
"sendfile");
656 $ilCtrl->setParameter($this,
"hist_id",
"");
668 $this->ctrl->setCmd(
"showSummary");
669 $this->ctrl->setCmdClass(
"ilinfoscreengui");
680 $ilTabs->activateTab(
"id_info");
684 $ilErr->raiseError($this->lng->txt(
"msg_no_perm_read"));
687 include_once(
"./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
692 $info->addButton($this->lng->txt(
"file_read"), $this->ctrl->getLinkTarget($this,
"sendfile"));
695 $info->enablePrivateNotes();
703 $info->enableNewsEditing(
false);
707 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
709 if ($enable_internal_rss)
711 $info->setBlockProperty(
"news",
"settings",
true);
712 $info->setBlockProperty(
"news",
"public_notifications_option",
true);
718 $info->addMetaDataSections($this->object->getId(),0, $this->
object->getType());
720 $info->addSection($this->lng->txt(
"file_info"));
721 $info->addProperty($this->lng->txt(
"filename"),
722 $this->
object->getFileName());
724 $info->addProperty($this->lng->txt(
"type"),
725 $this->
object->guessFileType());
727 $info->addProperty($this->lng->txt(
"size"),
729 $info->addProperty($this->lng->txt(
"version"),
730 $this->
object->getVersion());
732 include_once
"classes/class.ilHistory.php";
734 $uploader = array_shift($uploader);
735 $uploader = $uploader[
"user_id"];
737 $this->lng->loadLanguageModule(
"file");
738 include_once
"Services/User/classes/class.ilUserUtil.php";
741 if($this->id_type == self::WORKSPACE_NODE_ID)
749 $this->ctrl->forwardCommand($info);
756 global $ilTabs,
$lng;
758 $this->ctrl->setParameter($this,
"ref_id",$this->node_id);
762 $ilTabs->addTab(
"id_info",
763 $lng->txt(
"info_short"),
764 $this->ctrl->getLinkTargetByClass(array(
"ilobjfilegui",
"ilinfoscreengui"),
"showSummary"));
769 $ilTabs->addTab(
"settings",
771 $this->ctrl->getLinkTarget($this,
"edit"));
776 $ilTabs->addTab(
"id_versions",
777 $lng->txt(
"versions"),
778 $this->ctrl->getLinkTarget($this,
"versions"));
784 $ilTabs->addTab(
"id_meta",
785 $lng->txt(
"meta_data"),
786 $this->ctrl->getLinkTargetByClass(array(
'ilobjfilegui',
'ilmdeditorgui'),
'listSection'));
792 $ilTabs->addTab(
"export",
794 $this->ctrl->getLinkTargetByClass(
"ilexportgui",
""));
801 function _goto($a_target, $a_additional = null)
805 if($a_additional && substr($a_additional, -3) ==
"wsp")
807 $_GET[
"baseClass"] =
"ilsharedresourceGUI";
808 $_GET[
"wsp_id"] = $a_target;
809 include(
"ilias.php");
815 if ($ilAccess->checkAccess(
"visible",
"", $a_target))
817 $_GET[
"cmd"] =
"infoScreen";
818 $_GET[
"ref_id"] = $a_target;
819 include(
"repository.php");
822 else if ($ilAccess->checkAccess(
"read",
"", ROOT_FOLDER_ID))
824 $_GET[
"cmd"] =
"frameset";
825 $_GET[
"target"] =
"";
826 $_GET[
"ref_id"] = ROOT_FOLDER_ID;
829 include(
"repository.php");
833 $ilErr->raiseError($lng->txt(
"msg_no_perm_read"), $ilErr->FATAL);
843 if (is_object($this->
object))
845 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this,
""),
"",
$this->node_id);