From 9f108dd1a969473375341d92a7b1252fa2cedc9a Mon Sep 17 00:00:00 2001 From: mszulecki Date: Thu, 14 Jun 2007 17:09:01 +0000 Subject: Initial import. git-svn-id: http://svn.sukimashita.com/repos/mailadmin/trunk@2 4281df72-ff29-0410-8fee-2d9ac0c5f5a7 --- .../modules/mailbox/actions/actions.class.php | 56 ++++++++++++++++++++++ apps/admin/modules/mailbox/config/generator.yml | 56 ++++++++++++++++++++++ .../admin/modules/mailbox/templates/_domain_id.php | 1 + .../modules/mailbox/templates/_last_login.php | 1 + .../mailbox/templates/_max_address_count.php | 1 + .../admin/modules/mailbox/templates/_max_quota.php | 1 + .../modules/mailbox/templates/_new_password.php | 1 + apps/admin/modules/mailbox/templates/_password.php | 1 + apps/admin/modules/mailbox/validate/create.yml | 50 +++++++++++++++++++ apps/admin/modules/mailbox/validate/edit.yml | 48 +++++++++++++++++++ 10 files changed, 216 insertions(+) create mode 100644 apps/admin/modules/mailbox/actions/actions.class.php create mode 100644 apps/admin/modules/mailbox/config/generator.yml create mode 100644 apps/admin/modules/mailbox/templates/_domain_id.php create mode 100644 apps/admin/modules/mailbox/templates/_last_login.php create mode 100644 apps/admin/modules/mailbox/templates/_max_address_count.php create mode 100644 apps/admin/modules/mailbox/templates/_max_quota.php create mode 100644 apps/admin/modules/mailbox/templates/_new_password.php create mode 100644 apps/admin/modules/mailbox/templates/_password.php create mode 100644 apps/admin/modules/mailbox/validate/create.yml create mode 100644 apps/admin/modules/mailbox/validate/edit.yml (limited to 'apps/admin/modules/mailbox') 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 @@ +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 @@ +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 @@ +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 @@ +getAddressCount() ?> / 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 @@ +getQuota(); $qmax = ($q["max"] != null ? $q["max"]: $mailbox->getMaxQuota()); ?> / 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 @@ + 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 @@ + 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: [] + 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: [] + 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 -- cgit v1.1-32-gdbae