Furthermore, I send you other notes about your code that I'd like you to take into account for next patches:
1) Sorry for reiteration of the same thing, but please next time don't mix two fixes/enhancements in the same patch (issues 1932 and 1951) because it makes more difficult to analyze them.
2) Indent typos. We do:
switch (condiction)
{
...
}
Instead of:
switch (condition)
{
...
}
Or we do:
...
<?php else: ?>
<ul>
<?php foreach ($item->getCreators(array('inherit' => true)) as $creator): ?>
<li><?php echo link_to(render_title($creator), array($creator, 'module' => 'actor')) ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
Instead of:
<?php else: ?>
<ul>
<?php foreach ($item->getCreators(array('inherit' => true)) as $creator): ?>
<li><?php echo link_to(render_title($creator), array($creator, 'module' => 'actor')) ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
3) Enable debug mode when you are writing new code so you can check errors and common pitfalls. For example, after applying your patch I get three three errors like this in the information object browsew screen:
Notice: Undefined variable: resource in [...]/apps/qubit/modules/informationobject/templates/browseSuccess.php on line 34 Repository
4) If you want to check if the user is authenticated you should do:
- In sf templates: $sf_user->isAuthenticated()
- In sf actions: $this->getUser()->isAuthenticated()
You used:
- QubitAcl::check($this->object, 'update') or
- QubitAcl::check($resource, 'update),
... but it won't work because of two reasons:
- $this->object and $this->resource were not assigned before they are accessed and there is no reason to check only for an object when the browser is showing multiple records.
- QubitAcl::check method checks if a record can be updated by the current user, but based in what the issue description says we only want to check if the user is authenticated into the application.
5) Don't do this:
<?php echo __(sfConfig::get('app_ui_label_repository')) ?>
... because this label is already translatable, this is better:
<?php echo sfConfig::get('app_ui_label_repository') ?>
6) I think that this piece of code
<?php if (sfConfig::get('app_multi_repository')): ?>
<?php echo __('Level') ?>
<?php else: ?>
<?php echo __('Level') ?>
<?php endif; ?>
... could be simplified to:
<?php echo __('Level') ?>
7) Same thing here:
<?php if (sfConfig::get('app_multi_repository')): ?>
<?php echo $item->levelOfDescription ?>
<?php else: ?>
<?php echo $item->levelOfDescription ?>
<?php endif; ?>
8) When we render the repository name we check if it exists:
<?php foreach ($item->getCreators(array('inherit' => true)) as $creator): ?>
<li><?php echo link_to(render_title($creator), array($creator, 'module' => 'actor')) ?></li>
<?php endforeach; ?>
... in some cases you forgot to add the condition and you directly wrote:
<li><?php echo link_to(render_title($creator), array($creator, 'module' => 'actor')) ?></li>
9) Please, don't use tabs, instead use two spaces. If you're using Vim, you can set it up to show whitespaces and tabs, putting these directivos into your vim configuration file ($HOME/.vimrc):
set list
set listchars=tab:»·,trail:·,nbsp:%,extends:>,precedes:<