/** * @param string $action * @return string */ public static function get_data_browser_link_html_and_button_handler($action) { global $regional; $html; $html_caption; $button_handler; $button_handler_caption; $template; $paramquery = $_GET; unset($paramquery['run']); switch ($action) { case "parameter_delete": if (isset($_POST['sure'])) { self::delete($_POST['parameter_id']); } else { $template = new HTMLTemplate("data/parameter_delete_window.html"); $button_handler_template = new JSTemplate("data/js/parameter_delete_window.js"); $button_handler_template->set_var("session_id", $_GET['session_id']); $button_handler_template->set_var("parameter_id", $_POST['parameter_id']); $button_handler = $button_handler_template->get_string(); $button_handler_caption = "Delete"; $html_caption = "Delete Parameter"; $html = $template->get_string(); } break; case "permission": require_once "data.ajax.php"; if (isset($_POST['permissions'])) { $success = DataAjax::change_permission(json_decode($_POST['permissions']), "Parameter"); return $success; } else { $permission = DataAjax::permission_window(); $button_handler_template = new JSTemplate("data/js/parameter_permission_window.js"); $button_handler_template->set_var("session_id", $_GET['session_id']); $button_handler_template->set_var("parameter_id", $_POST['parameter_id']); $button_handler = $button_handler_template->get_string(); $button_handler_caption = "Change"; $html_caption = "Change permission"; $html = $permission; } break; } $array = array("content" => $html, "content_caption" => $html_caption, "handler" => $button_handler, "handler_caption" => $button_handler_caption); return json_encode($array); }
/** * @param string $action * @return string */ public static function get_data_browser_link_html_and_button_handler($action) { $html; $html_caption; $button_handler; $button_handler_caption; $template; $paramquery = $_GET; unset($paramquery['run']); switch ($action) { case "file_update": $unique_id = uniqid(); $paramquery['unique_id'] = $unique_id; $paramquery['file_id'] = $_POST['file_id']; $params = http_build_query($paramquery, '', '&'); $template = new HTMLTemplate("data/file_update_window.html"); $template->set_var("params", $params); $template->set_var("unique_id", $unique_id); $template->set_var("session_id", $_GET['session_id']); $button_handler_template = new JSTemplate("data/js/file_update_window.js"); $button_handler = $button_handler_template->get_string(); $button_handler_caption = "Upload"; $html_caption = "Upload newer version"; $html = $template->get_string(); break; case "file_update_minor": $unique_id = uniqid(); $paramquery['unique_id'] = $unique_id; $paramquery['file_id'] = $_POST['file_id']; $params = http_build_query($paramquery, '', '&'); $template = new HTMLTemplate("data/file_update_window.html"); $template->set_var("params", $params); $template->set_var("unique_id", $unique_id); $template->set_var("session_id", $_GET['session_id']); $button_handler_template = new JSTemplate("data/js/file_update_window.js"); $button_handler = $button_handler_template->get_string(); $button_handler_caption = "Upload"; $html_caption = "Upload minor version"; $html = $template->get_string(); break; case "permission": require_once "data.ajax.php"; if (isset($_POST['permissions'])) { return DataAjax::change_permission(json_decode($_POST['permissions']), "File"); } else { $permission = DataAjax::permission_window(); $button_handler_template = new JSTemplate("data/js/file_permission_window.js"); $button_handler_template->set_var("session_id", $_GET['session_id']); $button_handler_template->set_var("file_id", $_POST['file_id']); $button_handler = $button_handler_template->get_string(); $button_handler_caption = "Change"; $html_caption = "Change permission"; $html = $permission; } break; case "file_delete": if (isset($_POST['sure'])) { return self::delete_file($_POST['file_id']); } else { $template = new HTMLTemplate("data/file_delete_window.html"); $button_handler_template = new JSTemplate("data/js/file_delete_window.js"); $button_handler_template->set_var("session_id", $_GET['session_id']); $button_handler_template->set_var("file_id", $_POST['file_id']); $button_handler = $button_handler_template->get_string(); $button_handler_caption = "Delete"; $html_caption = "Delete File"; $html = $template->get_string(); } break; } $array = array("content" => $html, "content_caption" => $html_caption, "handler" => $button_handler, "handler_caption" => $button_handler_caption); return json_encode($array); }
/** * @param string $action * @return string */ public static function get_data_browser_link_html_and_button_handler($action) { $html; $html_caption; $button_handler; $button_handler_caption; $template; $paramquery = $_GET; unset($paramquery['run']); switch ($action) { case "folder_add": if (isset($_POST['folder_name'])) { return self::add_folder($_POST['folder_id'], $_POST['folder_name']); } else { $button_handler_template = new JSTemplate("data/js/folder_add_window.js"); $button_handler_template->set_var("session_id", $_GET['session_id']); $button_handler_template->set_var("folder_id", $_POST['folder_id']); $button_handler = $button_handler_template->get_string(); $button_handler_caption = "Add"; $html_caption = "Add Folder"; $template = new HTMLTemplate("data/folder_add_window.html"); $html = $template->get_string(); } break; case "folder_delete": if (isset($_POST['sure'])) { return self::delete_folder($_POST['folder_id']); } else { $paramquery['sure'] = "true"; $paramquery['nextpage'] = "1"; $params = http_build_query($paramquery); $template = new HTMLTemplate("data/folder_delete_window.html"); $template->set_var("params", $params); $button_handler_template = new JSTemplate("data/js/folder_delete_window.js"); $button_handler_template->set_var("session_id", $_GET['session_id']); $button_handler_template->set_var("folder_id", $_POST['folder_id']); $button_handler = $button_handler_template->get_string(); $button_handler_caption = "Delete"; $html_caption = "Delete Folder"; $html = $template->get_string(); } break; case "folder_rename": if (isset($_POST['folder_name'])) { return self::rename_folder($_POST['folder_id'], $_POST['folder_name']); } else { $template = new HTMLTemplate("data/folder_rename_window.html"); $button_handler_template = new JSTemplate("data/js/folder_rename_window.js"); $button_handler_template->set_var("session_id", $_GET['session_id']); $button_handler_template->set_var("folder_id", $_POST['folder_id']); $button_handler = $button_handler_template->get_string(); $button_handler_caption = "Rename"; $html_caption = "Rename Folder"; $html = $template->get_string(); } break; case "permission": require_once "data.ajax.php"; if (isset($_POST['permissions'])) { $success = DataAjax::change_permission(json_decode($_POST['permissions']), "Folder"); return $success; } else { $permission = DataAjax::permission_window(); $button_handler_template = new JSTemplate("data/js/folder_permission_window.js"); $button_handler_template->set_var("session_id", $_GET['session_id']); $button_handler_template->set_var("folder_id", $_POST['folder_id']); $button_handler = $button_handler_template->get_string(); $button_handler_caption = "Change"; $html_caption = "Change permission"; $html = $permission; } break; } $array = array("content" => $html, "content_caption" => $html_caption, "handler" => $button_handler, "handler_caption" => $button_handler_caption); return json_encode($array); }
/** * @param string $action * @return string */ public static function get_data_browser_link_html_and_button_handler($action) { global $regional; $html; $html_caption; $button_handler; $button_handler_caption; $template; $paramquery = $_GET; unset($paramquery['run']); switch ($action) { case "value_add": if (!isset($_POST['folder_id']) && !isset($_POST['value_array'])) { //second call (from additional script; loads template) require_once "core/modules/data/io/value_form.io.php"; $value_form_io = new ValueFormIO(null, $_POST['type_id'], $_POST['folder_id']); $value_form_io->set_field_class("DataValueAddValues"); return $value_form_io->get_content(); } if (isset($_POST['value_array'])) { //third call (from add button; creates value) return self::add_value($_POST['folder_id'], $_POST['type_id'], $_POST['value_array']); } require_once "core/include/data/value/access/value_type.access.php"; $types = ValueType_Access::list_entries(); $options = array(); $counter = 0; foreach ($types as $key => $value) { if ($value == 2) { continue; } $value_type = new ValueType($value); $options[$counter]['value'] = $value; $options[$counter]['content'] = $value_type->get_name(); $options[$counter]['selected'] = ""; $options[$counter]['disabled'] = ""; $counter++; } $template = new HTMLTemplate("data/value_add_window.html"); $template->set_var("option", $options); $html = $template->get_string(); $html_caption = "Add Value"; $button_handler_template = new JSTemplate("data/js/value_add_window.js"); $button_handler_template->set_var("session_id", $_GET['session_id']); $button_handler_template->set_var("folder_id", $_POST['folder_id']); $button_handler = $button_handler_template->get_string(); $button_handler_caption = "Add"; $additional_script_template = new JSTemplate("data/js/value_add_window_additional.js"); $additional_script_template->set_var("decimal_separator", $regional->get_decimal_separator()); $additional_script_template->set_var("thousand_separator", $regional->get_thousand_separator()); $additional_script_template->set_var("session_id", $_GET['session_id']); $additional_script = $additional_script_template->get_string(); $array = array("content" => $html, "content_caption" => $html_caption, "handler" => $button_handler, "handler_caption" => $button_handler_caption, "additional_script" => $additional_script); return json_encode($array); break; case "value_delete": if (isset($_POST['sure'])) { self::delete_value($_POST['value_id']); } else { $template = new HTMLTemplate("data/value_delete_window.html"); $button_handler_template = new JSTemplate("data/js/value_delete_window.js"); $button_handler_template->set_var("session_id", $_GET['session_id']); $button_handler_template->set_var("value_id", $_POST['value_id']); $button_handler = $button_handler_template->get_string(); $button_handler_caption = "Delete"; $html_caption = "Delete Value"; $html = $template->get_string(); } break; case "permission": require_once "data.ajax.php"; if (isset($_POST['permissions'])) { $success = DataAjax::change_permission(json_decode($_POST['permissions']), "Value"); return $success; } else { $permission = DataAjax::permission_window(); $button_handler_template = new JSTemplate("data/js/value_permission_window.js"); $button_handler_template->set_var("session_id", $_GET['session_id']); $button_handler_template->set_var("value_id", $_POST['value_id']); $button_handler = $button_handler_template->get_string(); $button_handler_caption = "Change"; $html_caption = "Change permission"; $html = $permission; } break; } $array = array("content" => $html, "content_caption" => $html_caption, "handler" => $button_handler, "handler_caption" => $button_handler_caption); return json_encode($array); }