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

Commit 27d4a00

Browse files
author
Charles Ma
committed
ENH: refs #301 Added relation type
Added margin in upload forms
1 parent 15965b8 commit 27d4a00

File tree

7 files changed

+66
-13
lines changed

7 files changed

+66
-13
lines changed

core/public/css/upload/upload.simpleupload.css

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,23 @@ width:94%!important;
1212

1313
}
1414
#jqueryFileUploadContent{
15-
15+
1616
}
1717

1818
div.tooBigUpload{
1919
display:none;
2020
}
2121

2222
/* -- Form Styles ------------------------------- */
23-
#swfuploadContent form {
23+
#swfuploadContent form {
2424
margin: 0;
2525
padding: 0;
2626
}
2727

28+
.globalButton{
29+
margin-top: 3px!important;
30+
}
31+
2832

2933

3034
#swfuploadContent div.fieldset {
@@ -68,8 +72,8 @@ div.tooBigUpload{
6872
#swfuploadContent button,
6973
#swfuploadContent input,
7074
#swfuploadContent select,
71-
#swfuploadContent textarea {
72-
border-width: 1px;
75+
#swfuploadContent textarea {
76+
border-width: 1px;
7377
margin-bottom: 10px;
7478
padding: 2px 3px;
7579
}
@@ -79,9 +83,9 @@ div.tooBigUpload{
7983
#swfuploadContent input[disabled]{ border: 1px solid #ccc } /* FF 2 Fix */
8084

8185

82-
#swfuploadContent label {
83-
width: 150px;
84-
text-align: right;
86+
#swfuploadContent label {
87+
width: 150px;
88+
text-align: right;
8589
display:block;
8690
margin-right: 5px;
8791
}
@@ -142,7 +146,7 @@ div.tooBigUpload{
142146
white-space: nowrap;
143147
overflow: hidden;
144148
display: inline;
145-
149+
146150
}
147151

148152
#swfuploadContent .progressBarInProgress,

modules/remoteprocessing/Notification.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ public function processProcessingResults($params)
151151
{
152152
$tmpArray = array_reverse(explode('.', basename($filepath)));
153153
$item = $uploadComponent->createUploadedItem($userDao, basename($filepath), $filepath, $folder);
154-
$jobModel->addItemRelation($job, $item);
154+
$jobModel->addItemRelation($job, $item, MIDAS_REMOTEPROCESSING_RELATION_TYPE_OUPUT);
155155

156156
// add parameter metadata
157157
if(is_numeric($tmpArray[1]) && isset($params['parametersList']) && isset($params['optionMatrix']))
@@ -178,7 +178,7 @@ public function processProcessingResults($params)
178178
$logFile = BASE_PATH.'/tmp/misc/'.uniqid();
179179
file_put_contents($logFile, $params['log']);
180180
$item = $uploadComponent->createUploadedItem($userDao, 'log.txt', $logFile, $folder);
181-
$jobModel->addItemRelation($job, $item);
181+
$jobModel->addItemRelation($job, $item, MIDAS_REMOTEPROCESSING_RELATION_TYPE_OUPUT);
182182
unlink($logFile);
183183
}
184184
}
@@ -227,7 +227,7 @@ public function addJob($params)
227227
$item = $this->Item->load($itemId);
228228
if($item != false)
229229
{
230-
$this->Remoteprocessing_Job->addItemRelation($job, $item);
230+
$this->Remoteprocessing_Job->addItemRelation($job, $item, MIDAS_REMOTEPROCESSING_RELATION_TYPE_INPUT);
231231
}
232232
}
233233
}

modules/remoteprocessing/configs/module.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ fullname= Remote processing
77
description=
88
;Category
99
category = Processing
10+
dependencies= scheduler,visualization,api
1011

1112
securitykey = ''

modules/remoteprocessing/constant/module.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,8 @@
1515
define("MIDAS_REMOTEPROCESSING_STATUS_WAIT", 0);
1616
define("MIDAS_REMOTEPROCESSING_STATUS_STARTED", 1);
1717
define("MIDAS_REMOTEPROCESSING_STATUS_DONE", 2);
18+
19+
define("MIDAS_REMOTEPROCESSING_RELATION_TYPE_EXECUTABLE", 0);
20+
define("MIDAS_REMOTEPROCESSING_RELATION_TYPE_INPUT", 1);
21+
define("MIDAS_REMOTEPROCESSING_RELATION_TYPE_OUPUT", 2);
1822
?>

modules/remoteprocessing/database/mysql/1.0.0.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ CREATE TABLE IF NOT EXISTS `remoteprocessing_job` (
1515

1616
CREATE TABLE IF NOT EXISTS `remoteprocessing_job2item` (
1717
`job_id` bigint(20) NOT NULL,
18-
`item_id` bigint(20) NOT NULL
18+
`item_id` bigint(20) NOT NULL,
19+
`type` tinyint(4) NOT NULL DEFAULT 0,
1920
);
2021

modules/remoteprocessing/models/dao/JobDao.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,9 @@ class Remoteprocessing_JobDao extends Remoteprocessing_AppDao
1717
public $_module = 'remoteprocessing';
1818

1919

20+
/** get Items */
21+
function getItems()
22+
{
23+
return $this->getModel()->getRelatedItems($this);
24+
}
2025
}

modules/remoteprocessing/models/pdo/JobModel.php

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,38 @@ function getBy($os, $condition, $expiration_date = false, $status = MIDAS_REMOTE
4040
return $return;
4141
}
4242

43+
/** get Related Items */
44+
function getRelatedItems($job)
45+
{
46+
if(!$job instanceof Remoteprocessing_JobDao)
47+
{
48+
throw new Zend_Exception("Should be an item.");
49+
}
50+
51+
$sql = $this->database->select()
52+
->from('remoteprocessing_job2item')
53+
->setIntegrityCheck(false)
54+
->where('job_id = ?', $job->getKey())
55+
->order('item_id DESC');
56+
57+
$loader = new MIDAS_ModelLoader();
58+
$itemModel = $loader->loadModel('Item');
59+
$rowset = $this->database->fetchAll($sql);
60+
$return = array();
61+
foreach($rowset as $row)
62+
{
63+
$tmpDao = $itemModel->load($row['item_id']);
64+
if($tmpDao != false)
65+
{
66+
$return[] = $tmpDao;
67+
unset($tmpDao);
68+
}
69+
}
70+
return $return;
71+
}
72+
4373
/** add item relation*/
44-
function addItemRelation($job, $item)
74+
function addItemRelation($job, $item, $type = MIDAS_REMOTEPROCESSING_RELATION_TYPE_EXECUTABLE)
4575
{
4676
if(!$job instanceof Remoteprocessing_JobDao)
4777
{
@@ -51,7 +81,15 @@ function addItemRelation($job, $item)
5181
{
5282
throw new Zend_Exception("Should be an item.");
5383
}
84+
if(!is_numeric($type))
85+
{
86+
throw new Zend_Exception("Should be a number.");
87+
}
5488
$this->database->link('items', $job, $item);
89+
90+
// sql because the query is simple and it
91+
$data = array('type' => $type);
92+
$this->database->update('remoteprocessing_job2item', $data, 'job_id = '.$job->getKey().' AND item_id = '.$item->getKey());
5593
}
5694

5795
/** get related job */

0 commit comments

Comments
 (0)