. */ /** * @brief Modify a subfolder * * * @file * @author Claire Figueras * @date $date$ * @version $Revision$ * @ingroup admin */ require_once "core" . DIRECTORY_SEPARATOR . "class" . DIRECTORY_SEPARATOR . "class_history.php"; $core = new core_tools(); $core->test_admin('admin_architecture', 'apps'); $core->load_lang(); $db = new dbquery(); $db->connect(); $desc = ""; $id = ""; $structureId = ""; $cssStyle = "default_style"; //$fontColor = '#000000'; // Black by default if (isset($_GET['id']) && ! empty($_GET['id'])) { $id = $_GET['id']; $db->query( "select doctypes_second_level_label, doctypes_first_level_id, css_style from " . $_SESSION['tablename']['doctypes_second_level'] . " where doctypes_second_level_id = " . $id ); $res = $db->fetch_object(); $desc = $db->show_string($res->doctypes_second_level_label); if (isset($res->css_style)) { $cssStyle = $db->show_string($res->css_style); } $structureId = $res->doctypes_first_level_id; } $mode = ""; if (isset($_REQUEST['mode']) && ! empty($_REQUEST['mode'])) { $mode = $_REQUEST['mode']; } $erreur = ""; if (isset($_REQUEST['valid'])) { if (isset($_REQUEST['css_style']) && !empty($_REQUEST['css_style'])) { $cssStyle = $db->protect_string_db($_REQUEST['css_style']); } else { $erreur .= _FONT_COLOR. ' ' . _MISSING . '.
'; } if (isset($_REQUEST['desc_sd']) && ! empty($_REQUEST['desc_sd'])) { $desc = $db->protect_string_db($_REQUEST['desc_sd']); $db->query( "select * from " . $_SESSION['tablename']['doctypes_second_level'] . " where doctypes_second_level_label = '" . $desc . "' and enabled = 'Y'" ); //$db->show(); if ($db->nb_result() > 1) { $erreur .= _THE_SUBFOLDER . " " . _ALREADY_EXISTS . "."; } else { if (isset($_REQUEST['structure']) && ! empty($_REQUEST['structure']) ) { $structure = $_REQUEST['structure']; if ($mode == "up") { if (isset($_REQUEST['ID_sd']) && ! empty($_REQUEST['ID_sd']) ) { $id = $db->protect_string_db($_REQUEST['ID_sd']); $db->query( "UPDATE " . $_SESSION['tablename']['doctypes_second_level'] . " set doctypes_second_level_label = '" . $desc . "', doctypes_first_level_id = " . $structure . ", css_style = '".$cssStyle."' " . " where doctypes_second_level_id = " . $id . "" ); $db->query( "update " . $_SESSION['tablename']['doctypes'] . " set doctypes_first_level_id = " . $structure . " where doctypes_second_level_id = " . $id ); if ($_SESSION['history']['subfolderup'] == "true") { $hist = new history(); $hist->add( $_SESSION['tablename']['doctypes_second_level'], $id, "UP", 'subfolderup', _SUBFOLDER_MODIF . " " . strtolower(_NUM) . $id . " (" . $info . ")", $_SESSION['config']['databasetype'] ); } $_SESSION['error'] .= _SUBFOLDER_MODIF . " : " . $id . "
"; } else { $erreur .= _SUBFOLDER_ID_PB . "."; } } else { $desc = $db->protect_string_db($_REQUEST['desc_sd']); $db->query( "INSERT INTO " . $_SESSION['tablename']['doctypes_second_level'] . " ( css_style, doctypes_second_level_label, " . "doctypes_first_level_id) VALUES ( '".$cssStyle ."', '" . $desc . "', ". $structure . ")" ); $db->query( "select doctypes_first_level_id from " . $_SESSION['tablename']['doctypes_second_level'] . " where doctypes_second_level_label = '" . $desc . "' and doctypes_first_level_id= " . $structure ); $res = $db->fetch_object(); if ($_SESSION['history']['subfolderadd'] == "true") { $hist = new history(); $hist->add( $_SESSION['tablename']['doctypes_second_level'], $res->doctypes_first_level_id, "ADD",'subfolderadd', _SUBFOLDER_ADDED . " (" . $desc . ")", $_SESSION['config']['databasetype'] ); } $_SESSION['error'] .= _NEW_SUBFOLDER . " : " . $desc . "
"; } if (empty($erreur)) { unset($_SESSION['m_admin']); ?> '; } } } else { $erreur .= _SUBFOLDER_DESC_MISSING . ".
"; } } if (file_exists( $_SESSION['config']['corepath'] . 'custom' . DIRECTORY_SEPARATOR . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id'] . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'htmlColors.xml' ) ) { $path = $_SESSION['config']['corepath'] . 'custom' . DIRECTORY_SEPARATOR . $_SESSION['custom_override_id'] . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id'] . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'htmlColors.xml'; } else { $path = 'apps' . DIRECTORY_SEPARATOR . $_SESSION['config']['app_id'] . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'htmlColors.xml'; } /* $fontColors = array(); $xml = simplexml_load_file($path); if ($xml <> false) { foreach ($xml->color as $color) { array_push( $fontColors, array( 'id' => (string) $color->id, 'label' => (string) $color->label, ) ); } } array_push( $fontColors, array( 'id' => '#000000', 'label' => _BLACK, ) ); function cmpColors($a, $b) { return strcmp(strtolower($a['label']), strtolower($b['label'])); } usort($fontColors, 'cmpColors');*/ $core->load_html('', true, false); if ($mode == "up") { $title = _SUBFOLDER_MODIF; } else { $title = _SUBFOLDER_CREATION; } $core->load_header($title); $time = $core->get_session_time_expire(); ?>

 


 

 

 

 

*/?>

 
load_js();?>