- Timestamp:
- 18 Nov 2014, 11:37:28 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/browser.py
r11979 r11985 51 51 grok.context(IIkobaObject) 52 52 53 53 54 class CustomersBreadcrumb(Breadcrumb): 54 55 """A breadcrumb for the customers container. … … 72 73 def title(self): 73 74 return self.context.display_fullname 75 74 76 75 77 class CustomersContainerPage(IkobaPage): … … 112 114 self.flash(_('No customer found.'), type="warning") 113 115 return 116 114 117 115 118 class CustomersContainerManagePage(IkobaPage): … … 168 171 if len(deleted): 169 172 self.flash(_('Successfully removed: ${a}', 170 mapping = {'a':', '.join(deleted)})) 171 return 173 mapping={'a': ','.join(deleted)})) 174 return 175 172 176 173 177 class CustomerAddFormPage(IkobaAddFormPage): … … 191 195 return 192 196 197 193 198 class LoginAsCustomerStep1(IkobaEditFormPage): 194 199 """ View to temporarily set a customer password. … … 202 207 def label(self): 203 208 return _(u'Set temporary password for ${a}', 204 mapping = {'a':self.context.display_fullname})209 mapping={'a': self.context.display_fullname}) 205 210 206 211 @action('Set password now', style='primary') … … 211 216 self.context.writeLogMessage( 212 217 self, 'temp_password generated: %s' % password) 213 args = {'password': password}218 args = {'password': password} 214 219 self.redirect(self.url(self.context) + 215 220 '/loginasstep2?%s' % urlencode(args)) 216 221 return 222 217 223 218 224 class LoginAsCustomerStep2(IkobaPage): … … 228 234 def label(self): 229 235 return _(u'Login as ${a}', 230 mapping = {'a':self.context.customer_id})236 mapping={'a': self.context.customer_id}) 231 237 232 238 def update(self, SUBMIT=None, password=None): … … 237 243 return 238 244 245 239 246 class CustomerBaseDisplayFormPage(IkobaDisplayFormPage): 240 247 """ Page to display customer base data … … 252 259 if self.context.suspended: 253 260 return _('${a}: Base Data (account deactivated)', 254 mapping = {'a':self.context.display_fullname})261 mapping={'a': self.context.display_fullname}) 255 262 return _('${a}: Base Data', 256 mapping = {'a':self.context.display_fullname})263 mapping={'a': self.context.display_fullname}) 257 264 258 265 @property … … 262 269 return _('unset') 263 270 271 264 272 class ContactCustomerForm(ContactAdminForm): 265 273 grok.context(ICustomer) … … 277 285 def label(self): 278 286 return _(u'Send message to ${a}', 279 mapping = {'a':self.context.display_fullname})287 mapping={'a': self.context.display_fullname}) 280 288 281 289 @action('Send message now', style='primary') … … 289 297 ikoba_utils = getUtility(IIkobaUtils) 290 298 success = ikoba_utils.sendContactForm( 291 self.request.principal.title, email,292 self.context.display_fullname, self.context.email,299 self.request.principal.title, email, 300 self.context.display_fullname, self.context.email, 293 301 self.request.principal.id,usertype, 294 302 self.config.name, 295 data['body'], data['subject'])303 data['body'], data['subject']) 296 304 if success: 297 305 self.flash(_('Your message has been sent.')) … … 299 307 self.flash(_('An smtp server error occurred.'), type="danger") 300 308 return 309 301 310 302 311 class CustomerBaseManageFormPage(IkobaEditFormPage): … … 326 335 errors = validator.validate_password(password, password_ctl) 327 336 if errors: 328 self.flash( 337 self.flash(' '.join(errors), type="danger") 329 338 return 330 339 changed_fields = self.applyData(self.context, **data) … … 344 353 return 345 354 355 346 356 class CustomerTriggerTransitionFormPage(IkobaEditFormPage): 347 357 """ View to manage customer base data … … 375 385 return 376 386 387 377 388 class CustomerActivatePage(UtilityView, grok.View): 378 389 """ Activate customer account … … 394 405 return 395 406 407 396 408 class CustomerDeactivatePage(UtilityView, grok.View): 397 409 """ Deactivate customer account … … 413 425 return 414 426 427 415 428 class CustomerHistoryPage(IkobaPage): 416 429 """ Page to display customer history … … 424 437 @property 425 438 def label(self): 426 return _('${a}: History', mapping = {'a':self.context.display_fullname}) 439 return _('${a}: History', mapping={'a':self.context.display_fullname}) 440 427 441 428 442 class CustomerRequestPasswordPage(IkobaAddFormPage): … … 446 460 # Forward only email to landing page in base package. 447 461 self.redirect(self.url(self.context, 'requestpw_complete', 448 data =dict(email=email)))462 data=dict(email=email))) 449 463 return 450 464 … … 513 527 return 514 528 529 515 530 class CustomerRequestPasswordEmailSent(IkobaPage): 516 531 """Landing page after successful password request. … … 527 542 self.customer_id = customer_id 528 543 return 544 529 545 530 546 class CustomerFilesUploadPage(IkobaPage): … … 548 564 # Pages for customers only 549 565 566 550 567 class CustomerBaseEditFormPage(IkobaEditFormPage): 551 568 """ View to edit customer base data … … 563 580 msave(self, **data) 564 581 return 582 565 583 566 584 class CustomerChangePasswordPage(IkobaEditFormPage): … … 587 605 self.flash(_('Password changed.')) 588 606 else: 589 self.flash( ' '.join(errors), type="warning") 590 return 591 607 self.flash(' '.join(errors), type="warning") 608 return
Note: See TracChangeset for help on using the changeset viewer.