commit 17c441c088f829945fc66f7185b68ec13c622e06
parent d758c7bd9a004decc1ceee659f4550b4a618dace
Author: dankert <devnull@localhost>
Date: Wed, 10 Oct 2007 21:08:55 +0200
Beim Hinzuf?gen von Vorlagen das Kopieren einer anderen Vorlage erlauben. Korrektur beim L?schen von Vorlagen.
Diffstat:
8 files changed, 65 insertions(+), 18 deletions(-)
diff --git a/actionClasses/TemplateAction.class.php b/actionClasses/TemplateAction.class.php
@@ -20,6 +20,9 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// ---------------------------------------------------------------------------
// $Log$
+// Revision 1.16 2007-10-10 19:08:55 dankert
+// Beim Hinzuf?gen von Vorlagen das Kopieren einer anderen Vorlage erlauben. Korrektur beim L?schen von Vorlagen.
+//
// Revision 1.15 2007-05-21 20:04:10 dankert
// Korrektur f?r Anzeige des Vorlagen-Quelltextes.
//
@@ -175,6 +178,10 @@ class TemplateAction extends Action
{
$this->template->delete();
}
+ else
+ {
+ $this->addNotice('template',$this->template->name,'CANCELED',OR_NOTICE_WARN);
+ }
}
@@ -183,6 +190,7 @@ class TemplateAction extends Action
*/
function remove()
{
+ $this->setTemplateVar('name',$this->template->name);
}
@@ -192,6 +200,7 @@ class TemplateAction extends Action
{
$this->template->extension = $this->getRequestVar('extension');
$this->template->save();
+ $this->addNotice('template',$this->template->name,'SAVED','ok');
}
@@ -224,26 +233,49 @@ class TemplateAction extends Action
}
$this->setTemplateVar('tree_refresh',true);
+ $this->addNotice('template',$this->template->name,'SAVED','ok');
}
+ /**
+ * Vorlage hinzufügen.
+ */
function add()
{
+ $this->setTemplateVar( 'templates',Template::getAll() );
}
function addtemplate()
{
- // Hinzuf?gen eines Templates
+ // Hinzufuegen eines Templates
if ( $this->getRequestVar('name') != '' )
{
- Template::add( $this->getRequestVar('name') );
+
+ $template = new Template();
+ $template->add( $this->getRequestVar('name') );
+ $this->addNotice('template',$template->name,'ADDED','ok');
+
+ $copy_templateid = intval($this->getRequestVar('templateid') );
+
+ if ( $copy_templateid > 0 )
+ {
+ $copy_template = new Template( $copy_templateid );
+ $copy_template->load();
+ foreach( $copy_template->getElements() as $element )
+ {
+ $element->load();
+ $element->templateid = $template->templateid;
+ $element->add();
+ $element->save();
+ }
+
+ $this->addNotice('template',$copy_template->name,'COPIED','ok');
+ }
}
$this->setTemplateVar('tree_refresh',true);
-
- $this->callSubAction('listing');
}
diff --git a/actionClasses/TemplateAction.ini.php b/actionClasses/TemplateAction.ini.php
@@ -62,7 +62,7 @@ menu=prop
target=delete
[delete]
-goto=name
+goto=listing
[menu]
listing=listing,add
diff --git a/language/de.ini.php b/language/de.ini.php
@@ -722,6 +722,7 @@ NOTICE_CANNOT_COPY_FOLDER ="Ordner können nicht kopiert werden (nicht implementi
NOTICE_COPIED = "wurde kopiert"
NOTICE_DELETED ="wurde gelöscht"
NOTICE_ERROR = "Bei der Aktion trat ein Fehler auf"
+NOTICE_CANCELED = "Vorgang wurde abgebrochen"
NOTICE_IMAGE_RESIZED = "Das Bild wurde geändert"
NOTICE_IMPORTED ="Datei wurde importiert"
NOTICE_LINKED ="Verknüpfung angelegt"
@@ -891,4 +892,5 @@ MENU_HELP_DESC=Onlinehilfe
MENU_FOLDER_CREATE=Neu
MENU_FOLDER_CREATE_DESC=Hinzufügen von Verzeichnis, Seite, Datei oder Verknüpfung
MENU_PROFILE_GROUPS=Gruppen
-MENU_PROFILE_GROUPS_DESC=Mitgliedschaft in Gruppen-
\ No newline at end of file
+MENU_PROFILE_GROUPS_DESC=Mitgliedschaft in Gruppen
+LIST_ENTRY_EMPTY="Nicht ausgewählt"+
\ No newline at end of file
diff --git a/objectClasses/Template.class.php b/objectClasses/Template.class.php
@@ -20,6 +20,9 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// ---------------------------------------------------------------------------
// $Log$
+// Revision 1.13 2007-10-10 19:08:55 dankert
+// Beim Hinzuf?gen von Vorlagen das Kopieren einer anderen Vorlage erlauben. Korrektur beim L?schen von Vorlagen.
+//
// Revision 1.12 2006-01-29 17:27:27 dankert
// Methode addElement() mit 2 weiteren Parametern
//
@@ -118,8 +121,8 @@ class Template
/**
- * Ermitteln aller Templates in dem aktuellen Projekt
- * @return Array
+ * Ermitteln aller Templates in dem aktuellen Projekt.
+ * @return Array mit Id:Name
*/
function getAll()
{
diff --git a/themes/default/include/elements.ini.php b/themes/default/include/elements.ini.php
@@ -33,7 +33,7 @@ password = name:*,default:,class:,size:40,maxlength:256
radio = readonly:false,name:*,value,default:false,prefix:,suffix:,class:,onchange:
raw =
row = class
-selectbox= list:*,name:*,default,onchange:,title:,class:
+selectbox= list:*,name:*,default,onchange:,title:,class:,addempty:false
radiobox = list:*,name:*,default,onchange:,title:,class:
set = var:*,value,key
table = class,width:100%,space:0px,padding:0px,widths,rowclasses:oddCOMMAeven,columnclasses
diff --git a/themes/default/include/html/selectbox.inc.php b/themes/default/include/html/selectbox.inc.php
@@ -1,4 +1,6 @@
-<select size="1" id="id_<?php echo $attr_name ?>" name="<?php echo $attr_name ?>" onchange="<?php echo $attr_onchange ?>" title="<?php echo $attr_title ?>" class="<?php echo $attr_class ?>"<?php
+<?php
+if ($attr_addempty) $$attr_list = array(''=>lang('LIST_ENTRY_EMPTY'))+$$attr_list;
+?><select size="1" id="id_<?php echo $attr_name ?>" name="<?php echo $attr_name ?>" onchange="<?php echo $attr_onchange ?>" title="<?php echo $attr_title ?>" class="<?php echo $attr_class ?>"<?php
if (count($$attr_list)==1) echo ' disabled="disabled"'
?>><?php
$attr_tmp_list = $$attr_list;
diff --git a/themes/default/templates/template/add.tpl.src.php b/themes/default/templates/template/add.tpl.src.php
@@ -3,8 +3,17 @@ page
window name:GLOBAL_TEMPLATES
row
- cell class:act
- input name:name
+ cell
+ text text:message:name
+ cell
+ input name:name
+ row
+ cell
+ text text:message:copy
+ cell
+ selectbox name:templateid list:templates addempty:true
+ row
+ cell colspan:2 class:act
button type:ok
focus field:name
\ No newline at end of file
diff --git a/themes/default/templates/template/remove.tpl.src.php b/themes/default/templates/template/remove.tpl.src.php
@@ -8,13 +8,12 @@ page
cell class:fx
text var:name
row
- cell
- text text:GLOBAL_DELETE
- cell
+ cell colspan:2
checkbox name:delete
-
+ label for:delete
+ text text:GLOBAL_DELETE
row
- cell colspan:2
+ cell colspan:2 class:act
button type:ok
focus field:delete