summaryrefslogtreecommitdiff
path: root/admin/schema_inc.php
blob: df9b8dbb77190845d23836594bac994e2115f887 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php

$tables = array(
	'pigeonholes' => "
		content_id I4 NOTNULL PRIMARY,
		structure_id I4 NOTNULL PRIMARY
		CONSTRAINT '
			, CONSTRAINT `pigeonholes_content_ref` FOREIGN KEY (`content_id`) REFERENCES `".BIT_DB_PREFIX."liberty_content`( `content_id` )'
	",
	'pigeonhole_members' => "
		parent_id I4 NOTNULL PRIMARY,
		content_id I4 NOTNULL PRIMARY
		CONSTRAINT '
			, CONSTRAINT `pigeonhole_members_parent_ref` FOREIGN KEY (`parent_id`) REFERENCES `".BIT_DB_PREFIX."liberty_content`( `content_id` )
			, CONSTRAINT `pigeonhole_members_content_ref` FOREIGN KEY (`content_id`) REFERENCES `".BIT_DB_PREFIX."liberty_content`( `content_id` )'
	"
);

global $gBitInstaller;

foreach( array_keys( $tables ) AS $tableName ) {
	$gBitInstaller->registerSchemaTable( PIGEONHOLES_PKG_NAME, $tableName, $tables[$tableName] );
}

$gBitInstaller->registerPackageInfo( PIGEONHOLES_PKG_NAME, array(
	'description' => "A Categorisation system that makes it easy to keep an overview of your data. Has a simple, yet powerful interface for categorising multiple pages at once.",
	'license' => '<a href="http://www.gnu.org/licenses/licenses.html#LGPL">LGPL</a>',
) );

// ### Sequences
$sequences = array (
	'pigeonholes_id_seq' => array( 'start' => 1 )
);

$gBitInstaller->registerSchemaSequences( PIGEONHOLES_PKG_NAME, $sequences );

// ### Default Preferences
$gBitInstaller->registerPreferences( PIGEONHOLES_PKG_NAME, array(
	array( PIGEONHOLES_PKG_NAME, 'pigeonholes_display_members','y' ),
	array( PIGEONHOLES_PKG_NAME, 'pigeonholes_limit_member_number','100' ),
	array( PIGEONHOLES_PKG_NAME, 'pigeonholes_list_style','table' ),
	array( PIGEONHOLES_PKG_NAME, 'pigeonholes_menu_text', 'Categories' ),
) );

// ### Default UserPermissions
$gBitInstaller->registerUserPermissions( PIGEONHOLES_PKG_NAME, array(
	array( 'p_pigeonholes_view', 'Can view pigeonholes', 'basic', PIGEONHOLES_PKG_NAME ),
	array( 'p_pigeonholes_insert_member', 'Can insert content into an existing pigeonhole', 'registered', PIGEONHOLES_PKG_NAME ),
	array( 'p_pigeonholes_update', 'Can update pigeonholes', 'editors', PIGEONHOLES_PKG_NAME ),
	//array( 'p_pigeonholes_admin', 'Can administer all aspects of pigeonholes', 'editors', PIGEONHOLES_PKG_NAME ),
) );

// Requirements
$gBitInstaller->registerRequirements( PIGEONHOLES_PKG_NAME, array(
    'liberty' => array( 'min' => '2.1.4' ),
));