4 require_once(
"./Services/FileUpload/classes/class.ilFileUploadUtil.php");
5 require_once(
"./Services/FileUpload/classes/class.ilFileUploadSettings.php");
42 $this->drop_zone_id = $a_drop_zone_id;
43 $this->ref_id = $a_ref_id;
55 $tpl->addJavaScript(
"./Services/FileUpload/js/tmpl.js");
56 $tpl->addJavaScript(
"./Services/FileUpload/js/jquery.ui.widget.js");
57 $tpl->addJavaScript(
"./Services/FileUpload/js/jquery.iframe-transport.js");
58 $tpl->addJavaScript(
"./Services/FileUpload/js/jquery.fileupload.js");
59 $tpl->addJavaScript(
"./Services/FileUpload/js/jquery.ba-dotimeout.min.js");
60 $tpl->addJavaScript(
"./Services/FileUpload/js/ilFileUpload.js");
91 if ($this->ref_id != null && !$this->use_form)
94 $title = str_replace(
"\"",
""", $title);
95 $title = str_replace(
"'",
"'", $title);
100 if ($this->input_field_id != null)
102 else if ($this->input_field_name != null)
106 if ($this->submit_button_name != null)
108 if ($this->cancel_button_name != null)
112 if ($this->drop_area_id != null)
116 if ($this->file_list_id != null)
120 if ($this->file_select_button_id != null)
125 if ($max_size != null)
130 if ($allowed_suffixes !=
"")
131 $options->allowedExtensions =
"[" . $allowed_suffixes .
"]";
135 if ($supported_archives !=
"")
136 $options->supportedArchives =
"[" . $supported_archives .
"]";
139 include_once(
"./Services/JSON/classes/class.ilJsonUtil.php");
145 $onLoadCode =
"il.FileUpload.add(\"$id\", " .
ilJsonUtil::encode(
$options) .
", " . ($this->current_obj ?
"true" :
"false") .
");";
147 $tpl->addOnLoadCode($onLoadCode);
163 if (self::$shared_code_loaded)
170 $tpl_shared =
new ilTemplate(
"tpl.fileupload_shared.html",
true,
true,
"Services/FileUpload");
173 $lng->loadLanguageModule(
"form");
174 $tpl_shared->setCurrentBlock(
"fileupload_texts");
175 $tpl_shared->setVariable(
"ERROR_MSG_FILE_TOO_LARGE", $lng->txt(
"form_msg_file_size_exceeds"));
176 $tpl_shared->setVariable(
"ERROR_MSG_WRONG_FILE_TYPE", $lng->txt(
"form_msg_file_wrong_file_type"));
177 $tpl_shared->setVariable(
"ERROR_MSG_EMPTY_FILE_OR_FOLDER", $lng->txt(
"error_empty_file_or_folder"));
178 $tpl_shared->setVariable(
"ERROR_MSG_UPLOAD_ZERO_BYTES", $lng->txt(
"error_upload_was_zero_bytes"));
179 $tpl_shared->setVariable(
"QUESTION_CANCEL_ALL", $lng->txt(
"cancel_file_upload"));
180 $tpl_shared->setVariable(
"ERROR_MSG_EXTRACT_FAILED", $lng->txt(
"error_extraction_failed"));
181 $tpl_shared->setVariable(
"PROGRESS_UPLOADING", $lng->txt(
"uploading"));
182 $tpl_shared->setVariable(
"PROGRESS_EXTRACTING", $lng->txt(
"extracting"));
183 $tpl_shared->setVariable(
"DROP_FILES_HERE", $lng->txt(
"drop_files_on_repo_obj_info"));
184 $tpl_shared->parseCurrentBlock();
187 $tpl_shared->setCurrentBlock(
"fileupload_defaults");
190 $tpl_shared->setVariable(
"ALLOWED_SUFFIXES",
"");
191 $tpl_shared->setVariable(
"SUPPORTED_ARCHIVES",
"\"zip\"");
192 $tpl_shared->parseCurrentBlock();
195 $tpl_panel =
new ilTemplate(
"tpl.fileupload_panel_template.html",
true,
true,
"Services/FileUpload");
196 $tpl_panel->setVariable(
"TXT_HEADER", $lng->txt(
"upload_files_title"));
197 $tpl_panel->setVariable(
"TXT_SHOW_ALL_DETAILS", $lng->txt(
'show_all_details'));
198 $tpl_panel->setVariable(
"TXT_HIDE_ALL_DETAILS", $lng->txt(
'hide_all_details'));
199 $tpl_panel->setVariable(
"TXT_SUBMIT", $lng->txt(
'upload_files'));
200 $tpl_panel->setVariable(
"TXT_CANCEL", $lng->txt(
'cancel'));
202 $tpl_shared->setCurrentBlock(
"fileupload_panel_tmpl");
203 $tpl_shared->setVariable(
"PANEL_TEMPLATE_HTML", $tpl_panel->get());
204 $tpl_shared->parseCurrentBlock();
207 $tpl_row =
new ilTemplate(
"tpl.fileupload_row_template.html",
true,
true,
"Services/FileUpload");
209 $tpl_row->setVariable(
"ALT_ALERT", $lng->txt(
"alert"));
210 $tpl_row->setVariable(
"TXT_CANCEL", $lng->txt(
"cancel"));
211 $tpl_row->setVariable(
"TXT_REMOVE", $lng->txt(
"remove"));
212 $tpl_row->setVariable(
"TXT_TITLE", $lng->txt(
"title"));
213 $tpl_row->setVariable(
"TXT_DESCRIPTION", $lng->txt(
"description"));
214 $tpl_row->setVariable(
"TXT_EXTRACT", $lng->txt(
"unzip"));
215 $tpl_row->setVariable(
"TXT_KEEP_STRUCTURE", $lng->txt(
"take_over_structure"));
216 $tpl_row->setVariable(
"TXT_KEEP_STRUCTURE_INFO", $lng->txt(
"take_over_structure_info"));
217 $tpl_row->setVariable(
"TXT_PENDING", $lng->txt(
"upload_pending"));
219 $tpl_shared->setCurrentBlock(
"fileupload_row_tmpl");
220 $tpl_shared->setVariable(
"ROW_TEMPLATE_HTML", $tpl_row->get());
221 $tpl_shared->parseCurrentBlock();
224 self::$shared_code_loaded =
true;
227 return $tpl_shared->get();
238 $list .= $delim .
"\"" . $suffix .
"\"";
248 $this->use_form =
true;
250 $this->submit_button_name = $a_submit_name;
251 $this->cancel_button_name = $a_cancel_name;
261 $this->max_file_size = $a_max;
279 $this->archive_suffixes = $a_suffixes;
299 $this->suffixes = $a_suffixes;
319 $this->input_field_name = $a_name;
334 $this->drop_area_id = $a_id;
344 $this->file_list_id = $a_id;
354 $this->file_select_button_id = $a_id;
375 include_once(
"Modules/File/classes/class.ilObjFileGUI.php");
376 $ilCtrl->setParameterByClass(self::FILE_OBJ_GUI_CLASS,
"ref_id", $this->ref_id);
377 $ilCtrl->setParameterByClass(self::FILE_OBJ_GUI_CLASS,
"new_type",
"file");
379 return $ilCtrl->getFormActionByClass(self::FILE_OBJ_GUI_CLASS,
"uploadFiles",
"",
true,
false);
384 if ($a_id != null && count($a_id) > 0)