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

Commit ebf31f8

Browse files
author
Charles Marion
committed
ENH: Added visualization module
Removed non proliferation module (postpone it)
1 parent 2df29b6 commit ebf31f8

File tree

43 files changed

+910
-168
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+910
-168
lines changed

core/constant/notification.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,8 @@
22
define("MIDAS_NOTIFY_LOGIN", 0);
33
define("MIDAS_NOTIFY_GET_CONFIG_TABS", 1);
44
define("MIDAS_NOTIFY_GET_DASBOARD", 2);
5+
6+
7+
/** visualization*/
8+
define("MIDAS_NOTIFY_CAN_VISUALIZE", 100);
59
?>

core/controllers/AdminController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ function migratemidas2Action()
422422
$this->haveToBeLogged();
423423
return;
424424
}
425-
if(!$this->userSession->Dao->getAdmin() == 1)
425+
if(!$this->userSession->Dao->getAdmin() == 1)
426426
{
427427
throw new Zend_Exception("You should be an administrator");
428428
}

core/controllers/ItemController.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,17 @@ function viewAction()
9191
$this->view->title .= ' - '.$itemDao->getName();
9292
$this->view->metaDescription = substr($itemDao->getDescription(), 0, 160);
9393

94+
95+
$tmp = Zend_Registry::get('notifier')->notify(MIDAS_NOTIFY_CAN_VISUALIZE, array('item' => $itemDao));
96+
if(isset($tmp['visualize']) && $tmp['visualize'] == true)
97+
{
98+
$this->view->preview = true;
99+
}
100+
else
101+
{
102+
$this->view->preview = false;
103+
}
104+
94105
$this->view->json['item'] = $itemDao->toArray();
95106
$this->view->json['item']['message']['delete'] = $this->t('Delete');
96107
$this->view->json['item']['message']['deleteMessage'] = $this->t('Do you really want to delete this item? It cannot be undo.');

core/models/base/CommunityModelBase.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,13 @@ function createCommunity($name, $description, $privacy, $user, $canJoin = null)
109109
$feedpolicyuserModel = $modelLoad->loadModel('Feedpolicyuser');
110110
$feedpolicygroupModel = $modelLoad->loadModel('Feedpolicygroup');
111111

112-
$folderGlobal = $folderModel->createFolder('community_'.$communityDao->getKey(), 'Main folder of the community '.$communityDao->getKey(), MIDAS_FOLDER_COMMUNITYPARENT);
113-
$folderPublic = $folderModel->createFolder('Public', 'Public folder of the community '.$communityDao->getKey(), $folderGlobal);
114-
$folderPrivate = $folderModel->createFolder('Private', 'Private folder of the community '.$communityDao->getKey(), $folderGlobal);
112+
$folderGlobal = $folderModel->createFolder('community_'.$communityDao->getKey(), '', MIDAS_FOLDER_COMMUNITYPARENT);
113+
$folderPublic = $folderModel->createFolder('Public', '', $folderGlobal);
114+
$folderPrivate = $folderModel->createFolder('Private', '', $folderGlobal);
115115

116-
$adminGroup = $groupModel->createGroup($communityDao, 'Admin group of community '.$communityDao->getKey());
117-
$moderatorsGroup = $groupModel->createGroup($communityDao, 'Moderators group of community '.$communityDao->getKey());
118-
$memberGroup = $groupModel->createGroup($communityDao, 'Members group of community '.$communityDao->getKey());
116+
$adminGroup = $groupModel->createGroup($communityDao, 'Administrator');
117+
$moderatorsGroup = $groupModel->createGroup($communityDao, 'Moderators');
118+
$memberGroup = $groupModel->createGroup($communityDao, 'Members');
119119
$anonymousGroup = $groupModel->load(MIDAS_GROUP_ANONYMOUS_KEY);
120120

121121
$communityDao->setFolderId($folderGlobal->getKey());

core/models/base/ItemModelBase.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ abstract function getOwnedByUser($userDao, $limit = 20);
3333
abstract function getSharedToUser($userDao, $limit = 20);
3434
abstract function getSharedToCommunity($communityDao, $limit = 20);
3535
abstract function policyCheck($itemdao, $userDao = null, $policy = 0);
36+
abstract function getLastRevision($itemdao);
3637

3738
/** save */
3839
public function save($dao)

core/models/base/ItempolicygroupModelBase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function __construct()
2020
} // end __construct()
2121

2222

23-
/** delete */
23+
/** delete */
2424
public function delete($dao)
2525
{
2626
$item = $dao->getItem();

core/models/base/UserModelBase.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ public function createUser($email, $password, $firstname, $lastname, $admin = 0)
112112
$feedpolicyuserModel = $this->ModelLoader->loadModel('Feedpolicyuser');
113113
$anonymousGroup = $groupModel->load(MIDAS_GROUP_ANONYMOUS_KEY);
114114

115-
$folderGlobal = $folderModel->createFolder('user_' . $userDao->getKey(), 'Main folder of ' . $userDao->getFullName(), MIDAS_FOLDER_USERPARENT);
116-
$folderPrivate = $folderModel->createFolder('Private', 'Private folder of ' . $userDao->getFullName(), $folderGlobal);
117-
$folderPublic = $folderModel->createFolder('Public', 'Public folder of ' . $userDao->getFullName(), $folderGlobal);
115+
$folderGlobal = $folderModel->createFolder('user_' . $userDao->getKey(), '', MIDAS_FOLDER_USERPARENT);
116+
$folderPrivate = $folderModel->createFolder('Private', '', $folderGlobal);
117+
$folderPublic = $folderModel->createFolder('Public', '', $folderGlobal);
118118

119119
$folderpolicygroupModel->createPolicy($anonymousGroup, $folderPublic, MIDAS_POLICY_READ);
120120

core/public/js/item/item.view.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,25 @@
3737
loadDialog("uploadrevision"+$(this).attr('element'),"/upload/revision?itemId="+$(this).attr('element'));
3838
showDialog($(this).html());
3939
});
40+
41+
42+
/** preview */
43+
$('a#itemPreviewLink').click(function(){
44+
45+
var height = $(window).height()-100;
46+
var width = $(window).width()-10;
47+
var url = json.global.webroot+"/visualize/?itemId="+json.item.item_id+'&height='+height+'&width='+width;
48+
var html = '<div id="fullscreenVisualize" >';
49+
html += '<div id="fullscreenPanel">test</div>';
50+
html += '<iframe name="fullscreenVisualizeIframe" height="'+height+'" width="'+width+'" id="fullscreenVisualizeIframe" src="'+url+'"></iframe>';
51+
html += '</div>';
52+
53+
$('body').append(html);
54+
$('.MainDialog').hide();
55+
$('.TopDynamicBar').hide();
56+
$('.Topbar').hide();
57+
$('.Header').hide();
58+
$('.Wrapper').hide();
59+
});
4060
});
4161

core/views/admin/index.phtml

Lines changed: 22 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -127,36 +127,28 @@ $this->headScript()->appendFile($this->coreWebroot . '/public/js/admin/admin.ind
127127
<?php
128128
foreach($this->modulesList as $key=>$module)
129129
{
130-
echo "
131-
<tr class='moduleElement'>
132-
<td>";
133-
if(isset($module->db->{$this->databaseType}))
134-
{
135-
echo "
136-
<input type='checkbox' class='moduleCheckbox' module='{$key}' name='module[{$key}]' ".((in_array($key, $this->modulesEnable))?'checked':'')."/>";
137-
}
138-
else
139-
{
140-
echo "
141-
Module not available with your database type.
142-
";
143-
}
144-
echo"
145-
</td>
146-
<td>
147-
<b>{$module->fullname}</b><br/>
148-
{$module->description}
149-
</td>";
150-
if($module->configPage)
151-
{
152-
echo "
153-
<td class='configLink' style='display:none;'>
154-
<a href='{$this->webroot}/$key/config'>View configuration</a>
155-
</td>";
156-
}
157-
echo "
158-
</tr>
159-
";
130+
if(isset($module->db->{$this->databaseType}))
131+
{
132+
echo "
133+
<tr class='moduleElement'>
134+
<td>
135+
<input type='checkbox' class='moduleCheckbox' module='{$key}' name='module[{$key}]' ".((in_array($key, $this->modulesEnable))?'checked':'')."/>
136+
</td>
137+
<td>
138+
<b>{$module->fullname}</b><br/>
139+
{$module->description}
140+
</td>";
141+
if($module->configPage)
142+
{
143+
echo "
144+
<td class='configLink' style='display:none;'>
145+
<a href='{$this->webroot}/$key/config'>View configuration</a>
146+
</td>";
147+
}
148+
echo "
149+
</tr>
150+
";
151+
}
160152
}
161153
?>
162154
</table>

core/views/item/view.phtml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,14 @@ $this->headScript()->appendFile($this->coreWebroot . '/public/js/item/item.view.
7777
<a href='{$this->webroot}/download/?items={$this->itemDao->getKey()}'>{$this->t('Download lastest revision')}</a>
7878
</li>
7979
";
80+
if($this->preview)
81+
{
82+
echo
83+
"<li>
84+
<a id='itemPreviewLink'>{$this->t('Preview')}</a>
85+
</li>
86+
";
87+
}
8088
if($this->isModerator)
8189
{
8290
echo

0 commit comments

Comments
 (0)