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

Commit

Permalink
ENH: Changed import policies
Browse files Browse the repository at this point in the history
Changed display
  • Loading branch information
Charles Marion committed Mar 8, 2011
1 parent cc11283 commit 16dd47e
Show file tree
Hide file tree
Showing 24 changed files with 440 additions and 141 deletions.
17 changes: 16 additions & 1 deletion application/AppController.php
Expand Up @@ -75,12 +75,27 @@ public function preDispatch()
"contentUploadLogin"=>utf8_encode($this->t('You need to be logged in to be able to upload files.'))
);

$browse=array(
'view'=>$this->t('View'),
'download'=>$this->t('Download'),
'edit'=>$this->t('Edit'),
'delete'=>$this->t('Delete'),
'share'=>$this->t('Share'),
'rename'=>$this->t('Rename'),
'move'=>$this->t('Move'),
'copy'=>$this->t('Copy'),
'community' => array(
'invit'=>$this->t('Invite collaborators'),
'advanced'=>$this->t('Advanced properties'),
)
);

$feed=array(
"deleteFeed"=>$this->t('Do you really want to delete the feed')
);

$this->view->json=array(
"global"=>$jsonGlobal,"login"=>$login,'feed'=>$feed
"global"=>$jsonGlobal,"login"=>$login,'feed'=>$feed,"browse"=>$browse
);
Zend_Loader::loadClass("JsonComponent",BASE_PATH.'/application/controllers/components');
} // end preDispatch()
Expand Down
24 changes: 8 additions & 16 deletions application/controllers/BrowseController.php
Expand Up @@ -39,29 +39,21 @@ public function indexAction()

$this->view->communities=$communities;
$this->view->header=$header;

$javascriptText=array();
$javascriptText['view']=$this->t('View');
$javascriptText['download']=$this->t('Download');
$javascriptText['edit']=$this->t('Edit');
$javascriptText['delete']=$this->t('Delete');
$javascriptText['share']=$this->t('Share');
$javascriptText['rename']=$this->t('Rename');
$javascriptText['move']=$this->t('Move');
$javascriptText['copy']=$this->t('Copy');

$javascriptText['community']['invit']=$this->t('Invite collaborators');
$javascriptText['community']['advanced']=$this->t('Advanced properties');
$this->view->json['browse']=$javascriptText;

$this->view->itemThumbnails=$this->Item->getRandomItems($this->userSession->Dao,0,12,true);
$this->view->nUsers=$this->User->getCountAll();
$this->view->nCommunities=$this->Community->getCountAll();
$this->view->nItems=$this->Item->getCountAll();
$this->view->notifications=array();
}

/** get getfolders content (ajax function for the treetable) */
public function getfolderscontentAction()
{
/* if(!$this->getRequest()->isXmlHttpRequest())
if(!$this->getRequest()->isXmlHttpRequest())
{
throw new Zend_Exception("Why are you here ? Should be ajax.");
}*/
}

$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
Expand Down
10 changes: 7 additions & 3 deletions application/controllers/CommunityController.php
Expand Up @@ -4,7 +4,7 @@ class CommunityController extends AppController
{
public $_models=array('Community','Folder','Group','Folderpolicygroup','Group','User','Feed',"Feedpolicygroup","Feedpolicyuser");
public $_daos=array('Community','Folder','Group','Folderpolicygroup','Group','User');
public $_components=array('Sortdao');
public $_components=array('Sortdao','Date');
public $_forms=array('Community');

/** Init Controller */
Expand Down Expand Up @@ -39,9 +39,8 @@ function indexAction()
/** view a community*/
function viewAction()
{

$this->view->Date=$this->Component->Date;
//TODO: add policy check
$this->view->header=$this->t("Communities");
$communityId=$this->_getParam("communityId");
if(!isset($communityId)||!is_numeric($communityId))
{
Expand All @@ -54,7 +53,12 @@ function viewAction()
}

$this->view->communityDao=$communityDao;
$this->view->information=array();
$this->view->feeds=$this->Feed->getFeedsByCommunity($this->userSession->Dao,$communityDao);

$this->view->folders=array();
$this->view->folders[]=$communityDao->getPublicFolder();
$this->view->folders[]=$communityDao->getPrivateFolder();
}//end index


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

/** Init Controller */
Expand All @@ -22,6 +22,7 @@ function init()
/** View Action*/
public function viewAction()
{
$this->view->Date=$this->Component->Date;
$folder_id=$this->_getParam('folderId');
$folder=$this->Folder->load($folder_id);
$folders=array();
Expand All @@ -39,6 +40,10 @@ public function viewAction()
{
$folders=$this->Folder->getChildrenFoldersFiltered($folder,$this->userSession->Dao,MIDAS_POLICY_READ);
$items=$this->Folder->getItemsFiltered($folder,$this->userSession->Dao,MIDAS_POLICY_READ);
foreach($items as $key=>$i)
{
$items[$key]->size=$this->Component->Utility->formatSize($i->getSizebytes());
}
$header.=" <li class='pathFolder'><a href='{$this->view->webroot}/folder/{$folder->getKey()}'>{$folder->getName()}</a></li>";
$parent=$folder->getParent();
while($parent!==false)
Expand All @@ -58,22 +63,11 @@ public function viewAction()
<li class='pathData'><a href='{$this->view->webroot}/browse'>Data</a></li>".$header;
$header.="</ul>";
}
$this->view->mainFolder=$folder;
$this->view->folders=$folders;
$this->view->items=$items;
$this->view->header=$header;

$javascriptText=array();
$javascriptText['view']=$this->t('View');
$javascriptText['edit']=$this->t('Edit');
$javascriptText['delete']=$this->t('Delete');
$javascriptText['share']=$this->t('Share');
$javascriptText['rename']=$this->t('Rename');
$javascriptText['move']=$this->t('Move');
$javascriptText['copy']=$this->t('Copy');

$javascriptText['community']['invit']=$this->t('Invite collaborators');
$javascriptText['community']['advanced']=$this->t('Advanced properties');
$this->view->json['browse']=$javascriptText;
}// end View Action

}//end class
12 changes: 8 additions & 4 deletions application/controllers/ImportController.php
Expand Up @@ -6,8 +6,7 @@
*/
class ImportController extends AppController
{

public $_models=array('Item','Folder','ItemRevision','Assetstore','Folderpolicyuser','Itempolicyuser','ItemKeyword');
public $_models=array('Item','Folder','ItemRevision','Assetstore','Folderpolicyuser','Itempolicyuser','ItemKeyword','Itempolicygroup','Group','Folderpolicygroup');
public $_daos=array('Item','Folder','ItemRevision','Bitstream','Assetstore','ItemKeyword');
public $_components=array('Upload','Utility');
public $_forms=array('Import','Assetstore');
Expand Down Expand Up @@ -115,8 +114,11 @@ private function _recursiveParseDirectory($path,$currentdir)
$child = new FolderDao;
$child->setName($fileInfo->getFilename());
$child->setParentId($currentdir->getFolderId());
$child->setDate(date('c'));
$this->Folder->save($child);
$this->Folderpolicyuser->createPolicy($this->userSession->Dao,$child,MIDAS_POLICY_ADMIN);
$this->Folderpolicyuser->createPolicy($this->userSession->Dao,$child,MIDAS_POLICY_ADMIN);
$anonymousGroup=$this->Group->load(MIDAS_GROUP_ANONYMOUS_KEY);
$this->Folderpolicygroup->createPolicy($anonymousGroup,$child,MIDAS_POLICY_READ);
}
$this->_recursiveParseDirectory($fileInfo->getPathName(),$child);
}
Expand All @@ -140,7 +142,9 @@ private function _recursiveParseDirectory($path,$currentdir)
$this->Item->addKeyword($item,$keyword);

// Set the policy of the item
$this->Itempolicyuser->createPolicy($this->userSession->Dao,$item,MIDAS_POLICY_ADMIN);
$this->Itempolicyuser->createPolicy($this->userSession->Dao,$item,MIDAS_POLICY_ADMIN);
$anonymousGroup=$this->Group->load(MIDAS_GROUP_ANONYMOUS_KEY);
$this->Itempolicygroup->createPolicy($anonymousGroup,$item,MIDAS_POLICY_READ);

// Add the item to the current directory
$this->Folder->addItem($currentdir,$item);
Expand Down
3 changes: 1 addition & 2 deletions application/controllers/SearchController.php
Expand Up @@ -26,8 +26,7 @@ public function indexAction()

// Get the items corresponding to the search
$items = $this->ItemKeyword->getItemsFromSearch($keyword,$this->userSession->Dao);

var_dump($items);
$this->view->items=$items;
}

/** search live Action */
Expand Down
20 changes: 5 additions & 15 deletions application/controllers/UserController.php
Expand Up @@ -8,7 +8,7 @@ class UserController extends AppController
public $_daos=array(
'User','Folder','Folderpolicygroup','Folderpolicyuser','Group'
);
public $_components=array();
public $_components=array('Date');
public $_forms=array(
'User'
);
Expand Down Expand Up @@ -168,6 +168,7 @@ public function validentryAction()
/** user page action*/
public function userpageAction()
{
$this->view->Date=$this->Component->Date;
$user_id=$this->_getParam("user_id");
if(!isset($user_id) && !$this->logged)
{
Expand All @@ -183,7 +184,7 @@ public function userpageAction()
{
$userDao=$this->User->load($user_id);
}

if(!$userDao instanceof UserDao)
{
throw new Zend_Exception("Unable to find user");
Expand All @@ -193,23 +194,12 @@ public function userpageAction()
$this->view->userCommunities=$this->User->getUserCommunities($userDao);
$this->view->folders=array();
$this->view->folders[]=$userDao->getPublicFolder();
if($userDao->getKey() == $this->userSession->Dao->getKey())
if(!empty($this->userSession->Dao)&& $userDao->getKey() == $this->userSession->Dao->getKey())
{
$this->view->folders[]=$userDao->getPrivateFolder();
}
$this->view->feeds=$this->Feed->getFeedsByUser($this->userSession->Dao,$userDao);

$javascriptText=array();
$javascriptText['view']=$this->t('View');
$javascriptText['edit']=$this->t('Edit');
$javascriptText['delete']=$this->t('Delete');
$javascriptText['share']=$this->t('Share');
$javascriptText['rename']=$this->t('Rename');
$javascriptText['move']=$this->t('Move');
$javascriptText['copy']=$this->t('Copy');

$javascriptText['community']['invit']=$this->t('Invite collaborators');
$javascriptText['community']['advanced']=$this->t('Advanced properties');
$this->view->json['browse']=$javascriptText;
$this->view->information=array();
}
}//end class
47 changes: 43 additions & 4 deletions application/views/browse/index.phtml
Expand Up @@ -3,7 +3,9 @@
$this->headScript()->appendFile($this->webroot.'/public/js/common/common.browser.js');
?>


<link type="text/css" rel="stylesheet" href="<?php echo $this->webroot?>/public/css/common/common.browser.css" />
<link type="text/css" rel="stylesheet" href="<?php echo $this->webroot?>/public/css/browse/browse.index.css" />
<div class="viewMain">
<img class="tableLoading" alt="" src="<?php echo $this->webroot?>/public/images/icons/loading.gif"/>
<table id="browseTable" class="midasTree">
Expand All @@ -29,26 +31,63 @@
echo "</tr>";
$node++;
}
?>

?>
</tbody>
</table>
</div>
<div class="viewSideBar">
<div class="sideElementFirst viewAction">
<div class="sideElementFirst viewAction" >
<h1>Actions</h1>
<ul>
<li>

</li>
</ul>
</div>
<div class="sideElementLast viewInfo">
<div class="sideElementLast viewInfo" >
<h1>Info</h1>
<img class="infoLoading" style="display:none;" alt="" src="<?php echo $this->webroot?>/public/images/icons/loading.gif"/>
<div class="ajaxInfoElement">
</div>
</div>


<div class="defaultSide" >
BlaBla
<br/>
<?php
if(!empty($this->notifications))
{
echo "<div class='sideElementFirst feedNotification'>
<h1>Notifications</h1>
</div>";
}
?>
<?php
if(!empty($this->itemThumbnails))
{
echo '<div class="'.(empty($this->notifications)?'sideElementFirst':'sideElement').' feedThumbnail">';
echo '<h1>Thumbnails</h1>';
foreach($this->itemThumbnails as $item)
{
echo "<a href='{$this->webroot}/item/{$item->getKey()}'>";
echo "<img src='{$this->webroot}/{$item->getThumbnail()}' alt=''/>";
echo "</a>";
}
echo '</div>';
}
?>
<div class="sideElementLast feedStats">
<h1>Stats</h1>
<?php
echo "<ul>";
echo " <li>{$this->nUsers} user".(($this->nUsers>1)?'s':'')."</li>";
echo " <li>{$this->nCommunities} ".(($this->nCommunities>1)?'communities':'community')."</li>";
echo " <li>{$this->nItems} item".(($this->nItems>1)?'s':'')."</li>";
echo "</ul>";
?>
</div>
</div>
</div>


Expand Down
2 changes: 1 addition & 1 deletion application/views/community/index.phtml
Expand Up @@ -23,7 +23,7 @@
</div>
<div class="sideElementLast viewInfo">
<h1>Info</h1>
bla
To do
</div>
</div>

Expand Down

0 comments on commit 16dd47e

Please sign in to comment.