Subversion Repositories oidplus

Rev

Rev 254 | Rev 277 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 daniel-mar 1
<?php
2
 
3
/*
4
 * OIDplus 2.0
5
 * Copyright 2019 Daniel Marschall, ViaThinkSoft
6
 *
7
 * Licensed under the Apache License, Version 2.0 (the "License");
8
 * you may not use this file except in compliance with the License.
9
 * You may obtain a copy of the License at
10
 *
11
 *     http://www.apache.org/licenses/LICENSE-2.0
12
 *
13
 * Unless required by applicable law or agreed to in writing, software
14
 * distributed under the License is distributed on an "AS IS" BASIS,
15
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
 * See the License for the specific language governing permissions and
17
 * limitations under the License.
18
 */
19
 
112 daniel-mar 20
if (!defined('IN_OIDPLUS')) die();
21
 
2 daniel-mar 22
class OIDplusGui {
23
 
24
        public static function generateContentPage($id) {
25
                $out = array();
26
 
27
                $handled = false;
28
                $out['title'] = '';
32 daniel-mar 29
                $out['icon'] = '';
2 daniel-mar 30
                $out['text'] = '';
31
 
61 daniel-mar 32
                foreach (OIDplus::getPagePlugins('*') as $plugin) {
33
                        $plugin->gui($id, $out, $handled);
34
                }
2 daniel-mar 35
 
36
                if (!$handled) {
256 daniel-mar 37
                        $out['title'] = 'Error';
38
                        $out['icon'] = 'img/error_big.png';
39
                        $out['text'] = 'The resource cannot be found.';
40
                        return $out;
2 daniel-mar 41
                }
42
 
43
                return $out;
44
        }
250 daniel-mar 45
 
46
        public static function link($goto) {
47
                if (strpos($goto, '#') !== false) {
48
                        list($goto, $anchor) = explode('#', $goto, 2);
49
                        return 'href="?goto='.urlencode($goto).'#'.htmlentities($anchor).'" onclick="openOidInPanel('.js_escape($goto).', true, '.js_escape($anchor).'); return false;"';
50
                } else {
51
                        return 'href="?goto='.urlencode($goto).'" onclick="openOidInPanel('.js_escape($goto).', true); return false;"';
52
                }
53
        }
2 daniel-mar 54
}