37 protected $cpHandler = NULL;
38 protected $cpPastingStarted = FALSE;
39 protected $skipCpHandler = FALSE;
42 protected $snapHandler = NULL;
43 public static $skipSnapshots = FALSE;
46 protected $currentDn =
'';
47 protected $currentDns = [];
50 protected $previousDn =
'';
51 protected $previousDns = [];
57 protected $tabObject = NULL;
58 protected $dialogObject = NULL;
61 protected $last_tabObject = NULL;
62 protected $last_dialogObject = NULL;
64 protected $renderCache;
70 protected $actions = [];
71 protected $actionHandlers = [];
73 protected $exporters = [];
75 public $neededAttrs = [];
77 public static $skipTemplates = TRUE;
80 protected $skipConfiguration = FALSE;
82 protected $columnConfiguration;
85 public static $columns = [
86 [
'ObjectTypeColumn', []],
87 [
'LinkColumn', [
'attributes' =>
'nameAttr',
'label' =>
'Name']],
88 [
'LinkColumn', [
'attributes' =>
'description',
'label' =>
'Description']],
89 [
'ActionsColumn', [
'label' =>
'Actions']],
92 function __construct (
94 array $filterElementDefinitions = [
95 [
'TabFilterElement', []],
99 global $config, $class_mapping;
101 if ($objectTypes === FALSE) {
102 $plInfos = pluglist::pluginInfos(get_class($this));
103 $objectTypes = $plInfos[
'plManages'];
106 if (!preg_match(
'/^geticon/', $this->icon)) {
111 foreach ($objectTypes as $key => $type) {
113 objects::infos($type);
114 $objectTypes[$key] = strtoupper($type);
116 unset($objectTypes[$key]);
120 $this->objectTypes = array_values($objectTypes);
122 $this->setUpHeadline();
123 $this->setUpListing();
124 $this->setUpFilter($filterElementDefinitions);
127 if (!$this->skipCpHandler) {
130 if (!static::$skipSnapshots && ($config->get_cfg_value(
'enableSnapshots') ==
'TRUE')) {
135 foreach (array_keys($class_mapping) as $class) {
136 if (preg_match(
'/Exporter$/', $class)) {
137 $info = call_user_func([$class,
'getInfo']);
139 $this->exporters = array_merge($this->exporters, $info);
144 $this->configureActions();
147 protected function setUpListing ()
152 protected function setUpFilter (array $filterElementDefinitions)
154 $this->filter =
new managementFilter($this, NULL, $filterElementDefinitions);
157 protected function setUpHeadline ()
159 $plInfos = pluglist::pluginInfos(get_class($this));
161 $this->headline = $plInfos[
'plShortName'];
162 $this->title = $plInfos[
'plTitle'];
163 $this->icon = $plInfos[
'plIcon'];
166 protected function configureActions ()
173 if (!static::$skipTemplates) {
175 $fromTemplateMenu = [];
178 foreach ($this->objectTypes as $type) {
179 $infos = objects::infos($type);
180 $img =
'geticon.php?context=actions&icon=document-new&size=16';
181 if (isset($infos[
'icon'])) {
182 $img = $infos[
'icon'];
184 $createMenu[] =
new Action(
185 'new_' . $type, $infos[
'name'], $img,
187 [$infos[
'aclCategory'] .
'/' . $infos[
'mainTab'] .
'/c']
189 if (!static::$skipTemplates) {
190 $templateMenu[] =
new Action(
191 'new_template_' . $type, $infos[
'name'], $img,
192 '0',
'newEntryTemplate',
193 [$infos[
'aclCategory'] .
'/template/c']
195 $fromTemplateMenu[] =
new Action(
196 'template_apply_' . $type, $infos[
'name'], $img,
197 '0',
'newEntryFromTemplate',
198 [$infos[
'aclCategory'] .
'/template/r', $infos[
'aclCategory'] .
'/' . $infos[
'mainTab'] .
'/c']
203 if (!static::$skipTemplates) {
208 'template', _(
'Template'),
'geticon.php?context=devices&icon=template&size=16',
212 'fromtemplate', _(
'From template'),
'geticon.php?context=actions&icon=document-new&size=16',
222 'new', _(
'Create'),
'geticon.php?context=actions&icon=document-new&size=16',
229 foreach ($this->exporters as $action => $exporter) {
230 $exportMenu[] =
new Action(
231 $action, $exporter[
'label'], $exporter[
'image'],
237 'export', _(
'Export list'),
'geticon.php?context=actions&icon=document-export&size=16',
244 'edit', _(
'Edit'),
'geticon.php?context=actions&icon=document-edit&size=16',
248 $this->actions[
'edit']->setSeparator(TRUE);
250 if (!$this->skipCpHandler) {
253 'cut', _(
'Cut'),
'geticon.php?context=actions&icon=edit-cut&size=16',
254 '+',
'copyPasteHandler',
260 'copy', _(
'Copy'),
'geticon.php?context=actions&icon=edit-copy&size=16',
261 '+',
'copyPasteHandler',
267 'paste', _(
'Paste'),
'geticon.php?context=actions&icon=edit-paste&size=16',
268 '0',
'copyPasteHandler',
272 $this->actions[
'paste']->setEnableFunction([$this,
'enablePaste']);
275 if (!static::$skipTemplates) {
278 'template_apply_to', _(
'Apply template'),
'geticon.php?context=actions&icon=tools-wizard&size=16',
279 '+',
'applyTemplateToEntry',
280 [
'/template/r',
'c'],
288 $action = archivedObject::getManagementAction($this->objectTypes,
'archiveRequested');
289 if ($action !== NULL) {
298 'remove', _(
'Remove'),
'geticon.php?context=actions&icon=edit-delete&size=16',
299 '+',
'removeRequested',
304 if (!static::$skipSnapshots && ($config->get_cfg_value(
'enableSnapshots') ==
'TRUE')) {
307 'snapshot', _(
'Create snapshot'),
'geticon.php?context=actions&icon=snapshot&size=16',
308 '1',
'createSnapshotDialog',
309 [
'/SnapshotHandler/c']
314 'restore', _(
'Restore snapshot'),
'geticon.php?context=actions&icon=document-restore&size=16',
315 '*',
'restoreSnapshotDialog',
316 [
'w',
'/SnapshotHandler/r']
319 $this->actions[
'snapshot']->setSeparator(TRUE);
320 $this->actions[
'restore']->setEnableFunction([$this,
'enableSnapshotRestore']);
323 if (!static::$skipTemplates) {
326 'template_apply', _(
'Create an object from this template'),
'geticon.php?context=actions&icon=document-new&size=16',
327 '1',
'newEntryFromTemplate',
328 [
'/template/r',
'c'],
342 if (!$this->skipConfiguration) {
352 $action->setParent($this);
353 $this->actions[$action->getName()] = $action;
354 foreach ($action->listActions() as $actionName) {
355 $this->actionHandlers[$actionName] = $action;
359 public function getColumnConfiguration (): array
363 if (!isset($this->columnConfiguration)) {
365 $this->columnConfiguration = $config->getManagementConfig(get_class($this));
368 if (!isset($this->columnConfiguration)) {
370 $this->columnConfiguration = static::$columns;
374 return $this->columnConfiguration;
377 public function setColumnConfiguration ($columns)
379 $this->columnConfiguration = $columns;
380 $this->listing->reloadColumns();
389 if (!is_object($this->listing)) {
392 $action = [
'targets' => [],
'action' =>
'',
'subaction' => NULL];
394 if (isset($_POST[
'edit_cancel'])) {
395 $action[
'action'] =
'cancel';
396 } elseif (isset($_POST[
'edit_finish'])) {
397 $action[
'action'] =
'save';
398 } elseif (isset($_POST[
'edit_apply'])) {
399 $action[
'action'] =
'apply';
401 } elseif (!$this->dialogOpened()) {
402 if (isset($_POST[
'delete_confirmed'])) {
403 $action[
'action'] =
'removeConfirmed';
404 } elseif (isset($_POST[
'delete_cancel'])) {
405 $action[
'action'] =
'cancelDelete';
406 } elseif (isset($_POST[
'archive_confirmed'])) {
407 $action[
'action'] =
'archiveConfirmed';
408 } elseif (isset($_POST[
'archive_cancel'])) {
409 $action[
'action'] =
'archiveCancel';
411 $action = $this->listing->getAction();
424 if (isset($action[
'subaction']) && isset($this->actionHandlers[$action[
'action'] .
'_' . $action[
'subaction']])) {
425 return $this->actionHandlers[$action[
'action'] .
'_' . $action[
'subaction']]->execute($this, $action);
426 } elseif (isset($this->actionHandlers[$action[
'action']])) {
427 return $this->actionHandlers[$action[
'action']]->execute($this, $action);
431 protected function handleSubAction (array $action):
bool 433 if (preg_match(
'/^tab_/', $action[
'subaction'])) {
434 $tab = preg_replace(
'/^tab_/',
'', $action[
'subaction']);
435 if (isset($this->tabObject->by_object[$tab])) {
436 $this->tabObject->current = $tab;
438 trigger_error(
'Unknown tab: ' . $tab);
448 $this->renderCache = $this->
execute();
453 if ($this->renderCache === NULL) {
454 if (!$this->dialogOpened()) {
456 $this->listing->update();
459 if (is_object($this->snapHandler)) {
460 $this->snapHandler->initSnapshotCache($this->listing->getBase());
469 if ($this->renderCache === NULL) {
472 $display = $this->tabObject->render();
474 $this->renderCache = $this->
getHeader() . $display;
475 } elseif (is_object($this->dialogObject)) {
477 $display = $this->dialogObject->render();
479 $this->renderCache = $this->
getHeader() . $display;
482 $this->renderCache = $this->renderList();
485 return $this->renderCache;
495 session::set(
'LOCK_VARS_TO_USE', [
'/^act$/',
'/^listing/',
'/^PID$/']);
505 if (!empty($action[
'action'])) {
506 logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $action,
'Action');
520 $this->tabObject->readPost();
521 $this->tabObject->update();
522 } elseif (is_object($this->dialogObject)) {
524 $this->dialogObject->readPost();
525 if (is_object($this->dialogObject)) {
527 if (!$this->dialogObject->update()) {
541 function renderList ():
string 546 $listRender = $this->listing->render();
547 $filterRender = $this->renderFilter();
548 $actionMenu = $this->renderActionMenu();
551 $smarty->assign(
'usePrototype',
'true');
552 $smarty->assign(
'LIST', $listRender);
553 $smarty->assign(
'FILTER', $filterRender);
554 $smarty->assign(
'ACTIONS', $actionMenu);
555 $smarty->assign(
'SIZELIMIT', $ui->getSizeLimitHandler()->renderWarning());
556 $smarty->assign(
'NAVIGATION', $this->listing->renderNavigation($this->skipConfiguration));
557 $smarty->assign(
'BASE', $this->listing->renderBase());
558 $smarty->assign(
'HEADLINE', $this->headline);
563 protected function renderFilter ():
string 565 return $this->filter->render();
568 protected function renderActionMenu ():
string 571 foreach ($this->actions as $action) {
573 $action->fillMenuItems($menuActions);
576 if (empty($menuActions)) {
581 $smarty->assign(
'actions', $menuActions);
585 function renderActionColumn (
ListingEntry $entry):
string 589 foreach ($this->actions as $action) {
590 $result .= $action->renderColumnIcons($entry);
596 function fillActionRowClasses (&$classes,
ListingEntry $entry)
598 foreach ($this->actions as $action) {
599 $action->fillRowClasses($classes, $entry);
611 if (!empty($this->currentDn) && ($this->currentDn !=
'new')) {
614 if (count($this->currentDns)) {
619 function dialogOpened ():
bool 621 return (is_object($this->tabObject) || is_object($this->dialogObject));
631 $smarty->assign(
'headline', $this->title);
632 $smarty->assign(
'headline_image', $this->icon);
634 if (is_object($this->tabObject) && ($this->currentDn !=
'')) {
635 return '<div class="pluginfo">' . $this->currentDn .
"</div>\n";
640 function openTabObject ($object)
642 $this->tabObject = $object;
643 $this->tabObject->parent = &$this;
652 $this->previousDn = $this->currentDn;
653 $this->currentDn =
'';
654 $this->previousDns = $this->currentDns;
655 $this->currentDns = [];
657 $this->last_tabObject = $this->tabObject;
658 $this->tabObject = NULL;
659 $this->last_dialogObject = $this->dialogObject;
660 $this->dialogObject = NULL;
663 protected function listAclCategories (): array
666 foreach ($this->objectTypes as $type) {
667 $infos = objects::infos($type);
668 $cat[] = $infos[
'aclCategory'];
670 return array_unique($cat);
679 if (!($this->tabObject instanceof
simpleTabs)) {
684 if ($this->tabObject->dialogOpened()) {
702 $smarty->assign(
'readOnly', $this->tabObject->readOnly());
703 $smarty->assign(
'showApply', ($this->currentDn !=
'new'));
707 function handleTemplateApply ($cancel = FALSE)
709 if (static::$skipTemplates) {
715 $msgs = $this->tabObject->save();
718 msg_dialog::displayChecks($msgs);
722 logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDn,
'Template applied!');
725 if (empty($this->currentDns)) {
728 $this->last_tabObject = $this->tabObject;
729 $this->tabObject = NULL;
730 $this->currentDn = array_shift($this->currentDns);
731 $this->dialogObject->setNextTarget($this->currentDn);
732 $this->dialogObject->readPost();
737 function enablePaste ($action,
ListingEntry $entry = NULL):
bool 739 if ($entry === NULL) {
740 return $this->cpHandler->entries_queued();
757 $type = $action[
'subaction'];
759 $this->currentDn =
'new';
762 $this->openTabObject(objects::create($type));
763 logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDn,
'Create entry initiated');
766 function newEntryTemplate (array $action)
768 if (static::$skipTemplates) {
771 $type = preg_replace(
'/^template_/',
'', $action[
'subaction']);
773 $this->currentDn =
'new';
776 $this->openTabObject(objects::createTemplate($type));
777 logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDn,
'Create template entry initiated');
780 function newEntryFromTemplate (array $action)
782 if (static::$skipTemplates) {
785 if (isset($action[
'targets'][0])) {
786 $dn = $action[
'targets'][0];
790 if ($action[
'subaction'] ==
'apply') {
794 $type = $this->listing->getEntry($dn)->getTemplatedType();
796 $type = preg_replace(
'/^apply_/',
'', $action[
'subaction']);
801 function applyTemplateToEntry (array $action)
804 if (static::$skipTemplates) {
807 if (empty($action[
'targets'])) {
810 $this->currentDns = $action[
'targets'];
813 if ($locks =
Lock::get($this->currentDns)) {
823 foreach ($this->currentDns as $dn) {
824 $entry = $this->listing->getEntry($dn);
825 if ($entry === NULL) {
826 trigger_error(
'Could not find ' . $dn .
', action canceled');
827 $this->currentDns = [];
831 if ($entry->isTemplate()) {
834 $this->currentDns = [];
839 $type = $entry->type;
840 } elseif ($entry->type != $type) {
843 $this->currentDns = [];
848 $this->currentDn = array_shift($this->currentDns);
850 $this->dialogObject =
new templateDialog($this, $type, NULL, $this->currentDn);
860 if (empty($action[
'targets'])) {
863 $this->currentDns = $action[
'targets'];
865 logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $action[
'targets'],
'Entry archive requested');
868 if ($locks =
Lock::get($this->currentDns)) {
876 foreach ($this->currentDns as $dn) {
877 $entry = $this->listing->getEntry($dn);
878 if ($entry->isTemplate()) {
882 $this->currentDns = [];
885 $infos = objects::infos($entry->getTemplatedType());
887 'name' => $entry[$infos[
'nameAttr']][0],
889 'icon' => $infos[
'icon'],
890 'type' => $infos[
'name']
895 $smarty->assign(
'objects', $objects);
899 public function archiveConfirmed (array $action)
901 logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDns,
'Archiving');
904 foreach ($this->currentDns as $dn) {
905 $entry = $this->listing->getEntry($dn);
907 $errors = archivedObject::archiveObject($entry->type, $dn);
908 if (empty($errors)) {
911 msg_dialog::displayChecks($errors);
918 _(
'Archive success'),
919 htmlescape(sprintf(_(
'%d entries were successfully archived'), $success)),
924 $this->currentDns = [];
940 if (is_object($this->tabObject)) {
944 $target = array_pop($action[
'targets']);
946 $entry = $this->listing->getEntry($target);
947 if ($entry === NULL) {
948 trigger_error(
'Could not find ' . $target .
', open canceled');
953 $this->currentDn = $target;
954 if ($locks =
Lock::get($this->currentDn, TRUE)) {
960 $this->openTabObject(
objects::open($this->currentDn, $entry->getTemplatedType()));
961 logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDn,
'Edit entry initiated');
962 if (isset($action[
'subaction'])
963 && ($this->handleSubAction($action) === FALSE)) {
964 trigger_error(
'Was not able to handle subaction: ' . $action[
'subaction']);
975 $this->handleTemplateApply(TRUE);
990 $this->tabObject->readPost();
991 $this->tabObject->update();
993 $this->handleTemplateApply();
995 $msgs = $this->tabObject->save();
997 msg_dialog::displayChecks($msgs);
999 logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDns,
'Entry saved');
1012 if ($this->tabObject instanceof
simpleTabs) {
1013 $this->tabObject->readPost();
1014 $this->tabObject->update();
1015 $msgs = $this->tabObject->save();
1017 msg_dialog::displayChecks($msgs);
1019 logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDns,
'Modifications applied');
1020 $this->tabObject->re_init();
1034 $this->currentDns = [];
1036 logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $action[
'targets'],
'Entry deletion requested');
1039 foreach ($action[
'targets'] as $dn) {
1040 $entry = $this->listing->getEntry($dn);
1042 if ($entry->checkAcl(
'd')) {
1043 $this->currentDns[] = $dn;
1045 $disallowed[] = $dn;
1048 trigger_error(
'Unknown object type received :' . $e->getMessage());
1051 if (count($disallowed)) {
1057 if (count($this->currentDns)) {
1059 if ($locks =
Lock::get($this->currentDns)) {
1067 foreach ($this->currentDns as $dn) {
1068 $entry = $this->listing->getEntry($dn);
1069 $infos = objects::infos($entry->getTemplatedType());
1070 if ($entry->isTemplate()) {
1071 $infos[
'nameAttr'] =
'cn';
1074 'name' => $entry[$infos[
'nameAttr']][0],
1076 'icon' => $infos[
'icon'],
1077 'type' => $infos[
'name']
1090 $smarty->assign(
'objects', $objects);
1091 $smarty->assign(
'multiple', TRUE);
1101 logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDns,
'Entry deletion confirmed');
1104 foreach ($this->currentDns as $dn) {
1105 $entry = $this->listing->getEntry($dn);
1106 if (empty($entry)) {
1109 if ($entry->checkAcl(
'd')) {
1111 $this->currentDn = $dn;
1112 $this->openTabObject(
objects::open($this->currentDn, $entry->getTemplatedType()));
1113 $errors = $this->tabObject->delete();
1114 msg_dialog::displayChecks($errors);
1120 $dnSnapshotsList = $snapshotHandler->getSnapshots($this->currentDn, TRUE);
1121 foreach ($dnSnapshotsList as $snap) {
1122 $snapshotHandler->removeSnapshot($snap[
'dn']);
1127 logging::log(
'security',
'management/' . get_class($this), $dn, [],
'Tried to trick deletion.');
1136 function configureDialog (array $action)
1138 if (!$this->skipConfiguration) {
1151 if (!is_object($this->cpHandler)) {
1156 $this->cpHandler->readPost();
1159 if (($action[
'action'] ==
'copy') || ($action[
'action'] ==
'cut')) {
1160 $this->cpHandler->cleanup_queue();
1161 foreach ($action[
'targets'] as $dn) {
1162 $entry = $this->listing->getEntry($dn);
1163 if (($action[
'action'] ==
'copy') && $entry->checkAcl(
'r')) {
1164 $this->cpHandler->add_to_queue($dn,
'copy', $entry->getTemplatedType());
1165 logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn,
'Entry copied!');
1167 if (($action[
'action'] ==
'cut') && $entry->checkAcl(
'rd')) {
1168 $this->cpHandler->add_to_queue($dn,
'cut', $entry->getTemplatedType());
1169 logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn,
'Entry cut!');
1175 if ($action[
'action'] ==
'paste') {
1176 $this->cpPastingStarted = TRUE;
1180 if ($this->cpPastingStarted && $this->cpHandler->entries_queued()) {
1181 $this->cpHandler->update();
1182 $data = $this->cpHandler->render();
1183 if (!empty($data)) {
1189 if (!$this->cpHandler->entries_queued()) {
1190 $this->cpPastingStarted = FALSE;
1191 $this->cpHandler->resetPaste();
1202 global $config, $ui;
1203 logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $action[
'targets'],
'Snapshot creation initiated!');
1205 $this->currentDn = array_pop($action[
'targets']);
1206 if (empty($this->currentDn)) {
1209 $entry = $this->listing->getEntry($this->currentDn);
1210 if ($entry->snapshotCreationAllowed()) {
1215 _(
'You are not allowed to create a snapshot for %s.'),
1229 global $config, $ui;
1231 if (empty($action[
'targets'])) {
1233 $this->currentDn = $this->listing->getBase();
1234 $aclCategories = $this->listAclCategories();
1237 $this->currentDn = $action[
'targets'][0];
1238 if (empty($this->currentDn)) {
1241 $aclCategories = [objects::infos($this->listing->getEntry($this->currentDn)->getTemplatedType())[
'aclCategory']];
1244 if ($ui->allow_snapshot_restore($this->currentDn, $aclCategories, empty($action[
'targets']))) {
1245 logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $this->currentDn,
'Snapshot restoring initiated!');
1246 $this->dialogObject =
new SnapshotRestoreDialog($this->currentDn, $this, empty($action[
'targets']), $aclCategories);
1250 _(
'You are not allowed to restore a snapshot for %s.'),
1259 function export (array $action)
1261 if (!isset($this->exporters[$action[
'action']])) {
1262 trigger_error(
'Unknown exporter ' . $action[
'action']);
1265 $exporter = $this->exporters[$action[
'action']];
1266 $file = $exporter[
'class']::export($this->listing);
1274 function getSnapshotBases (): array
1277 foreach ($this->objectTypes as $type) {
1278 $infos = objects::infos($type);
1279 $bases[] = $infos[
'ou'] . $this->listing->getBase();
1283 if (!count($bases)) {
1284 $bases[] = $this->listing->getBase();
1287 return array_unique($bases);
1295 $bases = $this->getSnapshotBases();
1297 foreach ($bases as $base) {
1298 $tmp = array_merge($tmp, $this->snapHandler->getAllDeletedSnapshots($base));
1308 function getAvailableSnapsShots (
string $dn): array
1310 return $this->snapHandler->getAvailableSnapsShots($dn);
1316 function enableSnapshotRestore ($action,
ListingEntry $entry = NULL):
bool 1318 if ($entry !== NULL) {
1320 return $this->snapHandler->hasSnapshots($entry->dn);
1323 return $this->snapHandler->hasDeletedSnapshots($this->getSnapshotBases());
1331 function createSnapshot (
string $dn,
string $description,
string $snapshotSource =
'FD')
1335 if (empty($dn) || ($this->currentDn !== $dn)) {
1336 trigger_error(
'There was a problem with the snapshot workflow');
1339 $entry = $this->listing->getEntry($dn);
1340 if ($entry->snapshotCreationAllowed()) {
1341 $this->snapHandler->createSnapshot($dn, $description, $entry->type, $snapshotSource);
1342 logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn,
'Snapshot created!');
1357 if (!empty($dn) && $ui->allow_snapshot_restore($dn, $this->dialogObject->aclCategory, $this->dialogObject->global)) {
1358 $dn = $this->snapHandler->restoreSnapshot($dn);
1359 logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn,
'Snapshot restored');
1361 if ($dn !== FALSE) {
1362 $this->listing->focusDn($dn);
1363 $entry = $this->listing->getEntry($dn);
1364 $this->currentDn = $dn;
1368 $this->openTabObject(
objects::open($this->currentDn, $entry->getTemplatedType()));
1385 if (!empty($dn) && $ui->allow_snapshot_delete($dn, $this->dialogObject->aclCategory)) {
1386 $this->snapHandler->removeSnapshot($dn);
1387 logging::debug(DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $dn,
'Snapshot deleted');
1394 static function mainInc ($classname = NULL, $objectTypes = FALSE)
1396 global $remove_lock, $cleanup, $display;
1398 if ($classname === NULL) {
1399 $classname = get_called_class();
1405 $macl->removeLocks();
1412 if (!
session::is_set($classname) || (isset($_GET[
'reset']) && $_GET[
'reset'] == 1)) {
1414 $managementObject =
new $classname($objectTypes);
1420 $managementObject->readPost();
1421 $managementObject->update();
1422 $display = $managementObject->render();
archiveRequested(array $action)
Queue selected objects to be archived. Checks Locks and ask for confirmation.
Snapshot creation dialog.
htmlescape(string $str)
Escape string for HTML output.
showTabFooter()
Whether footer buttons should appear.
getHeader()
Sets smarty headline and returns the plugin header which is displayed whenever a tab object is opened...
copyPasteHandler(array $action=['action'=> ''])
This method is used to queue and process copy&paste actions. Allows to copy, cut and paste mutliple e...
get_template_path($filename='', $plugin=FALSE, $path='')
Return themed path for specified base file.
static get($name)
Accessor of a session var.
This interface should be implemented by all dialog classes in FusionDirectory.
send_binary_content($data, $name, $type="application/octet-stream")
Initialize a file download with given content, name and data type.
render()
Render the dialog and returns the HTML code.
This class contains all function to manage tabs classes.
restoreSnapshotDialog(array $action)
Displays the "Restore snapshot dialog" for a given target. If no target is specified, open the restore removed object dialog.
static genLockedMessage(array $locks, bool $allowReadonly=FALSE, string $action=NULL)
Generate a lock message.
Management configuration dialog.
This class contains all function to copy and paste.
readPost()
Interpret POST content.
static get($objects, bool $allow_readonly=FALSE)
Get locks for objects.
static log(string $action, string $objecttype, string $object, array $changes=[], string $result='')
logging method
static display($title, string $message, int $type=INFO_DIALOG, array $trace=[])
Display a message dialog.
static set($name, $value)
Set a value in a session.
newEntry(array $action)
This method intiates the object creation.
registerAction(Action $action)
Register an action to show in the action menu and/or the action column.
removeSnapshot(string $dn)
Delete a snapshot.
static add($object, string $user=NULL)
Add a lock for object(s)
Snapshot restoration dialog.
& get_smarty()
Get global smarty object.
removeConfirmed(array $action)
Deletion was confirmed, delete the objects queued. Checks ACLs just in case.
This class handles the entries list for a management instance.
removeConfirmationDialog(array $objects)
Display confirmation dialog.
This class handles the management filter box.
static open(string $dn, string $type)
Create the tab object for the given dn.
static debug(int $level, int $line, string $function, string $file, $data, string $info='')
Debug output method.
cancelEdit()
Editing an object was canceled. Close dialogs/tabs and remove locks.
editEntry(array $action)
This method opens an existing object to be edited.
Parent class for all exceptions thrown in FusionDirectory.
static permDelete($name='')
Display that we have no permission to delete an object.
createSnapshot(string $dn, string $description, string $snapshotSource='FD')
Creates a new snapshot entry If source arg is not set, default to 'FD'.
static deleteByObject($object)
Remove a lock for object(s)
Action hidden from both column and menu.
removeRequested(array $action)
Queue selected objects to be removed. Checks ACLs, Locks and ask for confirmation.
static un_set($name)
Unset a session.
saveChanges()
Save object modifications and closes dialogs (returns to object listing).
createSnapshotDialog(array $action)
Opens the snapshot creation dialog for the given target.
This class contains all the function needed to handle the snapshot functionality. ...
applyChanges()
Save object modifications and keep dialogs opened.
execute()
Execute this plugin Handle actions/events, locking, snapshots, dialogs, tabs,...
update()
Update state and return FALSE if the dialog was closed.
handleAction(array $action)
Calls the registered method for a given action/event.
Parent class for all errors in FusionDirectory.
removeLocks()
Removes ldap object locks created by this class. Whenever an object is edited, we create locks to avo...
Template dialog handling.
detectPostActions()
Detects actions/events send by the ui and the corresponding targets.
restoreSnapshot(string $dn)
Restores a snapshot object.
getAllDeletedSnapshots()
Get all deleted snapshots.
getTabFooter()
Generates the footer which is used whenever a tab object is displayed.
static is_set($name)
Check if the name of the session is set.
closeDialogs()
This method closes dialogs and cleans up the cached object info and the ui.
class_available($name)
Checks if a class is available.