Commit b094c8f7 authored by Florian Kaiser's avatar Florian Kaiser
Browse files

initial version

parents
language: php
php:
- 5.4
- 5.5
- 5.6
- hhvm
env:
global:
- BRANCH=master
matrix:
- DB=mysql
matrix:
allow_failures:
- php: hhvm
include:
- php: 5.4
env: DB=sqlite
- php: 5.4
env: DB=pgsql
install:
# install ocdev
- sudo apt-get -y install python3-jinja2 python3-setuptools
- sudo easy_install3 requests
- sudo easy_install3 ocdev
# set up postgresql
- createuser -U travis -s oc_autotest
# set up mysql
- mysql -e 'create database oc_autotest;'
- mysql -u root -e "CREATE USER 'oc_autotest'@'localhost' IDENTIFIED BY '';"
- mysql -u root -e "grant all on oc_autotest.* to 'oc_autotest'@'localhost';"
# install owncloud
- cd ..
- ocdev setup core --dir owncloud --branch $BRANCH --no-history
- mv storageusage owncloud/apps
- phpenv config-add owncloud/apps/storageusage/tests/travis/php.ini
- cd owncloud
- ./occ maintenance:install --database-name oc_autotest --database-user oc_autotest --database-pass --admin-user admin --admin-pass admin --database $DB
- ./occ app:enable storageusage
before_script:
- cd apps/storageusage
script:
- phpunit -c phpunit.xml
- phpunit -c phpunit.integration.xml
# Authors
* Florian Kaiser: <florian.kaiser@mpcdf.mpg.de>
owncloud-storageusage (0.0.1)
* First release
\ No newline at end of file
This diff is collapsed.
# Makefile for building the project
app_name=storageusage
project_dir=$(CURDIR)/../$(app_name)
build_dir=$(CURDIR)/build/artifacts
appstore_dir=$(build_dir)/appstore
source_dir=$(build_dir)/source
package_name=$(app_name)
all: dist
clean:
rm -rf $(build_dir)
dist: clean
mkdir -p $(source_dir)
tar cvzf $(source_dir)/$(package_name).tar.gz $(project_dir) \
--exclude-vcs \
--exclude=$(project_dir)/build/artifacts \
--exclude=$(project_dir)/js/node_modules \
--exclude=$(project_dir)/js/coverage
appstore_package: clean
mkdir -p $(appstore_dir)
tar cvzf $(appstore_dir)/$(package_name).tar.gz $(project_dir) \
--exclude-vcs \
--exclude=$(project_dir)/build \
--exclude=$(project_dir)/js/node_modules \
--exclude=$(project_dir)/js/.bowerrc \
--exclude=$(project_dir)/js/.jshintrc \
--exclude=$(project_dir)/js/Gruntfile.js \
--exclude=$(project_dir)/js/*.json \
--exclude=$(project_dir)/js/*.conf.js \
--exclude=$(project_dir)/js/*.log \
--exclude=$(project_dir)/js/README.md \
--exclude=$(project_dir)/js/.bowerrc \
--exclude=$(project_dir)/.travis.yml \
--exclude=$(project_dir)/phpunit*xml \
--exclude=$(project_dir)/Makefile \
--exclude=$(project_dir)/tests
\ No newline at end of file
# Storage Usage
Place this app in **owncloud/apps/**
## Publish to App Store
First get an account for the [App Store](http://apps.owncloud.com/) then run:
make appstore_package
The archive is located in build/artifacts/appstore and can then be uploaded to the App Store.
## Running tests
After [Installing PHPUnit](http://phpunit.de/getting-started.html) run:
phpunit -c phpunit.xml
\ No newline at end of file
<?php
/**
* ownCloud - storageusage
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Florian Kaiser <florian.kaiser@mpcdf.mpg.de>
* @copyright Florian Kaiser 2015
*/
namespace OCA\StorageUsage\AppInfo;
use OCP\AppFramework\App;
$app = new App('storageusage');
$container = $app->getContainer();
$container->query('OCP\INavigationManager')->add(function () use ($container) {
$urlGenerator = $container->query('OCP\IURLGenerator');
$l10n = $container->query('OCP\IL10N');
return [
// the string under which your app will be referenced in owncloud
'id' => 'storageusage',
// sorting weight for the navigation. The higher the number, the higher
// will it be listed in the navigation
'order' => 10,
// the route that will be shown on startup
'href' => $urlGenerator->linkToRoute('storageusage.page.index'),
// the icon that will be shown in the navigation
// this file needs to exist in img/
'icon' => $urlGenerator->imagePath('storageusage', 'app.svg'),
// the title of your application. This will be used in the
// navigation or on the settings page of your app
'name' => $l10n->t('Storage Usage'),
];
});
<?xml version="1.0"?>
<info>
<id>storageusage</id>
<name>Storage Usage</name>
<description>Displays used space for all users</description>
<licence>AGPL</licence>
<author>Florian Kaiser</author>
<version>0.0.1</version>
<namespace>StorageUsage</namespace>
<category>other</category>
<dependencies>
<owncloud min-version="8.1" />
</dependencies>
</info>
<?php
/**
* ownCloud - storageusage
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Florian Kaiser <florian.kaiser@mpcdf.mpg.de>
* @copyright Florian Kaiser 2015
*/
/**
* Create your routes in here. The name is the lowercase name of the controller
* without the controller part, the stuff after the hash is the method.
* e.g. page#index -> OCA\StorageUsage\Controller\PageController->index()
*
* The controller class has to be registered in the application.php file since
* it's instantiated in there
*/
return [
'routes' => [
['name' => 'page#index', 'url' => '/', 'verb' => 'GET'],
['name' => 'page#do_echo', 'url' => '/echo', 'verb' => 'POST'],
]
];
\ No newline at end of file
<?php
/**
* ownCloud - storageusage
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Florian Kaiser <florian.kaiser@mpcdf.mpg.de>
* @copyright Florian Kaiser 2015
*/
namespace OCA\StorageUsage\Controller;
use OCP\IRequest;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\Controller;
class PageController extends Controller {
private $userId;
public function __construct($AppName, IRequest $request, $UserId){
parent::__construct($AppName, $request);
$this->userId = $UserId;
}
/**
* CAUTION: the @Stuff turns off security checks; for this page no admin is
* required and no CSRF check. If you don't know what CSRF is, read
* it up in the docs or you might create a security hole. This is
* basically the only required method to add this exemption, don't
* add it to any other method if you don't exactly know what it does
*
* @NoAdminRequired
* @NoCSRFRequired
*/
public function index() {
$params = ['user' => $this->userId];
return new TemplateResponse('storageusage', 'main', $params); // templates/main.php
}
/**
* Simply method that posts back the payload of the request
* @NoAdminRequired
*/
public function doEcho($echo) {
return new DataResponse(['echo' => $echo]);
}
}
\ No newline at end of file
#hello {
color: red;
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="32" width="32" version="1.1" xmlns:cc="http://creativecommons.org/ns#" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/">
<g transform="translate(573.14 110.3)" fill-rule="evenodd">
<path d="m-570.22-108.3c-0.50115 0-0.92082 0.41966-0.92082 0.92081v24.158c0 0.51739 0.40324 0.92073 0.92082 0.92073h26.158c0.51756 0 0.92081-0.40316 0.92081-0.92073l0.00069-14.154c0-0.5011-0.41966-0.92524-0.92081-0.92524h-21.079l-0.0007 11.005c0 0.48012-0.52409 0.97706-1.0042 0.97706-0.48012 0-0.99573-0.49694-0.99573-0.97706l0.0007-12.143c0-0.48012 0.40484-0.86215 0.88497-0.86215h4.5944l14.521 0.00052-0.0007-2.9516c0-0.56713-0.42551-1.0481-0.99245-1.0481h-13.007v-3.0791c0-0.50118-0.40586-0.92081-0.90701-0.92081z"/>
<path d="m-570.22-107.3c-0.50115 0-0.92082 0.41966-0.92082 0.92081v24.158c0 0.51739 0.40324 0.92073 0.92082 0.92073h26.158c0.51756 0 0.92081-0.40316 0.92081-0.92073l0.00069-14.154c0-0.5011-0.41966-0.92524-0.92081-0.92524h-21.079l-0.0007 11.005c0 0.48012-0.52409 0.97706-1.0042 0.97706-0.48012 0-0.99573-0.49694-0.99573-0.97706l0.0007-12.143c0-0.48012 0.40484-0.86214 0.88497-0.86214h4.5944l14.521 0.00052-0.0007-2.9516c0-0.56713-0.42551-1.0481-0.99245-1.0481h-13.007v-3.0791c0-0.50118-0.40586-0.92081-0.90701-0.92081z" fill="#fff"/>
</g>
</svg>
\ No newline at end of file
/**
* ownCloud - storageusage
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Florian Kaiser <florian.kaiser@mpcdf.mpg.de>
* @copyright Florian Kaiser 2015
*/
(function ($, OC) {
$(document).ready(function () {
$('#hello').click(function () {
alert('Hello from your script file');
});
$('#echo').click(function () {
var url = OC.generateUrl('/apps/storageusage/echo');
var data = {
echo: $('#echo-content').val()
};
$.post(url, data).success(function (response) {
$('#echo-result').text(response.echo);
});
});
});
})(jQuery, OC);
\ No newline at end of file
<phpunit bootstrap="../../lib/base.php">
<testsuites>
<testsuite name="unit">
<directory>./tests/integration</directory>
</testsuite>
</testsuites>
</phpunit>
\ No newline at end of file
<phpunit bootstrap="../../lib/base.php">
<testsuites>
<testsuite name="unit">
<directory>./tests/unit</directory>
</testsuite>
</testsuites>
</phpunit>
\ No newline at end of file
<?php
script('storageusage', 'script');
style('storageusage', 'style');
?>
<div id="app">
<div id="app-navigation">
<?php print_unescaped($this->inc('part.navigation')); ?>
<?php print_unescaped($this->inc('part.settings')); ?>
</div>
<div id="app-content">
<div id="app-content-wrapper">
<?php print_unescaped($this->inc('part.content')); ?>
</div>
</div>
</div>
<p>Hello World <?php p($_['user']) ?></p>
<p><button id="hello">click me</button></p>
<p><textarea id="echo-content">
Send this as ajax
</textarea></p>
<p><button id="echo">Send ajax request</button></p>
Ajax response: <div id="echo-result"></div>
\ No newline at end of file
<ul>
<li><a href="#">First level entry</a></li>
<li>
<a href="#">First level container</a>
<ul>
<li><a href="#">Second level entry</a></li>
<li><a href="#">Second level entry</a></li>
</ul>
</li>
</ul>
\ No newline at end of file
<div id="app-settings">
<div id="app-settings-header">
<button class="settings-button"
data-apps-slide-toggle="#app-settings-content"
></button>
</div>
<div id="app-settings-content">
<!-- Your settings in here -->
</div>
</div>
\ No newline at end of file
<?php
/**
* ownCloud - storageusage
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Florian Kaiser <florian.kaiser@mpcdf.mpg.de>
* @copyright Florian Kaiser 2015
*/
use OCP\AppFramework\App;
use Test\TestCase;
/**
* This test shows how to make a small Integration Test. Query your class
* directly from the container, only pass in mocks if needed and run your tests
* against the database
*/
class AppTest extends TestCase {
private $container;
public function setUp() {
parent::setUp();
$app = new App('storageusage');
$this->container = $app->getContainer();
}
public function testAppInstalled() {
$appManager = $this->container->query('OCP\App\IAppManager');
$this->assertTrue($appManager->isInstalled('storageusage'));
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment