Merge pull request #194 from nextcloud/vue

Move app to Vue.js
This commit is contained in:
Raimund Schlüßler 2019-01-25 21:23:11 +01:00 committed by GitHub
commit 8918f90bd8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
203 changed files with 22652 additions and 33366 deletions

16
.babelrc.js Normal file
View file

@ -0,0 +1,16 @@
module.exports = {
plugins: [
'@babel/plugin-syntax-dynamic-import',
'@babel/plugin-proposal-object-rest-spread'
],
presets: [
[
'@babel/preset-env',
{
targets: {
browsers: ['last 2 versions', 'ie >= 11']
}
}
]
]
}

View file

@ -7,7 +7,7 @@ end_of_line = lf
insert_final_newline = true
# Set default charset and indentation
[*.{php,js}]
[*.{php,js,scss,vue}]
charset = utf-8
indent_style = tab
tab_width = 4

74
.eslintrc.js Normal file
View file

@ -0,0 +1,74 @@
module.exports = {
root: true,
env: {
browser: true,
es6: true,
node: true,
jest: true
},
globals: {
t: false,
n: false,
OC: false,
OCA: false,
moment: true,
},
parserOptions: {
parser: 'babel-eslint'
},
extends: [
'eslint:recommended',
'plugin:node/recommended',
'plugin:vue/recommended',
'standard'
],
plugins: ['vue', 'node'],
rules: {
// space before function ()
'space-before-function-paren': ['error', 'never'],
// curly braces always space
'object-curly-spacing': ['error', 'always'],
// stay consistent with array brackets
'array-bracket-newline': ['error', 'consistent'],
// 1tbs brace style
'brace-style': 'error',
// tabs only
indent: ['error', 'tab'],
'no-tabs': 0,
'vue/html-indent': ['error', 'tab'],
// only debug console
'no-console': ['error', { allow: ['error', 'warn', 'debug'] }],
// classes blocks
'padded-blocks': ['error', { classes: 'always' }],
// always add a trailing comma, for diff readability
'comma-dangle': ["error", "only-multiline"],
// always have the operator in front
'operator-linebreak': ['error', 'before'],
// ternary on multiline
'multiline-ternary': ['error', 'always-multiline'],
// force proper JSDocs
'valid-jsdoc': [2, {
'prefer': {
'return': 'returns'
},
'requireReturn': false,
'requireReturnDescription': false
}],
// es6 import/export and require
'node/no-unpublished-require': ['off'],
'node/no-unsupported-features/es-syntax': ['off'],
// space before self-closing elements
'vue/html-closing-bracket-spacing': 'error',
// code spacing with attributes
'vue/max-attributes-per-line': [
'error',
{
singleline: 3,
multiline: {
max: 3,
allowFirstLine: true
}
}
]
}
};

11
.gitignore vendored
View file

@ -1,11 +1,11 @@
######################
## Files build by make
######################
/css/src/sprite.scss
/css/style.scss
/img/sprites.svg
/js/public/
/js/vendor/
/css/src/sprites-bw.scss
/css/src/sprites-color.scss
/img/bw.svg
/img/color.svg
/js/
#################
## PhpStorm
@ -247,3 +247,4 @@ Various
*.rej
build/
coverage

View file

@ -1,45 +0,0 @@
{
"esnext": true,
"curly": true,
"eqeqeq": true,
"immed": true,
"indent": 4,
"latedef": true,
"newcap": true,
"noarg": true,
"noempty": true,
"nonew": true,
"plusplus": false,
"node": true,
"undef": true,
"unused": false,
"strict": true,
"maxparams": false,
"maxdepth": 4,
"browser": true,
"devel": true,
"jquery": true,
"jasmine": true,
"globals": {
"jQuery": true,
"ICAL": true,
"jstz": true,
"moment": true,
"angular": true,
"app": true,
"OC": true,
"oc_current_user":true,
"oc_requesttoken": true,
"requestToken": true,
"inject": true,
"module": true,
"t": true,
"n": true,
"it": true,
"exports": true,
"escapeHTML": true,
"possible": true,
"dav": true,
"OCA": true
}
}

1
.prettierrc.js Normal file
View file

@ -0,0 +1 @@
module.exports = {};

View file

@ -1,19 +1,22 @@
{
"extends": "stylelint-config-standard",
"plugins": [
"stylelint-scss"
],
"ignoreFiles": [
"./css/src/sprite.scss"
],
"rules": {
"indentation": "tab",
"number-leading-zero": "never",
"comment-empty-line-before": ["always", {
"except": ["first-nested"]
}],
"at-rule-no-unknown": null,
"scss/at-rule-no-unknown": true,
"no-descending-specificity": null
}
"extends": "stylelint-config-recommended-scss",
"rules": {
"indentation": "tab",
"selector-type-no-unknown": null,
"number-leading-zero": null,
"rule-empty-line-before": ["always", {
"ignore": ["after-comment", "inside-block"]
}],
"declaration-empty-line-before": ["never", {
"ignore": ["after-declaration"]
}],
"comment-empty-line-before": null,
"selector-type-case": null,
"selector-list-comma-newline-after": null,
"no-descending-specificity": null,
"string-quotes": "single"
},
"plugins": [
"stylelint-scss"
]
}

232
Makefile
View file

@ -17,10 +17,6 @@
# * tar: for building the archive
# * npm: for building and testing everything JS
#
# If no composer.json is in the app root directory, the Composer step
# will be skipped. The same goes for the package.json which can be located in
# the app root or the js/ directory.
#
# The npm command by launches the npm build script:
#
# npm run build
@ -29,26 +25,10 @@
#
# npm run test
#
# The idea behind this is to be completely testing and build tool agnostic. All
# build tools and additional package managers should be installed locally in
# your project, since this won't pollute people's global namespace.
#
# The following npm scripts in your package.json install and update the
# npm dependencies and use gulp as build system (notice how everything is
# run from the node_modules folder):
#
# "scripts": {
# "test": "node node_modules/gulp-cli/bin/gulp.js karma",
# "prebuild": "npm install && npm upgrade",
# "build": "node node_modules/gulp-cli/bin/gulp.js"
# },
app_name=$(notdir $(CURDIR))
build_tools_directory=$(CURDIR)/build/tools
source_build_directory=$(CURDIR)/build/source/tasks
source_artifact_directory=$(CURDIR)/build/artifacts/source
source_package_name=$(source_artifact_directory)/$(app_name)
appstore_build_directory=$(CURDIR)/build/appstore/tasks
build_directory=$(CURDIR)/build
appstore_build_directory=$(CURDIR)/build/appstore/$(app_name)
appstore_artifact_directory=$(CURDIR)/build/artifacts/appstore
appstore_package_name=$(appstore_artifact_directory)/$(app_name)
npm=$(shell which npm 2> /dev/null)
@ -71,12 +51,12 @@ private_key=$(HOME)/.nextcloud/$(app_name).key
certificate=$(HOME)/.nextcloud/$(app_name).crt
sign=php -f $(occ) integrity:sign-app --privateKey="$(private_key)" --certificate="$(certificate)"
sign_skip_msg="Skipping signing, either no key and certificate found in $(private_key) and $(certificate) or occ can not be found at $(occ)"
ifneq (,$(wildcard $(private_key)))
ifneq (,$(wildcard $(certificate)))
ifneq (,$(wildcard $(occ)))
CAN_SIGN=true
endif
endif
ifneq ("$(wildcard $(private_key))","") #(,$(wildcard $(private_key)))
ifneq ("$(wildcard $(certificate))","")#(,$(wildcard $(certificate)))
ifneq ("$(wildcard $(occ))","")#(,$(wildcard $(occ)))
CAN_SIGN=true
endif
endif
endif
all: build
@ -86,160 +66,80 @@ all: build
# is present, the npm step is skipped
.PHONY: build
build:
make npm
# Installs npm dependencies
.PHONY: npm
npm:
$(npm) run build
# Removes the appstore build
# Sets up the development environment
.PHONY: development
development:
$(npm) install
$(npm) update
$(npm) run dev
# Removes the build directory and the compiled files
.PHONY: clean
clean:
rm -rf ./build
rm -f ./css/src/sprites.scss
rm -f ./css/src/sprites-bw.scss
rm -f ./css/src/sprites-color.scss
rm -f ./img/sprites.svg
rm -f ./img/bw.svg
rm -f ./img/color.svg
rm -f ./js/tasks.js
rm -f ./js/tasks.js.map
rm -rf $(build_directory)
# Same as clean but also removes dependencies installed by npm
.PHONY: distclean
distclean: clean
rm -rf vendor
rm -rf node_modules
rm -rf js/vendor
rm -rf js/node_modules
# Builds the source and appstore package
.PHONY: dist
dist:
make source
make appstore
# Watches the js and scss files
.PHONY: watch
watch:
$(npm) run watch
# Run make and make dist in a Docker container
.PHONY: docker-dist
docker-dist:
docker run --rm -it -v $(CURDIR):/tasks -w /tasks node make docker-target
# Command used inside Docker container; do not invoke directly
.PHONY: docker-target
docker-target:
which rsync zip openssl || (apt-get update && apt-get install -y rsync zip openssl)
make
make dist
# Builds the source package
.PHONY: source
source:
rm -rf $(source_build_directory) $(source_artifact_directory)
mkdir -p $(source_build_directory) $(source_artifact_directory)
rsync -rv . $(source_build_directory) \
--exclude=/.git/ \
--exclude=/.idea/ \
--exclude=/build/ \
--exclude=/js/node_modules/ \
--exclude=/node_modules/ \
--exclude=*.log
ifdef CAN_SIGN
$(sign) --path "$(source_build_directory)"
else
@echo $(sign_skip_msg)
endif
tar -cvzf $(source_package_name).tar.gz -C $(source_build_directory)/../ $(app_name)
# Builds the source package for the app store, ignores php and js tests
# Builds the source package for the app store
.PHONY: appstore
appstore:
rm -rf $(appstore_build_directory) $(appstore_artifact_directory)
appstore: clean build
mkdir -p $(appstore_build_directory) $(appstore_artifact_directory)
rsync -av . $(appstore_build_directory) \
--exclude=/tests \
--exclude=/.git \
--exclude=/.idea \
--exclude=/.babelrc \
--exclude=/.babelrc.js \
--exclude=/.editorconfig \
--exclude=/.eslintrc.js \
--exclude=/.gitattributes \
--exclude=/.gitignore \
--exclude=/.gitlab-ci.yml \
--exclude=/.prettierrc.js \
--exclude=/.scrutinizer.yml \
--exclude=/.stylelintrc \
--exclude=/.travis.yml \
--exclude=/.tx \
--exclude=/.v8flags*.json \
--exclude=/build.xml \
--exclude=/CONTRIBUTING.md \
--exclude=/tasks.sublime-project \
--exclude=/tasks.sublime-workspace \
--exclude=/issue_template.md \
--exclude=/Makefile \
--exclude=/phpunit.xml \
--exclude=/README.md \
--exclude=/CHANGELOG.md \
--exclude=/build \
--exclude=/css/src \
--exclude=/img/src \
--exclude=/.jshintrc \
--exclude=/.stylelintrc \
--exclude=/gulpfile.js \
--exclude=/node_modules \
--exclude=/package.json \
--exclude=/Makefile \
--exclude=/package-lock.json \
--exclude=/js/README.md \
--exclude=/js/README.mkdir \
--exclude=/js/app \
--exclude=/js/config \
--exclude=/js/vendor/**/.bower.json \
--exclude=/js/vendor/**/.npmignore \
--exclude=/js/vendor/**/bower.json \
--exclude=/js/vendor/**/Gruntfile.js \
--exclude=/js/vendor/**/package.json \
--exclude=/js/vendor/**/*.md \
--exclude=/js/vendor/**/karma.conf.js \
--exclude=/js/vendor/**/*.map \
--exclude=/js/vendor/angular-mocks \
--exclude=/js/vendor/angular/angular.js \
--exclude=/js/vendor/angular/angular.min.js.gzip \
--exclude=/js/vendor/angular/angular-csp.css \
--exclude=/js/vendor/angular/index.js \
--exclude=/js/vendor/angular-animate/angular-animate.js \
--exclude=/js/vendor/angular-animate/index.js \
--exclude=/js/vendor/angular-drag-and-drop-lists/angular-drag-and-drop-lists.js \
--exclude=/js/vendor/angular-drag-and-drop-lists/demo \
--exclude=/js/vendor/angular-drag-and-drop-lists/test \
--exclude=/js/vendor/angular-drag-and-drop-lists/LICENSE \
--exclude=/js/vendor/angular-route/angular-route.js \
--exclude=/js/vendor/angular-route/index.js \
--exclude=/js/vendor/angular-sanitize/angular-sanitize.js \
--exclude=/js/vendor/angular-sanitize/index.js \
--exclude=/js/vendor/angular-ui-select/dist/select.js \
--exclude=/js/vendor/angular-ui-select/dist/select.css \
--exclude=/js/vendor/angular-ui-select/docs \
--exclude=/js/vendor/angular-ui-select/composer.json \
--exclude=/js/vendor/angular-ui-select/deploy-docs.sh \
--exclude=/js/vendor/ical.js/build/benchmark \
--exclude=/js/vendor/ical.js/build/ical.js \
--exclude=/js/vendor/ical.js/lib \
--exclude=/js/vendor/ical.js/samples \
--exclude=/js/vendor/ical.js/sandbox \
--exclude=/js/vendor/ical.js/tasks \
--exclude=/js/vendor/ical.js/test-agent \
--exclude=/js/vendor/ical.js/test-agent-server.js \
--exclude=/js/vendor/ical.js/test-agent-coverage.json \
--exclude=/js/vendor/jstimezonedetect/dist/jstz.js \
--exclude=/js/vendor/jstimezonedetect/LICENCE.txt \
--exclude=/js/vendor/ui-select/dist/select.js \
--exclude=/js/vendor/ui-select/dist/select.css \
--exclude=/js/vendor/ui-select/docs \
--exclude=/js/vendor/ui-select/src \
--exclude=/js/vendor/ui-select/test \
--exclude=/js/vendor/ui-select/composer.json \
--exclude=/js/vendor/ui-select/deploy-docs.sh \
--exclude=/js/vendor/ui-select/*.js \
--exclude=/js/vendor/ui-select/LICENSE \
--exclude=/js/vendor_legacy/jquery-timepicker/i18n \
--exclude=/js/vendor_legacy/jquery-timepicker/include \
--exclude=/js/vendor_legacy/jquery-timepicker/legacy_1.2.6 \
--exclude=/js/vendor_legacy/jquery-timepicker/tests \
--exclude=/js/vendor_legacy/jquery-timepicker/index.html \
--exclude=/js/vendor_legacy/jquery-timepicker/jquery.ui.timepicker.css \
--exclude=/js/vendor_legacy/jquery-timepicker/GPL-LICENSE.txt \
--exclude=/js/vendor_legacy/jquery-timepicker/MIT-LICENSE.txt \
--exclude=/js/vendor_legacy/jquery-timepicker/README.md \
--exclude=/js/vendor_legacy/jquery-timepicker/timepicker.png \
--exclude=/screenshots \
--exclude=/timezones/INFO.md
--exclude=/package.json \
--exclude=/README.md \
--exclude=/svg-sprite-bw.json \
--exclude=/svg-sprite-bw.tmpl \
--exclude=/svg-sprite-color.json \
--exclude=/svg-sprite-color.tmpl \
--exclude=/webpack.common.js \
--exclude=/webpack.prod.js \
--exclude=/webpack.dev.js \
--exclude=/build \
--exclude=/coverage \
--exclude=/img/src \
--exclude=/src \
--exclude=/node_modules \
--exclude=/screenshots/ \
--exclude=/test \
--exclude=/tests
ifdef CAN_SIGN
mv $(configdir)/config.php $(configdir)/config-2.php
$(sign) --path="$(appstore_build_directory)"
@ -250,24 +150,14 @@ endif
cd $(appstore_build_directory)/../; \
zip -r $(appstore_package_name).zip $(app_name)
tar -czf $(appstore_package_name).tar.gz -C $(appstore_build_directory)/../ $(app_name)
# create hash
ifdef CAN_SIGN
openssl dgst -sha512 -sign $(private_key) $(appstore_package_name).tar.gz | openssl base64 -out $(appstore_artifact_directory)/$(app_name).sha512
else
@echo "Skipping hashing, no key found in $(private_key)."
endif
# Command for running JS and PHP tests. Works for package.json files in the js/
# and root directory. If phpunit is not installed systemwide, a copy is fetched
# from the internet
# Command for running VUE tests
.PHONY: test
test:
cd js && $(npm) run test
ifeq (, $(shell which phpunit 2> /dev/null))
@echo "No phpunit command available, downloading a copy from the web"
mkdir -p $(build_tools_directory)
curl -sSL https://phar.phpunit.de/phpunit.phar -o $(build_tools_directory)/phpunit.phar
php $(build_tools_directory)/phpunit.phar -c phpunit.xml --coverage-clover build/php-unit.clover
php $(build_tools_directory)/phpunit.phar -c phpunit.integration.xml --coverage-clover build/php-integration.clover
else
phpunit -c phpunit.xml --coverage-clover build/php-unit.clover
phpunit -c phpunit.integration.xml --coverage-clover build/php-unit.clover
endif
$(npm) run test

View file

@ -20,6 +20,6 @@
<repository>https://github.com/nextcloud/tasks.git</repository>
<screenshot>https://raw.githubusercontent.com/nextcloud/tasks/master/screenshots/tasks-1.png</screenshot>
<dependencies>
<nextcloud min-version="13" max-version="15"/>
<nextcloud min-version="15" max-version="16"/>
</dependencies>
</info>

View file

@ -40,5 +40,5 @@ $application->registerRoutes($this, array('routes' => array(
// settings
array('name' => 'settings#get', 'url' => '/settings', 'verb' => 'GET'),
array('name' => 'settings#set', 'url' => '/settings/{type}/{setting}/{value}', 'verb' => 'POST'),
array('name' => 'settings#set', 'url' => '/settings/{setting}/{value}', 'verb' => 'POST'),
)));

118
css/src/markdown.scss Normal file
View file

@ -0,0 +1,118 @@
/**
* Markdown rendering
*/
#markdown {
width: 100% !important;
min-height: 40px;
cursor: text;
p {
margin-bottom: 15px;
}
* {
white-space: normal;
word-wrap: break-word;
overflow-wrap: break-word;
}
a {
opacity: 0.5;
text-decoration: underline;
}
ol,
ul {
margin-left: 20px;
margin-bottom: 10px;
}
ul {
list-style-type: disc;
}
h1 {
font-size: 18px;
font-weight: 600;
margin-bottom: 5px;
}
h2 {
font-size: 16px;
font-weight: 600;
}
h3 {
font-size: 14px;
font-weight: 600;
}
h4 {
font-size: 13px;
font-weight: 600;
}
h6 {
font-size: 12px;
font-weight: 600;
}
pre {
background-color: var(--color-background-dark, $color-lightgrey);
padding: 3px;
overflow: auto;
code {
white-space: pre;
}
}
img {
max-width: 100%;
max-height: 50vh;
margin: auto;
display: block;
}
input[type=checkbox] {
margin: 0px 10px 0px 0px;
line-height: 10px;
font-size: 10px;
display: inline-block;
min-height: 12px;
}
li input[type='checkbox'].checkbox + label::before {
margin-left: -15px;
}
input[type='checkbox'].checkbox + label::before {
position: relative;
z-index: 100;
margin-right: 10px;
margin-top: 0;
}
li input[type='checkbox'].checkbox:not(:checked) + label::before {
background-color: $color-main-background;
}
table {
margin-bottom: 10px;
border-collapse: collapse;
thead {
background-color: var(--color-background-dark, $color-lightgrey);
}
td, th {
border: 1px solid var(--color-background-darker, $color-darkgrey);
padding: 3px;
}
}
blockquote {
padding: 10px 20px;
margin: 0 0 20px;
font-size: 17.5px;
border-left: 5px solid var(--color-background-dark);
}
}

View file

@ -1,264 +0,0 @@
$color-border: nc-darken($color-main-background, 8%);
#app-navigation {
& > ul {
display: flex;
flex-direction: column;
& > li {
display: inline-flex;
flex-wrap: wrap;
order: 1;
flex-shrink: 0;
& > a,
& > ul > li > a {
flex: 1 1 0;
z-index: 100;
}
& .app-navigation-entry-bullet,
& > ul > li > .app-navigation-entry-bullet {
position: absolute;
display: block;
margin: 16px;
width: 12px;
height: 12px;
border: none;
border-radius: 50%;
cursor: pointer;
}
& .app-navigation-entry-menu,
& > ul > li > .app-navigation-entry-menu {
top: 44px;
}
& > a,
& > .app-navigation-entry-deleted {
padding-left: 44px !important;
}
}
}
& .app-navigation-entry-utils {
flex: 0 1 auto;
position: unset;
}
& .active.with-menu > a,
& .with-counter > a {
padding-right: 12px;
}
li .app-navigation-entry-menu > ul > li > a {
line-height: 36px;
height: 36px;
min-height: 36px;
display: flex;
}
.app-navigation-entry-edit {
height: auto;
form {
display: inline-flex;
width: 100%;
}
}
}
.bubble,
.app-navigation-entry-menu,
.popovermenu {
box-shadow: unset;
filter: drop-shadow(0 1px 3px rgba(179, 179, 179, .75));
}
$border-radius: 3px;
/* ---- jQuery UI datepicker ---- */
.ui-widget.ui-datepicker {
margin-top: 10px;
padding: 4px 8px;
width: auto;
border-radius: $border-radius;
border: none;
background: unset;
background-color: $color-main-background;
filter: drop-shadow(0 1px 3px rgba(179, 179, 179, .75));
.ui-state-default,
.ui-widget-content .ui-state-default,
.ui-widget-header .ui-state-default {
border: 1px solid transparent;
background: inherit;
}
.ui-widget-header {
padding: 7px;
font-size: 13px;
border: none;
background-color: $color-main-background;
color: $color-main-text;
.ui-datepicker-title {
line-height: 1;
font-weight: 300;
}
.ui-icon {
opacity: .5;
&.ui-icon-circle-triangle-e {
background: url('../img/arrow-right.svg') center center no-repeat;
}
&.ui-icon-circle-triangle-w {
background: url('../img/arrow-left.svg') center center no-repeat;
}
}
.ui-state-hover .ui-icon {
opacity: 1;
}
}
.ui-datepicker-calendar {
th {
font-weight: normal;
color: nc-lighten($color-main-text, 33%);
opacity: .8;
}
tr:hover {
background-color: inherit;
}
td {
> * {
border-radius: 50%;
text-align: center;
font-weight: normal;
color: $color-main-text;
padding: 6px;
line-height: 12px;
}
&.ui-datepicker-today a:not(.ui-state-hover) {
background-color: nc-lighten($color-main-text, 86%);
}
&.ui-datepicker-current-day a.ui-state-active,
.ui-state-hover,
.ui-state-focus {
background-color: $color-primary;
color: $color-primary-text;
font-weight: bold;
}
&.ui-datepicker-week-end :not(.ui-state-hover),
.ui-priority-secondary:not(.ui-state-hover) {
color: nc-lighten($color-main-text, 33%);
opacity: .8;
}
}
}
}
.ui-datepicker-prev,
.ui-datepicker-next {
border: nc-darken($color-main-background, 14%);
background: $color-main-background;
}
/* ---- jQuery UI timepicker ---- */
.ui-widget.ui-timepicker {
margin-top: 10px !important;
width: auto !important;
border-radius: $border-radius;
filter: drop-shadow(0 1px 3px rgba(179, 179, 179, .75));
.ui-widget-content {
border: none !important;
background: unset;
background-color: $color-main-background;
}
.ui-state-default,
.ui-widget-content .ui-state-default,
.ui-widget-header .ui-state-default {
border: 1px solid transparent;
background: inherit;
}
.ui-widget-header {
padding: 7px;
font-size: 13px;
border: none;
background-color: $color-main-background;
color: $color-main-text;
.ui-timepicker-title {
line-height: 1;
font-weight: 300;
}
}
.ui-timepicker-table {
th {
font-weight: normal;
color: nc-lighten($color-main-text, 33%);
opacity: .8;
}
tr:hover {
background-color: inherit;
}
td {
> * {
border-radius: 50%;
text-align: center;
font-weight: normal;
color: $color-main-text;
padding: 8px 7px;
font-size: .9em;
line-height: 12px;
}
&.ui-timepicker-hour-cell a.ui-state-active,
&.ui-timepicker-minute-cell a.ui-state-active,
.ui-state-hover,
.ui-state-focus {
background-color: $color-primary;
color: $color-primary-text;
font-weight: bold;
}
&.ui-timepicker-minutes:not(.ui-state-hover) {
color: nc-lighten($color-main-text, 33%);
}
&.ui-timepicker-hours {
border-right: 1px solid $color-border;
}
}
}
}
.ui-datepicker::after,
.ui-timepicker.ui-widget::after {
left: 47%;
bottom: 100%;
border: solid transparent;
content: ' ';
height: 0;
width: 0;
position: absolute;
pointer-events: none;
border-color: rgba(0, 0, 0, 0);
border-bottom-color: #fff;
border-width: 9px;
margin-left: -9px;
}

View file

@ -1,19 +1,3 @@
/**
* SCSS variables
*/
//colors
$red: $color-error; // warnings and errors
$red_overdue: #b3312d; // overdue dates and high importance
$yellow: #fd0; // medium importance
$blue_due: #4271a6; // due dates and low importance
$gray_dark: #404040; // text
$gray: #a0a0a0; // inactive text, checkbox-borders and separators
$gray_light: #ccc;
$gray_easy: #f7f7f7;
$black: #000;
$white: #fff;
/**
* rules for app-navigation
*/
@ -34,7 +18,7 @@ $white: #fff;
z-index: -1;
width: 16px;
height: 16px;
background: url('../../../apps/tasks/css/../img/sprites.svg') no-repeat;
background: var(--icon-tasks-bw-000) no-repeat;
margin: 14px;
margin-left: -30px;
background-position: inherit;
@ -67,16 +51,10 @@ $white: #fff;
display: none;
}
&.caldav .app-navigation-entry-edit.caldav {
display: inline-block;
height: auto;
}
.app-navigation-entry-edit {
padding-left: 5px !important;
&.name,
&.caldav {
&.name {
display: none;
}
}
@ -90,14 +68,10 @@ $white: #fff;
}
.app-navigation-entry-edit {
&.name input[type="text"] {
&.name input[type='text'] {
width: calc(100% - 72px);
}
&.caldav input[type="text"] {
width: calc(100% - 36px);
}
input.action {
background-color: $gray_easy;
width: 36px;
@ -117,39 +91,64 @@ $white: #fff;
font-size: 100%;
}
.app-navigation-entry-menu li {
float: inherit;
width: auto !important;
cursor: pointer;
&:hover a {
opacity: 1 !important;
.app-navigation-entry-menu {
ul {
align-items: unset;
}
&.confirmed a {
&.confirmation-confirm {
display: inline-block !important;
opacity: 1;
}
&.confirmation-abort {
display: inline-block !important;
opacity: 1;
}
}
img {
cursor: pointer;
margin-right: 5px;
vertical-align: text-bottom;
}
span {
cursor: pointer;
}
button {
li {
float: inherit;
width: auto !important;
cursor: pointer;
height: 36px;
/*
* rules for confirmation directive
*/
> a {
&:not(:empty).confirmation-confirm {
padding: 0 !important;
}
span.countdown {
background-color: inherit;
color: $white;
display: block;
text-align: center;
filter: alpha(opacity=100) !important;
opacity: 1 !important;
}
}
&:hover a {
opacity: 1 !important;
}
&.confirmed a {
&.confirmation-confirm {
display: inline-block !important;
opacity: 1;
}
&.confirmation-abort {
display: inline-block !important;
opacity: 1;
}
}
img {
cursor: pointer;
margin-right: 5px;
vertical-align: text-bottom;
}
span {
cursor: pointer;
}
button {
float: inherit;
}
}
}
@ -178,9 +177,22 @@ $white: #fff;
justify-content: center;
align-items: center;
.color-selector-label {
display: block;
height: 24px;
width: calc(100% / 9) !important;
background-image: url('../img/color_picker.svg');
background-repeat: no-repeat;
background-position: center center;
.color-selector {
visibility: hidden;
}
}
li {
height: 24px;
width: calc(100% / 10) !important;
width: calc(100% / 9) !important;
&.selected {
border: 1px solid $gray_dark;
@ -198,27 +210,6 @@ $white: #fff;
}
}
/**
* rules for confirmation directive
*/
.app-navigation-entry-menu {
li > a {
&:not(:empty).confirmation-confirm {
padding: 0 !important;
}
span.countdown {
background-color: inherit;
color: $white;
display: block;
text-align: center;
filter: alpha(opacity=100) !important;
opacity: 1 !important;
}
}
}
.confirmation-default {
overflow: hidden;
}
@ -248,7 +239,6 @@ $white: #fff;
.confirmation-confirm {
@extend .confirmation-abort;
background-color: $red !important;
cursor: default !important;
}
@ -264,38 +254,42 @@ $white: #fff;
li {
line-height: 3em;
position: relative;
display: flex;
height: 40px;
label {
white-space: nowrap;
padding-right: 10px;
}
&.headline {
font-weight: bold;
line-height: 1.5em;
line-height: 50px;
}
.label-container {
white-space: nowrap;
padding-right: 115px;
text-overflow: ellipsis;
width: 100%;
overflow: hidden;
height: 100%;
float: left;
}
select {
position: absolute;
right: 0;
float: right;
min-width: 105px;
text-overflow: ellipsis;
margin-left: auto;
}
}
}
#collection_today > a > span.date {
position: absolute;
font-size: 7px;
left: 18px;
top: 1.5px;
font-size: 6px;
left: 17px;
top: 2px;
width: 10px;
text-align: center;
font-weight: bold;
}
#app-settings .label-container span.icon {
@ -330,10 +324,6 @@ $white: #fff;
float: left;
height: 34px;
&.focus {
background-color: $white;
}
.icon {
position: absolute;
top: 6px;
@ -366,7 +356,7 @@ $white: #fff;
overflow-y: auto;
}
.task-body .title-wrapper span.title a {
.task-body .task-info-wrapper .title span a {
cursor: pointer;
text-decoration: underline;
}
@ -394,10 +384,6 @@ $white: #fff;
.grouped-tasks {
position: relative;
}
.completed-hidden ol.completed-tasks {
display: none;
}
}
h2 {
@ -421,26 +407,6 @@ $white: #fff;
}
}
ol[dnd-list] {
.dndDraggingSource {
display: none;
}
.dndPlaceholder {
display: block;
background-color: $gray_light;
min-height: 37px;
}
.copy.dndDraggingSource {
display: block;
}
}
.dropzone-visible > ol[dnd-list] {
min-height: 50px;
}
/**
* rules for task-items
*/
@ -469,11 +435,9 @@ ol[dnd-list] {
}
&.add-subtask {
background: $white;
border: 1px solid $gray_light;
input {
background: transparent none repeat scroll 0 0 !important;
border: medium none !important;
border-radius: 0 !important;
box-shadow: none !important;
@ -491,10 +455,6 @@ ol[dnd-list] {
.subtasks-container {
margin-left: 35px;
&.subtaskshidden li.subtask {
display: none;
}
.task-item {
margin-top: -1px;
}
@ -502,7 +462,6 @@ ol[dnd-list] {
}
.task-body {
background-color: $white;
height: 37px;
list-style: none outside none;
margin: 0;
@ -518,35 +477,6 @@ ol[dnd-list] {
box-shadow: inset 4px 0 var(--color-primary);
}
&.attachment .icon.icon-note {
display: inline-block;
float: right;
}
&.subtasks .icon.subtasks {
display: inline-block;
}
&.completedsubtasks .icon.toggle-completed-subtasks {
display: inline-block;
}
.categories-list {
display: inline-block;
vertical-align: middle;
li {
background-color: $gray_easy;
border: 1px solid $gray_light;
border-radius: 2px;
color: $gray;
float: left;
font-weight: bold;
margin: -2px 4px 0;
padding: 2px 5px;
}
}
.icon {
&.large {
margin: 8px;
@ -568,30 +498,53 @@ ol[dnd-list] {
opacity: 1;
}
}
&.subtasks {
display: none;
}
&.toggle-completed-subtasks {
display: none;
}
}
.title-wrapper {
.task-info-wrapper {
cursor: pointer;
color: $gray_dark;
display: block;
display: flex;
line-height: 16px;
margin: 0 0 0 44px;
margin: 0;
overflow: hidden;
padding: 9px 0;
position: relative;
text-overflow: ellipsis;
white-space: nowrap;
.title {
cursor: text;
display: inline-flex;
padding: 10px;
}
.categories-list {
padding: 8px;
vertical-align: middle;
display: inline-flex;
text-overflow: ellipsis;
flex-wrap: nowrap;
overflow: hidden;
.category {
overflow: hidden;
display: inline-flex;
min-width: 45px;
background-color: $gray_easy;
border: 1px solid $gray_light;
border-radius: 2px;
margin: 0 4px;
.category-label {
color: $gray;
font-weight: bold;
padding: 2px 4px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
width: 100%;
text-align: center;
}
}
}
}
@ -613,6 +566,16 @@ ol[dnd-list] {
font-size: 11px;
line-height: 14px;
margin: 10px;
.calendar-indicator {
position: relative;
display: inline-block;
width: 8px;
height: 8px;
border: none;
border-radius: 50%;
cursor: pointer
}
}
.percentbar {
@ -667,16 +630,14 @@ ol[dnd-list] {
border-top: 1px solid $gray_light;
flex: 0 0 auto;
height: 30px;
display: flex;
justify-content: space-between;
a {
padding: 7px;
&.left {
float: left;
}
&.right {
float: right;
&.info {
cursor: default;
}
.icon {
@ -704,12 +665,17 @@ ol[dnd-list] {
}
}
.status-display {
float: right;
margin: 17px 0;
}
.title-text {
cursor: text;
display: inline-block;
min-height: 24px;
margin: 13px 0;
width: calc(100% - 115px);
width: calc(100% - 116px);
padding: 0 6px;
line-height: 22px;
// this border is to adjust the size of the div to the size
@ -728,12 +694,11 @@ ol[dnd-list] {
}
.expandable-container {
background: none repeat scroll 0 0 $white;
border: 1px solid $gray;
padding: 0 6px;
display: none !important;
margin: 13px 0;
width: calc(100% - 115px);
width: calc(100% - 116px);
line-height: 24px;
min-height: 24px;
@ -753,13 +718,19 @@ ol[dnd-list] {
}
.star {
padding: 13px;
padding: 13px 13px 13px 8px;
float: right;
.icon {
height: 24px;
width: 24px;
background-size: 144px 144px;
&.icon-color {
background-size: 96px 72px;
}
&.icon-bw {
background-size: 120px 120px;
}
}
}
@ -805,12 +776,12 @@ ol[dnd-list] {
position: relative;
.section {
border-bottom: 1px dotted $gray;
border-bottom: 1px dotted var(--color-text-lighter);
padding: 0;
position: relative;
margin-bottom: 0;
width: 100%;
color: $gray;
color: var(--color-text-lighter);
&:last-of-type {
border-bottom: unset;
@ -836,7 +807,8 @@ ol[dnd-list] {
&.date .icon {
&.icon-calendar-due,
&.icon-calendar-overdue,
&.icon-percent {
&.icon-percent,
&.icon-percent-active {
opacity: 1;
}
}
@ -913,23 +885,33 @@ ol[dnd-list] {
margin: 0;
float: unset;
}
.calendar-indicator {
position: relative;
display: inline-block;
width: 16px;
height: 16px;
border: none;
border-radius: 50%;
cursor: pointer;
vertical-align: middle;
}
}
input[type="range"] {
input[type='range'] {
border: medium none;
box-shadow: none;
width: calc(100% - 50px);
vertical-align: middle;
}
input[type="text"] {
input[type='number'] {
background: none repeat scroll 0 0 $gray_easy;
margin: 0;
min-height: 0;
}
input {
background-color: $white;
border-radius: 0;
margin-top: 0;
color: $gray_dark;
@ -937,14 +919,6 @@ ol[dnd-list] {
outline: medium none;
padding: 4px;
&.datepicker-input {
width: 60%;
}
&.timepicker-input {
width: calc(40% - 10px);
}
&.duration-input {
margin: 2px 0 0 .3em;
width: 35px;
@ -970,67 +944,70 @@ ol[dnd-list] {
.section-edit {
display: none;
margin-left: 12px;
padding-left: 12px;
vertical-align: middle;
width: calc(100% - 80px);
line-height: 0;
}
.detail-categories-container {
width: calc(100% - 40px);
display: inline-block;
margin-left: 12px;
}
&.detail-categories .select2-container-multi {
.select2-choices {
border: 1px solid transparent;
.select2-search-choice {
color: $blue_due;
font-weight: bold;
line-height: 14px;
margin: 2px 0 3px 5px;
background-image: none;
background-color: $gray_easy;
box-shadow: none;
border-color: $gray_light;
padding: 3px 5px 3px 18px;
a.select2-search-choice-close {
opacity: .4;
display: initial;
@extend .icon;
@extend .icon-close;
&:hover {
opacity: 1;
}
}
.mx-datepicker {
&.date {
width: 59%;
}
&.time {
width: 40%
}
}
&.select2-container-disabled .select2-choices {
background-color: $white;
background-image: none;
border: none;
cursor: default;
}
}
.select2-search-field input {
border: 0 none;
box-shadow: none;
font-weight: bold;
margin-top: 0;
font-family: inherit;
}
&.active .select2-search-field input {
.detail-calendar-container .multiselect__single {
color: $blue_due;
}
.detail-categories-container,
.detail-calendar-container {
width: calc(100% - 52px);
display: inline-block;
margin-left: 12px;
.multiselect.multiselect-vue {
width: 100%;
margin: 1px -1px;
vertical-align: middle;
&.multiselect--active .multiselect__tags {
border: 1px solid var(--color-border-dark);
}
.multiselect__tags {
border: 1px solid transparent;
.multiselect__tags-wrap {
padding-left: 0px;
}
.multiselect__input {
padding: 0px !important;
font-weight: bold;
}
.multiselect__single {
padding-left: 0px !important;
font-weight: bold;
}
}
.multiselect__tag {
color: $blue_due;
background: $gray_easy;
font-weight: bold;
}
.multiselect__element {
line-height: 1.1em;
}
}
}
.note {
border-width: 1px;
border-style: solid;
@ -1100,8 +1077,6 @@ ol[dnd-list] {
.display-view {
cursor: text;
display: block;
white-space: pre-wrap;
}
.edit-view {
@ -1114,10 +1089,6 @@ ol[dnd-list] {
}
.disabled .body .section {
.select2-search-field input {
width: auto;
display: block !important;
}
&.date:hover .icon.icon-trash {
display: none;
@ -1126,23 +1097,6 @@ ol[dnd-list] {
}
}
/**
* timepicker fixes
*/
.ui-timepicker-table td a {
display: block;
width: 14px;
}
/**
* datepicker fixes
*/
.ui-widget.ui-datepicker .ui-datepicker-calendar td > a {
width: 18px;
line-height: 18px;
height: 18px;
}
/**
* rules for icons
*/
@ -1159,10 +1113,6 @@ ol[dnd-list] {
.icon {
opacity: .7;
}
.detail-checkbox:not(.disabled) {
border-color: $black;
}
}
.icon {
@ -1193,23 +1143,24 @@ ol[dnd-list] {
&.icon-checkmark,
&.icon-tag-active,
&[class*=" icon-task-star-"] {
&[class*=' icon-task-star-'] {
opacity: 1 !important;
}
&.task-checkbox,
&.detail-checkbox {
border-radius: 3px;
border: 1px solid $gray;
border: 1px solid var(--color-main-text);
float: left;
margin: 9px;
opacity: 0.5;
&:not(.icon-checkmark) {
background: unset;
}
&:not(.disabled):hover {
border-color: $black;
opacity: 0.7;
}
&.disabled {
@ -1217,31 +1168,14 @@ ol[dnd-list] {
}
}
&.icon-note {
display: none;
}
&.right {
float: right;
}
}
#status {
padding: 10px 0 18px !important;
height: 22px !important;
background-color: transparent !important;
font-weight: bold;
color: $gray;
font-size: 13px !important;
&.emptycontent {
position: relative;
}
}
/**
* rules for sortorder-dropdown
*/
* rules for sortorder-dropdown
*/
.sortorder-dropdown-button {
background-color: $gray_easy;
@ -1269,7 +1203,7 @@ ol[dnd-list] {
}
.icon {
margin: 12px 8px;
margin: 11px 8px;
&.sort-indicator {
margin-left: auto;
@ -1296,7 +1230,7 @@ ol[dnd-list] {
& > a span {
opacity: 1 !important;
&[class*=" icon-"] {
&[class*=' icon-'] {
padding: 0;
background-size: auto;
@ -1343,3 +1277,51 @@ ol[dnd-list] {
}
}
}
.tooltip-arrow {
width: unset !important;
}
.icon span{
font-family: var(--font-face);
}
.task-status-container {
float:right;
margin: 8px;
}
.status-display {
display: inline-block;
width: 16px;
height: 16px;
&.success {
@extend .icon-color;
@extend .icon-checkmark-color;
}
&.refresh {
background-image: var(--icon-history-000);
animation: pulse 2s infinite;
border-radius: 50%;
opacity: .5;
cursor: pointer;
&:hover{
opacity: .7;
}
}
}
@keyframes pulse {
0% {
box-shadow: 0 0 0 0 rgba(50, 50, 50, .4);
}
70% {
box-shadow: 0 0 0 10px rgba(50, 50, 50, 0);
}
100% {
box-shadow: 0 0 0 0 rgba(50, 50, 50, 0);
}
}

15
css/src/vars.scss Normal file
View file

@ -0,0 +1,15 @@
/**
* SCSS variables
*/
//colors
$red: #e9322d; // warnings and errors
$red_overdue: #b3312d; // overdue dates and high importance
$yellow: #fd0; // medium importance
$blue_due: #4271a6; // due dates and low importance
$gray_dark: var(--color-main-text); // text
$gray: #a0a0a0; // inactive text, checkbox-borders and separators
$gray_light: var(--color-border-dark);
$gray_easy: var(--color-background-dark);
$black: #000;
$white: #fff;

View file

@ -19,9 +19,8 @@
*
*/
angular.module('Tasks').directive('autofocusOnInsert', function() {
'use strict';
return function(scope, elm) {
return elm.focus();
};
});
@import './src/vars';
@import './src/sprites-color';
@import './src/sprites-bw';
@import './src/style';
@import './src/markdown';

View file

@ -1,158 +0,0 @@
/**
* Nextcloud - Inventory
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Bernhard Posselt <dev@bernhard-posselt.com>
* @copyright Bernhard Posselt 2012, 2014
*
* @author Georg Ehrke
* @copyright 2017 Georg Ehrke <oc.list@georgehrke.com>
*
* @author Raimund Schlüßler
* @copyright 2018 Raimund Schlüßler <raimund.schluessler@mailbox.org>
*/
/*jslint node: true */
'use strict';
// get plugins
const gulp = require('gulp'),
uglify = require('gulp-uglify'),
jshint = require('gulp-jshint'),
KarmaServer = require('karma').Server,
concat = require('gulp-concat'),
wrap = require('gulp-wrap'),
strip = require('gulp-strip-banner'),
babel = require('gulp-babel'),
stylelint = require('gulp-stylelint'),
sourcemaps = require('gulp-sourcemaps'),
svgSprite = require('gulp-svg-sprite'),
npmFiles = require('gulp-npm-files');
// configure
const buildTarget = 'app.min.js';
const scssBuildTarget = 'style.scss';
const karmaConfig = __dirname + '/tests/js/config/karma.js';
const destinationFolder = __dirname + '/js/public/';
const scssDestinationFolder = __dirname + '/css/';
const jsSources = [
'./js/app/**/*.js'
];
const scssSources = [
'./css/src/*.scss'
];
const testSources = ['./tests/js/unit/**/*.js'];
const lintSources = jsSources.concat(testSources).concat(['*.js']);
const watchSources = lintSources;
const svgConfig = {
shape: {
transform: []
},
mode: {
css: { // Activate the «css» mode
bust: false,
common: 'icon',
dimensions: '',
prefix: '.icon-%s',
sprite: "../img/sprites.svg",
render: {
scss: {
dest: "src/sprite.scss"
}
}
}
}
};
// tasks
gulp.task('build', ['lint'], () => {
return gulp.src(jsSources)
.pipe(babel({
presets: ['es2015'],
compact: false,
babelrc: false,
ast: false
}))
.pipe(strip())
.pipe(sourcemaps.init({identityMap: true}))
.pipe(concat(buildTarget))
.pipe(wrap(`(function($, oc_requesttoken, undefined){
'use strict';
<%= contents %>
})(jQuery, oc_requesttoken);`))
.pipe(uglify())
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(destinationFolder));
});
gulp.task('default', ['build', 'vendor', 'scsslint', 'scssConcat']);
gulp.task('lint', () => {
return gulp.src(lintSources)
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter('default'))
.pipe(jshint.reporter('fail'));
});
gulp.task('scsslint', () => {
return gulp.src(scssSources)
.pipe(stylelint ({
reporters: [{
formatter: 'string',
console: true
}]
}));
});
gulp.task('scssConcat', ['svg_sprite'], () => {
return gulp.src(scssSources)
.pipe(concat(scssBuildTarget))
.pipe(gulp.dest(scssDestinationFolder));
});
gulp.task('scssConcatWatch', ['scsslint'], () => {
return gulp.src(scssSources)
.pipe(concat(scssBuildTarget))
.pipe(gulp.dest(scssDestinationFolder));
});
gulp.task('watch', () => {
gulp.watch(watchSources, ['build']);
gulp.watch(scssSources, ['scssConcatWatch']);
});
gulp.task('karma', (done) => {
new KarmaServer({
configFile: karmaConfig,
singleRun: true,
browsers: ['Firefox'],
reporters: ['progress', 'coverage']
}, done).start();
});
gulp.task('watch-karma', (done) => {
new KarmaServer({
configFile: karmaConfig,
autoWatch: true,
browsers: ['Firefox'],
reporters: ['progress', 'coverage']
}, done).start();
});
gulp.task('svg_sprite', () => {
return gulp.src('**/*.svg', {cwd: 'img/src'})
.pipe(svgSprite(svgConfig))
.pipe(gulp.dest('.'));
});
gulp.task("vendor", () => {
return gulp.src(npmFiles(), { base: "./node_modules" })
.pipe(gulp.dest('./js/vendor'));
});

5
img/color_picker.svg Normal file
View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generator: Adobe Illustrator 17.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg id="Layer_1" width="15" height="15" enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 100 100" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<path d="m91.645 8.355c-4.474-4.474-11.727-4.474-16.2 0l-13.5 13.501-3.727-3.727c-1.959-1.959-5.134-1.959-7.093 0s-1.959 5.134 0 7.093l3.727 3.727-41.51 41.508c-2.039 2.039-3.149 4.656-3.329 7.324-0.073 1.087-0.347 3.105-0.675 5.292-0.053 0.359-0.212 0.706-0.487 0.983l-3.105 3.106c-0.994 0.994-0.994 2.606 0 3.6l3.493 3.493c0.994 0.994 2.606 0.994 3.6 0l3.106-3.105c0.277-0.275 0.622-0.433 0.981-0.486 2.187-0.329 4.205-0.602 5.293-0.675 2.668-0.18 5.285-1.29 7.325-3.33l41.508-41.508 3.727 3.727c1.959 1.959 5.134 1.959 7.093 0s1.959-5.134 0-7.093l-12.365-12.366 9.697 7.577 12.44-12.441c4.475-4.473 4.474-11.726 1e-3 -16.2zm-26.594 34.394l-20.53 20.53c-0.994 0.994-2.606 0.994-3.6 0l-3.27-3.27c-0.994-0.993-2.605-0.993-3.599 1e-3l-0.616 0.616-2e-3 -2e-3 -14.728 14.727c-0.337 0.337-0.819 0.401-1.076 0.143s-0.194-0.74 0.143-1.076l23.841-23.841 4e-3 4e-3 15.633-15.633c0.994-0.994 2.606-0.994 3.6 0l4.2 4.201c0.994 0.994 0.994 2.606 0 3.6z" fill="#fff"/>
<metadata><rdf:RDF><cc:Work><dc:format>image/svg+xml</dc:format><dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/><cc:license rdf:resource="http://creativecommons.org/licenses/publicdomain/"/><dc:publisher><cc:Agent rdf:about="http://openclipart.org/"><dc:title>Openclipart</dc:title></cc:Agent></dc:publisher></cc:Work><cc:License rdf:about="http://creativecommons.org/licenses/publicdomain/"><cc:permits rdf:resource="http://creativecommons.org/ns#Reproduction"/><cc:permits rdf:resource="http://creativecommons.org/ns#Distribution"/><cc:permits rdf:resource="http://creativecommons.org/ns#DerivativeWorks"/></cc:License></rdf:RDF></metadata></svg>

After

Width:  |  Height:  |  Size: 2 KiB

View file

Before

Width:  |  Height:  |  Size: 150 B

After

Width:  |  Height:  |  Size: 150 B

View file

Before

Width:  |  Height:  |  Size: 176 B

After

Width:  |  Height:  |  Size: 176 B

View file

Before

Width:  |  Height:  |  Size: 372 B

After

Width:  |  Height:  |  Size: 372 B

View file

Before

Width:  |  Height:  |  Size: 737 B

After

Width:  |  Height:  |  Size: 737 B

View file

Before

Width:  |  Height:  |  Size: 553 B

After

Width:  |  Height:  |  Size: 553 B

1
img/src/bw/clock.svg Normal file
View file

@ -0,0 +1 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-opacity="0" stroke="#000" stroke-width="1.5"><circle cx="8" cy="8" r="5"/><path d="m5.1005 12.027-1.5 2.5981"/><path d="m10.9 12.027 1.5 2.5981"/><path d="m4.9731 1.6495-2.5981 1.5"/><path d="m11.027 1.6495 2.5981 1.5"/><path d="m8 5v3h2"/></g></svg>

After

Width:  |  Height:  |  Size: 368 B

View file

Before

Width:  |  Height:  |  Size: 262 B

After

Width:  |  Height:  |  Size: 262 B

View file

Before

Width:  |  Height:  |  Size: 220 B

After

Width:  |  Height:  |  Size: 220 B

1
img/src/bw/hide.svg Normal file
View file

@ -0,0 +1 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-opacity="0" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"><path d="m8.7576 14.243 6.4924-6.243-6.4924-6.2427"/><path d="m0.76074 8h14.479"/></g></svg>

After

Width:  |  Height:  |  Size: 302 B

View file

Before

Width:  |  Height:  |  Size: 139 B

After

Width:  |  Height:  |  Size: 139 B

1
img/src/bw/manual.svg Normal file
View file

@ -0,0 +1 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-opacity="0" stroke="#000" stroke-linejoin="round" stroke-width="1.5"><rect x="4.75" y="1.75" width="9.5" height="9.5"/><polyline points="3.5 4.75 1.75 4.75 1.75 7"/><polyline points="1.75 12 1.75 14.25 4 14.25"/><polyline points="9 14.25 11.25 14.25 11.25 13"/><line x1="1.75" x2="1.75" y1="8" y2="11"/><line x1="5" x2="8" y1="14.25" y2="14.25"/></g></svg>

After

Width:  |  Height:  |  Size: 474 B

View file

Before

Width:  |  Height:  |  Size: 392 B

After

Width:  |  Height:  |  Size: 392 B

1
img/src/bw/percent.svg Normal file
View file

@ -0,0 +1 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-opacity="0" stroke="#000" stroke-linecap="round" stroke-width="1.5"><circle cx="4" cy="4" r="2.25"/><path d="m11.603 1.7597-7.206 12.481"/><circle cx="12" cy="12" r="2.25"/></g></svg>

After

Width:  |  Height:  |  Size: 301 B

View file

Before

Width:  |  Height:  |  Size: 670 B

After

Width:  |  Height:  |  Size: 670 B

View file

Before

Width:  |  Height:  |  Size: 907 B

After

Width:  |  Height:  |  Size: 907 B

View file

Before

Width:  |  Height:  |  Size: 162 B

After

Width:  |  Height:  |  Size: 162 B

View file

Before

Width:  |  Height:  |  Size: 164 B

After

Width:  |  Height:  |  Size: 164 B

View file

Before

Width:  |  Height:  |  Size: 178 B

After

Width:  |  Height:  |  Size: 178 B

View file

Before

Width:  |  Height:  |  Size: 153 B

After

Width:  |  Height:  |  Size: 153 B

View file

Before

Width:  |  Height:  |  Size: 153 B

After

Width:  |  Height:  |  Size: 153 B

View file

Before

Width:  |  Height:  |  Size: 413 B

After

Width:  |  Height:  |  Size: 413 B

View file

Before

Width:  |  Height:  |  Size: 191 B

After

Width:  |  Height:  |  Size: 191 B

View file

Before

Width:  |  Height:  |  Size: 280 B

After

Width:  |  Height:  |  Size: 280 B

1
img/src/bw/trash.svg Normal file
View file

@ -0,0 +1 @@
<svg width="16" height="16" version="1.1" viewbox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M6.5 1L6 2H3c-.554 0-1 .446-1 1v1h12V3c0-.554-.446-1-1-1h-3l-.5-1zM3 5l.875 9c.06.55.573 1 1.125 1h6c.552 0 1.064-.45 1.125-1L13 5z"/></svg>

After

Width:  |  Height:  |  Size: 247 B

View file

@ -1 +0,0 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><g fill="none" stroke="#4574A9" stroke-width="1.5"><circle cx="8" cy="8" r="5"/><path d="m5.1005 12.027-1.5 2.5981"/><path d="m10.9 12.027 1.5 2.5981"/><path d="m4.9731 1.6495-2.5981 1.5"/><path d="m11.027 1.6495 2.5981 1.5"/><path d="m8 5v3h2"/></g></svg>

Before

Width:  |  Height:  |  Size: 354 B

View file

@ -1 +0,0 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><g fill="none" stroke="#CE3433" stroke-width="1.5"><circle cx="8" cy="8" r="5"/><path d="m5.1005 12.027-1.5 2.5981"/><path d="m10.9 12.027 1.5 2.5981"/><path d="m4.9731 1.6495-2.5981 1.5"/><path d="m11.027 1.6495 2.5981 1.5"/><path d="m8 5v3h2"/></g></svg>

Before

Width:  |  Height:  |  Size: 354 B

View file

@ -1 +0,0 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><g fill="none" stroke="#000" stroke-width="1.5"><circle cx="8" cy="8" r="5"/><path d="m5.1005 12.027-1.5 2.5981"/><path d="m10.9 12.027 1.5 2.5981"/><path d="m4.9731 1.6495-2.5981 1.5"/><path d="m11.027 1.6495 2.5981 1.5"/><path d="m8 5v3h2"/></g></svg>

Before

Width:  |  Height:  |  Size: 351 B

View file

Before

Width:  |  Height:  |  Size: 752 B

After

Width:  |  Height:  |  Size: 752 B

View file

Before

Width:  |  Height:  |  Size: 752 B

After

Width:  |  Height:  |  Size: 752 B

View file

Before

Width:  |  Height:  |  Size: 571 B

After

Width:  |  Height:  |  Size: 571 B

View file

@ -0,0 +1 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-opacity="0" stroke="#4574A9" stroke-width="1.5"><circle cx="8" cy="8" r="5"/><path d="m5.1005 12.027-1.5 2.5981"/><path d="m10.9 12.027 1.5 2.5981"/><path d="m4.9731 1.6495-2.5981 1.5"/><path d="m11.027 1.6495 2.5981 1.5"/><path d="m8 5v3h2"/></g></svg>

After

Width:  |  Height:  |  Size: 371 B

View file

@ -0,0 +1 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-opacity="0" stroke="#CE3433" stroke-width="1.5"><circle cx="8" cy="8" r="5"/><path d="m5.1005 12.027-1.5 2.5981"/><path d="m10.9 12.027 1.5 2.5981"/><path d="m4.9731 1.6495-2.5981 1.5"/><path d="m11.027 1.6495 2.5981 1.5"/><path d="m8 5v3h2"/></g></svg>

After

Width:  |  Height:  |  Size: 371 B

View file

@ -0,0 +1 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-opacity="0" stroke="#4574a9" stroke-linecap="round" stroke-width="1.5"><circle cx="4" cy="4" r="2.25" fill="none"/><path d="m11.603 1.7597-7.206 12.481"/><circle cx="12" cy="12" r="2.25"/></g></svg>

After

Width:  |  Height:  |  Size: 316 B

View file

Before

Width:  |  Height:  |  Size: 442 B

After

Width:  |  Height:  |  Size: 442 B

View file

Before

Width:  |  Height:  |  Size: 206 B

After

Width:  |  Height:  |  Size: 206 B

View file

Before

Width:  |  Height:  |  Size: 206 B

After

Width:  |  Height:  |  Size: 206 B

View file

Before

Width:  |  Height:  |  Size: 206 B

After

Width:  |  Height:  |  Size: 206 B

View file

@ -1 +0,0 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><g fill="none" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5"><path d="m8.7576 14.243 6.4924-6.243-6.4924-6.2427"/><path d="m0.76074 8h14.479"/></g></svg>

Before

Width:  |  Height:  |  Size: 285 B

View file

@ -1 +0,0 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><g fill="none" stroke="#000" stroke-linejoin="round" stroke-width="1.5"><rect x="4.75" y="1.75" width="9.5" height="9.5"/><polyline points="3.5 4.75 1.75 4.75 1.75 7"/><polyline points="1.75 12 1.75 14.25 4 14.25"/><polyline points="9 14.25 11.25 14.25 11.25 13"/><line x1="1.75" x2="1.75" y1="8" y2="11"/><line x1="5" x2="8" y1="14.25" y2="14.25"/></g></svg>

Before

Width:  |  Height:  |  Size: 457 B

View file

@ -1 +0,0 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><g fill="none" stroke="#4574a9" stroke-linecap="round" stroke-width="1.5"><circle cx="4" cy="4" r="2.25" fill="none"/><path d="m11.603 1.7597-7.206 12.481"/><circle cx="12" cy="12" r="2.25"/></g></svg>

Before

Width:  |  Height:  |  Size: 299 B

View file

@ -1 +0,0 @@
<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><g fill="none" stroke="#000" stroke-linecap="round" stroke-width="1.5"><circle cx="4" cy="4" r="2.25"/><path d="m11.603 1.7597-7.206 12.481"/><circle cx="12" cy="12" r="2.25"/></g></svg>

Before

Width:  |  Height:  |  Size: 284 B

View file

@ -1 +0,0 @@
<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg"><path d="M6.5 1L6 2H3c-.554 0-1 .446-1 1v1h12V3c0-.554-.446-1-1-1h-3l-.5-1zM3 5l.875 9c.06.55.573 1 1.125 1h6c.552 0 1.064-.45 1.125-1L13 5z" fill-rule="evenodd"/></svg>

Before

Width:  |  Height:  |  Size: 233 B

View file

@ -1,185 +0,0 @@
/**
* Nextcloud - Tasks
*
* @author Raimund Schlüßler
* @copyright 2018 Raimund Schlüßler <raimund.schluessler@mailbox.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
$('#content.app-tasks').attr('ng-app', 'Tasks');
$('#content.app-tasks').attr('ng-cloak');
$('#content.app-tasks').attr('ng-controller', 'AppController');
$('#content.app-tasks').attr('ng-click', 'closeAll($event)');
$('#content.app-tasks').addClass('handler');
angular.module('Tasks', ['ngRoute', 'ngAnimate', 'ui.select', 'ngSanitize', 'dndLists']).config([
'$provide', '$routeProvider', '$interpolateProvider', '$httpProvider',
function($provide, $routeProvider, $interpolateProvider, $httpProvider) {
'use strict';
var config;
$provide.value('Config', config = {
markReadTimeout: 500,
taskUpdateInterval: 1000 * 600
});
$httpProvider.defaults.headers.common.requesttoken = oc_requesttoken;
$routeProvider
.when('/calendars/:calendarID', {})
.when('/calendars/:calendarID/edit/:listparameter', {})
.when('/calendars/:calendarID/tasks/:taskID', {})
.when('/calendars/:calendarID/tasks/:taskID/settings', {})
.when('/calendars/:calendarID/tasks/:taskID/edit/:parameter', {})
.when('/collections/:collectionID/tasks/:taskID', {})
.when('/collections/:collectionID/tasks/:taskID/settings', {})
.when('/collections/:collectionID/tasks/:taskID/edit/:parameter', {})
.when('/collections/:collectionID', {})
.when('/search/:searchString', {})
.when('/search/:searchString/tasks/:taskID', {})
.when('/search/:searchString/tasks/:taskID/edit/:parameter', {})
.otherwise({
redirectTo: '/collections/all'
});
}
]);
angular.module('Tasks').run([
'$document', '$rootScope', 'Config', '$timeout', 'ListsBusinessLayer', 'TasksBusinessLayer', 'SearchBusinessLayer',
function($document, $rootScope, Config, $timeout, TasksBusinessLayer, ListsBusinessLayer, SearchBusinessLayer) {
'use strict';
var update;
var init = false;
(update = function() {
var timeOutUpdate;
timeOutUpdate = function() {
return $timeout(update, Config.taskUpdateInterval);
};
init = true;
return timeOutUpdate();
}).call();
OCA.Search.tasks = SearchBusinessLayer;
$document.click(function(event) {
$rootScope.$broadcast('documentClicked', event);
});
moment.locale('details', {
calendar: {
lastDay: '[' + t('tasks', 'Due yesterday') + '], HH:mm',
sameDay: '[' + t('tasks', 'Due today') + '], HH:mm',
nextDay: '[' + t('tasks', 'Due tomorrow') + '], HH:mm',
lastWeek: '[' + t('tasks', 'Due on') + '] MMM DD, YYYY, HH:mm',
nextWeek: '[' + t('tasks', 'Due on') + '] MMM DD, YYYY, HH:mm',
sameElse: '[' + t('tasks', 'Due on') + '] MMM DD, YYYY, HH:mm'
}
});
moment.locale('details_allday', {
calendar: {
lastDay: '[' + t('tasks', 'Due yesterday') + ']',
sameDay: '[' + t('tasks', 'Due today') + ']',
nextDay: '[' + t('tasks', 'Due tomorrow') + ']',
lastWeek: '[' + t('tasks', 'Due on') + '] MMM DD, YYYY',
nextWeek: '[' + t('tasks', 'Due on') + '] MMM DD, YYYY',
sameElse: '[' + t('tasks', 'Due on') + '] MMM DD, YYYY'
}
});
moment.locale('start', {
calendar: {
lastDay: '[' + t('tasks', 'Started yesterday') + '], HH:mm',
sameDay: '[' + t('tasks', 'Starts today') + '], HH:mm',
nextDay: '[' + t('tasks', 'Starts tomorrow') + '], HH:mm',
lastWeek: '[' + t('tasks', 'Started on') + '] MMM DD, YYYY, HH:mm',
nextWeek: '[' + t('tasks', 'Starts on') + '] MMM DD, YYYY, HH:mm',
sameElse: function() {
if (this.diff(moment()) > 0) {
return '[' + t('tasks', 'Starts on') + '] MMM DD, YYYY, HH:mm';
} else {
return '[' + t('tasks', 'Started on') + '] MMM DD, YYYY, HH:mm';
}
}
}
});
moment.locale('start_allday', {
calendar: {
lastDay: '[' + t('tasks', 'Started yesterday') + ']',
sameDay: '[' + t('tasks', 'Starts today') + ']',
nextDay: '[' + t('tasks', 'Starts tomorrow') + ']',
lastWeek: '[' + t('tasks', 'Started on') + '] MMM DD, YYYY',
nextWeek: '[' + t('tasks', 'Starts on') + '] MMM DD, YYYY',
sameElse: function() {
if (this.diff(moment()) > 0) {
return '[' + t('tasks', 'Starts on') + '] MMM DD, YYYY';
} else {
return '[' + t('tasks', 'Started on') + '] MMM DD, YYYY';
}
}
}
});
moment.locale('reminder', {
calendar: {
lastDay: t('tasks', '[Remind me yesterday at ]HH:mm'),
sameDay: t('tasks', '[Remind me today at ]HH:mm'),
nextDay: t('tasks', '[Remind me tomorrow at ]HH:mm'),
lastWeek: t('tasks', '[Remind me on ]MMM DD, YYYY,[ at ]HH:mm'),
nextWeek: t('tasks', '[Remind me on ]MMM DD, YYYY,[ at ]HH:mm'),
sameElse: t('tasks', '[Remind me on ]MMM DD, YYYY,[ at ]HH:mm')
}
});
moment.locale('tasks', {
calendar: {
lastDay: '[' + t('tasks', 'Yesterday') + ']',
sameDay: '[' + t('tasks', 'Today') + ']',
nextDay: '[' + t('tasks', 'Tomorrow') + ']',
lastWeek: 'DD.MM.YYYY',
nextWeek: 'DD.MM.YYYY',
sameElse: 'DD.MM.YYYY'
}
});
moment.locale('details_short', {
calendar: {
lastDay: '[' + t('tasks', 'Yesterday') + ']',
sameDay: '[' + t('tasks', 'Today') + ']',
nextDay: '[' + t('tasks', 'Tomorrow') + ']',
lastWeek: 'MMM DD, YYYY',
nextWeek: 'MMM DD, YYYY',
sameElse: 'MMM DD, YYYY'
}
});
moment.locale('list_week', {
calendar: {
lastDay: '[' + t('tasks', 'Yesterday') + ']',
sameDay: '[' + t('tasks', 'Today') + '], MMM. DD',
nextDay: '[' + t('tasks', 'Tomorrow') + '], MMM. DD',
lastWeek: 'ddd, MMM. DD',
nextWeek: 'ddd, MMM. DD',
sameElse: 'ddd, MMM. DD'
}
});
return moment.locale('en', {
relativeTime: {
future: t('tasks', "in %s"),
past: t('tasks', "%s ago"),
s: t('tasks', "seconds"),
m: t('tasks', "a minute"),
mm: t('tasks', "%d minutes"),
h: t('tasks', "an hour"),
hh: t('tasks', "%d hours"),
d: t('tasks', "a day"),
dd: t('tasks', "%d days"),
M: t('tasks', "a month"),
MM: t('tasks', "%d months"),
y: t('tasks', "a year"),
yy: t('tasks', "%d years")
}
});
}
]);

View file

@ -1,83 +0,0 @@
/**
* Nextcloud - Tasks
*
* @author Raimund Schlüßler
* @copyright 2018 Raimund Schlüßler <raimund.schluessler@mailbox.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
angular.module('Tasks').controller('AppController', [
'$scope', '$rootScope', 'ListsBusinessLayer', '$route', 'Status', '$timeout', '$location', '$routeParams', 'Loading', 'SettingsModel', 'Persistence', function($scope, $rootScope, ListsBusinessLayer, $route, status, $timeout, $location, $routeParams, Loading, SettingsModel, Persistence) {
'use strict';
var AppController = (function() {
function AppController(_$scope, $rootScope, _$listsbusinesslayer, _$route, _$status, _$timeout, _$location, _$routeparams, _Loading, _$settingsmodel, _persistence) {
this._$scope = _$scope;
this._$listsbusinesslayer = _$listsbusinesslayer;
this._$route = _$route;
this._$status = _$status;
this._$timeout = _$timeout;
this._$location = _$location;
this._$routeparams = _$routeparams;
this._Loading = _Loading;
this._$settingsmodel = _$settingsmodel;
this._persistence = _persistence;
this._$scope.status = this._$status.getStatus();
this._$scope.route = this._$routeparams;
this._$scope.status.newListName = "";
this._$scope.settingsmodel = this._$settingsmodel;
this._$listsbusinesslayer.init().then(function(results) {
Promise.all(results).then(function() {
$scope.$apply();
});
});
this._persistence.init();
this._$scope.closeAll = function($event) {
if ($($event.target).closest('.close-all').length || $($event.currentTarget).is($($event.target).closest('.handler'))) {
if (!angular.isUndefined(_$scope.route.calendarID)) {
if (_$scope.route.listparameter === 'name') {
$rootScope.$broadcast('cancelEditCalendar', _$scope.route.calendarID);
}
_$location.path('/calendars/' + _$scope.route.calendarID);
} else if (!angular.isUndefined(_$scope.route.collectionID)) {
_$location.path('/collections/' + _$scope.route.collectionID);
} else {
_$location.path('/collections/all');
}
_$scope.status.addingList = false;
_$scope.status.focusTaskInput = false;
_$scope.status.newListName = "";
}
if (!$($event.target).closest('.newList').length) {
_$scope.status.addingList = false;
_$scope.status.newListName = "";
}
if (!$($event.target).closest('.add-subtask').length) {
_$scope.status.addSubtaskTo = null;
_$scope.status.focusSubtaskInput = false;
}
};
this._$scope.isLoading = function() {
return _Loading.isLoading();
};
}
return AppController;
})();
return new AppController($scope, $rootScope, ListsBusinessLayer, $route, status, $timeout, $location, $routeParams, Loading, SettingsModel, Persistence);
}
]);

View file

@ -1,397 +0,0 @@
/**
* Nextcloud - Tasks
*
* @author Raimund Schlüßler
* @copyright 2018 Raimund Schlüßler <raimund.schluessler@mailbox.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
angular.module('Tasks').controller('DetailsController', [
'$scope', '$window', 'TasksModel', 'TasksBusinessLayer', '$route', '$location', '$timeout', '$routeParams', 'SettingsModel', 'Loading', 'ListsModel',
function($scope, $window, TasksModel, TasksBusinessLayer, $route, $location, $timeout, $routeParams, SettingsModel, Loading, ListsModel) {
'use strict';
var DetailsController = (function() {
function DetailsController(_$scope, _$window, _$tasksmodel,
_tasksbusinesslayer, _$route, _$location, _$timeout, _$routeparams, _$settingsmodel, _Loading, _$listsmodel) {
this._$scope = _$scope;
this._$window = _$window;
this._$tasksmodel = _$tasksmodel;
this._$listsmodel = _$listsmodel;
this._tasksbusinesslayer = _tasksbusinesslayer;
this._$route = _$route;
this._$location = _$location;
this._$timeout = _$timeout;
this._$routeparams = _$routeparams;
this._$settingsmodel = _$settingsmodel;
this._Loading = _Loading;
this._$scope.task = _$tasksmodel.getById(_$scope.route.taskID);
this._$scope.found = true;
this._$scope.$on('$routeChangeSuccess', function() {
var task = _$tasksmodel.getByUri(_$scope.route.taskID);
if (!(angular.isUndefined(task) || task === null)) {
_$scope.task = task;
// Bind categories to task.cats as angular.ui/ui-select seems to have problems with Getter/Setter
_$scope.task.cats = task.categories;
_$scope.found = true;
} else if (_$scope.route.taskID !== void 0) {
_$scope.found = false;
}
});
this._$scope.settingsmodel = this._$settingsmodel;
this._$scope.settingsmodel.add({
'id': 'various',
'categories': []
});
this._$scope.isAddingComment = false;
this._$scope.timers = [];
this._$scope.durations = [{
name: t('tasks', 'week'),
names: t('tasks', 'weeks'),
id: 'week'
}, {
name: t('tasks', 'day'),
names: t('tasks', 'days'),
id: 'day'
}, {
name: t('tasks', 'hour'),
names: t('tasks', 'hours'),
id: 'hour'
}, {
name: t('tasks', 'minute'),
names: t('tasks', 'minutes'),
id: 'minute'
}, {
name: t('tasks', 'second'),
names: t('tasks', 'seconds'),
id: 'second'
}
];
this._$scope.loadTask = function(taskID) {
var task = _$tasksmodel.getByUri(_$scope.route.taskID);
if (!(angular.isUndefined(task) || task === null)) {
_$scope.task = task;
_$scope.found = true;
}
};
this._$scope.TaskState = function() {
if (_$scope.found) {
return 'found';
} else {
if (_Loading.isLoading()) {
return 'loading';
} else {
return null;
}
}
};
this._$scope.params = [
{
name: t('tasks', 'before beginning'),
invert: true,
related: 'START',
id: "10"
}, {
name: t('tasks', 'after beginning'),
invert: false,
related: 'START',
id: "00"
}, {
name: t('tasks', 'before end'),
invert: true,
related: 'END',
id: "11"
}, {
name: t('tasks', 'after end'),
invert: false,
related: 'END',
id: "01"
}
];
this._$scope.filterParams = function(params) {
var task;
task = _$tasksmodel.getById(_$scope.route.taskID);
if (!(angular.isUndefined(task) || task === null)) {
if (task.due && task.start) {
return params;
} else if (task.start) {
return params.slice(0, 2);
} else {
return params.slice(2);
}
}
};
this._$scope.deleteTask = function(task) {
return _$timeout(function() {
return _tasksbusinesslayer.deleteTask(task).then(function () {
return $scope.$apply();
});
}, 500);
};
this._$scope.triggerUpdate = function(task) {
_tasksbusinesslayer.triggerUpdate(task);
};
this._$scope.editName = function($event, task) {
if (task.calendar.writable) {
if (!$($event.target).is('a')) {
_$scope.setEditRoute('name');
}
}
};
this._$scope.editDueDate = function($event, task) {
if (task.calendar.writable) {
if ($($event.currentTarget).is($($event.target).closest('.handler'))) {
_$scope.setEditRoute('duedate');
_tasksbusinesslayer.initDueDate(task);
}
}
};
this._$scope.editStart = function($event, task) {
if (task.calendar.writable) {
if ($($event.currentTarget).is($($event.target).closest('.handler'))) {
_$scope.setEditRoute('startdate');
_tasksbusinesslayer.initStartDate(task);
}
}
};
this._$scope.editReminder = function($event, task) {
if (task.calendar.writable) {
if ($($event.currentTarget).is($($event.target).closest('.handler'))) {
_$scope.setEditRoute('reminer');
return _tasksbusinesslayer.initReminder(_$scope.route.taskID);
}
}
};
this._$scope.editNote = function($event, task) {
if (task.calendar.writable) {
if ($($event.currentTarget).is($($event.target).closest('.handler'))) {
if (!$($event.target).is('a')) {
_$scope.setEditRoute('note');
}
}
}
};
this._$scope.editPriority = function($event, task) {
if (task.calendar.writable) {
if ($($event.currentTarget).is($($event.target).closest('.handler'))) {
_$scope.setEditRoute('priority');
}
}
};
this._$scope.editPercent = function($event, task) {
if (task.calendar.writable) {
if ($($event.currentTarget).is($($event.target).closest('.handler'))) {
_$scope.setEditRoute('percent');
}
}
};
this._$scope.endEdit = function($event) {
if ($($event.target).closest('.end-edit').length || $($event.currentTarget).is($($event.target).closest('.handler'))) {
_$scope.resetRoute();
}
};
this._$scope.endName = function($event) {
if ($event.keyCode === 13) {
$event.preventDefault();
_$scope.resetRoute();
}
if ($event.keyCode === 27) {
return _$scope.resetRoute();
}
};
this._$scope.setEditRoute = function(type) {
var calendarID = _$scope.route.calendarID;
var collectionID = _$scope.route.collectionID;
if (calendarID) {
$location.path('/calendars/' + calendarID + '/tasks/' + _$scope.route.taskID + '/edit/' + type);
} else if (collectionID) {
$location.path('/collections/' + collectionID + '/tasks/' + _$scope.route.taskID + '/edit/' + type);
}
};
this._$scope.resetRoute = function() {
var calendarID = _$scope.route.calendarID;
var collectionID = _$scope.route.collectionID;
if (calendarID) {
$location.path('/calendars/' + calendarID + '/tasks/' + _$scope.route.taskID);
} else if (collectionID) {
$location.path('/collections/' + collectionID + '/tasks/' + _$scope.route.taskID);
}
};
this._$scope.deletePercent = function(task) {
return _tasksbusinesslayer.setPercentComplete(task, 0);
};
this._$scope.deleteReminder = function() {
return _tasksbusinesslayer.deleteReminderDate(_$scope.route.taskID);
};
this._$scope.toggleCompleted = function(task) {
if (task.completed) {
_tasksbusinesslayer.setPercentComplete(task, 0);
} else {
_tasksbusinesslayer.setPercentComplete(task, 100);
}
};
this._$scope.setPercentComplete = function(task, complete) {
_tasksbusinesslayer.setPercentComplete(task, complete);
};
this._$scope.toggleStarred = function(task) {
if (task.priority > 5) {
_tasksbusinesslayer.setPriority(task, 0);
} else {
_tasksbusinesslayer.setPriority(task, 9);
}
};
this._$scope.deletePriority = function(task) {
return _tasksbusinesslayer.setPriority(task, 0);
};
this._$scope.isDue = function(date) {
return _$tasksmodel.due(date);
};
this._$scope.isOverDue = function(date) {
return _$tasksmodel.overdue(date);
};
this._$scope.setstartday = function(date) {
return _tasksbusinesslayer.setStart(_$scope.task, moment(date, 'MM/DD/YYYY'), 'day');
};
this._$scope.setstarttime = function(date) {
return _tasksbusinesslayer.setStart(_$scope.task, moment(date, 'HH:mm'), 'time');
};
this._$scope.deleteStartDate = function(task) {
_tasksbusinesslayer.deleteStartDate(task);
};
this._$scope.setdueday = function(date) {
return _tasksbusinesslayer.setDue(_$scope.task, moment(date, 'MM/DD/YYYY'), 'day');
};
this._$scope.setduetime = function(date) {
return _tasksbusinesslayer.setDue(_$scope.task, moment(date, 'HH:mm'), 'time');
};
this._$scope.deleteDueDate = function(task) {
_tasksbusinesslayer.deleteDueDate(task);
};
this._$scope.isAllDayPossible = function(task) {
return !angular.isUndefined(task) && task.calendar.writable && (task.due || task.start);
};
this._$scope.toggleAllDay = function(task) {
_tasksbusinesslayer.setAllDay(task, !task.allDay);
};
this._$scope.setreminderday = function(date) {
return _tasksbusinesslayer.setReminderDate(_$scope.route.taskID, moment(date, 'MM/DD/YYYY'), 'day');
};
this._$scope.setremindertime = function(date) {
return _tasksbusinesslayer.setReminderDate(_$scope.route.taskID, moment(date, 'HH:mm'), 'time');
};
this._$scope.reminderType = function(task) {
if (!angular.isUndefined(task)) {
if (task.reminder === null) {
if (moment(task.start, "YYYYMMDDTHHmmss").isValid() || moment(task.due, "YYYYMMDDTHHmmss").isValid()) {
return 'DURATION';
} else {
return 'DATE-TIME';
}
} else {
return task.reminder.type;
}
}
};
this._$scope.changeReminderType = function(task) {
_tasksbusinesslayer.checkReminderDate(task.id);
if (this.reminderType(task) === 'DURATION') {
if (task.reminder) {
task.reminder.type = 'DATE-TIME';
} else {
task.reminder = {
type: 'DATE-TIME'
};
}
} else {
if (task.reminder) {
task.reminder.type = 'DURATION';
} else {
task.reminder = {
type: 'DURATION'
};
}
}
return _tasksbusinesslayer.setReminder(task.id);
};
this._$scope.setReminderDuration = function(taskID) {
return _tasksbusinesslayer.setReminder(_$scope.route.taskID);
};
this._$scope.addComment = function() {
var comment,
_this = this;
if (_$scope.CommentContent) {
_$scope.isAddingComment = true;
comment = {
tmpID: 'newComment' + Date.now(),
comment: _$scope.CommentContent,
taskID: _$scope.route.taskID,
time: moment().format('YYYYMMDDTHHmmss'),
name: $('#expandDisplayName').text()
};
_tasksbusinesslayer.addComment(comment, function(data) {
_$tasksmodel.updateComment(data);
_$scope.isAddingComment = false;
}, function() {
_$scope.isAddingComment = false;
});
_$scope.CommentContent = '';
}
};
this._$scope.sendComment = function(event) {
if (event.keyCode === 13) {
return _$scope.addComment();
}
};
this._$scope.deleteComment = function(commentID) {
return _tasksbusinesslayer.deleteComment(_$scope.route.taskID, commentID);
};
this._$scope.commentStrings = function() {
return {
button: t('tasks', 'Comment'),
input: t('tasks', 'Add a comment')
};
};
this._$scope.addCategory = function(category, model) {
_$scope.task.categories = _$scope.task.cats;
var default_categories = _$scope.settingsmodel.getById('various').categories;
if (default_categories.indexOf(category) < 0) {
default_categories.push(category);
}
_tasksbusinesslayer.doUpdate(_$scope.task);
};
this._$scope.removeCategory = function(category, model) {
_$scope.task.categories = _$scope.task.cats;
_tasksbusinesslayer.doUpdate(_$scope.task);
};
}
return DetailsController;
})();
return new DetailsController($scope, $window, TasksModel, TasksBusinessLayer, $route, $location, $timeout, $routeParams, SettingsModel, Loading, ListsModel);
}
]);

View file

@ -1,90 +0,0 @@
/**
* Nextcloud - Tasks
*
* @author Raimund Schlüßler
* @copyright 2018 Raimund Schlüßler <raimund.schluessler@mailbox.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
angular.module('Tasks').controller('SettingsController', [
'$scope', '$window', 'Status', '$location', 'CollectionsModel', 'SettingsBusinessLayer', 'SettingsModel', function($scope, $window, Status, $location, CollectionsModel, SettingsBusinessLayer, SettingsModel) {
'use strict';
var SettingsController;
SettingsController = (function() {
function SettingsController(_$scope, _$window, _$status, _$location, _$collectionsmodel, _$settingsbusinesslayer, _$settingsmodel) {
var _this = this;
this._$scope = _$scope;
this._$window = _$window;
this._$status = _$status;
this._$location = _$location;
this._$collectionsmodel = _$collectionsmodel;
this._$settingsbusinesslayer = _$settingsbusinesslayer;
this._$settingsmodel = _$settingsmodel;
this._$scope.status = this._$status.getStatus();
this._$scope.collections = this._$collectionsmodel.getAll();
this._$scope.settingsmodel = this._$settingsmodel;
this._$scope.collectionOptions = [
{
id: 0,
name: t('tasks', 'Hidden')
}, {
id: 1,
name: t('tasks', 'Visible')
}, {
id: 2,
name: t('tasks', 'Automatic')
}
];
this._$scope.startOfWeekOptions = [
{
id: 0,
name: t('tasks', 'Sunday')
}, {
id: 1,
name: t('tasks', 'Monday')
}, {
id: 2,
name: t('tasks', 'Tuesday')
}, {
id: 3,
name: t('tasks', 'Wednesday')
}, {
id: 4,
name: t('tasks', 'Thursday')
}, {
id: 5,
name: t('tasks', 'Friday')
}, {
id: 6,
name: t('tasks', 'Saturday')
}
];
this._$scope.setVisibility = function(collectionID) {
var collection;
collection = _$collectionsmodel.getById(collectionID);
return _$settingsbusinesslayer.setVisibility(collectionID, collection.show);
};
this._$scope.setStartOfWeek = function() {
return _$settingsbusinesslayer.set('various', 'startOfWeek', _$settingsmodel.getById('various').startOfWeek);
};
}
return SettingsController;
})();
return new SettingsController($scope, $window, Status, $location, CollectionsModel, SettingsBusinessLayer, SettingsModel);
}
]);

View file

@ -1,456 +0,0 @@
/**
* Nextcloud - Tasks
*
* @author Raimund Schlüßler
* @copyright 2018 Raimund Schlüßler <raimund.schluessler@mailbox.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
(function() {
'use strict';
var __indexOf = [].indexOf || function(item) {
for (var i = 0, l = this.length; i < l; i++) {
if (i in this && this[i] === item) {
return i;
}
}
return -1;
};
angular.module('Tasks').controller('TasksController', [
'$scope', '$window', '$routeParams', 'TasksModel', 'ListsModel', 'CollectionsModel', 'TasksBusinessLayer', '$location',
'SettingsBusinessLayer', 'SearchBusinessLayer', 'VTodo', 'SettingsModel',
function($scope, $window, $routeParams, TasksModel, ListsModel, CollectionsModel, TasksBusinessLayer, $location,
SettingsBusinessLayer, SearchBusinessLayer, VTodo, SettingsModel) {
var TasksController;
TasksController = (function() {
function TasksController(_$scope, _$window, _$routeParams, _$tasksmodel, _$listsmodel, _$collectionsmodel, _tasksbusinesslayer, $location,
_settingsbusinesslayer, _searchbusinesslayer, vtodo, _$settingsmodel) {
var _this = this;
this._$scope = _$scope;
this._$window = _$window;
this._$routeParams = _$routeParams;
this._$tasksmodel = _$tasksmodel;
this._$listsmodel = _$listsmodel;
this._$collectionsmodel = _$collectionsmodel;
this._tasksbusinesslayer = _tasksbusinesslayer;
this.$location = $location;
this._settingsbusinesslayer = _settingsbusinesslayer;
this._searchbusinesslayer = _searchbusinesslayer;
this._vtodo = vtodo;
this._$scope.tasks = this._$tasksmodel.getAll();
this._$scope.draggedTasks = [];
this._$scope.calendars = this._$listsmodel.getAll();
this._$scope.days = [0, 1, 2, 3, 4, 5, 6];
this._$scope.isAddingTask = false;
this._$scope.focusInputField = false;
this._$scope.TasksModel = this._$tasksmodel;
this._$scope.TasksBusinessLayer = this._tasksbusinesslayer;
this._$settingsmodel = _$settingsmodel;
this._$scope.addTask = function(taskName, related, calendar, parent) {
var _ref, _this = this;
if (calendar === null) {
calendar = '';
}
_$scope.isAddingTask = true;
var task = {
calendar: null,
related: related,
summary: taskName,
priority: '0',
due: false,
start: false,
reminder: null,
completed: false,
complete: '0',
note: ''
};
if (((_ref = _$scope.route.collectionID) === 'starred' || _ref === 'today' || _ref === 'week' || _ref === 'all' || _ref === 'completed' || _ref === 'current')) {
if (related) {
task.calendar = calendar;
} else {
task.calendar = _$listsmodel.getStandardList();
}
if (_$scope.route.collectionID === 'starred') {
task.priority = '1';
}
if (_$scope.route.collectionID === 'today') {
task.due = moment().startOf('day').format("YYYY-MM-DDTHH:mm:ss");
}
if (_$scope.route.collectionID === 'current') {
task.start = moment().format("YYYY-MM-DDTHH:mm:ss");
}
} else {
task.calendar = _$listsmodel.getByUri(_$scope.route.calendarID);
}
task = VTodo.create(task);
_tasksbusinesslayer.add(task).then(function(task) {
_$scope.isAddingTask = false;
_$scope.openDetails(task.uri, null);
return $scope.$apply();
});
if (parent) {
_tasksbusinesslayer.setHideSubtasks(parent, 0);
}
_$scope.status.focusTaskInput = false;
_$scope.status.focusSubtaskInput = false;
_$scope.status.addSubtaskTo = null;
_$scope.status.taskName = '';
_$scope.status.subtaskName = '';
};
this._$scope.getAddString = function() {
var calendar = _$listsmodel.getStandardList();
if (angular.isDefined(calendar)) {
if (angular.isDefined(_$scope.route.collectionID)) {
switch (_$scope.route.collectionID) {
case 'starred':
return t('tasks', 'Add an important item in "%s"...').replace('%s', calendar.displayname);
case 'today':
return t('tasks', 'Add an item due today in "%s"...').replace('%s', calendar.displayname);
case 'all':
return t('tasks', 'Add an item in "%s"...').replace('%s', calendar.displayname);
case 'current':
return t('tasks', 'Add a current item in "%s"...').replace('%s', calendar.displayname);
case 'completed':
case 'week':
return null;
}
} else {
if (angular.isDefined(_$listsmodel.getByUri(_$scope.route.calendarID))) {
return t('tasks', 'Add an item in "%s"...').replace('%s', _$listsmodel.getByUri(_$scope.route.calendarID).displayname);
}
}
}
};
this._$scope.getSubAddString = function(taskname) {
return t('tasks', 'Add a subtask to "%s"...').replace('%s', taskname);
};
this._$scope.showSubtaskInput = function(uid) {
_$scope.status.addSubtaskTo = uid;
};
this._$scope.hideSubtasks = function(task) {
var taskID = _$scope.route.taskID;
var descendantIDs = _$tasksmodel.getDescendantIDs(task);
if (task.uri === taskID) {
return false;
} else if (__indexOf.call(descendantIDs, taskID) >= 0) {
return false;
} else {
return task.hideSubtasks;
}
};
this._$scope.showInput = function() {
var collectionID = _$scope.route.collectionID;
var calendar = _$listsmodel.getByUri(_$scope.route.calendarID);
if (collectionID === 'completed' || collectionID === 'week') {
return false;
}
if (angular.isDefined(calendar)) {
return calendar.writable;
} else {
return true;
}
};
this._$scope.focusTaskInput = function() {
_$scope.status.focusTaskInput = true;
};
this._$scope.focusSubtaskInput = function() {
_$scope.status.focusSubtaskInput = true;
};
this._$scope.openDetails = function(id, $event) {
var calendarID = _$scope.route.calendarID;
var collectionID = _$scope.route.collectionID;
if ($event === null || $($event.currentTarget).is($($event.target).closest('.handler'))) {
var parent = _$tasksmodel.getByUri(id);
if (!parent.loadedCompleted) {
_tasksbusinesslayer.getAll(parent.calendar, true, parent).then(function() {
parent.loadedCompleted = true;
$scope.$apply();
});
}
if (calendarID) {
$location.path('/calendars/' + calendarID + '/tasks/' + id);
} else if (collectionID) {
$location.path('/collections/' + collectionID + '/tasks/' + id);
}
}
};
this._$scope.toggleCompleted = function(task) {
if (task.completed) {
_tasksbusinesslayer.setPercentComplete(task, 0);
} else {
_tasksbusinesslayer.setPercentComplete(task, 100);
}
};
this._$scope.toggleStarred = function(task) {
if (task.priority > 5) {
_tasksbusinesslayer.setPriority(task, 0);
} else {
_tasksbusinesslayer.setPriority(task, 9);
}
};
this._$scope.toggleHidden = function() {
return _settingsbusinesslayer.toggle('various', 'showHidden');
};
this._$scope.filterTasks = function(task, filter) {
return function(task) {
return _$tasksmodel.filterTasks(task, filter);
};
};
this._$scope.getSubTasks = function(tasks, parent) {
var ret, task, _i, _len;
ret = [];
for (_i = 0, _len = tasks.length; _i < _len; _i++) {
task = tasks[_i];
if (task.related === parent.uid && task !== parent && !(parent.hideCompletedSubtasks && task.completed)) {
ret.push(task);
}
}
return ret;
};
this._$scope.hasNoParent = function(task) {
return function(task) {
return _$tasksmodel.hasNoParent(task);
};
};
this._$scope.hasSubtasks = function(task) {
return _$tasksmodel.hasSubtasks(task.uid);
};
this._$scope.hasCompletedSubtasks = function(task) {
return _$tasksmodel.hasCompletedSubtasks(task.uid);
};
this._$scope.toggleSubtasks = function(task) {
_tasksbusinesslayer.setHideSubtasks(task, !task.hideSubtasks);
};
this._$scope.toggleCompletedSubtasks = function(task) {
_tasksbusinesslayer.setHideCompletedSubtasks(task, !task.hideCompletedSubtasks);
};
this._$scope.filterTasksByString = function(task) {
return function(task) {
var filter = _searchbusinesslayer.getFilter();
return _$tasksmodel.filterTasksByString(task, filter);
};
};
this._$scope.filteredTasks = function() {
var filter;
filter = _searchbusinesslayer.getFilter();
return _$tasksmodel.filteredTasks(filter);
};
this._$scope.dayHasEntry = function() {
return function(date) {
var filter, task, tasks, _i, _len;
filter = _searchbusinesslayer.getFilter();
tasks = _$tasksmodel.filteredTasks(filter);
for (_i = 0, _len = tasks.length; _i < _len; _i++) {
task = tasks[_i];
if (task.completed || !_$tasksmodel.hasNoParent(task)) {
continue;
}
if (_$tasksmodel.taskAtDay(task, date)) {
return true;
}
}
return false;
};
};
this._$scope.taskAtDay = function(task, day) {
return function(task) {
return _$tasksmodel.taskAtDay(task, day);
};
};
this._$scope.filterLists = function() {
return function(calendar) {
return _$scope.getCount(calendar.uri, _$scope.route.collectionID);
};
};
this._$scope.getCount = function(calendarID, type) {
var filter = _searchbusinesslayer.getFilter();
return _$listsmodel.getCount(calendarID, type, filter);
};
this._$scope.getCountString = function(calendarID, type) {
var filter = _searchbusinesslayer.getFilter();
return n('tasks', '%n Completed Task', '%n Completed Tasks', _$listsmodel.getCount(calendarID, type, filter));
};
this._$scope.checkTaskInput = function($event) {
if ($event.keyCode === 27) {
$($event.currentTarget).blur();
_$scope.status.taskName = '';
_$scope.status.subtaskName = '';
_$scope.status.addSubtaskTo = null;
_$scope.status.focusTaskInput = false;
_$scope.status.focusSubtaskInput = false;
}
};
this._$scope.getCompletedTasks = function(calendarID) {
var calendar = _$listsmodel.getById(calendarID);
_tasksbusinesslayer.getAll(calendar, true).then(function() {
_$listsmodel.setLoadedCompleted(calendarID);
$scope.$apply();
});
};
this._$scope.loadedCompleted = function(calendarID) {
return _$listsmodel.loadedCompleted(calendarID);
};
this._$scope.sortDue = function(task) {
if (task.due === null) {
return 'last';
} else {
return task.due;
}
};
this._$scope.sortStart = function(task) {
if (task.start === null) {
return 'last';
} else {
return task.start;
}
};
this._$scope.getSortOrder = function() {
switch (_$scope.settingsmodel.getById('various').sortOrder) {
case 'due':
return _$scope.sortDue;
case 'start':
return _$scope.sortStart;
case 'priority':
return '-priority';
case 'alphabetically':
return 'summary';
case 'manual':
return 'manual';
default:
return ['completed', _$scope.sortDue, '-priority', _$scope.sortStart, 'summary'];
}
};
this._$scope.getSortOrderIcon = function() {
switch (_$scope.settingsmodel.getById('various').sortOrder) {
case 'due':
case 'start':
return 'icon-calendar';
case 'priority':
return 'icon-task-star';
case 'alphabetically':
return 'icon-alphabetically';
case 'manual':
return 'icon-manual';
default:
return 'icon-list';
}
};
this._$scope.setSortOrder = function($event, order) {
_$scope.settingsmodel.getById('various').sortDirection = (_$scope.settingsmodel.getById('various').sortOrder === order) ? +!_$scope.settingsmodel.getById('various').sortDirection : 0;
_$scope.settingsmodel.getById('various').sortOrder = order;
_settingsbusinesslayer.set('various', 'sortOrder', order);
_settingsbusinesslayer.set('various', 'sortDirection', _$scope.settingsmodel.getById('various').sortDirection);
};
this._$scope.dropAsSubtask = function($event, item, index) {
if ($event.dataTransfer.dropEffect === 'move') {
var parentID = $($event.target).closest('.task-item').attr('taskID');
var task = _$tasksmodel.getByUri(item.uri);
var parent = _$tasksmodel.getByUri(parentID);
_tasksbusinesslayer.changeParent(task, parent);
}
$('.subtasks-container').removeClass('dropzone-visible');
return true;
};
this._$scope.dropAsRootTask = function($event, item, index) {
if ($event.dataTransfer.dropEffect === 'move') {
var task = _$tasksmodel.getByUri(item.uri);
var collectionID = $($event.target).closest('ol[dnd-list]').attr('collectionID');
var calendarID = $($event.target).closest('ol[dnd-list]').attr('calendarID');
var newCalendar = _$listsmodel.getByUri(calendarID);
var queries = _tasksbusinesslayer.makeRootTask(task, newCalendar, collectionID);
Promise.all(queries).then(function() {
$scope.$apply();
});
}
$('.subtasks-container').removeClass('dropzone-visible');
return true;
};
this._$scope.dragover = function($event, item, index) {
$('.subtasks-container').removeClass('dropzone-visible');
var calendarID = $($event.target).closest('ol[dnd-list]').attr('calendarID');
var calendar = _$listsmodel.getByUri(calendarID);
if (calendar.writable) {
$($event.target).closest('.task-item').children('.subtasks-container').addClass('dropzone-visible');
return true;
} else {
return false;
}
};
this._$scope.allow = function(task) {
if (task.calendar.writable) {
return "copyMove";
} else {
return "copy";
}
};
this._$scope.dragStart = function($event) {
if ($event.dataTransfer.effectAllowed === 'copy' || ($event.dataTransfer.effectAllowed === 'copyMove' && $event.ctrlKey)) {
$($event.target).addClass('copy');
}
};
this._$scope.dragEnd = function($event) {
$($event.target).removeClass('copy');
};
}
return TasksController;
})();
return new TasksController($scope, $window, $routeParams, TasksModel, ListsModel, CollectionsModel, TasksBusinessLayer, $location, SettingsBusinessLayer,
SearchBusinessLayer, VTodo, SettingsModel);
}
]);
}).call(this);

View file

@ -1,40 +0,0 @@
/**
* Nextcloud - Tasks
*
* @author Raimund Schlüßler
* @copyright 2018 Raimund Schlüßler <raimund.schluessler@mailbox.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
angular.module('Tasks').directive('appNavigationEntryUtils', function() {
'use strict';
return {
restrict: 'C',
link: function(scope, elm) {
var button, menu;
menu = elm.siblings('.app-navigation-entry-menu');
button = $(elm).find('.app-navigation-entry-utils-menu-button button');
button.click(function() {
menu.toggleClass('open');
});
scope.$on('documentClicked', function(scope, event) {
if (event.target !== button[0]) {
menu.removeClass('open');
}
});
}
};
});

View file

@ -1,167 +0,0 @@
/**
* Nextcloud - Tasks App
*
* @author Raghu Nayyar
* @author Georg Ehrke
* @copyright 2017 Raghu Nayyar <beingminimal@gmail.com>
* @copyright 2017 Georg Ehrke <oc.list@georgehrke.com>
* @copyright 2017 John Molakvoæ <fremulon@protonmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
/* https://github.com/kayellpeee/hsl_rgb_converter
* expected hue range: [0, 360)
* expected saturation range: [0, 1]
* expected lightness range: [0, 1]
*/
var hslToRgb = function(hue, saturation, lightness) {
'use strict';
// based on algorithm from http://en.wikipedia.org/wiki/HSL_and_HSV#Converting_to_RGB
if(Array.isArray(hue)) {
saturation = hue[1];
lightness = hue[2];
hue = hue[0];
}
if (hue === undefined) {
return [0, 0, 0];
}
saturation /= 100;
lightness /= 100;
var chroma = (1 - Math.abs((2 * lightness) - 1)) * saturation;
var huePrime = hue / 60;
var secondComponent = chroma * (1 - Math.abs((huePrime % 2) - 1));
huePrime = Math.floor(huePrime);
var red;
var green;
var blue;
if (huePrime === 0) {
red = chroma;
green = secondComponent;
blue = 0;
} else if (huePrime === 1) {
red = secondComponent;
green = chroma;
blue = 0;
} else if (huePrime === 2) {
red = 0;
green = chroma;
blue = secondComponent;
} else if (huePrime === 3) {
red = 0;
green = secondComponent;
blue = chroma;
} else if (huePrime === 4) {
red = secondComponent;
green = 0;
blue = chroma;
} else if (huePrime === 5) {
red = chroma;
green = 0;
blue = secondComponent;
}
var lightnessAdjustment = lightness - (chroma / 2);
red += lightnessAdjustment;
green += lightnessAdjustment;
blue += lightnessAdjustment;
return [Math.round(red * 255), Math.round(green * 255), Math.round(blue * 255)];
};
/*
* Convert rgb array to hex string
*/
var rgbToHex = function(r, g, b) {
'use strict';
if(Array.isArray(r)) {
g = r[1];
b = r[2];
r = r[0];
}
return '#' + parseInt(r, 10).toString(16) + parseInt(g, 10).toString(16) + parseInt(b, 10).toString(16);
};
var listofcolours = [
'#31CC7C',
'#317CCC',
'#FF7A66',
'#F1DB50',
'#7C31CC',
'#CC317C',
'#3A3B3D',
'#CACBCD'
];
/*
* Generate a random colour with the core generator
*/
var randColour = function() {
'use strict';
if (typeof String.prototype.toHsl === 'function') {
return rgbToHex(hslToRgb(Math.random().toString().toHsl()));
} else {
return listofcolours[Math.floor(Math.random() * listofcolours.length)];
}
};
/**
* Directive: Colorpicker
* Description: Colorpicker for the Tasks app.
*/
angular.module('Tasks').directive('colorpicker', function() {
'use strict';
if (typeof String.prototype.toHsl === 'function') {
var hsl = "";
var hslcolour = "";
// 0 40 80 120 160 200 240 280 320
listofcolours = ["15", "9", "4", "b", "6", "11", "74", "f", "57"];
listofcolours.forEach(function(hash, index) {
hsl = hash.toHsl();
hslcolour = hslToRgb(hsl);
listofcolours[index] = rgbToHex(hslcolour);
});
}
return {
scope: {
selected: '=',
customizedColors: '=colors'
},
restrict: 'AE',
templateUrl: OC.filePath('tasks', 'templates', 'colorpicker.html'),
link: function(scope, element, attr) {
scope.colors = scope.customizedColors || listofcolours;
scope.selected = scope.selected || scope.colors[0];
scope.random = "#000000";
scope.randomizeColour = function() {
scope.random = randColour();
scope.pick(scope.random);
};
scope.pick = function(color) {
scope.selected = color;
};
}
};
});

View file

@ -1,56 +0,0 @@
/**
* Nextcloud - Tasks
*
* @author Raimund Schlüßler
* @copyright 2018 Raimund Schlüßler <raimund.schluessler@mailbox.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
angular.module('Tasks').directive('datepicker', function() {
'use strict';
return {
restrict: 'A',
scope: false,
link: function(scope, elm, attr) {
return elm.datepicker({
onSelect: function(date, inst) {
scope['set' + attr.datepicker + 'day'](date);
return scope.$apply();
},
beforeShow: function(input, inst) {
var dp, marginLeft;
dp = $(inst).datepicker('widget');
marginLeft = -Math.abs($(input).outerWidth() - dp.outerWidth()) / 2 + 'px';
dp.css({
'margin-left': marginLeft
});
$("div.ui-datepicker:before").css({
'left': 100 + 'px'
});
return $('.hasDatepicker').datepicker("option", "firstDay", scope.settingsmodel.getById('various').startOfWeek);
},
beforeShowDay: function(date) {
if (moment(date).startOf('day').diff(moment(scope.task[attr.datepicker], "YYYYMMDDTHHmmss").startOf('day'), 'days') === 0) {
return [1, "selected"];
} else {
return [1, ""];
}
},
minDate: null
});
}
};
});

View file

@ -1,41 +0,0 @@
/**
* Nextcloud - Tasks
*
* @author Raimund Schlüßler
* @copyright 2018 Raimund Schlüßler <raimund.schluessler@mailbox.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
angular.module('Tasks').directive('ocClickFocus', [
'$timeout', function($timeout) {
'use strict';
return function(scope, elm, attr) {
var options;
options = scope.$eval(attr.ocClickFocus);
if (angular.isDefined(options) && angular.isDefined(options.selector)) {
return elm.click(function() {
if (angular.isDefined(options.timeout)) {
return $timeout(function() {
return $(options.selector).focus();
}, options.timeout);
} else {
return $(options.selector).focus();
}
});
}
};
}
]);

View file

@ -1,39 +0,0 @@
/**
* Nextcloud - Tasks
*
* @author Raimund Schlüßler
* @copyright 2018 Raimund Schlüßler <raimund.schluessler@mailbox.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
angular.module('Tasks').directive('timepicker', function() {
'use strict';
return {
restrict: 'A',
link: function(scope, elm, attr) {
return elm.timepicker({
onSelect: function(date, inst) {
scope['set' + attr.timepicker + 'time'](date);
return scope.$apply();
},
myPosition: 'center top',
atPosition: 'center bottom',
hourText: t('tasks', 'Hours'),
minuteText: t('tasks', 'Minutes')
});
}
};
});

View file

@ -1,34 +0,0 @@
/**
* Nextcloud - Tasks
*
* @author Raimund Schlüßler
* @copyright 2018 Raimund Schlüßler <raimund.schluessler@mailbox.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
angular.module('Tasks').filter('counterFormatter', function() {
'use strict';
return function(count) {
switch (false) {
case count !== 0:
return '';
case count < 999:
return '999+';
default:
return count;
}
};
});

View file

@ -1,31 +0,0 @@
/**
* Nextcloud - Tasks
*
* @author Raimund Schlüßler
* @copyright 2018 Raimund Schlüßler <raimund.schluessler@mailbox.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
angular.module('Tasks').filter('dateDetails', function() {
'use strict';
return function(due) {
if (moment(due, "YYYYMMDDTHHmmss").isValid()) {
return moment(due, "YYYYMMDDTHHmmss").locale(due.isDate ? 'details_allday' : 'details').calendar();
} else {
return t('tasks', 'Set due date');
}
};
});

View file

@ -1,31 +0,0 @@
/**
* Nextcloud - Tasks
*
* @author Raimund Schlüßler
* @copyright 2018 Raimund Schlüßler <raimund.schluessler@mailbox.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
angular.module('Tasks').filter('dateDetailsShort', function() {
'use strict';
return function(reminder) {
if (moment(reminder, "YYYYMMDDTHHmmss").isValid()) {
return moment(reminder, "YYYYMMDDTHHmmss").locale('details_short').calendar();
} else {
return '';
}
};
});

View file

@ -1,31 +0,0 @@
/**
* Nextcloud - Tasks
*
* @author Raimund Schlüßler
* @copyright 2018 Raimund Schlüßler <raimund.schluessler@mailbox.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
angular.module('Tasks').filter('dateFromNow', function() {
'use strict';
return function(due) {
if (moment(due, "YYYYMMDDTHHmmss").isValid()) {
return moment(due, "YYYYMMDDTHHmmss").fromNow();
} else {
return '';
}
};
});

View file

@ -1,31 +0,0 @@
/**
* Nextcloud - Tasks
*
* @author Raimund Schlüßler
* @copyright 2018 Raimund Schlüßler <raimund.schluessler@mailbox.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
angular.module('Tasks').filter('dateTaskList', function() {
'use strict';
return function(due) {
if (moment(due, "YYYYMMDDTHHmmss").isValid()) {
return moment(due, "YYYYMMDDTHHmmss").locale('tasks').calendar();
} else {
return '';
}
};
});

View file

@ -1,31 +0,0 @@
/**
* Nextcloud - Tasks
*
* @author Raimund Schlüßler
* @copyright 2018 Raimund Schlüßler <raimund.schluessler@mailbox.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
angular.module('Tasks').filter('dayTaskList', function() {
'use strict';
return function(due) {
if (moment(due, "YYYYMMDDTHHmmss").isValid()) {
return moment(due, "YYYYMMDDTHHmmss").locale('tasks').calendar();
} else {
return '';
}
};
});

View file

@ -1,27 +0,0 @@
/**
* Nextcloud - Tasks
*
* @author Raimund Schlüßler
* @copyright 2018 Raimund Schlüßler <raimund.schluessler@mailbox.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
angular.module('Tasks').filter('percentDetails', function() {
'use strict';
return function(percent) {
return t('tasks', '%s %% completed').replace('%s', percent).replace('%%', '%');
};
});

View file

@ -1,38 +0,0 @@
/**
* Nextcloud - Tasks
*
* @author Raimund Schlüßler
* @copyright 2018 Raimund Schlüßler <raimund.schluessler@mailbox.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
angular.module('Tasks').filter('priorityDetails', function() {
'use strict';
return function(priority) {
var string;
string = t('tasks', 'priority %s: ').replace('%s', priority);
if (+priority === 6 || +priority === 7 || +priority === 8 || +priority === 9) {
return string + ' ' + t('tasks', 'high');
} else if (+priority === 5) {
return string + ' ' + t('tasks', 'medium');
} else if (+priority === 1 || +priority === 2 || +priority === 3 || +priority === 4) {
return string + ' ' + t('tasks', 'low');
} else {
return t('tasks', 'no priority assigned');
}
};
});

View file

@ -1,82 +0,0 @@
/**
* Nextcloud - Tasks
*
* @author Raimund Schlüßler
* @copyright 2018 Raimund Schlüßler <raimund.schluessler@mailbox.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
angular.module('Tasks').filter('reminderDetails', function() {
'use strict';
return function(reminder, scope) {
function before(related) {
if (related === 'END') {
return ' ' + t('tasks', 'before end');
} else {
return ' ' + t('tasks', 'before beginning');
}
}
function after(related) {
if (related === 'END') {
return ' ' + t('tasks', 'after end');
} else {
return ' ' + t('tasks', 'after beginning');
}
}
function tokenName(reminder, token) {
if (+reminder.duration[token.id] === 1) {
return token.name;
} else {
return token.names;
}
}
var ds, time, token, _ref;
if (!(angular.isUndefined(reminder) || reminder === null)) {
if (reminder.type === 'DATE-TIME' && moment(reminder.date, "YYYYMMDDTHHmmss").isValid()) {
return moment(reminder.date, "YYYYMMDDTHHmmss").locale('reminder').calendar();
} else if (reminder.type === 'DURATION' && reminder.duration) {
ds = t('tasks', 'Remind me');
_ref = scope.durations;
for (var _i = 0, _len = _ref.length; _i < _len; _i++) {
token = _ref[_i];
if (+reminder.duration[token.id]) {
time = 1;
ds += ' ' + reminder.duration[token.id] + ' ';
ds += tokenName(reminder, token);
}
}
if (!time) {
if (reminder.duration.params.related === 'END') {
ds += ' ' + t('tasks', 'at the end');
} else {
ds += ' ' + t('tasks', 'at the beginning');
}
} else {
if (reminder.duration.params.invert) {
ds += before(reminder.duration.params.related);
} else {
ds += after(reminder.duration.params.related);
}
}
return ds;
} else {
return t('tasks', 'Remind me');
}
} else {
return t('tasks', 'Remind me');
}
};
});

View file

@ -1,31 +0,0 @@
/**
* Nextcloud - Tasks
*
* @author Raimund Schlüßler
* @copyright 2018 Raimund Schlüßler <raimund.schluessler@mailbox.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
angular.module('Tasks').filter('startDetails', function() {
'use strict';
return function(due) {
if (moment(due, "YYYYMMDDTHHmmss").isValid()) {
return moment(due, "YYYYMMDDTHHmmss").locale(due.isDate ? 'start_allday' : 'start').calendar();
} else {
return t('tasks', 'Set start date');
}
};
});

View file

@ -1,31 +0,0 @@
/**
* Nextcloud - Tasks
*
* @author Raimund Schlüßler
* @copyright 2018 Raimund Schlüßler <raimund.schluessler@mailbox.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
angular.module('Tasks').filter('timeTaskList', function() {
'use strict';
return function(due) {
if (moment(due, "YYYYMMDDTHHmmss").isValid()) {
return moment(due, "YYYYMMDDTHHmmss").format('HH:mm');
} else {
return '';
}
};
});

View file

@ -1,71 +0,0 @@
/**
* Nextcloud - Tasks
*
* @author Raimund Schlüßler
* @copyright 2018 Raimund Schlüßler <raimund.schluessler@mailbox.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
angular.module('Tasks').factory('ListsBusinessLayer', [
'ListsModel', 'Persistence', 'TasksBusinessLayer', 'CalendarService', function(ListsModel, Persistence, TasksBusinessLayer, CalendarService) {
'use strict';
var ListsBusinessLayer;
ListsBusinessLayer = (function() {
function ListsBusinessLayer(_$listsmodel, _persistence, _$tasksbusinesslayer, _$calendarservice) {
this._$listsmodel = _$listsmodel;
this._persistence = _persistence;
this._$tasksbusinesslayer = _$tasksbusinesslayer;
this._$calendarservice = _$calendarservice;
}
ListsBusinessLayer.prototype.init = function() {
return this._$calendarservice.getAll().then(function(calendars) {
var calendar, _i, _len, _results;
_results = [];
for (_i = 0, _len = calendars.length; _i < _len; _i++) {
calendar = calendars[_i];
ListsModel.add(calendar);
_results.push(TasksBusinessLayer.getAll(calendar));
}
return _results;
});
};
ListsBusinessLayer.prototype.add = function(calendar, color) {
return this._$calendarservice.create(calendar, color, ['vtodo']).then(function(calendar) {
ListsModel.add(calendar);
return calendar;
});
};
ListsBusinessLayer.prototype["delete"] = function(calendar) {
return this._$calendarservice["delete"](calendar).then(function() {
return ListsModel["delete"](calendar);
});
};
ListsBusinessLayer.prototype.rename = function(calendar) {
this._$calendarservice.update(calendar).then(function(calendar) {
calendar.dropPreviousState();
});
};
return ListsBusinessLayer;
})();
return new ListsBusinessLayer(ListsModel, Persistence, TasksBusinessLayer, CalendarService);
}
]);

View file

@ -1,56 +0,0 @@
/**
* Nextcloud - Tasks
*
* @author Raimund Schlüßler
* @copyright 2018 Raimund Schlüßler <raimund.schluessler@mailbox.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
angular.module('Tasks').factory('SettingsBusinessLayer', [
'Persistence', 'SettingsModel', function(Persistence, SettingsModel) {
'use strict';
var SettingsBusinessLayer = (function() {
function SettingsBusinessLayer(_persistence, _$settingsmodel) {
this._persistence = _persistence;
this._$settingsmodel = _$settingsmodel;
}
SettingsBusinessLayer.prototype.updateModel = function() {
var success, _this = this;
success = function() {};
return this._persistence.getCollections(success, true);
};
SettingsBusinessLayer.prototype.setVisibility = function(collectionID, visibility) {
return this._persistence.setVisibility(collectionID, visibility);
};
SettingsBusinessLayer.prototype.toggle = function(type, setting) {
this._$settingsmodel.toggle(type, setting);
var value = this._$settingsmodel.getById(type)[setting];
return this._persistence.setting(type, setting, +value);
};
SettingsBusinessLayer.prototype.set = function(type, setting, value) {
return this._persistence.setting(type, setting, value);
};
return SettingsBusinessLayer;
})();
return new SettingsBusinessLayer(Persistence, SettingsModel);
}
]);

View file

@ -1,599 +0,0 @@
/**
* Nextcloud - Tasks
*
* @author Raimund Schlüßler
* @copyright 2018 Raimund Schlüßler <raimund.schluessler@mailbox.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
angular.module('Tasks').factory('TasksBusinessLayer', [
'TasksModel', 'Persistence', 'VTodoService', 'VTodo', '$timeout',
function(TasksModel, Persistence, VTodoService, VTodo, $timeout) {
'use strict';
var TasksBusinessLayer;
TasksBusinessLayer = (function() {
function TasksBusinessLayer(_$tasksmodel, _persistence, _$vtodoservice, _$vtodo, $timeout) {
this._$tasksmodel = _$tasksmodel;
this._persistence = _persistence;
this._$vtodoservice = _$vtodoservice;
}
TasksBusinessLayer.prototype.getAll = function(calendar, completed, parent) {
return this._$vtodoservice.getAll(calendar, completed, parent).then(function(tasks) {
var task, _i, _len, _results;
_results = [];
for (_i = 0, _len = tasks.length; _i < _len; _i++) {
task = tasks[_i];
var vTodo = new VTodo(task.calendar, task.properties, task.uri);
_results.push(TasksModel.ad(vTodo));
}
return _results;
});
};
TasksBusinessLayer.prototype.add = function(task) {
return this._$vtodoservice.create(task.calendar, task.data).then(function(task) {
var vTodo = new VTodo(task.calendar, task.properties, task.uri);
TasksModel.ad(vTodo);
return vTodo;
});
};
TasksBusinessLayer.prototype.getTask = function(calendar, uri) {
return this._$vtodoservice.get(calendar, uri).then(function(task) {
TasksModel.ad(task);
return task;
});
};
TasksBusinessLayer.prototype.setPriority = function(task, priority) {
if (task.calendar.writable) {
task.priority = priority;
this.doUpdate(task);
}
};
TasksBusinessLayer.prototype.setPercentComplete = function(task, percentComplete) {
if (task.calendar.writable) {
if (percentComplete < 100) {
this.uncompleteParents(task.related);
} else {
this.completeChildren(task);
}
task.complete = percentComplete;
this.triggerUpdate(task);
}
};
TasksBusinessLayer.prototype.triggerUpdate = function(task, duration) {
if (!duration) {
duration = 1000;
}
if (task.timers.update) {
$timeout.cancel(task.timers.update);
}
task.timers.update = $timeout(function(task) {
VTodoService.update(task);
}, duration, true, task);
};
TasksBusinessLayer.prototype.doUpdate = function(task) {
return this._$vtodoservice.update(task);
};
TasksBusinessLayer.prototype.completeChildren = function(task) {
var child, _i, _len;
var children = this._$tasksmodel.getChildren(task);
var _results = [];
for (_i = 0, _len = children.length; _i < _len; _i++) {
child = children[_i];
_results.push(this.setPercentComplete(child, 100));
}
return _results;
};
TasksBusinessLayer.prototype.uncompleteParents = function(uid) {
if (uid) {
var parent = this._$tasksmodel.getByUid(uid);
if (parent.completed) {
return this.setPercentComplete(parent, 0);
}
}
};
TasksBusinessLayer.prototype.setHideSubtasks = function(task, hide) {
task.hideSubtasks = hide;
if (task.calendar.writable) {
this.doUpdate(task);
}
};
TasksBusinessLayer.prototype.setHideCompletedSubtasks = function(task, hide) {
task.hideCompletedSubtasks = hide;
if (task.calendar.writable) {
this.doUpdate(task);
}
};
TasksBusinessLayer.prototype.deleteTask = function(task) {
var child, children, _i, _len;
children = this._$tasksmodel.getChildren(task);
for (_i = 0, _len = children.length; _i < _len; _i++) {
child = children[_i];
this.deleteTask(child);
}
return this._$vtodoservice["delete"](task).then(function() {
return TasksModel["delete"](task);
});
};
TasksBusinessLayer.prototype.momentToICALTime = function(moment, asDate) {
if(asDate) {
return ICAL.Time.fromDateString(moment.format('YYYY-MM-DD'));
} else {
return ICAL.Time.fromDateTimeString(moment.format('YYYY-MM-DDTHH:mm:ss'));
}
};
TasksBusinessLayer.prototype.initDueDate = function(task) {
var start = moment(task.start, "YYYY-MM-DDTHH:mm:ss");
var due = moment(task.due, "YYYY-MM-DDTHH:mm:ss");
if (!due.isValid()) {
var reference = start.isAfter() ? start : moment();
if(task.allDay) {
reference.startOf('day').add(1, 'd');
} else {
reference.startOf('hour').add(1, 'h');
}
return this.setDue(task, reference, 'all');
}
};
TasksBusinessLayer.prototype.setDue = function(task, date, type) {
if (type === null) {
type = 'day';
}
var allDay = task.allDay;
var start = moment(task.start, "YYYY-MM-DDTHH:mm:ss");
var olddue = moment(task.due, "YYYY-MM-DDTHH:mm:ss");
var due = olddue.clone();
if (type === 'day') {
if (moment(due).isValid()) {
due.year(date.year()).month(date.month()).date(date.date());
} else {
due = date.add(12, 'h');
}
} else if (type === 'time') {
if (moment(due).isValid()) {
due.hour(date.hour()).minute(date.minute());
} else {
due = date;
}
} else if (type === 'all') {
due = date;
} else {
return;
}
if (due.isBefore(start) || due.isSame(start)) {
start.subtract(olddue.diff(due), 'ms');
task.start = this.momentToICALTime(start, allDay);
}
task.due = this.momentToICALTime(due, allDay);
// this.checkReminderDate(task);
this.doUpdate(task);
};
TasksBusinessLayer.prototype.deleteDueDate = function(task) {
// var reminder = task.reminder;
// if (reminder !== null && reminder.type === 'DURATION' && reminder.duration.params.related === 'END') {
// this.deleteReminderDate(task);
// }
task.due = null;
this.doUpdate(task);
};
TasksBusinessLayer.prototype.initStartDate = function(task) {
var start = moment(task.start, "YYYY-MM-DDTHH:mm:ss");
var due = moment(task.due, "YYYY-MM-DDTHH:mm:ss");
if (!start.isValid()) {
var reference = moment().add(1, 'h');
if (due.isBefore(reference)) {
reference = due.subtract(1, 'm');
}
reference.startOf(task.allDay ? 'day' : 'hour');
return this.setStart(task, reference, 'all');
}
};
TasksBusinessLayer.prototype.setStart = function(task, date, type) {
if (type === null) {
type = 'day';
}
var allDay = task.allDay;
var due = moment(task.due, "YYYY-MM-DDTHH:mm:ss");
var oldstart = moment(task.start, "YYYY-MM-DDTHH:mm:ss");
var start = oldstart.clone();
if (type === 'day') {
if (moment(start).isValid()) {
start.year(date.year()).month(date.month()).date(date.date());
} else {
start = date.add(12, 'h');
}
} else if (type === 'time') {
if (moment(start).isValid()) {
start.hour(date.hour()).minute(date.minute());
} else {
start = date;
}
} else if (type === 'all') {
start = date;
} else {
return;
}
if(start.isAfter(due) || start.isSame(due)) {
due.add(start.diff(oldstart), 'ms');
task.due = this.momentToICALTime(due, allDay);
}
task.start = this.momentToICALTime(start, allDay);
// this.checkReminderDate(taskID);
this.doUpdate(task);
};
TasksBusinessLayer.prototype.deleteStartDate = function(task) {
// var reminder = task.reminder;
// if (reminder !== null && reminder.type === 'DURATION' && reminder.duration.params.related === 'START') {
// this.deleteReminderDate(task);
// }
task.start = null;
this.doUpdate(task);
};
TasksBusinessLayer.prototype.setAllDay = function(task, allDay) {
task.allDay = allDay;
if (allDay) {
var due = moment(task.due, "YYYY-MM-DDTHH:mm:ss");
var start = moment(task.start, "YYYY-MM-DDTHH:mm:ss");
if(start.isAfter(due) || start.isSame(due)) {
start = moment(due).subtract(1, 'day');
task.start = this.momentToICALTime(start, allDay);
}
}
this.doUpdate(task);
};
TasksBusinessLayer.prototype.initReminder = function(taskID) {
var p, task;
if (!this.checkReminderDate(taskID)) {
task = this._$tasksmodel.getById(taskID);
task.reminder = {
type: 'DURATION',
action: 'DISPLAY',
duration: {
token: 'week',
week: 0,
day: 0,
hour: 0,
minute: 0,
second: 0,
params: {
invert: true
}
}
};
if (moment(task.start, "YYYYMMDDTHHmmss").isValid()) {
p = task.reminder.duration.params;
p.related = 'START';
p.id = '10';
} else if (moment(task.due, "YYYYMMDDTHHmmss").isValid()) {
p = task.reminder.duration.params;
p.related = 'END';
p.id = '11';
} else {
task.reminder.type = 'DATE-TIME';
task.reminder.date = moment().startOf('hour').add(1, 'h').format('YYYYMMDDTHHmmss');
}
return this.setReminder(taskID);
}
};
TasksBusinessLayer.prototype.setReminderDate = function(taskID, date, type) {
var newreminder, reminder, reminderdate;
if (type === null) {
type = 'day';
}
reminder = this._$tasksmodel.getById(taskID).reminder;
newreminder = {
type: 'DATE-TIME',
action: 'DISPLAY',
duration: null
};
if (type === 'day') {
if (this.checkReminderDate(taskID) || reminder === null) {
reminderdate = moment(reminder.date, "YYYYMMDDTHHmmss");
newreminder.action = reminder.action;
if (reminderdate.isValid() && reminder.type === 'DATE-TIME') {
reminderdate.year(date.year()).month(date.month()).date(date.date());
} else {
reminderdate = date.add(12, 'h');
}
} else {
reminderdate = date.add(12, 'h');
}
} else if (type === 'time') {
if (this.checkReminderDate(taskID) || reminder === null) {
reminderdate = moment(reminder.date, "YYYYMMDDTHHmmss");
newreminder.action = reminder.action;
if (reminderdate.isValid() && reminder.type === 'DATE-TIME') {
reminderdate.hour(date.hour()).minute(date.minute());
} else {
reminderdate = date;
}
} else {
reminderdate = date;
}
} else {
return;
}
newreminder.date = reminderdate.format('YYYYMMDDTHHmmss');
this._$tasksmodel.setReminder(taskID, newreminder);
return this._persistence.setReminder(taskID, newreminder);
};
TasksBusinessLayer.prototype.setReminder = function(taskID) {
var reminder;
if (this.checkReminderDate(taskID)) {
reminder = this._$tasksmodel.getById(taskID).reminder;
return this._persistence.setReminder(taskID, reminder);
}
};
TasksBusinessLayer.prototype.checkReminderDate = function(taskID) {
var d, date, duration, rel, related, reminder, seg, task, token;
task = this._$tasksmodel.getById(taskID);
reminder = task.reminder;
if (reminder !== null && reminder.type === 'DURATION') {
if (!reminder.duration) {
return false;
} else if (reminder.duration.params.related === 'START') {
token = 'start';
} else if (reminder.duration.params.related === 'END') {
token = 'due';
} else {
return false;
}
date = moment(task[token], "YYYYMMDDTHHmmss");
duration = reminder.duration;
d = {
w: duration.week,
d: duration.day,
h: duration.hour,
m: duration.minute,
s: duration.second
};
if (duration.params.invert) {
date = date.subtract(d);
} else {
date = date.add(d);
}
task.reminder.date = date.format('YYYYMMDDTHHmmss');
} else if (reminder !== null && reminder.type === 'DATE-TIME') {
duration = reminder.duration;
date = moment(reminder.date, "YYYYMMDDTHHmmss");
if (!date.isValid()) {
return false;
}
if (duration) {
if (duration.params.related === 'START') {
related = moment(task.start, "YYYYMMDDTHHmmss");
} else {
related = moment(task.due, "YYYYMMDDTHHmmss");
}
seg = this.secondsToSegments(date.diff(related, 'seconds'));
duration.params.invert = seg.invert;
duration.token = 'week';
duration.week = seg.week;
duration.day = seg.day;
duration.hour = seg.hour;
duration.minute = seg.minute;
duration.second = seg.second;
} else {
if (task.start) {
related = moment(task.start, "YYYYMMDDTHHmmss");
rel = 'START';
d = 0;
} else if (task.due) {
related = moment(task.due, "YYYYMMDDTHHmmss");
rel = 'END';
d = 1;
} else {
return true;
}
seg = this.secondsToSegments(date.diff(related, 'seconds'));
reminder.duration = {
token: 'week',
params: {
related: rel,
invert: seg.invert,
id: +seg.invert + '' + d
},
week: seg.week,
day: seg.day,
hour: seg.hour,
minute: seg.minute,
second: seg.second
};
}
} else {
return false;
}
return true;
};
TasksBusinessLayer.prototype.secondsToSegments = function(s) {
var d, h, i, m, w;
if (s < 0) {
s *= -1;
i = true;
} else {
i = false;
}
w = Math.floor(s / 604800);
s -= w * 604800;
d = Math.floor(s / 86400);
s -= d * 86400;
h = Math.floor(s / 3600);
s -= h * 3600;
m = Math.floor(s / 60);
s -= m * 60;
return {
week: w,
day: d,
hour: h,
minute: m,
second: s,
invert: i
};
};
TasksBusinessLayer.prototype.deleteReminderDate = function(taskID) {
this._$tasksmodel.setReminder(taskID, null);
return this._persistence.setReminder(taskID, false);
};
TasksBusinessLayer.prototype.changeCalendar = function(task, newCalendar) {
if(task.calendar !== newCalendar && newCalendar.writable) {
var newTask = angular.copy(task);
newTask.calendar = newCalendar;
if (!TasksModel.hasNoParent(newTask)) {
var parent = TasksModel.getByUid(newTask.related);
if (parent.calendar.uri !== newTask.calendar.uri) {
newTask.related = null;
TasksBusinessLayer.prototype.setPercentComplete(newTask, 0);
}
}
return VTodoService.create(newCalendar, newTask.data).then(function(newVTodo) {
var vTodo = new VTodo(newVTodo.calendar, newVTodo.properties, newVTodo.uri);
TasksModel.ad(vTodo);
return VTodoService["delete"](task).then(function() {
TasksModel["delete"](task);
var queries = [];
var children = TasksModel.getChildren(newTask);
var _i, _len, child;
for (_i = 0, _len = children.length; _i < _len; _i++) {
child = children[_i];
if (child.calendar.uri !== newTask.calendar.uri) {
queries.push(TasksBusinessLayer.prototype.changeCalendar(child, newTask.calendar));
}
}
return Promise.all(queries);
});
});
} else {
return Promise.resolve(true);
}
};
// called from outside
TasksBusinessLayer.prototype.changeCollection = function(taskID, collectionID) {
var task = this._$tasksmodel.getById(taskID);
switch (collectionID) {
case 'starred':
task.priority = 9;
return this.doUpdate(task);
case 'completed':
return this.setPercentComplete(task, 100);
case 'uncompleted':
if (task.completed) {
return this.setPercentComplete(task, 0);
} else {
return false;
}
break;
case 'today':
return this.setDue(task, moment().startOf('day').add(12, 'h'), 'all');
case 'week':
case 'all':
return false;
default:
return false;
}
};
TasksBusinessLayer.prototype.changeParent = function(task, parent) {
if (parent.calendar.writable) {
task.related = parent.uid;
parent.hideSubtasks = 0;
if (parent.completed && !task.completed) {
this.setPercentComplete(parent, 0);
} else {
this.doUpdate(parent);
}
if (parent.calendar.uri !== task.calendar.uri) {
this.changeCalendar(task, parent.calendar);
} else {
this.doUpdate(task);
}
}
};
TasksBusinessLayer.prototype.makeRootTask = function(task, newCalendar, collectionID) {
if (newCalendar.writable) {
var requests = [];
task.related = null;
if (collectionID !== "completed" && task.completed) {
task.complete = 0;
}
requests.push(this.changeCollection(task.uri, collectionID));
if (task.calendar !== newCalendar) {
requests.push(this.changeCalendar(task, newCalendar));
} else {
requests.push(this.doUpdate(task));
}
return requests;
}
};
TasksBusinessLayer.prototype.addComment = function(comment, onSuccess, onFailure) {
var success,
_this = this;
if (!onSuccess) {
onSuccess = function() {};
}
if (!onFailure) {
onFailure = function() {};
}
this._$tasksmodel.addComment(comment);
success = function(response) {
if (response.status === 'error') {
return onFailure();
} else {
return onSuccess(response.data);
}
};
return this._persistence.addComment(comment, success);
};
TasksBusinessLayer.prototype.deleteComment = function(taskID, commentID) {
this._$tasksmodel.deleteComment(taskID, commentID);
return this._persistence.deleteComment(taskID, commentID);
};
return TasksBusinessLayer;
})();
return new TasksBusinessLayer(TasksModel, Persistence, VTodoService, VTodo, $timeout);
}
]);

View file

@ -1,461 +0,0 @@
/**
* Nextcloud - Tasks
*
* @author Raghu Nayyar
* @author Georg Ehrke
* @author Raimund Schlüßler
* @copyright 2017 Raghu Nayyar <beingminimal@gmail.com>
* @copyright 2017 Georg Ehrke <oc.list@georgehrke.com>
* @copyright 2018 Raimund Schlüßler <raimund.schluessler@mailbox.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
angular.module('Tasks').service('CalendarService', ['DavClient', 'Calendar', function(DavClient, Calendar){
'use strict';
var _this = this;
this._CALENDAR_HOME = null;
this._currentUserPrincipal = null;
this._takenUrls = [];
this._PROPERTIES = [
'{' + DavClient.NS_DAV + '}displayname',
'{' + DavClient.NS_IETF + '}calendar-description',
'{' + DavClient.NS_IETF + '}calendar-timezone',
'{' + DavClient.NS_APPLE + '}calendar-order',
'{' + DavClient.NS_APPLE + '}calendar-color',
'{' + DavClient.NS_IETF + '}supported-calendar-component-set',
'{' + DavClient.NS_OWNCLOUD + '}calendar-enabled',
'{' + DavClient.NS_DAV + '}acl',
'{' + DavClient.NS_DAV + '}owner',
'{' + DavClient.NS_OWNCLOUD + '}invite'
];
function discoverHome(callback) {
return DavClient.propFind(DavClient.buildUrl(OC.linkToRemoteBase('dav')), ['{' + DavClient.NS_DAV + '}current-user-principal'], 0, {'requesttoken': OC.requestToken}).then(function(response) {
if (!DavClient.wasRequestSuccessful(response.status)) {
throw "CalDAV client could not be initialized - Querying current-user-principal failed";
}
if (response.body.propStat.length < 1) {
return;
}
var props = response.body.propStat[0].properties;
_this._currentUserPrincipal = props['{' + DavClient.NS_DAV + '}current-user-principal'][0].textContent;
return DavClient.propFind(DavClient.buildUrl(_this._currentUserPrincipal), ['{' + DavClient.NS_IETF + '}calendar-home-set'], 0, {'requesttoken': OC.requestToken}).then(function (response) {
if (!DavClient.wasRequestSuccessful(response.status)) {
throw "CalDAV client could not be initialized - Querying calendar-home-set failed";
}
if (response.body.propStat.length < 1) {
return;
}
var props = response.body.propStat[0].properties;
_this._CALENDAR_HOME = props['{' + DavClient.NS_IETF + '}calendar-home-set'][0].textContent;
return callback();
});
});
}
function getResponseCodeFromHTTPResponse(t) {
return parseInt(t.split(' ')[1]);
}
this.getAll = function() {
if (this._CALENDAR_HOME === null) {
return discoverHome(function() {
return _this.getAll();
});
}
var prom = DavClient.propFind(DavClient.buildUrl(this._CALENDAR_HOME), this._PROPERTIES, 1, {'requesttoken': OC.requestToken}).then(function(response) {
var calendars = [];
if (!DavClient.wasRequestSuccessful(response.status)) {
throw "CalDAV client could not be initialized - Querying calendars failed";
}
for (var i = 0; i < response.body.length; i++) {
var body = response.body[i];
if (body.propStat.length < 1) {
continue;
}
_this._takenUrls.push(body.href);
var responseCode = getResponseCodeFromHTTPResponse(body.propStat[0].status);
if (!DavClient.wasRequestSuccessful(responseCode)) {
continue;
}
var doesSupportVTodo = false;
var components = body.propStat[0].properties['{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set'];
if (components) {
for (var j=0; j < components.length; j++) {
var name = components[j].attributes.getNamedItem('name').textContent.toLowerCase();
if (name === 'vtodo') {
doesSupportVTodo = true;
}
}
}
if (!doesSupportVTodo) {
continue;
}
_this._getACLFromResponse(body);
var uri = body.href.substr(_this._CALENDAR_HOME.length).replace(/[^\w\-]+/g, '');
var calendar = new Calendar(body.href, body.propStat[0].properties, uri);
calendars.push(calendar);
}
return calendars;
});
return prom;
};
this.get = function(url) {
if (this._CALENDAR_HOME === null) {
return discoverHome(function() {
return _this.get(url);
});
}
return DavClient.propFind(DavClient.buildUrl(url), this._PROPERTIES, 0, {'requesttoken': OC.requestToken}).then(function(response) {
var body = response.body;
if (body.propStat.length < 1) {
//TODO - something went wrong
return;
}
var responseCode = getResponseCodeFromHTTPResponse(body.propStat[0].status);
if (!DavClient.wasRequestSuccessful(responseCode)) {
//TODO - something went wrong
return;
}
_this._getACLFromResponse(body);
var uri = body.href.substr(_this._CALENDAR_HOME.length).replace(/[^\w\-]+/g, '');
return new Calendar(body.href, body.propStat[0].properties, uri);
});
};
this.create = function(name, color, components) {
if (this._CALENDAR_HOME === null) {
return discoverHome(function() {
return _this.create(name, color);
});
}
if (typeof components === 'undefined') {
components = ['vtodo'];
}
var xmlDoc = document.implementation.createDocument('', '', null);
var cMkcalendar = xmlDoc.createElement('c:mkcalendar');
cMkcalendar.setAttribute('xmlns:c', 'urn:ietf:params:xml:ns:caldav');
cMkcalendar.setAttribute('xmlns:d', 'DAV:');
cMkcalendar.setAttribute('xmlns:a', 'http://apple.com/ns/ical/');
cMkcalendar.setAttribute('xmlns:o', 'http://owncloud.org/ns');
xmlDoc.appendChild(cMkcalendar);
var dSet = xmlDoc.createElement('d:set');
cMkcalendar.appendChild(dSet);
var dProp = xmlDoc.createElement('d:prop');
dSet.appendChild(dProp);
dProp.appendChild(this._createXMLForProperty(xmlDoc, 'displayname', name));
dProp.appendChild(this._createXMLForProperty(xmlDoc, 'enabled', true));
dProp.appendChild(this._createXMLForProperty(xmlDoc, 'color', color));
dProp.appendChild(this._createXMLForProperty(xmlDoc, 'components', components));
var body = cMkcalendar.outerHTML;
var uri = this._suggestUri(name);
var url = this._CALENDAR_HOME + uri + '/';
var headers = {
'Content-Type' : 'application/xml; charset=utf-8',
'requesttoken' : OC.requestToken
};
return DavClient.request('MKCALENDAR', url, headers, body).then(function(response) {
if (response.status === 201) {
_this._takenUrls.push(url);
return _this.get(url).then(function(calendar) {
calendar.enabled = true;
return _this.update(calendar);
});
}
});
};
this.update = function(calendar) {
var xmlDoc = document.implementation.createDocument('', '', null);
var dPropUpdate = xmlDoc.createElement('d:propertyupdate');
dPropUpdate.setAttribute('xmlns:c', 'urn:ietf:params:xml:ns:caldav');
dPropUpdate.setAttribute('xmlns:d', 'DAV:');
dPropUpdate.setAttribute('xmlns:a', 'http://apple.com/ns/ical/');
dPropUpdate.setAttribute('xmlns:o', 'http://owncloud.org/ns');
xmlDoc.appendChild(dPropUpdate);
var dSet = xmlDoc.createElement('d:set');
dPropUpdate.appendChild(dSet);
var dProp = xmlDoc.createElement('d:prop');
dSet.appendChild(dProp);
var updatedProperties = calendar.updatedProperties;
calendar.resetUpdatedProperties();
for (var i=0; i < updatedProperties.length; i++) {
dProp.appendChild(this._createXMLForProperty(
xmlDoc,
updatedProperties[i],
calendar[updatedProperties[i]]
));
}
var url = calendar.url;
var body = dPropUpdate.outerHTML;
var headers = {
'Content-Type' : 'application/xml; charset=utf-8',
'requesttoken' : OC.requestToken
};
return DavClient.request('PROPPATCH', url, headers, body).then(function(response) {
return calendar;
});
};
this.delete = function(calendar) {
return DavClient.request('DELETE', calendar.url, {'requesttoken': OC.requestToken}, '').then(function(response) {
if (response.status === 204) {
return true;
} else {
// TODO - handle error case
return false;
}
});
};
this.share = function(calendar, shareType, shareWith, writable, existingShare) {
var xmlDoc = document.implementation.createDocument('', '', null);
var oShare = xmlDoc.createElement('o:share');
oShare.setAttribute('xmlns:d', 'DAV:');
oShare.setAttribute('xmlns:o', 'http://owncloud.org/ns');
xmlDoc.appendChild(oShare);
var oSet = xmlDoc.createElement('o:set');
oShare.appendChild(oSet);
var dHref = xmlDoc.createElement('d:href');
if (shareType === OC.Share.SHARE_TYPE_USER) {
dHref.textContent = 'principal:principals/users/';
} else if (shareType === OC.Share.SHARE_TYPE_GROUP) {
dHref.textContent = 'principal:principals/groups/';
}
dHref.textContent += shareWith;
oSet.appendChild(dHref);
var oSummary = xmlDoc.createElement('o:summary');
oSummary.textContent = t('calendar', '{calendar} shared by {owner}', {
calendar: calendar.displayname,
owner: calendar.owner
});
oSet.appendChild(oSummary);
if (writable) {
var oRW = xmlDoc.createElement('o:read-write');
oSet.appendChild(oRW);
}
var headers = {
'Content-Type' : 'application/xml; charset=utf-8',
requesttoken : oc_requesttoken
};
var body = oShare.outerHTML;
return DavClient.request('POST', calendar.url, headers, body).then(function(response) {
if (response.status === 200) {
if (!existingShare) {
if (shareType === OC.Share.SHARE_TYPE_USER) {
calendar.sharedWith.users.push({
id: shareWith,
displayname: shareWith,
writable: writable
});
} else if (shareType === OC.Share.SHARE_TYPE_GROUP) {
calendar.sharedWith.groups.push({
id: shareWith,
displayname: shareWith,
writable: writable
});
}
}
}
});
};
this.unshare = function(calendar, shareType, shareWith) {
var xmlDoc = document.implementation.createDocument('', '', null);
var oShare = xmlDoc.createElement('o:share');
oShare.setAttribute('xmlns:d', 'DAV:');
oShare.setAttribute('xmlns:o', 'http://owncloud.org/ns');
xmlDoc.appendChild(oShare);
var oRemove = xmlDoc.createElement('o:remove');
oShare.appendChild(oRemove);
var dHref = xmlDoc.createElement('d:href');
if (shareType === OC.Share.SHARE_TYPE_USER) {
dHref.textContent = 'principal:principals/users/';
} else if (shareType === OC.Share.SHARE_TYPE_GROUP) {
dHref.textContent = 'principal:principals/groups/';
}
dHref.textContent += shareWith;
oRemove.appendChild(dHref);
var headers = {
'Content-Type' : 'application/xml; charset=utf-8',
requesttoken: oc_requesttoken
};
var body = oShare.outerHTML;
return DavClient.request('POST', calendar.url, headers, body).then(function(response) {
if (response.status === 200) {
if (shareType === OC.Share.SHARE_TYPE_USER) {
calendar.sharedWith.users = calendar.sharedWith.users.filter(function(user) {
return user.id !== shareWith;
});
} else if (shareType === OC.Share.SHARE_TYPE_GROUP) {
calendar.sharedWith.groups = calendar.sharedWith.groups.filter(function(groups) {
return groups.id !== shareWith;
});
}
//todo - remove entry from calendar object
return true;
} else {
return false;
}
});
};
this._createXMLForProperty = function(xmlDoc, propName, value) {
switch(propName) {
case 'enabled':
var oEnabled = xmlDoc.createElement('o:calendar-enabled');
oEnabled.textContent = value ? '1' : '0';
return oEnabled;
case 'displayname':
var dDisplayname = xmlDoc.createElement('d:displayname');
dDisplayname.textContent = value;
return dDisplayname;
case 'order':
var aOrder = xmlDoc.createElement('a:calendar-color');
aOrder.textContent = value;
return aOrder;
case 'color':
var aColor = xmlDoc.createElement('a:calendar-color');
aColor.textContent = value;
return aColor;
case 'components':
var cComponents = xmlDoc.createElement('c:supported-calendar-component-set');
for (var i=0; i < value.length; i++) {
var cComp = xmlDoc.createElement('c:comp');
cComp.setAttribute('name', value[i].toUpperCase());
cComponents.appendChild(cComp);
}
return cComponents;
}
};
this._getACLFromResponse = function(body) {
var canWrite = false;
var acl = body.propStat[0].properties['{' + DavClient.NS_DAV + '}acl'];
if (acl) {
for (var k=0; k < acl.length; k++) {
var href = acl[k].getElementsByTagNameNS('DAV:', 'href');
if (href.length === 0) {
continue;
}
href = href[0].textContent;
if (href !== _this._currentUserPrincipal) {
continue;
}
var writeNode = acl[k].getElementsByTagNameNS('DAV:', 'write');
if (writeNode.length > 0) {
canWrite = true;
}
}
}
body.propStat[0].properties.canWrite = canWrite;
};
this._isUriAlreadyTaken = function(uri) {
return (this._takenUrls.indexOf(this._CALENDAR_HOME + uri + '/') !== -1);
};
this._suggestUri = function(displayname) {
var uri = displayname.toString().toLowerCase()
.replace(/\s+/g, '-') // Replace spaces with -
.replace(/[^\w\-]+/g, '') // Remove all non-word chars
.replace(/\-\-+/g, '-') // Replace multiple - with single -
.replace(/^-+/, '') // Trim - from start of text
.replace(/-+$/, ''); // Trim - from end of text
if (!this._isUriAlreadyTaken(uri)) {
return uri;
}
if (uri.indexOf('-') === -1) {
uri = uri + '-1';
if (!this._isUriAlreadyTaken(uri)) {
return uri;
}
}
while (this._isUriAlreadyTaken(uri)) {
var positionLastDash = uri.lastIndexOf('-');
var firstPart = uri.substr(0, positionLastDash);
var lastPart = uri.substr(positionLastDash + 1);
if (lastPart.match(/^\d+$/)) {
lastPart = parseInt(lastPart);
lastPart++;
uri = firstPart + '-' + lastPart;
} else if (lastPart === '') {
uri = uri + '1';
} else {
uri = uri = '-1';
}
}
return uri;
};
}]);

View file

@ -1,57 +0,0 @@
/**
* Nextcloud - Tasks
*
* @author Raghu Nayyar
* @author Georg Ehrke
* @author Raimund Schlüßler
* @copyright 2017 Raghu Nayyar <beingminimal@gmail.com>
* @copyright 2017 Georg Ehrke <oc.list@georgehrke.com>
* @copyright 2018 Raimund Schlüßler <raimund.schluessler@mailbox.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
angular.module('Tasks').service('DavClient', [
function() {
'use strict';
var client;
client = new dav.Client({
baseUrl: OC.linkToRemote('dav/calendars'),
xmlNamespaces: {
'DAV:': 'd',
'urn:ietf:params:xml:ns:caldav': 'c',
'http://apple.com/ns/ical/': 'aapl',
'http://owncloud.org/ns': 'oc',
'http://nextcloud.com/ns': 'nc',
'http://calendarserver.org/ns/': 'cs'
}
});
angular.extend(client, {
NS_DAV: 'DAV:',
NS_IETF: 'urn:ietf:params:xml:ns:caldav',
NS_APPLE: 'http://apple.com/ns/ical/',
NS_OWNCLOUD: 'http://owncloud.org/ns',
NS_NEXTCLOUD: 'http://nextcloud.com/ns',
NS_CALENDARSERVER: 'http://calendarserver.org/ns/',
buildUrl: function(path) {
return window.location.protocol + '//' + window.location.host + path;
},
wasRequestSuccessful: function(status) {
return status >= 200 && status <= 299;
}
});
return client;
}
]);

View file

@ -1,42 +0,0 @@
/**
* Nextcloud - Tasks
*
* @author Raghu Nayyar
* @author Georg Ehrke
* @author Raimund Schlüßler
* @copyright 2017 Raghu Nayyar <beingminimal@gmail.com>
* @copyright 2017 Georg Ehrke <oc.list@georgehrke.com>
* @copyright 2018 Raimund Schlüßler <raimund.schluessler@mailbox.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
angular.module('Tasks').service('ICalFactory', [
function() {
'use strict';
// creates a new ICAL root element with a product id property
return {
new: function() {
var root = new ICAL.Component(['vcalendar', [], []]);
var version = angular.element('#app').attr('data-appVersion');
root.updatePropertyWithValue('prodid', '-//Nextcloud Tasks v' + version);
return root;
}
};
}
]);

View file

@ -1,138 +0,0 @@
/**
* Nextcloud - Tasks
*
* @author Raimund Schlüßler
* @copyright 2018 Raimund Schlüßler <raimund.schluessler@mailbox.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
(function() {
'use strict';
angular.module('Tasks').factory('_Model', [
function() {
var Model;
Model = (function() {
function Model() {
this._data = [];
this._dataMap = {};
this._filterCache = {};
}
Model.prototype.handle = function(data) {
var item, _i, _len, _results;
_results = [];
for (_i = 0, _len = data.length; _i < _len; _i++) {
item = data[_i];
_results.push(this.add(item));
}
return _results;
};
Model.prototype.add = function(data, clearCache) {
if (clearCache === null) {
clearCache = true;
}
if (clearCache) {
this._invalidateCache();
}
if (angular.isDefined(this._dataMap[data.id])) {
return this.update(data, clearCache);
} else {
this._data.push(data);
this._dataMap[data.id] = data;
}
};
Model.prototype.update = function(data, clearCache) {
var entry, key, value, _results;
if (clearCache === null) {
clearCache = true;
}
if (clearCache) {
this._invalidateCache();
}
entry = this.getById(data.id);
_results = [];
for (key in data) {
value = data[key];
if (key === 'id') {
continue;
} else {
_results.push(entry[key] = value);
}
}
return _results;
};
Model.prototype.getById = function(id) {
return this._dataMap[id];
};
Model.prototype.getAll = function() {
return this._data;
};
Model.prototype.removeById = function(id, clearCache) {
var counter, data, entry, _i, _len, _ref;
if (clearCache === null) {
clearCache = true;
}
_ref = this._data;
for (counter = _i = 0, _len = _ref.length; _i < _len; counter = ++_i) {
entry = _ref[counter];
if (entry.id === id) {
this._data.splice(counter, 1);
data = this._dataMap[id];
delete this._dataMap[id];
if (clearCache) {
this._invalidateCache();
}
return data;
}
}
};
Model.prototype.clear = function() {
this._data.length = 0;
this._dataMap = {};
return this._invalidateCache();
};
Model.prototype._invalidateCache = function() {
this._filterCache = {};
};
Model.prototype.get = function(query) {
var hash;
hash = query.hashCode();
if (!angular.isDefined(this._filterCache[hash])) {
this._filterCache[hash] = query.exec(this._data);
}
return this._filterCache[hash];
};
Model.prototype.size = function() {
return this._data.length;
};
return Model;
})();
return Model;
}
]);
}).call(this);

View file

@ -1,289 +0,0 @@
/**
* Nextcloud - Tasks
*
* @author Raghu Nayyar
* @author Georg Ehrke
* @author Raimund Schlüßler
* @copyright 2017 Raghu Nayyar <beingminimal@gmail.com>
* @copyright 2017 Georg Ehrke <oc.list@georgehrke.com>
* @copyright 2018 Raimund Schlüßler <raimund.schluessler@mailbox.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
angular.module('Tasks').factory('Calendar', ['$rootScope', '$filter', '$window', function($rootScope, $filter, $window) {
'use strict';
function Calendar(url, props, uri) {
var _this = this;
props.color = props['{http://apple.com/ns/ical/}calendar-color'];
if (typeof props.color !== 'undefined') {
if (props.color.length === 9) {
props.color = props.color.substr(0,7);
}
} else {
props.color = '#1d2d44';
}
angular.extend(this, {
_propertiesBackup: {},
_properties: {
url: url,
uri: uri,
enabled: props['{http://owncloud.org/ns}calendar-enabled'] === '1',
displayname: props['{DAV:}displayname'] || t('tasks','Unnamed'),
color: props.color,
order: parseInt(props['{http://apple.com/ns/ical/}calendar-order']) || 0,
components: {
vevent: false,
vjournal: false,
vtodo: false
},
writable: props.canWrite,
shareable: props.canWrite,
sharedWith: {
users: [],
groups: []
},
owner: '',
loadedCompleted: false
},
_updatedProperties: []
});
this._propertiesBackup = angular.copy(this._properties);
// angular.extend(this, {
// tmpId: null,
// fcEventSource: {
// events: function (start, end, timezone, callback) {
// // console.log('querying events ...');
// // TimezoneService.get(timezone).then(function(tz) {
// // _this.list.loading = true;
// // $rootScope.$broadcast('reloadCalendarList');
// // VEventService.getAll(_this, start, end).then(function(events) {
// // var vevents = [];
// // for (var i = 0; i < events.length; i++) {
// // vevents = vevents.concat(events[i].getFcEvent(start, end, tz));
// // }
// // callback(vevents);
// // _this.list.loading = false;
// // $rootScope.$broadcast('reloadCalendarList');
// // });
// // });
// },
// editable: this._properties.writable,
// calendar: this
// },
// list: {
// edit: false,
// loading: this.enabled,
// locked: false,
// editingShares: false
// }
// });
var components = props['{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set'];
for (var i=0; i < components.length; i++) {
var name = components[i].attributes.getNamedItem('name').textContent.toLowerCase();
if (this._properties.components.hasOwnProperty(name)) {
this._properties.components[name] = true;
}
}
var shares = props['{http://owncloud.org/ns}invite'];
if (typeof shares !== 'undefined') {
for (var j=0; j < shares.length; j++) {
var href = shares[j].getElementsByTagNameNS('DAV:', 'href');
if (href.length === 0) {
continue;
}
href = href[0].textContent;
var access = shares[j].getElementsByTagNameNS('http://owncloud.org/ns', 'access');
if (access.length === 0) {
continue;
}
access = access[0];
var readWrite = access.getElementsByTagNameNS('http://owncloud.org/ns', 'read-write');
readWrite = readWrite.length !== 0;
if (href.startsWith('principal:principals/users/')) {
this._properties.sharedWith.users.push({
id: href.substr(27),
displayname: href.substr(27),
writable: readWrite
});
} else if (href.startsWith('principal:principals/groups/')) {
this._properties.sharedWith.groups.push({
id: href.substr(28),
displayname: href.substr(28),
writable: readWrite
});
}
}
}
var owner = props['{DAV:}owner'];
if (typeof owner !== 'undefined' && owner.length !== 0) {
owner = owner[0].textContent.slice(0, -1);
if (owner.startsWith('/remote.php/dav/principals/users/')) {
this._properties.owner = owner.substr(33);
}
}
// this.tmpId = RandomStringService.generate();
}
Calendar.prototype = {
get url() {
return this._properties.url;
},
get caldav() {
return $window.location.origin + this.url;
},
get exportUrl() {
var url = this.url;
// cut off last slash to have a fancy name for the ics
if (url.slice(url.length - 1) === '/') {
url = url.slice(0, url.length - 1);
}
url += '?export';
return url;
},
get enabled() {
return this._properties.enabled;
},
get uri() {
return this._properties.uri;
},
get components() {
return this._properties.components;
},
set enabled(enabled) {
this._properties.enabled = enabled;
this._setUpdated('enabled');
},
get displayname() {
return this._properties.displayname;
},
set displayname(displayname) {
this._properties.displayname = displayname;
this._setUpdated('displayname');
},
get color() {
return this._properties.color;
},
set color(color) {
this._properties.color = color;
this._setUpdated('color');
},
get sharedWith() {
return this._properties.sharedWith;
},
set sharedWith(sharedWith) {
this._properties.sharedWith = sharedWith;
},
get textColor() {
var color = this.color;
var fallbackColor = '#fff';
var c;
switch (color.length) {
case 4:
c = color.match(/^#([0-9a-f]{3})$/i)[1];
if (c) {
return this._generateTextColor(
parseInt(c.charAt(0),16)*0x11,
parseInt(c.charAt(1),16)*0x11,
parseInt(c.charAt(2),16)*0x11
);
}
return fallbackColor;
case 7:
case 9:
var regex = new RegExp('^#([0-9a-f]{' + (color.length - 1) + '})$', 'i');
c = color.match(regex)[1];
if (c) {
return this._generateTextColor(
parseInt(c.substr(0,2),16),
parseInt(c.substr(2,2),16),
parseInt(c.substr(4,2),16)
);
}
return fallbackColor;
default:
return fallbackColor;
}
},
get order() {
return this._properties.order;
},
set order(order) {
this._properties.order = order;
this._setUpdated('order');
},
get writable() {
return this._properties.writable;
},
get shareable() {
return this._properties.shareable;
},
get owner() {
return this._properties.owner;
},
get loadedCompleted() {
return this._properties.loadedCompleted;
},
set loadedCompleted(loadedCompleted) {
this._properties.loadedCompleted = loadedCompleted;
},
_setUpdated: function(propName) {
if (this._updatedProperties.indexOf(propName) === -1) {
this._updatedProperties.push(propName);
}
},
get updatedProperties() {
return this._updatedProperties;
},
resetUpdatedProperties: function() {
this._updatedProperties = [];
},
prepareUpdate: function() {
this._propertiesBackup = angular.copy(this._properties);
},
resetToPreviousState: function() {
this._properties = angular.copy(this._propertiesBackup);
this._propertiesBackup = {};
},
dropPreviousState: function() {
this._propertiesBackup = {};
},
toggleSharesEditor: function() {
this.list.editingShares = !this.list.editingShares;
},
_generateTextColor: function(r,g,b) {
var brightness = (((r * 299) + (g * 587) + (b * 114)) / 1000);
return (brightness > 130) ? '#000000' : '#FAFAFA';
}
};
return Calendar;
}]);

View file

@ -1,91 +0,0 @@
/**
* Nextcloud - Tasks
*
* @author Raimund Schlüßler
* @copyright 2018 Raimund Schlüßler <raimund.schluessler@mailbox.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
(function() {
'use strict';
var __hasProp = {}.hasOwnProperty,
__extends = function(child, parent) {
for (var key in parent) {
if (__hasProp.call(parent, key)) {
child[key] = parent[key];
}
}
function Ctor() {
this.constructor = child;
}
Ctor.prototype = parent.prototype;
child.prototype = new Ctor();
child.__super__ = parent.prototype;
return child;
},
__indexOf = [].indexOf || function(item) {
for (var i = 0, l = this.length; i < l; i++) {
if (i in this && this[i] === item) {
return i;
}
}
return -1;
};
angular.module('Tasks').factory('CollectionsModel', [
'TasksModel', '_Model', function(TasksModel, _Model) {
var CollectionsModel = (function(_super) {
function CollectionsModel(_$tasksmodel) {
this._$tasksmodel = _$tasksmodel;
this._nameCache = {};
CollectionsModel.__super__.constructor.call(this);
}
__extends(CollectionsModel, _super);
CollectionsModel.prototype.add = function(data, clearCache) {
if (clearCache === null) {
clearCache = true;
}
this._nameCache[data.displayname] = data;
if (angular.isDefined(data.id)) {
return CollectionsModel.__super__.add.call(this, data, clearCache);
}
};
CollectionsModel.prototype.getCount = function(collectionID, filter) {
var count, task, tasks, _i, _len;
if (filter === null) {
filter = '';
}
count = 0;
tasks = this._$tasksmodel.filteredTasks(filter);
for (_i = 0, _len = tasks.length; _i < _len; _i++) {
task = tasks[_i];
count += this._$tasksmodel.filterTasks(task, collectionID) && !task.related;
}
return count;
};
return CollectionsModel;
})(_Model);
return new CollectionsModel(TasksModel);
}
]);
}).call(this);

View file

@ -1,194 +0,0 @@
/**
* Nextcloud - Tasks
*
* @author Raimund Schlüßler
* @copyright 2018 Raimund Schlüßler <raimund.schluessler@mailbox.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
(function() {
'use strict';
var __hasProp = {}.hasOwnProperty,
__extends = function(child, parent) {
for (var key in parent) {
if (__hasProp.call(parent, key)) {
child[key] = parent[key];
}
}
function Ctor() {
this.constructor = child;
}
Ctor.prototype = parent.prototype;
child.prototype = new Ctor();
child.__super__ = parent.prototype;
return child;
},
__indexOf = [].indexOf || function(item) {
for (var i = 0, l = this.length; i < l; i++) {
if (i in this && this[i] === item) {
return i;
}
}
return -1;
};
angular.module('Tasks').factory('ListsModel', [
'TasksModel', '_Model', function(TasksModel, _Model) {
var ListsModel = (function(_super) {
function ListsModel(_$tasksmodel) {
this._$tasksmodel = _$tasksmodel;
this._tmpUriCache = {};
this._data = [];
this._dataMap = {};
this._filterCache = {};
}
__extends(ListsModel, _super);
ListsModel.prototype.add = function(calendar, clearCache) {
var updateByUri;
if (clearCache === null) {
clearCache = true;
}
updateByUri = angular.isDefined(calendar.uri) && angular.isDefined(this.getByUri(calendar.uri));
if (updateByUri) {
return this.update(calendar, clearCache);
} else {
if (angular.isDefined(calendar.uri)) {
if (clearCache) {
this._invalidateCache();
}
if (!angular.isDefined(this._dataMap[calendar.uri])) {
this._data.push(calendar);
this._dataMap[calendar.uri] = calendar;
}
}
}
};
ListsModel.prototype.getByUri = function(uri) {
return this._dataMap[uri];
};
ListsModel.prototype.update = function(list, clearCache) {
var tmplist;
if (clearCache === null) {
clearCache = true;
}
tmplist = this._tmpIdCache[list.tmpID];
if (angular.isDefined(list.id) && angular.isDefined(tmplist) && angular.isUndefined(tmplist.id)) {
tmplist.id = list.id;
this._dataMap[list.id] = tmplist;
}
list["void"] = false;
return ListsModel.__super__.update.call(this, list, clearCache);
};
ListsModel.prototype["delete"] = function(calendar, clearCache) {
var counter, data, entry, _i, _len, _ref;
if (clearCache === null) {
clearCache = true;
}
_ref = this._data;
for (counter = _i = 0, _len = _ref.length; _i < _len; counter = ++_i) {
entry = _ref[counter];
if (entry === calendar) {
this._data.splice(counter, 1);
data = this._dataMap[calendar.uri];
delete this._dataMap[calendar.uri];
if (clearCache) {
this._invalidateCache();
}
return data;
}
}
};
ListsModel.prototype.getStandardList = function() {
var calendars;
if (this.size()) {
calendars = this.getAll();
return calendars[0];
}
};
ListsModel.prototype.isNameAlreadyTaken = function(displayname, uri) {
var calendar, calendars, ret, _i, _len;
calendars = this.getAll();
ret = false;
for (_i = 0, _len = calendars.length; _i < _len; _i++) {
calendar = calendars[_i];
if (calendar.displayname === displayname && calendar.uri !== uri) {
ret = true;
}
}
return ret;
};
ListsModel.prototype.getCount = function(calendarID, collectionID, filter) {
var count, task, tasks, _i, _len;
if (filter === null) {
filter = '';
}
count = 0;
tasks = this._$tasksmodel.filteredTasks(filter);
for (_i = 0, _len = tasks.length; _i < _len; _i++) {
task = tasks[_i];
count += this._$tasksmodel.filterTasks(task, collectionID) && task.calendar.uri === calendarID && !task.related;
}
// if (collectionID === 'completed' && filter === '') {
// count += this.notLoaded(calendarID);
// }
return count;
};
ListsModel.prototype.loadedCompleted = function(calendarID) {
if (angular.isUndefined(this.getById(calendarID))) {
return false;
} else {
return this.getById(calendarID).loadedCompleted;
}
};
ListsModel.prototype.setLoadedCompleted = function(calendarID) {
this.getById(calendarID).loadedCompleted = true;
};
ListsModel.prototype.getColor = function(calendarID) {
if (angular.isUndefined(this.getById(calendarID))) {
return '#CCCCCC';
} else {
return this.getById(calendarID).calendarcolor;
}
};
ListsModel.prototype.getName = function(calendarID) {
if (angular.isUndefined(this.getById(calendarID))) {
return '';
} else {
return this.getById(calendarID).displayname;
}
};
return ListsModel;
})(_Model);
return new ListsModel(TasksModel);
}
]);
}).call(this);

View file

@ -1,81 +0,0 @@
/**
* Nextcloud - Tasks
*
* @author Raimund Schlüßler
* @copyright 2018 Raimund Schlüßler <raimund.schluessler@mailbox.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
(function() {
'use strict';
var __hasProp = {}.hasOwnProperty,
__extends = function(child, parent) {
for (var key in parent) {
if (__hasProp.call(parent, key)) {
child[key] = parent[key];
}
}
function Ctor() {
this.constructor = child;
}
Ctor.prototype = parent.prototype;
child.prototype = new Ctor();
child.__super__ = parent.prototype;
return child;
},
__indexOf = [].indexOf || function(item) {
for (var i = 0, l = this.length; i < l; i++) {
if (i in this && this[i] === item) {
return i;
}
}
return -1;
};
angular.module('Tasks').factory('SettingsModel', [
'_Model', function(_Model) {
var SettingsModel = (function(_super) {
function SettingsModel() {
this._nameCache = {};
SettingsModel.__super__.constructor.call(this);
}
__extends(SettingsModel, _super);
SettingsModel.prototype.add = function(data, clearCache) {
if (clearCache === null) {
clearCache = true;
}
this._nameCache[data.displayname] = data;
if (angular.isDefined(data.id)) {
return SettingsModel.__super__.add.call(this, data, clearCache);
} else {
return this._data.push(data);
}
};
SettingsModel.prototype.toggle = function(type, setting) {
var set;
set = this.getById(type);
this.getById(type)[setting] = !set[setting];
};
return SettingsModel;
})(_Model);
return new SettingsModel();
}
]);
}).call(this);

View file

@ -1,307 +0,0 @@
/**
* Nextcloud - Tasks
*
* @author Raghu Nayyar
* @author Georg Ehrke
* @author Raimund Schlüßler
* @copyright 2017 Raghu Nayyar <beingminimal@gmail.com>
* @copyright 2017 Georg Ehrke <oc.list@georgehrke.com>
* @copyright 2018 Raimund Schlüßler <raimund.schluessler@mailbox.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
angular.module('Tasks').factory('VTodo', ['$filter', 'ICalFactory', 'RandomStringService',
function($filter, icalfactory, RandomStringService) {
'use strict';
function VTodo(calendar, props, uri) {
var _this = this;
angular.extend(this, {
calendar: calendar,
data: props['{urn:ietf:params:xml:ns:caldav}calendar-data'],
uri: uri,
etag: props['{DAV:}getetag'] || null,
timers: [],
loaded: false
});
this.jCal = ICAL.parse(this.data);
this.components = new ICAL.Component(this.jCal);
if (this.components.jCal.length === 0) {
throw "invalid calendar";
}
}
VTodo.prototype = {
get summary() {
var vtodos = this.components.getAllSubcomponents('vtodo');
return vtodos[0].getFirstPropertyValue('summary');
},
set summary(summary) {
var vtodos = this.components.getAllSubcomponents('vtodo');
vtodos[0].updatePropertyWithValue('summary', summary);
this.updateLastModified();
this.data = this.components.toString();
},
get priority() {
var vtodos = this.components.getAllSubcomponents('vtodo');
var priority = vtodos[0].getFirstPropertyValue('priority');
return (10 - priority) % 10;
},
set priority(priority) {
var vtodos = this.components.getAllSubcomponents('vtodo');
vtodos[0].updatePropertyWithValue('priority', (10 - priority) % 10);
this.updateLastModified();
this.data = this.components.toString();
},
get complete() {
var vtodos = this.components.getAllSubcomponents('vtodo');
return vtodos[0].getFirstPropertyValue('percent-complete') || 0;
},
set complete(complete) {
var vtodos = this.components.getAllSubcomponents('vtodo');
vtodos[0].updatePropertyWithValue('percent-complete', complete);
this.updateLastModified();
this.data = this.components.toString();
if (complete < 100) {
this.completed = null;
if (complete === 0) {
this.status = 'NEEDS-ACTION';
} else {
this.status = 'IN-PROCESS';
}
} else {
this.completed = ICAL.Time.now();
this.status = 'COMPLETED';
}
},
get completed() {
var vtodos = this.components.getAllSubcomponents('vtodo');
var comp = vtodos[0].getFirstPropertyValue('completed');
if (comp) {
return true;
} else {
return false;
}
},
set completed(completed) {
var vtodos = this.components.getAllSubcomponents('vtodo');
if (completed) {
vtodos[0].updatePropertyWithValue('completed', completed);
} else {
vtodos[0].removeProperty('completed');
}
this.updateLastModified();
this.data = this.components.toString();
},
get completed_date() {
var vtodos = this.components.getAllSubcomponents('vtodo');
var comp = vtodos[0].getFirstPropertyValue('completed');
if (comp) {
return comp.toJSDate();
} else {
return null;
}
},
get status() {
var vtodos = this.components.getAllSubcomponents('vtodo');
return vtodos[0].getFirstPropertyValue('status');
},
set status(status) {
var vtodos = this.components.getAllSubcomponents('vtodo');
vtodos[0].updatePropertyWithValue('status', status);
this.updateLastModified();
this.data = this.components.toString();
},
get note() {
var vtodos = this.components.getAllSubcomponents('vtodo');
return vtodos[0].getFirstPropertyValue('description') || '';
},
set note(note) {
var vtodos = this.components.getAllSubcomponents('vtodo');
vtodos[0].updatePropertyWithValue('description', note);
this.updateLastModified();
this.data = this.components.toString();
},
get uid() {
var vtodos = this.components.getAllSubcomponents('vtodo');
return vtodos[0].getFirstPropertyValue('uid') || '';
},
get related() {
var vtodos = this.components.getAllSubcomponents('vtodo');
return vtodos[0].getFirstPropertyValue('related-to') || null;
},
set related(related) {
var vtodos = this.components.getAllSubcomponents('vtodo');
if (related) {
vtodos[0].updatePropertyWithValue('related-to', related);
} else {
vtodos[0].removeProperty('related-to');
}
this.updateLastModified();
this.data = this.components.toString();
},
get hideSubtasks() {
var vtodos = this.components.getAllSubcomponents('vtodo');
return +vtodos[0].getFirstPropertyValue('x-oc-hidesubtasks') || 0;
},
set hideSubtasks(hide) {
var vtodos = this.components.getAllSubcomponents('vtodo');
vtodos[0].updatePropertyWithValue('x-oc-hidesubtasks', +hide);
this.updateLastModified();
this.data = this.components.toString();
},
get hideCompletedSubtasks() {
var vtodos = this.components.getAllSubcomponents('vtodo');
return +vtodos[0].getFirstPropertyValue('x-oc-hidecompletedsubtasks') || 0;
},
set hideCompletedSubtasks(hide) {
var vtodos = this.components.getAllSubcomponents('vtodo');
vtodos[0].updatePropertyWithValue('x-oc-hidecompletedsubtasks', +hide);
this.updateLastModified();
this.data = this.components.toString();
},
get reminder() {
return null;
},
get categories() {
var vtodos = this.components.getAllSubcomponents('vtodo');
var categories = vtodos[0].getFirstProperty('categories');
if (categories) {
return categories.getValues();
} else {
return [];
}
},
set categories(cats) {
var vtodos = this.components.getAllSubcomponents('vtodo');
var categories = vtodos[0].getFirstProperty('categories');
if (cats.length > 0) {
if (categories) {
categories.setValues(cats);
} else {
var prop = new ICAL.Property('categories');
prop.setValues(cats);
categories = vtodos[0].addProperty(prop);
}
} else {
vtodos[0].removeProperty('categories');
}
this.updateLastModified();
this.data = this.components.toString();
},
get start() {
var vtodos = this.components.getAllSubcomponents('vtodo');
return vtodos[0].getFirstPropertyValue('dtstart');
},
set start(start) {
var vtodos = this.components.getAllSubcomponents('vtodo');
if (start) {
vtodos[0].updatePropertyWithValue('dtstart', start);
} else {
vtodos[0].removeProperty('dtstart');
}
this.updateLastModified();
this.data = this.components.toString();
},
get due() {
var vtodos = this.components.getAllSubcomponents('vtodo');
return vtodos[0].getFirstPropertyValue('due');
},
set due(due) {
var vtodos = this.components.getAllSubcomponents('vtodo');
if (due) {
vtodos[0].updatePropertyWithValue('due', due);
} else {
vtodos[0].removeProperty('due');
}
this.updateLastModified();
this.data = this.components.toString();
},
get allDay() {
var vtodos = this.components.getAllSubcomponents('vtodo');
var start = vtodos[0].getFirstPropertyValue('dtstart');
var due = vtodos[0].getFirstPropertyValue('due');
var d = due ? due : start;
return d!==null && d.isDate;
},
set allDay(allDay) {
var vtodos = this.components.getAllSubcomponents('vtodo');
var start = vtodos[0].getFirstPropertyValue('dtstart');
if(start) {
start.isDate = allDay;
vtodos[0].updatePropertyWithValue('dtstart', start);
}
var due = vtodos[0].getFirstPropertyValue('due');
if(due) {
due.isDate = allDay;
vtodos[0].updatePropertyWithValue('due', due);
}
this.updateLastModified();
this.data = this.components.toString();
},
get comments() {
return null;
},
get loadedCompleted () {
return this.loaded;
},
set loadedCompleted (loadedCompleted) {
this.loaded = loadedCompleted;
},
updateLastModified () {
var vtodos = this.components.getAllSubcomponents('vtodo');
vtodos[0].updatePropertyWithValue('last-modified', ICAL.Time.now());
vtodos[0].updatePropertyWithValue('dtstamp', ICAL.Time.now());
}
};
VTodo.create = function(task) {
var comp = icalfactory.new();
var vtodo = new ICAL.Component('vtodo');
comp.addSubcomponent(vtodo);
vtodo.updatePropertyWithValue('created', ICAL.Time.now());
vtodo.updatePropertyWithValue('dtstamp', ICAL.Time.now());
vtodo.updatePropertyWithValue('last-modified', ICAL.Time.now());
vtodo.updatePropertyWithValue('uid', RandomStringService.generate());
vtodo.updatePropertyWithValue('summary', task.summary);
vtodo.updatePropertyWithValue('priority', task.priority);
vtodo.updatePropertyWithValue('percent-complete', task.complete);
vtodo.updatePropertyWithValue('x-oc-hidesubtasks', 0);
if (task.related) {
vtodo.updatePropertyWithValue('related-to', task.related);
}
if (task.note) {
vtodo.updatePropertyWithValue('description', task.note);
}
if (task.due) {
vtodo.updatePropertyWithValue('due', task.due);
}
if (task.start) {
vtodo.updatePropertyWithValue('dtstart', task.start);
}
return new VTodo(task.calendar, {
'{urn:ietf:params:xml:ns:caldav}calendar-data': comp.toString(),
'{DAV:}getetag': null
}, null);
};
return VTodo;
}]);

View file

@ -1,131 +0,0 @@
/**
* Nextcloud - Tasks
*
* @author Raimund Schlüßler
* @copyright 2018 Raimund Schlüßler <raimund.schluessler@mailbox.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
angular.module('Tasks').factory('Persistence', [
'Request', 'Loading', '$rootScope', '$q', 'CalendarService', function(Request, Loading, $rootScope, $q, CalendarService) {
'use strict';
var Persistence = (function() {
function Persistence(_request, _Loading, _$rootScope, _CalendarService) {
this._request = _request;
this._Loading = _Loading;
this._$rootScope = _$rootScope;
this._CalendarService = _CalendarService;
}
Persistence.prototype.init = function() {
var successCallback,
_this = this;
this.deferred = $q.defer();
successCallback = function() {
return _this.deferred.resolve();
};
this.getCollections();
this.getSettings();
return this.deferred.promise;
};
Persistence.prototype.getCollections = function(onSuccess, showLoading) {
var failureCallbackWrapper, params, successCallbackWrapper,
_this = this;
if (showLoading === null) {
showLoading = true;
}
if (!onSuccess) {
onSuccess = function() {};
}
if (showLoading) {
this._Loading.increase();
successCallbackWrapper = function(data) {
onSuccess();
return _this._Loading.decrease();
};
failureCallbackWrapper = function(data) {
return _this._Loading.decrease();
};
} else {
successCallbackWrapper = function(data) {
return onSuccess();
};
failureCallbackWrapper = function(data) {};
}
params = {
onSuccess: successCallbackWrapper,
onFailure: failureCallbackWrapper
};
return this._request.get('/apps/tasks/collections', params);
};
Persistence.prototype.getSettings = function(onSuccess, showLoading) {
var failureCallbackWrapper, params, successCallbackWrapper,
_this = this;
if (showLoading === null) {
showLoading = true;
}
if (!onSuccess) {
onSuccess = function() {};
}
if (showLoading) {
this._Loading.increase();
successCallbackWrapper = function(data) {
onSuccess();
return _this._Loading.decrease();
};
failureCallbackWrapper = function(data) {
return _this._Loading.decrease();
};
} else {
successCallbackWrapper = function(data) {
return onSuccess();
};
failureCallbackWrapper = function(data) {};
}
params = {
onSuccess: successCallbackWrapper,
onFailure: failureCallbackWrapper
};
return this._request.get('/apps/tasks/settings', params);
};
Persistence.prototype.setVisibility = function(collectionID, visibility) {
var params = {
routeParams: {
collectionID: collectionID,
visibility: visibility
}
};
return this._request.post('/apps/tasks/collection/{collectionID}/visibility/{visibility}', params);
};
Persistence.prototype.setting = function(type, setting, value) {
var params = {
routeParams: {
type: type,
setting: setting,
value: value
}
};
return this._request.post('/apps/tasks/settings/{type}/{setting}/{value}', params);
};
return Persistence;
})();
return new Persistence(Request, Loading, $rootScope, CalendarService);
}
]);

View file

@ -1,56 +0,0 @@
/**
* Nextcloud - Tasks
*
* @author Raimund Schlüßler
* @copyright 2018 Raimund Schlüßler <raimund.schluessler@mailbox.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
angular.module('Tasks').factory('Publisher', [
'CollectionsModel', 'SettingsModel', function(CollectionsModel, SettingsModel) {
'use strict';
var Publisher = (function() {
function Publisher(_$collectionsmodel, _$settingsmodel) {
this._$collectionsmodel = _$collectionsmodel;
this._$settingsmodel = _$settingsmodel;
this._subscriptions = {};
this.subscribeObjectTo(this._$collectionsmodel, 'collections');
this.subscribeObjectTo(this._$settingsmodel, 'settings');
}
Publisher.prototype.subscribeObjectTo = function(object, name) {
var base = this._subscriptions;
if (!base[name]) {
base[name] = [];
}
return this._subscriptions[name].push(object);
};
Publisher.prototype.publishDataTo = function(data, name) {
var ref, results, subscriber, _i, _len;
ref = this._subscriptions[name] || [];
results = [];
for (_i = 0, _len = ref.length; _i < _len; _i++) {
subscriber = ref[_i];
results.push(subscriber.handle(data));
}
return results;
};
return Publisher;
})();
return new Publisher(CollectionsModel, SettingsModel);
}
]);

View file

@ -1,32 +0,0 @@
/**
* Nextcloud - Tasks
*
* @author Raghu Nayyar
* @author Georg Ehrke
* @copyright 2017 Raghu Nayyar <beingminimal@gmail.com>
* @copyright 2017 Georg Ehrke <oc.list@georgehrke.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
angular.module('Tasks').factory('RandomStringService', function () {
'use strict';
return {
generate: function() {
return Math.random().toString(36).substr(2);
}
};
});

View file

@ -1,147 +0,0 @@
/**
* Nextcloud - Tasks
*
* @author Raimund Schlüßler
* @copyright 2018 Raimund Schlüßler <raimund.schluessler@mailbox.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
angular.module('Tasks').factory('Request', [
'$http', 'Publisher', function($http, Publisher) {
'use strict';
var Request = (function() {
function Request($http, publisher) {
this.$http = $http;
this.publisher = publisher;
this.count = 0;
this.initialized = false;
this.shelvedRequests = [];
this.initialized = true;
this._executeShelvedRequests();
}
Request.prototype.request = function(route, data) {
var defaultConfig, defaultData, url;
if (data === null) {
data = {};
}
defaultData = {
routeParams: {},
data: {},
onSuccess: function() {
return {};
},
onFailure: function() {
return {};
},
config: {}
};
angular.extend(defaultData, data);
if (!this.initialized) {
this._shelveRequest(route, defaultData);
return;
}
url = OC.generateUrl(route, defaultData.routeParams);
defaultConfig = {
url: url,
data: defaultData.data
};
angular.extend(defaultConfig, defaultData.config);
if (defaultConfig.method === 'GET') {
defaultConfig.params = defaultConfig.data;
}
return this.$http(defaultConfig).then((function(_this) {
return function(response) {
var name, ref, value;
ref = response.data.data;
for (name in ref) {
value = ref[name];
_this.publisher.publishDataTo(value, name);
}
return defaultData.onSuccess(response.data, response.status, response.headers, response.config);
};
})(this)).catch(function(response) {
return defaultData.onFailure(response.data, response.status, response.headers, response.config);
});
};
Request.prototype.post = function(route, data) {
if (data === null) {
data = {};
}
if (!data.config) {
data.config = {};
}
data.config.method = 'POST';
return this.request(route, data);
};
Request.prototype.get = function(route, data) {
if (data === null) {
data = {};
}
if (!data.config) {
data.config = {};
}
data.config.method = 'GET';
return this.request(route, data);
};
Request.prototype.put = function(route, data) {
if (data === null) {
data = {};
}
if (!data.config) {
data.config = {};
}
data.config.method = 'PUT';
return this.request(route, data);
};
Request.prototype["delete"] = function(route, data) {
if (data === null) {
data = {};
}
if (!data.config) {
data.config = {};
}
data.config.method = 'DELETE';
return this.request(route, data);
};
Request.prototype._shelveRequest = function(route, data) {
var request = {
route: route,
data: data
};
return this.shelvedRequests.push(request);
};
Request.prototype._executeShelvedRequests = function() {
var r, ref, results, _i, _len;
ref = this.shelvedRequests;
results = [];
for (_i = 0, _len = ref.length; _i < _len; _i++) {
r = ref[_i];
results.push(this.request(r.route, r.data));
}
return results;
};
return Request;
})();
return new Request($http, Publisher);
}
]);

View file

@ -1,212 +0,0 @@
/**
* Nextcloud - Tasks
*
* @author Raghu Nayyar
* @author Georg Ehrke
* @author Raimund Schlüßler
* @copyright 2017 Raghu Nayyar <beingminimal@gmail.com>
* @copyright 2017 Georg Ehrke <oc.list@georgehrke.com>
* @copyright 2018 Raimund Schlüßler <raimund.schluessler@mailbox.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
angular.module('Tasks').service('VTodoService', ['DavClient', 'RandomStringService', '$timeout', function(DavClient, RandomStringService, $timeout) {
'use strict';
var _this = this;
this.getAll = function(calendar, completed, parent) {
if (completed === null) {
completed = false;
}
if (parent === null) {
parent = false;
}
var xmlDoc = document.implementation.createDocument('', '', null);
var cCalQuery = xmlDoc.createElement('c:calendar-query');
cCalQuery.setAttribute('xmlns:c', 'urn:ietf:params:xml:ns:caldav');
cCalQuery.setAttribute('xmlns:d', 'DAV:');
cCalQuery.setAttribute('xmlns:a', 'http://apple.com/ns/ical/');
cCalQuery.setAttribute('xmlns:o', 'http://owncloud.org/ns');
xmlDoc.appendChild(cCalQuery);
var dProp = xmlDoc.createElement('d:prop');
cCalQuery.appendChild(dProp);
var dGetEtag = xmlDoc.createElement('d:getetag');
dProp.appendChild(dGetEtag);
var cCalendarData = xmlDoc.createElement('c:calendar-data');
dProp.appendChild(cCalendarData);
var cFilter = xmlDoc.createElement('c:filter');
cCalQuery.appendChild(cFilter);
var cCompFilterVCal = xmlDoc.createElement('c:comp-filter');
cCompFilterVCal.setAttribute('name', 'VCALENDAR');
cFilter.appendChild(cCompFilterVCal);
var cCompFilterVTodo = xmlDoc.createElement('c:comp-filter');
cCompFilterVTodo.setAttribute('name', 'VTODO');
cCompFilterVCal.appendChild(cCompFilterVTodo);
var cPropFilterCompleted = xmlDoc.createElement('c:prop-filter');
cPropFilterCompleted.setAttribute('name', 'COMPLETED');
cCompFilterVTodo.appendChild(cPropFilterCompleted);
if (!completed) {
var cIsNotDefined = xmlDoc.createElement('c:is-not-defined');
cPropFilterCompleted.appendChild(cIsNotDefined);
}
if (parent) {
var cPropFilterRelated = xmlDoc.createElement('c:prop-filter');
cPropFilterRelated.setAttribute('name', 'RELATED-TO');
cCompFilterVTodo.appendChild(cPropFilterRelated);
var cTextMatch = xmlDoc.createElement('c:text-match');
var cTextMatchValue = xmlDoc.createTextNode(parent.uid);
cTextMatch.appendChild(cTextMatchValue);
cPropFilterRelated.appendChild(cTextMatch);
}
// var cPropFilterStatus = xmlDoc.createElement('c:prop-filter');
// cPropFilterStatus.setAttribute('name', 'STATUS');
// cCompFilterVTodo.appendChild(cPropFilterStatus);
// var cTextMatch = xmlDoc.createElement('c:text-match');
// cTextMatch.setAttribute('negate-condition', 'yes');
// var cTextMatchValue = xmlDoc.createTextNode('CANCELLED');
// cTextMatch.appendChild(cTextMatchValue);
// cPropFilterStatus.appendChild(cTextMatch);
// var cTimeRange = xmlDoc.createElement('c:time-range');
// cTimeRange.setAttribute('start', this._getTimeRangeStamp(start));
// cTimeRange.setAttribute('end', this._getTimeRangeStamp(end));
// cCompFilterVTodo.appendChild(cTimeRange);
var url = calendar.url;
var headers = {
'Content-Type': 'application/xml; charset=utf-8',
'Depth': 1,
'requesttoken': OC.requestToken
};
var body = cCalQuery.outerHTML;
return DavClient.request('REPORT', url, headers, body).then(function(response) {
if (!DavClient.wasRequestSuccessful(response.status)) {
//TODO - something went wrong
return;
}
var vTodos = [];
for (var i in response.body) {
var object = response.body[i];
var properties = object.propStat[0].properties;
var uri = object.href.substr(object.href.lastIndexOf('/') + 1);
var vTodo = {
calendar: calendar,
properties: properties,
uri: uri
};
vTodos.push(vTodo);
}
return vTodos;
});
};
this.get = function(calendar, uri) {
var url = calendar.url + uri;
return DavClient.request('GET', url, {'requesttoken' : OC.requestToken}, '').then(function(response) {
var vTodo = {
calendar: calendar,
properties: {
'{urn:ietf:params:xml:ns:caldav}calendar-data': response.body,
'{DAV:}getetag': response.xhr.getResponseHeader('ETag')},
uri: uri
};
return vTodo;
});
};
this.create = function(calendar, data, returnTodo) {
if (typeof returnTodo === 'undefined') {
returnTodo = true;
}
var headers = {
'Content-Type': 'text/calendar; charset=utf-8',
'requesttoken': OC.requestToken
};
var uri = this._generateRandomUri();
var url = calendar.url + uri;
return DavClient.request('PUT', url, headers, data).then(function(response) {
if (!DavClient.wasRequestSuccessful(response.status)) {
console.log(response);
return false;
// TODO - something went wrong, do smth about it
}
return returnTodo ?
_this.get(calendar, uri) :
true;
});
};
this.update = function(task) {
var url = task.calendar.url + task.uri;
var headers = {
'Content-Type': 'text/calendar; charset=utf-8',
'If-Match': task.etag,
'requesttoken': OC.requestToken
};
$timeout.cancel(task.timers.update);
return DavClient.request('PUT', url, headers, task.data).then(function(response) {
task.etag = response.xhr.getResponseHeader('ETag');
return DavClient.wasRequestSuccessful(response.status);
});
};
this.delete = function(task) {
var url = task.calendar.url + task.uri;
var headers = {
'If-Match': task.etag,
'requesttoken': OC.requestToken
};
return DavClient.request('DELETE', url, headers, '').then(function(response) {
return DavClient.wasRequestSuccessful(response.status);
});
};
this._generateRandomUri = function() {
var uri = 'Nextcloud-';
uri += RandomStringService.generate();
uri += RandomStringService.generate();
uri += '.ics';
return uri;
};
// this._getTimeRangeStamp = function(momentObject) {
// return momentObject.format('YYYYMMDD') + 'T' + momentObject.format('HHmmss') + 'Z';
// };
}]);

View file

@ -1,12 +0,0 @@
[
"vendor/angular/angular.min.js",
"vendor/angular-route/angular-route.min.js",
"vendor/angular-animate/angular-animate.min.js",
"vendor/angular-sanitize/angular-sanitize.min.js",
"vendor/angular-drag-and-drop-lists/angular-drag-and-drop-lists.min.js",
"vendor/ui-select/dist/select.min.js",
"vendor/jstimezonedetect/dist/jstz.min.js",
"vendor/ical.js/build/ical.min.js",
"vendor_legacy/jquery-timepicker/jquery.ui.timepicker.js",
"public/app.min.js"
]

View file

@ -1,278 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.""''''''

View file

@ -1,20 +0,0 @@
Copyright (c) 2011 John Resig, http://jquery.com/
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Some files were not shown because too many files have changed in this diff Show more