Permalink
Browse files

creation of the General Settings view

  • Loading branch information...
Filippo
Filippo committed Jul 25, 2010
1 parent ca3cfd8 commit 49dc21ef9062bee4805f0b8b11e59601d7738b37
Showing with 193 additions and 405 deletions.
  1. +52 −60 apps/fe/modules/sfGuardUser/templates/indexSuccess.php
  2. +6 −1 apps/fe/templates/layout.php
  3. BIN data/phpcollab_unit_test.db
  4. +1 −4 plugins/fdEventsListenersPlugin/test/unit/EventListenerTest.php
  5. +6 −0 plugins/idProjectManagementPlugin/config/routing.yml
  6. +19 −1 plugins/idProjectManagementPlugin/lib/generator/LogMessageGenerator.php
  7. +5 −1 plugins/idProjectManagementPlugin/lib/model/doctrine/PluginLogTime.class.php
  8. +5 −1 plugins/idProjectManagementPlugin/lib/model/doctrine/PluginPriority.class.php
  9. +5 −1 plugins/idProjectManagementPlugin/lib/model/doctrine/PluginStatus.class.php
  10. +5 −0 plugins/idProjectManagementPlugin/lib/model/doctrine/PluginTracker.class.php
  11. +0 −19 plugins/idProjectManagementPlugin/modules/idIssue/actions/actions.class.php
  12. +2 −6 plugins/idProjectManagementPlugin/modules/idIssue/templates/showSuccess.php
  13. +0 −25 plugins/idProjectManagementPlugin/modules/idLogtime/actions/actions.class.php
  14. +0 −2 plugins/idProjectManagementPlugin/modules/idLogtime/templates/reportAllUsersForProjectSuccess.php
  15. +1 −2 plugins/idProjectManagementPlugin/modules/idLogtime/templates/reportSuccess.php
  16. +0 −8 plugins/idProjectManagementPlugin/modules/idMessage/actions/actions.class.php
  17. +0 −14 plugins/idProjectManagementPlugin/modules/idMilestone/actions/actions.class.php
  18. +15 −29 plugins/idProjectManagementPlugin/modules/idPriority/actions/actions.class.php
  19. +0 −4 plugins/idProjectManagementPlugin/modules/idProfile/actions/actions.class.php
  20. +3 −13 plugins/idProjectManagementPlugin/modules/idProject/actions/actions.class.php
  21. +3 −6 plugins/idProjectManagementPlugin/modules/idProject/templates/_create_project_menu.php
  22. +1 −17 plugins/idProjectManagementPlugin/modules/idStatus/actions/actions.class.php
  23. +0 −7 plugins/idProjectManagementPlugin/modules/idTracker/actions/actions.class.php
  24. +3 −7 plugins/idProjectManagementPlugin/modules/idTracker/templates/indexSuccess.php
  25. +2 −1 test/functional/fe/adminNavigationMenuTest.php
  26. +2 −1 test/functional/fe/idProjectShowAsUserTest.php
  27. +4 −7 test/functional/fe/idProjectUserCreateTest.php
  28. +5 −5 test/functional/fe/idProjectUserDeleteTest.php
  29. +21 −108 test/functional/fe/idProjectUserShowSortingTest.php
  30. +25 −51 test/functional/fe/idProjectUserViewTest.php
  31. +2 −4 test/functional/fe/sfGuardUserSubNavigationMenuTest.php
@@ -5,72 +5,64 @@
'configuration' => $configuration,
'module_name' => 'user',
'fields' => array('username',
- 'is_active',
- 'groups_list',
- 'permissions_list'),
+ 'groups_list'),
)); ?>
-<div class="block" id="block-tables">
- <?php include_partial('idProject/sf_guard_create_menu', array('module_name' => 'user')); ?>
- <div class="content">
- <h2 class="title"><?php echo __('Users list') ?></h2>
- <div class="inner">
-
- <?php if ($pager->getNbResults() > 0): ?>
-
- <table class="table">
- <tr>
- <th class="first">&nbsp;</th>
- <?php include_partial('sfGuardUser/sf_guard_th_as_ordering_links', array(
- 'sort' => $sort,
- 'module_name' => 'user',
- 'fields' => array(
- $prefix_for_sf_guard_user_field.'.username',
- $prefix_for_profile.'.first_name',
- $prefix_for_profile.'.last_name',
- $prefix_for_profile.'.email',
- $prefix_for_sf_guard_user_field.'.created_at'
- )
- )); ?>
+<div class="span-23" id="content">
+ <div class="span-full last project-navigation">
+ <ul>
+ <li><?php echo link_to('Users', '@sf_guard_user'); ?></li>
+ <li><?php echo link_to('Groups', '@sf_guard_group'); ?></li>
+ <li><?php echo link_to('Permissions', '@sf_guard_permission'); ?></li>
+ </ul>
+ </div>
- <th class="last"><?php echo __('Actions') ?></th>
- </tr>
+ <div class="span-full">
+ <div class="title">
+ <span>Users</span>
+ <a id="add-user"class="button block-green medium-round" href="<?php echo url_for('@sf_guard_user_new') ?>">Add</a>
+ </div>
+ <div class="menu">
+ <div class="span-5"><?php echo link_to(__('Username'), 'sfGuardUser/index?sort=s.username&sort_type='.('s.username' == $sort[0] && $sort[1] == 'asc' ? 'desc' : 'asc')) ?></div>
+ <div class="span-5"><?php echo link_to(__('First Name'), 'sfGuardUser/index?sort=p.first_name&sort_type='.('p.first_name' == $sort[0] && $sort[1] == 'asc' ? 'desc' : 'asc')) ?></div>
+ <div class="span-5"><?php echo link_to(__('Last Name'), 'sfGuardUser/index?sort=p.last_name&sort_type='.('p.last_name' == $sort[0] && $sort[1] == 'asc' ? 'desc' : 'asc')) ?></div>
+ <div class="span-6 right last append-1">E-mail</div>
+ </div>
- <?php foreach ($pager->getResults() as $i => $sf_guard_user): $odd = fmod(++$i, 2) ? 'odd' : 'even' ?>
- <tr class="<?php echo $odd ?>">
- <td class="first">&nbsp;</td>
- <td>
- <?php echo link_to($sf_guard_user['username'], 'sf_guard_user_edit', $sf_guard_user) ?>
- </td>
- <td><?php echo $sf_guard_user->Profile->first_name ?></td>
- <td><?php echo $sf_guard_user->Profile->last_name ?></td>
- <td><?php echo $sf_guard_user->Profile->email ?></td>
- <td>
- <?php echo $sf_guard_user['created_at'] ? format_date($sf_guard_user['created_at'], "f") : '&nbsp;' ?>
- </td>
-
- <td>
- <?php include_partial('idProject/sf_guard_actions', array('sf_guard_object' => $sf_guard_user, 'module_name' => 'user')); ?>
- </td>
-
- </tr>
+ <ul class="action">
+ <?php if ($pager->getNbResults() > 0): ?>
+ <?php foreach ($pager->getResults() as $user): ?>
+ <li class="icon-group">
+ <ul>
+ <li class="span-5"><?php echo link_to($user['username'], 'sf_guard_user_edit', $user) ?>&nbsp;</li>
+ <li class="span-5"><?php echo $user->Profile->first_name ?>&nbsp;</li>
+ <li class="span-5"><?php echo $user->Profile->last_name ?>&nbsp;</li>
+ <li class="span-7 right last append-1"><?php echo $user->Profile->email ?>&nbsp;</li>
+ <li class="edit-delete">
+ <?php echo link_to(__('Edit'), '@sf_guard_user_edit?id='.$user->getId()) ?>
+ <?php echo link_to(__('Delete'), '@sf_guard_user_delete?id='.$user->getId(), array('confirm' => __('Do you really want to delete this user?'))) ?>
+ </li>
+ </ul>
+ </li>
<?php endforeach; ?>
+ <?php else: ?>
+ <li>
+ <ul>
+ <li class="span-3"></li>
+ <li class="span-15">No users</li>
+ <li class="span-4 right last"></li>
+ </ul>
+ </li>
+ <?php endif; ?>
+ </ul>
- <?php if ($pager->haveToPaginate()): ?>
- <tr class="even">
- <td colspan="7">
- <?php include_partial('sfGuardUser/pagination', array('pager' => $pager)) ?>
- <br/>
- <?php echo __('(page %%page%%/%%nb_pages%%)', array('%%page%%' => $pager->getPage(), '%%nb_pages%%' => $pager->getLastPage()), 'sf_admin') ?>
- </td>
- </tr>
- <?php endif; ?>
-
-
- </table>
-
- <?php endif; ?>
-
+ <?php if($pager->haveToPaginate()):?>
+ <div class="span-full pagenation">
+ <ul>
+ <?php echo pager_navigation_log_time($pager, '@collab_settings') ?>
+ </ul>
</div>
+ <?php endif; ?>
+
</div>
</div>
@@ -15,7 +15,12 @@
<div class="container">
<?php if ($sf_user->isAuthenticated()) : ?>
<div id="utility" class="showgrid-off">
- Hello, <?php echo link_to($sf_user->getUsername(), '@edit_profile') ?> <a href="<?php echo url_for('@sf_guard_signout') ?>" class="login">Logout</a> <a href="#" class="settings">Settings</a> <a href="#" class="help">Help</a>
+ Hello, <?php echo link_to($sf_user->getUsername(), '@edit_profile') ?>
+ <a href="<?php echo url_for('@sf_guard_signout') ?>" class="login">Logout</a>
+ <?php if ($sf_user->isAdmin()):?>
+ <a href="<?php echo url_for('@collab_settings')?>" class="settings">Settings</a>
+ <?php endif; ?>
+ <a href="#" class="help">Help</a>
<select>
<?php foreach($sf_user->getMyProjects() as $project): ?>
<option><?php echo $project->name ?></option>
View
Binary file not shown.
@@ -7,9 +7,6 @@
new sfDatabaseManager($configuration);
Doctrine::loadData(sfConfig::get('sf_test_dir').'/fixtures/fixtures.yml');
-//1) Generazione evento
-//2) Catch dell'evento da parte dell'EventListener
-//3) Salvataggio dell'evento sul database
class stub {}
@@ -21,7 +18,7 @@ class stub {}
$t->is('stub_namespace', $namespace, '::extracNamespace() extract the right value');
$action = EventListener::extracAction($event);
-$t->is('creation', $action, '::extracNamespace() extract the right value');
+$t->is('creation', $action, '::extracAction() extract the right value');
$event = new sfEvent(new stub, 'stub_namespace.creation', array('project_id' => '1000'));
$message = EventListener::processParameters($event);
@@ -1,3 +1,9 @@
+collab_settings:
+ url: /:sf_culture/settings
+ param: { module: sfGuardUser, action: index}
+ requirements:
+ sf_culture: (?:en|it)
+
sf_guard_signin:
url: /:sf_culture/login
param: { module: sfGuardAuth, action: signin}
@@ -51,14 +51,32 @@ public static function generate($user, $action, $object)
return $user_ref.ucfirst($action).$suffix.' '. ucfirst(get_class($object)) .' '.$link_to_object;
}
+ private static function getProjectId(Doctrine_Event $event)
+ {
+ $object = $event->getInvoker();
+ switch (get_class($object))
+ {
+ case 'Priority':
+ case 'Status':
+ case 'Tracker':
+ return null;
+ case 'LogTime':
+ return $object->issue->project_id;
+ case 'Project':
+ return $event->getInvoker()->id;
+ default :
+ return $event->getInvoker()->project_id;
+ }
+ }
+
public static function storeFromDoctrineEvent($message, $action, Doctrine_Event $event)
{
$event_log = new self::$log_class;
$event_log->setNamespace(strtolower(get_class($event->getInvoker())));
$event_log->setAction($action);
$event_log->setMessage($message);
$event_log->setCreatedAt(date('Y-m-d H:i:s'));
- $project_id = ($event->getInvoker() instanceof Project) ? $event->getInvoker()->id : $event->getInvoker()->project_id;
+ $project_id = self::getProjectId($event);
$event_log->setProjectId($project_id);
$event_log->save();
@@ -5,5 +5,9 @@
*/
abstract class PluginLogTime extends BaseLogTime
{
-
+ public function setUp()
+ {
+ parent::setUp();
+ $this->addListener(new EventLogDoctrineListener());
+ }
}
@@ -21,5 +21,9 @@
*/
abstract class PluginPriority extends BasePriority
{
-
+ public function setUp()
+ {
+ parent::setUp();
+ $this->addListener(new EventLogDoctrineListener());
+ }
}
@@ -21,5 +21,9 @@
*/
abstract class PluginStatus extends BaseStatus
{
-
+ public function setUp()
+ {
+ parent::setUp();
+ $this->addListener(new EventLogDoctrineListener());
+ }
}
@@ -5,4 +5,9 @@
*/
abstract class PluginTracker extends BaseTracker
{
+ public function setUp()
+ {
+ parent::setUp();
+ $this->addListener(new EventLogDoctrineListener());
+ }
}
@@ -28,7 +28,6 @@ class idIssueActions extends sfActions
*/
public function executeIndex(sfWebRequest $request)
{
- $this->forwardUnless($this->getUser()->hasCredential('idIssue-Read'), sfConfig::get('sf_secure_module'), sfConfig::get('sf_secure_action'));
$this->forward404Unless($this->project = Doctrine::getTable('Project')->findOneBy('id', $request->getParameter('project_id')));
$this->pager = new sfDoctrinePager('Issue',10);
@@ -44,8 +43,6 @@ public function executeIndex(sfWebRequest $request)
*/
public function executeShow(sfWebRequest $request)
{
- $this->forwardUnless($this->getUser()->hasCredential('idIssue-Read'), sfConfig::get('sf_secure_module'), sfConfig::get('sf_secure_action'));
-
$this->issue = Doctrine::getTable('Issue')->getIssueById($request->getParameter('issue_id'));
$this->forward404Unless($this->issue && $this->issue->project_id == $request->getParameter('project_id'));
@@ -72,8 +69,6 @@ public function executeShow(sfWebRequest $request)
*/
public function executeNew(sfWebRequest $request)
{
- $this->forwardUnless($this->getUser()->hasCredential('idIssue-Create'), sfConfig::get('sf_secure_module'), sfConfig::get('sf_secure_action'));
-
$this->forward404Unless(!is_null($this->project = Doctrine::getTable('Project')->find(array($request->getParameter('project_id')))));
$this->form = new idIssueForm($request->getParameter('project_id'));
$this->form->setDefault('project_id', $request->getParameter('project_id'));
@@ -88,8 +83,6 @@ public function executeNew(sfWebRequest $request)
*/
public function executeCreate(sfWebRequest $request)
{
- $this->forwardUnless($this->getUser()->hasCredential('idIssue-Create'), sfConfig::get('sf_secure_module'), sfConfig::get('sf_secure_action'));
-
$this->forward404Unless($request->isMethod('post'));
$this->forward404Unless(!is_null($this->project = Doctrine::getTable('Project')->find(array($request->getParameter('project_id')))));
@@ -107,8 +100,6 @@ public function executeCreate(sfWebRequest $request)
*/
public function executeEdit(sfWebRequest $request)
{
- $this->forwardUnless($this->getUser()->hasCredential('idIssue-Edit'), sfConfig::get('sf_secure_module'), sfConfig::get('sf_secure_action'));
-
$this->forward404Unless(!is_null($this->project = Doctrine::getTable('Project')->find(array($request->getParameter('project_id')))));
$this->forward404Unless($issue = Doctrine::getTable('Issue')->find(array($request->getParameter('issue_id'))), sprintf('Object issue does not exist (%s).', array($request->getParameter('issue_id'))));
@@ -124,8 +115,6 @@ public function executeEdit(sfWebRequest $request)
*/
public function executeUpdate(sfWebRequest $request)
{
- $this->forwardUnless($this->getUser()->hasCredential('idIssue-Edit'), sfConfig::get('sf_secure_module'), sfConfig::get('sf_secure_action'));
-
$this->forward404Unless($request->isMethod('post') || $request->isMethod('put'));
$this->forward404Unless(!is_null($this->project = Doctrine::getTable('Project')->find(array($request->getParameter('project_id')))));
$this->forward404Unless($issue = Doctrine::getTable('Issue')->find(array($request->getParameter('issue_id'))), sprintf('Object issue does not exist (%s).', array($request->getParameter('issue_id'))));
@@ -144,8 +133,6 @@ public function executeUpdate(sfWebRequest $request)
*/
public function executeDelete(sfWebRequest $request)
{
- $this->forwardUnless($this->getUser()->hasCredential('idIssue-Delete'), sfConfig::get('sf_secure_module'), sfConfig::get('sf_secure_action'));
-
$this->forward404Unless(!is_null($this->project = Doctrine::getTable('Project')->find(array($request->getParameter('project_id')))));
$this->forward404Unless($issue = Doctrine::getTable('Issue')->find(array($request->getParameter('issue_id'))), sprintf('Object issue does not exist (%s).', array($request->getParameter('issue_id'))));
$request->checkCSRFProtection();
@@ -158,8 +145,6 @@ public function executeDelete(sfWebRequest $request)
public function executeSetEstimatedTime(sfWebRequest $request)
{
- $this->forwardUnless($this->getUser()->hasCredential('idIssue-Edit'), sfConfig::get('sf_secure_module'), sfConfig::get('sf_secure_action'));
-
$this->forward404Unless($request->isMethod('post') || $request->isMethod('put'));
$this->forward404Unless($issue = Doctrine::getTable('Issue')->find(array($request->getParameter('issue_id'))), sprintf('Object issue does not exist (%s).', array($request->getParameter('issue_id'))));
@@ -168,10 +153,6 @@ public function executeSetEstimatedTime(sfWebRequest $request)
if ($form->isValid())
{
$issue = $form->save();
- $this->dispatcher->notify(new sfEvent($issue,
- 'issue.set_estimated_time_success',
- array('log_message' => LogMessageGenerator::generate($this->getUser(), 'Set estimated time to '.$issue->estimated_time.' hours', $issue),
- 'project_id' => $issue->project_id)));
$this->redirect('@show_issue?project_id='.$issue->project_id.'&issue_id='.$issue->id);
}
@@ -67,12 +67,8 @@
<div class="span-12 last">
<div class="span-6 key">
Log time: <?php echo $issue->getTotalLogTime(); ?><br/>
- <?php if ($sf_user->hasCredential('idLogotime-ReadReport')): ?>
- <?php echo link_to(__('My log time report'), '@log_time_report_issue_actual_user?issue_id='.$issue->getId()) ?><br />
- <?php endif; ?>
- <?php if ($sf_user->hasCredential('idLogotime-ReadReport')): ?>
- <?php echo link_to(__('All users log time report'), '@log_time_report_issue_all_users?issue_id='.$issue->getId()) ?>
- <?php endif; ?>
+ <?php echo link_to(__('My log time report'), '@log_time_report_issue_actual_user?issue_id='.$issue->getId()) ?><br />
+ <?php echo link_to(__('All users log time report'), '@log_time_report_issue_all_users?issue_id='.$issue->getId()) ?>
</div>
<div class="span-6 last">
<form action="<?php echo url_for('@set_log_time_from_issue?issue_id='.$issue->getId()); ?>" method="post" class="form">
Oops, something went wrong.

0 comments on commit 49dc21e

Please sign in to comment.