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