From: hickert Date: Mon, 26 Jun 2006 04:05:34 +0000 (+0000) Subject: Moved snapshot tpl to ihtml/themes X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=003fe7ff136493fca25cf835ae5e46b590ae4383;p=gosa.git Moved snapshot tpl to ihtml/themes Moved include/class_SnapShotDialog.inc into ./include git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3881 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/ihtml/themes/default/snapshotdialog.tpl b/ihtml/themes/default/snapshotdialog.tpl new file mode 100755 index 000000000..c71b07041 --- /dev/null +++ b/ihtml/themes/default/snapshotdialog.tpl @@ -0,0 +1,99 @@ +{if $RestoreMode} + +

{t}Restoring an object snapshot{/t}

+
+

+{t}This procedure will create a working snapshot of the selected object.{/t} +
+

+

+
+ + {if $CountSnapShots!=0} + {t}You will be able to restore from{/t} + {else} + {t}There are no available snapshots.{/t} + {/if} +
+
+

+
+ + + + + + + +
+ {if $CountSnapShots==0} + {t}There is no snapshot available that could be restored.{/t} + {else} + {t}Choose a snapshot and click continue, to restore the snapshot.{/t} + {/if} +
+ +
+ +

 

+

+

+ +   + +

+{else} + +

{t}Creating an object snapshot{/t}

+
+

+{t}This procedure will create a working snapshot of the selected object.{/t} +
+

+

+
+{t}You will be able to restore from{/t} +
+
+

+
+ + + + + + + + + + + + +
+ {t}Object{/t} + + {$CurrentDN} +
+ {t}Date{/t} + + {$CurrentDate} +
+ {t}Description{/t}
+ +
+ +

 

+

+

+ +   + +

+{/if} diff --git a/include/class_SnapShotDialog.inc b/include/class_SnapShotDialog.inc new file mode 100755 index 000000000..07b410d21 --- /dev/null +++ b/include/class_SnapShotDialog.inc @@ -0,0 +1,97 @@ +parent = $parent; + } + + + /* Display snapshot dialog */ + function execute() + { + plugin::execute(); + $smarty = get_smarty(); + + /* We must restore a snapshot, so get snapshots */ + if($this->Restore){ + + /* Should we only display all snapshots of already deleted objects + or the snapshots for the given object dn */ + $res = array(); + if($this->DeletedOnes){ + if(is_array($this->dn)){ + $tmp = array(); + foreach($this->dn as $dn){ + $tmp = array_merge($tmp,$this->getAllDeletedSnapshots($dn,true)); + } + }else{ + $tmp = $this->getAllDeletedSnapshots($this->dn,true); + } + }else{ + $tmp = $this->Available_SnapsShots($this->dn,true); + } + + /* Walk through all entries and setup the display text */ + foreach($tmp as $key => $entry){ + + $data = $entry['description'][0]; + $date = date("d.m.Y H.i.s",preg_replace("/\-.*$/","",$entry['gosaSnapshotTimestamp'][0])); + if($this->DeletedOnes){ + $data.= " - ".$entry['gosaSnapshotDN'][0]; + } + + if(strlen($data) > 83){ + $data= substr($data,0,80)." ..."; + } + + $res[base64_encode($entry['dn'])] = $date." - ".$data; + } + natcasesort($res); + $smarty->assign("SnapShots",array_reverse($res)); + $smarty->assign("CountSnapShots",count($res)); + } + + $smarty->assign("RestoreMode",$this->Restore); + $smarty->assign("CurrentDate",date("d.m.Y H:i")); + $smarty->assign("CurrentDN",$this->dn); + $smarty->assign("CurrentDescription",$this->CurrentDescription); + return($smarty->fetch(get_template_path("snapshotdialog.tpl",TRUE))); + } + + + function check() + { + $message = plugin::check(); + if(!$this->Restore){ + if(empty($this->CurrentDescription)){ + $message[] = _("Please specify a valid description for this snapshot."); + } + } + return($message); + } + + + function save_object() + { + plugin::save_object(); + foreach($this->attributes as $name){ + if(isset($_POST[$name])){ + $this->$name = stripslashes($_POST[$name]); + } + } + } +} + +?> diff --git a/plugins/admin/systems/class_SnapShotDialog.inc b/plugins/admin/systems/class_SnapShotDialog.inc deleted file mode 100755 index 5d9149dbc..000000000 --- a/plugins/admin/systems/class_SnapShotDialog.inc +++ /dev/null @@ -1,97 +0,0 @@ -parent = $parent; - } - - - /* Display snapshot dialog */ - function execute() - { - plugin::execute(); - $smarty = get_smarty(); - - /* We must restore a snapshot, so get snapshots */ - if($this->Restore){ - - /* Should we only display all snapshots of already deleted objects - or the snapshots for the given object dn */ - $res = array(); - if($this->DeletedOnes){ - if(is_array($this->dn)){ - $tmp = array(); - foreach($this->dn as $dn){ - $tmp = array_merge($tmp,$this->getAllDeletedSnapshots($dn,true)); - } - }else{ - $tmp = $this->getAllDeletedSnapshots($this->dn,true); - } - }else{ - $tmp = $this->Available_SnapsShots($this->dn,true); - } - - /* Walk through all entries and setup the display text */ - foreach($tmp as $key => $entry){ - - $data = $entry['description'][0]; - $date = date("d.m.Y H.i.s",preg_replace("/\-.*$/","",$entry['gosaSnapshotTimestamp'][0])); - if($this->DeletedOnes){ - $data.= " - ".$entry['gosaSnapshotDN'][0]; - } - - if(strlen($data) > 83){ - $data= substr($data,0,80)." ..."; - } - - $res[base64_encode($entry['dn'])] = $date." - ".$data; - } - natcasesort($res); - $smarty->assign("SnapShots",array_reverse($res)); - $smarty->assign("CountSnapShots",count($res)); - } - - $smarty->assign("RestoreMode",$this->Restore); - $smarty->assign("CurrentDate",date("d.m.Y H:i")); - $smarty->assign("CurrentDN",$this->dn); - $smarty->assign("CurrentDescription",$this->CurrentDescription); - return($smarty->fetch(get_template_path("snapshotdialog.tpl",TRUE,dirname(__FILE__)))); - } - - - function check() - { - $message = plugin::check(); - if(!$this->Restore){ - if(empty($this->CurrentDescription)){ - $message[] = _("Please specify a valid description for this snapshot."); - } - } - return($message); - } - - - function save_object() - { - plugin::save_object(); - foreach($this->attributes as $name){ - if(isset($_POST[$name])){ - $this->$name = stripslashes($_POST[$name]); - } - } - } -} - -?> diff --git a/plugins/admin/systems/snapshotdialog.tpl b/plugins/admin/systems/snapshotdialog.tpl deleted file mode 100755 index c71b07041..000000000 --- a/plugins/admin/systems/snapshotdialog.tpl +++ /dev/null @@ -1,99 +0,0 @@ -{if $RestoreMode} - -

{t}Restoring an object snapshot{/t}

-
-

-{t}This procedure will create a working snapshot of the selected object.{/t} -
-

-

-
- - {if $CountSnapShots!=0} - {t}You will be able to restore from{/t} - {else} - {t}There are no available snapshots.{/t} - {/if} -
-
-

-
- - - - - - - -
- {if $CountSnapShots==0} - {t}There is no snapshot available that could be restored.{/t} - {else} - {t}Choose a snapshot and click continue, to restore the snapshot.{/t} - {/if} -
- -
- -

 

-

-

- -   - -

-{else} - -

{t}Creating an object snapshot{/t}

-
-

-{t}This procedure will create a working snapshot of the selected object.{/t} -
-

-

-
-{t}You will be able to restore from{/t} -
-
-

-
- - - - - - - - - - - - -
- {t}Object{/t} - - {$CurrentDN} -
- {t}Date{/t} - - {$CurrentDate} -
- {t}Description{/t}
- -
- -

 

-

-

- -   - -

-{/if}