From f641c2cec68a3ad00c1aead29d099f36cf691eb5 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 17 Apr 2014 07:37:21 +0000 Subject: [PATCH] open password in a popup --- phpgwapi/inc/class.auth.inc.php | 9 ++-- phpgwapi/inc/class.egw_framework.inc.php | 10 ++--- ...php => class.preferences_password.inc.php} | 43 +++---------------- preferences/password.php | 24 ----------- 4 files changed, 18 insertions(+), 68 deletions(-) rename preferences/inc/{class.uipassword.inc.php => class.preferences_password.inc.php} (62%) delete mode 100644 preferences/password.php diff --git a/phpgwapi/inc/class.auth.inc.php b/phpgwapi/inc/class.auth.inc.php index 4d2f674963..02c3ff503c 100644 --- a/phpgwapi/inc/class.auth.inc.php +++ b/phpgwapi/inc/class.auth.inc.php @@ -127,7 +127,7 @@ class auth //echo "Warn about the upcomming change ".$GLOBALS['egw_info']['server']['warn_about_upcoming_pwd_change'].' days before that time is reached
'; //$result = $GLOBALS['egw_info']['server']['change_pwd_every_x_days'] - $daysLeftUntilChangeReq; //echo $GLOBALS['egw_info']['server']['change_pwd_every_x_days'].' - '.$daysLeftUntilChangeReq.'='. $result.'
'; - if (!($app == 'preferences' && $class == 'uipassword' && $method=='change') && + if (!($app == 'preferences' && $class == 'preferences_password' && $method == 'change') && ( ($GLOBALS['egw_info']['server']['change_pwd_every_x_days'] && ($GLOBALS['egw_info']['user']['apps']['preferences'] || $GLOBALS['egw_info']['user']['apps']['password']) && @@ -168,8 +168,11 @@ class auth 'date'=>egw_time::to($alpwchange_val)))); $message = lang('it has been more then %1 days since you changed your password',$GLOBALS['egw_info']['server']['change_pwd_every_x_days']); } - if ($GLOBALS['egw_info']['user']['apps']['password']) egw::redirect_link('/preferences/password.php',array('message'=>$message)); - egw::redirect_link('/index.php',array('menuaction'=>'preferences.uipassword.change','message'=>$message)); + egw::redirect_link('/index.php',array( + 'menuaction' => 'preferences.preferences_password.change', + 'message' => $message, + 'nopopup' => true, + )); } } return true; diff --git a/phpgwapi/inc/class.egw_framework.inc.php b/phpgwapi/inc/class.egw_framework.inc.php index 1a6acf3135..7cad8c30fc 100644 --- a/phpgwapi/inc/class.egw_framework.inc.php +++ b/phpgwapi/inc/class.egw_framework.inc.php @@ -1305,15 +1305,15 @@ if ($app == 'home') continue; } // allways display password in topmenu, if user has rights to change it - if((($pw_app = $GLOBALS['egw_info']['user']['apps']['preferences']) || - ($pw_app = $GLOBALS['egw_info']['user']['apps']['password'])) && + if ($GLOBALS['egw_info']['user']['apps']['preferences'] && !$GLOBALS['egw']->acl->check('nopasswordchange', 1, 'preferences')) { $this->_add_topmenu_item(array( - 'name' => $pw_app['name'] == 'password' ? 'about' : $pw_app['name'], + 'id' => 'password', + 'name' => 'preferences', 'title' => lang('Password'), - 'url' => egw::link($pw_app['name'] == 'password' ? $pw_app['index'] : '/index.php?menuaction=preferences.uipassword.change'), - 'icon' => common::image($pw_app['icon'],$pw_app['icon_app']), + 'url' => 'javascript:egw.open_link("'. + egw::link('/index.php?menuaction=preferences.preferences_password.change').'", "_blank", "400x200")', )); } diff --git a/preferences/inc/class.uipassword.inc.php b/preferences/inc/class.preferences_password.inc.php similarity index 62% rename from preferences/inc/class.uipassword.inc.php rename to preferences/inc/class.preferences_password.inc.php index e2ce1bd93f..4360d91d64 100644 --- a/preferences/inc/class.uipassword.inc.php +++ b/preferences/inc/class.preferences_password.inc.php @@ -9,7 +9,7 @@ * @version $Id$ */ -class uipassword +class preferences_password { var $public_functions = array( 'change' => True @@ -21,17 +21,10 @@ class uipassword $n_passwd = $_POST['n_passwd']; $n_passwd_2 = $_POST['n_passwd_2']; $o_passwd_2 = $_POST['o_passwd_2']; - if (isset($_GET['message'])) $_GET['message'] = str_replace("
"," ",html::purify($_GET['message'])); + if (isset($_GET['message'])) $message = str_replace("
"," ",html::purify($_GET['message'])); if($GLOBALS['egw']->acl->check('nopasswordchange', 1) || $_POST['cancel']) { - if ($GLOBALS['egw_info']['user']['apps']['preferences']) - { - egw::redirect_link('/preferences/index.php'); - } - else - { - egw::redirect_link('/index.php'); // redirect to start page - } + egw_framework::window_close(); } $GLOBALS['egw']->template->set_file(array( @@ -42,25 +35,7 @@ class uipassword $GLOBALS['egw']->template->set_var('lang_enter_old_password',lang('Enter your old password')); $GLOBALS['egw']->template->set_var('lang_change',lang('Change password')); $GLOBALS['egw']->template->set_var('lang_cancel',lang('Cancel')); - $GLOBALS['egw']->template->set_var('form_action', - $GLOBALS['egw_info']['user']['apps']['preferences'] ? - egw::link('/index.php','menuaction=preferences.uipassword.change') : - egw::link('/preferences/password.php')); - - if($GLOBALS['egw_info']['server']['auth_type'] != 'ldap') - { - $smtpClassName = 'defaultsmtp'; - if (($default_profile_id = emailadmin_bo::getDefaultProfileID())) - { - $bofelamimail = felamimail_bo::forceEAProfileLoad($default_profile_id); - //fetch the smtpClass - //_debug_array($bofelamimail->ogServer); - $smtpClassName = get_class($bofelamimail->ogServer); - } - $GLOBALS['egw']->template->set_var('sql_message', - $smtpClassName != 'defaultsmtp' ? '' : - lang('note: This feature does *not* change your email password. This will need to be done manually.')); - } + $GLOBALS['egw']->template->set_var('form_action',egw::link('/index.php','menuaction=preferences.preferences_password.change')); $errors = array(); if($_POST['change']) @@ -104,26 +79,22 @@ class uipassword { $errors[] = lang('Failed to change password.'); } + egw_framework::message(implode("\n", $errors), 'error'); common::egw_header(); echo parse_navbar(); - $GLOBALS['egw']->template->set_var('messages',common::error_list($errors)); $GLOBALS['egw']->template->pfp('out','form'); common::egw_exit(True); } else { - if ($GLOBALS['egw_info']['user']['apps']['preferences']) - { - egw::redirect_link('/preferences/index.php','cd=18'); - } - $_GET['message'] = lang('Password changed'); + egw_framework::refresh_opener(lang('Password changed'), 'preferences'); + egw_framework::window_close(); } } $GLOBALS['egw_info']['flags']['app_header'] = lang('Change your password'); common::egw_header(); echo parse_navbar(); - $GLOBALS['egw']->template->set_var('messages',''.htmlspecialchars($_GET['message']).''); $GLOBALS['egw']->template->pfp('out','form'); common::egw_footer(); } diff --git a/preferences/password.php b/preferences/password.php deleted file mode 100644 index 0240a62089..0000000000 --- a/preferences/password.php +++ /dev/null @@ -1,24 +0,0 @@ - - * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License - * @version $Id$ - */ - -$GLOBALS['egw_info'] = array( - 'flags' => array( - 'noheader' => True, - 'nonavbar' => True, - 'currentapp' => 'preferences', - ) -); -include('../header.inc.php'); - -$GLOBALS['egw']->template = new Template(common::get_tpl_dir('preferences')); -translation::add_app('preferences'); -ExecMethod('preferences.uipassword.change'); -common::egw_footer();