Subversion Repositories oidplus

Rev

Rev 790 | Rev 801 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 790 Rev 800
Line 26... Line 26...
26
 
26
 
27
                if (count($dirs) == 0) {
27
                if (count($dirs) == 0) {
28
                        $icon = null;
28
                        $icon = null;
29
                } else {
29
                } else {
30
                        $dir = $dirs[0];
30
                        $dir = $dirs[0];
-
 
31
                        $icon_name = $ot::rootIconname('root');
-
 
32
                        if (!$icon_name) return null;
31
                        $icon = $dir.'/img/treeicon_root.png';
33
                        $icon = $dir.'/'.$icon_name;
32
                        if (!file_exists($icon)) $icon = null;
34
                        if (!file_exists($icon)) return null;
33
                        $icon = substr($icon, strlen(OIDplus::localpath()));
35
                        $icon = substr($icon, strlen(OIDplus::localpath()));
34
                }
36
                }
35
 
37
 
36
                return $icon;
38
                return $icon;
37
        }
39
        }
Line 462... Line 464...
462
        public function gui($id, &$out, &$handled) {
464
        public function gui($id, &$out, &$handled) {
463
                if ($id === 'oidplus:system') {
465
                if ($id === 'oidplus:system') {
464
                        $handled = true;
466
                        $handled = true;
465
 
467
 
466
                        $out['title'] = OIDplus::config()->getValue('system_title');
468
                        $out['title'] = OIDplus::config()->getValue('system_title');
467
                        $out['icon'] = OIDplus::webpath(__DIR__).'system_big.png';
469
                        $out['icon'] = OIDplus::webpath(__DIR__,true).'img/main_icon.png';
468
 
470
 
469
                        if (file_exists(OIDplus::localpath() . 'userdata/welcome/welcome$'.OIDplus::getCurrentLang().'.html')) {
471
                        if (file_exists(OIDplus::localpath() . 'userdata/welcome/welcome$'.OIDplus::getCurrentLang().'.html')) {
470
                                $cont = file_get_contents(OIDplus::localpath() . 'userdata/welcome/welcome$'.OIDplus::getCurrentLang().'.html');
472
                                $cont = file_get_contents(OIDplus::localpath() . 'userdata/welcome/welcome$'.OIDplus::getCurrentLang().'.html');
471
                        } else if (file_exists(OIDplus::localpath() . 'userdata/welcome/welcome.html')) {
473
                        } else if (file_exists(OIDplus::localpath() . 'userdata/welcome/welcome.html')) {
472
                                $cont = file_get_contents(OIDplus::localpath() . 'userdata/welcome/welcome.html');
474
                                $cont = file_get_contents(OIDplus::localpath() . 'userdata/welcome/welcome.html');
Line 507... Line 509...
507
                if (!is_null($obj)) {
509
                if (!is_null($obj)) {
508
                        $handled = true;
510
                        $handled = true;
509
 
511
 
510
                        if (!$obj->userHasReadRights()) {
512
                        if (!$obj->userHasReadRights()) {
511
                                $out['title'] = _L('Access denied');
513
                                $out['title'] = _L('Access denied');
512
                                $out['icon'] = 'img/error_big.png';
514
                                $out['icon'] = 'img/error.png';
513
                                $out['text'] = '<p>'._L('Please <a %1>log in</a> to receive information about this object.',OIDplus::gui()->link('oidplus:login')).'</p>';
515
                                $out['text'] = '<p>'._L('Please <a %1>log in</a> to receive information about this object.',OIDplus::gui()->link('oidplus:login')).'</p>';
514
                                return;
516
                                return;
515
                        }
517
                        }
516
 
518
 
517
                        $parent = null;
519
                        $parent = null;
Line 528... Line 530...
528
                                        } else {
530
                                        } else {
529
                                                $res = OIDplus::db()->query("select * from ###objects where id = ?", array($obj->nodeId()));
531
                                                $res = OIDplus::db()->query("select * from ###objects where id = ?", array($obj->nodeId()));
530
                                                if (!$res->any()) {
532
                                                if (!$res->any()) {
531
                                                        http_response_code(404);
533
                                                        http_response_code(404);
532
                                                        $out['title'] = _L('Object not found');
534
                                                        $out['title'] = _L('Object not found');
533
                                                        $out['icon'] = 'img/error_big.png';
535
                                                        $out['icon'] = 'img/error.png';
534
                                                        $out['text'] = _L('The object %1 was not found in this database.','<code>'.htmlentities($id).'</code>');
536
                                                        $out['text'] = _L('The object %1 was not found in this database.','<code>'.htmlentities($id).'</code>');
535
                                                        return;
537
                                                        return;
536
                                                } else {
538
                                                } else {
537
                                                        $row = $res->fetch_array(); // will be used further down the code
539
                                                        $row = $res->fetch_array(); // will be used further down the code
538
                                                        $obj->getContentPage($out['title'], $out['text'], $out['icon']);
540
                                                        $obj->getContentPage($out['title'], $out['text'], $out['icon']);
Line 544... Line 546...
544
                                }
546
                                }
545
                        }
547
                        }
546
                        if (!$matches_any_registered_type) {
548
                        if (!$matches_any_registered_type) {
547
                                http_response_code(404);
549
                                http_response_code(404);
548
                                $out['title'] = _L('Object not found');
550
                                $out['title'] = _L('Object not found');
549
                                $out['icon'] = 'img/error_big.png';
551
                                $out['icon'] = 'img/error.png';
550
                                $out['text'] = _L('The object %1 was not found in this database.','<code>'.htmlentities($id).'</code>');
552
                                $out['text'] = _L('The object %1 was not found in this database.','<code>'.htmlentities($id).'</code>');
551
                                return;
553
                                return;
552
                        }
554
                        }
553
 
555
 
554
                        // ---
556
                        // ---
Line 661... Line 663...
661
 
663
 
662
        public function tree(&$json, $ra_email=null, $nonjs=false, $req_goto='') {
664
        public function tree(&$json, $ra_email=null, $nonjs=false, $req_goto='') {
663
                if ($nonjs) {
665
                if ($nonjs) {
664
                        $json[] = array(
666
                        $json[] = array(
665
                                'id' => 'oidplus:system',
667
                                'id' => 'oidplus:system',
666
                                'icon' => OIDplus::webpath(__DIR__).'system.png',
668
                                'icon' => OIDplus::webpath(__DIR__,true).'img/main_icon16.png',
667
                                'text' => _L('System')
669
                                'text' => _L('System')
668
                        );
670
                        );
669
 
671
 
670
                        $parent = '';
672
                        $parent = '';
671
                        $res = OIDplus::db()->query("select parent from ###objects where id = ?", array($req_goto));
673
                        $res = OIDplus::db()->query("select parent from ###objects where id = ?", array($req_goto));
Line 773... Line 775...
773
                                        "opened" => true,
775
                                        "opened" => true,
774
                                        // "selected" => true)  // "selected" is buggy:
776
                                        // "selected" => true)  // "selected" is buggy:
775
                                        // 1) The select-event will not be triggered upon loading
777
                                        // 1) The select-event will not be triggered upon loading
776
                                        // 2) The nodes directly blow cannot be opened (loading infinite time)
778
                                        // 2) The nodes directly blow cannot be opened (loading infinite time)
777
                                ),
779
                                ),
778
                                'icon' => OIDplus::webpath(__DIR__).'system.png',
780
                                'icon' => OIDplus::webpath(__DIR__,true).'img/main_icon16.png',
779
                                'children' => $objTypesChildren
781
                                'children' => $objTypesChildren
780
                        );
782
                        );
781
 
783
 
782
                        return true;
784
                        return true;
783
                }
785
                }