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

Commit

Permalink
ENH: Fixed small bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles Marion committed Apr 21, 2011
1 parent 6e41da1 commit 04a6f99
Show file tree
Hide file tree
Showing 23 changed files with 167 additions and 59 deletions.
19 changes: 19 additions & 0 deletions core/AppController.php
Expand Up @@ -56,12 +56,30 @@ public function preDispatch()
{
$this->logged=true;
$this->view->logged=true;
$user->Dao->lastAction=date('c');
$this->view->userDao=$user->Dao;
$cookieData = $this->getRequest()->getCookie('recentItems'.$this->userSession->Dao->user_id);
$this->view->recentItems=array();
if(isset($cookieData))
{
$this->view->recentItems= unserialize($cookieData);
$check=$this->_getParam('checkRecentItem');
// check if recent items exit (every 10 minutes)
if(isset($check)||strtotime($user->Dao->lastAction)<strtotime("-1 minute"))
{
echo "yeah";exit;
$modelLoad = new MIDAS_ModelLoader();
$itemModel = $modelLoad->loadModel('Item');
foreach ($this->view->recentItems as $key => $t)
{
$item=$itemModel->load($t->getKey());
if($item==false)
{
unset($this->view->recentItems[$key]);
}
}
setcookie('recentItems'.$this->userSession->Dao->getKey(), serialize($this->view->recentItems), time()+60*60*24*30,'/'); //30 days
}
}
}
else
Expand Down Expand Up @@ -99,6 +117,7 @@ public function preDispatch()
'createFolder'=>$this->t('Create a new Folder'),
'preview'=>$this->t('Preview'),
'download'=>$this->t('Download'),
'downloadLastest'=>$this->t('Download lastest revision'),
'manage'=>$this->t('Manage'),
'edit'=>$this->t('Edit'),
'delete'=>$this->t('Delete'),
Expand Down
2 changes: 1 addition & 1 deletion core/controllers/CommunityController.php
Expand Up @@ -362,7 +362,7 @@ function createAction()
$this->Feedpolicygroup->createPolicy($anonymousGroup,$feed,MIDAS_POLICY_READ);
}

$this->_redirect("/community");
$this->_redirect("/community/".$communityDao->getKey());
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion core/controllers/FolderController.php
Expand Up @@ -52,7 +52,7 @@ public function viewAction()
if(strpos($parent->getName(), 'community')!==false&&$this->Folder->getCommunity($parent)!==false)
{
$community=$this->Folder->getCommunity($parent);
$header=" <li class='pathCommunity'><img alt='' src='{$this->view->coreWebroot}/public/images/icons/community.png' /><span><a href='{$this->view->webroot}/community/{$community->getKey()}'>{$community->getName()}</a></span></li>".$header;
$header=" <li class='pathCommunity'><img alt='' src='{$this->view->coreWebroot}/public/images/icons/community.png' /><span><a href='{$this->view->webroot}/community/{$community->getKey()}#tabs-3'>{$community->getName()}</a></span></li>".$header;
}
elseif(strpos($parent->getName(), 'user')!==false&&$this->Folder->getUser($parent)!==false)
{
Expand Down
2 changes: 1 addition & 1 deletion core/controllers/InstallController.php
Expand Up @@ -240,7 +240,7 @@ function step3Action()
$applicationConfig['global']['processing']=$form->getValue('process');

$this->Component->Utility->createInitFile(BASE_PATH.'/core/configs/application.local.ini',$applicationConfig);
$this->_redirect("/admin");
$this->_redirect("/admin#tabs-modules");
}
} // end method step2Action

Expand Down
6 changes: 4 additions & 2 deletions core/controllers/ItemController.php
Expand Up @@ -4,7 +4,7 @@ class ItemController extends AppController
{
public $_models=array('Item');
public $_daos=array();
public $_components=array('Date');
public $_components=array('Date','Utility');
public $_forms=array();

/** Init Controller */
Expand Down Expand Up @@ -78,6 +78,8 @@ function viewAction()
$itemDao->creation=$this->Component->Date->formatDate(strtotime($itemRevision->getDate()));
$this->view->itemDao=$itemDao;

$this->view->itemSize=$this->Component->Utility->formatSize($itemDao->getSizebytes());;

$this->view->json['item']=$itemDao->_toArray();
$this->view->json['item']['message']['delete']=$this->t('Delete');
$this->view->json['item']['message']['deleteMessage']=$this->t('Do you really want to delete this item? It cannot be undo.');
Expand All @@ -104,7 +106,7 @@ function deleteAction()

$this->Item->delete($itemDao);

$this->_redirect('/');
$this->_redirect('/?checkRecentItem=true');
}//end delete

}//end class
Expand Down
6 changes: 3 additions & 3 deletions core/controllers/forms/CommunityForm.php
Expand Up @@ -17,9 +17,9 @@ public function createCreateForm()

$privacy = new Zend_Form_Element_Radio('privacy');
$privacy->addMultiOptions( array(
MIDAS_COMMUNITY_PUBLIC => $this->t("Public"),
MIDAS_COMMUNITY_PRIVATE => $this->t("Private"),
MIDAS_COMMUNITY_SEMIPRIVATE => $this->t("Semi-private")
MIDAS_COMMUNITY_PUBLIC => $this->t("Public (Folders are public. Everyone can join the community)"),
MIDAS_COMMUNITY_PRIVATE => $this->t("Private (Folders are private. Only invited users can join the community)"),
MIDAS_COMMUNITY_SEMIPRIVATE => $this->t("Semi-private (Contain public and private folders. Only invited users can join the community)")
))
->setRequired(true)
->setValue(MIDAS_COMMUNITY_PUBLIC);
Expand Down
4 changes: 2 additions & 2 deletions core/controllers/forms/UserForm.php
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 (Everyone can access to my information)"),
MIDAS_USER_PRIVATE => $this->t("Private (Nobody can access to my page)"),
MIDAS_USER_PUBLIC => $this->t("Public (Anyone can see my information)"),
MIDAS_USER_PRIVATE => $this->t("Private (Nobody can see my information)"),
))
->setRequired(true)
->setValue(MIDAS_COMMUNITY_PUBLIC);
Expand Down
4 changes: 4 additions & 0 deletions core/public/css/admin/admin.showlog.css
@@ -1,3 +1,7 @@
tr.logSum{
cursor: pointer;
}

.ui-widget-content{
border: none!important;
}
2 changes: 1 addition & 1 deletion core/public/css/community/community.index.css
Expand Up @@ -8,7 +8,7 @@ div.communityList div{
padding-bottom: 5px;
}

div.communityList a{
div.communityList a.communityTitle{
font-weight: bold;
font-size: 14px;
}
Expand Down
18 changes: 17 additions & 1 deletion core/public/js/admin/admin.index.js
Expand Up @@ -39,13 +39,29 @@
return;
}
createNotive(jsonResponse[1],1500);
initModulesConfigLinks();
});
});

initModulesConfigLinks();
});

var tabs;

function initModulesConfigLinks()
{
$('input.moduleCheckbox').each(function(){
if($(this).is(':checked'))
{
$(this).parents('tr').find('td.configLink').show();
}
else
{
$(this).parents('tr').find('td.configLink').hide();
}
})

}

/** On assetstore add sucess */
function assetstoreAddCallback(responseText, statusText, xhr, $form)
{
Expand Down
2 changes: 1 addition & 1 deletion core/public/js/common/common.browser.js
Expand Up @@ -157,7 +157,7 @@
if(type=='item')
{
html+='<li><a href="'+json.global.webroot+'/item/'+element+'">'+json.browse.view+'</a></li>';
html+='<li><a href="'+json.global.webroot+'/download?items='+element+'">'+json.browse.download+'</a></li>';
html+='<li><a href="'+json.global.webroot+'/download?items='+element+'">'+json.browse.downloadLastest+'</a></li>';
if(policy>=1)
{
html+='<li><a>'+json.browse.share+'</a></li>';
Expand Down
39 changes: 26 additions & 13 deletions core/public/js/community/community.index.js
@@ -1,14 +1,27 @@
$('a.createCommunity').click(function()
{
if(json.global.logged)
$(document).ready(function() {
$('a.createCommunity').click(function()
{
loadDialog("createCommunity","/community/create");
showDialog(json.community.createCommunity,false);
}
else
{
createNotive(json.community.contentCreateLogin,4000)
$("div.TopDynamicBar").show('blind');
loadAjaxDynamicBar('login','/user/login');
}
});
if(json.global.logged)
{
loadDialog("createCommunity","/community/create");
showDialog(json.community.createCommunity,false);
}
else
{
createNotive(json.community.contentCreateLogin,4000)
$("div.TopDynamicBar").show('blind');
loadAjaxDynamicBar('login','/user/login');
}
});

$('a.moreDescription').click(function(){
$(this).parents('div').find('.shortDescription').hide();
$(this).parents('div').find('.fullDescription').show();
})
$('a.lessDescription').click(function(){
$(this).parents('div').find('.shortDescription').show();
$(this).parents('div').find('.fullDescription').hide();
})

});

18 changes: 15 additions & 3 deletions core/translation/fr-main.csv
Expand Up @@ -45,7 +45,9 @@ Create;Cr
Private;Priv�e
Public;Publique
Private (Nobody can access to my page);Priv� (Personne ne peut acc�der � mes informations)
Private (Nobody can see my information);Priv� (Personne ne peut voir mes informations)
Public (Everyone can access to my information);Publique (Tout le monde peut acc�der � mes informations)
Public (Anyone can see my information);Publique (Tout le monde peut voir mes informations)
Semi-private;Semi-priv�e
Description;Description
Created;Cr�e
Expand Down Expand Up @@ -144,7 +146,7 @@ Modify my information;Modifier mes informations
Modify my picture;Modifier mon image
Choose a picture;Choisir une image
Modifier Picture;Modifier image
My picture;Mon image
My Avatar;Mon Avatar
Groups;Groupes
Files;Fichiers
Save;Sauver
Expand All @@ -168,7 +170,17 @@ No result found.;Aucun r
Show more results.;Montrer plus de r�sultats.
Delete user;Supprimer utilisateur
Manage Account Information;G�rer le compte utilisateur
Manage Profile;G�rer Profil
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�.
My Communities;Mes Communaut�s
You don't belong to any community.;Vous ne faites parti d'aucune communaut�.
less;moins
more;plus
Download lastest revision;T�l�charger la derni�re r�vision
My information;Mes informations
My Password;Mon Mot de Passe
Current Avatar;Avatar actuel
Upload new avatar;Uploader nouveau avatar
Modify password;Modifier mot de passe
Retype new password;Retapper nouveau mot de passe
27 changes: 22 additions & 5 deletions core/views/admin/index.phtml
Expand Up @@ -10,9 +10,9 @@ $this->headScript()->appendFile($this->coreWebroot . '/public/js/admin/admin.ind
<div class="tabs" id='tabsGeneric'>
<ul>
<li><a href="#tabs-configuration">Configuration</a></li>
<li><a href="#tabs-assetstore">Assetstores</a></li>
<li><a href="<?php echo $this->webroot?>/admin/upgrade">Upgrade</a></li>
<li><a href="#tabs-modules">Modules</a></li>
<li><a href="#tabs-assetstore">Assetstores</a></li>
<li><a href="<?php echo $this->webroot?>/admin/upgrade">Upgrade</a></li>
<li><a href="<?php echo $this->webroot?>/admin/showlog">Logs</a></li>
</ul>
<div id="tabs-configuration">
Expand Down Expand Up @@ -77,7 +77,24 @@ $this->headScript()->appendFile($this->coreWebroot . '/public/js/admin/admin.ind
{
echo "<b>Free space: {$assetstore->freeSpaceText}</b>";
}
}
}
echo "<br/>Path: {$assetstore->getPath()}";
echo "<br/>Type: ";
switch ($assetstore->getType())
{
case MIDAS_ASSETSTORE_LOCAL:
echo "Local";
break;
case MIDAS_ASSETSTORE_REMOTE:
echo "Remote";
break;
case MIDAS_ASSETSTORE_AMAZON:
echo "Amazon S3";
break;
default:
echo $assetstore->getType();
break;
}
echo"</div>";
}
?>
Expand Down Expand Up @@ -114,10 +131,10 @@ $this->headScript()->appendFile($this->coreWebroot . '/public/js/admin/admin.ind
<b>{$module->fullname}</b><br/>
{$module->description}
</td>";
if($module->configPage&&in_array($key, $this->modulesEnable))
if($module->configPage)
{
echo "
<td>
<td class='configLink' style='display:none;'>
<a href='{$this->webroot}/$key/config'>View configuration</a>
</td>";
}
Expand Down
4 changes: 2 additions & 2 deletions core/views/admin/showlog.phtml
@@ -1,5 +1,5 @@
<link type="text/css" rel="stylesheet" href="<?php echo $this->coreWebroot?>/public/css/admin/admin.showlog.css" />
<script type="text/javascript" src="<?php echo $this->coreWebroot?>/public/js/admin/admin.showlog.js"></script>
<link type="text/css" rel="stylesheet" href="<?php echo $this->coreWebroot?>/public/css/admin/admin.showlog.css?<?php echo time()?>" />
<script type="text/javascript" src="<?php echo $this->coreWebroot?>/public/js/admin/admin.showlog.js?<?php echo time()?>"></script>

<form id="logSelector" method="post" action="<?php echo $this->webroot?>/admin/showlog">
<label for="startlog">From</label>
Expand Down
2 changes: 1 addition & 1 deletion core/views/community/create.phtml
Expand Up @@ -4,7 +4,7 @@

<form id="createCommunityForm" class="genericForm" method="<?php echo $this->form['method']?>" action="<?php echo $this->form['action']?>">
<div class="createNameElement">
<label for="name"><?php echo $this->t('Nom')?></label>
<label for="name"><?php echo $this->t('Name')?></label>
<?php echo $this->form['name']?>
</div>
<div>
Expand Down
14 changes: 12 additions & 2 deletions core/views/community/index.phtml
Expand Up @@ -12,10 +12,20 @@
{
echo "
<div>
<a href='{$this->webroot}/community/{$community->getKey()}'>{$community->getName()}</a>
<a class='communityTitle' href='{$this->webroot}/community/{$community->getKey()}'>{$community->getName()}</a>
<br/>
<span>
<span class='shortDescription' >
";
if(strlen($community->getDescription())>270)
{
echo substr($community->getDescription(), 0,270)."... <a class='moreDescription'>{$this->t('more')}</a>";
}
echo "
</span>
<span class='fullDescription' style='display:none;'>
{$community->getDescription()}
<br/>
<a class='lessDescription'>{$this->t('less')}</a>
</span>
</div>
";
Expand Down
9 changes: 6 additions & 3 deletions core/views/community/view.phtml
Expand Up @@ -28,7 +28,8 @@ $this->headScript()->appendFile($this->coreWebroot.'/public/js/common/common.bro
<ul>
<li><a href="#tabs-1"><?php echo $this->t("Feed")?></a></li>
<?php
if(!empty($this->information))
$description=$this->communityDao->getDescription();
if(!empty($description))
{
?>
<li><a href="#tabs-2"><?php echo $this->t('Info');?></a></li>
Expand All @@ -43,11 +44,13 @@ $this->headScript()->appendFile($this->coreWebroot.'/public/js/common/common.bro
?>
</div>
<?php
if(!empty($this->information))
if(!empty($description))
{
?>
<div id="tabs-2">
???
<?php
echo $description;
?>
</div>
<?php
}
Expand Down

0 comments on commit 04a6f99

Please sign in to comment.