Skip to content
This repository has been archived by the owner on Sep 10, 2021. It is now read-only.

Commit

Permalink
ENH: Removed advanced search
Browse files Browse the repository at this point in the history
Improved user settings
Added user privacy
  • Loading branch information
Charles Marion committed Apr 20, 2011
1 parent ed4b205 commit 22bc0ce
Show file tree
Hide file tree
Showing 20 changed files with 159 additions and 61 deletions.
4 changes: 2 additions & 2 deletions core/controllers/ErrorController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class ErrorController extends AppController
{
public $_models=array();
public $_daos=array();
public $_components=array('NotifyError');
public $_components=array('NotifyError','Utility');
public $_forms=array();
private $_error;
private $_environment;
Expand Down Expand Up @@ -81,7 +81,7 @@ public function errorAction()
}
else
{
$this->getLogger()->warn('URL: '.$this->Utility->curPageURL()."\n".$this->view->message);
$this->getLogger()->warn('URL: '.$this->Component->NotifyError->curPageURL()."\n".$this->view->message);
}

}
Expand Down
5 changes: 0 additions & 5 deletions core/controllers/SearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,6 @@ private function formatResults($order,$items,$folders,$communities,$users)
return $resultsArray;
}//formatResults

/** advanced search Action */
public function advancedAction()
{
$this->_helper->layout->disableLayout();
}//advancedAction

/** search live Action */
public function liveAction()
Expand Down
25 changes: 23 additions & 2 deletions core/controllers/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class UserController extends AppController
public $_daos=array(
'User','Folder','Folderpolicygroup','Folderpolicyuser','Group'
);
public $_components=array('Date','Filter');
public $_components=array('Date','Filter','Sortdao');
public $_forms=array(
'User'
);
Expand Down Expand Up @@ -178,7 +178,7 @@ public function settingsAction()
$this->_helper->layout->disableLayout();

$userId=$this->_getParam('userId');
if(isset($userId)&&!$this->userSession->Dao->isAdmin())
if(isset($userId)&&$userId!=$this->userSession->Dao->getKey()&&!$this->userSession->Dao->isAdmin())
{
throw new Zend_Exception('You should be an admin');
}
Expand Down Expand Up @@ -296,6 +296,23 @@ public function settingsAction()
}
}

$communities=array();
$groups=$userDao->getGroups();
foreach($groups as $group)
{
$community=$group->getCommunity();
if(!isset($communities[$community->getKey()]))
{
$community->groups=array();
$communities[$community->getKey()]=$community;
}
$communities[$community->getKey()]->groups[]=$group;
}
$this->Component->Sortdao->field='name';
$this->Component->Sortdao->order='asc';
usort($communities, array($this->Component->Sortdao,'sortByName'));

$this->view->communities=$communities;
$this->view->user=$userDao;
$this->view->thumbnail=$userDao->getThumbnail();
$this->view->jsonSettings=array();
Expand Down Expand Up @@ -325,6 +342,10 @@ public function userpageAction()
else
{
$userDao=$this->User->load($user_id);
if($userDao->getPrivacy()==MIDAS_USER_PRIVATE&&(!isset($this->userSession->Dao)||!$this->userSession->Dao->isAdmin()))
{
throw new Zend_Exception("Permission error");
}
}

if(!$userDao instanceof UserDao)
Expand Down
17 changes: 4 additions & 13 deletions core/controllers/components/NotifyErrorComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,6 @@ public function fatalEror($logger,$mailer)
if(!is_null($e = error_get_last()))
{
$environment = Zend_Registry::get('configGlobal')->environment;
$db = Zend_Registry::get('dbAdapter');
if(method_exists($db,"getProfiler"))
{
$profiler = $db->getProfiler();
}
else
{
$profiler = new Zend_Db_Profiler();
}

switch ($environment) {
case 'production':
Expand All @@ -68,9 +59,9 @@ public function fatalEror($logger,$mailer)
header('content-type: text/plain');
echo $this->getFatalErrorMessage($e);
}
$logger->crit($this->getFatalErrorMessage($e));
}
$logger->__destruct();
$logger->crit($this->getFatalErrorMessage($e));
$logger->__destruct();
}
}

public function warningError($errno, $errstr, $errfile, $errline)
Expand All @@ -91,7 +82,7 @@ public function warningError($errno, $errstr, $errfile, $errline)
}


private function curPageURL()
public function curPageURL()
{
$pageURL = 'http';
if (isset($_SERVER["HTTPS"] )&&$_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
Expand Down
4 changes: 2 additions & 2 deletions core/controllers/forms/UserForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ public function createAccountForm($firstname_value=null,$lastname_value=null,$co

$privacy = new Zend_Form_Element_Radio('privacy');
$privacy->addMultiOptions( array(
MIDAS_USER_PUBLIC => $this->t("Public"),
MIDAS_USER_PRIVATE => $this->t("Private"),
MIDAS_USER_PUBLIC => $this->t("Public (Everyone can access to my information)"),
MIDAS_USER_PRIVATE => $this->t("Private (Nobody can access to my page)"),
))
->setRequired(true)
->setValue(MIDAS_COMMUNITY_PUBLIC);
Expand Down
3 changes: 1 addition & 2 deletions core/layouts/layout.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
<ul>
<li onclick="location.replace(\''.$this->webroot.'/user/userpage\');"><a>'.$this->t('My Page').'</a></li>
<li class="myAccountLink"><a>'.$this->t('My Account').'</a></li>
<li class="modulesLink"><a>'.$this->t('Modules').'</a></li>';
';
if($this->userDao->isAdmin())
{
echo '
Expand Down Expand Up @@ -130,7 +130,6 @@
<input type="text" id="live_search" value="<?= $this->t('Jump to a data, folder...') ?>" autocomplete="off" autocorrect="off" autocapitalize="off" />
<input type="hidden" id="live_search_value" value="init" />
<div id="searchloading" style="display:none"></div>
<a id="advancedSearchLink"><?php echo $this->t('Advanced search')?></a>
</div>
<div class="HeaderAction">
<ul>
Expand Down
5 changes: 5 additions & 0 deletions core/public/css/layout/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ img.thumbnailSmall{
margin-right: 3px;
}

.ui-widget {

font-family: 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif !important;
font-size: 12px!important;
}
/*-------------------------------------------------
TOP
-------------------------------------------------*/
Expand Down
Empty file.
20 changes: 20 additions & 0 deletions core/public/css/user/user.settings.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,27 @@ div#tabsSettings{
margin-right: auto;
}

form#modifyAccount span{
float:left;
width: 80px;
}


form#modifyAccount input[type="text"], form#modifyAccount input[type="password"]{
width: 200px!important;
}

div#accountPrivacy{
margin-left: 100px;
}

div#accountPrivacy label{
width: auto!important;
}

div#imageActual{
float:right;
}

/** Tabs*/

Expand Down
2 changes: 1 addition & 1 deletion core/public/js/layout/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ $(function() {
});

$('#menuUserInfo').click(function(){
globalAuthAsk(json.global.webroot+'/user/userpage');
globalAuthAsk(json.global.webroot+'/user/userpage#tabs-3');
});
$("div.TopDynamicBar .closeButton").click(function()
{
Expand Down
Empty file.
11 changes: 10 additions & 1 deletion core/translation/fr-main.csv
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ Privacy;Confidentialit
Create;Cr�er
Private;Priv�e
Public;Publique
Private (Nobody can access to my page);Priv� (Personne ne peut acc�der � mes informations)
Public (Everyone can access to my information);Publique (Tout le monde peut acc�der � mes informations)
Semi-private;Semi-priv�e
Description;Description
Created;Cr�e
Expand Down Expand Up @@ -149,7 +151,9 @@ Save;Sauver
Please, set the name.;Merci de renseigner le nom.
Manage Community;G�rer Communaut�
Administrators;Administrateurs
Administrator;Administrateur
Moderators;Mod�rateurs
Moderator;Mod�rateur
There is no custom group.;Il n'y a pas de groupe personnalis�.
Create a group;Cr�er un groupe
Edit a group;Editer une groupe
Expand All @@ -162,4 +166,9 @@ All the results;Tous les r
Number of views;Nombre de vues
No result found.;Aucun r�sultat trouv� pour votre recherche.
Show more results.;Montrer plus de r�sultats.
Delete user;Supprimer utilisateur
Delete user;Supprimer utilisateur
Manage Account Information;G�rer le compte utilisateur
Company;Soci�t�
Please select an image file on your computer (2 MB maximum);S�lectionnez un fichier image sur votre ordinateur (2 Mo maximum)
My communities;Mes communaut�s
You don't belong to any community.;Vous ne faites parti d'aucune communaut�.
2 changes: 1 addition & 1 deletion core/views/community/manage.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ $this->headScript()->appendFile($this->coreWebroot.'/public/js/common/common.bro
foreach($this->members as $member)
{
if($i>10)break;
echo "<li><a href='{$this->webroot}/user/{$member->getKey()}'>{$member->getFullName()}</a></li>";
echo "<li>{$this->linkuser($member)}</li>";
}
?>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion core/views/community/view.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ $this->headScript()->appendFile($this->coreWebroot.'/public/js/common/common.bro
foreach($this->members as $member)
{
if($i>10)break;
echo "<li><a href='{$this->webroot}/user/{$member->getKey()}'>{$member->getFullName()}</a></li>";
echo "<li>{$this->linkuser($member)}</li>";
}
?>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion core/views/element/feed.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
}
echo "</div>";
echo "<div class='feedInfo'>";
echo "<a href='{$view->webroot}/user/{$feed->getUser()->getKey()}'>{$feed->getUser()->getFullName()}</a> ";
echo $view->linkuser($feed->getUser()).' ';
switch($type)
{
case MIDAS_FEED_CREATE_COMMUNITY:
Expand Down
21 changes: 21 additions & 0 deletions core/views/helpers/Linkuser.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php
class Zend_View_Helper_Linkuser
{
/** translation helper */
function linkuser($userDao)
{
if($userDao->getPrivacy()==MIDAS_USER_PUBLIC||isset($this->view->userDao)&&$this->view->userDao->isAdmin()||isset($this->view->userDao)&&$userDao->getKey()==$this->view->userDao->getKey())
{
return "<a href='{$this->view->webroot}/user/{$userDao->getKey()}'>{$userDao->getFullName()}</a>";
}
return "{$userDao->getFullName()}";
}//en method t



/** Set view*/
public function setView(Zend_View_Interface $view)
{
$this->view = $view;
}
}// end class
4 changes: 2 additions & 2 deletions core/views/item/view.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ $this->headScript()->appendFile($this->coreWebroot . '/public/js/item/item.view.
{
echo "<tr>";
echo " <td ><a href='{$this->webroot}/download/?items={$this->itemDao->getKey()},{$revision->getRevision()}'>Revision {$revision->getRevision()}</a></td>";
echo " <td>{$this->Date->ago($revision->getDate(),false)} {$this->t('by')} <a href='{$this->webroot}/user/{$revision->getUserId()}'>{$revision->getUser()->getFullName()}</a></td>";
echo " <td>{$this->Date->ago($revision->getDate(),false)} {$this->t('by')} {$this->linkuser($revision->getUser())} </td>";
echo " <td>{$revision->getChanges()}</td>";
echo "</tr>";
$node++;
Expand Down Expand Up @@ -80,7 +80,7 @@ $this->headScript()->appendFile($this->coreWebroot . '/public/js/item/item.view.
</tr>
<tr>
<td><?php echo $this->t('Uploaded by');?></td>
<td><a href="/Midas/MIDAS3/user/<?php echo $this->itemDao->lastrevision->getUser()->getKey()?>"><?php echo $this->itemDao->lastrevision->getUser()->getFullName()?></a></td>
<td><?php echo $this->linkuser($this->itemDao->lastrevision->getUser())?></td>
</tr>
<tr>
<td>Revision</td>
Expand Down
8 changes: 0 additions & 8 deletions core/views/search/advanced.phtml

This file was deleted.

0 comments on commit 22bc0ce

Please sign in to comment.