diff options
author | mszulecki | 2007-06-14 17:09:01 +0000 |
---|---|---|
committer | mszulecki | 2007-06-14 17:09:01 +0000 |
commit | 9f108dd1a969473375341d92a7b1252fa2cedc9a (patch) | |
tree | d5f2e35ec0bd2d52dab0ee3282fc6751e0fa8dba /apps/admin/modules/mailbox | |
parent | e35884d11b81e4e4bbd73e1882e2b8011e85d118 (diff) | |
download | mailadmin-9f108dd1a969473375341d92a7b1252fa2cedc9a.tar.gz mailadmin-9f108dd1a969473375341d92a7b1252fa2cedc9a.tar.bz2 |
Initial import.
git-svn-id: http://svn.sukimashita.com/repos/mailadmin/trunk@2 4281df72-ff29-0410-8fee-2d9ac0c5f5a7
Diffstat (limited to 'apps/admin/modules/mailbox')
10 files changed, 216 insertions, 0 deletions
diff --git a/apps/admin/modules/mailbox/actions/actions.class.php b/apps/admin/modules/mailbox/actions/actions.class.php new file mode 100644 index 0000000..566c69f --- /dev/null +++ b/apps/admin/modules/mailbox/actions/actions.class.php @@ -0,0 +1,56 @@ +<?php + +/** + * mailbox actions. + * + * @package mailadmin + * @subpackage mailbox + * @author Your name here + * @version SVN: $Id: actions.class.php 2288 2006-10-02 15:22:13Z fabien $ + */ +class mailboxActions extends automailboxActions +{ + public function executeList() + { + // pageination + if($this->hasRequestParameter("max_per_page")) + $this->getUser()->setResultsPerPage($this->getRequestParameter("max_per_page")); + + return parent::executeList(); + } + + public function executeCreate() + { + $this->setTemplate("edit"); + $result = $this->executeEdit(); + + if($this->getRequest()->getMethod() == sfRequest::GET) + { + if(!$this->hasRequestParameter("id")) + { + $this->updateMailboxFromRequest(); + } + + // reset is needed as updateMailboxFromRequest() deactivates + $this->mailbox->setActive(true); + } + return $result; + } + + public function handleErrorCreate() + { + $this->setTemplate("edit"); + return $this->handleErrorEdit(); + } + + public function executeCreateAddress() + { + $mailbox = MailboxPeer::retrieveByPk($this->getRequestParameter('id')); + $this->redirect("address/create?address[mailbox_id]=".$this->getRequestParameter('id')."&address[domain_id]=".$mailbox->getDomainId()); + } + + public function executeViewAddresses() + { + $this->redirect("address/list?filter=filter&filters[mailbox_id]=".$this->getRequestParameter('id')); + } +} diff --git a/apps/admin/modules/mailbox/config/generator.yml b/apps/admin/modules/mailbox/config/generator.yml new file mode 100644 index 0000000..9c119ea --- /dev/null +++ b/apps/admin/modules/mailbox/config/generator.yml @@ -0,0 +1,56 @@ +generator: + class: sfPropelAdminGenerator + param: + model_class: Mailbox + theme: mailadmin + + fields: + domain: { name: Domain } + domain_id: { name: Domain } + name { name: Username } + max_quota: { name: Quota } + max_address_count: { name: Maximum Addresses } + last_login: { name: Last Login } + + list: + peer_method: doSelectJoinDomain + title: List of Mailboxes + display: [=name, _domain_id, _max_quota, _max_address_count, active, _last_login] + filters: [name, domain_id, max_quota, max_address_count, active, last_login] + max_per_page: '$this->getUser()->getResultsPerPage("pager")' + sort: [domain_id, asc] + fields: + name: { params: align=right } + domain_id: { params: align=left } + max_quota: { params: align=right } + max_address_count: { params: align=right } + active: { params: align=center width=1% } + last_login: { params: align=right } + object_actions: + viewaddresses: { name: View Addresses, action: viewAddresses, icon: address.gif } + createaddress: { name: Create New Address, action: createAddress, icon: address-new.gif } + edit: { name: Edit Mailbox, action: edit, icon: edit.gif } + delete: { name: Delete Mailbox, action: delete, icon: trash.gif, params: confirm=This will also remove all addresses for this mailbox. Are you sure? } + actions: {} + + create: + title: Create New Mailbox + + edit: + title: Editing Mailbox %%name%% + display: + 'General Settings': [name, _password, _new_password, domain_id, active] + 'Limits': [max_quota, max_address_count] + fields: + name: { name: Username, params: size=50 } + password: { name: Password, params: size=50, only_for: create } + new_password: { name: New Password, help: 'Enter a password to change it, leave the field blank to keep the current one', params: size=50, only_for: edit } + domain_id: { name: For Domain } + active: { name: Enable Login, help: 'Inactive mailboxes receive mail, however users are unable to login' } + max_quota: { name: Maximum Storage Space in kb, help: '0 = No Limit', params: size=50 } + max_address_count: { name: Maximum Number of Addresses, help: '0 = No Limit', params: size=50 } + actions: + _save_and_list: { name: Save } + _save_and_add: { name: 'Save, then create new one' } + _list: { name: Cancel } + diff --git a/apps/admin/modules/mailbox/templates/_domain_id.php b/apps/admin/modules/mailbox/templates/_domain_id.php new file mode 100644 index 0000000..4e93b4b --- /dev/null +++ b/apps/admin/modules/mailbox/templates/_domain_id.php @@ -0,0 +1 @@ +<?php echo $mailbox->getDomain()->getName() ?> diff --git a/apps/admin/modules/mailbox/templates/_last_login.php b/apps/admin/modules/mailbox/templates/_last_login.php new file mode 100644 index 0000000..6e0583a --- /dev/null +++ b/apps/admin/modules/mailbox/templates/_last_login.php @@ -0,0 +1 @@ +<?php echo ($mailbox->getLastLogin()==""? "Never":$mailbox->getLastLogin()) ?> diff --git a/apps/admin/modules/mailbox/templates/_max_address_count.php b/apps/admin/modules/mailbox/templates/_max_address_count.php new file mode 100644 index 0000000..66cc68f --- /dev/null +++ b/apps/admin/modules/mailbox/templates/_max_address_count.php @@ -0,0 +1 @@ +<?php use_helper("Files") ?><?php echo $mailbox->getAddressCount() ?> / <?php echo ($mailbox->getMaxAddressCount()==0 ? "Unlimited": $mailbox->getMaxAddressCount()) ?> diff --git a/apps/admin/modules/mailbox/templates/_max_quota.php b/apps/admin/modules/mailbox/templates/_max_quota.php new file mode 100644 index 0000000..3bf8c47 --- /dev/null +++ b/apps/admin/modules/mailbox/templates/_max_quota.php @@ -0,0 +1 @@ +<?php use_helper("Files") ?><?php $q = $mailbox->getQuota(); $qmax = ($q["max"] != null ? $q["max"]: $mailbox->getMaxQuota()); ?><?php if($q["resource"] != null): ?><?php echo format_bytes($q["current"]*1000) ?> / <?php endif; ?><?php echo ($qmax==0 ? "Unlimited" : format_bytes($qmax*1000)) ?> diff --git a/apps/admin/modules/mailbox/templates/_new_password.php b/apps/admin/modules/mailbox/templates/_new_password.php new file mode 100644 index 0000000..1c28ee6 --- /dev/null +++ b/apps/admin/modules/mailbox/templates/_new_password.php @@ -0,0 +1 @@ +<?php echo input_password_tag('mailbox[new_password]', '', 'size=50') ?> diff --git a/apps/admin/modules/mailbox/templates/_password.php b/apps/admin/modules/mailbox/templates/_password.php new file mode 100644 index 0000000..412f824 --- /dev/null +++ b/apps/admin/modules/mailbox/templates/_password.php @@ -0,0 +1 @@ +<?php echo input_password_tag('mailbox[password]', '', 'size=50') ?> diff --git a/apps/admin/modules/mailbox/validate/create.yml b/apps/admin/modules/mailbox/validate/create.yml new file mode 100644 index 0000000..3668321 --- /dev/null +++ b/apps/admin/modules/mailbox/validate/create.yml @@ -0,0 +1,50 @@ +fillin: + enabled: true + param: + exclude_types: [password] + +validators: + myStringValidator: + class: sfStringValidator + param: + min: 2 + min_error: This field is too short (2 characters minimum) + max: 100 + max_error: This field is too long (100 characters maximum) + myPasswordValidator: + class: sfStringValidator + param: + min: 5 + min_error: The password is too short (5 characters minimum) + max: 100 + max_error: The password is too long (100 characters maximum) + +fields: + mailbox{name}: + required: + msg: The Username is required + myStringValidator: + sfRegexValidator: + match:..........Yes + match_error: 'The characters ".,;/" are not allowed' + pattern: '/[^.,;\/]$/i' + myDenyStringValidator: + values: [<?php echo implode(', ',sfConfig::get('app_mailbox_deny_names')) ?>] + values_error: This Username is not allowed + sfPropelUniqueValidator: + class: Mailbox + column: name + unique_error: This Username already exists + mailbox{password}: + required: + msg: The Password is required + myPasswordValidator: + mailbox{domain_id}: + required: + msg: A Domain has to be specified + mailbox{max_quota}: + required: + msg: The Mailbox Quota is required + mailbox{max_address_count}: + required: + msg: The Maximum Address Count is required diff --git a/apps/admin/modules/mailbox/validate/edit.yml b/apps/admin/modules/mailbox/validate/edit.yml new file mode 100644 index 0000000..1629a9d --- /dev/null +++ b/apps/admin/modules/mailbox/validate/edit.yml @@ -0,0 +1,48 @@ +fillin: + enabled: true + param: + exclude_types: [password] + +validators: + myStringValidator: + class: sfStringValidator + param: + min: 2 + min_error: This field is too short (2 characters minimum) + max: 100 + max_error: This field is too long (100 characters maximum) + myPasswordValidator: + class: sfStringValidator + param: + min: 5 + min_error: The password is too short (5 characters minimum) + max: 100 + max_error: The password is too long (100 characters maximum) + +fields: + mailbox{name}: + required: + msg: The Username is required + myStringValidator: + sfRegexValidator: + match:..........Yes + match_error: 'The characters ".,;/" are not allowed' + pattern: '/[^.,;\/]$/i' + myDenyStringValidator: + values: [<?php echo implode(', ',sfConfig::get('app_mailbox_deny_names')) ?>] + values_error: This Username is not allowed + sfPropelUniqueValidator: + class: Mailbox + column: name + unique_error: This Username already exists + mailbox{new_password}: + myPasswordValidator: + mailbox{domain_id}: + required: + msg: A Domain has to be specified + mailbox{max_quota}: + required: + msg: The Mailbox Quota is required + mailbox{max_address_count}: + required: + msg: The Maximum Address Count is required |