commit 680dab083b10b4461ea5efe55a0730fceff161b7
parent 019f398abc5e7c8a5ed18cd4528493e2ce8ef620
Author: dankert <devnull@localhost>
Date: Tue, 8 May 2007 23:16:20 +0200
Korrektur und Erweiterung von Hinzuf?gen/Bearbeiten von Sprachen.
Diffstat:
9 files changed, 127 insertions(+), 123 deletions(-)
diff --git a/actionClasses/LanguageAction.class.php b/actionClasses/LanguageAction.class.php
@@ -20,7 +20,10 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// ---------------------------------------------------------------------------
// $Log$
-// Revision 1.9 2007-01-21 22:26:45 dankert
+// Revision 1.10 2007-05-08 21:16:20 dankert
+// Korrektur und Erweiterung von Hinzuf?gen/Bearbeiten von Sprachen.
+//
+// Revision 1.9 2007/01/21 22:26:45 dankert
// Korreketur beim Hinzuf?gen/Entfernen von Sprachen.
//
// Revision 1.8 2006/01/29 17:18:59 dankert
@@ -88,6 +91,22 @@ class LanguageAction extends Action
*/
function add()
{
+ global $conf;
+ $countryList = $conf['countries'];
+
+ foreach( $this->project->getLanguageIds() as $id )
+ {
+ if ( $id == $this->language->languageid )
+ continue;
+
+ $l = new Language( $id );
+ $l->load();
+
+ unset( $countryList[$l->isoCode] );
+ }
+
+ asort( $countryList );
+ $this->setTemplateVar('isocodes' ,$countryList );
}
@@ -123,6 +142,7 @@ class LanguageAction extends Action
*/
function remove()
{
+ $this->setTemplateVar('name' ,$this->language->name );
}
@@ -142,14 +162,21 @@ class LanguageAction extends Action
function save()
{
global $conf;
- $countryList = $conf['countries'];
- $iso = $this->getRequestVar('isocode');
- $this->language->isoCode = strtolower( $iso );
- $this->language->name = $countryList[$iso];
+ if ( $this->hasRequestVar('name') )
+ {
+ $this->language->name = $this->getRequestVar('name' );
+ $this->language->isoCode = $this->getRequestVar('isocode');
+ }
+ else
+ {
+ $countryList = $conf['countries'];
+ $iso = $this->getRequestVar('isocode');
+ $this->language->name = $countryList[$iso];
+ $this->language->isoCode = strtolower( $iso );
+ }
+
$this->language->save();
-
- $this->callSubAction( 'listing' );
}
@@ -172,7 +199,8 @@ class LanguageAction extends Action
unset( $countryList[strtoupper($l->isoCode)] );
$list[$id] = array();
- $list[$id]['name'] = $l->name;
+ $list[$id]['name' ] = $l->name;
+ $list[$id]['isocode'] = $l->isoCode;
if ( $this->userIsAdmin() )
{
@@ -205,11 +233,6 @@ class LanguageAction extends Action
global $conf;
$countryList = $conf['countries'];
- if ( count($this->language->getAll()) >= 2 )
- $this->setTemplateVar('delete',true );
- else
- $this->setTemplateVar('delete',false);
-
foreach( $this->project->getLanguageIds() as $id )
{
if ( $id == $this->language->languageid )
@@ -222,10 +245,40 @@ class LanguageAction extends Action
}
asort( $countryList );
- $this->setTemplateVar('isocodes' ,$countryList );
- $this->setTemplateVar('languageid' ,$this->language->languageid);
- $this->setTemplateVar('act_isocode',$this->language->isoCode );
+ $this->setTemplateVar('isocodes' ,$countryList );
+ $this->setTemplateVar('isocode' ,strtoupper($this->language->isoCode) );
+ }
+
+
+
+ function advanced()
+ {
+ $this->setTemplateVar('isocode',$this->language->isoCode);
+ $this->setTemplateVar('name' ,$this->language->name );
+ }
+
+
+
+
- $this->forward('language_edit');
+ function checkmenu( $menu )
+ {
+ switch( $menu )
+ {
+ case 'remove':
+ $actLanguage = Session::getProjectLanguage();
+ return
+ $this->userIsAdmin() &&
+ count( $this->language->getAll() ) >= 2 &&
+ isset($this->language) &&
+ $actLanguage->languageid != $this->language->languageid;
+
+ case 'add':
+ return
+ $this->userIsAdmin();
+
+ default:
+ return true;
+ }
}
}
\ No newline at end of file
diff --git a/actionClasses/LanguageAction.ini.php b/actionClasses/LanguageAction.ini.php
@@ -1,17 +1,18 @@
[setdefault]
-target=listing
+goto=listing
[listing]
menu=listing
-[default]
-goto=listing
-
[edit]
menu=edit
target=save
+[advanced]
+menu=edit
+target=save
+
[add]
menu=listing
target=addlanguage
@@ -24,14 +25,11 @@ target=delete
goto=listing
[save]
-goto=edit
+goto=listing
[addlanguage]
goto=listing
-[add]
-target=addlanguage
-
[menu]
listing=listing,add
-edit=edit,remove-
\ No newline at end of file
+edit=edit,advanced,remove+
\ No newline at end of file
diff --git a/themes/default/templates/language/add.tpl.src.php b/themes/default/templates/language/add.tpl.src.php
@@ -3,8 +3,10 @@ page
window icon:project name:GLOBAL_PROJECTS
row
+ cell
+ text text:LANGUAGE_ISOCODE
cell class:fx
- input name:name
+ selectbox list:isocodes name:isocode
row
- cell class:act
+ cell class:act colspan:2
button type:ok
\ No newline at end of file
diff --git a/themes/default/templates/language/advanced.tpl.src.php b/themes/default/templates/language/advanced.tpl.src.php
@@ -0,0 +1,19 @@
+page
+ form method:post
+
+ window icon:group name:GLOBAL_GROUPS
+ row
+ cell
+ text text:GLOBAL_NAME
+ cell class:fx
+ input name:name
+ row
+ cell
+ text text:LANGUAGE_ISOCODE
+ cell class:fx
+ input name:isocode
+ row
+ cell colspan:2
+ button type:ok
+ focus field:name
+
diff --git a/themes/default/templates/language/edit.tpl.php b/themes/default/templates/language/edit.tpl.php
@@ -1,41 +0,0 @@
-<?php include( $tpl_dir.'header.tpl.php') ?>
-
-<!-- $Id$ -->
-
-<center>
-
-<?php echo Html::form('language','save',$languageid) ?>
-
-<table class="main" width="90%" cellspacing="0" cellpadding="4">
-
-<tr>
- <th colspan="2"><?php echo lang('GLOBAL_LANGUAGE') ?></a></th>
-</tr>
-
-<tr>
-<td width="50%" class="f1"><?php echo lang('GLOBAL_LANGUAGE') ?></a></td>
-<td width="50%" class="f2"><?php echo Html::selectBox('isocode',$isocodes,strtoupper($act_isocode)) ?></td>
-</tr>
-
-<?php if ( $delete )
- { ?>
-<tr>
-<td width="50%" class="f2" rowspan="2"><?php echo lang('GLOBAL_DELETE') ?></a></td>
-<td width="50%" class="f2"><input type="checkbox" name="delete" value="1"></td>
-</tr>
-<tr>
-<td class="help"><?php echo lang('HELP_LANGUAGE_DELETE') ?></td>
-<?php } ?>
-</tr>
-
-<tr>
-<td colspan="2" class="act"><input type="submit" class="submit" value="<?php echo lang('GLOBAL_SAVE') ?>"></a></td>
-</tr>
-</table>
-
-</form>
-</center>
-
-<?php Html::focusField('name') ?>
-
-<?php include( $tpl_dir.'footer.tpl.php') ?>-
\ No newline at end of file
diff --git a/themes/default/templates/language/edit.tpl.src.php b/themes/default/templates/language/edit.tpl.src.php
@@ -4,9 +4,9 @@ page
window icon:group name:GLOBAL_GROUPS
row
cell
- text text:GLOBAL_NAME
+ text text:GLOBAL_LANGUAGE
cell class:fx
- input name:name
+ selectbox list:isocodes name:isocode
row
cell colspan:2
button type:ok
diff --git a/themes/default/templates/language/list.tpl.php b/themes/default/templates/language/list.tpl.php
@@ -1,45 +0,0 @@
-<?php include( $tpl_dir.'header.tpl.php') ?>
-
-<!-- $Id$ -->
-<center>
-
-<?php echo Html::form('language','add') ?>
-
-<table class="main" width="60%" cellspacing="0" cellpadding="4">
-<tr>
- <th colspan="3"><?php echo lang('GLOBAL_LANGUAGES') ?></th>
-</tr>
-
-<?php $f1=true;
- foreach( $el as $id=>$e )
- { ?>
-<tr>
-<?php if ( isset($e['url']))
- { ?>
-<td width="50%" class="<?php if($f1==true) {echo'f1'; } else{echo'f2'; }?>"><a href="<?php echo $e['url'] ?>"><img src="<?php echo $image_dir.'icon_lang'.IMG_EXT ?>" align="left" border="0" /><?php echo $e['name'] ?></a></td>
-<td width="25%" class="<?php if($f1==true) {echo'f1';$f1=false;} else{echo'f2';$f1=true;}?>"><?php if (!isset($e['default_url'])) echo '<strong>'.lang('GLOBAL_default').'</strong>'; else echo '<a href="'.$e['default_url'].'" target="_self">'.lang('GLOBAL_make_default').'</a>' ?></td>
-<?php }
- else
- { ?>
-<td width="50%" class="<?php if($f1==true) {echo'f1'; } else{echo'f2'; }?>"><img src="<?php echo $image_dir.'icon_lang.png' ?>" align="left"/><?php echo $e['name'] ?></td>
-<td width="25%" class="<?php if($f1==true) {echo'f1';$f1=false;} else{echo'f2';$f1=true;}?>"> </td>
-<?php } ?>
-<td width="25%" class="<?php if($f1==true) {echo'f1';$f1=false;} else{echo'f2';$f1=true;}?>"><?php if (!isset($e['select_url' ])) echo '<strong>'.lang('GLOBAL_selected').'</strong>'; else echo '<a href="'.$e['select_url'].'" target="_top">'.lang('GLOBAL_select').'</a>' ?></td>
-</tr>
-<?php } ?>
-
-<?php if (isset($isocodes))
- { ?>
-<tr>
-<td colspan="3" class="act"><?php echo Html::selectBox( 'isocode',$isocodes ) ?>
-<input type="submit" class="submit" value="<?php echo lang('GLOBAL_ADD') ?>"></td>
-</tr>
-<?php } ?>
-
-</table>
-
-</form>
-
-</center>
-
-<?php include( $tpl_dir.'footer.tpl.php') ?>-
\ No newline at end of file
diff --git a/themes/default/templates/language/listing.tpl.src.php b/themes/default/templates/language/listing.tpl.src.php
@@ -1,8 +1,27 @@
page
- window icon:group name:GLOBAL_GROUPS
+ window icon:language
list list:el extract:true
row
cell class:fx
link url:var:url target:cms_main
- image file:icon_group
+ image file:icon_language
text var:name
+
+ cell class:fx
+ text var:isocode
+
+ cell class:fx
+ if present:default_url
+ link url:var:default_url target:cms_main_main
+ text text:GLOBAL_make_default
+ else
+ text text:GLOBAL_is_default
+ cell class:fx
+ if present:select_url
+ link url:var:select_url target:config:interface/frames/top
+ text text:GLOBAL_select
+ else
+ text text:GLOBAL_selected
+ set var:select_url
+ set var:default_url
+ +
\ No newline at end of file
diff --git a/themes/default/templates/language/remove.tpl.src.php b/themes/default/templates/language/remove.tpl.src.php
@@ -6,12 +6,12 @@ page
cell
text text:GLOBAL_NAME
cell class:fx
- text var:name
+ text text:var:name
row
cell
text text:GLOBAL_DELETE
cell
- checkbox name:delete
+ checkbox name:confirm
row
cell colspan:2 class:help
text text:GROUP_DELETE_DESC