$jarr['visible'] = 'yes';
    $jarr['short_title'] = 'B - In valutazione';
    $jarr['parent'] = 'stato';
    $report->menuitems[] = $jarr;
    $jarr = array();
    $jarr['url'] = "javascript:camila_inline_update_selected('stato','C1 - In lavorazione')";
    $jarr['visible'] = 'yes';
    $jarr['short_title'] = 'C1 - In lavorazione';
    $jarr['parent'] = 'stato';
    $report->menuitems[] = $jarr;
    $jarr = array();
    $jarr['url'] = "javascript:camila_inline_update_selected('stato','C2 - In attesa di lavorazione')";
    $jarr['visible'] = 'yes';
    $jarr['short_title'] = 'C2 - In attesa di lavorazione';
    $jarr['parent'] = 'stato';
    $report->menuitems[] = $jarr;
    $jarr = array();
    $jarr['url'] = "javascript:camila_inline_update_selected('stato','D1 - Eseguita')";
    $jarr['visible'] = 'yes';
    $jarr['short_title'] = 'D1 - Eseguita';
    $jarr['parent'] = 'stato';
    $report->menuitems[] = $jarr;
    $jarr = array();
    $jarr['url'] = "javascript:camila_inline_update_selected('stato','D2 - Respinta')";
    $jarr['visible'] = 'yes';
    $jarr['short_title'] = 'D2 - Respinta';
    $jarr['parent'] = 'stato';
    $report->menuitems[] = $jarr;
    $report->process();
    $report->draw();
}
 function operation($id, $operation, $returl)
 {
     global $_CAMILA;
     if ($operation == 'delete') {
         require_once CAMILA_DIR . 'datagrid/form.class.php';
         require_once CAMILA_DIR . 'datagrid/elements/form/hidden.php';
         $form3 = new phpform('camila', 'cf_worktable_admin.php');
         $form3->submitbutton = camila_get_translation('camila.worktable.delete');
         $form3->drawrules = false;
         new form_hidden($form3, 'custom', $id);
         new form_hidden($form3, 'worktable_op', $operation);
         if ($returl != '') {
             new form_hidden($form3, 'returl', $returl);
         }
         if ($form3->process()) {
             $result = $_CAMILA['db']->Execute('select tablename,scriptname from ' . CAMILA_TABLE_WORKT . ' where id=' . $_CAMILA['db']->qstr($id));
             if ($result === false) {
                 camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $_CAMILA['db']->ErrorMsg());
             }
             $table = $result->fields['tablename'];
             $script = $result->fields['scriptname'];
             $result = $_CAMILA['db']->Execute('delete from ' . CAMILA_TABLE_WORKT . ' where id=' . $_CAMILA['db']->qstr($id));
             if ($result === false) {
                 camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $_CAMILA['db']->ErrorMsg());
             }
             $result = $_CAMILA['db']->Execute('delete from ' . CAMILA_TABLE_WORKC . ' where (wt_id=' . $_CAMILA['db']->qstr($id) . ' and is_deleted<>' . $_CAMILA['db']->qstr('y') . ')');
             if ($result === false) {
                 camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $_CAMILA['db']->ErrorMsg());
             }
             $stmt = sprintf($_CAMILA['db']->_dropSeqSQL, $table);
             $result = $_CAMILA['db']->Execute($stmt);
             //if ($result === false)
             //    camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $_CAMILA['db']->ErrorMsg());
             $record = array();
             $record['visible'] = 'no';
             $record['active'] = 'no';
             $updateSQL = $_CAMILA['db']->AutoExecute(CAMILA_TABLE_PAGES, $record, 'UPDATE', 'url=' . $_CAMILA['db']->qstr($script));
             //if (!$updateSQL) {
             //    camila_information_text(camila_get_translation('camila.worktable.db.error'));
             //    $success3 = false;
             //}
         } else {
             camila_information_text(camila_get_translation('camila.worktable.delete.areyousure'));
             $result = $_CAMILA['db']->Execute('select short_title from ' . CAMILA_TABLE_WORKT . ' where id=' . $_CAMILA['db']->qstr($id));
             if ($result === false) {
                 camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $_CAMILA['db']->ErrorMsg());
             }
             $name = $result->fields['short_title'];
             $myText = new CHAW_text($name, HAW_TEXTFORMAT_BOLD);
             $myText->set_br(2);
             $_CAMILA['page']->add_text($myText);
             $form3->draw();
             $success = false;
         }
     } elseif ($operation == 'rebuild') {
         require_once CAMILA_DIR . 'datagrid/form.class.php';
         require_once CAMILA_DIR . 'datagrid/elements/form/hidden.php';
         $form3 = new phpform('camila', 'cf_worktable_admin.php');
         $form3->submitbutton = camila_get_translation('camila.worktable.delete');
         $form3->drawrules = false;
         new form_hidden($form3, 'custom', $id);
         new form_hidden($form3, 'worktable_op', $operation);
         if ($returl != '') {
             new form_hidden($form3, 'returl', $returl);
         }
         if ($form3->process()) {
             $this->configure_table($id, true, $returl);
         } else {
             camila_information_text(camila_get_translation('camila.worktable.rebuild.areyousure'));
             $result = $_CAMILA['db']->Execute('select short_title from ' . CAMILA_TABLE_WORKT . ' where id=' . $_CAMILA['db']->qstr($id));
             if ($result === false) {
                 camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $_CAMILA['db']->ErrorMsg());
             }
             $name = $result->fields['short_title'];
             $myText = new CHAW_text($name, HAW_TEXTFORMAT_BOLD);
             $myText->set_br(2);
             $_CAMILA['page']->add_text($myText);
             $form3->draw();
             $success = false;
         }
     } elseif ($operation == 'showtemplatefields') {
         $stmt = "select wt_id,name,name_abbrev,col_name as colname_form, col_name as colname_table from " . CAMILA_TABLE_WORKC . ' where (wt_id=' . $_CAMILA['db']->qstr($id) . ' and is_deleted<>' . $_CAMILA['db']->qstr('y') . ') order by name';
         require_once CAMILA_DIR . 'datagrid/report.class.php';
         $report = new report($stmt);
         $report->mapping = camila_get_translation('camila.worktable.mapping.worktable');
         $report->process();
         $report->fields['colname_form']->onprint = camila_configurator_template_fieldname_form;
         $report->fields['colname_form']->dummy = true;
         $report->fields['colname_form']->orderable = false;
         $report->fields['colname_table']->onprint = camila_configurator_template_fieldname_table;
         $report->fields['colname_table']->dummy = true;
         $report->fields['colname_table']->orderable = false;
         $report->fields['wt_id']->print = false;
         $report->fields['name']->orderable = false;
         $report->fields['name_abbrev']->orderable = false;
         $report->drawfilterbox = false;
         $report->drawnavigationbox = false;
         $report->draw();
     }
     if ($success) {
         $myText = new CHAW_text(camila_get_translation('camila.worktable.db.importok'));
         $_CAMILA['page']->add_text($myText);
     }
 }