Subversion Repositories oidplus

Rev

Rev 281 | Rev 348 | 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
 
327 daniel-mar 44
        public static function link($goto, $new_window=false) {
45
                if ($new_window) {
46
                        return 'href="?goto='.urlencode($goto).'" target="_blank"';
250 daniel-mar 47
                } else {
327 daniel-mar 48
                        if (strpos($goto, '#') !== false) {
49
                                list($goto, $anchor) = explode('#', $goto, 2);
50
                                return 'href="?goto='.urlencode($goto).'#'.htmlentities($anchor).'" onclick="openOidInPanel('.js_escape($goto).', true, '.js_escape($anchor).'); return false;"';
51
                        } else {
52
                                return 'href="?goto='.urlencode($goto).'" onclick="openOidInPanel('.js_escape($goto).', true); return false;"';
53
                        }
250 daniel-mar 54
                }
55
        }
2 daniel-mar 56
}