From 7d01f5f427ca31e86cdd759bf49a9c95afbad508 Mon Sep 17 00:00:00 2001 From: Frank Karlitschek Date: Sun, 30 Jun 2013 20:53:42 +0200 Subject: [PATCH] A skeleton app for usage in the future --- ajax/thumbnail.php | 31 ++++++++++ appinfo/app.php | 38 ++++++++++++ appinfo/info.xml | 10 ++++ appinfo/version | 1 + css/style.css | 6 ++ img/office.png | Bin 0 -> 328 bytes img/office.svg | 128 ++++++++++++++++++++++++++++++++++++++++ index.php | 39 ++++++++++++ lib/office.php | 48 +++++++++++++++ templates/documents.php | 27 +++++++++ 10 files changed, 328 insertions(+) create mode 100644 ajax/thumbnail.php create mode 100755 appinfo/app.php create mode 100755 appinfo/info.xml create mode 100755 appinfo/version create mode 100755 css/style.css create mode 100644 img/office.png create mode 100644 img/office.svg create mode 100755 index.php create mode 100755 lib/office.php create mode 100755 templates/documents.php diff --git a/ajax/thumbnail.php b/ajax/thumbnail.php new file mode 100644 index 00000000..1f33d47b --- /dev/null +++ b/ajax/thumbnail.php @@ -0,0 +1,31 @@ +. +* +*/ + +OCP\JSON::checkLoggedIn(); +OCP\JSON::checkAppEnabled('office'); +session_write_close(); + +$file = $_GET['filepath']; +\OCP\Preview::show($file,120,120); + + diff --git a/appinfo/app.php b/appinfo/app.php new file mode 100755 index 00000000..38b53ea3 --- /dev/null +++ b/appinfo/app.php @@ -0,0 +1,38 @@ +. + * + */ + +OCP\Util::addStyle( 'office', 'style'); + +OCP\App::register(array('order' => 70, 'id' => 'office', 'name' => 'Office')); + +OCP\App::addNavigationEntry(array( + 'id' => 'office_index', + 'order' => 80, + 'href' => OCP\Util::linkTo('office', 'index.php'), + 'icon' => OCP\Util::imagePath('office', 'office.png'), + 'name' => 'Office') +); + + + +?> diff --git a/appinfo/info.xml b/appinfo/info.xml new file mode 100755 index 00000000..ef648c51 --- /dev/null +++ b/appinfo/info.xml @@ -0,0 +1,10 @@ + + + office + Office + An ownCloud app to work with office documents + AGPL + Frank Karlitschek + 4 + true + diff --git a/appinfo/version b/appinfo/version new file mode 100755 index 00000000..9f8e9b69 --- /dev/null +++ b/appinfo/version @@ -0,0 +1 @@ +1.0 \ No newline at end of file diff --git a/css/style.css b/css/style.css new file mode 100755 index 00000000..48573c58 --- /dev/null +++ b/css/style.css @@ -0,0 +1,6 @@ +#emptyfolder { position:absolute; margin:10em 0 0 10em; font-size:1.5em; font-weight:bold; color:#888; text-shadow:#fff 0 1px 0; } + +.officelist { margin-top:5px; padding:5px; width:100%;} +.officelist tr:hover { backgound-color:#aaa; } +.officelist tr td { padding:5px; } + diff --git a/img/office.png b/img/office.png new file mode 100644 index 0000000000000000000000000000000000000000..9c7ff2642f91b06a93376754d762f402e3f36581 GIT binary patch literal 328 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzmSQK*5Dp-y;YjHK@;M7UB8!3Q zuY)k7lg8`{prB-lYeY$Kep*R+Vo@qXd3m{BW?pu2a$-TMUVc&f>~}U&Kt)GAT^vIq zTHj7P%XdgYpryP=|LIls4+pBNChUH_*q2|-S%ihNUajV&itp_W!dAOkRZ>;j7hbJp zW)NWzzVwREgUd58blHvj6K6F|Z@go$;2GPQ$&E2aMM9T!x83^~&a9f7y>{=Bc~ess zOi3vFr_XH5JLk#H+^r(Vq`BVjIIywtUEbdm@hv|hSH8L#TmPEL<=u5ArOE9Dk`Zjv z8ueV%6&aK-r3s};8XSw69d_?!rNYk@x<-y{%Zxs}i1;4Ly*7AW(kg$07T$X@_xH%{ R-46;122WQ%mvv4FO#n_Ad-VVS literal 0 HcmV?d00001 diff --git a/img/office.svg b/img/office.svg new file mode 100644 index 00000000..8ebf861f --- /dev/null +++ b/img/office.svg @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/index.php b/index.php new file mode 100755 index 00000000..a3b417c7 --- /dev/null +++ b/index.php @@ -0,0 +1,39 @@ +. + * + */ + +require_once('lib/office.php'); + + +OCP\User::checkLoggedIn(); +OCP\JSON::checkAppEnabled('office'); +OCP\App::setActiveNavigationEntry( 'office_index' ); + +OCP\Util::addStyle( 'office', 'style' ); + + +$list=\OCA\Office\Storage::getDocuments(); +$tmpl = new OCP\Template('office', 'documents', 'user'); +$tmpl->assign('list', $list); +$tmpl->printPage(); + + diff --git a/lib/office.php b/lib/office.php new file mode 100755 index 00000000..1bd1deeb --- /dev/null +++ b/lib/office.php @@ -0,0 +1,48 @@ +. + * + */ + + +namespace OCA\Office; + +class Storage { + + public static function getDocuments() { + $documents=array(); + $list=\OCP\Files::searchByMime('video' ); + foreach($list as $l) { + $info=pathinfo($l); + $size=\OC_Filesystem::filesize($l); + $mtime=\OC_Filesystem::filemtime($l); + + $entry=array('url'=>$l,'name'=>$info['filename'],'size'=>$size,'mtime'=>$mtime); + $documents[]=$entry; + } + + + return $documents; + } + + +} + +?> diff --git a/templates/documents.php b/templates/documents.php new file mode 100755 index 00000000..0aadcbb0 --- /dev/null +++ b/templates/documents.php @@ -0,0 +1,27 @@ +No documents are found. Please upload a document into your ownCloud'); + +}else{ + + echo(''); + foreach($_['list'] as $entry) { + echo(' + + + + + + ' + ); + } + echo('
'.$entry['name'].''.\OCP\Util::formatDate($entry['mtime']).''.\OCP\Util::humanFileSize($entry['size']).'
'); + + + +} + +