Rev 449 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
148 | daniel-mar | 1 | <?php |
2 | |||
3 | /* |
||
4 | * OIDplus 2.0 |
||
511 | daniel-mar | 5 | * Copyright 2019 - 2021 Daniel Marschall, ViaThinkSoft |
148 | daniel-mar | 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 | |||
511 | daniel-mar | 20 | if (!defined('INSIDE_OIDPLUS')) die(); |
21 | |||
256 | daniel-mar | 22 | class OIDplusPageAdminPlugins extends OIDplusPagePluginAdmin { |
23 | |||
148 | daniel-mar | 24 | public function init($html=true) { |
25 | } |
||
26 | |||
27 | public function gui($id, &$out, &$handled) { |
||
307 | daniel-mar | 28 | $tmp = explode('$',$id); |
29 | $classname = isset($tmp[1]) ? $tmp[1] : null; |
||
30 | |||
31 | $parts = explode('.',$tmp[0],2); |
||
151 | daniel-mar | 32 | if (!isset($parts[1])) $parts[1] = ''; |
33 | if ($parts[0] != 'oidplus:system_plugins') return; |
||
34 | $handled = true; |
||
360 | daniel-mar | 35 | $out['title'] = _L('Installed plugins'); |
241 | daniel-mar | 36 | $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : ''; |
148 | daniel-mar | 37 | |
151 | daniel-mar | 38 | if (!OIDplus::authUtils()::isAdminLoggedIn()) { |
39 | $out['icon'] = 'img/error_big.png'; |
||
360 | daniel-mar | 40 | $out['text'] = '<p>'._L('You need to <a %1>log in</a> as administrator.',OIDplus::gui()->link('oidplus:login')).'</p>'; |
281 | daniel-mar | 41 | return; |
151 | daniel-mar | 42 | } |
43 | |||
307 | daniel-mar | 44 | if (!is_null($classname)) { |
380 | daniel-mar | 45 | $plugin = OIDplus::getPluginByClassName($classname); |
46 | if (is_null($plugin)) { |
||
47 | $out['icon'] = 'img/error_big.png'; |
||
48 | $out['text'] = '<p>'._L('Plugin %1 not found.',$classname).'</p>'; |
||
49 | return; |
||
50 | } |
||
51 | |||
408 | daniel-mar | 52 | $out['title'] = empty($plugin->getManifest()->getName()) ? htmlentities($classname) : htmlentities($plugin->getManifest()->getName()); |
241 | daniel-mar | 53 | $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : ''; |
151 | daniel-mar | 54 | |
408 | daniel-mar | 55 | $back_link = 'oidplus:system_plugins'; |
56 | if (get_parent_class($classname) == 'OIDplusPagePluginPublic') $back_link = 'oidplus:system_plugins.pages.public'; |
||
57 | if (get_parent_class($classname) == 'OIDplusPagePluginRa') $back_link = 'oidplus:system_plugins.pages.ra'; |
||
58 | if (get_parent_class($classname) == 'OIDplusPagePluginAdmin') $back_link = 'oidplus:system_plugins.pages.admin'; |
||
59 | if (get_parent_class($classname) == 'OIDplusObjectTypePlugin') $back_link = 'oidplus:system_plugins.objects'; |
||
60 | if (get_parent_class($classname) == 'OIDplusDatabasePlugin') $back_link = 'oidplus:system_plugins.database'; |
||
61 | if (get_parent_class($classname) == 'OIDplusSqlSlangPlugin') $back_link = 'oidplus:system_plugins.sql'; |
||
62 | if (get_parent_class($classname) == 'OIDplusAuthPlugin') $back_link = 'oidplus:system_plugins.auth'; |
||
63 | if (get_parent_class($classname) == 'OIDplusLoggerPlugin') $back_link = 'oidplus:system_plugins.logger'; |
||
64 | if (get_parent_class($classname) == 'OIDplusLanguagePlugin') $back_link = 'oidplus:system_plugins.language'; |
||
449 | daniel-mar | 65 | if (get_parent_class($classname) == 'OIDplusDesignPlugin') $back_link = 'oidplus:system_plugins.design'; |
408 | daniel-mar | 66 | $out['text'] = '<p><a '.OIDplus::gui()->link($back_link).'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>'; |
433 | daniel-mar | 67 | |
360 | daniel-mar | 68 | $out['text'] .= '<div><label class="padding_label">'._L('Class name').'</label><b>'.htmlentities($classname).'</b></div>'. |
449 | daniel-mar | 69 | '<div><label class="padding_label">'._L('Location').'</label><b>'.htmlentities($plugin->getPluginDirectory()).'</b></div>'. |
360 | daniel-mar | 70 | '<div><label class="padding_label">'._L('Plugin type').'</label><b>'.htmlentities(get_parent_class($classname)).'</b></div>'. |
380 | daniel-mar | 71 | '<div><label class="padding_label">'._L('Plugin name').'</label><b>'.htmlentities(empty($plugin->getManifest()->getName()) ? _L('n/a') : $plugin->getManifest()->getName()).'</b></div>'. |
72 | '<div><label class="padding_label">'._L('Plugin author').'</label><b>'.htmlentities(empty($plugin->getManifest()->getAuthor()) ? _L('n/a') : $plugin->getManifest()->getAuthor()).'</b></div>'. |
||
73 | '<div><label class="padding_label">'._L('Plugin version').'</label><b>'.htmlentities(empty($plugin->getManifest()->getVersion()) ? _L('n/a') : $plugin->getManifest()->getVersion()).'</b></div>'. |
||
74 | '<div><label class="padding_label">'._L('Plugin OID').'</label><b>'.htmlentities(empty($plugin->getManifest()->getOid()) ? _L('n/a') : $plugin->getManifest()->getOid()).'</b></div>'. |
||
75 | (!empty(trim($plugin->getManifest()->getHtmlDescription())) ? '<br><p><b>'._L('Additional information').':</b></p>' : ''). |
||
76 | $plugin->getManifest()->getHtmlDescription(); |
||
151 | daniel-mar | 77 | } else { |
78 | $show_pages_public = false; |
||
79 | $show_pages_ra = false; |
||
80 | $show_pages_admin = false; |
||
81 | $show_db_active = false; |
||
82 | $show_db_inactive = false; |
||
274 | daniel-mar | 83 | $show_sql_active = false; |
84 | $show_sql_inactive = false; |
||
151 | daniel-mar | 85 | $show_obj_active = false; |
86 | $show_obj_inactive = false; |
||
221 | daniel-mar | 87 | $show_auth = false; |
289 | daniel-mar | 88 | $show_logger = false; |
355 | daniel-mar | 89 | $show_language = false; |
449 | daniel-mar | 90 | $show_design_active = false; |
91 | $show_design_inactive = false; |
||
151 | daniel-mar | 92 | |
93 | if ($parts[1] == '') { |
||
360 | daniel-mar | 94 | $out['title'] = _L('Installed plugins'); |
241 | daniel-mar | 95 | $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : ''; |
151 | daniel-mar | 96 | $show_pages_public = true; |
97 | $show_pages_ra = true; |
||
98 | $show_pages_admin = true; |
||
99 | $show_db_active = true; |
||
100 | $show_db_inactive = true; |
||
274 | daniel-mar | 101 | $show_sql_active = true; |
102 | $show_sql_inactive = true; |
||
151 | daniel-mar | 103 | $show_obj_active = true; |
104 | $show_obj_inactive = true; |
||
221 | daniel-mar | 105 | $show_auth = true; |
289 | daniel-mar | 106 | $show_logger = true; |
355 | daniel-mar | 107 | $show_language = true; |
449 | daniel-mar | 108 | $show_design_active = true; |
109 | $show_design_inactive = true; |
||
151 | daniel-mar | 110 | } else if ($parts[1] == 'pages') { |
360 | daniel-mar | 111 | $out['title'] = _L('Page plugins'); |
241 | daniel-mar | 112 | $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : ''; |
408 | daniel-mar | 113 | $out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:system_plugins').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>'; |
151 | daniel-mar | 114 | $show_pages_public = true; |
115 | $show_pages_ra = true; |
||
116 | $show_pages_admin = true; |
||
117 | } else if ($parts[1] == 'pages.public') { |
||
360 | daniel-mar | 118 | $out['title'] = _L('Public page plugins'); |
241 | daniel-mar | 119 | $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : ''; |
408 | daniel-mar | 120 | $out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:system_plugins.pages').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>'; |
151 | daniel-mar | 121 | $show_pages_public = true; |
122 | } else if ($parts[1] == 'pages.ra') { |
||
360 | daniel-mar | 123 | $out['title'] = _L('RA page plugins'); |
241 | daniel-mar | 124 | $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : ''; |
408 | daniel-mar | 125 | $out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:system_plugins.pages').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>'; |
151 | daniel-mar | 126 | $show_pages_ra = true; |
127 | } else if ($parts[1] == 'pages.admin') { |
||
360 | daniel-mar | 128 | $out['title'] = _L('Admin page plugins'); |
241 | daniel-mar | 129 | $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : ''; |
408 | daniel-mar | 130 | $out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:system_plugins.pages').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>'; |
151 | daniel-mar | 131 | $show_pages_admin = true; |
132 | } else if ($parts[1] == 'objects') { |
||
360 | daniel-mar | 133 | $out['title'] = _L('Object type plugins'); |
241 | daniel-mar | 134 | $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : ''; |
408 | daniel-mar | 135 | $out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:system_plugins').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>'; |
151 | daniel-mar | 136 | $show_obj_active = true; |
137 | $show_obj_inactive = true; |
||
138 | } else if ($parts[1] == 'objects.enabled') { |
||
360 | daniel-mar | 139 | $out['title'] = _L('Object type plugins (enabled)'); |
241 | daniel-mar | 140 | $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : ''; |
408 | daniel-mar | 141 | $out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:system_plugins').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>'; |
151 | daniel-mar | 142 | $show_obj_active = true; |
143 | } else if ($parts[1] == 'objects.disabled') { |
||
360 | daniel-mar | 144 | $out['title'] = _L('Object type plugins (disabled)'); |
241 | daniel-mar | 145 | $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : ''; |
408 | daniel-mar | 146 | $out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:system_plugins').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>'; |
151 | daniel-mar | 147 | $show_obj_inactive = true; |
148 | } else if ($parts[1] == 'database') { |
||
360 | daniel-mar | 149 | $out['title'] = _L('Database provider plugins'); |
241 | daniel-mar | 150 | $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : ''; |
408 | daniel-mar | 151 | $out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:system_plugins').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>'; |
151 | daniel-mar | 152 | $show_db_active = true; |
153 | $show_db_inactive = true; |
||
154 | } else if ($parts[1] == 'database.enabled') { |
||
360 | daniel-mar | 155 | $out['title'] = _L('Database provider plugins (active)'); |
241 | daniel-mar | 156 | $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : ''; |
408 | daniel-mar | 157 | $out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:system_plugins').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>'; |
151 | daniel-mar | 158 | $show_db_active = true; |
159 | } else if ($parts[1] == 'database.disabled') { |
||
360 | daniel-mar | 160 | $out['title'] = _L('Database provider plugins (inactive)'); |
241 | daniel-mar | 161 | $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : ''; |
408 | daniel-mar | 162 | $out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:system_plugins').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>'; |
151 | daniel-mar | 163 | $show_db_inactive = true; |
274 | daniel-mar | 164 | } else if ($parts[1] == 'sql') { |
360 | daniel-mar | 165 | $out['title'] = _L('SQL slang plugins'); |
274 | daniel-mar | 166 | $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : ''; |
408 | daniel-mar | 167 | $out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:system_plugins').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>'; |
274 | daniel-mar | 168 | $show_sql_active = true; |
169 | $show_sql_inactive = true; |
||
170 | } else if ($parts[1] == 'sql.enabled') { |
||
360 | daniel-mar | 171 | $out['title'] = _L('SQL slang plugins (active)'); |
274 | daniel-mar | 172 | $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : ''; |
408 | daniel-mar | 173 | $out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:system_plugins').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>'; |
274 | daniel-mar | 174 | $show_sql_active = true; |
175 | } else if ($parts[1] == 'sql.disabled') { |
||
360 | daniel-mar | 176 | $out['title'] = _L('SQL slang plugins (inactive)'); |
274 | daniel-mar | 177 | $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : ''; |
408 | daniel-mar | 178 | $out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:system_plugins').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>'; |
274 | daniel-mar | 179 | $show_sql_inactive = true; |
221 | daniel-mar | 180 | } else if ($parts[1] == 'auth') { |
360 | daniel-mar | 181 | $out['title'] = _L('RA authentication'); |
241 | daniel-mar | 182 | $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : ''; |
408 | daniel-mar | 183 | $out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:system_plugins').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>'; |
221 | daniel-mar | 184 | $show_auth = true; |
289 | daniel-mar | 185 | } else if ($parts[1] == 'logger') { |
360 | daniel-mar | 186 | $out['title'] = _L('Logger'); |
289 | daniel-mar | 187 | $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : ''; |
408 | daniel-mar | 188 | $out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:system_plugins').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>'; |
289 | daniel-mar | 189 | $show_logger = true; |
355 | daniel-mar | 190 | } else if ($parts[1] == 'language') { |
360 | daniel-mar | 191 | $out['title'] = _L('Languages'); |
355 | daniel-mar | 192 | $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : ''; |
408 | daniel-mar | 193 | $out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:system_plugins').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>'; |
355 | daniel-mar | 194 | $show_language = true; |
449 | daniel-mar | 195 | } else if ($parts[1] == 'design') { |
196 | $out['title'] = _L('Designs'); |
||
197 | $out['icon'] = file_exists(__DIR__.'/icon_big.png') ? OIDplus::webpath(__DIR__).'icon_big.png' : ''; |
||
198 | $out['text'] = '<p><a '.OIDplus::gui()->link('oidplus:system_plugins').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>'; |
||
199 | $show_design_active = true; |
||
200 | $show_design_inactive = true; |
||
151 | daniel-mar | 201 | } else { |
433 | daniel-mar | 202 | $out['title'] = _L('Error'); |
148 | daniel-mar | 203 | $out['icon'] = 'img/error_big.png'; |
360 | daniel-mar | 204 | $out['text'] = '<p>'._L('Invalid arguments').'</p>'; |
408 | daniel-mar | 205 | $out['text'] .= '<p><a '.OIDplus::gui()->link('oidplus:system_plugins').'><img src="img/arrow_back.png" width="16" alt="'._L('Go back').'"> '._L('Go back').'</a></p>'; |
281 | daniel-mar | 206 | return; |
148 | daniel-mar | 207 | } |
208 | |||
281 | daniel-mar | 209 | $pp_public = array(); |
210 | $pp_ra = array(); |
||
211 | $pp_admin = array(); |
||
289 | daniel-mar | 212 | |
281 | daniel-mar | 213 | foreach (OIDplus::getPagePlugins() as $plugin) { |
214 | if (is_subclass_of($plugin, OIDplusPagePluginPublic::class)) { |
||
215 | $pp_public[] = $plugin; |
||
216 | } |
||
217 | if (is_subclass_of($plugin, OIDplusPagePluginRa::class)) { |
||
218 | $pp_ra[] = $plugin; |
||
219 | } |
||
220 | if (is_subclass_of($plugin, OIDplusPagePluginAdmin::class)) { |
||
221 | $pp_admin[] = $plugin; |
||
222 | } |
||
223 | } |
||
224 | |||
151 | daniel-mar | 225 | if ($show_pages_public) { |
281 | daniel-mar | 226 | if (count($plugins = $pp_public) > 0) { |
360 | daniel-mar | 227 | $out['text'] .= '<h2>'._L('Public page plugins').'</h2>'; |
222 | daniel-mar | 228 | $out['text'] .= '<div class="container box"><div id="suboid_table" class="table-responsive">'; |
229 | $out['text'] .= '<table class="table table-bordered table-striped">'; |
||
230 | $out['text'] .= ' <tr>'; |
||
360 | daniel-mar | 231 | $out['text'] .= ' <th width="25%">'._L('Class name').'</th>'; |
232 | $out['text'] .= ' <th width="25%">'._L('Plugin name').'</th>'; |
||
233 | $out['text'] .= ' <th width="25%">'._L('Plugin version').'</th>'; |
||
234 | $out['text'] .= ' <th width="25%">'._L('Plugin author').'</th>'; |
||
222 | daniel-mar | 235 | $out['text'] .= ' </tr>'; |
151 | daniel-mar | 236 | foreach ($plugins as $plugin) { |
222 | daniel-mar | 237 | $out['text'] .= ' <tr>'; |
307 | daniel-mar | 238 | $out['text'] .= '<td><a '.OIDplus::gui()->link('oidplus:system_plugins$'.get_class($plugin)).'>'.htmlentities(get_class($plugin)).'</a></td>'; |
380 | daniel-mar | 239 | $out['text'] .= '<td>' . htmlentities(empty($plugin->getManifest()->getName()) ? _L('n/a') : $plugin->getManifest()->getName()) . '</td>'; |
240 | $out['text'] .= '<td>' . htmlentities(empty($plugin->getManifest()->getVersion()) ? _L('n/a') : $plugin->getManifest()->getVersion()) . '</td>'; |
||
241 | $out['text'] .= '<td>' . htmlentities(empty($plugin->getManifest()->getAuthor()) ? _L('n/a') : $plugin->getManifest()->getAuthor()) . '</td>'; |
||
222 | daniel-mar | 242 | $out['text'] .= ' </tr>'; |
151 | daniel-mar | 243 | } |
222 | daniel-mar | 244 | $out['text'] .= '</table>'; |
245 | $out['text'] .= '</div></div>'; |
||
148 | daniel-mar | 246 | } |
247 | } |
||
248 | |||
151 | daniel-mar | 249 | if ($show_pages_ra) { |
281 | daniel-mar | 250 | if (count($plugins = $pp_ra) > 0) { |
360 | daniel-mar | 251 | $out['text'] .= '<h2>'._L('RA page plugins').'</h2>'; |
222 | daniel-mar | 252 | $out['text'] .= '<div class="container box"><div id="suboid_table" class="table-responsive">'; |
253 | $out['text'] .= '<table class="table table-bordered table-striped">'; |
||
254 | $out['text'] .= ' <tr>'; |
||
360 | daniel-mar | 255 | $out['text'] .= ' <th width="25%">'._L('Class name').'</th>'; |
256 | $out['text'] .= ' <th width="25%">'._L('Plugin name').'</th>'; |
||
257 | $out['text'] .= ' <th width="25%">'._L('Plugin version').'</th>'; |
||
258 | $out['text'] .= ' <th width="25%">'._L('Plugin author').'</th>'; |
||
222 | daniel-mar | 259 | $out['text'] .= ' </tr>'; |
151 | daniel-mar | 260 | foreach ($plugins as $plugin) { |
222 | daniel-mar | 261 | $out['text'] .= ' <tr>'; |
307 | daniel-mar | 262 | $out['text'] .= '<td><a '.OIDplus::gui()->link('oidplus:system_plugins$'.get_class($plugin)).'>'.htmlentities(get_class($plugin)).'</a></td>'; |
380 | daniel-mar | 263 | $out['text'] .= '<td>' . htmlentities(empty($plugin->getManifest()->getName()) ? _L('n/a') : $plugin->getManifest()->getName()) . '</td>'; |
264 | $out['text'] .= '<td>' . htmlentities(empty($plugin->getManifest()->getVersion()) ? _L('n/a') : $plugin->getManifest()->getVersion()) . '</td>'; |
||
265 | $out['text'] .= '<td>' . htmlentities(empty($plugin->getManifest()->getAuthor()) ? _L('n/a') : $plugin->getManifest()->getAuthor()) . '</td>'; |
||
222 | daniel-mar | 266 | $out['text'] .= ' </tr>'; |
151 | daniel-mar | 267 | } |
222 | daniel-mar | 268 | $out['text'] .= '</table>'; |
269 | $out['text'] .= '</div></div>'; |
||
148 | daniel-mar | 270 | } |
271 | } |
||
272 | |||
151 | daniel-mar | 273 | if ($show_pages_admin) { |
281 | daniel-mar | 274 | if (count($plugins = $pp_admin) > 0) { |
360 | daniel-mar | 275 | $out['text'] .= '<h2>'._L('Admin page plugins').'</h2>'; |
222 | daniel-mar | 276 | $out['text'] .= '<div class="container box"><div id="suboid_table" class="table-responsive">'; |
277 | $out['text'] .= '<table class="table table-bordered table-striped">'; |
||
278 | $out['text'] .= ' <tr>'; |
||
360 | daniel-mar | 279 | $out['text'] .= ' <th width="25%">'._L('Class name').'</th>'; |
280 | $out['text'] .= ' <th width="25%">'._L('Plugin name').'</th>'; |
||
281 | $out['text'] .= ' <th width="25%">'._L('Plugin version').'</th>'; |
||
282 | $out['text'] .= ' <th width="25%">'._L('Plugin author').'</th>'; |
||
222 | daniel-mar | 283 | $out['text'] .= ' </tr>'; |
151 | daniel-mar | 284 | foreach ($plugins as $plugin) { |
222 | daniel-mar | 285 | $out['text'] .= ' <tr>'; |
307 | daniel-mar | 286 | $out['text'] .= '<td><a '.OIDplus::gui()->link('oidplus:system_plugins$'.get_class($plugin)).'>'.htmlentities(get_class($plugin)).'</a></td>'; |
380 | daniel-mar | 287 | $out['text'] .= '<td>' . htmlentities(empty($plugin->getManifest()->getName()) ? _L('n/a') : $plugin->getManifest()->getName()) . '</td>'; |
288 | $out['text'] .= '<td>' . htmlentities(empty($plugin->getManifest()->getVersion()) ? _L('n/a') : $plugin->getManifest()->getVersion()) . '</td>'; |
||
289 | $out['text'] .= '<td>' . htmlentities(empty($plugin->getManifest()->getAuthor()) ? _L('n/a') : $plugin->getManifest()->getAuthor()) . '</td>'; |
||
222 | daniel-mar | 290 | $out['text'] .= ' </tr>'; |
151 | daniel-mar | 291 | } |
222 | daniel-mar | 292 | $out['text'] .= '</table>'; |
293 | $out['text'] .= '</div></div>'; |
||
148 | daniel-mar | 294 | } |
295 | } |
||
296 | |||
222 | daniel-mar | 297 | if ($show_obj_active || $show_obj_inactive) { |
227 | daniel-mar | 298 | $enabled = $show_obj_active ? OIDplus::getObjectTypePluginsEnabled() : array(); |
299 | $disabled = $show_obj_inactive ? OIDplus::getObjectTypePluginsDisabled() : array(); |
||
222 | daniel-mar | 300 | if (count($plugins = array_merge($enabled, $disabled)) > 0) { |
360 | daniel-mar | 301 | $out['text'] .= '<h2>'._L('Object types').'</h2>'; |
222 | daniel-mar | 302 | $out['text'] .= '<div class="container box"><div id="suboid_table" class="table-responsive">'; |
303 | $out['text'] .= '<table class="table table-bordered table-striped">'; |
||
304 | $out['text'] .= ' <tr>'; |
||
360 | daniel-mar | 305 | $out['text'] .= ' <th width="25%">'._L('Class name').'</th>'; |
306 | $out['text'] .= ' <th width="25%">'._L('Plugin name').'</th>'; |
||
307 | $out['text'] .= ' <th width="25%">'._L('Plugin version').'</th>'; |
||
308 | $out['text'] .= ' <th width="25%">'._L('Plugin author').'</th>'; |
||
222 | daniel-mar | 309 | $out['text'] .= ' </tr>'; |
227 | daniel-mar | 310 | foreach ($plugins as $plugin) { |
222 | daniel-mar | 311 | $out['text'] .= ' <tr>'; |
227 | daniel-mar | 312 | if (in_array($plugin, $enabled)) { |
307 | daniel-mar | 313 | $out['text'] .= '<td><a '.OIDplus::gui()->link('oidplus:system_plugins$'.get_class($plugin)).'>'.htmlentities(get_class($plugin)).'</a></td>'; |
222 | daniel-mar | 314 | } else { |
360 | daniel-mar | 315 | $out['text'] .= '<td><a '.OIDplus::gui()->link('oidplus:system_plugins$'.get_class($plugin)).'><font color="gray">'.htmlentities(get_class($plugin)).' '._L('(disabled)').'</font></a></td>'; |
222 | daniel-mar | 316 | } |
380 | daniel-mar | 317 | $out['text'] .= '<td>' . htmlentities(empty($plugin->getManifest()->getName()) ? _L('n/a') : $plugin->getManifest()->getName()) . '</td>'; |
318 | $out['text'] .= '<td>' . htmlentities(empty($plugin->getManifest()->getVersion()) ? _L('n/a') : $plugin->getManifest()->getVersion()) . '</td>'; |
||
319 | $out['text'] .= '<td>' . htmlentities(empty($plugin->getManifest()->getAuthor()) ? _L('n/a') : $plugin->getManifest()->getAuthor()) . '</td>'; |
||
222 | daniel-mar | 320 | $out['text'] .= ' </tr>'; |
150 | daniel-mar | 321 | } |
222 | daniel-mar | 322 | $out['text'] .= '</table>'; |
323 | $out['text'] .= '</div></div>'; |
||
148 | daniel-mar | 324 | } |
325 | } |
||
326 | |||
151 | daniel-mar | 327 | if ($show_db_active || $show_db_inactive) { |
328 | if (count($plugins = OIDplus::getDatabasePlugins()) > 0) { |
||
360 | daniel-mar | 329 | $out['text'] .= '<h2>'._L('Database providers').'</h2>'; |
222 | daniel-mar | 330 | $out['text'] .= '<div class="container box"><div id="suboid_table" class="table-responsive">'; |
331 | $out['text'] .= '<table class="table table-bordered table-striped">'; |
||
332 | $out['text'] .= ' <tr>'; |
||
360 | daniel-mar | 333 | $out['text'] .= ' <th width="25%">'._L('Class name').'</th>'; |
334 | $out['text'] .= ' <th width="25%">'._L('Plugin name').'</th>'; |
||
335 | $out['text'] .= ' <th width="25%">'._L('Plugin version').'</th>'; |
||
336 | $out['text'] .= ' <th width="25%">'._L('Plugin author').'</th>'; |
||
222 | daniel-mar | 337 | $out['text'] .= ' </tr>'; |
151 | daniel-mar | 338 | foreach ($plugins as $plugin) { |
275 | daniel-mar | 339 | $active = $plugin::id() == OIDplus::baseConfig()->getValue('DATABASE_PLUGIN'); |
222 | daniel-mar | 340 | if ($active && !$show_db_active) continue; |
341 | if (!$active && !$show_db_inactive) continue; |
||
342 | |||
343 | $out['text'] .= ' <tr>'; |
||
274 | daniel-mar | 344 | if ($active) { |
360 | daniel-mar | 345 | $out['text'] .= '<td><a '.OIDplus::gui()->link('oidplus:system_plugins$'.get_class($plugin)).'><b>'.htmlentities(get_class($plugin)).'</b> '._L('(active)').'</a></td>'; |
151 | daniel-mar | 346 | } else { |
307 | daniel-mar | 347 | $out['text'] .= '<td><a '.OIDplus::gui()->link('oidplus:system_plugins$'.get_class($plugin)).'>'.htmlentities(get_class($plugin)).'</a></td>'; |
151 | daniel-mar | 348 | } |
380 | daniel-mar | 349 | $out['text'] .= '<td>' . htmlentities(empty($plugin->getManifest()->getName()) ? _L('n/a') : $plugin->getManifest()->getName()) . '</td>'; |
350 | $out['text'] .= '<td>' . htmlentities(empty($plugin->getManifest()->getVersion()) ? _L('n/a') : $plugin->getManifest()->getVersion()) . '</td>'; |
||
351 | $out['text'] .= '<td>' . htmlentities(empty($plugin->getManifest()->getAuthor()) ? _L('n/a') : $plugin->getManifest()->getAuthor()) . '</td>'; |
||
222 | daniel-mar | 352 | $out['text'] .= ' </tr>'; |
150 | daniel-mar | 353 | } |
222 | daniel-mar | 354 | $out['text'] .= '</table>'; |
355 | $out['text'] .= '</div></div>'; |
||
148 | daniel-mar | 356 | } |
357 | } |
||
221 | daniel-mar | 358 | |
274 | daniel-mar | 359 | if ($show_sql_active || $show_sql_inactive) { |
360 | if (count($plugins = OIDplus::getSqlSlangPlugins()) > 0) { |
||
360 | daniel-mar | 361 | $out['text'] .= '<h2>'._L('SQL slang plugins').'</h2>'; |
274 | daniel-mar | 362 | $out['text'] .= '<div class="container box"><div id="suboid_table" class="table-responsive">'; |
363 | $out['text'] .= '<table class="table table-bordered table-striped">'; |
||
364 | $out['text'] .= ' <tr>'; |
||
360 | daniel-mar | 365 | $out['text'] .= ' <th width="25%">'._L('Class name').'</th>'; |
366 | $out['text'] .= ' <th width="25%">'._L('Plugin name').'</th>'; |
||
367 | $out['text'] .= ' <th width="25%">'._L('Plugin version').'</th>'; |
||
368 | $out['text'] .= ' <th width="25%">'._L('Plugin author').'</th>'; |
||
274 | daniel-mar | 369 | $out['text'] .= ' </tr>'; |
370 | foreach ($plugins as $plugin) { |
||
371 | $active = $plugin::id() == OIDplus::db()->getSlang()::id(); |
||
372 | if ($active && !$show_sql_active) continue; |
||
373 | if (!$active && !$show_sql_inactive) continue; |
||
374 | |||
375 | $out['text'] .= ' <tr>'; |
||
376 | if ($active) { |
||
360 | daniel-mar | 377 | $out['text'] .= '<td><a '.OIDplus::gui()->link('oidplus:system_plugins$'.get_class($plugin)).'><b>'.htmlentities(get_class($plugin)).'</b> '._L('(active)').'</a></td>'; |
274 | daniel-mar | 378 | } else { |
307 | daniel-mar | 379 | $out['text'] .= '<td><a '.OIDplus::gui()->link('oidplus:system_plugins$'.get_class($plugin)).'>'.htmlentities(get_class($plugin)).'</a></td>'; |
274 | daniel-mar | 380 | } |
380 | daniel-mar | 381 | $out['text'] .= '<td>' . htmlentities(empty($plugin->getManifest()->getName()) ? _L('n/a') : $plugin->getManifest()->getName()) . '</td>'; |
382 | $out['text'] .= '<td>' . htmlentities(empty($plugin->getManifest()->getVersion()) ? _L('n/a') : $plugin->getManifest()->getVersion()) . '</td>'; |
||
383 | $out['text'] .= '<td>' . htmlentities(empty($plugin->getManifest()->getAuthor()) ? _L('n/a') : $plugin->getManifest()->getAuthor()) . '</td>'; |
||
274 | daniel-mar | 384 | $out['text'] .= ' </tr>'; |
385 | } |
||
386 | $out['text'] .= '</table>'; |
||
387 | $out['text'] .= '</div></div>'; |
||
388 | } |
||
389 | } |
||
390 | |||
221 | daniel-mar | 391 | if ($show_auth) { |
392 | if (count($plugins = OIDplus::getAuthPlugins()) > 0) { |
||
360 | daniel-mar | 393 | $out['text'] .= '<h2>'._L('RA authentication providers').'</h2>'; |
222 | daniel-mar | 394 | $out['text'] .= '<div class="container box"><div id="suboid_table" class="table-responsive">'; |
395 | $out['text'] .= '<table class="table table-bordered table-striped">'; |
||
396 | $out['text'] .= ' <tr>'; |
||
360 | daniel-mar | 397 | $out['text'] .= ' <th width="25%">'._L('Class name').'</th>'; |
398 | $out['text'] .= ' <th width="25%">'._L('Plugin name').'</th>'; |
||
399 | $out['text'] .= ' <th width="25%">'._L('Plugin version').'</th>'; |
||
400 | $out['text'] .= ' <th width="25%">'._L('Plugin author').'</th>'; |
||
222 | daniel-mar | 401 | $out['text'] .= ' </tr>'; |
221 | daniel-mar | 402 | foreach ($plugins as $plugin) { |
222 | daniel-mar | 403 | $out['text'] .= ' <tr>'; |
307 | daniel-mar | 404 | $out['text'] .= '<td><a '.OIDplus::gui()->link('oidplus:system_plugins$'.get_class($plugin)).'>'.htmlentities(get_class($plugin)).'</a></td>'; |
380 | daniel-mar | 405 | $out['text'] .= '<td>' . htmlentities(empty($plugin->getManifest()->getName()) ? _L('n/a') : $plugin->getManifest()->getName()) . '</td>'; |
406 | $out['text'] .= '<td>' . htmlentities(empty($plugin->getManifest()->getVersion()) ? _L('n/a') : $plugin->getManifest()->getVersion()) . '</td>'; |
||
407 | $out['text'] .= '<td>' . htmlentities(empty($plugin->getManifest()->getAuthor()) ? _L('n/a') : $plugin->getManifest()->getAuthor()) . '</td>'; |
||
222 | daniel-mar | 408 | $out['text'] .= ' </tr>'; |
221 | daniel-mar | 409 | } |
222 | daniel-mar | 410 | $out['text'] .= '</table>'; |
411 | $out['text'] .= '</div></div>'; |
||
221 | daniel-mar | 412 | } |
413 | } |
||
289 | daniel-mar | 414 | |
415 | if ($show_logger) { |
||
416 | if (count($plugins = OIDplus::getLoggerPlugins()) > 0) { |
||
360 | daniel-mar | 417 | $out['text'] .= '<h2>'._L('Logger plugins').'</h2>'; |
289 | daniel-mar | 418 | $out['text'] .= '<div class="container box"><div id="suboid_table" class="table-responsive">'; |
419 | $out['text'] .= '<table class="table table-bordered table-striped">'; |
||
420 | $out['text'] .= ' <tr>'; |
||
360 | daniel-mar | 421 | $out['text'] .= ' <th width="25%">'._L('Class name').'</th>'; |
422 | $out['text'] .= ' <th width="25%">'._L('Plugin name').'</th>'; |
||
423 | $out['text'] .= ' <th width="25%">'._L('Plugin version').'</th>'; |
||
424 | $out['text'] .= ' <th width="25%">'._L('Plugin author').'</th>'; |
||
289 | daniel-mar | 425 | $out['text'] .= ' </tr>'; |
426 | foreach ($plugins as $plugin) { |
||
427 | $reason = ''; |
||
428 | $active = $plugin->available($reason); |
||
429 | |||
430 | $out['text'] .= ' <tr>'; |
||
431 | if ($active) { |
||
307 | daniel-mar | 432 | $out['text'] .= '<td><a '.OIDplus::gui()->link('oidplus:system_plugins$'.get_class($plugin)).'>'.htmlentities(get_class($plugin)).'</a></td>'; |
289 | daniel-mar | 433 | } else { |
360 | daniel-mar | 434 | $out['text'] .= '<td><a '.OIDplus::gui()->link('oidplus:system_plugins$'.get_class($plugin)).'><font color="gray">'.htmlentities(get_class($plugin)).'</font></a> <font color="gray">('._L('not available: %1',htmlentities($reason)).')</font></td>'; |
289 | daniel-mar | 435 | } |
380 | daniel-mar | 436 | $out['text'] .= '<td>' . htmlentities(empty($plugin->getManifest()->getName()) ? _L('n/a') : $plugin->getManifest()->getName()) . '</td>'; |
437 | $out['text'] .= '<td>' . htmlentities(empty($plugin->getManifest()->getVersion()) ? _L('n/a') : $plugin->getManifest()->getVersion()) . '</td>'; |
||
438 | $out['text'] .= '<td>' . htmlentities(empty($plugin->getManifest()->getAuthor()) ? _L('n/a') : $plugin->getManifest()->getAuthor()) . '</td>'; |
||
289 | daniel-mar | 439 | $out['text'] .= ' </tr>'; |
440 | } |
||
441 | $out['text'] .= '</table>'; |
||
442 | $out['text'] .= '</div></div>'; |
||
443 | } |
||
444 | } |
||
355 | daniel-mar | 445 | |
446 | if ($show_language) { |
||
447 | if (count($plugins = OIDplus::getLanguagePlugins()) > 0) { |
||
360 | daniel-mar | 448 | $out['text'] .= '<h2>'._L('Languages').'</h2>'; |
355 | daniel-mar | 449 | $out['text'] .= '<div class="container box"><div id="suboid_table" class="table-responsive">'; |
450 | $out['text'] .= '<table class="table table-bordered table-striped">'; |
||
451 | $out['text'] .= ' <tr>'; |
||
360 | daniel-mar | 452 | $out['text'] .= ' <th width="25%">'._L('Class name').'</th>'; |
453 | $out['text'] .= ' <th width="25%">'._L('Plugin name').'</th>'; |
||
454 | $out['text'] .= ' <th width="25%">'._L('Plugin version').'</th>'; |
||
455 | $out['text'] .= ' <th width="25%">'._L('Plugin author').'</th>'; |
||
355 | daniel-mar | 456 | $out['text'] .= ' </tr>'; |
457 | foreach ($plugins as $plugin) { |
||
458 | $out['text'] .= ' <tr>'; |
||
459 | $out['text'] .= '<td><a '.OIDplus::gui()->link('oidplus:system_plugins$'.get_class($plugin)).'>'.htmlentities(get_class($plugin)).'</a></td>'; |
||
380 | daniel-mar | 460 | $out['text'] .= '<td>' . htmlentities(empty($plugin->getManifest()->getName()) ? _L('n/a') : $plugin->getManifest()->getName()) . '</td>'; |
461 | $out['text'] .= '<td>' . htmlentities(empty($plugin->getManifest()->getVersion()) ? _L('n/a') : $plugin->getManifest()->getVersion()) . '</td>'; |
||
462 | $out['text'] .= '<td>' . htmlentities(empty($plugin->getManifest()->getAuthor()) ? _L('n/a') : $plugin->getManifest()->getAuthor()) . '</td>'; |
||
355 | daniel-mar | 463 | $out['text'] .= ' </tr>'; |
464 | } |
||
465 | $out['text'] .= '</table>'; |
||
466 | $out['text'] .= '</div></div>'; |
||
467 | } |
||
468 | } |
||
449 | daniel-mar | 469 | |
470 | if ($show_design_active || $show_design_inactive) { |
||
471 | if (count($plugins = OIDplus::getDesignPlugins()) > 0) { |
||
472 | $out['text'] .= '<h2>'._L('Designs').'</h2>'; |
||
473 | $out['text'] .= '<div class="container box"><div id="suboid_table" class="table-responsive">'; |
||
474 | $out['text'] .= '<table class="table table-bordered table-striped">'; |
||
475 | $out['text'] .= ' <tr>'; |
||
476 | $out['text'] .= ' <th width="25%">'._L('Class name').'</th>'; |
||
477 | $out['text'] .= ' <th width="25%">'._L('Plugin name').'</th>'; |
||
478 | $out['text'] .= ' <th width="25%">'._L('Plugin version').'</th>'; |
||
479 | $out['text'] .= ' <th width="25%">'._L('Plugin author').'</th>'; |
||
480 | $out['text'] .= ' </tr>'; |
||
481 | foreach ($plugins as $plugin) { |
||
482 | $active = OIDplus::config()->getValue('design') === basename($plugin->getPluginDirectory()); |
||
483 | if ($active && !$show_design_active) continue; |
||
484 | if (!$active && !$show_design_inactive) continue; |
||
485 | |||
486 | $out['text'] .= ' <tr>'; |
||
487 | if ($active) { |
||
488 | $out['text'] .= '<td><a '.OIDplus::gui()->link('oidplus:system_plugins$'.get_class($plugin)).'><b>'.htmlentities(get_class($plugin)).'</b> '._L('(active)').'</a></td>'; |
||
489 | } else { |
||
490 | $out['text'] .= '<td><a '.OIDplus::gui()->link('oidplus:system_plugins$'.get_class($plugin)).'>'.htmlentities(get_class($plugin)).'</a></td>'; |
||
491 | } |
||
492 | $out['text'] .= '<td>' . htmlentities(empty($plugin->getManifest()->getName()) ? _L('n/a') : $plugin->getManifest()->getName()) . '</td>'; |
||
493 | $out['text'] .= '<td>' . htmlentities(empty($plugin->getManifest()->getVersion()) ? _L('n/a') : $plugin->getManifest()->getVersion()) . '</td>'; |
||
494 | $out['text'] .= '<td>' . htmlentities(empty($plugin->getManifest()->getAuthor()) ? _L('n/a') : $plugin->getManifest()->getAuthor()) . '</td>'; |
||
495 | $out['text'] .= ' </tr>'; |
||
496 | } |
||
497 | $out['text'] .= '</table>'; |
||
498 | $out['text'] .= '</div></div>'; |
||
499 | } |
||
500 | } |
||
148 | daniel-mar | 501 | } |
502 | } |
||
503 | |||
504 | public function tree(&$json, $ra_email=null, $nonjs=false, $req_goto='') { |
||
281 | daniel-mar | 505 | if (!OIDplus::authUtils()::isAdminLoggedIn()) return false; |
289 | daniel-mar | 506 | |
148 | daniel-mar | 507 | if (file_exists(__DIR__.'/treeicon.png')) { |
241 | daniel-mar | 508 | $tree_icon = OIDplus::webpath(__DIR__).'treeicon.png'; |
148 | daniel-mar | 509 | } else { |
510 | $tree_icon = null; // default icon (folder) |
||
511 | } |
||
512 | |||
151 | daniel-mar | 513 | $tree_icon_pages = $tree_icon; // TODO |
514 | $tree_icon_pages_public = $tree_icon; // TODO |
||
515 | $tree_icon_pages_ra = $tree_icon; // TODO |
||
516 | $tree_icon_pages_admin = $tree_icon; // TODO |
||
517 | $tree_icon_db_active = $tree_icon; // TODO |
||
518 | $tree_icon_db_inactive = $tree_icon; // TODO |
||
274 | daniel-mar | 519 | $tree_icon_sql_active = $tree_icon; // TODO |
520 | $tree_icon_sql_inactive = $tree_icon; // TODO |
||
151 | daniel-mar | 521 | $tree_icon_obj_active = $tree_icon; // TODO |
522 | $tree_icon_obj_inactive = $tree_icon; // TODO |
||
221 | daniel-mar | 523 | $tree_icon_auth = $tree_icon; // TODO |
289 | daniel-mar | 524 | $tree_icon_logger = $tree_icon; // TODO |
355 | daniel-mar | 525 | $tree_icon_language = $tree_icon; // TODO |
449 | daniel-mar | 526 | $tree_icon_design_active = $tree_icon; // TODO |
527 | $tree_icon_design_inactive = $tree_icon; // TODO |
||
151 | daniel-mar | 528 | |
281 | daniel-mar | 529 | $pp_public = array(); |
530 | $pp_ra = array(); |
||
531 | $pp_admin = array(); |
||
532 | |||
533 | foreach (OIDplus::getPagePlugins() as $plugin) { |
||
534 | if (is_subclass_of($plugin, OIDplusPagePluginPublic::class)) { |
||
535 | $pp_public[] = $plugin; |
||
536 | } |
||
537 | if (is_subclass_of($plugin, OIDplusPagePluginRa::class)) { |
||
538 | $pp_ra[] = $plugin; |
||
539 | } |
||
540 | if (is_subclass_of($plugin, OIDplusPagePluginAdmin::class)) { |
||
541 | $pp_admin[] = $plugin; |
||
542 | } |
||
543 | } |
||
544 | |||
545 | |||
151 | daniel-mar | 546 | $public_plugins = array(); |
281 | daniel-mar | 547 | foreach ($pp_public as $plugin) { |
380 | daniel-mar | 548 | $txt = (empty($plugin->getManifest()->getName())) ? get_class($plugin) : $plugin->getManifest()->getName(); |
222 | daniel-mar | 549 | |
151 | daniel-mar | 550 | $public_plugins[] = array( |
307 | daniel-mar | 551 | 'id' => 'oidplus:system_plugins$'.get_class($plugin), |
151 | daniel-mar | 552 | 'icon' => $tree_icon_pages_public, |
222 | daniel-mar | 553 | 'text' => $txt, |
151 | daniel-mar | 554 | ); |
555 | } |
||
556 | $ra_plugins = array(); |
||
281 | daniel-mar | 557 | foreach ($pp_ra as $plugin) { |
380 | daniel-mar | 558 | $txt = (empty($plugin->getManifest()->getName())) ? get_class($plugin) : $plugin->getManifest()->getName(); |
222 | daniel-mar | 559 | |
151 | daniel-mar | 560 | $ra_plugins[] = array( |
307 | daniel-mar | 561 | 'id' => 'oidplus:system_plugins$'.get_class($plugin), |
151 | daniel-mar | 562 | 'icon' => $tree_icon_pages_ra, |
222 | daniel-mar | 563 | 'text' => $txt, |
151 | daniel-mar | 564 | ); |
565 | } |
||
566 | $admin_plugins = array(); |
||
281 | daniel-mar | 567 | foreach ($pp_admin as $plugin) { |
380 | daniel-mar | 568 | $txt = (empty($plugin->getManifest()->getName())) ? get_class($plugin) : $plugin->getManifest()->getName(); |
222 | daniel-mar | 569 | |
151 | daniel-mar | 570 | $admin_plugins[] = array( |
307 | daniel-mar | 571 | 'id' => 'oidplus:system_plugins$'.get_class($plugin), |
151 | daniel-mar | 572 | 'icon' => $tree_icon_pages_admin, |
222 | daniel-mar | 573 | 'text' => $txt, |
151 | daniel-mar | 574 | ); |
575 | } |
||
576 | $db_plugins = array(); |
||
577 | foreach (OIDplus::getDatabasePlugins() as $plugin) { |
||
380 | daniel-mar | 578 | $txt = (empty($plugin->getManifest()->getName())) ? get_class($plugin) : $plugin->getManifest()->getName(); |
222 | daniel-mar | 579 | |
275 | daniel-mar | 580 | if ($plugin::id() == OIDplus::baseConfig()->getValue('DATABASE_PLUGIN')) { |
151 | daniel-mar | 581 | $db_plugins[] = array( |
307 | daniel-mar | 582 | 'id' => 'oidplus:system_plugins$'.get_class($plugin), |
151 | daniel-mar | 583 | 'icon' => $tree_icon_db_active, |
584 | 'text' => $txt, |
||
585 | ); |
||
586 | } else { |
||
587 | $db_plugins[] = array( |
||
307 | daniel-mar | 588 | 'id' => 'oidplus:system_plugins$'.get_class($plugin), |
151 | daniel-mar | 589 | 'icon' => $tree_icon_db_inactive, |
590 | 'text' => '<font color="gray">'.$txt.'</font>', |
||
591 | ); |
||
592 | } |
||
593 | } |
||
274 | daniel-mar | 594 | $sql_plugins = array(); |
595 | foreach (OIDplus::getSqlSlangPlugins() as $plugin) { |
||
380 | daniel-mar | 596 | $txt = (empty($plugin->getManifest()->getName())) ? get_class($plugin) : $plugin->getManifest()->getName(); |
274 | daniel-mar | 597 | |
598 | if ($plugin::id() == OIDplus::db()->getSlang()::id()) { |
||
599 | $sql_plugins[] = array( |
||
307 | daniel-mar | 600 | 'id' => 'oidplus:system_plugins$'.get_class($plugin), |
274 | daniel-mar | 601 | 'icon' => $tree_icon_db_active, |
602 | 'text' => $txt, |
||
603 | ); |
||
604 | } else { |
||
605 | $sql_plugins[] = array( |
||
307 | daniel-mar | 606 | 'id' => 'oidplus:system_plugins$'.get_class($plugin), |
274 | daniel-mar | 607 | 'icon' => $tree_icon_db_inactive, |
608 | 'text' => '<font color="gray">'.$txt.'</font>', |
||
609 | ); |
||
610 | } |
||
611 | } |
||
151 | daniel-mar | 612 | $obj_plugins = array(); |
227 | daniel-mar | 613 | $enabled = OIDplus::getObjectTypePluginsEnabled(); |
614 | $disabled = OIDplus::getObjectTypePluginsDisabled(); |
||
222 | daniel-mar | 615 | foreach (array_merge($enabled, $disabled) as $plugin) { |
380 | daniel-mar | 616 | $txt = (empty($plugin->getManifest()->getName())) ? get_class($plugin) : $plugin->getManifest()->getName(); |
222 | daniel-mar | 617 | if (in_array($plugin, $enabled)) { |
151 | daniel-mar | 618 | $obj_plugins[] = array( |
307 | daniel-mar | 619 | 'id' => 'oidplus:system_plugins$'.get_class($plugin), |
151 | daniel-mar | 620 | 'icon' => $tree_icon_obj_active, |
621 | 'text' => $txt, |
||
622 | ); |
||
623 | } else { |
||
624 | $obj_plugins[] = array( |
||
307 | daniel-mar | 625 | 'id' => 'oidplus:system_plugins$'.get_class($plugin), |
151 | daniel-mar | 626 | 'icon' => $tree_icon_obj_inactive, |
627 | 'text' => '<font color="gray">'.$txt.'</font>', |
||
628 | ); |
||
629 | } |
||
630 | } |
||
221 | daniel-mar | 631 | $auth_plugins = array(); |
632 | foreach (OIDplus::getAuthPlugins() as $plugin) { |
||
380 | daniel-mar | 633 | $txt = (empty($plugin->getManifest()->getName())) ? get_class($plugin) : $plugin->getManifest()->getName(); |
222 | daniel-mar | 634 | |
221 | daniel-mar | 635 | $auth_plugins[] = array( |
307 | daniel-mar | 636 | 'id' => 'oidplus:system_plugins$'.get_class($plugin), |
221 | daniel-mar | 637 | 'icon' => $tree_icon_auth, |
222 | daniel-mar | 638 | 'text' => $txt, |
221 | daniel-mar | 639 | ); |
640 | } |
||
289 | daniel-mar | 641 | $logger_plugins = array(); |
642 | foreach (OIDplus::getLoggerPlugins() as $plugin) { |
||
380 | daniel-mar | 643 | $txt = (empty($plugin->getManifest()->getName())) ? get_class($plugin) : $plugin->getManifest()->getName(); |
289 | daniel-mar | 644 | |
645 | $reason = ''; |
||
646 | if (!$plugin->available($reason)) $txt = '<font color="gray">'.$txt.'</font>'; |
||
647 | |||
648 | $logger_plugins[] = array( |
||
307 | daniel-mar | 649 | 'id' => 'oidplus:system_plugins$'.get_class($plugin), |
289 | daniel-mar | 650 | 'icon' => $tree_icon_logger, |
651 | 'text' => $txt, |
||
652 | ); |
||
653 | } |
||
355 | daniel-mar | 654 | $language_plugins = array(); |
655 | foreach (OIDplus::getLanguagePlugins() as $plugin) { |
||
380 | daniel-mar | 656 | $txt = (empty($plugin->getManifest()->getName())) ? get_class($plugin) : $plugin->getManifest()->getName(); |
355 | daniel-mar | 657 | |
658 | $language_plugins[] = array( |
||
659 | 'id' => 'oidplus:system_plugins$'.get_class($plugin), |
||
660 | 'icon' => $tree_icon_language, |
||
661 | 'text' => $txt, |
||
662 | ); |
||
663 | } |
||
449 | daniel-mar | 664 | $design_plugins = array(); |
665 | foreach (OIDplus::getDesignPlugins() as $plugin) { |
||
666 | $txt = (empty($plugin->getManifest()->getName())) ? get_class($plugin) : $plugin->getManifest()->getName(); |
||
667 | |||
668 | $active = OIDplus::config()->getValue('design') === basename($plugin->getPluginDirectory()); |
||
669 | if ($active) { |
||
670 | $design_plugins[] = array( |
||
671 | 'id' => 'oidplus:system_plugins$'.get_class($plugin), |
||
672 | 'icon' => $tree_icon_design_active, |
||
673 | 'text' => $txt, |
||
674 | ); |
||
675 | } else { |
||
676 | $design_plugins[] = array( |
||
677 | 'id' => 'oidplus:system_plugins$'.get_class($plugin), |
||
678 | 'icon' => $tree_icon_design_inactive, |
||
679 | 'text' => '<font color="gray">'.$txt.'</font>', |
||
680 | ); |
||
681 | } |
||
682 | } |
||
148 | daniel-mar | 683 | $json[] = array( |
684 | 'id' => 'oidplus:system_plugins', |
||
685 | 'icon' => $tree_icon, |
||
360 | daniel-mar | 686 | 'text' => _L('Plugins'), |
151 | daniel-mar | 687 | 'children' => array( |
688 | array( |
||
689 | 'id' => 'oidplus:system_plugins.pages', |
||
690 | 'icon' => $tree_icon, |
||
360 | daniel-mar | 691 | 'text' => _L('Page plugins'), |
151 | daniel-mar | 692 | 'children' => array( |
693 | array( |
||
694 | 'id' => 'oidplus:system_plugins.pages.public', |
||
695 | 'icon' => $tree_icon, |
||
360 | daniel-mar | 696 | 'text' => _L('Public'), |
151 | daniel-mar | 697 | 'children' => $public_plugins |
698 | ), |
||
699 | array( |
||
700 | 'id' => 'oidplus:system_plugins.pages.ra', |
||
701 | 'icon' => $tree_icon, |
||
360 | daniel-mar | 702 | 'text' => _L('RA'), |
151 | daniel-mar | 703 | 'children' => $ra_plugins |
704 | ), |
||
705 | array( |
||
706 | 'id' => 'oidplus:system_plugins.pages.admin', |
||
707 | 'icon' => $tree_icon, |
||
360 | daniel-mar | 708 | 'text' => _L('Admin'), |
151 | daniel-mar | 709 | 'children' => $admin_plugins |
710 | ) |
||
711 | ) |
||
712 | ), |
||
713 | array( |
||
714 | 'id' => 'oidplus:system_plugins.objects', |
||
715 | 'icon' => $tree_icon, |
||
360 | daniel-mar | 716 | 'text' => _L('Object types'), |
151 | daniel-mar | 717 | 'children' => $obj_plugins |
718 | ), |
||
719 | array( |
||
720 | 'id' => 'oidplus:system_plugins.database', |
||
721 | 'icon' => $tree_icon, |
||
360 | daniel-mar | 722 | 'text' => _L('Database providers'), |
151 | daniel-mar | 723 | 'children' => $db_plugins |
221 | daniel-mar | 724 | ), |
725 | array( |
||
274 | daniel-mar | 726 | 'id' => 'oidplus:system_plugins.sql', |
727 | 'icon' => $tree_icon, |
||
360 | daniel-mar | 728 | 'text' => _L('SQL slangs'), |
274 | daniel-mar | 729 | 'children' => $sql_plugins |
730 | ), |
||
731 | array( |
||
221 | daniel-mar | 732 | 'id' => 'oidplus:system_plugins.auth', |
733 | 'icon' => $tree_icon, |
||
360 | daniel-mar | 734 | 'text' => _L('RA authentication'), |
221 | daniel-mar | 735 | 'children' => $auth_plugins |
289 | daniel-mar | 736 | ), |
737 | array( |
||
738 | 'id' => 'oidplus:system_plugins.logger', |
||
739 | 'icon' => $tree_icon, |
||
360 | daniel-mar | 740 | 'text' => _L('Logger'), |
289 | daniel-mar | 741 | 'children' => $logger_plugins |
355 | daniel-mar | 742 | ), |
743 | array( |
||
744 | 'id' => 'oidplus:system_plugins.language', |
||
745 | 'icon' => $tree_icon, |
||
360 | daniel-mar | 746 | 'text' => _L('Languages'), |
355 | daniel-mar | 747 | 'children' => $language_plugins |
449 | daniel-mar | 748 | ), |
749 | array( |
||
750 | 'id' => 'oidplus:system_plugins.design', |
||
751 | 'icon' => $tree_icon, |
||
752 | 'text' => _L('Designs'), |
||
753 | 'children' => $design_plugins |
||
151 | daniel-mar | 754 | ) |
755 | ) |
||
148 | daniel-mar | 756 | ); |
757 | |||
758 | return true; |
||
759 | } |
||
760 | |||
761 | public function tree_search($request) { |
||
408 | daniel-mar | 762 | // Not required, because all sub-nodes are loaded at the same time; no lazy-loading |
148 | daniel-mar | 763 | return false; |
764 | } |
||
360 | daniel-mar | 765 | } |