-
Notifications
You must be signed in to change notification settings - Fork 265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cc-5709: Airtime Analyzer #57
base: 2.5.x
Are you sure you want to change the base?
Changes from 67 commits
1009719
a43f487
f432ea9
5873f7b
61df7c1
66000a2
8d9b9c1
42806b1
d081ff1
375ec54
fae5b15
f9f9e24
c586e3e
f428a2d
7968749
6f1dd79
94375ee
04da9b3
a5eb5e9
c2f6032
26a39ed
ace03ed
abcdf5e
c11e39f
721e4e1
9cd200d
2d67484
4b4fd54
5dab498
e4e5590
094382c
16fb9d7
22343ed
d063700
ed494ac
bc080a2
56c3d80
6b7170f
81dd1de
c291439
0040965
691841e
4cdd855
08badfb
8432799
091be8c
e1a0429
9eb0f2f
d21cb59
7caa42c
1373d49
9f9c32a
2e6d382
4548123
a969f8f
5e7fdb9
e3c2ae0
a12ebf2
560d1a9
e5a74e7
24d842c
aeb3bb7
2b70417
1393bad
e84f765
d2e8325
c2411b6
e6bbf8e
6f119b0
e7dfc08
039a511
9d0f564
8e714bc
1aa99e2
7438ecd
aaee522
7ca6b91
82d7f09
3f676be
c09457c
46542d2
72841de
9c2a086
41ff0cc
efb2a5e
7490c81
b38f3d7
f1ea100
ecb072b
f6aa2e5
6fa7ddb
b7d1852
8c27549
dd37ffb
02ea553
aa8a262
6545828
35c450b
4622834
879e776
ca62086
9fe0830
52f3ed8
0ccc7e7
c4692cc
2423ea6
f439072
081ca0a
a10e287
544d20e
28be5c6
f775bed
82f251f
54523e2
53dc92b
9726fb8
8134687
70ff673
7edd993
7018f45
978fc43
01ad2ab
fd39db2
c590869
e236491
54d1bcf
b871b32
52b0db5
7e1d14f
5f98151
27b8f0a
e24b4f4
1dc72d5
ecc0225
fa88e72
c636272
63b357f
eb0f12c
49f3881
b304e2f
dbc5563
5cf5ff4
b324031
c132cac
95517ca
f1fa492
8eaeaf7
2d20e58
71f2cc1
2827db8
7d86ea3
32bdbe1
d42db75
3c73abc
e7e1926
6460854
11a3137
dd3b54f
c829b6b
8ffd707
7db571d
8e8fe2d
544767a
f08535c
884a4c4
8fbe7dd
670a63d
e59cd11
6cb993c
2f93826
8601452
92feacd
432245b
7c0a25b
bf91677
e1f1807
16dc286
53624d8
59ceb11
ec189fc
644e6b0
d73b331
38bd45b
4dd2768
3b1c776
dbfb2fc
29d3d87
e7a742d
6de8bbe
2af14e0
70a2190
ff0a685
7059820
1de3262
6e2f07f
cdabbc6
3f5b4fa
1718868
9a8b34f
13827d9
cf57af0
8d914bc
e5c806f
9d6cf86
2185fc9
7d0f165
89e760f
52a6663
29c5cf5
527d285
38882ab
2c2f7eb
a40067c
38a2924
bade613
230cdcc
476128c
d5ee710
6ebe8ec
134ade8
6adaf7a
43c6475
ea86860
3f97ed3
3f6983a
ee6862e
3e6f3ab
536094e
9baed1b
e32a269
4b6e567
2a9790a
eb40379
a07a1ed
66a6a8f
2ae921e
17f1d0e
487ab9b
cc9e6ef
0177e40
b6acfb2
6d00da8
be7cae4
61a47ae
6858316
73e5fb9
e2130df
90aa1fa
a52e2fa
25e4fb0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,12 +2,11 @@ | |
|
||
class PluploadController extends Zend_Controller_Action | ||
{ | ||
|
||
public function init() | ||
{ | ||
$ajaxContext = $this->_helper->getHelper('AjaxContext'); | ||
$ajaxContext->addActionContext('upload', 'json') | ||
->addActionContext('copyfile', 'json') | ||
$ajaxContext->addActionContext('upload', 'json') | ||
->addActionContext('recent-uploads', 'json') | ||
->initContext(); | ||
} | ||
|
||
|
@@ -18,33 +17,62 @@ public function indexAction() | |
$baseUrl = Application_Common_OsPath::getBaseDir(); | ||
$locale = Application_Model_Preference::GetLocale(); | ||
|
||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'], 'text/javascript'); | ||
$this->view->headScript()->appendFile($baseUrl.'js/plupload/plupload.full.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); | ||
$this->view->headScript()->appendFile($baseUrl.'js/plupload/jquery.plupload.queue.min.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); | ||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/library/plupload.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); | ||
$this->view->headScript()->appendFile($baseUrl.'js/plupload/i18n/'.$locale.'.js?'.$CC_CONFIG['airtime_version'],'text/javascript'); | ||
|
||
$this->view->headLink()->appendStylesheet($baseUrl.'css/plupload.queue.css?'.$CC_CONFIG['airtime_version']); | ||
$this->view->headLink()->appendStylesheet($baseUrl.'css/addmedia.css?'.$CC_CONFIG['airtime_version']); | ||
} | ||
|
||
public function uploadAction() | ||
{ | ||
$upload_dir = ini_get("upload_tmp_dir") . DIRECTORY_SEPARATOR . "plupload"; | ||
$tempFilePath = Application_Model_StoredFile::uploadFile($upload_dir); | ||
$tempFileName = basename($tempFilePath); | ||
|
||
$this->_helper->json->sendJson(array("jsonrpc" => "2.0", "tempfilepath" => $tempFileName)); | ||
} | ||
|
||
public function copyfileAction() | ||
public function recentUploadsAction() | ||
{ | ||
$upload_dir = ini_get("upload_tmp_dir") . DIRECTORY_SEPARATOR . "plupload"; | ||
$filename = $this->_getParam('name'); | ||
$tempname = $this->_getParam('tempname'); | ||
$result = Application_Model_StoredFile::copyFileToStor($upload_dir, | ||
$filename, $tempname); | ||
if (!is_null($result)) | ||
$this->_helper->json->sendJson(array("jsonrpc" => "2.0", "error" => $result)); | ||
if (isset($_GET['uploadFilter'])) { | ||
$filter = $_GET['uploadFilter']; | ||
} else { | ||
$filter = "all"; | ||
} | ||
|
||
$limit = isset($_GET['iDisplayLength']) ? $_GET['iDisplayLength'] : 10; | ||
$rowStart = isset($_GET['iDisplayStart']) ? $_GET['iDisplayStart'] : 0; | ||
|
||
$recentUploadsQuery = CcFilesQuery::create()->filterByDbUtime(array('min' => time() - 30 * 24 * 60 * 60)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this automatically converting a number to a timestamp somewhere? kind of confusing. |
||
->orderByDbUtime(Criteria::DESC); | ||
|
||
$numTotalRecentUploads = $recentUploadsQuery->find()->count(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can just use count() without find. |
||
|
||
if ($filter == "pending") { | ||
$recentUploadsQuery->filterByDbImportStatus("1"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shouldn't need the quotes around the 1 if it's an integer column. |
||
} else if ($filter == "failed") { | ||
$recentUploadsQuery->filterByDbImportStatus(array('min' => 100)); | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. datatables expects another count after filtering for the iTotalDisplayRecords field. |
||
$recentUploads = $recentUploadsQuery->offset($rowStart)->limit($limit)->find(); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should use a transaction here to make sure the count/find match. |
||
$numRecentUploads = $limit; | ||
//CcFilesQuery::create()->filterByDbUtime(array('min' => time() - 30 * 24 * 60 * 60)) | ||
|
||
//$this->_helper->json->sendJson(array("jsonrpc" => "2.0", "tempfilepath" => $tempFileName)); | ||
|
||
$uploadsArray = array(); | ||
|
||
foreach ($recentUploads as $upload) | ||
{ | ||
$upload->toArray(BasePeer::TYPE_FIELDNAME); | ||
//array_push($uploadsArray, $upload); //TODO: $this->sanitizeResponse($upload)); | ||
|
||
//$this->_helper->json->sendJson($upload->asJson()); | ||
//TODO: Invoke sanitization here | ||
array_push($uploadsArray, $upload->toArray(BasePeer::TYPE_FIELDNAME)); | ||
} | ||
|
||
|
||
$this->_helper->json->sendJson(array("jsonrpc" => "2.0")); | ||
$this->view->sEcho = intval($this->getRequest()->getParam('sEcho')); | ||
$this->view->iTotalDisplayRecords = $numTotalRecentUploads; | ||
//$this->view->iTotalDisplayRecords = $numRecentUploads; //$r["iTotalDisplayRecords"]; | ||
$this->view->iTotalRecords = $numTotalRecentUploads; //$r["iTotalRecords"]; | ||
$this->view->files = $uploadsArray; //$r["aaData"]; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should probably use the zend way to get params