Subversion Repositories oidplus

Rev

Rev 277 | Rev 327 | 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
 
20
class OIDplusGui {
21
 
22
        public static function generateContentPage($id) {
23
                $out = array();
24
 
25
                $handled = false;
26
                $out['title'] = '';
32 daniel-mar 27
                $out['icon'] = '';
2 daniel-mar 28
                $out['text'] = '';
29
 
281 daniel-mar 30
                foreach (OIDplus::getPagePlugins() as $plugin) {
61 daniel-mar 31
                        $plugin->gui($id, $out, $handled);
281 daniel-mar 32
                        if ($handled) break;
61 daniel-mar 33
                }
2 daniel-mar 34
 
35
                if (!$handled) {
256 daniel-mar 36
                        $out['title'] = 'Error';
37
                        $out['icon'] = 'img/error_big.png';
38
                        $out['text'] = 'The resource cannot be found.';
2 daniel-mar 39
                }
40
 
41
                return $out;
42
        }
250 daniel-mar 43
 
44
        public static function link($goto) {
45
                if (strpos($goto, '#') !== false) {
46
                        list($goto, $anchor) = explode('#', $goto, 2);
47
                        return 'href="?goto='.urlencode($goto).'#'.htmlentities($anchor).'" onclick="openOidInPanel('.js_escape($goto).', true, '.js_escape($anchor).'); return false;"';
48
                } else {
49
                        return 'href="?goto='.urlencode($goto).'" onclick="openOidInPanel('.js_escape($goto).', true); return false;"';
50
                }
51
        }
2 daniel-mar 52
}