summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2cba62d)
raw | patch | inline | side by side (parent: 2cba62d)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 12 Jan 2010 13:37:27 +0000 (13:37 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 12 Jan 2010 13:37:27 +0000 (13:37 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15162 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/systems/admin/systems/class_systemManagement.inc | patch | blob | history |
diff --git a/gosa-plugins/systems/admin/systems/class_systemManagement.inc b/gosa-plugins/systems/admin/systems/class_systemManagement.inc
index a0b98cb72bf38de666448cab648d5b95b66b89a2..894655dde0f16dd5f6ccd26ed9fce7eb9b2b38d2 100644 (file)
}
+ /*! \brief Opens the snapshot creation dialog for the given target.
+ *
+ * @param String 'action' The name of the action which was the used as trigger.
+ * @param Array 'target' A list of object dns, which should be affected by this method.
+ * @param Array 'all' A combination of both 'action' and 'target'.
+ */
+ function createSnapshotDialog($action="",$target=array(),$all=array())
+ {
+ @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$target,"Snaptshot creation initiated!");
+
+ $pInfo = $this->getObjectDefinitions();
+ $headpage = $this->getHeadpage();
+ foreach($target as $dn){
+
+ $entry = $headpage->getEntry($dn);
+ $type = $headpage->getType($dn);
+ if(!isset($pInfo[$type])) {
+ trigger_error('Unknown system type \''.$type.'\'!');
+ return;
+ }
+
+ if(!empty($dn) && $this->ui->allow_snapshot_create($dn,$pInfo[$type]['aclCategory'])){
+ $this->dialogObject = new SnapShotDialog($this->config,$dn,$this);
+ $this->dialogObject->aclCategories = array($pInfo[$type]['aclCategory']);
+ $this->dialogObject->parent = &$this;
+
+ }else{
+ msg_dialog::display(_("Permission"),sprintf(_("You are not allowed to create a snapshot for %s."),$dn),
+ ERROR_DIALOG);
+ }
+ }
+ }
+
+
+ /*! \brief Displays the "Restore snapshot dialog" for a given target.
+ * If no target is specified, open the restore removed object
+ * dialog.
+ * @param String 'action' The name of the action which was the used as trigger.
+ * @param Array 'target' A list of object dns, which should be affected by this method.
+ * @param Array 'all' A combination of both 'action' and 'target'.
+ */
+ function restoreSnapshotDialog($action="",$target=array(),$all=array())
+ {
+ // Set current restore base for snapshot handling.
+ $headpage = $this->getHeadpage();
+ $pInfo = $this->getObjectDefinitions();
+ if(is_object($this->snapHandler)){
+ $bases = array();
+ foreach($this->storagePoints as $sp){
+ $bases[] = $sp.$headpage->getBase();
+ }
+ }
+
+ // No bases specified? Try base
+ if(!count($bases)) $bases[] = $this->headpage->getBase();
+
+ // No target, open the restore removed object dialog.
+ if(!count($target)){
+
+ $cats = array();
+ foreach($pInfo as $data){
+ $cats[] = $data['aclCategory'];
+ }
+ $cats = array_unique($cats);
+
+ $entry = $headpage->getBase();
+ if(!empty($entry) && $this->ui->allow_snapshot_restore($entry,$cats)){
+ @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$entry,"Snaptshot restoring initiated!");
+ $this->dialogObject = new SnapShotDialog($this->config,$entry,$this);
+ $this->dialogObject->set_snapshot_bases($bases);
+ $this->dialogObject->display_all_removed_objects = true;
+ $this->dialogObject->display_restore_dialog = true;
+ $this->dialogObject->parent = &$this;
+ }else{
+ msg_dialog::display(_("Permission"),sprintf(_("You are not allowed to restore a snapshot for %s."),$entry),
+ ERROR_DIALOG);
+ }
+ }else{
+
+ // Display the restore points for a given object.
+ $dn = array_pop($target);
+ $entry = $headpage->getEntry($dn);
+ $type = $headpage->getType($dn);
+ if(!isset($pInfo[$type])) {
+ trigger_error('Unknown system type \''.$type.'\'!');
+ return;
+ }
+
+ if(!empty($dn) && $this->ui->allow_snapshot_create($dn,$pInfo[$type]['aclCategory'])){
+ @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$dn,"Snaptshot restoring initiated!");
+ $this->dialogObject = new SnapShotDialog($this->config,$dn,$this);
+ $this->dialogObject->set_snapshot_bases($bases);
+ $this->dialogObject->display_restore_dialog = true;
+ $this->dialogObject->parent = &$this;
+ }else{
+ msg_dialog::display(_("Permission"),sprintf(_("You are not allowed to restore a snapshot for %s."),$dn),
+ ERROR_DIALOG);
+ }
+ }
+ }
+
+
+ /*! \brief Restores a snapshot object.
+ * The dn of the snapshot entry has to be given as ['target'] parameter.
+ *
+ * @param String 'action' The name of the action which was the used as trigger.
+ * @param Array 'target' A list of object dns, which should be affected by this method.
+ * @param Array 'all' A combination of both 'action' and 'target'.
+ */
+ function restoreSnapshot($action="",$target=array(),$all=array())
+ {
+ $dn = array_pop($target);
+ $this->snapHandler->restore_snapshot($dn);
+ @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__,$dn,"Snaptshot restored!");
+ $this->closeDialogs();
+ }
+
- /*! \brief Detects actions/events send by the ui
+ /*! \brief Detects actions/events send by the ui
* and the corresponding targets.
*/
function detectPostActions()
"plugClass" => "workgeneric",
"tabClass" => "worktabs",
"tabDesc" => "WORKTABS",
- "aclClass" => "workstation",
+ "aclClass" => "workgeneric",
"sendEvents" => TRUE,
- "aclCategory" => "workgeneric"),
+ "aclCategory" => "workstation"),
"gotoTerminal" => array(
"ou" => get_ou('terminalRDN'),
"tabClass" => "termtabs",
"sendEvents" => TRUE,
"tabDesc" => "TERMTABS",
- "aclClass" => "terminal",
- "aclCategory" => "termgeneric"),
+ "aclClass" => "termgeneric",
+ "aclCategory" => "terminal"),
"gotoPrinter" => array(
"ou" => get_ou('printerRDN'),
"plugClass" => "printgeneric",
"tabClass" => "printtabs",
"tabDesc" => "PRINTTABS",
- "aclClass" => "printer",
+ "aclClass" => "printgeneric",
"sendEvents" => FALSE,
- "aclCategory" => "printgeneric"),
+ "aclCategory" => "printer"),
"FAKE_OC_NewDevice" => array(
"ou" => get_ou('systemIncomingRDN'),
"tabClass" => "termtabs",
"sendEvents" => TRUE,
"tabDesc" => "TERMTABS",
- "aclClass" => "terminal",
- "aclCategory" => "termgeneric"),
+ "aclClass" => "termgeneric",
+ "aclCategory" => "terminal"),
"goFonHardware" => array(
"ou" => get_ou('phoneRDN'),
"tabClass" => "phonetabs",
"tabDesc" => "PHONETABS",
"sendEvents" => FALSE,
- "aclClass" => "phone",
- "aclCategory" => "phoneGeneric"),
+ "aclClass" => "phoneGeneric",
+ "aclCategory" => "phone"),
"FAKE_OC_winstation" => array(
"ou" => get_winstations_ou(),