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 del_selected_company() { global $wb; if ($wb->del_ids) { $table_name = $wb->setting["Settings"]["company_table"]; $where_is = " WHERE id IN ({$wb->del_ids}) "; $sql = " DELETE FROM {$table_name} {$where_is} "; $wb->db->query($sql); reset_company_view(); $wb->del_ids = null; } else { wb_message_box($wb->mainwin, $wb->vars["Lang"]["lang_deleted_empty"], $wb->vars["Lang"]["system_name"], WBC_WARNING); } }
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; }
<?php /** * WINBINDER - A native Windows binding for PHP * * Copyright © 2005 Hypervisual - see LICENSE.TXT for details * Authors: Rubem Pechansky and Hans Rebel * * Database wrapper functions for WinBinder (MySQL-specific) * version 2b */ if (PHP_VERSION >= "5") { if (!extension_loaded('mysql')) { if (!@dl('php_mysql.dll')) { wb_message_box(null, "MySQL extension could not be loaded.", "Error", WBC_STOP); trigger_error("MySQL extension could not be loaded.\n", E_USER_ERROR); } } } // -------------------------------------------------------------------- CONSTANTS define("DB_MYSQL_WRAP", "db_v2b"); define("FETCH_BOTH", MYSQL_BOTH); define("FETCH_NUM", MYSQL_NUM); define("FETCH_ASSOC", MYSQL_ASSOC); // ----------------------------------------------------------- DATABASE VERSION CHECK /** * raw_get_db_version() * Returns the version of the database library. * * @return string */
function process_main($window, $id, $ctrl) { global $statusbar, $fmod, $mainwin; switch ($id) { case ID_INFOTIMER: $status = "´ÅÅÌ: " . $fmod->fmod_GetOutputName() . " "; $status .= "¸èÇú³¤¶È: " . $fmod->fmod_GetLenght(true) . " ·ÖÖÓ "; $status .= "ÒѲ¥·Å: " . $fmod->fmod_Msec2Time($fmod->fmod_GetTime(true)) . " sec "; if ($song_name = $fmod->fmodStreamUrl) { $status .= "Ãû³Æ: {$song_name} "; } wb_set_text($statusbar, $status); // play position if ($fmod->fmod_GetLenght(false)) { wb_set_value(wb_get_control($mainwin, ID_PLAY_POS), round($fmod->fmod_GetTime(false) / $fmod->fmod_GetLenght(false), 2) * 100); } if ($fmod->fmod_GetTime(false) == $fmod->fmod_GetLenght(false)) { $fmod->fmod_StreamOpen($fmod->fmodStreamUrl); $fmod->fmod_StreamPlay(); } break; case ID_OPEN: $filename = wb_sys_dlg_open(); if ($filename) { if ($fmod->fmod_StreamOpen($filename)) { $fmod->fmod_StreamPlay(); // returns true, then play } else { wb_message_box($window, "Error opening Audiostream!\n" . $fmod->lasterror, APPNAME, WBC_INFO); } } break; case ID_CLOSE: $fmod->fmod_StreamStop(); break; case ID_PLAY: $fmod->fmod_StreamPlay(); break; case ID_STOP: $fmod->fmod_StreamStop(); break; case ID_PAUSE: if ($fmod->fmodStreamState == 1) { switch ($fmod->fmodIsPaused) { case 0: $fmod->fmod_SoundPause(true); wb_set_text($ctrl, "¼ÌÐø.."); break; case 1: $fmod->fmod_SoundPause(false); wb_set_text($ctrl, "ÔÝÍ£"); break; } } break; case ID_MUTE: if ($fmod->fmodStreamState == 1) { switch ($fmod->fmodIsMuted) { case 0: $fmod->fmod_SoundMute(true); wb_set_text($ctrl, "·ÅÒô"); break; case 1: $fmod->fmod_SoundMute(false); wb_set_text($ctrl, "¾²Òô"); break; } } break; case ID_SURROUND: switch ($fmod->fmodSurroundEnabled) { case 0: $fmod->fmod_SetSurround(true); wb_set_text($ctrl, "Ñ»·"); break; case 1: $fmod->fmod_SetSurround(false); wb_set_text($ctrl, "²»Ñ»·"); break; } break; case ID_VOLUMEN: $fmod->fmod_SetVolumen(wb_get_value($ctrl)); wb_set_text($statusbar, "ÒôÁ¿: " . $fmod->fmod_GetVolumen()); break; case ID_BALANCE: $fmod->fmod_SetPanning(wb_get_value($ctrl)); break; case ID_BALCENTER: $fmod->fmod_SetPanning(127); wb_set_value(wb_get_control($window, ID_BALANCE), 127); break; case IDCLOSE: $fmod->fmod_SoundClose(); wb_release_library($fmod->fmodlib); wb_destroy_window($window); break; } }
define("FIF_PPMRAW", 15); define("FIF_RAS", 16); define("FIF_TARGA", 17); define("FIF_TIFF", 18); define("FIF_WBMP", 19); define("FIF_PSD", 20); define("FIF_CUT", 21); define("FIF_XBM", 22); define("FIF_XPM", 23); define("FIF_DDS", 24); define("FIF_GIF", 25); //------------------------------------------------------------- GLOBAL VARIABLES if (!isset($FI)) { $FI = wb_load_library("ext\\freeimage"); if (!$FI) { wb_message_box(null, "FreeImage extension could not be loaded.", "Error", WBC_STOP); die; } } //-------------------------------------------------------------------- FUNCTIONS function FreeImage_GetVersion() { global $FI; static $pfn = null; if ($pfn === null) { $pfn = wb_get_function_address("FreeImage_GetVersion", $FI); } // Must use wb_peek because this function returns a string pointer $version = wb_peek(wb_call_function($pfn)); return $version; }
function _error($function, $str) { if (!$this->silent) { $errmsg = 'wb_httpget error in function "' . $function . '":'; $errmsg .= "\n\n"; $errmsg .= $str; if (is_numeric($this->wb_parent_window)) { wb_message_box($this->wb_parent_window, $errmsg, APPNAME, WBC_INFO); } else { print $errmsg; } } $this->status = 'error'; }
function save_settings() { global $wb; wb_set_text($wb->statusbar, "Saving configuration..."); // Get values save_window_geom($wb->mainwin, "main", true); // Get various settings foreach ($wb->options_array as $var) { $var = strtolower($var); if ($wb->{$var} === '') { $wb->settings["Settings"][$var] = ''; } elseif (preg_match("/[\\d\\.\\,]+/", $wb->{$var})) { $wb->settings["Settings"][$var] = (int) $wb->{$var}; } else { $wb->settings["Settings"][$var] = $wb->{$var}; } } // Save options to INI file $contents = generate_ini($wb->settings, "; Make Release INI file\r\n"); if ($contents) { file_put_contents(SYS_INIFILE, $contents); wb_set_text($wb->statusbar, "Configuration saved."); } else { wb_message_box($wb->mainwin, "Problem saving file " . SYS_INIFILE); } }
/** * * formhelper.php * * @package core * @author John.meng <*****@*****.**> * @author цот╤РШ * @author QQ:3440895 * @version CVS: $Id: formhelper.php,v 1.2 2006/12/25 14:53:35 arzen Exp $ */ function empty_message_box($parent, $message) { global $wb; wb_message_box($parent, $message, $wb->vars["Lang"]["system_name"], WBC_WARNING); }
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; } }