<?php

/**
 *
 * yc_main.form.inc.php
 *
 * @package    core
 * @author     John.meng <*****@*****.**>
 * @author     цот╤РШ
 * @author     QQ:3440895
 * @version    CVS: $Id: yc_main.form.inc.php,v 1.2 2006/12/24 01:17:28 arzen Exp $
 */
include_once PATH_FORM . "yc_main.form.php";
wb_set_image($wb->tree_view, PATH_RES . "treeview.bmp", GREEN, 0, 10);
$items = wb_create_items($wb->tree_view, array(array($wb->vars["Lang"]["lang_cust"] . $wb->vars["Lang"]["lang_manage"], 2001), array($wb->vars["Lang"]["lang_contact"], 2002, 1), array($wb->vars["Lang"]["lang_company"], 2003, 1), array($wb->vars["Lang"]["lang_product"], 2004, 1), array($wb->vars["Lang"]["lang_sale"] . $wb->vars["Lang"]["lang_manage"], 2005), array($wb->vars["Lang"]["lang_opportunity"], 2006, 1), array($wb->vars["Lang"]["lang_order"], 2007, 1), array($wb->vars["Lang"]["lang_agreement"], 2008, 1), array($wb->vars["Lang"]["lang_afterservice"] . $wb->vars["Lang"]["lang_manage"], 2009), array($wb->vars["Lang"]["lang_complaints"], 2010, 1), array($wb->vars["Lang"]["lang_refundment"], 2011, 1), array($wb->vars["Lang"]["lang_review"], 2012, 1)));
wb_set_state($wb->tree_view, $items[0], true);
wb_set_state($wb->tree_view, $items[4], true);
wb_set_state($wb->tree_view, $items[8], true);
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);
}