23 $this->ilias =& $ilias;
25 $this->main_dir = $a_main_directory;
26 $this->commands = array();
27 $this->file_labels = array();
28 $this->label_enable =
false;
29 $this->ctrl->saveParameter($this,
"cdir");
30 $lng->loadLanguageModule(
"content");
42 $this->allow_directories = $a_val;
52 return $this->allow_directories;
62 $this->table_id = $a_val;
72 return $this->table_id;
82 $this->title = $a_val;
103 if (!is_array($pars))
107 $_SESSION[
"fsys"][
"lastcomm"] = array_merge(
128 $next_class = $this->ctrl->getNextClass($this);
129 $cmd = $this->ctrl->getCmd();
135 if (substr(
$cmd, 0, 11) ==
"extCommand_")
155 $i = count($this->commands);
157 $this->commands[$i][
"object"] =& $a_obj;
158 $this->commands[$i][
"method"] = $a_func;
159 $this->commands[$i][
"name"] = $a_name;
170 $this->file_labels[$a_file][] = $a_label;
178 $this->label_enable = $a_act;
179 $this->label_header = $a_label_header;
187 if (!isset(
$_POST[
"file"]))
189 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
192 if (count(
$_POST[
"file"]) > 1)
194 $this->ilias->raiseError($this->lng->txt(
"cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
197 if (
$_POST[
"file"][0] ==
".." )
199 $this->ilias->raiseError($this->lng->txt(
"select_a_file"),$this->ilias->error_obj->MESSAGE);
203 $file = (!empty($cur_subdir))
210 $this->ilias->raiseError($this->lng->txt(
"select_a_file"),$this->ilias->error_obj->MESSAGE);
213 $file = (!empty($cur_subdir))
217 $obj =& $this->commands[$a_nr][
"object"];
218 $method = $this->commands[$a_nr][
"method"];
221 return $obj->$method(
$file);
240 if($new_subdir ==
"..")
242 $cur_subdir = substr($cur_subdir, 0, strrpos($cur_subdir,
"/"));
246 if (!empty($new_subdir))
248 if (!empty($cur_subdir))
250 $cur_subdir = $cur_subdir.
"/".$new_subdir;
254 $cur_subdir = $new_subdir;
259 $cur_subdir = str_replace(
"..",
"", $cur_subdir);
261 $cur_dir = (!empty($cur_subdir))
262 ? $this->main_dir.
"/".$cur_subdir
265 $this->ctrl->setParameter($this,
"cdir", $cur_subdir);
268 $ilToolbar->setFormAction($ilCtrl->getFormAction($this),
true);
269 include_once(
"./Services/Form/classes/class.ilTextInputGUI.php");
273 $ti =
new ilTextInputGUI($this->lng->txt(
"cont_new_dir"),
"new_dir");
276 $ilToolbar->addInputItem($ti,
true);
277 $ilToolbar->addFormButton($lng->txt(
"create"),
"createDirectory");
279 $ilToolbar->addSeparator();
282 include_once(
"./Services/Form/classes/class.ilFileInputGUI.php");
283 $fi =
new ilFileInputGUI($this->lng->txt(
"cont_new_file"),
"new_file");
285 $ilToolbar->addInputItem($fi,
true);
286 $ilToolbar->addFormButton($lng->txt(
"upload"),
"uploadFile");
288 include_once
'Services/FileSystemStorage/classes/class.ilUploadFiles.php';
291 $ilToolbar->addSeparator();
293 $options[
""] = $lng->txt(
"cont_select_from_upload_dir");
296 $file = htmlspecialchars($file, ENT_QUOTES,
"utf-8");
299 include_once(
"./Services/Form/classes/class.ilSelectInputGUI.php");
300 $si =
new ilSelectInputGUI($this->lng->txt(
"cont_uploaded_file"),
"uploaded_file");
302 $ilToolbar->addInputItem($si,
true);
303 $ilToolbar->addFormButton($lng->txt(
"copy"),
"uploadFile");
308 include_once(
"./Services/FileSystemStorage/classes/class.ilFileSystemTableGUI.php");
310 $this->label_enable, $this->file_labels, $this->label_header, $this->commands);
314 $fs_table->setTitle($this->
getTitle());
316 if (
$_GET[
"resetoffset"] == 1)
318 $fs_table->resetOffset();
320 $this->tpl->setContent($fs_table->getHTML());
328 if (!isset(
$_POST[
"file"]))
330 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
333 if (count(
$_POST[
"file"]) > 1)
335 $this->ilias->raiseError($this->lng->txt(
"cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
340 $this->ilias->raiseError($this->lng->txt(
"select_a_file"),$this->ilias->error_obj->MESSAGE);
344 $file = (!empty($cur_subdir))
349 $this->tpl->addBlockfile(
"ADM_CONTENT",
"adm_content",
"tpl.file_rename.html",
false);
352 $this->tpl->setVariable(
"FORMACTION", $this->ctrl->getFormAction($this,
"renameFile"));
355 $this->tpl->setVariable(
"TXT_HEADER", $this->lng->txt(
"cont_rename_dir"));
359 $this->tpl->setVariable(
"TXT_HEADER", $this->lng->txt(
"rename_file"));
361 $this->tpl->setVariable(
"TXT_NAME", $this->lng->txt(
"name"));
363 $this->tpl->setVariable(
"CMD_CANCEL",
"cancelRename");
364 $this->tpl->setVariable(
"CMD_SUBMIT",
"renameFile");
365 $this->tpl->setVariable(
"TXT_CANCEL", $this->lng->txt(
"cancel"));
366 $this->tpl->setVariable(
"TXT_SUBMIT", $this->lng->txt(
"rename"));
368 $this->tpl->parseCurrentBlock();
379 $new_name = str_replace(
"/",
"", $new_name);
382 $this->ilias->raiseError($this->lng->txt(
"enter_new_name"),$this->ilias->error_obj->MESSAGE);
386 $dir = (!empty($cur_subdir))
387 ? $this->main_dir.
"/".$cur_subdir.
"/"
388 : $this->main_dir.
"/";
390 rename(
$dir.ilUtil::stripSlashes(
$_GET[
"old_name"]),
$dir.$new_name);
393 if (@is_dir(
$dir.$new_name))
397 "new_name" => $new_name));
403 "new_name" => $new_name));
405 $this->ctrl->redirect($this,
"listFiles");
413 $this->ctrl->redirect($this,
"listFiles");
425 $cur_dir = (!empty($cur_subdir))
426 ? $this->main_dir.
"/".$cur_subdir
430 $new_dir = str_replace(
"/",
"", $new_dir);
432 if (!empty($new_dir))
435 if (is_dir($cur_dir.
"/".$new_dir))
445 $this->ctrl->saveParameter($this,
"cdir");
446 $this->ctrl->redirect($this,
"listFiles");
458 $cur_dir = (!empty($cur_subdir))
459 ? $this->main_dir.
"/".$cur_subdir
463 include_once
'Services/FileSystemStorage/classes/class.ilUploadFiles.php';
465 if (is_file($_FILES[
"new_file"][
"tmp_name"]))
467 move_uploaded_file($_FILES[
"new_file"][
"tmp_name"],
477 elseif (
$_POST[
"uploaded_file"])
493 else if (trim($_FILES[
"new_file"][
"name"]) ==
"")
498 $this->ctrl->saveParameter($this,
"cdir");
502 $this->ctrl->redirect($this,
"listFiles");
512 if (!is_array(
$_POST[
"file"]) || count(
$_POST[
"file"]) == 0)
515 $ilCtrl->redirect($this,
"listFile");
519 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
521 $cgui->setFormAction($ilCtrl->getFormAction($this));
522 $cgui->setHeaderText($lng->txt(
"info_delete_sure"));
523 $cgui->setCancel($lng->txt(
"cancel"),
"listFiles");
524 $cgui->setConfirm($lng->txt(
"delete"),
"deleteFile");
526 foreach (
$_POST[
"file"] as $i)
528 $cgui->addItem(
"file[]", $i, $i);
531 $tpl->setContent($cgui->getHTML());
542 if (!isset(
$_POST[
"file"]))
544 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
547 foreach (
$_POST[
"file"] as $post_file)
551 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
556 $cur_dir = (!empty($cur_subdir))
557 ? $this->main_dir.
"/".$cur_subdir
573 $this->ctrl->saveParameter($this,
"cdir");
586 $this->ctrl->redirect($this,
"listFiles");
596 if (!isset(
$_POST[
"file"]))
598 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
601 if (count(
$_POST[
"file"]) > 1)
603 $this->ilias->raiseError($this->lng->txt(
"cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
607 $cur_dir = (!empty($cur_subdir))
608 ? $this->main_dir.
"/".$cur_subdir
626 $this->ctrl->saveParameter($this,
"cdir");
628 $this->ctrl->redirect($this,
"listFiles");
636 if (!isset(
$_POST[
"file"]))
638 $this->ilias->raiseError($this->lng->txt(
"no_checkbox"),$this->ilias->error_obj->MESSAGE);
641 if (count(
$_POST[
"file"]) > 1)
643 $this->ilias->raiseError($this->lng->txt(
"cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
647 $cur_dir = (!empty($cur_subdir))
648 ? $this->main_dir.
"/".$cur_subdir
659 $this->ctrl->saveParameter($this,
"cdir");
660 $this->ctrl->redirect($this,
"listFiles");
671 $ilCtrl->setParameter($this,
"resetoffset", 1);
672 $tabs_gui->addTarget(
"cont_list_files",
673 $this->ctrl->getLinkTarget($this,
"listFiles"),
"listFiles",
675 $ilCtrl->setParameter($this,
"resetoffset",
"");