commit 002676dcbb5407fd5eacb625491ac7389070ff61
parent ef25921b110891e8ef11536cb55be11f30005848
Author: dankert <devnull@localhost>
Date: Tue, 15 Sep 2009 00:55:38 +0200
Neuer Dialog zum Speichern von Benutzereinstellungen in Cookies
Diffstat:
6 files changed, 306 insertions(+), 12 deletions(-)
diff --git a/actionClasses/ProfileAction.class.php b/actionClasses/ProfileAction.class.php
@@ -60,7 +60,38 @@ class ProfileAction extends Action
}
}
+
+
+ function settings()
+ {
+ foreach( array('always_edit') as $name )
+ $this->setTemplateVar($name,isset($_COOKIE['or_'.$name]));
+ }
+
+
+ function savesettings()
+ {
+ foreach( array('always_edit') as $name )
+ {
+ if ( $this->hasRequestVar($name))
+ {
+ // Cookie setzen
+ setcookie('or_'.$name,'1');
+ $_COOKIE['or_'.$name] = '1';
+ }
+ else
+ {
+ // Cookie löschen
+ setcookie('or_'.$name,'', time()-3600);
+ unset($_COOKIE['or_'.$name]);
+ }
+ }
+
+ $this->addNotice('user',$this->user->name,'SAVED','ok');
+ }
+
+
function pwchange()
{
}
@@ -81,7 +112,7 @@ class ProfileAction extends Action
if ( empty($newMail) )
{
- // Bestätigungscode stimmt nicht.
+ // Best�tigungscode stimmt nicht.
$this->addValidationError('mail');
return;
}
@@ -124,8 +155,8 @@ class ProfileAction extends Action
if ( $sessionCode == $inputRegisterCode )
{
- // Bestätigungscode stimmt überein.
- // E-Mail-Adresse ändern.
+ // Best�tigungscode stimmt �berein.
+ // E-Mail-Adresse �ndern.
$this->user->mail = $newMail;
$this->user->save();
@@ -133,7 +164,7 @@ class ProfileAction extends Action
}
else
{
- // Bestätigungscode stimmt nicht.
+ // Best�tigungscode stimmt nicht.
$this->addValidationError('code','code_not_match');
$this->callSubAction('confirmmail');
}
@@ -189,7 +220,7 @@ class ProfileAction extends Action
/**
- * @param String $name Menüpunkt
+ * @param String $name Men�punkt
* @return boolean
*/
function checkMenu( $name )
@@ -198,7 +229,9 @@ class ProfileAction extends Action
switch( $name )
{
- case 'pwchange':
+ case 'pwchange':
+ // Die Funktion "Kennwort setzen" ist nur aktiv, wenn als Authentifizierungs-Backend
+ // auch die interne Benutzerdatenbank eingesetzt wird.
return @$conf['security']['auth']['type'] == 'database'
&& !@$conf['security']['auth']['userdn'];
diff --git a/actionClasses/ProfileAction.ini.php b/actionClasses/ProfileAction.ini.php
@@ -34,5 +34,12 @@ goto=edit
[saveprofile]
goto=edit
+[settings]
+menu=edit
+target=savesettings
+
+[savesettings]
+goto=settings
+
[menu]
-edit=edit,pwchange,mail,groups-
\ No newline at end of file
+edit=edit,settings,pwchange,mail,groups+
\ No newline at end of file
diff --git a/language/de.ini.php b/language/de.ini.php
@@ -1025,4 +1025,7 @@ MENU_TITLE_FILE_RIGHTS="Datei-Berechtigungen"
INHERIT_RIGHTS = "Berechtigungen in allen untergeordneten Objekten zurücksetzen und die vererbbaren Berechtigungen dieses Ordners dort anwenden."
CONTENT = "Inhalt"
EDITOR = "Editor"
-EDITOR_SHOW_LANGUAGE = "Sprache anzeigen"-
\ No newline at end of file
+EDITOR_SHOW_LANGUAGE = "Sprache anzeigen"
+MENU_PROFILE_SETTINGS = "Einstellungen"
+MENU_PROFILE_SETTINGS_DESC = "Verändern Ihrer Benutzereinstellungen"
+SETTING_ALWAYS_EDIT = "Falls möglich, ein Formular sofort zum Bearbeiten öffnen"
diff --git a/language/en.ini.php b/language/en.ini.php
@@ -1025,4 +1025,7 @@ INHERIT_RIGHTS = "Reset rights in all Sub-objects and inherit the inheritable ri
NOTICE_GROUPS_MAY_CONFLICT_WITH_LDAP="The user-group-relations my conflict with the directory service. Memberships were synchronized at login time."
NOTICE_CONCURRENT_VALUE_CHANGE="While your edit session another user has changed this content at {last_change_time}. Your changes where saved, but you should check the archive if the overwritten content should be merged."
NOTICE_CONCURRENT_VALUE_CHANGE_NOT_SAVED="While your edit session another user has changed this content at {last_change_time}. Your changes where not saved."
-NOTICE_CODE_DISABLED = "The dynamic code will not be executed in the actual environment."-
\ No newline at end of file
+NOTICE_CODE_DISABLED = "The dynamic code will not be executed in the actual environment."
+MENU_PROFILE_SETTINGS = "Settings"
+MENU_PROFILE_SETTINGS_DESC = "Edit your user settings"
+SETTING_ALWAYS_EDIT = "If possible, open every form in edit mode"
diff --git a/themes/default/pages/html/profile/settings.tpl.php b/themes/default/pages/html/profile/settings.tpl.php
@@ -0,0 +1,236 @@
+<?php $attr1_class='main'; ?><?php
+ if (!headers_sent()) header('Content-Type: text/html; charset='.$charset)
+?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+ <title><?php echo isset($attr1_title)?$attr1_title.' - ':(isset($windowTitle)?lang($windowTitle).' - ':'') ?><?php echo $cms_title ?></title>
+ <meta http-equiv="content-type" content="text/html; charset=<?php echo $charset ?>" >
+ <meta name="MSSmartTagsPreventParsing" content="true" >
+ <meta name="robots" content="noindex,nofollow" >
+<?php if (isset($windowMenu) && is_array($windowMenu)) foreach( $windowMenu as $menu )
+ {
+ ?>
+ <link rel="section" href="<?php echo Html::url($actionName,@$menu['subaction'],$this->getRequestId() ) ?>" title="<?php echo lang($menu['text']) ?>" >
+<?php
+ }
+?><?php if (isset($metaList) && is_array($metaList)) foreach( $metaList as $meta )
+ {
+ ?>
+ <link rel="<?php echo $meta['name'] ?>" href="<?php echo $meta['url'] ?>" title="<?php echo lang($meta['title']) ?>" ><?php
+ }
+?><?php if(!empty($root_stylesheet)) { ?>
+ <link rel="stylesheet" type="text/css" href="<?php echo $root_stylesheet ?>" >
+<?php } ?>
+<?php if($root_stylesheet!=$user_stylesheet) { ?>
+ <link rel="stylesheet" type="text/css" href="<?php echo $user_stylesheet ?>" >
+<?php } ?>
+</head>
+<body class="<?php echo $attr1_class ?>" <?php if (@$conf['interface']['application_mode']) { ?> style="padding:0px;margin:0px;"<?php } ?> >
+<?php /* Debug-Information */ if ($showDuration) { echo "<!--\n";print_r($this->templateVars);echo "\n-->";} ?><?php unset($attr1_class); ?><?php $attr2_name=''; $attr2_target='_self'; $attr2_method='post'; $attr2_enctype='application/x-www-form-urlencoded'; ?><?php
+ $attr2_action = $actionName;
+ $attr2_subaction = $targetSubActionName;
+ $attr2_id = $this->getRequestId();
+ if ($this->isEditable() && !$this->isEditMode())
+ $attr2_subaction = $subActionName;
+?><form name="<?php echo $attr2_name ?>"
+ target="<?php echo $attr2_target ?>"
+ action="<?php echo Html::url( $attr2_action,$attr2_subaction,$attr2_id ) ?>"
+ method="<?php echo $attr2_method ?>"
+ enctype="<?php echo $attr2_enctype ?>" style="margin:0px;padding:0px;">
+<?php if ($this->isEditable() && !$this->isEditMode()) { ?>
+<input type="hidden" name="mode" value="edit" />
+<?php } ?>
+<input type="hidden" name="<?php echo REQ_PARAM_ACTION ?>" value="<?php echo $attr2_action ?>" />
+<input type="hidden" name="<?php echo REQ_PARAM_SUBACTION ?>" value="<?php echo $attr2_subaction ?>" />
+<input type="hidden" name="<?php echo REQ_PARAM_ID ?>" value="<?php echo $attr2_id ?>" /><?php
+ if ( $conf['interface']['url_sessionid'] )
+ echo '<input type="hidden" name="'.session_name().'" value="'.session_id().'" />'."\n";
+?><?php unset($attr2_name);unset($attr2_target);unset($attr2_method);unset($attr2_enctype); ?><?php $attr3_width='93%'; $attr3_rowclasses='odd,even'; $attr3_columnclasses='1,2,3'; ?><?php
+ $coloumn_widths=array();
+ if (!empty($attr3_widths))
+ {
+ $column_widths = explode(',',$attr3_widths);
+ unset($attr3['widths']);
+ }
+ if (!empty($attr3_rowclasses))
+ {
+ $row_classes = explode(',',$attr3_rowclasses);
+ $row_class_idx = 999;
+ unset($attr3['rowclasses']);
+ }
+ if (!empty($attr3_columnclasses))
+ {
+ $column_classes = explode(',',$attr3_columnclasses);
+ unset($attr3['columnclasses']);
+ }
+ global $image_dir;
+ if (@$conf['interface']['application_mode'] )
+ {
+ echo '<table class="main" cellspacing="0" cellpadding="4" width="100%" style="margin:0px;border:0px; padding:0px;" height_oo="100%">';
+ }
+ else
+ {
+ echo '<br/><br/><br/><center>';
+ echo '<table class="main" cellspacing="0" cellpadding="4" width="'.$attr3_width.'">';
+ }
+ if (!@$conf['interface']['application_mode'] )
+ {
+ echo '<tr><td class="menu">';
+ echo '<img src="'.$image_dir.'icon_'.$actionName.IMG_ICON_EXT.'" align="left" border="0">';
+ if ($this->isEditable()) { ?>
+ <?php if ($this->isEditMode()) {
+ ?><a href="<?php echo Html::url($actionName,$subActionName,$this->getRequestId() ) ?>" accesskey="1" title="<?php echo langHtml('MODE_EDIT_DESC') ?>" class="path" style="text-align:right;font-weight:bold;font-weight:bold;"><img src="<?php echo $image_dir ?>mode-edit.png" style="vertical-align:top; " border="0" /></a> <?php } else {
+ ?><a href="<?php echo Html::url($actionName,$subActionName,$this->getRequestId(),array('mode'=>'edit') ) ?>" accesskey="1" title="<?php echo langHtml('MODE_SHOW_DESC') ?>" class="path" style="text-align:right;font-weight:bold;font-weight:bold;"><img src="<?php echo $image_dir ?>readonly.png" style="vertical-align:top; " border="0" /></a> <?php }
+ ?><?php }
+ echo '<span class="path">'.langHtml('GLOBAL_'.$actionName).'</span> <strong>»</strong> ';
+ if ( !isset($path) || is_array($path) )
+ $path = array();
+ foreach( $path as $pathElement)
+ {
+ extract($pathElement);
+ echo '<a href="'.$url.'" class="path">'.langHtml($name).'</a>';
+ echo ' » ';
+ }
+ echo '<span class="title">'.langHtml($windowTitle).'</span>';
+ ?>
+ </td>
+ <?php
+ }
+ ?>
+<?php ?> <!--<td class="menu" style="align:right;">
+ <?php if (isset($windowIcons)) foreach( $windowIcons as $icon )
+ {
+ ?><a href="<?php echo $icon['url'] ?>" title="<?php echo 'ICON_'.langHtml($menu['type'].'_DESC') ?>"><image border="0" src="<?php echo $image_dir.$icon['type'].IMG_ICON_EXT ?>"></a> <?php
+ }
+ ?>
+ </td>-->
+ </tr>
+ <tr><td class="subaction">
+ <?php if ( !isset($windowMenu) || !is_array($windowMenu) )
+ $windowMenu = array();
+ foreach( $windowMenu as $menu )
+ {
+ $tmp_text = langHtml($menu['text']);
+ $tmp_key = strtoupper(langHtml($menu['key' ]));
+ $tmp_pos = strpos(strtolower($tmp_text),strtolower($tmp_key));
+ if ( $tmp_pos !== false )
+ $tmp_text = substr($tmp_text,0,max($tmp_pos,0)).'<span class="accesskey">'. substr($tmp_text,$tmp_pos,1).'</span>'.substr($tmp_text,$tmp_pos+1);
+ if ( isset($menu['url']) )
+ {
+ ?><a href="<?php echo Html::url($actionName,$menu['subaction'],$this->getRequestId() ) ?>" accesskey="<?php echo $tmp_key ?>" title="<?php echo langHtml($menu['text'].'_DESC') ?>" class="menu<?php echo $this->subActionName==$menu['subaction']?'_highlight':'' ?>"><?php echo $tmp_text ?></a> <?php
+ }
+ else
+ {
+ ?><span class="menu_disabled" title="<?php echo langHtml($menu['text'].'_DESC') ?>" class="menu_disabled"><?php echo $tmp_text ?></span> <?php
+ }
+ }
+ if (@$conf['help']['enabled'] )
+ {
+ ?><a href="<?php echo $conf['help']['url'].$actionName.'/'.$subActionName.@$conf['help']['suffix'] ?> " target="_new" title="<?php echo langHtml('MENU_HELP_DESC') ?>" class="menu" style="cursor:help;"><?php echo @$conf['help']['only_question_mark']?'?':langHtml('MENU_HELP') ?></a><?php
+ }
+ ?></td>
+ </tr>
+<?php if (isset($notices) && count($notices)>0 )
+ { ?>
+ <tr>
+ <td align="center" class="notice">
+ <?php foreach( $notices as $notice_idx=>$notice ) { ?>
+ <br><table class="notice" width="80%">
+ <?php if ($notice['name']!='') { ?>
+ <tr>
+ <th colspan="2"><img src="<?php echo $image_dir.'icon_'.$notice['type'].IMG_ICON_EXT ?>" align="left" /><?php echo $notice['name'] ?>
+ </th>
+ </tr>
+<?php } ?>
+ <tr class="<?php echo $notice['status'] ?>">
+ <td style="padding:10px;" width="30px"><img src="<?php echo $image_dir.'notice_'.$notice['status'].IMG_ICON_EXT ?>" style="padding:10px" /></td>
+ <td style="padding:10px;padding-right:10px;padding-bottom:10px;"><?php if ($notice['status']=='error') { ?><strong><?php } ?><?php echo langHtml($notice['key'],$notice['vars']) ?><?php if ($notice['status']=='error') { ?></strong><?php } ?>
+ <?php if (!empty($notice['log'])) { ?><pre><?php echo htmlentities(implode("\n",$notice['log'])) ?></pre><?php } ?>
+ </td>
+ </tr>
+ </table>
+ <?php } ?>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2"><fieldset></fieldset></td>
+ </tr>
+<?php } ?>
+ <tr>
+ <td>
+ <table cellspacing="0" width="100%" cellpadding="4">
+<?php unset($attr3_width);unset($attr3_rowclasses);unset($attr3_columnclasses); ?><?php ?><?php
+ $attr4_tmp_class='';
+ $attr4_last_class = $attr4_tmp_class;
+ echo Html::open_tag('tr',array('class'=>$attr4_tmp_class));
+?><?php ?><?php ?><?php
+ $column_class_idx++;
+ if ($column_class_idx > count($column_classes))
+ $column_class_idx=1;
+ $column_class=$column_classes[$column_class_idx-1];
+ if (empty($attr5_class))
+ $attr5_class=$column_class;
+ global $cell_column_nr;
+ $cell_column_nr++;
+ if ( isset($column_widths[$cell_column_nr-1]) && !isset($attr5_rowspan) )
+ $attr5_width=$column_widths[$cell_column_nr-1];
+?><td<?php
+?>><?php ?><?php $attr6_default=false; $attr6_readonly=false; $attr6_name='always_edit'; ?><?php
+ if ($this->isEditable() && !$this->isEditMode()) $attr6_readonly=true;
+ if ( isset($$attr6_name) )
+ $checked = $$attr6_name;
+ else
+ $checked = $attr6_default;
+?><input class="checkbox" type="checkbox" id="id_<?php echo $attr6_name ?>" name="<?php echo $attr6_name ?>" <?php if ($attr6_readonly) echo ' disabled="disabled"' ?> value="1" <?php if( $checked ) echo 'checked="checked"' ?><?php if (in_array($attr6_name,$errors)) echo ' style="background-color:red;"' ?> /><?php
+if ( $attr6_readonly && $checked )
+{
+?><input type="hidden" name="<?php echo $attr6_name ?>" value="1" /><?php
+}
+?><?php unset($attr6_name); unset($attr6_readonly); unset($attr6_default); ?><?php unset($attr6_default);unset($attr6_readonly);unset($attr6_name); ?><?php $attr6_for='always_edit'; ?><label for="id_<?php echo $attr6_for ?><?php if (!empty($attr6_value)) echo '_'.$attr6_value ?>"><?php unset($attr6_for); ?><?php $attr7_class='text'; $attr7_key='setting_always_edit'; $attr7_escape=true; ?><?php
+ $attr7_title = '';
+ $tmp_tag = 'span';
+?><<?php echo $tmp_tag ?> class="<?php echo $attr7_class ?>" title="<?php echo $attr7_title ?>"><?php
+ $langF = $attr7_escape?'langHtml':'lang';
+ $tmp_text = $langF($attr7_key);
+ $tmp_text = nl2br($tmp_text);
+ echo $tmp_text;
+ unset($tmp_text);
+?></<?php echo $tmp_tag ?>><?php unset($attr7_class);unset($attr7_key);unset($attr7_escape); ?><?php ?></label><?php ?><?php ?></td><?php ?><?php ?></tr><?php ?><?php ?><?php
+ $attr4_tmp_class='';
+ $attr4_last_class = $attr4_tmp_class;
+ echo Html::open_tag('tr',array('class'=>$attr4_tmp_class));
+?><?php ?><?php $attr5_class='act'; $attr5_colspan='2'; ?><?php
+ $column_class_idx++;
+ if ($column_class_idx > count($column_classes))
+ $column_class_idx=1;
+ $column_class=$column_classes[$column_class_idx-1];
+ if (empty($attr5_class))
+ $attr5_class=$column_class;
+ global $cell_column_nr;
+ $cell_column_nr++;
+ if ( isset($column_widths[$cell_column_nr-1]) && !isset($attr5_rowspan) )
+ $attr5_width=$column_widths[$cell_column_nr-1];
+?><td<?php
+?> class="<?php echo $attr5_class ?>" <?php
+?> colspan="<?php echo $attr5_colspan ?>" <?php
+?>><?php unset($attr5_class);unset($attr5_colspan); ?><?php $attr6_type='ok'; $attr6_class='ok'; $attr6_value='ok'; $attr6_text='button_ok'; ?><?php
+ if ($this->isEditable() && !$this->isEditMode())
+ $attr6_text = 'MODE_EDIT';
+ $attr6_type = 'submit';
+ $attr6_src = '';
+?><input type="<?php echo $attr6_type ?>"<?php if(isset($attr6_src)) { ?> src="<?php echo $image_dir.'icon_'.$attr6_src.IMG_ICON_EXT ?>"<?php } ?> name="<?php echo $attr6_value ?>" class="<?php echo $attr6_class ?>" title="<?php echo lang($attr6_text.'_DESC') ?>" value=" <?php echo langHtml($attr6_text) ?> " /><?php unset($attr6_src) ?><?php
+?><?php unset($attr6_type);unset($attr6_class);unset($attr6_value);unset($attr6_text); ?><?php ?></td><?php ?><?php ?></tr><?php ?><?php ?> </table>
+ </td>
+ </tr>
+</table>
+</center>
+<?php if ($showDuration)
+ { ?>
+<br/>
+<center><small>
+<?php $dur = time()-START_TIME;
+ echo floor($dur/60).':'.str_pad($dur%60,2,'0',STR_PAD_LEFT); ?></small></center>
+<?php } ?>
+<?php ?><?php ?></form>
+<?php ?><?php ?></body>
+</html><?php ?>+
\ No newline at end of file
diff --git a/themes/default/templates/profile/settings.tpl.src.php b/themes/default/templates/profile/settings.tpl.src.php
@@ -0,0 +1,13 @@
+page
+ form method:post
+ window
+ row
+ cell
+ checkbox name:always_edit
+ #cell
+ label for:always_edit
+ text key:setting_always_edit
+
+ row
+ cell colspan:2 class:act
+ button type:ok