summaryrefslogtreecommitdiffstats
path: root/apps/admin/modules/domain
diff options
context:
space:
mode:
authorGravatar mszulecki2007-06-14 17:09:01 +0000
committerGravatar mszulecki2007-06-14 17:09:01 +0000
commit9f108dd1a969473375341d92a7b1252fa2cedc9a (patch)
treed5f2e35ec0bd2d52dab0ee3282fc6751e0fa8dba /apps/admin/modules/domain
parente35884d11b81e4e4bbd73e1882e2b8011e85d118 (diff)
downloadmailadmin-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/domain')
-rw-r--r--apps/admin/modules/domain/actions/actions.class.php47
-rw-r--r--apps/admin/modules/domain/config/generator.yml53
-rw-r--r--apps/admin/modules/domain/config/security.yml11
-rw-r--r--apps/admin/modules/domain/templates/_default_mailbox_quota.php1
-rw-r--r--apps/admin/modules/domain/templates/_edit_header.php13
-rw-r--r--apps/admin/modules/domain/templates/_max_mailbox_count.php1
-rw-r--r--apps/admin/modules/domain/templates/_quota.php1
-rw-r--r--apps/admin/modules/domain/validate/create.yml46
-rw-r--r--apps/admin/modules/domain/validate/edit.yml46
9 files changed, 219 insertions, 0 deletions
diff --git a/apps/admin/modules/domain/actions/actions.class.php b/apps/admin/modules/domain/actions/actions.class.php
new file mode 100644
index 0000000..badbf03
--- /dev/null
+++ b/apps/admin/modules/domain/actions/actions.class.php
@@ -0,0 +1,47 @@
+<?php
+
+/**
+ * domain actions.
+ *
+ * @package mailadmin
+ * @subpackage domain
+ * @author Your name here
+ * @version SVN: $Id: actions.class.php 2288 2006-10-02 15:22:13Z fabien $
+ */
+class domainActions extends autodomainActions
+{
+ public function executeList()
+ {
+ // pageination
+ if($this->hasRequestParameter("max_per_page"))
+ $this->getUser()->setResultsPerPage($this->getRequestParameter("max_per_page"));
+
+ return parent::executeList();
+ }
+
+ public function executeCreate()
+ {
+ // populate preset values
+ $this->getRequest()->setParameter('domain[creator_id]', $this->getUser()->getId());
+
+ $this->setTemplate("edit");
+ return $this->executeEdit();
+ }
+
+ public function handleErrorCreate()
+ {
+ $this->setTemplate("edit");
+ return $this->handleErrorEdit();
+ }
+
+ public function executeCreateMailbox()
+ {
+ $domain = DomainPeer::retrieveByPk($this->getRequestParameter('id'));
+ $this->redirect("mailbox/create?mailbox[domain_id]=".$domain->getId()."&mailbox[name]=".sprintf("%s%d", $domain->getMailboxPrefix(), $domain->getMailboxCount()+1)."&mailbox[max_quota]=".$domain->getDefaultMailboxQuota() );
+ }
+
+ public function executeViewMailboxes()
+ {
+ $this->redirect("mailbox/list?filter=filter&filters[domain_id]=".$this->getRequestParameter('id'));
+ }
+}
diff --git a/apps/admin/modules/domain/config/generator.yml b/apps/admin/modules/domain/config/generator.yml
new file mode 100644
index 0000000..df971b3
--- /dev/null
+++ b/apps/admin/modules/domain/config/generator.yml
@@ -0,0 +1,53 @@
+generator:
+ class: sfPropelAdminGenerator
+ param:
+ model_class: Domain
+ theme: mailadmin
+
+ fields:
+ name: { name: Domain }
+ mailbox_prefix: { name: Mailbox Prefix }
+ max_mailbox_count: { name: Max Mailbox Count }
+ quota: { name: Quota }
+ creator: { name: Created by }
+
+ list:
+ title: List of Domains
+ display: [=name, user, mailbox_prefix, _max_mailbox_count, _quota, _default_mailbox_quota]
+ filters: [name, mailbox_prefix, max_mailbox_count, quota, default_mailbox_quota]
+ max_per_page: '$this->getUser()->getResultsPerPage("pager")'
+ sort: [name, asc]
+ fields:
+ name: { params: align=left }
+ mailbox_prefix: { params: align=left }
+ user: { name: Created By, credentials: [[superadmin]] }
+ max_mailbox_count: { params: align=right }
+ mailbox_count: { params: align=right }
+ quota: { params: align=right }
+ default_mailbox_quota: { name: Default Mailbox Quota, params: align=right }
+ object_actions:
+ viewmailboxes: { name: View Mailboxes, action: viewMailboxes, icon: mail.gif }
+ createmailbox: { name: Create New Mailbox, action: createMailbox, icon: mail-new.gif }
+ edit: { name: Edit Domain, action: edit, icon: edit.gif, credentials: [[superadmin, domainmaster]] }
+ delete: { name: Delete Domain, action: delete, icon: trash.gif, credentials: [[superadmin, domainmaster]], params: confirm=Are you sure? }
+ actions: {}
+
+ create:
+ title: Create New Domain
+
+ edit:
+ title: 'Editing Domain %%name%%'
+ display:
+ 'General Settings': [name, mailbox_prefix]
+ 'Limits': [max_mailbox_count, quota, default_mailbox_quota]
+ fields:
+ name: { name: Domain Name, params: size=50 }
+ mailbox_prefix: { name: Prefix for new Mailboxes, params: size=50 onfocus='updatePrefixFromDomainName(this);' }
+ max_mailbox_count: { name: Maximum Number of Mailboxes, help: '0 = No Limit', params: size=50 }
+ quota: { name: Default Quota in kb, help: '0 = No Limit', params: size=50 }
+ default_mailbox_quota: { name: Quota for Domain in kb, 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/domain/config/security.yml b/apps/admin/modules/domain/config/security.yml
new file mode 100644
index 0000000..2431ebf
--- /dev/null
+++ b/apps/admin/modules/domain/config/security.yml
@@ -0,0 +1,11 @@
+create:
+ is_secure: on
+ credentials: [[superadmin, domainmaster]]
+
+edit:
+ is_secure: on
+ credentials: [[superadmin, domainmaster]]
+
+all:
+ is_secure: on
+
diff --git a/apps/admin/modules/domain/templates/_default_mailbox_quota.php b/apps/admin/modules/domain/templates/_default_mailbox_quota.php
new file mode 100644
index 0000000..272ad83
--- /dev/null
+++ b/apps/admin/modules/domain/templates/_default_mailbox_quota.php
@@ -0,0 +1 @@
+<?php use_helper("Files") ?><?php echo ($domain->getDefaultMailboxQuota()==0 ? "Unlimited" : format_bytes($domain->getDefaultMailboxQuota()*1000)) ?>
diff --git a/apps/admin/modules/domain/templates/_edit_header.php b/apps/admin/modules/domain/templates/_edit_header.php
new file mode 100644
index 0000000..fed004a
--- /dev/null
+++ b/apps/admin/modules/domain/templates/_edit_header.php
@@ -0,0 +1,13 @@
+<?php use_helper("Javascript") ?>
+
+<?php
+ use_javascript(sfConfig::get('sf_prototype_web_dir').'/js/prototype');
+
+ echo javascript_tag("
+ function updatePrefixFromDomainName(field) {
+ v = $('domain_name').value;
+ if(field.value!='') return true;
+ field.value = v.substring(0, v.indexOf('.'));
+ return true;
+ }");
+?>
diff --git a/apps/admin/modules/domain/templates/_max_mailbox_count.php b/apps/admin/modules/domain/templates/_max_mailbox_count.php
new file mode 100644
index 0000000..8b7a70b
--- /dev/null
+++ b/apps/admin/modules/domain/templates/_max_mailbox_count.php
@@ -0,0 +1 @@
+<?php echo $domain->getMailboxCount() ?> / <?php echo ($domain->getMaxMailboxCount()==0 ? "Unlimited": $domain->getMaxMailboxCount()) ?>
diff --git a/apps/admin/modules/domain/templates/_quota.php b/apps/admin/modules/domain/templates/_quota.php
new file mode 100644
index 0000000..0b36b22
--- /dev/null
+++ b/apps/admin/modules/domain/templates/_quota.php
@@ -0,0 +1 @@
+<?php use_helper("Files") ?><?php echo format_bytes($domain->getUsedQuota()*1000) ?> / <?php echo ($domain->getQuota()==0 ? "Unlimited" : format_bytes($domain->getQuota()*1000)) ?>
diff --git a/apps/admin/modules/domain/validate/create.yml b/apps/admin/modules/domain/validate/create.yml
new file mode 100644
index 0000000..c8183c2
--- /dev/null
+++ b/apps/admin/modules/domain/validate/create.yml
@@ -0,0 +1,46 @@
+fillin:
+ enabled: true
+
+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)
+
+fields:
+ domain{name}:
+ required:
+ msg: The Domain Name is required
+ myStringValidator:
+ sfRegexValidator:
+ match:..........Yes
+ match_error: 'The name must be in the form: example.org'
+ pattern: /[^.]+\.[^.]+$/si
+ sfPropelUniqueValidator:
+ class: Domain
+ column: name
+ unique_error: This domain already exists
+ domain{mailbox_prefix}:
+ required:
+ msg: The Mailbox Prefix is required
+ myStringValidator:
+ sfRegexValidator:
+ match: Yes
+ match_error: The prefix must only consist out of alphanumeric characters
+ pattern: /[A-z0-9]/si
+ sfPropelUniqueValidator:
+ class: Domain
+ column: mailbox_prefix
+ unique_error: This prefix already exists
+ domain{max_mailbox_count}:
+ required:
+ msg: The Mailbox Count is required
+ domain{quota}:
+ required:
+ msg: The Domain Quota is required
+ domain{default_mailbox_quota}:
+ required:
+ msg: The Mailbox Quota is required
diff --git a/apps/admin/modules/domain/validate/edit.yml b/apps/admin/modules/domain/validate/edit.yml
new file mode 100644
index 0000000..c8183c2
--- /dev/null
+++ b/apps/admin/modules/domain/validate/edit.yml
@@ -0,0 +1,46 @@
+fillin:
+ enabled: true
+
+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)
+
+fields:
+ domain{name}:
+ required:
+ msg: The Domain Name is required
+ myStringValidator:
+ sfRegexValidator:
+ match:..........Yes
+ match_error: 'The name must be in the form: example.org'
+ pattern: /[^.]+\.[^.]+$/si
+ sfPropelUniqueValidator:
+ class: Domain
+ column: name
+ unique_error: This domain already exists
+ domain{mailbox_prefix}:
+ required:
+ msg: The Mailbox Prefix is required
+ myStringValidator:
+ sfRegexValidator:
+ match: Yes
+ match_error: The prefix must only consist out of alphanumeric characters
+ pattern: /[A-z0-9]/si
+ sfPropelUniqueValidator:
+ class: Domain
+ column: mailbox_prefix
+ unique_error: This prefix already exists
+ domain{max_mailbox_count}:
+ required:
+ msg: The Mailbox Count is required
+ domain{quota}:
+ required:
+ msg: The Domain Quota is required
+ domain{default_mailbox_quota}:
+ required:
+ msg: The Mailbox Quota is required