Ejemplo n.º 1
1
function process_main($window, $id, $ctrl, $lparam1 = 0, $lparam2 = 0)
{
    global $wb, $statusbar;
    switch ($id) {
        case IDC_TREEVIEW:
            $selnode = wb_get_selected($wb->tree_view);
            if ($wb->left_control) {
                wb_set_visible($wb->left_control, false);
            }
            switch (wb_get_value($wb->tree_view)) {
                case 2002:
                    include_once PATH_FORM . 'Contact.form.php';
                    $wb->current_ctl = new ContactForm();
                    $wb->left_control = $wb->current_ctl->renderForm();
                    break;
                case 2003:
                    $wb->left_control = wb_create_control($wb->mainwin, CheckBox, "Checkbox 1", 170, 105, 91, 14, 0);
                    break;
                case 2004:
                    $wb->left_control = wb_create_control($wb->mainwin, RTFEditBox, "Rich text", 170, 120, 205, 55, 0);
                    break;
            }
            wb_set_text($wb->statusbar, "Selected item: " . wb_get_text($wb->tree_view, $selnode) . " / Value: " . wb_get_value($wb->tree_view) . " / Parent: " . wb_get_parent($wb->tree_view, $selnode) . " / Level: " . wb_get_level($wb->tree_view, $selnode) . " / State: " . (wb_get_state($wb->tree_view, $selnode) ? "expanded" : "collapsed"));
            break;
        case IDCLOSE:
            // IDCLOSE is predefined
            if (wb_message_box($wb->mainwin, $wb->vars["Lang"]["lang_sure_logout"], $wb->vars["Lang"]["system_name"], WBC_QUESTION | WBC_YESNO)) {
                wb_destroy_window($window);
            }
            break;
        case IDC_CATEGORY_LIST_VIEW:
            $sel = wb_get_selected($ctrl);
            $sel = $sel ? implode(", ", $sel) : "none";
            wb_message_box($wb->mainwin, $sel);
            break;
        default:
            include_once PATH_FORM . 'contact.handle.php';
            process_ContactForm($window, $id, $ctrl, $lparam1, $lparam2);
            break;
    }
}
function process_project($window, $id, $ctrl)
{
    global $wb;
    switch ($id) {
        case IDC_ISTABPAGE:
            $val = wb_get_value($ctrl);
            wb_set_enabled(wb_get_control($wb->winproject, IDC_TABNUMBER), $val);
            wb_set_enabled(wb_get_control($wb->winproject, IDC_TABNUMBERSPINNER), $val);
            break;
        case IDC_CTRLVAR:
            $hastext = wb_get_text($ctrl) !== '';
            wb_set_enabled(wb_get_control($wb->winproject, IDC_STARTCTRLVAL), $hastext);
            break;
        case IDC_LOCALIZE:
            wb_set_enabled(wb_get_control($wb->winproject, IDC_LOCPREFIX), wb_get_value($ctrl));
            break;
        case IDOK:
            // 	Set various settings
            foreach ($wb->project_array as $var) {
                $var = strtolower($var);
                $ctrl = wb_get_control($wb->winproject, constant("IDC_" . strtoupper($var)));
                if (wb_get_class($ctrl) != RadioButton && wb_get_class($ctrl) != CheckBox) {
                    $wb->form[$wb->currentform]->{$var} = wb_get_text($ctrl);
                } else {
                    $wb->form[$wb->currentform]->{$var} = wb_get_value($ctrl);
                }
            }
            // Fall-through
        // Fall-through
        case IDCANCEL:
            set_default_accel();
            wb_destroy_window($window);
            break;
    }
}
function process_options($window, $id, $ctrl)
{
    global $wb;
    switch ($id) {
        case IDC_WIREFRAME:
        case IDC_GRID:
            wb_set_value(wb_get_control($wb->mainwin, $id), wb_get_value($ctrl));
            break;
        case IDC_BROWSE:
            $current = wb_get_text(wb_get_control($window, IDC_FILEPATH));
            $path = wb_sys_dlg_path($window, 'Select default path for project files:', $current);
            if ($path) {
                wb_set_text(wb_get_control($window, IDC_FILEPATH), $path);
            }
            break;
        case IDOK:
            // 	Set various settings
            foreach ($wb->options_array as $var) {
                $var = strtolower($var);
                $ctrl = wb_get_control($wb->winoptions, constant("IDC_" . strtoupper($var)));
                if (wb_get_class($ctrl) == CheckBox) {
                    $wb->{$var} = wb_get_value($ctrl);
                } else {
                    $wb->{$var} = wb_get_text($ctrl);
                }
            }
            // Fall-through
        // Fall-through
        case IDCANCEL:
            set_default_accel();
            wb_destroy_window($window);
            break;
    }
}
function process_prior($window, $id)
{
    global $mainwin, $prior_table;
    switch ($id) {
        case ID_PRIORITYLIST:
            update_prior_controls($window);
            break;
        case ID_NEWITEM:
            $name = wb_get_text(wb_get_control($window, ID_NAME));
            db_edit_record($prior_table, 0, "name", array($name));
            update_priors($window);
            update_prior_controls($window);
            break;
        case ID_SETITEM:
            $name = wb_get_text(wb_get_control($window, ID_NAME));
            $itemlist = wb_get_control($window, ID_PRIORITYLIST);
            $id = db_get_id($prior_table, wb_get_selected($itemlist));
            db_edit_record($prior_table, $id, "name", array($name));
            update_priors($window);
            update_prior_controls($window);
            break;
        case ID_DELETEITEM:
            $itemlist = wb_get_control($window, ID_PRIORITYLIST);
            $selected = wb_get_selected($itemlist);
            $id = db_get_id($prior_table, $selected);
            db_delete_records($prior_table, db_get_id($prior_table, $selected));
            update_priors($window);
            update_prior_controls($window);
            break;
        case ID_MOVEUP:
            $itemlist = wb_get_control($window, ID_PRIORITYLIST);
            $selected = wb_get_selected($itemlist);
            $id = db_get_id($prior_table, $selected);
            db_swap_records($prior_table, db_get_id($prior_table, $selected), db_get_id($prior_table, $selected - 1));
            update_priors($window);
            update_prior_controls($window);
            break;
        case ID_MOVEDOWN:
            $itemlist = wb_get_control($window, ID_PRIORITYLIST);
            $selected = wb_get_selected($itemlist);
            $id = db_get_id($prior_table, $selected);
            db_swap_records($prior_table, db_get_id($prior_table, $selected), db_get_id($prior_table, $selected + 1));
            update_priors($window);
            update_prior_controls($window);
            break;
        case IDCANCEL:
        case IDCLOSE:
        case IDOK:
            wb_destroy_window($window);
            break;
    }
}
function update_item($window)
{
    global $id_edit;
    $name = wb_get_text(wb_get_control($window, ID_NAME));
    $descr = wb_get_text(wb_get_control($window, ID_DESCRIPTION));
    // Fetch the id from table 'cat'
    $id_cat = (int) db_get_id("cat", wb_get_selected(wb_get_control($window, ID_CATLIST)));
    $id_prior = (int) db_get_id("priority", wb_get_selected(wb_get_control($window, ID_PRIORLIST)));
    $id_sever = (int) db_get_id("severity", wb_get_selected(wb_get_control($window, ID_SEVERLIST)));
    $res = db_edit_record("item", $id_edit, "name\ndescription\ncat\npriority\nseverity", array($name, $descr, $id_cat, $id_prior, $id_sever));
    if (!$res) {
        wb_message_box($window, "Problem editing this record.", null, WBC_WARNING);
    }
    return $res;
}
Ejemplo n.º 6
0
/**
 *
 * contact.handle.php
 *
 * @package    core
 * @author     John.meng <*****@*****.**>
 * @author     цот╤РШ
 * @author     QQ:3440895
 * @version    CVS: $Id: contact.handle.php,v 1.1 2006/12/18 05:22:34 arzen Exp $
 */
function process_ContactForm($window, $id, $ctrl, $lparam1 = 0, $lparam2 = 0)
{
    global $wb, $statusbar;
    switch ($id) {
        case IDC_NAV_FIRST:
            $wb->current_page = 1;
            $wb->current_ctl->reset_listview();
            break;
        case IDC_NAV_PRE:
            $wb->current_page -= 1;
            $wb->current_page = $wb->current_page < 1 ? 1 : $wb->current_page;
            $wb->current_ctl->reset_listview();
            break;
        case IDC_NAV_NEXT:
            $wb->current_page += 1;
            $wb->current_page = $wb->current_page > $wb->total_page ? $wb->total_page : $wb->current_page;
            $wb->current_ctl->reset_listview();
            break;
        case IDC_NAV_LAST:
            $wb->current_page = $wb->total_page;
            $wb->current_ctl->reset_listview();
            break;
        case IDC_CATEGORY_SEARCH_SUBMIT:
            $wb->current_category_page = 1;
            $wb->current_ctl->reset_category_listview(wb_get_text($wb->current_ctl->category_keyword));
            break;
        case IDC_CATEGORY_NAV_PRE:
            $wb->current_category_page -= 1;
            $wb->current_category_page = $wb->current_category_page < 1 ? 1 : $wb->current_category_page;
            $wb->current_ctl->reset_category_listview();
            break;
        case IDC_CATEGORY_NAV_NEXT:
            $wb->current_category_page += 1;
            $wb->current_category_page = $wb->current_category_page > $wb->total_category_page ? $wb->total_category_page : $wb->current_category_page;
            $wb->current_ctl->reset_category_listview();
            break;
        case IDC_CATEGORY_SUBMIT:
            $wb->current_ctl->execCategoryAddSubmit();
            $wb->current_ctl->reset_category_listview();
            break;
            //		case IDC_CATEGORY_LIST_VIEW:
            //			$sel = wb_get_selected($wb->current_ctl->category_list);
            //			wb_message_box($wb->mainwin, $sel);
            //
            ////			wb_message_box($wb->mainwin, $wb->vars["Lang"]["lang_sure_logout"]);
            //			break;
    }
}
function process_test_lists($window, $id, $ctrl = 0, $lparam = 0)
{
    //	$ctrl = wb_get_control($window, $id);
    switch ($id) {
        case IDC_LISTLINE:
            $n = wb_get_value($ctrl);
            $text = wb_get_text(wb_get_control($window, IDC_LISTVIEW2027), $n);
            if (is_array($text)) {
                $elem = $text[1];
                $text = implode(" ", $text);
            }
            wb_set_text(wb_get_control($window, IDC_EDIT2064), "{$n} [{$text}]\r\n{$elem}");
            return true;
        case IDC_LISTVIEW2027:
        case IDC_LISTVIEW2067:
            if ($lparam == WBC_DBLCLICK) {
                wb_set_text(wb_get_control($window, IDC_EDIT2064), "Double-clicked.");
            } else {
                $val = wb_get_value($ctrl);
                if ($val && is_array($val)) {
                    $val = implode(", ", $val);
                }
                $sel = wb_get_selected($ctrl);
                if ($sel && is_array($sel)) {
                    $sel = implode(", ", $sel);
                }
                $text = wb_get_text($ctrl);
                if (@is_array($text[0])) {
                    $all = $text;
                    $text = "";
                    foreach ($all as $arr) {
                        $text .= "(" . implode(", ", $arr) . ") ";
                    }
                } elseif (is_array($text)) {
                    $text = implode(", ", $text);
                }
                wb_set_text(wb_get_control($window, IDC_EDIT2064), "Selected rows: {$sel}\nValues: [{$val}]\nText: {$text}");
            }
            return true;
        case IDC_LISTBOX2018:
        case IDC_COMBOBOX2010:
            $val = wb_get_value($ctrl);
            $text = wb_get_text($ctrl);
            wb_set_text(wb_get_control($window, IDC_EDIT2064), "[{$text}] [val: {$val}]");
            return true;
    }
    return false;
}
function process_contact_category_search($window, $id, $ctrl)
{
    global $wb;
    switch ($id) {
        case IDC_SEARCH_SUBMIT:
            $wb->current_page = 1;
            $wb->keyword = wb_get_text(wb_get_control($window, IDC_KEYWORD));
            reset_contact_category_view();
            wb_destroy_window($window);
            break;
        case IDCLOSE:
            // IDCLOSE is predefined
        // IDCLOSE is predefined
        case IDCANCEL:
            wb_destroy_window($window);
            break;
    }
}
function inser_update_agreement($parent)
{
    global $wb;
    $ctrl_map = agreement_ctrl_mapping();
    $table_name = $wb->setting["Settings"]["agreement_table"];
    $set_str = "";
    while (list($ctrl_name, $field_name) = each($ctrl_map)) {
        $value = wb_get_text(wb_get_control($parent, $ctrl_name));
        $set_str .= "{$field_name}='{$value}',";
    }
    $set_str = rtrim($set_str, ',');
    if ($wb->current_action == 'update') {
        $id = $wb->current_ids;
        $sql = "UPDATE {$table_name} SET {$set_str} WHERE id='{$id}' ";
    } else {
        $sql = "INSERT INTO {$table_name} SET {$set_str} ";
    }
    $wb->db->query($sql);
    reset_agreement_view();
}
function insert_update_complaints_category($parent)
{
    global $wb;
    $ctrl_map = complaints_category_ctrl_mapping();
    $table_name = $wb->setting["Settings"]["complaints_category_table"];
    $set_str = "";
    while (list($ctrl_name, $field_name) = each($ctrl_map)) {
        $value = wb_get_text(wb_get_control($parent, $ctrl_name));
        $set_str .= "{$field_name}='{$value}',";
    }
    $set_str = rtrim($set_str, ',');
    if ($wb->current_action == 'update') {
        $id = $wb->current_ids;
        $sql = "UPDATE {$table_name} SET {$set_str} WHERE id='{$id}' ";
    } else {
        $sql = "INSERT INTO {$table_name} SET {$set_str} ";
    }
    $wb->db->query($sql);
    //	include(PATH_FORM."yc_complaints.form.inc.php");
    reset_complaints_category_view();
}
function process_refundment_edit($window, $id, $ctrl)
{
    global $wb;
    switch ($id) {
        case IDC_UPDATE:
            $wb->current_action = 'update';
            wb_set_enabled(wb_get_control($window, IDC_SAVE), true);
            wb_set_enabled(wb_get_control($window, IDC_UPDATE), false);
            break;
        case IDC_SAVE:
            if (!wb_get_text(wb_get_control($window, IDC_REFUNDMENT_COMPANY))) {
                empty_message_box($window, $wb->vars["Lang"]["lang_please_fillup"] . $wb->vars["Lang"]["lang_company"]);
                wb_set_focus(wb_get_control($window, IDC_REFUNDMENT_COMPANY));
            } else {
                inser_update_refundment($window);
                wb_destroy_window($window);
            }
            break;
        case IDCANCEL:
            wb_destroy_window($window);
            break;
    }
}
function process_setting($window, $id, $ctrl)
{
    global $wb;
    switch ($id) {
        case IDOK:
            $wb->setting["Settings"]["db_host"] = wb_get_text(wb_get_control($window, IDC_DB_HOST));
            $wb->setting["Settings"]["db_username"] = wb_get_text(wb_get_control($window, IDC_DB_USERNAME));
            $wb->setting["Settings"]["db_password"] = wb_get_text(wb_get_control($window, IDC_DB_PASSWORD));
            $wb->setting["Settings"]["db_dbname"] = wb_get_text(wb_get_control($window, IDC_DB_NAME));
            $current_lang = wb_get_text(wb_get_control($window, IDC_LANGUAGE));
            include PATH_CONFIG . "common.php";
            $lang_value = array_search($current_lang, $LangOption);
            //			switch ($current_lang)
            //			{
            //				case 'english':
            //					$lang_value='en';
            //					break;
            //				case 'chinese':
            //					$lang_value='zh-cn';
            //					break;
            //
            //			}
            $wb->setting["Settings"]["lang_set"] = $lang_value;
            //			include('include/wb_generic.inc.php');
            //			$contents = generate_ini($wb->setting, "; Store Setting INI file\r\n");
            $contents = generates_ini($wb->setting, "; Store Setting INI file\r\n");
            file_put_contents(PATH_INI . SEETING_DAT, $contents);
            wb_destroy_window($window);
            break;
        case IDCLOSE:
            // IDCLOSE is predefined
        // IDCLOSE is predefined
        case IDCANCEL:
            wb_destroy_window($window);
            break;
    }
}
Ejemplo n.º 13
0
 /**
  * set_timeout
  * no desc
  */
 function set_timeout($timeout, $source = '')
 {
     if ($source == 'wb_text') {
         $ctrl = @wb_get_control($this->wb_parent_window, $timeout);
         if ($ctrl == 0) {
             $this->_error('set_timeout', 'The given control was not found!');
             return false;
         }
         $value = wb_get_text($ctrl);
         if (!empty($value) and $value != '') {
             $timeout = $value;
         }
     }
     $timeout = intval($timeout);
     // default timeout:
     if ($timeout <= 0) {
         $this->_error('set_timeout', 'Timeout value is invalid (must be more than 0)');
         return false;
     } else {
         $this->timeout = $timeout;
     }
     return true;
 }
function get_selected_tree_item_index($window)
{
    global $cat_table, $it_list;
    // Below: get id of selected treeview element. See comment in update_items()
    $it_list = wb_get_control($window, ID_TREE);
    $sel_text = wb_get_text($it_list);
    $cat_data = db_get_data("cat", null, "name");
    $sel_index = (int) array_search($sel_text, $cat_data);
    return $sel_index;
}
Ejemplo n.º 15
0
 function execCategoryAddSubmit()
 {
     global $wb;
     $category_table_name = $wb->setting["Settings"]["contact_category_table"];
     $category_name = wb_get_text($this->category_name);
     $category_active = wb_get_text($this->category_active);
     $sql = "INSERT INTO {$category_table_name} SET category_name = '{$category_name}' ";
     $wb->db->query($sql);
 }
function process_test_values($window, $id, $ctrl = 0, $lparam1 = 0, $lparam2 = 0)
{
    global $statusbar;
    if ($lparam1 == WBC_GETFOCUS) {
        wb_set_text($statusbar, "Focus to control {$id}");
        return false;
    }
    switch ($id) {
        case IDC_EDIT4069:
        case IDC_EDIT4071:
            if ($lparam1 == WBC_KEYDOWN) {
                wb_set_text($statusbar, "Char {$lparam2}: " . chr($lparam2));
            }
            break;
        case IDC_EDIT4057:
            if ($lparam1 == WBC_KEYDOWN) {
                wb_set_text($statusbar, "Char {$lparam2}: " . chr($lparam2));
                //				wb_set_text(wb_get_control($window, IDC_STATIC4048), $lparam2 . "\n" . chr($lparam2));
                break;
            }
            $text = wb_get_text(wb_get_control($window, IDC_EDIT4057));
            wb_set_text(wb_get_control($window, IDC_EDIT4058), $text);
            wb_set_text(wb_get_control($window, IDC_EDIT4059), $text);
            wb_set_text(wb_get_control($window, IDC_EDIT4065), implode(" ", array_fill(0, 20, $text)));
            break;
        case IDC_LISTBOX4053:
            if ($lparam1 & WBC_DBLCLICK) {
                wb_set_text(wb_get_control($window, IDC_STATIC4048), "Double-click");
            } else {
                wb_set_text(wb_get_control($window, IDC_STATIC4048), "Single click");
            }
            break;
        case IDC_HSCROLL4056:
        case IDC_SLIDER4011:
            $value = wb_get_value(wb_get_control($window, $id));
            wb_set_value(wb_get_control($window, IDC_PROGRESSBAR4007), $value);
            wb_set_text(wb_get_control($window, IDC_STATIC4019), $value);
            wb_set_value(wb_get_control($window, IDC_HSCROLL4026), $value);
            wb_set_value(wb_get_control($window, IDC_VSCROLL4051), $value);
            wb_set_value(wb_get_control($window, IDC_UPDOWN4028), $value);
            $value = wb_get_value(wb_get_control($window, $id));
            wb_set_text(wb_get_control($window, IDC_STATIC4048), "Control #{$id}: value [{$value}]\n");
            wb_set_value(wb_get_control($window, IDC_EDIT4052), $value);
            break;
        case IDC_RADIOBUTTON4014:
        case IDC_RADIOBUTTON4015:
        case IDC_RADIOBUTTON4016:
            $value = $id - IDC_RADIOBUTTON4014;
            wb_set_value(wb_get_control($window, IDC_LISTBOX4053), $value);
            wb_set_value(wb_get_control($window, IDC_COMBOBOX4054), $value);
            wb_set_value(wb_get_control($window, IDC_LISTBOX4055), $value);
            break;
        case IDC_CHECKBOX4034:
            wb_set_selected(wb_get_control($window, IDC_CHECKBOX4049), wb_get_selected($ctrl));
            $value = wb_get_value(wb_get_control($window, $id));
            wb_set_text(wb_get_control($window, IDC_STATIC4048), "Control #{$id}: value [{$value}]\n");
            break;
        case IDC_UPDOWN4028:
        case IDC_CHECKBOX4049:
            $value = wb_get_value(wb_get_control($window, $id));
            wb_set_text(wb_get_control($window, IDC_STATIC4048), "Control #{$id}: value [{$value}]\n");
            break;
    }
}
function process_refundment($window, $id, $ctrl, $lparam1 = 0, $lparam2 = 0)
{
    global $wb;
    switch ($id) {
        case IDC_NAV_FIRST:
            $wb->current_page = 1;
            reset_refundment_view();
            break;
        case IDC_NAV_PRE:
            $wb->current_page -= 1;
            $wb->current_page = $wb->current_page < 1 ? 1 : $wb->current_page;
            reset_refundment_view();
            break;
        case IDC_NAV_NEXT:
            $wb->current_page += 1;
            $wb->current_page = $wb->current_page > $wb->total_page ? $wb->total_page : $wb->current_page;
            reset_refundment_view();
            break;
        case IDC_NAV_LAST:
            $wb->current_page = $wb->total_page;
            reset_refundment_view();
            break;
        case IDC_REFUNDMENT_LIST:
            if ($lparam1 == WBC_DBLCLICK) {
                $current_rows = wb_get_text($ctrl);
                $current_id = $current_rows[0][0];
                $wb->current_ids = $current_id;
                $wb->current_form_state = false;
                $wb->current_action = 'update';
                if ($wb->current_ids) {
                    include_once PATH_FORM . "yc_refundment_edit.form.inc.php";
                    create_refundment_edit_dlg();
                }
            }
            // Show current selection and checked items
            $sel = wb_get_selected($ctrl);
            $sel = $sel ? implode(", ", $sel) : "none";
            $contents = wb_get_text($ctrl);
            $text = "";
            if ($contents) {
                foreach ($contents as $row) {
                    $text .= $row ? "[" . implode(", ", $row) . "]  " : "";
                }
            }
            $checked = wb_get_value($ctrl);
            $temp_str = "";
            if ($checked) {
                foreach ($checked as $value) {
                    $row_data = wb_get_text($ctrl, $value, 0);
                    $temp_str .= $row_data . ",";
                }
                $del_ids = rtrim($temp_str, ',');
                $wb->del_ids = $del_ids;
            }
            $checked = $checked ? implode(", ", $checked) : "none";
            wb_set_text($wb->statusbar, "Selected lines: " . $sel . " / checked: " . $checked . " / deleted: " . $del_ids . " / contents: " . $text);
            break;
        case IDC_REFUNDMENT_CATEGORY_LIST:
            if ($lparam1 == WBC_DBLCLICK) {
                $current_rows = wb_get_text($ctrl);
                $current_id = $current_rows[0][0];
                $wb->current_ids = $current_id;
                $wb->current_form_state = false;
                $wb->current_action = 'update';
                if ($wb->current_ids) {
                    include_once PATH_FORM . "yc_refundment_category_edit.form.inc.php";
                    create_refundment_category_edit_dlg();
                }
            }
            // Show current selection and checked items
            $sel = wb_get_selected($ctrl);
            $sel = $sel ? implode(", ", $sel) : "none";
            $contents = wb_get_text($ctrl);
            $text = "";
            if ($contents) {
                foreach ($contents as $row) {
                    $text .= $row ? "[" . implode(", ", $row) . "]  " : "";
                }
            }
            $checked = wb_get_value($ctrl);
            $temp_str = "";
            if ($checked) {
                foreach ($checked as $value) {
                    $row_data = wb_get_text($ctrl, $value, 0);
                    $temp_str .= $row_data . ",";
                }
                $del_ids = rtrim($temp_str, ',');
                $wb->del_ids = $del_ids;
            }
            $checked = $checked ? implode(", ", $checked) : "none";
            wb_set_text($wb->statusbar, "Selected lines: " . $sel . " / checked: " . $checked . " / deleted: " . $del_ids . " / contents: " . $text);
            break;
    }
}
function process_review_edit($window, $id, $ctrl)
{
    global $wb;
    switch ($id) {
        //		case IDC_REVIEW_CAL_SELECT:
        //			wb_set_visible (wb_get_control($window, IDC_REVIEW_CALENDAR), true);
        //			break;
        //		case IDC_REVIEW_CALENDAR:
        //			$date = strftime("%Y-%m-%d %H:%M%:%S", wb_get_value($ctrl));
        //			wb_set_text(wb_get_control($window, IDC_REVIEW_REVIEWDATE), $date);
        ////			wb_set_visible (wb_get_control($window, IDC_REVIEW_CALENDAR), false);
        //			break;
        case IDC_UPDATE:
            $wb->current_action = 'update';
            wb_set_enabled(wb_get_control($window, IDC_SAVE), true);
            wb_set_enabled(wb_get_control($window, IDC_UPDATE), false);
            break;
        case IDC_SAVE:
            if (!wb_get_text(wb_get_control($window, IDC_REVIEW_COMPANY))) {
                empty_message_box($window, $wb->vars["Lang"]["lang_please_fillup"] . $wb->vars["Lang"]["lang_company"]);
                wb_set_focus(wb_get_control($window, IDC_REVIEW_COMPANY));
            } else {
                inser_update_review($window);
                wb_destroy_window($window);
            }
            break;
        case IDCANCEL:
            wb_destroy_window($window);
            break;
    }
}
Ejemplo n.º 19
0
function process_main($window, $id, $ctrl, $lparam1 = 0, $lparam2 = 0)
{
    global $wb;
    switch ($id) {
        case ID_CREATE:
            $wb->current_ids = null;
            $wb->current_action = "insert";
            switch ($wb->current_module) {
                case "contact":
                    include_once PATH_FORM . "yc_contact_edit.form.inc.php";
                    create_contact_edit_dlg();
                    break;
                case "contact_category":
                case "company":
                case "product":
                case "product_category":
                case "opportunity":
                case "order":
                case "order_category":
                case "agreement":
                case "agreement_category":
                case "complaints":
                case "complaints_category":
                case "refundment":
                case "refundment_category":
                case "review":
                    $module_name = $wb->current_module;
                    $function_name = "create_{$module_name}_edit_dlg";
                    include_once PATH_FORM . "yc_{$module_name}_edit.form.inc.php";
                    $function_name();
                    break;
            }
            wb_set_text($wb->statusbar, "Create module: " . $wb->current_module);
            break;
        case IDC_TOOLBAR_SEARCH:
            switch ($wb->current_module) {
                case "contact":
                    create_contact_search_dlg($window);
                    break;
                case "contact_category":
                    create_category_contact_search_dlg($window);
                    break;
                case "company":
                case "product":
                case "product_category":
                case "opportunity":
                case "order":
                case "order_category":
                case "agreement":
                case "agreement_category":
                case "complaints":
                case "complaints_category":
                case "refundment":
                case "refundment_category":
                case "review":
                    $module_name = $wb->current_module;
                    $function_name = "create_{$module_name}_search_dlg";
                    include_once PATH_FORM . "yc_{$module_name}_search.form.inc.php";
                    $function_name();
                    break;
            }
            wb_set_text($wb->statusbar, "Search module: " . $wb->current_module);
            break;
        case ID_DELETE:
            switch ($wb->current_module) {
                case "contact":
                    del_selected_contact();
                    break;
                case "contact_category":
                case "company":
                case "product":
                case "product_category":
                case "opportunity":
                case "order":
                case "order_category":
                case "agreement":
                case "agreement_category":
                case "complaints":
                case "complaints_category":
                case "refundment":
                case "refundment_category":
                case "review":
                    $module_name = $wb->current_module;
                    $function_name = "del_selected_{$module_name}";
                    $function_name();
                    break;
            }
            wb_set_text($wb->statusbar, "Deleted module: " . $wb->current_module);
            break;
        case IDC_LEFT_TREE:
            $selnode = wb_get_selected($wb->tree_view);
            if ($wb->right_control) {
                wb_set_visible($wb->right_control, false);
            }
            switch (wb_get_value($wb->tree_view)) {
                case 2001:
                case 2002:
                    $wb->current_module = "contact";
                    $wb->keyword = null;
                    $wb->current_page = 1;
                    $wb->del_ids = null;
                    displayContactForm();
                    break;
                case 2003:
                    $wb->current_module = "company";
                    $wb->keyword = null;
                    $wb->current_page = 1;
                    $wb->del_ids = null;
                    include_once PATH_FORM . "yc_company.form.inc.php";
                    displayCompanyMainTabForm();
                    break;
                case 2004:
                    $wb->current_module = "product";
                    $wb->keyword = null;
                    $wb->current_page = 1;
                    $wb->del_ids = null;
                    include_once PATH_FORM . "yc_product.form.inc.php";
                    display_product_main_tab_form();
                    break;
                case 2005:
                case 2006:
                    $wb->current_module = "opportunity";
                    $wb->keyword = null;
                    $wb->current_page = 1;
                    $wb->del_ids = null;
                    include_once PATH_FORM . "yc_opportunity.form.inc.php";
                    display_opportunity_main_tab_form();
                    break;
                case 2007:
                    $wb->current_module = "order";
                    $wb->keyword = null;
                    $wb->current_page = 1;
                    $wb->del_ids = null;
                    include_once PATH_FORM . "yc_order.form.inc.php";
                    display_order_main_tab_form();
                    break;
                case 2008:
                    $wb->current_module = "agreement";
                    $wb->keyword = null;
                    $wb->current_page = 1;
                    $wb->del_ids = null;
                    include_once PATH_FORM . "yc_agreement.form.inc.php";
                    display_agreement_main_tab_form();
                    break;
                case 2009:
                case 2010:
                    $wb->current_module = "complaints";
                    $wb->keyword = null;
                    $wb->current_page = 1;
                    $wb->del_ids = null;
                    include_once PATH_FORM . "yc_complaints.form.inc.php";
                    display_complaints_main_tab_form();
                    break;
                case 2011:
                    $wb->current_module = "refundment";
                    $wb->keyword = null;
                    $wb->current_page = 1;
                    $wb->del_ids = null;
                    include_once PATH_FORM . "yc_refundment.form.inc.php";
                    display_refundment_main_tab_form();
                    break;
                case 2012:
                    $wb->current_module = "review";
                    $wb->keyword = null;
                    $wb->current_page = 1;
                    $wb->del_ids = null;
                    include_once PATH_FORM . "yc_review.form.inc.php";
                    display_review_main_tab_form();
                    break;
            }
            wb_set_text($wb->statusbar, "Selected item: " . wb_get_text($wb->tree_view, $selnode) . " / Value: " . wb_get_value($wb->tree_view) . " / Parent: " . wb_get_parent($wb->tree_view, $selnode) . " / Level: " . wb_get_level($wb->tree_view, $selnode) . " / State: " . (wb_get_state($wb->tree_view, $selnode) ? "expanded" : "collapsed"));
            break;
        case IDCLOSE:
            // IDCLOSE is predefined
            if (wb_message_box($wb->mainwin, $wb->vars["Lang"]["lang_sure_logout"], $wb->vars["Lang"]["system_name"], WBC_QUESTION | WBC_YESNO)) {
                wb_destroy_window($window);
            }
            break;
        case ID_ABOUT:
            include_once PATH_FORM . "yc_about.form.inc.php";
            display_about_dlg();
            break;
        case ID_SETTING:
            include_once PATH_FORM . "yc_setting.form.inc.php";
            display_setting_dlg();
            break;
        default:
            if (process_contact($window, $id, $ctrl, $lparam1, $lparam2)) {
                break;
            }
            if (wb_get_class($ctrl) == TabControl && $lparam1 & WBC_HEADERSEL) {
                switch ($id) {
                    case IDC_CONTACT_FORM:
                        if ($lparam2 == 0) {
                            $wb->current_module = "contact";
                        } else {
                            $wb->current_module = "contact_category";
                        }
                        break;
                    case IDC_PRODUCTS_TAB:
                        if ($lparam2 == 0) {
                            $wb->current_module = "product";
                        } else {
                            $wb->current_module = "product_category";
                        }
                        break;
                    case IDC_ORDER_TAB:
                        if ($lparam2 == 0) {
                            $wb->current_module = "order";
                        } else {
                            $wb->current_module = "order_category";
                        }
                        break;
                    case IDC_AGREEMENT_TAB:
                        if ($lparam2 == 0) {
                            $wb->current_module = "agreement";
                        } else {
                            $wb->current_module = "agreement_category";
                        }
                        break;
                    case IDC_COMPLAINTS_TAB:
                        if ($lparam2 == 0) {
                            $wb->current_module = "complaints";
                        } else {
                            $wb->current_module = "complaints_category";
                        }
                        break;
                    case IDC_REFUNDMENT_TAB:
                        if ($lparam2 == 0) {
                            $wb->current_module = "refundment";
                        } else {
                            $wb->current_module = "refundment_category";
                        }
                        break;
                }
                wb_set_text($wb->statusbar, "Tab #{$lparam2} of tab control #{$id} selected.");
            } else {
                wb_set_text($wb->statusbar, "Control ID: " . $id);
            }
            break;
    }
}