Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
v1r0x committed Feb 20, 2016
1 parent 28fa269 commit c3f9480
Show file tree
Hide file tree
Showing 46 changed files with 4,933 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.project
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
# polls
polls
=====

polls for ownCloud

Put the files under <owncloud_dir>/apps/polls and enable it in ownCloud.

The app is also available at the [appstore](https://apps.owncloud.com/content/show.php/Polls?content=167919).
34 changes: 34 additions & 0 deletions appinfo/app.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
/**
* ownCloud - polls
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Vinzenz Rosenkranz <[email protected]>
* @copyright Vinzenz Rosenkranz 2016
*/

namespace OCA\Polls\AppInfo;

$l = \OC::$server->getL10N('polls');

\OC::$server->getNavigationManager()->add(array(
// the string under which your app will be referenced in owncloud
'id' => 'polls',

// sorting weight for the navigation. The higher the number, the higher
// will it be listed in the navigation
'order' => 77,

// the route that will be shown on startup
'href' => \OC::$server->getURLGenerator()->linkToRoute('polls.page.index'),

// the icon that will be shown in the navigation
// this file needs to exist in img/
'icon' => \OC::$server->getURLGenerator()->imagePath('polls', 'app-logo-polls.svg'),

// the title of your application. This will be used in the
// navigation or on the settings page of your app
'name' => $l->t('Polls')
));
112 changes: 112 additions & 0 deletions appinfo/application.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
<?php
/**
* ownCloud - polls
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Vinzenz Rosenkranz <[email protected]>
* @copyright Vinzenz Rosenkranz 2016
*/

namespace OCA\Polls\AppInfo;


use OC\AppFramework\Utility\SimpleContainer;
use \OCP\AppFramework\App;
use \OCA\Polls\Db\AccessMapper;
use \OCA\Polls\Db\CommentMapper;
use \OCA\Polls\Db\DateMapper;
use \OCA\Polls\Db\EventMapper;
use \OCA\Polls\Db\NotificationMapper;
use \OCA\Polls\Db\ParticipationMapper;
use \OCA\Polls\Db\TextMapper;
use \OCA\Polls\Controller\PageController;


class Application extends App {


public function __construct (array $urlParams=array()) {
parent::__construct('polls', $urlParams);

$container = $this->getContainer();

/**
* Controllers
*/
$container->registerService('PageController', function($c) {
/** @var SimpleContainer $c */
return new PageController(
$c->query('AppName'),
$c->query('Request'),
$c->query('UserManager'),
$c->query('Logger'),
$c->query('ServerContainer')->getURLGenerator(),
$c->query('UserId'),
$c->query('AccessMapper'),
$c->query('CommentMapper'),
$c->query('DateMapper'),
$c->query('EventMapper'),
$c->query('NotificationMapper'),
$c->query('ParticipationMapper'),
$c->query('TextMapper')
);
});

$container->registerService('UserManager', function($c) {
return $c->query('ServerContainer')->getUserManager();
});

$container->registerService('Logger', function($c) {
return $c->query('ServerContainer')->getLogger();
});

$server = $container->getServer();
$container->registerService('AccessMapper', function($c) use ($server) {
/** @var SimpleContainer $c */
return new AccessMapper(
$server->getDb()
);
});
$container->registerService('CommentMapper', function($c) use ($server) {
/** @var SimpleContainer $c */
return new CommentMapper(
$server->getDb()
);
});
$container->registerService('DateMapper', function($c) use ($server) {
/** @var SimpleContainer $c */
return new DateMapper(
$server->getDb()
);
});
$container->registerService('EventMapper', function($c) use ($server) {
/** @var SimpleContainer $c */
return new EventMapper(
$server->getDb()
);
});
$container->registerService('NotificationMapper', function($c) use ($server) {
/** @var SimpleContainer $c */
return new NotificationMapper(
$server->getDb()
);
});
$container->registerService('ParticipationMapper', function($c) use ($server) {
/** @var SimpleContainer $c */
return new ParticipationMapper(
$server->getDb()
);
});
$container->registerService('TextMapper', function($c) use ($server) {
/** @var SimpleContainer $c */
return new TextMapper(
$server->getDb()
);
});

}


}
222 changes: 222 additions & 0 deletions appinfo/database.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<database>
<name>*dbname*</name>
<create>true</create>
<overwrite>false</overwrite>
<charset>utf8</charset>
<table>
<name>*dbprefix*polls_events</name>
<declaration>
<field>
<name>id</name>
<type>integer</type>
<notnull>true</notnull>
<autoincrement>1</autoincrement>
<default>0</default>
</field>
<field>
<name>hash</name>
<type>text</type>
<length>64</length>
</field>
<field>
<name>type</name>
<type>integer</type>
<notnull>false</notnull>
<length>16</length>
</field>
<field>
<name>title</name>
<type>text</type>
<notnull>true</notnull>
<length>128</length>
</field>
<field>
<name>description</name>
<type>text</type>
<notnull>true</notnull>
<length>1024</length>
</field>
<field>
<name>owner</name>
<type>text</type>
<notnull>true</notnull>
<length>64</length>
</field>
<field>
<name>created</name>
<type>timestamp</type>
</field>
<field>
<name>access</name>
<type>text</type>
<notnull>false</notnull>
<length>1024</length>
</field>
<field>
<name>expire</name>
<type>timestamp</type>
</field>

</declaration>
</table>
<table>
<name>*dbprefix*polls_dts</name>
<declaration>
<field>
<name>id</name>
<type>integer</type>
<notnull>true</notnull>
<autoincrement>1</autoincrement>
</field>
<field>
<name>poll_id</name>
<type>integer</type>
</field>
<field>
<name>dt</name>
<type>timestamp</type>
<length>32</length>
</field>
</declaration>
</table>
<table>
<name>*dbprefix*polls_txts</name>
<declaration>
<field>
<name>id</name>
<type>integer</type>
<default>0</default>
<notnull>true</notnull>
<autoincrement>1</autoincrement>
</field>
<field>
<name>poll_id</name>
<type>integer</type>
</field>
<field>
<name>text</name>
<type>text</type>
<length>256</length>
</field>
</declaration>
</table>
<table>
<name>*dbprefix*polls_particip</name>
<declaration>
<field>
<name>id</name>
<type>integer</type>
<default>0</default>
<notnull>true</notnull>
<autoincrement>1</autoincrement>
</field>
<field>
<name>poll_id</name>
<type>integer</type>
</field>
<field>
<name>dt</name>
<type>timestamp</type>
</field>
<field>
<name>type</name>
<type>integer</type>
</field>
<field>
<name>user_id</name>
<type>text</type>
<notnull>true</notnull>
<length>64</length>
</field>
</declaration>
</table>
<table>
<name>*dbprefix*polls_particip_text</name>
<declaration>
<field>
<name>id</name>
<type>integer</type>
<default>0</default>
<notnull>true</notnull>
<autoincrement>1</autoincrement>
</field>
<field>
<name>poll_id</name>
<type>integer</type>
</field>
<field>
<name>text</name>
<type>text</type>
<length>256</length>
</field>
<field>
<name>user_id</name>
<type>text</type>
<notnull>true</notnull>
<length>64</length>
</field>
<field>
<name>type</name>
<type>integer</type>
</field>
</declaration>
</table>
<table>
<name>*dbprefix*polls_comments</name>
<declaration>
<field>
<name>id</name>
<type>integer</type>
<notnull>true</notnull>
<autoincrement>1</autoincrement>
<default>0</default>
</field>
<field>
<name>poll_id</name>
<type>integer</type>
</field>
<field>
<name>user_id</name>
<type>text</type>
<notnull>true</notnull>
<length>64</length>
</field>
<field>
<name>dt</name>
<type>text</type>
<notnull>true</notnull>
<length>32</length>
</field>
<field>
<name>comment</name>
<type>text</type>
<notnull>false</notnull>
<length>1024</length>
</field>
</declaration>
</table>
<table>
<name>*dbprefix*polls_notif</name>
<declaration>
<field>
<name>id</name>
<type>integer</type>
<default>0</default>
<notnull>true</notnull>
<autoincrement>1</autoincrement>
</field>
<field>
<name>poll_id</name>
<type>integer</type>
</field>
<field>
<name>user_id</name>
<type>text</type>
<notnull>true</notnull>
<length>64</length>
</field>
</declaration>
</table>

</database>
Loading

0 comments on commit c3f9480

Please sign in to comment.