Example #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;
    }
}
/**
 *
 * yc_agreement_search.form.inc.php.
 *
 * @package    core
 * @author     John.meng <*****@*****.**>
 * @author     цот╤РШ
 * @author     QQ:3440895
 * @version    CVS: $Id: yc_agreement_search.form.inc.php,v 1.1 2006/12/24 11:46:48 arzen Exp $
 */
function create_agreement_search_dlg()
{
    global $wb;
    include PATH_FORM . "yc_agreement_search.form.php";
    wb_set_handler($search_form, "process_agreement_search");
    wb_set_visible($search_form, true);
}
/**
 *
 * yc_about.form.inc.php
 *
 * @package    core
 * @author     John.meng <*****@*****.**>
 * @author     цот╤РШ
 * @author     QQ:3440895
 * @version    CVS: $Id: yc_about.form.inc.php,v 1.1 2006/12/24 01:17:28 arzen Exp $
 */
function display_about_dlg()
{
    global $wb;
    include PATH_FORM . "yc_about.form.php";
    wb_set_visible($winmain, true);
    wb_set_handler($winmain, "process_about");
}
function create_project_dlg($parent)
{
    global $wb;
    include "fe_project.form.php";
    // 	Read various settings
    foreach ($wb->project_array as $var) {
        $var = strtolower($var);
        $ctrl = wb_get_control($wb->winproject, constant("IDC_" . strtoupper($var)));
        if (preg_match("/[\\d\\.\\,]+/", $wb->form[$wb->currentform]->{$var})) {
            wb_set_value($ctrl, $wb->form[$wb->currentform]->{$var});
        } else {
            if (wb_get_class($ctrl) != RadioButton && wb_get_class($ctrl) != CheckBox) {
                wb_set_text($ctrl, $wb->form[$wb->currentform]->{$var});
            }
        }
    }
    // Disable / enable controls according to context
    wb_set_enabled(wb_get_control($wb->winproject, IDC_LOCPREFIX), wb_get_value(wb_get_control($wb->winproject, IDC_LOCALIZE)));
    $val = wb_get_value(wb_get_control($wb->winproject, IDC_ISTABPAGE));
    wb_set_enabled(wb_get_control($wb->winproject, IDC_TABNUMBER), $val);
    wb_set_enabled(wb_get_control($wb->winproject, IDC_TABNUMBERSPINNER), $val);
    $hastext = wb_get_text(wb_get_control($wb->winproject, IDC_CTRLVAR)) !== '';
    wb_set_enabled(wb_get_control($wb->winproject, IDC_STARTCTRLVAL), $hastext);
    wb_set_handler($wb->winproject, "process_project");
    wb_set_visible($wb->winproject, true);
    set_default_accel($wb->winproject, false);
}
/**
 *
 * yc_contact_search.form.inc.php.
 *
 * @package    core
 * @author     John.meng <*****@*****.**>
 * @author     цот╤РШ
 * @author     QQ:3440895
 * @version    CVS: $Id: yc_contact_category_search.form.inc.php,v 1.1 2006/12/20 04:49:59 arzen Exp $
 */
function create_category_contact_search_dlg($parent)
{
    global $wb;
    include PATH_FORM . "yc_contact_category_search.form.php";
    wb_set_handler($wb->contact_search, "process_contact_category_search");
    wb_set_visible($wb->contact_search, true);
}
/**
 *
 * yc_order_category_search.form.inc.php.
 *
 * @package    core
 * @author     John.meng <*****@*****.**>
 * @author     цот╤РШ
 * @author     QQ:3440895
 * @version    CVS: $Id: yc_order_category_search.form.inc.php,v 1.1 2006/12/24 11:46:48 arzen Exp $
 */
function create_order_category_search_dlg()
{
    global $wb;
    include PATH_FORM . "yc_order_category_search.form.php";
    wb_set_handler($search_form, "process_order_category_search");
    wb_set_visible($search_form, true);
}
/**
 *
 * yc_contact_search.form.inc.php.
 *
 * @package    core
 * @author     John.meng <*****@*****.**>
 * @author     цот╤РШ
 * @author     QQ:3440895
 * @version    CVS: $Id: yc_contact_search.form.inc.php,v 1.2 2006/12/20 04:49:59 arzen Exp $
 */
function create_contact_search_dlg($parent)
{
    global $wb;
    include PATH_FORM . "yc_contact_search.form.php";
    wb_set_handler($wb->contact_search, "process_contact_search");
    wb_set_visible($wb->contact_search, true);
    //	set_default_accel($wb->contact_search, false);
}
/**
 *
 * yc_about.form.inc.php
 *
 * @package    core
 * @author     John.meng <*****@*****.**>
 * @author     цот╤РШ
 * @author     QQ:3440895
 * @version    CVS: $Id: yc_setting.form.inc.php,v 1.4 2006/12/25 12:37:27 arzen Exp $
 */
function display_setting_dlg()
{
    global $wb;
    include PATH_FORM . "yc_setting.form.php";
    wb_set_text(wb_get_control($winmain, IDC_DB_HOST), $wb->setting["Settings"]["db_host"]);
    wb_set_text(wb_get_control($winmain, IDC_DB_USERNAME), $wb->setting["Settings"]["db_username"]);
    wb_set_text(wb_get_control($winmain, IDC_DB_PASSWORD), $wb->setting["Settings"]["db_password"]);
    wb_set_text(wb_get_control($winmain, IDC_DB_NAME), $wb->setting["Settings"]["db_dbname"]);
    include PATH_CONFIG . "common.php";
    $items = array_values($LangOption);
    wb_set_text(wb_get_control($winmain, IDC_LANGUAGE), $items);
    wb_set_text(wb_get_control($winmain, IDC_LANGUAGE), $LangOption[$wb->setting["Settings"]["lang_set"]]);
    //	wb_set_selected(wb_get_control($winmain, IDC_LANGUAGE),$LangOption[$wb->setting["Settings"]["lang_set"]]);
    wb_set_visible($winmain, true);
    wb_set_handler($winmain, "process_setting");
}
function create_contact_edit_dlg()
{
    global $wb;
    include PATH_FORM . "yc_contact_edit.form.php";
    //-------- view detail -------
    if ($id = $wb->current_ids) {
        getContactByID($winmain, $id);
        //		wb_message_box($wb->mainwin,$id);//implode(",",$all_ctrl)
    }
    if ($wb->current_action == "insert") {
        wb_set_enabled(wb_get_control($winmain, IDC_CONTACT_SAVE), true);
        wb_set_enabled(wb_get_control($winmain, IDC_CONTACT_UPDATE), false);
    } else {
        wb_set_enabled(wb_get_control($winmain, IDC_CONTACT_SAVE), false);
        wb_set_enabled(wb_get_control($winmain, IDC_CONTACT_UPDATE), true);
    }
    wb_set_handler($winmain, "process_contact_edit");
    wb_set_visible($winmain, true);
}
function create_refundment_edit_dlg()
{
    global $wb;
    include PATH_FORM . "yc_refundment_edit.form.php";
    wb_set_text(wb_get_control($winmain, IDC_REFUNDMENT_HANDLEDATE), date("0000-00-00 00:00:00"));
    //-------- view detail -------
    if ($id = $wb->current_ids) {
        get_refundment_by_id($winmain, $id);
        //		wb_message_box($wb->mainwin,$id);//implode(",",$all_ctrl)
    }
    if ($wb->current_action == "insert") {
        wb_set_enabled(wb_get_control($winmain, IDC_SAVE), true);
        wb_set_enabled(wb_get_control($winmain, IDC_UPDATE), false);
    } else {
        wb_set_enabled(wb_get_control($winmain, IDC_SAVE), false);
        wb_set_enabled(wb_get_control($winmain, IDC_UPDATE), true);
    }
    wb_set_handler($winmain, "process_refundment_edit");
    wb_set_visible($winmain, true);
}
function create_edit_dlg($parent, $id, $cat = null)
{
    global $id_edit, $curr_cat;
    $id_edit = $id;
    $curr_cat = $cat;
    // Remove the line below while not under development
    file_put_contents("dlg_item.rc.php", "<?php\n\n" . parse_rc(file_get_contents(PATH_DATA . "dlg_item.rc"), '$dlg', '$parent', 'ModalDialog', null, WBC_CENTER, WBC_CENTER, WBC_CENTER, WBC_CENTER, 'WBC_INVISIBLE') . "\n?>");
    include "dlg_item.rc.php";
    wb_set_handler($dlg, "process_item");
    wb_set_text($dlg, $id ? "Edit item #{$id}" : "Create new item");
    // Fill up the lists
    $item_data = db_get_data("cat", null, array("name"));
    wb_set_text(wb_get_control($dlg, ID_CATLIST), $item_data);
    $item_data = db_get_data("priority", null, array("name"));
    wb_set_text(wb_get_control($dlg, ID_PRIORLIST), $item_data);
    $item_data = db_get_data("severity", null, array("name"));
    wb_set_text(wb_get_control($dlg, ID_SEVERLIST), $item_data);
    update_item_controls($dlg);
    wb_set_visible($dlg, true);
}
function create_options_dlg($parent)
{
    global $wb;
    include "fe_options.form.php";
    // 	Read various settings
    foreach ($wb->options_array as $var) {
        $var = strtolower($var);
        $ctrl = wb_get_control($wb->winoptions, constant("IDC_" . strtoupper($var)));
        if (preg_match("/[\\d\\.\\,]+/", $wb->{$var})) {
            wb_set_value($ctrl, $wb->{$var});
        } else {
            if (wb_get_class($ctrl) != RadioButton && wb_get_class($ctrl) != CheckBox) {
                wb_set_text($ctrl, $wb->{$var});
            }
        }
    }
    wb_set_handler($wb->winoptions, "process_options");
    wb_set_visible($wb->winoptions, true);
    set_default_accel($wb->winoptions, false);
}
function reset_form($class, $parent, $title, $width, $height, $style = 0, $value = 0)
{
    global $wb;
    $wb->currentform = 0;
    $wb->proj_filename = null;
    if (!isset($wb->form[$wb->currentform])) {
        $wb->form[$wb->currentform] = new stdclass();
    }
    // Reset form data with fixed attributes
    $wb->form[$wb->currentform]->ct = array();
    $wb->form[$wb->currentform]->numcontrols = 0;
    $wb->form[$wb->currentform]->ncurrindex = 0;
    $wb->form[$wb->currentform]->nselcontrol = -1;
    $wb->form[$wb->currentform]->treenode = 0;
    foreach ($wb->project_array as $var) {
        $wb->form[$wb->currentform]->{$var} = constant("DEFAULT_" . strtoupper($var));
    }
    // Variable attributes
    $wb->form[$wb->currentform]->width = $width;
    $wb->form[$wb->currentform]->height = $height;
    $wb->form[$wb->currentform]->caption = $title;
    $wb->form[$wb->currentform]->cclass = $class;
    $wb->form[$wb->currentform]->style = (int) $style;
    $wb->form[$wb->currentform]->value = (int) $value;
    // Resize, reposition and show form
    $pos = wb_get_position($parent);
    wb_set_position($wb->formwin, $pos[0] + 180, $pos[1] + 76);
    wb_set_size($wb->formwin, $width, $height);
    wb_set_text($wb->formwin, $title);
    wb_set_visible($wb->formwin, true);
    // Create a treeview item for this form
    wb_delete_items($wb->tree, $wb->form[$wb->currentform]->treenode);
    $root = $wb->rootnode;
    $node = wb_create_items($wb->tree, array(array($title, $wb->currentform, $root, 8, 9, 2)));
    $wb->form[$wb->currentform]->treenode = $node;
    // numforms is always set to 1
    $wb->numforms = 1;
    // Expand the root and select the new node
    wb_set_state($wb->tree, $root, 1);
    wb_set_selected($wb->tree, $node);
}
function create_review_edit_dlg()
{
    global $wb;
    include PATH_FORM . "yc_review_edit.form.php";
    include PATH_CONFIG . "common.php";
    $items = array_values($ReviewwayOption);
    wb_set_text(wb_get_control($winmain, IDC_REVIEW_CATEGORY), $items);
    wb_set_text(wb_get_control($winmain, IDC_REVIEW_REVIEWDATE), date("Y-m-d H:i:s"));
    //	wb_set_visible (wb_get_control($winmain, IDC_REVIEW_CALENDAR), false);
    //-------- view detail -------
    if ($id = $wb->current_ids) {
        get_review_by_id($winmain, $id);
        //		wb_message_box($wb->mainwin,$id);//implode(",",$all_ctrl)
    }
    if ($wb->current_action == "insert") {
        wb_set_enabled(wb_get_control($winmain, IDC_SAVE), true);
        wb_set_enabled(wb_get_control($winmain, IDC_UPDATE), false);
    } else {
        wb_set_enabled(wb_get_control($winmain, IDC_SAVE), false);
        wb_set_enabled(wb_get_control($winmain, IDC_UPDATE), true);
    }
    wb_set_handler($winmain, "process_review_edit");
    wb_set_visible($winmain, true);
}
Example #15
0
 function wb_hideWindow($wid, $timer = null)
 {
     if (isset(self::$wb_windows[$wid])) {
         if (!is_null($timer)) {
             wb_destroy_timer(self::$wb_windows[$wid], $timer);
         }
         wb_set_visible(self::$wb_windows[$wid], false);
     }
 }
Example #16
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;
    }
}