3 // $Id: setting_action.php 1159 2008-01-24 18:51:36Z thierry $
6 require_once 'plc_login.php';
8 // Get session and API handles
9 require_once 'plc_session.php';
14 require_once 'plc_drupal.php';
15 drupal_set_title('Slices');
16 include 'plc_header.php';
20 require_once 'plc_functions.php';
21 require_once 'plc_sorts.php';
24 $_person= $plc->person;
25 $_roles= $_person['role_ids'];
27 //plc_debug('GET',$_GET);
28 //plc_debug('POST',$_POST);
30 // attribute type updates
31 if( $_POST['edit_type'] ) {
32 $setting_type_id= intval( $_POST['interface_setting_type_id'] );
33 $setting_type = array ('category' => $_POST['category'],
34 'name' => $_POST['name'],
35 'min_role_id' => intval( $_POST['min_role_id'] ),
36 'description' => $_POST['description']);
39 $api->UpdateInterfaceSettingType( $setting_type_id, $setting_type );
40 $api_error=$api->error();
41 if (!empty($api_error)) {
42 print "<div class='plc-error'>" . $api_error . "</div>";
45 header( "location: settings.php" );
49 // attribute type adds
50 if( $_POST['add_type'] ) {
51 $setting_type = array ('category' => $_POST['category'],
52 'name' => $_POST['name'],
53 'min_role_id' => intval( $_POST['min_role_id'] ),
54 'description' => $_POST['description']);
56 $api->AddInterfaceSettingType( $setting_type );
58 header( "location: settings.php" );
64 if( $_GET['rem_id'] ) {
65 // get the id of the attrib to remove from GET
66 $setting_id= intval( $_GET['rem_id'] );
69 $setting= $api->GetInterfaceSettings( array( $setting_id ), array( "interface_id" ) );
70 $interface_id= $setting[0]['interface_id'];
72 // delete the attribute
73 $api->DeleteInterfaceSetting( $setting_id );
75 header( "location: node_networks.php?id=$interface_id" );
80 if( $_POST['add_setting'] ) {
81 // get the interface_id, attribute_type_id, and value from POST
82 $interface_id= intval( $_POST['interface_id'] );
83 $interface_setting_type_id= intval( $_POST['interface_setting_type_id'] );
84 $value= $_POST['value'];
87 $api->AddInterfaceSetting( $interface_id, $interface_setting_type_id, $value );
89 header( "location: node_networks.php?id=$interface_id" );
94 if( $_POST['edit_setting'] ) {
95 // get the id of the setting to update and the value from POST
96 $setting_id= intval( $_POST['setting_id'] );
97 $value= $_POST['value'];
98 $interface_id= $_POST['interface_id'];
101 $api->UpdateInterfaceSetting($setting_id, $value );
103 header( "location: node_networks.php?id=$interface_id" );
107 // down here is some codqe from attrib_action.php that was not converted yet
108 // Settings -------------------------------------------------
110 // ATTRIBUTE TYPES ---------------------------------------------------
112 // delete attribute types
113 if( $_GET['del_type'] ) {
115 $type_id= intval( $_GET['del_type'] );
118 $api->DeleteInterfaceSettingType( $type_id );
120 header( "location: settings.php" );
128 include 'plc_footer.php';