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

Commit 57ddf00

Browse files
author
Charles Marion
committed
ENH: added drag and drop upload
added licenses
1 parent 7c41569 commit 57ddf00

23 files changed

+2295
-122
lines changed

core/configs/application.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ session.lifetime=20
1313
alert.email=charles.marion@kitware.com
1414
;E-mail admin
1515
alert.enable=1
16-
;Webdav path
17-
webdav.path=midaswebdav
1816
;Path to md5sum
1917
md5sum.path=
2018
;Password prefix
@@ -25,6 +23,8 @@ defaultassetstore.id=
2523
default.timezone=America/New_York
2624
;Processing onthefly or cron
2725
processing=onthefly
26+
;Default license
27+
defaultlicense=1
2828

2929
[module]
3030

core/constant/license.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
define("LICENSE_PDDL", 0); // ?Public Domain for data/databases? ,http://www.opendatacommons.org/licenses/pddl/summary/
3+
define("LICENSE_ODC_BY", 1); // Attribution for data/databases http://www.opendatacommons.org/licenses/by/summary/
4+
define("LICENSE_ODBL", 2); // Attribution Share-Alike for data/databases http://www.opendatacommons.org/licenses/odbl/summary/
5+
define("LICENSE_RESERVED", 3); //This work is copyrighted by is owner and cannot be shared, distributed or modified without prior consent of the author.
6+
define("LICENSE_CC_ATRRIBUTION", 4); // Attribution 3.0 Unported (CC BY 3.0) http://creativecommons.org/licenses/by/3.0/
7+
define("LICENSE_CC_ATRRIBUTION_SHAREALIKE", 5); // Attribution-ShareAlike 3.0 Unported http://creativecommons.org/licenses/by-sa/3.0/
8+
define("LICENSE_CC_NODERIVS", 6); // Attribution-NoDerivs 3.0 Unported (CC BY-ND 3.0) http://creativecommons.org/licenses/by-nd/3.0/
9+
define("LICENSE_CC_NONCOMMERCIAL", 7); // Attribution-NonCommercial 3.0 Unported (CC BY-NC 3.0) http://creativecommons.org/licenses/by-nc/3.0/
10+
define("LICENSE_CC_NONCOMMERCIAL_SHARELIKE", 8); // Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0) http://creativecommons.org/licenses/by-nc-sa/3.0/
11+
define("LICENSE_CC_NONCOMMERCIAL_NODERIVS", 9); // Attribution-NonCommercial-NoDerivs 3.0 Unported (CC BY-NC-ND 3.0) http://creativecommons.org/licenses/by-nc-nd/3.0/
12+
?>

core/controllers/AdminController.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ function indexAction()
3535
$formArray['lang']->setValue($applicationConfig['global']['application.lang']);
3636
$formArray['smartoptimizer']->setValue($applicationConfig['global']['smartoptimizer']);
3737
$formArray['timezone']->setValue($applicationConfig['global']['default.timezone']);
38+
$this->view->selectedLicense=$applicationConfig['global']['defaultlicense'];
3839
$this->view->configForm=$formArray;
3940

4041
$allModules=$this->Component->Utility->getAllModules();
@@ -58,6 +59,7 @@ function indexAction()
5859
$applicationConfig['global']['environment']=$this->_getParam('environment');
5960
$applicationConfig['global']['smartoptimizer']=$this->_getParam('smartoptimizer');
6061
$applicationConfig['global']['default.timezone']=$this->_getParam('timezone');
62+
$applicationConfig['global']['defaultlicense']=$this->_getParam('licenseSelect');
6163
$this->Component->Utility->createInitFile(BASE_PATH.'/core/configs/application.local.ini', $applicationConfig);
6264
echo JsonComponent::encode(array(true,'Changed saved'));
6365
}

core/controllers/BrowseController.php

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public function movecopyAction()
6363
{
6464
$copySubmit=$this->_getParam('copyElement');
6565
$moveSubmit=$this->_getParam('moveElement');
66+
$select=$this->_getParam('selectElement');
6667
if(isset($copySubmit)||isset($moveSubmit))
6768
{
6869
$elements=explode(';',$this->_getParam('elements'));
@@ -128,30 +129,39 @@ public function movecopyAction()
128129
throw new Zend_Exception("Why are you here ? Should be ajax.");
129130
}
130131
$this->_helper->layout->disableLayout();
131-
$folderIds=$this->_getParam('folders');
132-
$itemIds=$this->_getParam('items');
133-
$move=$this->_getParam('move');
134-
$this->view->folderIds=$folderIds;
135-
$this->view->itemIds=$itemIds;
136-
$this->view->moveEnabled=true;
137-
if(isset($move))
138-
{
139-
$this->view->moveEnabled=false;
140-
}
141-
$folderIds=explode('-',$folderIds);
142-
$itemIds=explode('-',$itemIds);
143-
$folders= $this->Folder->load($folderIds);
144-
$items= $this->Item->load($itemIds);
145-
if(empty($folders)&&empty ($items))
132+
133+
if(!isset($select))
146134
{
147-
throw new Zend_Exception("No element selected");
135+
$folderIds=$this->_getParam('folders');
136+
$itemIds=$this->_getParam('items');
137+
$move=$this->_getParam('move');
138+
$this->view->folderIds=$folderIds;
139+
$this->view->itemIds=$itemIds;
140+
$this->view->moveEnabled=true;
141+
if(isset($move))
142+
{
143+
$this->view->moveEnabled=false;
144+
}
145+
$folderIds=explode('-',$folderIds);
146+
$itemIds=explode('-',$itemIds);
147+
$folders= $this->Folder->load($folderIds);
148+
$items= $this->Item->load($itemIds);
149+
if(empty($folders)&&empty ($items))
150+
{
151+
throw new Zend_Exception("No element selected");
152+
}
153+
if(!$this->view->logged)
154+
{
155+
throw new Zend_Exception("Should be logged");
156+
}
157+
$this->view->folders=$folders;
158+
$this->view->items=$items;
159+
$this->view->selectEnabled=false;
148160
}
149-
if(!$this->view->logged)
161+
else
150162
{
151-
throw new Zend_Exception("Should be logged");
163+
$this->view->selectEnabled=true;
152164
}
153-
$this->view->folders=$folders;
154-
$this->view->items=$items;
155165

156166
$communities=$this->User->getUserCommunities($this->userSession->Dao);
157167
$communities=array_merge($communities, $this->Community->getPublicCommunities());

core/controllers/UploadController.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public function simpleuploadAction()
3939
$this->_helper->layout->disableLayout();
4040
$this->view->form=$this->getFormAsArray($this->Form->Upload->createUploadLinkForm());
4141
$this->userSession->uploaded=array();
42+
$this->view->selectedLicense=Zend_Registry::get('configGlobal')->defaultlicense;
4243
}//end simple upload
4344

4445

@@ -147,12 +148,17 @@ public function saveuploadedAction()
147148
$upload = new Zend_File_Transfer();
148149
$upload->receive();
149150
$path=$upload->getFileName();
151+
$file_size=filesize($path);
150152
$privacy=$this->_getParam("privacy");
151-
152153
if (!empty($path)&& file_exists($path) && $upload->getFileSize() > 0)
153154
{
154155
$item=$this->createUploadedItem($this->userSession->Dao,$upload->getFilename(null,false),$upload->getFilename(),$privacy);
155156
$this->userSession->uploaded[]=$item->getKey();
157+
158+
$info= array();
159+
$info['name']= basename($upload->getFileName());
160+
$info['size']= $file_size;
161+
echo json_encode($info);
156162
}
157163
}//end saveuploaded
158164

core/include.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
include_once BASE_PATH.'/core/constant/policy.php';
1616
include_once BASE_PATH.'/core/constant/folder.php';
1717
include_once BASE_PATH.'/core/constant/feed.php';
18+
include_once BASE_PATH.'/core/constant/license.php';
1819
include_once BASE_PATH.'/core/constant/user.php';
1920
include_once BASE_PATH.'/core/constant/resourcetype.php';
2021
include_once BASE_PATH.'/core/constant/task.php';

core/models/base/ItemRevisionModelBase.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public function __construct()
1717
'date' => array('type'=>MIDAS_DATA),
1818
'changes' => array('type'=>MIDAS_DATA),
1919
'user_id' => array('type'=>MIDAS_DATA),
20+
'license' => array('type'=>MIDAS_DATA),
2021
'bitstreams' => array('type'=>MIDAS_ONE_TO_MANY, 'model'=>'Bitstream', 'parent_column'=> 'itemrevision_id', 'child_column' => 'itemrevision_id'),
2122
'item' => array('type'=>MIDAS_MANY_TO_ONE, 'model'=>'Item', 'parent_column'=> 'item_id', 'child_column' => 'item_id'),
2223
'user' => array('type'=>MIDAS_MANY_TO_ONE, 'model'=>'User', 'parent_column'=> 'user_id', 'child_column' => 'user_id'),
3.25 KB
Loading
Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
@charset 'UTF-8';
2+
/*
3+
* jQuery File Upload Plugin CSS 4.1
4+
* https://github.com/blueimp/jQuery-File-Upload
5+
*
6+
* Copyright 2010, Sebastian Tschan
7+
* https://blueimp.net
8+
*
9+
* Licensed under the MIT license:
10+
* http://creativecommons.org/licenses/MIT/
11+
*/
12+
13+
form.file_upload {
14+
position: relative;
15+
overflow: hidden;
16+
direction: ltr;
17+
cursor: pointer;
18+
text-align: center;
19+
width: 15em;
20+
height: 2.5em;
21+
line-height: 2.5em;
22+
border: #354856 1px solid;
23+
-moz-border-radius: 6px;
24+
-webkit-border-radius: 6px;
25+
-khtml-border-radius: 6px;
26+
border-radius: 6px;
27+
background-color: #57BB7D;
28+
background-image: -webkit-gradient(linear,left top,left bottom,from(#57BB7D),to(#32724A));
29+
background-image: -moz-linear-gradient(center top,#57BB7D 0%,#32724A 100% );
30+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#57BB7D',endColorstr='#32724A');
31+
-webkit-box-shadow: #666 0 0 2px;
32+
box-shadow: #666 0 0 2px;
33+
-moz-box-shadow: 0px 0px 2px #666;
34+
color: white;
35+
font-size: 14px;
36+
font-weight: bold;
37+
margin-top: 5px;
38+
}
39+
40+
form.file_upload_small {
41+
width: 15em;
42+
height: 2.5em;
43+
line-height: 2.5em;
44+
font-size: 100%;
45+
border: #354856 1px solid;
46+
-moz-border-radius: 6px;
47+
-webkit-border-radius: 6px;
48+
-khtml-border-radius: 6px;
49+
border-radius: 6px;
50+
background-color: #57BB7D;
51+
background-image: -webkit-gradient(linear,left top,left bottom,from(#57BB7D),to(#32724A));
52+
background-image: -moz-linear-gradient(center top,#57BB7D 0%,#32724A 100% );
53+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#57BB7D',endColorstr='#32724A');
54+
-webkit-box-shadow: #666 0 0 2px;
55+
box-shadow: #666 0 0 2px;
56+
-moz-box-shadow: 0px 0px 2px #666;
57+
}
58+
59+
form.file_upload_large {
60+
width: 100%;
61+
height: 7em;
62+
line-height: 7em;
63+
font-size: 2em;
64+
border: #354856 1px solid;
65+
-moz-border-radius: 6px;
66+
-webkit-border-radius: 6px;
67+
-khtml-border-radius: 6px;
68+
border-radius: 6px;
69+
background-color: #57BB7D;
70+
background-image: -webkit-gradient(linear,left top,left bottom,from(#57BB7D),to(#32724A));
71+
background-image: -moz-linear-gradient(center top,#57BB7D 0%,#32724A 100% );
72+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#57BB7D',endColorstr='#32724A');
73+
-webkit-box-shadow: #666 0 0 2px;
74+
box-shadow: #666 0 0 2px;
75+
-moz-box-shadow: 0px 0px 2px #666;
76+
}
77+
78+
form.file_upload_highlight,
79+
form.file_upload:hover {
80+
background-color: #5BD288;
81+
background-image: -webkit-gradient(linear,left top,left bottom,from(#5BD288),to(#429D64));
82+
background-image: -moz-linear-gradient(center top,#5BD288 0%,#429D64 100% );
83+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#5BD288',endColorstr='#429D64');
84+
}
85+
86+
form.file_upload input {
87+
position: absolute;
88+
top: 0;
89+
right: 0;
90+
margin: 0;
91+
border: 300px solid transparent;
92+
opacity: 0;
93+
-ms-filter: 'alpha(opacity=0)';
94+
filter: alpha(opacity=0);
95+
-o-transform: translate(-300px, -300px) scale(10);
96+
-moz-transform: translate(-800px, 0) scale(10);
97+
cursor: pointer;
98+
height: 100%;
99+
}
100+
101+
:root form.file_upload input {
102+
height: auto;
103+
}
104+
105+
form.file_upload button,
106+
.no-js .file_upload_label,
107+
.no-js .file_upload_overall_progress,
108+
.no-js .file_upload_buttons {
109+
display: none;
110+
}
111+
112+
.file_upload .file_upload_label,
113+
.file_upload .file_upload_overall_progress,
114+
.file_upload .file_upload_buttons {
115+
display: block;
116+
}
117+
118+
.file_upload img {
119+
border: none;
120+
}
121+
122+
.progressbar, .progressbar div {
123+
border: 1px solid #aaa;
124+
-moz-border-radius: 4px;
125+
-webkit-border-radius: 4px;
126+
border-radius: 4px;
127+
}
128+
129+
.progressbar div {
130+
width: 100%;
131+
height: 100%;
132+
margin: -1px;
133+
}
134+
135+
.file_upload_progress .ui-progressbar-value,
136+
.file_upload_overall_progress .ui-progressbar-value,
137+
.progressbar div {
138+
background: url(images/pbar-ani.gif);
139+
}
140+
141+
.file_upload_progress div {
142+
width: 150px;
143+
height: 17px;
144+
}
145+
146+
.file_upload_overall_progress div {
147+
width: 350px;
148+
height: 17px;
149+
}
150+
151+
.file_upload .file_name {
152+
padding: 0 10px;
153+
font-size: 1.1em;
154+
}
155+
156+
.file_upload .file_size {
157+
padding: 0 10px 0 0;
158+
text-align: right;
159+
font-size: 1.1em;
160+
}
161+
162+
.file_upload .files,
163+
.file_upload_overall_progress {
164+
margin: 10px 0;
165+
}
166+
167+
.file_upload .ui-widget {
168+
font-size: 1em;
169+
}

core/public/css/layout/jquery.cluetip.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
-webkit-box-shadow: #CCC 0px 0px 3px;
100100
-moz-box-shadow: 0px 0px 6px #CCC;
101101
background-color: white;
102-
border: 1px solid #D7D7D7;
102+
border: 1px solid black;
103103
-moz-border-radius: 6px;
104104
-webkit-border-radius: 6px;
105105
-khtml-border-radius: 6px;

0 commit comments

Comments
 (0)