26 require_once
"./classes/class.ilObjectGUI.php";
27 require_once
"./Modules/File/classes/class.ilObjFile.php";
28 require_once
"./Modules/File/classes/class.ilObjFileAccess.php";
46 function ilObjFileGUI($a_data,$a_id,$a_call_by_reference =
true, $a_prepare_output =
true)
49 $this->
ilObjectGUI($a_data,$a_id,$a_call_by_reference,
false);
59 global $ilAccess, $ilNavigationHistory;
63 $ilAccess->checkAccess(
"read",
"",
$_GET[
"ref_id"]))
65 $ilNavigationHistory->addItem(
$_GET[
"ref_id"],
66 "repository.php?cmd=infoScreen&ref_id=".
$_GET[
"ref_id"],
"file");
69 $next_class = $this->ctrl->getNextClass($this);
70 $cmd = $this->ctrl->getCmd();
74 include_once
'payment/classes/class.ilPaymentObject.php';
79 $this->tpl->getStandardTemplate();
81 include_once
'Services/Payment/classes/class.ilShopPurchaseGUI.php';
83 $ret = $this->ctrl->forwardCommand($pp);
96 case "ilinfoscreengui":
100 case 'ilmdeditorgui':
102 include_once
'Services/MetaData/classes/class.ilMDEditorGUI.php';
104 $md_gui =&
new ilMDEditorGUI($this->object->getId(), 0, $this->
object->getType());
105 $md_gui->
addObserver($this->
object,
'MDUpdateListener',
'General');
108 $md_gui->addObserver($this->
object,
'MDUpdateListener',
'Technical');
110 $this->ctrl->forwardCommand($md_gui);
113 case 'ilpermissiongui':
114 include_once(
"./classes/class.ilPermissionGUI.php");
116 $ret =& $this->ctrl->forwardCommand($perm_gui);
143 $new_type = $_POST[
"new_type"] ? $_POST[
"new_type"] :
$_GET[
"new_type"];
145 if (!$rbacsystem->checkAccess(
"create",
$_GET[
"ref_id"], $new_type))
147 $this->ilErr->raiseError($this->lng->txt(
"permission_denied"),$this->ilErr->MESSAGE);
153 if ($a_reload_form !=
"single_upload")
157 $this->tpl->setVariable(
"SINGLE_UPLOAD_FORM", $this->single_form_gui->getHtml());
159 if ($a_reload_form !=
"zip_upload")
164 $this->tpl->setVariable(
"ZIP_UPLOAD_FORM", $this->zip_form_gui->getHtml());
166 $this->tpl->setVariable(
"TXT_REQUIRED_FLD", $this->lng->txt(
"required_field"));
167 $this->tpl->setVariable(
"TXT_TAKE_OVER_STRUCTURE", $this->lng->txt(
"take_over_structure"));
168 $this->tpl->setVariable(
"TXT_HEADER_ZIP", $this->lng->txt(
"header_zip"));
182 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
184 $this->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 $this->single_form_gui->addItem($in_title);
195 $this->single_form_gui->addItem($in_descr);
200 $this->single_form_gui->addItem($in_file);
203 if ($a_mode ==
"create")
205 $this->single_form_gui->addCommandButton(
"save", $this->lng->txt($this->type.
"_add"));
206 $this->single_form_gui->addCommandButton(
"saveAndMeta", $this->lng->txt(
"file_add_and_metadata"));
207 $this->single_form_gui->addCommandButton(
"cancel", $lng->txt(
"cancel"));
215 $this->single_form_gui->setTableWidth(
"60%");
217 $this->single_form_gui->setTitle($this->lng->txt($this->type.
"_new"));
218 $this->single_form_gui->setTitleIcon(
ilUtil::getImagePath(
'icon_file.gif'), $this->lng->txt(
'obj_file'));
220 if ($a_mode ==
"create")
222 $this->ctrl->setParameter($this,
"new_type",
"file");
224 $this->single_form_gui->setFormAction($this->ctrl->getFormAction($this));
236 include_once(
"Services/Form/classes/class.ilPropertyFormGUI.php");
238 $this->zip_form_gui->setMultipart(
true);
243 $in_file->setSuffixes(array(
"zip"));
244 $this->zip_form_gui->addItem($in_file);
247 $in_str =
new ilCheckboxInputGUI($this->lng->txt(
"take_over_structure"),
"adopt_structure");
248 $in_str->
setInfo($this->lng->txt(
"take_over_structure_info"));
249 $this->zip_form_gui->addItem($in_str);
252 if ($a_mode ==
"create")
254 $this->zip_form_gui->addCommandButton(
"saveUnzip", $this->lng->txt($this->type.
"_add"));
255 $this->zip_form_gui->addCommandButton(
"cancel", $lng->txt(
"cancel"));
263 $this->zip_form_gui->setTableWidth(
"60%");
265 $this->zip_form_gui->setTitle($this->lng->txt(
"header_zip"));
266 $this->zip_form_gui->setTitleIcon(
ilUtil::getImagePath(
'icon_file.gif'), $this->lng->txt(
'obj_file'));
268 if ($a_mode ==
"create")
270 $this->ctrl->setParameter($this,
"new_type",
"file");
272 $this->zip_form_gui->setFormAction($this->ctrl->getFormAction($this));
286 if ($rbacsystem->checkAccess(
"create",
$_GET[
"ref_id"],
"file")) {
287 if ($this->zip_form_gui->checkInput())
289 $zip_file = $this->zip_form_gui->getInput(
"zip_file");
290 $adopt_structure = $this->zip_form_gui->getInput(
"adopt_structure");
292 include_once (
"Services/Utilities/classes/class.ilFileUtils.php");
301 $permission = $rbacsystem->checkAccess(
"create",
$_GET[
"ref_id"],
"cat");
302 $containerType =
"Category";
305 $permission = $rbacsystem->checkAccess(
"create",
$_GET[
"ref_id"],
"fold");
306 $containerType =
"Folder";
319 $zip_file[
"tmp_name"],
320 ($adopt_structure && $permission),
332 $this->ctrl->returnToParent($this);
336 $this->zip_form_gui->setValuesByPost();
342 $this->ilErr->raiseError($this->lng->txt(
"permission_denied"),$this->ilErr->MESSAGE);
357 if ($this->single_form_gui->checkInput())
359 $title = $this->single_form_gui->getInput(
"title");
360 $description = $this->single_form_gui->getInput(
"description");
361 $upload_file = $this->single_form_gui->getInput(
"upload_file");
365 $title = $upload_file[
"name"];
372 if ($titleExtension != $fileExtension && strlen($fileExtension) > 0)
374 $title .=
'.'.$fileExtension;
380 include_once(
"./Modules/File/classes/class.ilObjFile.php");
382 $fileObj->setTitle(
$title);
383 $fileObj->setDescription($description);
384 $fileObj->setFileName($upload_file[
"name"]);
386 include_once(
"./Services/Utilities/classes/class.ilMimeTypeUtil.php");
388 "", $upload_file[
"name"], $upload_file[
"type"]));
389 $fileObj->setFileSize($upload_file[
"size"]);
391 $fileObj->createReference();
392 $fileObj->putInTree(
$_GET[
"ref_id"]);
393 $fileObj->setPermissions(
$_GET[
"ref_id"]);
395 $fileObj->createDirectory();
396 $fileObj->getUploadFile($upload_file[
"tmp_name"],
397 $upload_file[
"name"]);
400 require_once(
'Services/Tracking/classes/class.ilChangeEvent.php');
408 $this->ctrl->setParameter($this,
"ref_id", $fileObj->getRefId());
409 if ($this->ctrl->getCmd() ==
"saveAndMeta")
412 $this->ctrl->getLinkTargetByClass(array(
"ilobjfilegui",
"ilmdeditorgui"),
"listSection");
413 $target = str_replace(
"new_type=",
"nt=", $target);
418 $this->ctrl->returnToParent($this);
423 $this->single_form_gui->setValuesByPost();
445 $data = $_FILES[
"Fobject"];
448 while (substr(
$data[
"name"][
"file"],-1) ==
'/')
450 $data[
"name"][
"file"] = substr(
$data[
"name"][
"file"],0,-1);
453 if (empty(
$data[
"name"][
"file"]) && empty($_POST[
"Fobject"][
"title"]))
455 $this->ilias->raiseError($this->lng->txt(
"msg_no_title"),$this->ilias->error_obj->MESSAGE);
458 $filename = empty(
$data[
"name"][
"file"]) ? $this->
object->getFileName() :
$data[
"name"][
"file"];
460 if(strlen(trim(
$title)) == 0)
469 if ($titleExtension != $fileExtension && strlen($fileExtension) > 0)
471 $title .=
'.'.$fileExtension;
475 $this->
object->setTitle(
$title);
477 if (!empty(
$data[
"name"][
"file"]))
479 $this->
object->replaceFile($_FILES[
"Fobject"][
"tmp_name"][
"file"],$_FILES[
"Fobject"][
"name"][
"file"]);
480 $this->
object->setFileName($_FILES[
"Fobject"][
"name"][
"file"]);
482 include_once(
"./Services/Utilities/classes/class.ilMimeTypeUtil.php");
484 "", $_FILES[
"Fobject"][
"name"][
"file"], $_FILES[
"Fobject"][
"type"][
"file"]));
485 $this->
object->setFileSize($_FILES[
"Fobject"][
"size"][
"file"]);
490 $this->update = $this->
object->update();
493 if (!empty(
$data[
"name"][
"file"]))
495 require_once(
'Services/Tracking/classes/class.ilChangeEvent.php');
518 global $rbacsystem, $ilAccess;
520 if (!$ilAccess->checkAccess(
"write",
"", $this->ref_id))
522 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_write"),$this->ilias->error_obj->MESSAGE);
540 $this->tpl->setVariable(
"TXT_TITLE", $this->lng->txt(
"title"));
541 $this->tpl->setVariable(
"TITLE", $fields[
"title"]);
542 $this->tpl->setVariable(
"TXT_DESC", $this->lng->txt(
"desc"));
543 $this->tpl->setVariable(
"DESC", $fields[
"desc"]);
544 $this->tpl->setVariable(
"TXT_REPLACE_FILE", $this->lng->txt(
"replace_file"));
547 $obj_str = ($this->call_by_reference) ?
"" :
"&obj_id=".$this->obj_id;
549 $this->tpl->setVariable(
"FORMACTION", $this->
getFormAction(
"update",$this->ctrl->getFormAction($this,
"update").$obj_str));
550 $this->tpl->setVariable(
"TXT_HEADER", $this->lng->txt($this->object->getType().
"_edit"));
551 $this->tpl->setVariable(
"TARGET", $this->
getTargetFrame(
"update"));
552 $this->tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
"cancel"));
553 $this->tpl->setVariable(
"TXT_SUBMIT", $this->lng->txt(
"save"));
554 $this->tpl->setVariable(
"CMD_SUBMIT",
"update");
555 $this->tpl->setVariable(
"TXT_REQUIRED_FLD", $this->lng->txt(
"required_field"));
563 if ($ilAccess->checkAccess(
"read",
"", $this->ref_id))
566 require_once(
'Services/Tracking/classes/class.ilChangeEvent.php');
575 $this->
object->sendFile(
$_GET[
"hist_id"]);
579 $this->ilErr->raiseError($this->lng->txt(
"permission_denied"),$this->ilErr->MESSAGE);
592 global $rbacsystem, $ilAccess;
594 if (!$ilAccess->checkAccess(
"read",
"",
$_GET[
"ref_id"]))
596 $this->ilErr->raiseError($this->lng->txt(
"permission_denied"),$this->ilErr->MESSAGE);
599 require_once(
"classes/class.ilHistoryGUI.php");
606 array(
"ref_id" =>
$_GET[
"ref_id"],
"cmd" =>
"versions",
607 "cmdClass" =>
$_GET[
"cmdClass"],
"cmdNode" =>
$_GET[
"cmdNode"]));
609 $this->tpl->setVariable(
"ADM_CONTENT", $hist_html);
619 $this->ctrl->setCmd(
"showSummary");
620 $this->ctrl->setCmdClass(
"ilinfoscreengui");
631 if (!$ilAccess->checkAccess(
"visible",
"", $this->ref_id))
633 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
636 include_once(
"./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
639 if ($ilAccess->checkAccess(
"read",
"sendfile", $this->ref_id))
641 $info->addButton($this->lng->txt(
"file_read"), $this->ctrl->getLinkTarget($this,
"sendfile"));
644 $info->enablePrivateNotes();
646 if ($ilAccess->checkAccess(
"read",
"",
$_GET[
"ref_id"]))
652 $info->enableNewsEditing(
false);
653 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"]))
656 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
658 if ($enable_internal_rss)
660 $info->setBlockProperty(
"news",
"settings",
true);
661 $info->setBlockProperty(
"news",
"public_notifications_option",
true);
667 $info->addMetaDataSections($this->object->getId(),0, $this->
object->getType());
669 $info->addSection($this->lng->txt(
"file_info"));
670 $info->addProperty($this->lng->txt(
"filename"),
671 $this->
object->getFileName());
673 $info->addProperty($this->lng->txt(
"type"),
674 $this->
object->guessFileType());
676 $info->addProperty($this->lng->txt(
"size"),
678 $info->addProperty($this->lng->txt(
"version"),
679 $this->
object->getVersion());
682 $this->ctrl->forwardCommand($info);
689 global $rbacsystem, $ilAccess;
693 $this->ctrl->setParameter($this,
"ref_id",$this->ref_id);
695 if ($ilAccess->checkAccess(
"visible",
"", $this->ref_id))
697 $force_active = ($this->ctrl->getNextClass() ==
"ilinfoscreengui"
698 || strtolower(
$_GET[
"cmdClass"]) ==
"ilnotegui")
701 $tabs_gui->addTarget(
"info_short",
702 $this->ctrl->getLinkTargetByClass(
703 array(
"ilobjfilegui",
"ilinfoscreengui"),
"showSummary"),
704 array(
"showSummary",
"",
"infoScreen"),
705 "",
"", $force_active);
708 if ($ilAccess->checkAccess(
"write",
"", $this->ref_id))
710 $tabs_gui->addTarget(
"edit",
711 $this->ctrl->getLinkTarget($this,
"edit"),
"edit",
"");
715 if ($ilAccess->checkAccess(
"write",
"", $this->ref_id))
717 $tabs_gui->addTarget(
"meta_data",
718 $this->ctrl->getLinkTargetByClass(array(
'ilobjfilegui',
'ilmdeditorgui'),
'listSection'),
719 "",
'ilmdeditorgui');
722 if ($ilAccess->checkAccess(
"write",
"", $this->ref_id))
724 $tabs_gui->addTarget(
"versions",
725 $this->ctrl->getLinkTarget($this,
"versions"),
"versions", get_class($this));
728 if ($ilAccess->checkAccess(
"edit_permission",
"", $this->ref_id))
730 $tabs_gui->addTarget(
"perm_settings",
731 $this->ctrl->getLinkTargetByClass(array(get_class($this),
'ilpermissiongui'),
"perm"), array(
"perm",
"info",
"owner"),
'ilpermissiongui');
739 if ($ilAccess->checkAccess(
"visible",
"", $a_target))
741 $_GET[
"cmd"] =
"infoScreen";
742 $_GET[
"ref_id"] = $a_target;
743 include(
"repository.php");
746 else if ($ilAccess->checkAccess(
"read",
"", ROOT_FOLDER_ID))
748 $_GET[
"cmd"] =
"frameset";
749 $_GET[
"target"] =
"";
750 $_GET[
"ref_id"] = ROOT_FOLDER_ID;
753 include(
"repository.php");
757 $ilErr->raiseError($lng->txt(
"msg_no_perm_read"), $ilErr->FATAL);
768 if (is_object($this->
object))
770 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this,
""),
"",
$_GET[
"ref_id"]);