Exemple #1
0
function auth_gen_form()
{
    global $sql;
    $page = new dom_root();
    $page->title = 'Вход в систему';
    $auth_div = new dom_auth_request();
    //$page->append_child($auth_div);
    $cont = new dom_table();
    $tr = new dom_tr();
    $td = new dom_td();
    $d = new dom_div();
    $d->css_style['top'] = '1px';
    $d->css_style['bottom'] = '1px';
    $d->css_style['left'] = '1px';
    $d->css_style['right'] = '1px';
    $d->css_style['position'] = 'fixed';
    $d->css_style['display'] = 'block';
    $cont->css_style['height'] = '100%';
    $cont->css_style['width'] = '100%';
    $td->css_style['height'] = '100%';
    $cont->append_child($tr);
    $tr->append_child($td);
    $td->append_child($auth_div);
    $d->append_child($cont);
    $page->append_child($d);
    //$txt=new dom_statictext;
    //$txt->text=md5('test');
    //$page->append_child($txt);
    $page->scripts['core.js'] = '/js/core.js';
    $page->scripts['commoncontrols.js'] = '/js/commoncontrols.js';
    $page->endscripts[] = "var ct=\$i('" . $auth_div->username->id_gen() . "');ct.focus();ct.selectionStart=0;ct.selectionEnd=ct.value.length;";
    $settings_tool = new settings_tool();
    $page->for_each_set('oid', -1);
    $page->collect_oids($settings_tool);
    $page->settings_array = $settings_tool->read_oids($sql);
    $page->after_build();
    print $page->html();
    //print_r($_SERVER);
    exit;
}
Exemple #2
0
 function handle_event($ev)
 {
     global $sql;
     // !
     $changed = false;
     $this->name = $ev->parent_name;
     $this->context =& $ev->context;
     $this->oid = $ev->context[$ev->long_name]['oid'];
     $this->long_name = $ev->parent_name;
     $settings = new settings_tool();
     $this->current_task = dom_root::setting_val(-1, $this->name . '.current_task', 0);
     $total_count_id = $ev->context[$ev->parent_name]['total_count_id'];
     if ($ev->rem_name == 'print_date') {
         $sql->query($settings->set_query(-1, $ev->long_name, $_SESSION['uid'], 0, $_POST['val']));
     }
     if ($ev->rem_name == 'fltr') {
         //child node targeted event
         $_SESSION['fltr'] = $_POST['val'];
         $_SESSION['ed_offset'] = 0;
         print "\$i('" . js_escape($ev->context[$ev->parent_name]['ed_offset_id']) . "').value='0';";
         print "\$i('" . js_escape($ev->context[$ev->parent_name]['ed_offset_id']) . "').oldval='0';";
         $changed = true;
     }
     if (preg_match('/^speed$|^density$|^ipp_host$|^ipp_printer$/', $ev->rem_name)) {
         $sql->query($settings->set_query(-1, $ev->long_name, $_SESSION['uid'], 0, $_POST['val']));
     }
     if ($ev->rem_name == 'ed_count') {
         //child node targeted event
         $_SESSION['ed_count'] = intval($_POST['val']);
         $changed = true;
     }
     if ($ev->rem_name == 'do_logout') {
         //child node targeted event
         unset($_SESSION['uid']);
         print "window.location.reload(true);";
     }
     if ($ev->rem_name == 'ed_offset') {
         //child node targeted event
         $_SESSION['ed_offset'] = intval($_POST['val']);
         $changed = true;
     }
     if ($ev->rem_name == 'current_task') {
         //child node targeted event
         $sql->query($settings->set_query(-1, $ev->long_name, $_SESSION['uid'], 0, $_POST['val']));
         $this->current_task = $_POST['val'];
         $changed = true;
     }
     if ($ev->rem_name == 'only_selected') {
         //child node targeted event
         $_SESSION['selonly'] = $_POST['val'];
         if ($_POST['val'] == 1) {
             $_SESSION['fltr'] = '';
             print "\$i('" . js_escape($ev->context[$ev->parent_name]['fltr_id']) . "').value='';";
             print "\$i('" . js_escape($ev->context[$ev->parent_name]['fltr_id']) . "').oldval='';";
             $_SESSION['ed_offset'] = 0;
             //intval($_POST['val']);
             print "\$i('" . js_escape($ev->context[$ev->parent_name]['ed_offset_id']) . "').value='0';";
             print "\$i('" . js_escape($ev->context[$ev->parent_name]['ed_offset_id']) . "').oldval='0';";
         }
         $changed = true;
     }
     if ($ev->rem_name == 'subtract_current') {
         $this->subtract_current();
         print "window.location.reload(true);";
         exit;
     }
     if ($ev->rem_name == 'clear_btn') {
         //child node targeted event
         //$_SESSION['selonly']=0;
         $_SESSION['selonly'] = 0;
         print "\$i('" . js_escape($ev->context[$ev->parent_name]['selonly_id']) . "').checked=0;";
         $this->selclear();
         $changed = true;
     }
     /*		
     $ipp = new PrintIPP();
     $ipp->setHost("localhost");
     $ipp->setPrinterURI("/printers/epson");
     $ipp->setData("./testfiles/test-utf8.txt"); // Path to file.
     $ipp->printJob();
     */
     if ($ev->rem_name == 'print_direct_btn') {
         //child node targeted event
         //$_SESSION['selonly']=0;
         $this->print_direct();
         $changed = true;
     }
     if ($ev->rem_name == 'print_direct_btn_acct') {
         //child node targeted event
         //$_SESSION['selonly']=0;
         $this->print_direct();
         $this->subtract_current();
         print "window.location.reload(true);";
         exit;
     }
     if ($ev->rem_name == 'qw.ed2') {
         //child node targeted event
         //$_SESSION['selonly']=0;
         $this->print_direct($ev->keys['id']);
         $this->subtract_current();
         print "window.location.reload(true);";
         exit;
     }
     if ($ev->rem_name == 'print_direct_btn_+1') {
         //child node targeted event
         //$_SESSION['selonly']=0;
         $this->print_plus_1();
         print "window.location.reload(true);";
         exit;
     }
     if ($changed) {
         //common part
         $customid = $ev->context[$ev->parent_name]['retid'];
         $oid = $ev->context[$ev->long_name]['oid'];
         $htmlid = $ev->context[$ev->long_name]['htmlid'];
         $r = new query_result_viewer_codes();
         $r->context =& $ev->context;
         $r->keys =& $ev->keys;
         $r->oid = $oid;
         $r->name = $ev->parent_name . '.qw';
         $r->etype = $ev->parent_type . '.query_result_viewer_codes';
         $this->setup($r);
         $r->bootstrap();
         print "var nya=\$i('" . js_escape($customid) . "');" . "try{nya.innerHTML=";
         reload_object($r);
         print "nya.scrollTop=0;}catch(e){ window.location.reload(true);};";
     }
     $evparent_name = $ev->parent_name;
     editor_generic::handle_event($ev);
     $this->clean_zeroes();
     unset($this->editors['total_count']->com_parent);
     $this->editors['total_count']->name = $evparent_name . '.total_count';
     $this->setup_h();
     print "var nya=\$i('" . js_escape($total_count_id) . "');" . "try{nya.innerHTML=";
     reload_object($this->editors['total_count']);
     print "}catch(e){nya.innerHTML='exception';};";
 }
Exemple #3
0
        $td = new dom_div();
        $txt = new dom_statictext();
        $txt->text = $i;
        $td->append_child($txt);
        $tr->append_child($td);
        $td = new dom_div();
        $txt = new dom_statictext();
        $txt->text = $v;
        $td->append_child($txt);
        $tr->append_child($td);
        $tr->attributes['width'] = $cnt++ % 2;
        $res->append_child($tr);
    }
    return $res;
}
$test = new dom_root();
$test->title = 'preved';
$div = new dom_div();
$div->name = '1';
$div->css_style['background-color'] = 'red';
$div->css_style['width'] = '15em';
$div->css_style['height'] = 'auto';
$div->css_style['position'] = 'absolute';
$div->css_style['left'] = '50';
$div->css_style['top'] = '50';
$text = new dom_statichtml();
$text->text = "<u>krossafcheg </u>\n<br>";
$test->append_child($div);
$div_id = $div->id;
$div = new dom_div();
$div->name = '2';