Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Forth commit into mail_quota fixed behaviour (ticket #337)

  • Loading branch information...
commit 271e200acc36711b6c3495a9cdffd184d02d4d0d 1 parent aa58d60
aseques authored May 03, 2012
6  gui/public/client/mail_accounts.php
@@ -259,6 +259,7 @@ function gen_page_dmn_mail_list($tpl, $dmn_id, $dmn_name) {
259 259
 			}
260 260
 
261 261
 			$txt_quota = "---";
  262
+			$localeinfo=localeconv();
262 263
 
263 264
 			if ($is_mailbox) {
264 265
 				$complete_email = $mail_acc . '@' . $show_dmn_name;
@@ -282,9 +283,9 @@ function gen_page_dmn_mail_list($tpl, $dmn_id, $dmn_name) {
282 283
 			}
283 284
 			if ($userquotamax == 0)	{
284 285
 				$userquotamax=tr('unlimited');
285  
-				$userquotapercent = "0.000";
  286
+				$userquotapercent = "0".$localeinfo['decimal_point']."000";
286 287
 			} else {
287  
-				$userquotapercent = number_format((($userquota/$userquotamax)*100), 3, '.', '');
  288
+				$userquotapercent = number_format((($userquota/$userquotamax)*100), 3, $localeinfo['decimal_point'], '');
288 289
 				$userquotamax = formatBytes($userquotamax);
289 290
 			}
290 291
 				$userquota= formatBytes($userquota);	
@@ -773,6 +774,7 @@ function count_default_mails($dmn_id) {
773 774
 		'TR_MAIL' => tr('Mail'),
774 775
 		'TR_TYPE' => tr('Type'),
775 776
 		'TR_STATUS' => tr('Status'),
  777
+		'TR_QUOTA' => tr('Quota'),
776 778
 		'TR_ACTION' => tr('Action'),
777 779
 		'TR_AUTORESPOND' => tr('Auto respond'),
778 780
 		'TR_DMN_MAILS' => tr('Domain mails'),
13  gui/public/client/mail_quota.php
@@ -97,11 +97,11 @@ function client_UpdateMailAccount($mailAccountData)
97 97
 
98 98
 	// Quota data validation
99 99
 	$quotaValue = 0;
100  
-	$quotaUpdate = false;
  100
+	$quotaUpdate = 0;
101 101
 	if (!empty($_POST['quota']) || $_POST['quota'] == 0) {
102  
-		if($_POST['quota'] != $mailAccountData['quota']) {
  102
+		if($_POST['quota'] != floor($mailAccountData['quota'] / 1024 /1024)) {
103 103
 			if(is_numeric($_POST['quota'])) {
104  
-				$quotaUpdate = true;
  104
+				$quotaUpdate = 1;
105 105
 				$quotaValue = $_POST['quota'] * 1024 * 1024;
106 106
 			} else {
107 107
 				set_page_message(tr('Quota must be number'), 'error');
@@ -111,7 +111,7 @@ function client_UpdateMailAccount($mailAccountData)
111 111
 		set_page_message(tr('Quota must have a value'), 'error');
112 112
 	}
113 113
 
114  
-	if (!Zend_Session::namespaceIsset('pageMessages') && $quotaUpdate) {
  114
+	if ((!Zend_Session::namespaceIsset('pageMessages')) && ($quotaUpdate!=0)) {
115 115
 		iMSCP_Events_Manager::getInstance()->dispatch(
116 116
 			iMSCP_Events::onBeforeEditMail, array('mailId' => $mailAccountData['mail_id'])
117 117
 		);
@@ -136,7 +136,8 @@ function client_UpdateMailAccount($mailAccountData)
136 136
 		write_log("{$_SESSION['user_logged']}: updated mail quota: {$mailAccountData['mail_addr']}", E_USER_NOTICE);
137 137
 		return true;
138 138
 	} else {
139  
-		set_page_message(tr("Nothing's been changed."), 'info');
  139
+		set_page_message(tr("Nothing has been changed."), 'info');
  140
+		return true;
140 141
 	}
141 142
 
142 143
 	return false;
@@ -212,7 +213,7 @@ function client_generateQuotaForm($tpl, $mailAccountData)
212 213
 		 'TR_PAGE_TITLE' => tr('i-MSCP - Client / Manage mail / Edit quota'),
213 214
 		 'THEME_CHARSET' => tr('encoding'),
214 215
 		 'ISP_LOGO' => layout_getUserLogo(),
215  
-		 'TR_EDIT_MAIL_ACCOUNT' => tr('Edit mail quota'),
  216
+		 'TR_EDIT_MAIL_QUOTA' => tr('Edit mail quota'),
216 217
 		 'TR_QUOTA' => tr('Quota in MB (0 unlimited)'),
217 218
 		 'QUOTA' => $quotaValue,
218 219
 		 'TR_HELP' => tr('help'),
2  gui/themes/default/client/mail_accounts.tpl
@@ -19,7 +19,7 @@
19 19
 					<th>{TR_MAIL}</th>
20 20
 					<th>{TR_TYPE}</th>
21 21
 					<th>{TR_STATUS}</th>
22  
-					<th>{TR_QUOTA_USE}</th>
  22
+					<th>{TR_QUOTA}</th>
23 23
 					<th>{TR_ACTION}</th>
24 24
 				</tr>
25 25
 			</thead>
6  gui/themes/default/client/navigation.xml
@@ -199,6 +199,12 @@
199 199
 							<visible>0</visible>
200 200
 							<title_class>email</title_class>
201 201
 						</mail_account_edit_link>
  202
+						<mail_account_quota_link>
  203
+							<label>Edit mail quota</label>
  204
+							<uri>/client/mail_quota.php</uri>
  205
+							<visible>0</visible>
  206
+							<title_class>email</title_class>
  207
+						</mail_account_quota_link>
202 208
 						<enable_autoresponder_link>
203 209
 							<label>Enable auto responder</label>
204 210
 							<uri>/client/mail_autoresponder_enable.php</uri>

0 notes on commit 271e200

Please sign in to comment.
Something went wrong with that request. Please try again.