Beispiel #1
0
 case 'Edit':
     $sql->query("DROP TABLE `%tree_tmp`");
     ddc_gentable_n('%tree_tmp', $ddc_tree_structure, $ddc_tree_structure_keys, $sql);
     $sql->query("INSERT INTO `%tree_tmp` SELECT * FROM `%tree`");
     print "window.location.reload(true);";
     exit;
 case "Cancel":
     $sql->query("DROP TABLE `%tree_tmp`");
     print "window.location.reload(true);";
     exit;
 case "Save":
     $ddc = new ddc_key();
     $ddc->attach('%tree', $sql);
     $ddc2 = new ddc_key();
     $ddc2->attach('%tree_tmp', $sql);
     $ddc->gen_changes($ddc2);
     foreach ($ddc->actions as $i => $r) {
         print "chse.safe_alert(111,'" . js_escape($r->q) . "');";
     }
     $ddc->apply_changes($sql);
     $sql->query("DROP TABLE `%tree`");
     ddc_gentable_n('%tree', $ddc_tree_structure, $ddc_tree_structure_keys, $sql);
     $sql->query("INSERT INTO `%tree` SELECT * FROM `%tree_tmp`");
     //print "window.location.reload(true);";
     exit;
 case 'del':
     $q = "DELETE FROM `" . $workingtable . "` WHERE (SELECT `%tree_selections`.selected FROM `%tree_selections` WHERE `" . $workingtable . "`.id=`%tree_selections`.id )=1";
     $sql->query($q);
     //clean up orphans
     $q = "DELETE FROM `" . $workingtable . "` WHERE (SELECT a.id FROM `" . $workingtable . "` as a WHERE `" . $workingtable . "`.parentid=a.id ) IS NULL";
     $sql->query($q);
Beispiel #2
0
 function html_inner()
 {
     global $sql;
     $r = $sql->fetch1($sql->query("SELECT count(1) FROM `" . TABLE_META_TREE_TMP . "`"));
     if ($r > 0) {
         $t = TABLE_META_TREE_TMP;
     } else {
         $t = TABLE_META_TREE;
     }
     $new = new ddc_key();
     $new->attach(TABLE_META_TREE_TMP, $sql);
     $old = new ddc_key();
     $old->attach(TABLE_META_TREE, $sql);
     $diff = $new->gen_changes($old);
     if (is_array($diff)) {
         $this->tbl->html_head();
     }
     if (is_array($diff)) {
         foreach ($diff as $d) {
             $this->args['type'] = $d->type;
             $this->args['id'] = $d->id;
             $this->args['href'] = '';
             $this->args['name'] = $d->descr;
             $this->args['sql_change'] = $d->query;
             //$this->args['meta_change']=$d->meta_change;
             unset($this->args['difference']);
             if (isset($d->difference)) {
                 $this->args['difference'] = $d->difference;
             }
             //$this->args['change']=count($d->diff);
             $this->row->css_style['background'] = '';
             switch ($d->type) {
                 case 'table duplicate':
                     $this->row->css_style['background'] = string_to_color('sql_table', 2);
                     break;
                 case 'column duplicate':
                     $this->row->css_style['background'] = string_to_color('name', 2);
                     break;
                     //case '*':	$this->row->css_style['background']='yellow';break;
             }
             $this->row->html();
             $this->row->id_alloc();
         }
     } else {
         $this->gen_error->text = $diff;
         $this->gen_error->html();
     }
     if (is_array($diff)) {
         $this->tbl->html_tail();
     }
 }