commit 459fc0fcca24dc59ad192fc2e675253df812760a
parent c97f3932d94d4fcfff369d92d6192e358fcefcd7
Author: dankert <devnull@localhost>
Date: Sat, 24 Nov 2007 15:17:42 +0100
MimeType in Template ermitteln. Auswahl der Erweiterung ?ber Auswahl-Box.
Diffstat:
5 files changed, 71 insertions(+), 55 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.21 2007-11-24 14:17:42 dankert
+// MimeType in Template ermitteln. Auswahl der Erweiterung ?ber Auswahl-Box.
+//
// Revision 1.20 2007-11-16 22:56:19 dankert
// Dialog-Verbesserung f?r Hinzuf?gen von Element im Template-Quellcode.
//
@@ -183,8 +186,19 @@ class TemplateAction extends Action
//
function savename()
{
- $this->template->name = $this->getRequestVar('name');
- $this->template->save();
+
+ if ($this->getRequestVar('name') == "")
+ {
+ $this->addValidationError('name');
+ $this->callSubAction('name');
+ return;
+ }
+ else
+ {
+ $this->template->name = $this->getRequestVar('name');
+ $this->template->save();
+ $this->addNotice('template',$this->template->name,'SAVED',OR_NOTICE_OK);
+ }
}
@@ -237,7 +251,11 @@ class TemplateAction extends Action
//
function saveextension()
{
- $this->template->extension = $this->getRequestVar('extension');
+ if ( $this->getRequestVar('type') == "list" )
+ $this->template->extension = $this->getRequestVar('extension');
+ else
+ $this->template->extension = $this->getRequestVar('extensiontext');
+
$this->template->save();
$this->addNotice('template',$this->template->name,'SAVED','ok');
}
@@ -421,20 +439,9 @@ class TemplateAction extends Action
*/
function name()
{
- $this->setTemplateVar('name' ,$this->template->name );
-
- // von diesem Template abh?ngige Seiten ermitteln
- //
- $list = array();
- foreach( $this->template->getDependentObjectIds() as $oid )
- {
- $page = new Page( $oid );
- $page->load();
- $list[$oid] = array();
- $list[$oid]['name'] = $page->name;
- $list[$oid]['url' ] = Html::url( 'main','page',$oid );
- }
- $this->setTemplateVar('pages',$list );
+ $this->setTemplateVar('name' ,$this->template->name );
+ $this->setTemplateVar('extension',$this->template->extension );
+ $this->setTemplateVar('mime_type',$this->template->mimeType() );
}
@@ -444,8 +451,21 @@ class TemplateAction extends Action
*/
function extension()
{
- $this->setTemplateVar('extension',$this->template->extension);
-
+
+ global $conf;
+ $mime_types = array();
+ foreach( $conf['mime-types'] as $ext=>$type )
+ $mime_types[$ext] = $ext.' - '.$type;
+
+ $this->setTemplateVar('mime_types',$mime_types);
+
+ $this->setTemplateVar('extension' ,$this->template->extension);
+ $this->setTemplateVar('extensiontext',$this->template->extension);
+
+ if ( isset($mime_types[$this->template->extension]) )
+ $this->setTemplateVar('type','list');
+ else
+ $this->setTemplateVar('type','text');
}
diff --git a/actionClasses/TemplateAction.ini.php b/actionClasses/TemplateAction.ini.php
@@ -49,10 +49,10 @@ menu=prop
target=savename
[savename]
-goto=listing
+goto=name
[saveextension]
-goto=listing
+goto=name
[extension]
menu=prop
diff --git a/themes/default/templates/template/extension.tpl.src.php b/themes/default/templates/template/extension.tpl.src.php
@@ -2,12 +2,20 @@ page
form
window name:GLOBAL_PROP
row
- cell class:fx
+ cell
text text:TEMPLATE_extension
- cell class:fx
- input name:extension size:10
+ cell
+ radio name:type value:list
+ cell
+ selectbox list:mime_types name:extension addempty:true
row
- cell colspan:2
+ cell
+ cell
+ radio name:type value:text
+ cell
+ input name:extensiontext size:10
+ row
+ cell colspan:3 class:act
button type:ok
focus field:extension
\ No newline at end of file
diff --git a/themes/default/templates/template/name.tpl.src.php b/themes/default/templates/template/name.tpl.src.php
@@ -2,40 +2,27 @@ page
form
window name:GLOBAL_PROP
row
- cell class:fx
+ cell
text text:TEMPLATE_NAME
- cell class:fx
+ cell
input name:name
row
cell colspan:2
+ fieldset
+ row
+ cell
+ text text:message:file_extension
+ cell
+ link action:template subaction:extension
+ text text:var:extension
+ row
+ cell
+ text text:message:file_mimetype
+ cell
+ link action:template subaction:extension
+ text text:var:mime_type
+ row
+ cell colspan:2 class:act
button type:ok
-RAW
-<!--
-<tr>
- <th colspan="2"><?php echo lang('GLOBAL_PAGES') ?></th>
-</tr>
-
-<?php $f1=true;
- foreach( $pages as $id=>$p )
- { ?>
-<tr>
-<td class="f1"><a href="<?php echo $p['url'] ?>" target="cms_main"><img src="<?php echo $image_dir.'icon_page'.IMG_EXT ?>" border="0" align="left"><?php echo $p['name'] ?></a></td>
-</tr>
-<?php }
- if ( count($pages)==0)
- { ?>
-<tr>
-<td class="f1"><?php echo lang('GLOBAL_NOT_FOUND') ?></td>
-</tr>
-<?php } ?>
-
-
-</table>
-
-
-</center>
--->
-END
-
focus field:name
\ No newline at end of file
diff --git a/themes/default/templates/template/pages.tpl.src.php b/themes/default/templates/template/pages.tpl.src.php
@@ -3,5 +3,6 @@ page
list list:pages value:name key:pageid
row
cell
+ image icon:page
link action:main subaction:page id:var:pageid target:cms_main
text var:name