Skip to content
This repository has been archived by the owner on Dec 27, 2022. It is now read-only.

Commit

Permalink
setup for comments and time tracking, fixed html/css
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-LE committed May 27, 2012
1 parent ea7bb5d commit 3bfc2c7
Show file tree
Hide file tree
Showing 10 changed files with 266 additions and 131 deletions.
1 change: 1 addition & 0 deletions common.php
Expand Up @@ -99,6 +99,7 @@ class Config
'template' => array('default'=>'default', 'type'=>'s'),
'showdate' => array('default'=>0, 'type'=>'i'),
'auth_bypass' => array('default'=>'none', 'type'=>'s'),
'debugmode' => array('default'=>0, 'type'=>'i'),
);

public static $config;
Expand Down
5 changes: 5 additions & 0 deletions core/Lang.class.php
Expand Up @@ -14,6 +14,7 @@ class DefaultLang {
'actionNoteSave' => "save",
'actionNoteCancel' => "cancel",
'error' => "Some error occurred (click for details)",
'error_silent' => "Some error occurred",
'denied' => "Access denied",
'invalidpass' => "Wrong password",
'invalidlogin' => "Invalid credentials",
Expand All @@ -39,6 +40,10 @@ class DefaultLang {
'log_time' => "Log time",
'progress' => "Progress",
'in_progress' => "In progress",
'time_spent' => "Time spent",
'time_today' => "today",
'save' => "Save",
'cancel' => "Cancel",
);

private $default_inc = array
Expand Down
80 changes: 60 additions & 20 deletions db/config.php
@@ -1,31 +1,71 @@
<?php
/*
This file is part of yourTinyTodo by the yourTinyTodo community.
Copyrights for portions of this file are retained by their owners.
Based on myTinyTodo by Max Pozdeev
(C) Copyright 2009-2010 Max Pozdeev <maxpozdeev@gmail.com>
Licensed under the GNU GPL v3 license. See file COPYRIGHT for details.
*/

# Configuration goes here
$config = array();
$config['db'] = 'mysql';
$config['mysql.host'] = 'localhost';
$config['mysql.db'] = 'ytt_test';
$config['mysql.user'] = 'root';
$config['mysql.password'] = '1234';
$config['postgres.host'] = 'localhost';
$config['postgres.db'] = 'yourtinytodo';
$config['postgres.user'] = 'user';
$config['postgres.password'] = '';
$config['prefix'] = 'ytt_';

# Database type: sqlite or mysql
$config['db'] = '';

# Specify these settings if you selected above to use Mysql
$config['mysql.host'] = "localhost";
$config['mysql.db'] = "yytinytodo";
$config['mysql.user'] = "user";
$config['mysql.password'] = "";

# Tables prefix
$config['prefix'] = "ytt_";

# These two parameters are used when yourtinytodo index.php called not from installation directory
# 'url' - URL where index.php is called from (ex.: http://site.com/todo.php)
# 'ytt_url' - directory URL where yourtinytodo is installed (with trailing slash) (ex.: http://site.com/lib/yourtinytodo/)
$config['url'] = '';
$config['ytt_url'] = '';
$config['title'] = '';
$config['lang'] = 'de';
$config['password'] = '';
$config['multiuser'] = 1;
$config['smartsyntax'] = 1;
$config['timezone'] = 'Europe/Berlin';

# Language pack
$config['lang'] = "en";

# Specify password here to protect your tasks from modification,
# or leave empty that everyone could read/write todolist
$config['password'] = "";

# To disable smart syntax uncomment the line below
#$config['smartsyntax'] = 0;

# multi user support
$config['multiuser'] = 0;

# Default Time zone
$config['timezone'] = 'UTC';

# To disable auto adding selected tag comment out the line below or set value to 0
$config['autotag'] = 1;

# duedate calendar format: 1 => y-m-d (default), 2 => m/d/y, 3 => d.m.y
$config['duedateformat'] = 1;

# First day of week: 0-Sunday, 1-Monday, 2-Tuesday, .. 6-Saturday
$config['firstdayofweek'] = 1;

# select session handling mechanism: files or default (php default)
$config['session'] = 'default';

# Date/time formats
$config['clock'] = 24;
$config['dateformat'] = 'd.m.Y';
$config['dateformat2'] = 'd.m.y';
$config['dateformatshort'] = 'd.m';
$config['template'] = 'default';
$config['dateformat'] = 'j M Y';
$config['dateformatshort'] = 'j M';

# Show task date in list
$config['showdate'] = 0;

$config['auth_bypass'] = 'none';
$config['debugmode'] = 0;
?>
13 changes: 9 additions & 4 deletions init.php
Expand Up @@ -19,18 +19,23 @@
require_once(YTTPATH. 'core/Notification.class.php');
require_once(YTTPATH. 'core/TimeTracker.class.php');

ini_set('display_errors', 0);

define('YTT_VERSION', '1.0a');

define('DEBUG_MODE', true);

if(!isset($config)) global $config;
Config::loadConfig($config);
unset($config);

date_default_timezone_set(Config::get('timezone'));

if(Config::get('debugmode')) {
ini_set('display_errors', 1);
error_reporting(E_ALL);
} else {
ini_set('display_errors', 0);
error_reporting(E_NONE);
}


# MySQL Database Connection
if(Config::get('db') == 'mysql')
{
Expand Down
5 changes: 5 additions & 0 deletions lang/de.php
Expand Up @@ -23,6 +23,7 @@ class Lang extends DefaultLang
'actionNoteSave' => "Speichern",
'actionNoteCancel' => "Abbrechen",
'error' => "Ein Fehler ist aufgetreten (hier klicken für Details)",
'error_silent' => "Ein Fehler ist aufgetreten",
'denied' => "Zugriff verweigert",
'invalidpass' => "Falsches Passwort",
'invalidlogin' => "Ungültige Logindaten",
Expand All @@ -47,6 +48,10 @@ class Lang extends DefaultLang
'log_time' => "Zeit erfassen",
'progress' => "Fortschritt",
'in_progress' => "In Arbeit",
'time_spent' => "Zeit erfassen für",
'time_today' => "heute",
'save' => "Speichern",
'cancel' => "Abbrechen",
);

var $inc = array
Expand Down
5 changes: 5 additions & 0 deletions lang/en.php
Expand Up @@ -23,6 +23,7 @@ class Lang extends DefaultLang
'actionNoteSave' => "save",
'actionNoteCancel' => "cancel",
'error' => "Some error occurred (click for details)",
'error_silent' => "Some error occurred",
'denied' => "Access denied",
'invalidpass' => "Wrong password",
'invalidlogin' => "Invalid credentials",
Expand All @@ -47,6 +48,10 @@ class Lang extends DefaultLang
'log_time' => "Log time",
'progress' => "Progress",
'in_progress' => "In progress",
'time_spent' => "Time spent",
'time_today' => "today",
'save' => "Save",
'cancel' => "Cancel",
);

var $inc = array
Expand Down
98 changes: 81 additions & 17 deletions setup.php
Expand Up @@ -196,7 +196,7 @@


$db->ex(
"CREATE TABLE IF NOT EXISTS `ytt_notifications` (
"CREATE TABLE IF NOT EXISTS `{$db->prefix}notifications` (
`id` int(11) NOT NULL auto_increment,
`user_id` int(11) NOT NULL,
`text` varchar(255) NOT NULL,
Expand All @@ -207,7 +207,7 @@


$db->ex(
"CREATE TABLE IF NOT EXISTS `ytt_notification_listeners` (
"CREATE TABLE IF NOT EXISTS `{$db->prefix}notification_listeners` (
`id` int(11) NOT NULL auto_increment,
`user_id` int(11) NOT NULL,
`type` set('task','list','global') character set utf8 NOT NULL,
Expand All @@ -216,6 +216,28 @@
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; ");


$db->ex(
"CREATE TABLE IF NOT EXISTS `{$db->prefix}comments` (
`id` int(11) NOT NULL auto_increment,
`task_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`created` timestamp NOT NULL default CURRENT_TIMESTAMP,
`comment` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; ");


$db->ex(
"CREATE TABLE IF NOT EXISTS `{$db->prefix}time_tracker` (
`id` int(11) NOT NULL auto_increment,
`created` timestamp NOT NULL default CURRENT_TIMESTAMP,
`task_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
`minutes` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; ");


} catch (Exception $e) {
exitMessage("<b>Error:</b> ". htmlarray($e->getMessage()));
}
Expand Down Expand Up @@ -346,45 +368,85 @@
");

$db->ex(
"CREATE TABLE ytt_notifications (
"CREATE TABLE {$db->prefix}notifications (
id integer NOT NULL,
user_id integer,
text character varying,
created timestamp with time zone,
shown integer
);
CREATE SEQUENCE ytt_notifications_id_seq
CREATE SEQUENCE {$db->prefix}notifications_id_seq
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
ALTER SEQUENCE ytt_notifications_id_seq OWNED BY mtt_notifications.id;
ALTER TABLE ytt_notifications ALTER COLUMN id SET DEFAULT nextval('mtt_notifications_id_seq'::regclass);
ALTER TABLE ONLY ytt_notifications
ADD CONSTRAINT ytt_notifications_pkey PRIMARY KEY (id);
ALTER SEQUENCE {$db->prefix}notifications_id_seq OWNED BY {$db->prefix}notifications.id;
ALTER TABLE {$db->prefix}notifications ALTER COLUMN id SET DEFAULT nextval('{$db->prefix}notifications_id_seq'::regclass);
ALTER TABLE ONLY {$db->prefix}notifications
ADD CONSTRAINT {$db->prefix}notifications_pkey PRIMARY KEY (id);
");


$db->ex(
"CREATE TABLE ytt_notification_listeners (
"CREATE TABLE {$db->prefix}notification_listeners (
id integer NOT NULL,
user_id integer,
\"type\" character varying,
value integer
);
COMMENT ON COLUMN ytt_notification_listeners.\"type\" IS '''task'',''list'',''global''';
CREATE SEQUENCE ytt_notification_listeners_id_seq
COMMENT ON COLUMN {$db->prefix}notification_listeners.\"type\" IS '''task'',''list'',''global''';
CREATE SEQUENCE {$db->prefix}notification_listeners_id_seq
START WITH 1
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
ALTER SEQUENCE ytt_notification_listeners_id_seq OWNED BY ytt_notification_listeners.id;
ALTER TABLE ytt_notification_listeners ALTER COLUMN id SET DEFAULT nextval('ytt_notification_listeners_id_seq'::regclass);
ALTER TABLE ONLY ytt_notification_listeners
ADD CONSTRAINT ytt_notification_listeners_pkey PRIMARY KEY (id);
ALTER SEQUENCE {$db->prefix}notification_listeners_id_seq OWNED BY {$db->prefix}notification_listeners.id;
ALTER TABLE {$db->prefix}notification_listeners ALTER COLUMN id SET DEFAULT nextval('{$db->prefix}notification_listeners_id_seq'::regclass);
ALTER TABLE ONLY {$db->prefix}notification_listeners
ADD CONSTRAINT {$db->prefix}notification_listeners_pkey PRIMARY KEY (id);
");


$db->ex(
'CREATE TABLE '.$db->prefix.'comments (
id integer NOT NULL,
task_id integer,
user_id integer,
created timestamp with time zone DEFAULT now(),
"comment" character varying
);'."
CREATE SEQUENCE {$db->prefix}comments_id_seq
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
ALTER SEQUENCE {$db->prefix}comments_id_seq OWNED BY {$db->prefix}comments.id;
ALTER TABLE {$db->prefix}comments ALTER COLUMN id SET DEFAULT nextval('{$db->prefix}comments_id_seq'::regclass);
ALTER TABLE ONLY {$db->prefix}comments
ADD CONSTRAINT {$db->prefix}comments_pkey PRIMARY KEY (id);
");


$db->ex(
"CREATE TABLE {$db->prefix}time_tracker (
id integer NOT NULL,
created timestamp with time zone,
task_id integer,
user_id integer,
minutes integer
);
CREATE SEQUENCE {$db->prefix}time_tracker_id_seq
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;
ALTER SEQUENCE {$db->prefix}time_tracker_id_seq OWNED BY {$db->prefix}time_tracker.id;
ALTER TABLE {$db->prefix}time_tracker ALTER COLUMN id SET DEFAULT nextval('{$db->prefix}time_tracker_id_seq'::regclass);
ALTER TABLE ONLY {$db->prefix}time_tracker
ADD CONSTRAINT {$db->prefix}time_tracker_pkey PRIMARY KEY (id);
");

// Using || to concatenate in YTT is not recommeneded because there are
Expand Down Expand Up @@ -463,8 +525,10 @@

$db->ex('CREATE TABLE '.$db->prefix.'users ("id" INTEGER PRIMARY KEY NOT NULL , "uuid" VARCHAR, "username" VARCHAR, "password" VARCHAR, "email" VARCHAR, "d_created" INTEGER, "role" INTEGER)');

$db->ex('CREATE TABLE "ytt_notifications" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL , "user_id" INTEGER, "text" VARCHAR, "created" DATETIME DEFAULT CURRENT_TIMESTAMP, "shown" INTEGER)');
$db->ex('CREATE TABLE "main"."ytt_notification_listeners" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL , "user_id" INTEGER, "type" VARCHAR, "value" INTEGER)');
$db->ex('CREATE TABLE "{$db->prefix}notifications" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL , "user_id" INTEGER, "text" VARCHAR, "created" DATETIME DEFAULT CURRENT_TIMESTAMP, "shown" INTEGER)');
$db->ex('CREATE TABLE "{$db->prefix}notification_listeners" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL , "user_id" INTEGER, "type" VARCHAR, "value" INTEGER)');
$db->ex('CREATE TABLE "{$db->prefix}comments" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL , "task_id" INTEGER, "user_id" INTEGER, "created" DATETIME DEFAULT CURRENT_TIMESTAMP, "comment" TEXT)');
$db->ex('CREATE TABLE "{$db->prefix}time_tracker" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL , "created" DATETIME, "task_id" INTEGER, "user_id" INTEGER, "minutes" INTEGER)');

} catch (Exception $e) {
exitMessage("<b>Error:</b> ". htmlarray($e->getMessage()));
Expand Down

0 comments on commit 3bfc2c7

Please sign in to comment.