diff options
Diffstat (limited to 'data')
23 files changed, 978 insertions, 0 deletions
diff --git a/data/fixtures/10-common_data.yml b/data/fixtures/10-common_data.yml new file mode 100644 index 0000000..f435ccc --- /dev/null +++ b/data/fixtures/10-common_data.yml @@ -0,0 +1,21 @@ +Role: + superadmin: + name: Superadmin + credentials: 'superadmin' + domainmaster: + name: Domain Master + credentials: 'domainmaster' + mailboxmaster: + name: Mailbox Master + credentials: 'mailboxmaster' + +User: + admin: + nickname: admin + first_name: + last_name: + email: + password: admin + role_id: superadmin + created_at: + diff --git a/data/generator/sfPropelAdmin/mailadmin/template/actions/actions.class.php b/data/generator/sfPropelAdmin/mailadmin/template/actions/actions.class.php new file mode 100644 index 0000000..70f94f0 --- /dev/null +++ b/data/generator/sfPropelAdmin/mailadmin/template/actions/actions.class.php @@ -0,0 +1,435 @@ +[?php + +/** + * <?php echo $this->getGeneratedModuleName() ?> actions. + * + * @package ##PROJECT_NAME## + * @subpackage <?php echo $this->getGeneratedModuleName() ?> + + * @author Fabien Potencier <fabien.potencier@symfony-project.com> + * @version SVN: $Id: actions.class.php 3501 2007-02-18 10:28:17Z fabien $ + */ +class <?php echo $this->getGeneratedModuleName() ?>Actions extends sfActions +{ + public function executeIndex() + { + return $this->forward('<?php echo $this->getModuleName() ?>', 'list'); + } + + public function executeList() + { + $this->processSort(); + + $this->processFilters(); + +<?php if ($this->getParameterValue('list.filters')): ?> + $this->filters = $this->getUser()->getAttributeHolder()->getAll('sf_admin/<?php echo $this->getSingularName() ?>/filters'); +<?php endif ?> + + // pager + $this->pager = new sfPropelPager('<?php echo $this->getClassName() ?>', <?php echo $this->getParameterValue('list.max_per_page', 20) ?>); + $c = new Criteria(); + $this->addSortCriteria($c); + $this->addFiltersCriteria($c); + $this->pager->setCriteria($c); + $this->pager->setPage($this->getRequestParameter('page', 1)); +<?php if ($this->getParameterValue('list.peer_method')): ?> + $this->pager->setPeerMethod('<?php echo $this->getParameterValue('list.peer_method') ?>'); +<?php endif ?> +<?php if ($this->getParameterValue('list.peer_count_method')): ?> + $this->pager->setPeerCountMethod('<?php echo $this->getParameterValue('list.peer_count_method') ?>'); +<?php endif ?> + $this->pager->init(); + } + + public function executeCreate() + { + return $this->forward('<?php echo $this->getModuleName() ?>', 'edit'); + } + + public function executeSave() + { + return $this->forward('<?php echo $this->getModuleName() ?>', 'edit'); + } + + public function executeEdit() + { + $this-><?php echo $this->getSingularName() ?> = $this->get<?php echo $this->getClassName() ?>OrCreate(); + + if ($this->getRequest()->getMethod() == sfRequest::POST) + { + $this->update<?php echo $this->getClassName() ?>FromRequest(); + + $this->save<?php echo $this->getClassName() ?>($this-><?php echo $this->getSingularName() ?>); + + $this->setFlash('notice', 'Your modifications have been saved'); + + if ($this->getRequestParameter('save_and_add')) + { + return $this->redirect('<?php echo $this->getModuleName() ?>/create'); + } + else if ($this->getRequestParameter('save_and_list')) + { + return $this->redirect('<?php echo $this->getModuleName() ?>/list'); + } + else + { + return $this->redirect('<?php echo $this->getModuleName() ?>/edit?<?php echo $this->getPrimaryKeyUrlParams('this->') ?>); + } + } + else + { + $this->labels = $this->getLabels(); + } + } + + public function executeDelete() + { + $this-><?php echo $this->getSingularName() ?> = <?php echo $this->getClassName() ?>Peer::retrieveByPk(<?php echo $this->getRetrieveByPkParamsForAction(40) ?>); + $this->forward404Unless($this-><?php echo $this->getSingularName() ?>); + + try + { + $this->delete<?php echo $this->getClassName() ?>($this-><?php echo $this->getSingularName() ?>); + } + catch (PropelException $e) + { + $this->getRequest()->setError('delete', 'Could not delete the selected <?php echo sfInflector::humanize($this->getSingularName()) ?>. Make sure it does not have any associated items.'); + return $this->forward('<?php echo $this->getModuleName() ?>', 'list'); + } + +<?php foreach ($this->getColumnCategories('edit.display') as $category): ?> +<?php foreach ($this->getColumns('edit.display', $category) as $name => $column): ?> +<?php $input_type = $this->getParameterValue('edit.fields.'.$column->getName().'.type') ?> +<?php if ($input_type == 'admin_input_file_tag'): ?> +<?php $upload_dir = $this->replaceConstants($this->getParameterValue('edit.fields.'.$column->getName().'.upload_dir')) ?> + $currentFile = sfConfig::get('sf_upload_dir')."/<?php echo $upload_dir ?>/".$this-><?php echo $this->getSingularName() ?>->get<?php echo $column->getPhpName() ?>(); + if (is_file($currentFile)) + { + unlink($currentFile); + } + +<?php endif; ?> +<?php endforeach; ?> +<?php endforeach; ?> + return $this->redirect('<?php echo $this->getModuleName() ?>/list'); + } + + public function handleErrorEdit() + { + $this->preExecute(); + $this-><?php echo $this->getSingularName() ?> = $this->get<?php echo $this->getClassName() ?>OrCreate(); + $this->update<?php echo $this->getClassName() ?>FromRequest(); + + $this->labels = $this->getLabels(); + + return sfView::SUCCESS; + } + + protected function save<?php echo $this->getClassName() ?>($<?php echo $this->getSingularName() ?>) + { + $<?php echo $this->getSingularName() ?>->save(); + +<?php foreach ($this->getColumnCategories('edit.display') as $category): ?> +<?php foreach ($this->getColumns('edit.display', $category) as $name => $column): $type = $column->getCreoleType(); ?> +<?php $name = $column->getName() ?> +<?php if ($column->isPrimaryKey()) continue ?> +<?php $credentials = $this->getParameterValue('edit.fields.'.$column->getName().'.credentials') ?> +<?php $input_type = $this->getParameterValue('edit.fields.'.$column->getName().'.type') ?> +<?php + +$user_params = $this->getParameterValue('edit.fields.'.$column->getName().'.params'); +$user_params = is_array($user_params) ? $user_params : sfToolkit::stringToArray($user_params); +$through_class = isset($user_params['through_class']) ? $user_params['through_class'] : ''; + +?> +<?php if ($through_class): ?> +<?php + +$class = $this->getClassName(); +$related_class = sfPropelManyToMany::getRelatedClass($class, $through_class); +$related_table = constant($related_class.'Peer::TABLE_NAME'); +$middle_table = constant($through_class.'Peer::TABLE_NAME'); +$this_table = constant($class.'Peer::TABLE_NAME'); + +$related_column = sfPropelManyToMany::getRelatedColumn($class, $through_class); +$column = sfPropelManyToMany::getColumn($class, $through_class); + +?> +<?php if ($input_type == 'admin_double_list' || $input_type == 'admin_check_list' || $input_type == 'admin_select_list'): ?> +<?php if ($credentials): $credentials = str_replace("\n", ' ', var_export($credentials, true)) ?> + if ($this->getUser()->hasCredential(<?php echo $credentials ?>)) + { +<?php endif; ?> + // Update many-to-many for "<?php echo $name ?>" + $c = new Criteria(); + $c->add(<?php echo $through_class ?>Peer::<?php echo strtoupper($column->getColumnName()) ?>, $<?php echo $this->getSingularName() ?>->getPrimaryKey()); + <?php echo $through_class ?>Peer::doDelete($c); + + $ids = $this->getRequestParameter('associated_<?php echo $name ?>'); + if (is_array($ids)) + { + foreach ($ids as $id) + { + $<?php echo ucfirst($through_class) ?> = new <?php echo $through_class ?>(); + $<?php echo ucfirst($through_class) ?>->set<?php echo $column->getPhpName() ?>($<?php echo $this->getSingularName() ?>->getPrimaryKey()); + $<?php echo ucfirst($through_class) ?>->set<?php echo $related_column->getPhpName() ?>($id); + $<?php echo ucfirst($through_class) ?>->save(); + } + } + +<?php if ($credentials): ?> + } +<?php endif; ?> +<?php endif; ?> +<?php endif; ?> +<?php endforeach; ?> +<?php endforeach; ?> + } + + protected function delete<?php echo $this->getClassName() ?>($<?php echo $this->getSingularName() ?>) + { + $<?php echo $this->getSingularName() ?>->delete(); + } + + protected function update<?php echo $this->getClassName() ?>FromRequest() + { + $<?php echo $this->getSingularName() ?> = $this->getRequestParameter('<?php echo $this->getSingularName() ?>'); + +<?php foreach ($this->getColumnCategories('edit.display') as $category): ?> +<?php foreach ($this->getColumns('edit.display', $category) as $name => $column): $type = $column->getCreoleType(); ?> +<?php $name = $column->getName() ?> +<?php if ($column->isPrimaryKey()) continue ?> +<?php $credentials = $this->getParameterValue('edit.fields.'.$column->getName().'.credentials') ?> +<?php $input_type = $this->getParameterValue('edit.fields.'.$column->getName().'.type') ?> +<?php if ($credentials): $credentials = str_replace("\n", ' ', var_export($credentials, true)) ?> + if ($this->getUser()->hasCredential(<?php echo $credentials ?>)) + { +<?php endif; ?> +<?php if ($input_type == 'admin_input_file_tag'): ?> +<?php $upload_dir = $this->replaceConstants($this->getParameterValue('edit.fields.'.$column->getName().'.upload_dir')) ?> + $currentFile = sfConfig::get('sf_upload_dir')."/<?php echo $upload_dir ?>/".$this-><?php echo $this->getSingularName() ?>->get<?php echo $column->getPhpName() ?>(); + if (!$this->getRequest()->hasErrors() && isset($<?php echo $this->getSingularName() ?>['<?php echo $name ?>_remove'])) + { + $this-><?php echo $this->getSingularName() ?>->set<?php echo $column->getPhpName() ?>(''); + if (is_file($currentFile)) + { + unlink($currentFile); + } + } + + if (!$this->getRequest()->hasErrors() && $this->getRequest()->getFileSize('<?php echo $this->getSingularName() ?>[<?php echo $name ?>]')) + { +<?php elseif ($type != CreoleTypes::BOOLEAN): ?> + if (isset($<?php echo $this->getSingularName() ?>['<?php echo $name ?>'])) + { +<?php endif; ?> +<?php if ($input_type == 'admin_input_file_tag'): ?> +<?php if ($this->getParameterValue('edit.fields.'.$column->getName().'.filename')): ?> + $fileName = "<?php echo str_replace('"', '\\"', $this->replaceConstants($this->getParameterValue('edit.fields.'.$column->getName().'.filename'))) ?>"; +<?php else: ?> + $fileName = md5($this->getRequest()->getFileName('<?php echo $this->getSingularName() ?>[<?php echo $name ?>]').time().rand(0, 99999)); +<?php endif ?> + $ext = $this->getRequest()->getFileExtension('<?php echo $this->getSingularName() ?>[<?php echo $name ?>]'); + if (is_file($currentFile)) + { + unlink($currentFile); + } + $this->getRequest()->moveFile('<?php echo $this->getSingularName() ?>[<?php echo $name ?>]', sfConfig::get('sf_upload_dir')."/<?php echo $upload_dir ?>/".$fileName.$ext); + $this-><?php echo $this->getSingularName() ?>->set<?php echo $column->getPhpName() ?>($fileName.$ext); +<?php elseif ($type == CreoleTypes::DATE || $type == CreoleTypes::TIMESTAMP): ?> + if ($<?php echo $this->getSingularName() ?>['<?php echo $name ?>']) + { + try + { + $dateFormat = new sfDateFormat($this->getUser()->getCulture()); + <?php $inputPattern = $type == CreoleTypes::DATE ? 'd' : 'g'; ?> + <?php $outputPattern = $type == CreoleTypes::DATE ? 'i' : 'I'; ?> + if (!is_array($<?php echo $this->getSingularName() ?>['<?php echo $name ?>'])) + { + $value = $dateFormat->format($<?php echo $this->getSingularName() ?>['<?php echo $name ?>'], '<?php echo $outputPattern ?>', $dateFormat->getInputPattern('<?php echo $inputPattern ?>')); + } + else + { + $value_array = $<?php echo $this->getSingularName() ?>['<?php echo $name ?>']; + $value = $value_array['year'].'-'.$value_array['month'].'-'.$value_array['day'].(isset($value_array['hour']) ? ' '.$value_array['hour'].':'.$value_array['minute'].(isset($value_array['second']) ? ':'.$value_array['second'] : '') : ''); + } + $this-><?php echo $this->getSingularName() ?>->set<?php echo $column->getPhpName() ?>($value); + } + catch (sfException $e) + { + // not a date + } + } + else + { + $this-><?php echo $this->getSingularName() ?>->set<?php echo $column->getPhpName() ?>(null); + } +<?php elseif ($type == CreoleTypes::BOOLEAN): ?> + $this-><?php echo $this->getSingularName() ?>->set<?php echo $column->getPhpName() ?>(isset($<?php echo $this->getSingularName() ?>['<?php echo $name ?>']) ? $<?php echo $this->getSingularName() ?>['<?php echo $name ?>'] : 0); +<?php elseif ($column->isForeignKey()): ?> + $this-><?php echo $this->getSingularName() ?>->set<?php echo $column->getPhpName() ?>($<?php echo $this->getSingularName() ?>['<?php echo $name ?>'] ? $<?php echo $this->getSingularName() ?>['<?php echo $name ?>'] : null); +<?php else: ?> + $this-><?php echo $this->getSingularName() ?>->set<?php echo $column->getPhpName() ?>($<?php echo $this->getSingularName() ?>['<?php echo $name ?>']); +<?php endif; ?> +<?php if ($type != CreoleTypes::BOOLEAN): ?> + } +<?php endif; ?> +<?php if ($credentials): ?> + } +<?php endif; ?> +<?php endforeach; ?> +<?php endforeach; ?> + } + + protected function get<?php echo $this->getClassName() ?>OrCreate(<?php echo $this->getMethodParamsForGetOrCreate() ?>) + { + if (<?php echo $this->getTestPksForGetOrCreate() ?>) + { + $<?php echo $this->getSingularName() ?> = new <?php echo $this->getClassName() ?>(); + } + else + { + $<?php echo $this->getSingularName() ?> = <?php echo $this->getClassName() ?>Peer::retrieveByPk(<?php echo $this->getRetrieveByPkParamsForGetOrCreate() ?>); + + $this->forward404Unless($<?php echo $this->getSingularName() ?>); + } + + return $<?php echo $this->getSingularName() ?>; + } + + protected function processFilters() + { +<?php if ($this->getParameterValue('list.filters')): ?> + if ($this->getRequest()->hasParameter('filter')) + { + $filters = $this->getRequestParameter('filters'); +<?php foreach ($this->getColumns('list.filters') as $column): $type = $column->getCreoleType() ?> +<?php if ($type == CreoleTypes::DATE || $type == CreoleTypes::TIMESTAMP): ?> + if (isset($filters['<?php echo $column->getName() ?>']['from']) && $filters['<?php echo $column->getName() ?>']['from'] !== '') + { + $filters['<?php echo $column->getName() ?>']['from'] = sfI18N::getTimestampForCulture($filters['<?php echo $column->getName() ?>']['from'], $this->getUser()->getCulture()); + } + if (isset($filters['<?php echo $column->getName() ?>']['to']) && $filters['<?php echo $column->getName() ?>']['to'] !== '') + { + $filters['<?php echo $column->getName() ?>']['to'] = sfI18N::getTimestampForCulture($filters['<?php echo $column->getName() ?>']['to'], $this->getUser()->getCulture()); + } +<?php endif; ?> +<?php endforeach; ?> + + $this->getUser()->getAttributeHolder()->removeNamespace('sf_admin/<?php echo $this->getSingularName() ?>/filters'); + $this->getUser()->getAttributeHolder()->add($filters, 'sf_admin/<?php echo $this->getSingularName() ?>/filters'); + } +<?php endif; ?> + } + + protected function processSort() + { + if ($this->getRequestParameter('sort')) + { + $this->getUser()->setAttribute('sort', $this->getRequestParameter('sort'), 'sf_admin/<?php echo $this->getSingularName() ?>/sort'); + $this->getUser()->setAttribute('type', $this->getRequestParameter('type', 'asc'), 'sf_admin/<?php echo $this->getSingularName() ?>/sort'); + } + + if (!$this->getUser()->getAttribute('sort', null, 'sf_admin/<?php echo $this->getSingularName() ?>/sort')) + { +<?php if ($sort = $this->getParameterValue('list.sort')): ?> +<?php if (is_array($sort)): ?> + $this->getUser()->setAttribute('sort', '<?php echo $sort[0] ?>', 'sf_admin/<?php echo $this->getSingularName() ?>/sort'); + $this->getUser()->setAttribute('type', '<?php echo $sort[1] ?>', 'sf_admin/<?php echo $this->getSingularName() ?>/sort'); +<?php else: ?> + $this->getUser()->setAttribute('sort', '<?php echo $sort ?>', 'sf_admin/<?php echo $this->getSingularName() ?>/sort'); + $this->getUser()->setAttribute('type', 'asc', 'sf_admin/<?php echo $this->getSingularName() ?>/sort'); +<?php endif; ?> +<?php endif; ?> + } + } + + protected function addFiltersCriteria($c) + { +<?php if ($this->getParameterValue('list.filters')): ?> +<?php foreach ($this->getColumns('list.filters') as $column): $type = $column->getCreoleType() ?> +<?php if (($column->isPartial() || $column->isComponent()) && $this->getParameterValue('list.fields.'.$column->getName().'.filter_criteria_disabled')) continue ?> + if (isset($this->filters['<?php echo $column->getName() ?>_is_empty'])) + { + $criterion = $c->getNewCriterion(<?php echo $this->getPeerClassName() ?>::<?php echo strtoupper($column->getName()) ?>, ''); + $criterion->addOr($c->getNewCriterion(<?php echo $this->getPeerClassName() ?>::<?php echo strtoupper($column->getName()) ?>, null, Criteria::ISNULL)); + $c->add($criterion); + } +<?php if ($type == CreoleTypes::DATE || $type == CreoleTypes::TIMESTAMP): ?> + else if (isset($this->filters['<?php echo $column->getName() ?>'])) + { + if (isset($this->filters['<?php echo $column->getName() ?>']['from']) && $this->filters['<?php echo $column->getName() ?>']['from'] !== '') + { +<?php if ($type == CreoleTypes::DATE): ?> + $criterion = $c->getNewCriterion(<?php echo $this->getPeerClassName() ?>::<?php echo strtoupper($column->getName()) ?>, date('Y-m-d', $this->filters['<?php echo $column->getName() ?>']['from']), Criteria::GREATER_EQUAL); +<?php else: ?> + $criterion = $c->getNewCriterion(<?php echo $this->getPeerClassName() ?>::<?php echo strtoupper($column->getName()) ?>, $this->filters['<?php echo $column->getName() ?>']['from'], Criteria::GREATER_EQUAL); +<?php endif; ?> + } + if (isset($this->filters['<?php echo $column->getName() ?>']['to']) && $this->filters['<?php echo $column->getName() ?>']['to'] !== '') + { + if (isset($criterion)) + { +<?php if ($type == CreoleTypes::DATE): ?> + $criterion->addAnd($c->getNewCriterion(<?php echo $this->getPeerClassName() ?>::<?php echo strtoupper($column->getName()) ?>, date('Y-m-d', $this->filters['<?php echo $column->getName() ?>']['to']), Criteria::LESS_EQUAL)); +<?php else: ?> + $criterion->addAnd($c->getNewCriterion(<?php echo $this->getPeerClassName() ?>::<?php echo strtoupper($column->getName()) ?>, $this->filters['<?php echo $column->getName() ?>']['to'], Criteria::LESS_EQUAL)); +<?php endif; ?> + } + else + { +<?php if ($type == CreoleTypes::DATE): ?> + $criterion = $c->getNewCriterion(<?php echo $this->getPeerClassName() ?>::<?php echo strtoupper($column->getName()) ?>, date('Y-m-d', $this->filters['<?php echo $column->getName() ?>']['to']), Criteria::LESS_EQUAL); +<?php else: ?> + $criterion = $c->getNewCriterion(<?php echo $this->getPeerClassName() ?>::<?php echo strtoupper($column->getName()) ?>, $this->filters['<?php echo $column->getName() ?>']['to'], Criteria::LESS_EQUAL); +<?php endif; ?> + } + } + + if (isset($criterion)) + { + $c->add($criterion); + } + } +<?php else: ?> + else if (isset($this->filters['<?php echo $column->getName() ?>']) && $this->filters['<?php echo $column->getName() ?>'] !== '') + { +<?php if ($type == CreoleTypes::CHAR || $type == CreoleTypes::VARCHAR || $type == CreoleTypes::LONGVARCHAR): ?> + $c->add(<?php echo $this->getPeerClassName() ?>::<?php echo strtoupper($column->getName()) ?>, strtr($this->filters['<?php echo $column->getName() ?>'], '*', '%'), Criteria::LIKE); +<?php else: ?> + $c->add(<?php echo $this->getPeerClassName() ?>::<?php echo strtoupper($column->getName()) ?>, $this->filters['<?php echo $column->getName() ?>']); +<?php endif; ?> + } +<?php endif; ?> +<?php endforeach; ?> +<?php endif; ?> + } + + protected function addSortCriteria($c) + { + if ($sort_column = $this->getUser()->getAttribute('sort', null, 'sf_admin/<?php echo $this->getSingularName() ?>/sort')) + { + $sort_column = <?php echo $this->getClassName() ?>Peer::translateFieldName($sort_column, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_COLNAME); + if ($this->getUser()->getAttribute('type', null, 'sf_admin/<?php echo $this->getSingularName() ?>/sort') == 'asc') + { + $c->addAscendingOrderByColumn($sort_column); + } + else + { + $c->addDescendingOrderByColumn($sort_column); + } + } + } + + protected function getLabels() + { + return array( +<?php foreach ($this->getColumnCategories('edit.display') as $category): ?> +<?php foreach ($this->getColumns('edit.display', $category) as $name => $column): ?> + '<?php echo $this->getSingularName() ?>{<?php echo $column->getName() ?>}' => '<?php $label_name = str_replace("'", "\\'", $this->getParameterValue('edit.fields.'.$column->getName().'.name')); echo $label_name ?><?php if ($label_name): ?>:<?php endif ?>', +<?php endforeach; ?> +<?php endforeach; ?> + ); + } +} diff --git a/data/generator/sfPropelAdmin/mailadmin/template/templates/_edit_actions.php b/data/generator/sfPropelAdmin/mailadmin/template/templates/_edit_actions.php new file mode 100644 index 0000000..1d0d720 --- /dev/null +++ b/data/generator/sfPropelAdmin/mailadmin/template/templates/_edit_actions.php @@ -0,0 +1,13 @@ +<ul class="sf_admin_actions"> +<?php $editActions = $this->getParameterValue('edit.actions') ?> +<?php if (null !== $editActions): ?> +<?php foreach ((array) $editActions as $actionName => $params): ?> + <?php if ($actionName == '_delete') continue ?> + <?php echo $this->addCredentialCondition($this->getButtonToAction($actionName, $params, true), $params) ?> +<?php endforeach; ?> +<?php else: ?> + <?php echo $this->getButtonToAction('_list', array(), true) ?> + <?php echo $this->getButtonToAction('_save', array(), true) ?> + <?php echo $this->getButtonToAction('_save_and_add', array(), true) ?> +<?php endif; ?> +</ul> diff --git a/data/generator/sfPropelAdmin/mailadmin/template/templates/_edit_footer.php b/data/generator/sfPropelAdmin/mailadmin/template/templates/_edit_footer.php new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/data/generator/sfPropelAdmin/mailadmin/template/templates/_edit_footer.php diff --git a/data/generator/sfPropelAdmin/mailadmin/template/templates/_edit_form.php b/data/generator/sfPropelAdmin/mailadmin/template/templates/_edit_form.php new file mode 100644 index 0000000..47c385e --- /dev/null +++ b/data/generator/sfPropelAdmin/mailadmin/template/templates/_edit_form.php @@ -0,0 +1,93 @@ +[?php echo form_tag('<?php echo $this->getModuleName() ?>/'.$sf_context->getActionName(), array( + 'id' => 'sf_admin_edit_form', + 'name' => 'sf_admin_edit_form', + 'multipart' => true, +<?php foreach ($this->getColumnCategories('edit.display') as $category): ?> +<?php foreach ($this->getColumns('edit.display', $category) as $name => $column): ?> +<?php if ('admin_double_list' == $this->getParameterValue('edit.fields.'.$column->getName().'.type')): ?> + 'onsubmit' => 'double_list_submit(); return true;' +<?php break 2; ?> +<?php endif; ?> +<?php endforeach; ?> +<?php endforeach; ?> +)) ?] + +<?php foreach ($this->getPrimaryKey() as $pk): ?> +[?php echo object_input_hidden_tag($<?php echo $this->getSingularName() ?>, 'get<?php echo $pk->getPhpName() ?>') ?] +<?php endforeach; ?> + +<?php $first = true ?> +<?php foreach ($this->getColumnCategories('edit.display') as $category): ?> +<?php + if ($category[0] == '-') + { + $category_name = substr($category, 1); + $collapse = true; + + if ($first) + { + $first = false; + echo "[?php use_javascript(sfConfig::get('sf_prototype_web_dir').'/js/prototype') ?]\n"; + echo "[?php use_javascript(sfConfig::get('sf_admin_web_dir').'/js/collapse') ?]\n"; + } + } + else + { + $category_name = $category; + $collapse = false; + } +?> +<fieldset id="sf_fieldset_<?php echo preg_replace('/[^a-z0-9_]/', '_', strtolower($category_name)) ?>" class="<?php if ($collapse): ?> collapse<?php endif; ?>"> +<?php if ($category != 'NONE'): ?><h2>[?php echo __('<?php echo $category_name ?>') ?]</h2> + +<?php endif; ?> + +<?php $hides = $this->getParameterValue('edit.hide', array()) ?> +<?php foreach ($this->getColumns('edit.display', $category) as $name => $column): ?> +<?php if (in_array($column->getName(), $hides)) continue ?> +<?php if ($column->isPrimaryKey()) continue ?> +<?php $credentials = $this->getParameterValue('edit.fields.'.$column->getName().'.credentials') ?> +<?php if ($credentials): $credentials = str_replace("\n", ' ', var_export($credentials, true)) ?> + [?php if ($sf_user->hasCredential(<?php echo $credentials ?>)): ?] +<?php endif; ?> +<?php $only_for = $this->getParameterValue('edit.fields.'.$column->getName().'.only_for'); if($only_for): ?> +[?php if($sf_context->getActionName()=='<?php echo $only_for ?>'): ?] +<?php endif; ?> +<div class="form-row"> + [?php echo label_for('<?php echo $this->getParameterValue("edit.fields.".$column->getName().".label_for", $this->getSingularName()."[".$column->getName()."]") ?>', __($labels['<?php echo $this->getSingularName() ?>{<?php echo $column->getName() ?>}']), '<?php if ($column->isNotNull()): ?>class="required" <?php endif; ?>') ?] + <div class="content[?php if ($sf_request->hasError('<?php echo $this->getSingularName() ?>{<?php echo $column->getName() ?>}')): ?] form-error[?php endif; ?]"> + [?php if ($sf_request->hasError('<?php echo $this->getSingularName() ?>{<?php echo $column->getName() ?>}')): ?] + [?php echo form_error('<?php echo $this->getSingularName() ?>{<?php echo $column->getName() ?>}', array('class' => 'form-error-msg')) ?] + [?php endif; ?] + [?php $value = <?php echo $this->getColumnEditTag($column); ?>; echo $value ? $value : ' ' ?] + <?php echo $this->getHelp($column, 'edit') ?> + </div> +</div> + +<?php if($only_for): ?> +[?php endif; ?] +<?php endif; ?> + +<?php if ($credentials): ?> + [?php endif; ?] +<?php endif; ?> + +<?php endforeach; ?> +</fieldset> +<?php endforeach; ?> + +[?php include_partial('edit_actions', array('<?php echo $this->getSingularName() ?>' => $<?php echo $this->getSingularName() ?>)) ?] + +</form> + +<ul class="sf_admin_actions"> +<?php +/* + * WARNING: delete is a form, it must be outside the main form + */ + $editActions = $this->getParameterValue('edit.actions'); +?> + <?php if (null === $editActions || (null !== $editActions && array_key_exists('_delete', $editActions))): ?> + <?php echo $this->addCredentialCondition($this->getButtonToAction('_delete', $editActions['_delete'], true), $editActions['_delete']) ?> + <?php endif; ?> +</ul> diff --git a/data/generator/sfPropelAdmin/mailadmin/template/templates/_edit_header.php b/data/generator/sfPropelAdmin/mailadmin/template/templates/_edit_header.php new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/data/generator/sfPropelAdmin/mailadmin/template/templates/_edit_header.php diff --git a/data/generator/sfPropelAdmin/mailadmin/template/templates/_edit_messages.php b/data/generator/sfPropelAdmin/mailadmin/template/templates/_edit_messages.php new file mode 100644 index 0000000..2306f05 --- /dev/null +++ b/data/generator/sfPropelAdmin/mailadmin/template/templates/_edit_messages.php @@ -0,0 +1,5 @@ +[?php if ($sf_flash->has('notice')): ?] +<div class="save-ok"> +<h2>[?php echo __($sf_flash->get('notice')) ?]</h2> +</div> +[?php endif; ?] diff --git a/data/generator/sfPropelAdmin/mailadmin/template/templates/_filters.php b/data/generator/sfPropelAdmin/mailadmin/template/templates/_filters.php new file mode 100644 index 0000000..76be382 --- /dev/null +++ b/data/generator/sfPropelAdmin/mailadmin/template/templates/_filters.php @@ -0,0 +1,36 @@ +[?php use_helper('Object') ?] + +<?php if ($this->getParameterValue('list.filters')): ?> +<div id="sf_admin_filters" style="display:none"> +[?php echo form_tag('<?php echo $this->getModuleName() ?>/list', array('method' => 'get')) ?] + + <hr size="1" /> + <h2>[?php echo __('Filters') ?]</h2> +<?php foreach ($this->getColumns('list.filters') as $column): $type = $column->getCreoleType() ?> +<?php $credentials = $this->getParameterValue('list.fields.'.$column->getName().'.credentials') ?> +<?php if ($credentials): $credentials = str_replace("\n", ' ', var_export($credentials, true)) ?> + [?php if ($sf_user->hasCredential(<?php echo $credentials ?>)): ?] +<?php endif; ?> + <div class="form-row"> + <label for="<?php echo $column->getName() ?>">[?php echo __('<?php echo str_replace("'", "\\'", $this->getParameterValue('list.fields.'.$column->getName().'.name')) ?>:') ?]</label> + <div class="content"> + [?php echo <?php echo $this->getColumnFilterTag($column) ?> ?] +<?php if ($this->getParameterValue('list.fields.'.$column->getName().'.filter_is_empty')): ?> + <div>[?php echo checkbox_tag('filters[<?php echo $column->getName() ?>_is_empty]', 1, isset($filters['<?php echo $column->getName() ?>_is_empty']) ? $filters['<?php echo $column->getName() ?>_is_empty'] : null) ?] <label for="filters[<?php echo $column->getName() ?>_is_empty]">[?php echo __('is empty') ?]</label></div> +<?php endif; ?> + </div> + </div> +<?php if ($credentials): ?> + [?php endif; ?] +<?php endif; ?> + + <?php endforeach; ?> + + <div class="formaction"> + [?php echo submit_tag(__('filter'), 'name=filter class=sf_admin_action_filter') ?] + [?php echo button_to(__('reset'), '<?php echo $this->getModuleName() ?>/list?filter=filter', 'class=sf_admin_action_reset_filter') ?] + </div> + +</form> +</div> +<?php endif; ?> diff --git a/data/generator/sfPropelAdmin/mailadmin/template/templates/_list.php b/data/generator/sfPropelAdmin/mailadmin/template/templates/_list.php new file mode 100644 index 0000000..cc85625 --- /dev/null +++ b/data/generator/sfPropelAdmin/mailadmin/template/templates/_list.php @@ -0,0 +1,18 @@ +<table> +<tr> +<?php if ($this->getParameterValue('list.object_actions')): ?> +[?php $c = 0; ?] +<?php foreach ($this->getParameterValue('list.object_actions') as $actionName => $params): ?> + <?php echo $this->addCredentialCondition('[?php $c++; ?]', $params) ?> +<?php endforeach; ?> + <th width="1%" colspan="[?php echo $c ?]" id="sf_admin_list_th_sf_actions">[?php echo __('Actions') ?]</th> +<?php endif; ?> +[?php include_partial('list_th_<?php echo $this->getParameterValue('list.layout', 'tabular') ?>') ?] +</tr> +[?php $i = 1; foreach ($pager->getResults() as $<?php echo $this->getSingularName() ?>): $odd = fmod(++$i, 2) ?] +<tr class="sf_admin_row_[?php echo $odd ?]"> +[?php include_partial('list_td_actions', array('<?php echo $this->getSingularName() ?>' => $<?php echo $this->getSingularName() ?>)) ?] +[?php include_partial('list_td_<?php echo $this->getParameterValue('list.layout', 'tabular') ?>', array('<?php echo $this->getSingularName() ?>' => $<?php echo $this->getSingularName() ?>)) ?] +</tr> +[?php endforeach; ?] +</table> diff --git a/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_actions.php b/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_actions.php new file mode 100644 index 0000000..a13263c --- /dev/null +++ b/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_actions.php @@ -0,0 +1,10 @@ +<ul class="sf_admin_actions"> +<?php $listActions = $this->getParameterValue('list.actions') ?> +<?php if (null !== $listActions): ?> + <?php foreach ((array) $listActions as $actionName => $params): ?> + <?php echo $this->addCredentialCondition($this->getButtonToAction($actionName, $params, false), $params) ?> + <?php endforeach; ?> +<?php else: ?> + <?php echo $this->getButtonToAction('_create', array(), false) ?> +<?php endif; ?> +</ul> diff --git a/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_footer.php b/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_footer.php new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_footer.php diff --git a/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_header.php b/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_header.php new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_header.php diff --git a/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_messages.php b/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_messages.php new file mode 100644 index 0000000..c2eb7c7 --- /dev/null +++ b/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_messages.php @@ -0,0 +1,13 @@ +[?php if ($sf_request->getError('delete')): ?] +<div class="form-errors"> + <h2>Could not delete the selected <?php echo sfInflector::humanize($this->getSingularName()) ?></h2> + <ul> + <li>[?php echo $sf_request->getError('delete') ?]</li> + </ul> +</div> +[?php endif; ?] +[?php if ($sf_flash->has('notice')): ?] +<div class="save-ok"> +<h2>[?php echo image_tag("information.gif","alt=[?]")?] [?php echo __($sf_flash->get('notice')) ?]</h2> +</div> +[?php endif; ?] diff --git a/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_td_actions.php b/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_td_actions.php new file mode 100644 index 0000000..fcaca78 --- /dev/null +++ b/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_td_actions.php @@ -0,0 +1,5 @@ +<?php if ($this->getParameterValue('list.object_actions')): ?> +<?php foreach ($this->getParameterValue('list.object_actions') as $actionName => $params): ?> + <?php echo $this->addCredentialCondition("<td><ul class=\"sf_admin_td_actions\">".$this->getLinkToAction($actionName, $params, true)."</ul></td>", $params) ?> +<?php endforeach; ?> +<?php endif; ?> diff --git a/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_td_stacked.php b/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_td_stacked.php new file mode 100644 index 0000000..0d9e274 --- /dev/null +++ b/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_td_stacked.php @@ -0,0 +1,16 @@ +<td colspan="<?php echo count($this->getColumns('list.display')) ?>"> +<?php if ($this->getParameterValue('list.params')): ?> + <?php echo $this->getI18NString('list.params') ?> +<?php else: ?> +<?php $hides = $this->getParameterValue('list.hide', array()) ?> +<?php foreach ($this->getColumns('list.display') as $column): ?> +<?php if (in_array($column->getName(), $hides)) continue ?> + <?php if ($column->isLink()): ?> + [?php echo link_to(<?php echo $this->getColumnListTag($column) ?> ? <?php echo $this->getColumnListTag($column) ?> : __('-'), '<?php echo $this->getModuleName() ?>/edit?<?php echo $this->getPrimaryKeyUrlParams() ?>) ?] + <?php else: ?> + [?php echo <?php echo $this->getColumnListTag($column) ?> ?] + <?php endif; ?> + - +<?php endforeach; ?> +<?php endif; ?> +</td>
\ No newline at end of file diff --git a/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_td_tabular.php b/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_td_tabular.php new file mode 100644 index 0000000..e4e50bb --- /dev/null +++ b/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_td_tabular.php @@ -0,0 +1,30 @@ +<?php $hs = $this->getParameterValue('list.hide', array()) ?> +<?php foreach ($this->getColumns('list.display') as $column): ?> +<?php if (in_array($column->getName(), $hs)) continue ?> +<?php $credentials = $this->getParameterValue('list.fields.'.$column->getName().'.credentials') ?> +<?php if ($credentials): $credentials = str_replace("\n", ' ', var_export($credentials, true)) ?> + [?php if ($sf_user->hasCredential(<?php echo $credentials ?>)): ?] +<?php endif; ?> + <?php + $user_params = $this->getParameterValue('list.fields.'.$column->getName().'.params'); + $user_params = is_array($user_params) ? sfToolkit::stringToArray($user_params) : $user_params; + ?> + <?php if ($column->isLink()): ?> + + <?php $editcredentials = $this->getParameterValue('list.object_actions.edit.credentials'); ?> + <?php if($editcredentials): $editcredentials = str_replace("\n", ' ', var_export($editcredentials, true)); ?> + [?php if ($sf_user->hasCredential(<?php echo $editcredentials ?>)): ?] + <?php endif; ?> + [?php echo tag('td', <?php echo var_export($user_params, true) ?>, true) ?][?php echo link_to(<?php echo $this->getColumnListTag($column) ?> ? <?php echo $this->getColumnListTag($column) ?> : __('-'), '<?php echo $this->getModuleName() ?>/edit?<?php echo $this->getPrimaryKeyUrlParams() ?>) ?]</td> +<?php if ($editcredentials): ?> + [?php else: ?] + [?php echo tag('td', <?php echo var_export($user_params, true) ?>, true) ?][?php echo <?php echo $this->getColumnListTag($column) ?> ?]</td> + [?php endif; ?] +<?php endif; ?> +<?php else: ?> + [?php echo tag('td', <?php echo var_export($user_params, true) ?>, true) ?][?php echo <?php echo $this->getColumnListTag($column) ?> ?]</td> + <?php endif; ?> +<?php if ($credentials): ?> + [?php endif; ?] +<?php endif; ?> +<?php endforeach; ?> diff --git a/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_th_stacked.php b/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_th_stacked.php new file mode 100644 index 0000000..305bdcf --- /dev/null +++ b/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_th_stacked.php @@ -0,0 +1 @@ +[?php include_partial('list_th_tabular') ?] diff --git a/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_th_tabular.php b/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_th_tabular.php new file mode 100644 index 0000000..4a48eca --- /dev/null +++ b/data/generator/sfPropelAdmin/mailadmin/template/templates/_list_th_tabular.php @@ -0,0 +1,28 @@ +<?php $hides = $this->getParameterValue('list.hide', array()) ?> +<?php foreach ($this->getColumns('list.display') as $column): ?> +<?php if (in_array($column->getName(), $hides)) continue ?> +<?php $credentials = $this->getParameterValue('list.fields.'.$column->getName().'.credentials') ?> +<?php if ($credentials): $credentials = str_replace("\n", ' ', var_export($credentials, true)) ?> + [?php if ($sf_user->hasCredential(<?php echo $credentials ?>)): ?] +<?php endif; ?> + <?php + $user_params = $this->getParameterValue('list.fields.'.$column->getName().'.params'); + $user_params = is_array($user_params) ? $user_params : sfToolkit::stringToArray($user_params); + $user_params['id'] = "sf_admin_list_th_".$column->getName(); + ?> + [?php echo tag('th', <?php echo var_export($user_params, true) ?>, true) ?] + <?php if ($column->isReal()): ?> + [?php if ($sf_user->getAttribute('sort', null, 'sf_admin/<?php echo $this->getSingularName() ?>/sort') == '<?php echo $column->getName() ?>'): ?] + [?php echo link_to(__('<?php echo str_replace("'", "\\'", $this->getParameterValue('list.fields.'.$column->getName().'.name')) ?>'), '<?php echo $this->getModuleName() ?>/list?sort=<?php echo $column->getName() ?>&type='.($sf_user->getAttribute('type', 'asc', 'sf_admin/<?php echo $this->getSingularName() ?>/sort') == 'asc' ? 'desc' : 'asc')) ?][?php $sorttype = $sf_user->getAttribute('type', 'asc','sf_admin/<?php echo$this->getSingularName() ?>/sort'); if($sorttype=='images') $sorttype = 'desc'; ?][?php echo image_tag('sort-'.$sorttype.'.gif', array('alt' => __($sorttype), 'border' => 0)) ?] + [?php else: ?] + [?php echo link_to(__('<?php echo str_replace("'", "\\'", $this->getParameterValue('list.fields.'.$column->getName().'.name')) ?>'), '<?php echo $this->getModuleName() ?>/list?sort=<?php echo $column->getName() ?>&type=asc') ?] + [?php endif; ?] + <?php else: ?> + [?php echo __('<?php echo str_replace("'", "\\'", $this->getParameterValue('list.fields.'.$column->getName().'.name')) ?>') ?] + <?php endif; ?> + <?php echo $this->getHelpAsIcon($column, 'list') ?> + </th> +<?php if ($credentials): ?> + [?php endif; ?] +<?php endif; ?> +<?php endforeach; ?> diff --git a/data/generator/sfPropelAdmin/mailadmin/template/templates/_pager.php b/data/generator/sfPropelAdmin/mailadmin/template/templates/_pager.php new file mode 100644 index 0000000..818d925 --- /dev/null +++ b/data/generator/sfPropelAdmin/mailadmin/template/templates/_pager.php @@ -0,0 +1,13 @@ +[?php if($pager->getNbResults() > 25 || $pager->haveToPaginate()): ?] +<div class="tablenavigation"> +<ul> +[?php if($pager->haveToPaginate()): ?] +<li><span class="pageinfo">Page <span class="pageindex">[?php echo $pager->getPage() ?]</span> of <span class="pageindex">[?php echo $pager->getLastPage() ?]</span></span></li> +<li>[?php if($pager->getPage()!=$pager->getFirstPage()): ?][?php echo link_to(image_tag("first.gif", array('border' => 0, 'alt' => __('First'), 'title' => __('First'))), '<?php echo $this->getModuleName() ?>/list?page='.$pager->getFirstPage()) ?]</a> +[?php echo link_to(image_tag("previous.gif", array('border' => 0, 'alt' => __('Previous'), 'title' => __('Previous'))), '<?php echo $this->getModuleName() ?>/list?page='.$pager->getPreviousPage()) ?]</a>[?php endif; ?] +[?php if($pager->getPage()!=$pager->getLastPage()): ?][?php echo link_to(image_tag("next.gif", array('border' => 0, 'alt' => __('Next'), 'title' => __('Next'))), '<?php echo $this->getModuleName() ?>/list?page='.$pager->getNextPage()) ?] +[?php echo link_to(image_tag("last.gif", array('border' => 0, 'alt' => __('Last'), 'title' => __('Last'))), '<?php echo $this->getModuleName() ?>/list?page='.$pager->getLastPage()) ?][?php endif; ?]</li> +[?php endif; ?] +</ul> +</div> +[?php endif; ?] diff --git a/data/generator/sfPropelAdmin/mailadmin/template/templates/editSuccess.php b/data/generator/sfPropelAdmin/mailadmin/template/templates/editSuccess.php new file mode 100644 index 0000000..2727a2c --- /dev/null +++ b/data/generator/sfPropelAdmin/mailadmin/template/templates/editSuccess.php @@ -0,0 +1,20 @@ +[?php use_helper('Object', 'Validation', 'ObjectAdmin', 'I18N', 'Date') ?] + +<div id="context"> + +<h1>[?php echo ($sf_context->getActionName()=='create' ? <?php echo $this->getI18NString('create.title', 'create '.$this->getModuleName(), false) ?>: <?php echo $this->getI18NString('edit.title', 'edit '.$this->getModuleName(), false) ?>) ?]</h1> + +<div id="sf_admin_header"> +[?php include_partial('<?php echo $this->getModuleName() ?>/edit_header', array('<?php echo $this->getSingularName() ?>' => $<?php echo $this->getSingularName() ?>)) ?] +</div> + +<div id="sf_admin_content"> +[?php include_partial('<?php echo $this->getModuleName() ?>/edit_messages', array('<?php echo $this->getSingularName() ?>' => $<?php echo $this->getSingularName() ?>, 'labels' => $labels)) ?] +[?php include_partial('<?php echo $this->getModuleName() ?>/edit_form', array('<?php echo $this->getSingularName() ?>' => $<?php echo $this->getSingularName() ?>, 'labels' => $labels)) ?] +</div> + +<div id="sf_admin_footer"> +[?php include_partial('<?php echo $this->getModuleName() ?>/edit_footer', array('<?php echo $this->getSingularName() ?>' => $<?php echo $this->getSingularName() ?>)) ?] +</div> + +</div> diff --git a/data/generator/sfPropelAdmin/mailadmin/template/templates/listSuccess.php b/data/generator/sfPropelAdmin/mailadmin/template/templates/listSuccess.php new file mode 100644 index 0000000..c92aaf4 --- /dev/null +++ b/data/generator/sfPropelAdmin/mailadmin/template/templates/listSuccess.php @@ -0,0 +1,38 @@ +[?php use_helper('I18N', 'Date', 'Tag', 'Javascript') ?] + +<div id="context"> + +<h1><?php echo $this->getI18NString('list.title', $this->getModuleName().' list') ?></h1> + +<div id="sf_admin_header"> +[?php include_partial('<?php echo $this->getModuleName() ?>/list_header', array('pager' => $pager)) ?] +[?php include_partial('<?php echo $this->getModuleName() ?>/list_messages', array('pager' => $pager)) ?] +</div> + +<div id="sf_admin_content"> +<span class="summary"><b>[?php echo __('Results') ?]:</b> [?php echo $pager->getNbResults() ?]</span><span class="summary"><b>Entries per Page:</b> [?php echo select_tag("resultsperpage", options_for_select(<?php $opt = $this->getParameterValue('list.max_per_page_options', array(10,25,50,100)); var_export(@array_combine($opt,$opt)); ?>, $pager->getMaxPerPage()), array("onchange" => "document.location.href = '".url_for('<?php echo $this->getModuleName() ?>/list')."?max_per_page='+this.value")) ?]</span><?php if ($this->getParameterValue('list.filters')): ?><span class="summary toggle">[?php echo link_to_function(__('Toggle Filter Settings'), visual_effect('toggle_blind', 'sf_admin_filters' )) ?]</span> +<?php endif; ?> + +<?php if ($this->getParameterValue('list.filters')): ?> +<div id="sf_admin_bar"> +[?php include_partial('filters', array('filters' => $filters)) ?] +</div> +<?php endif; ?> + +[?php include_partial('pager', array('pager' => $pager, 'location' => 'top')) ?] +<hr size="1" /> +[?php if (!$pager->getNbResults()): ?] +[?php echo __('no result') ?] +[?php else: ?] +[?php include_partial('<?php echo $this->getModuleName() ?>/list', array('pager' => $pager)) ?] +[?php endif; ?] +<hr size="1" /> +[?php include_partial('pager', array('pager' => $pager, 'location' => 'bottom')) ?] +[?php include_partial('list_actions') ?] +</div> + +<div id="sf_admin_footer"> +[?php include_partial('<?php echo $this->getModuleName() ?>/list_footer', array('pager' => $pager)) ?] +</div> + +</div> diff --git a/data/sql/lib.model.schema.sql b/data/sql/lib.model.schema.sql new file mode 100644 index 0000000..ffbe542 --- /dev/null +++ b/data/sql/lib.model.schema.sql @@ -0,0 +1,181 @@ + +# This is a fix for InnoDB in MySQL >= 4.1.x +# It "suspends judgement" for fkey relationships until are tables are set. +SET FOREIGN_KEY_CHECKS = 0; + +#----------------------------------------------------------------------------- +#-- role +#----------------------------------------------------------------------------- + +DROP TABLE IF EXISTS `role`; + + +CREATE TABLE `role` +( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `name` VARCHAR(255), + `credentials` VARCHAR(255), + PRIMARY KEY (`id`) +)Type=MyISAM; + +#----------------------------------------------------------------------------- +#-- user +#----------------------------------------------------------------------------- + +DROP TABLE IF EXISTS `user`; + + +CREATE TABLE `user` +( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `parent_user_id` INTEGER default -1, + `nickname` VARCHAR(50), + `first_name` VARCHAR(100), + `last_name` VARCHAR(100), + `email` VARCHAR(255), + `sha1_password` VARCHAR(40), + `salt` VARCHAR(32), + `role_id` INTEGER, + `last_login` DATETIME, + `created_at` DATETIME, + PRIMARY KEY (`id`), + INDEX `user_FI_1` (`parent_user_id`), + CONSTRAINT `user_FK_1` + FOREIGN KEY (`parent_user_id`) + REFERENCES `user` (`id`) + ON DELETE SET NULL, + INDEX `user_FI_2` (`role_id`), + CONSTRAINT `user_FK_2` + FOREIGN KEY (`role_id`) + REFERENCES `role` (`id`) +)Type=MyISAM; + +#----------------------------------------------------------------------------- +#-- domain_permission +#----------------------------------------------------------------------------- + +DROP TABLE IF EXISTS `domain_permission`; + + +CREATE TABLE `domain_permission` +( + `user_id` INTEGER, + `domain_id` INTEGER, + `id` INTEGER NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`id`), + INDEX `domain_permission_FI_1` (`user_id`), + CONSTRAINT `domain_permission_FK_1` + FOREIGN KEY (`user_id`) + REFERENCES `user` (`id`) + ON DELETE CASCADE, + INDEX `domain_permission_FI_2` (`domain_id`), + CONSTRAINT `domain_permission_FK_2` + FOREIGN KEY (`domain_id`) + REFERENCES `domain` (`id`) + ON DELETE CASCADE +)Type=MyISAM; + +#----------------------------------------------------------------------------- +#-- domain +#----------------------------------------------------------------------------- + +DROP TABLE IF EXISTS `domain`; + + +CREATE TABLE `domain` +( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `name` VARCHAR(255), + `creator_id` INTEGER, + `mailbox_prefix` VARCHAR(255), + `max_mailbox_count` INTEGER, + `quota` INTEGER, + `default_mailbox_quota` INTEGER, + PRIMARY KEY (`id`), + UNIQUE KEY `i2` (`name`), + INDEX `domain_FI_1` (`creator_id`), + CONSTRAINT `domain_FK_1` + FOREIGN KEY (`creator_id`) + REFERENCES `user` (`id`) + ON DELETE SET NULL +)Type=MyISAM; + +#----------------------------------------------------------------------------- +#-- mailbox +#----------------------------------------------------------------------------- + +DROP TABLE IF EXISTS `mailbox`; + + +CREATE TABLE `mailbox` +( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `domain_id` INTEGER, + `name` VARCHAR(30), + `password` VARCHAR(40), + `max_quota` INTEGER, + `max_address_count` INTEGER, + `last_login` DATETIME, + `active` INTEGER default 1, + PRIMARY KEY (`id`), + INDEX `mailbox_FI_1` (`domain_id`), + CONSTRAINT `mailbox_FK_1` + FOREIGN KEY (`domain_id`) + REFERENCES `domain` (`id`) + ON DELETE SET NULL +)Type=MyISAM; + +#----------------------------------------------------------------------------- +#-- address +#----------------------------------------------------------------------------- + +DROP TABLE IF EXISTS `address`; + + +CREATE TABLE `address` +( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `mailbox_id` INTEGER, + `localpart` VARCHAR(255), + `domain_id` INTEGER, + `alias` VARCHAR(255), + `destination` TEXT, + `active` INTEGER default 1, + `save_in_mailbox` INTEGER default 1, + PRIMARY KEY (`id`), + INDEX `address_FI_1` (`mailbox_id`), + CONSTRAINT `address_FK_1` + FOREIGN KEY (`mailbox_id`) + REFERENCES `mailbox` (`id`) + ON DELETE CASCADE, + INDEX `address_FI_2` (`domain_id`), + CONSTRAINT `address_FK_2` + FOREIGN KEY (`domain_id`) + REFERENCES `domain` (`id`) +)Type=MyISAM; + +#----------------------------------------------------------------------------- +#-- log +#----------------------------------------------------------------------------- + +DROP TABLE IF EXISTS `log`; + + +CREATE TABLE `log` +( + `id` INTEGER NOT NULL AUTO_INCREMENT, + `user_id` INTEGER default null, + `created_at` DATETIME, + `message` TEXT, + `host` VARCHAR(255), + `priority` INTEGER, + PRIMARY KEY (`id`), + INDEX `log_FI_1` (`user_id`), + CONSTRAINT `log_FK_1` + FOREIGN KEY (`user_id`) + REFERENCES `user` (`id`) + ON DELETE SET NULL +)Type=MyISAM; + +# This restores the fkey checks, after having unset them earlier +SET FOREIGN_KEY_CHECKS = 1; diff --git a/data/sql/sqldb.map b/data/sql/sqldb.map new file mode 100644 index 0000000..83d47c5 --- /dev/null +++ b/data/sql/sqldb.map @@ -0,0 +1,2 @@ +# Sqlfile -> Database map +lib.model.schema.sql=propel |