diff --git a/src/addon/calendar/lang/en.json b/src/addon/calendar/lang/en.json
index 474af9c02..4bb5a7893 100644
--- a/src/addon/calendar/lang/en.json
+++ b/src/addon/calendar/lang/en.json
@@ -1,4 +1,7 @@
{
"calendar": "Calendar",
- "calendarevents": "Calendar events"
+ "calendarevents": "Calendar events",
+ "defaultnotificationtime": "Default notification time",
+ "errorloadevents": "Error loading events.",
+ "noevents": "There are no events"
}
\ No newline at end of file
diff --git a/src/addon/calendar/pages/list/list.ts b/src/addon/calendar/pages/list/list.ts
index 5212688ea..e49e4d2f9 100644
--- a/src/addon/calendar/pages/list/list.ts
+++ b/src/addon/calendar/pages/list/list.ts
@@ -67,12 +67,12 @@ export class AddonCalendarListPage implements OnDestroy {
private eventsProvider: CoreEventsProvider, private navCtrl: NavController) {
this.siteHomeId = sitesProvider.getCurrentSite().getSiteHomeId();
- this.notificationsEnabled = localNotificationsProvider.isAvailable();
+ this.notificationsEnabled = true;//localNotificationsProvider.isAvailable();
if (this.notificationsEnabled) {
// Re-schedule events if default time changes.
this.obsDefaultTimeChange = eventsProvider.on(AddonCalendarProvider.DEFAULT_NOTIFICATION_TIME_CHANGED, () => {
calendarProvider.scheduleEventsNotifications(this.events);
- });
+ }, sitesProvider.getCurrentSiteId());
}
// @TODO: Split view once single event is done.
@@ -297,7 +297,6 @@ export class AddonCalendarListPage implements OnDestroy {
* Open calendar events settings.
*/
openSettings() {
- // @TODO: Check the settings page name.
this.navCtrl.push('AddonCalendarSettingsPage');
};
diff --git a/src/addon/calendar/pages/settings/settings.html b/src/addon/calendar/pages/settings/settings.html
new file mode 100644
index 000000000..b32c35dcf
--- /dev/null
+++ b/src/addon/calendar/pages/settings/settings.html
@@ -0,0 +1,22 @@
+
+
+ {{ 'core.settings.settings' | translate }}
+
+
+
+
+
+ {{ 'addon.calendar.defaultnotificationtime' | translate }}
+
+ {{ 'core.settings.disabled' | translate }}
+ {{ 600 | coreDuration }}
+ {{ 1800 | coreDuration }}
+ {{ 3600 | coreDuration }}
+ {{ 7200 | coreDuration }}
+ {{ 21600 | coreDuration }}
+ {{ 43200 | coreDuration }}
+ {{ 86400 | coreDuration }}
+
+
+
+
diff --git a/src/addon/calendar/pages/settings/settings.module.ts b/src/addon/calendar/pages/settings/settings.module.ts
new file mode 100644
index 000000000..59067baa6
--- /dev/null
+++ b/src/addon/calendar/pages/settings/settings.module.ts
@@ -0,0 +1,31 @@
+// (C) Copyright 2015 Martin Dougiamas
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import { NgModule } from '@angular/core';
+import { IonicPageModule } from 'ionic-angular';
+import { TranslateModule } from '@ngx-translate/core';
+import { AddonCalendarSettingsPage } from './settings';
+import { CorePipesModule } from '../../../../pipes/pipes.module';
+
+@NgModule({
+ declarations: [
+ AddonCalendarSettingsPage,
+ ],
+ imports: [
+ CorePipesModule,
+ IonicPageModule.forChild(AddonCalendarSettingsPage),
+ TranslateModule.forChild()
+ ],
+})
+export class AddonCalendarSettingsPageModule {}
diff --git a/src/addon/calendar/pages/settings/settings.scss b/src/addon/calendar/pages/settings/settings.scss
new file mode 100644
index 000000000..1f837a1e7
--- /dev/null
+++ b/src/addon/calendar/pages/settings/settings.scss
@@ -0,0 +1,3 @@
+page-addon-calendar-settings {
+
+}
\ No newline at end of file
diff --git a/src/addon/calendar/pages/settings/settings.ts b/src/addon/calendar/pages/settings/settings.ts
new file mode 100644
index 000000000..5e1be133c
--- /dev/null
+++ b/src/addon/calendar/pages/settings/settings.ts
@@ -0,0 +1,50 @@
+// (C) Copyright 2015 Martin Dougiamas
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import { Component } from '@angular/core';
+import { IonicPage } from 'ionic-angular';
+import { AddonCalendarProvider } from '../../providers/calendar';
+import { CoreEventsProvider } from '../../../../providers/events';
+import { CoreSitesProvider } from '../../../../providers/sites';
+
+/**
+ * Page that displays the list of calendar events.
+ */
+@IonicPage()
+@Component({
+ selector: 'page-addon-calendar-settings',
+ templateUrl: 'settings.html',
+})
+export class AddonCalendarSettingsPage {
+
+ defaultTime = 0;
+
+ constructor(private calendarProvider: AddonCalendarProvider, private eventsProvider: CoreEventsProvider,
+ private sitesProvider: CoreSitesProvider) {}
+
+ /**
+ * View loaded.
+ */
+ ionViewDidLoad() {
+ this.calendarProvider.getDefaultNotificationTime().then((time) => {
+ this.defaultTime = time;
+ });
+ }
+
+ updateDefaultTime(newTime) {
+ this.calendarProvider.setDefaultNotificationTime(newTime);
+ this.eventsProvider.trigger(AddonCalendarProvider.DEFAULT_NOTIFICATION_TIME_CHANGED, {time: newTime},
+ this.sitesProvider.getCurrentSiteId());
+ };
+}
\ No newline at end of file
diff --git a/src/addon/calendar/providers/calendar.ts b/src/addon/calendar/providers/calendar.ts
index d1a8445ec..bb5b0a4ec 100644
--- a/src/addon/calendar/providers/calendar.ts
+++ b/src/addon/calendar/providers/calendar.ts
@@ -350,6 +350,20 @@ export class AddonCalendarProvider {
return Promise.all(promises);
}
+ /**
+ * Set the default notification time.
+ *
+ * @param {number} time New default time.
+ * @param {string} [siteId] ID of the site. If not defined, use current site.
+ * @return {Promise} Promise resolved when stored.
+ */
+ setDefaultNotificationTime(time: number, siteId?: string) : Promise {
+ siteId = siteId || this.sitesProvider.getCurrentSiteId();
+
+ let key = AddonCalendarProvider.DEFAULT_NOTIFICATION_TIME_SETTING + '#' + siteId;
+ return this.configProvider.set(key, time);
+ }
+
/**
* Store events in local DB.
*
diff --git a/src/app/app.ios.scss b/src/app/app.ios.scss
index 829e70af8..84a20c0c0 100644
--- a/src/app/app.ios.scss
+++ b/src/app/app.ios.scss
@@ -24,6 +24,9 @@
}
}
+.bar-buttons core-context-menu .button-clear-ios {
+ color: $toolbar-ios-button-color;
+}
// Highlights inside the input element.
@if ($core-text-input-ios-show-highlight) {
@@ -87,4 +90,4 @@
@include ios-input-highlight($text-input-ios-highlight-color-invalid);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/app/app.md.scss b/src/app/app.md.scss
index c62a2141f..4aa56ca6d 100644
--- a/src/app/app.md.scss
+++ b/src/app/app.md.scss
@@ -12,8 +12,12 @@
height: calc(100% - #{($card-md-margin-end + $card-md-margin-start)});
}
+.bar-buttons core-context-menu .button-clear-md {
+ color: $toolbar-md-button-color;
+}
+
// Highlights inside the input element.
-@if ($core-text-input-md-show-highlight) {
+@if ($mm-text-input-md-show-highlight) {
.card-md, .list-md {
// In order to get a 2px border we need to add an inset
// box-shadow 1px (this is to avoid the div resizing)
@@ -75,4 +79,4 @@
@include md-input-highlight($text-input-md-highlight-color-invalid);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/app/app.scss b/src/app/app.scss
index 8c06237ba..9f15a904b 100644
--- a/src/app/app.scss
+++ b/src/app/app.scss
@@ -153,16 +153,16 @@ core-format-text[maxHeight], *[core-format-text][maxHeight] {
display: none;
}
- &:not(.core-shortened) {
+ &:not(.mm-shortened) {
max-height: none !important;
}
- &.core-shortened {
+ &.mm-shortened {
color: $gray-darker;
overflow: hidden;
min-height: 50px;
- .core-show-more {
+ .mm-show-more {
color: color($colors, dark);
text-align: right;
font-size: 14px;
diff --git a/src/app/app.wp.scss b/src/app/app.wp.scss
index c0544152c..fd5175023 100644
--- a/src/app/app.wp.scss
+++ b/src/app/app.wp.scss
@@ -11,3 +11,7 @@
.col[align-self-stretch] .card-wp {
height: calc(100% - #{($card-wp-margin-end + $card-wp-margin-start)});
}
+
+.bar-buttons core-context-menu .button-clear-wp {
+ color: $toolbar-wp-button-color;
+}
diff --git a/src/providers/events.ts b/src/providers/events.ts
index e9066b00f..198cb6a68 100644
--- a/src/providers/events.ts
+++ b/src/providers/events.ts
@@ -64,9 +64,10 @@ export class CoreEventsProvider {
*
* @param {string} eventName Name of the event to listen to.
* @param {Function} callBack Function to call when the event is triggered.
+ * @param {string} [siteId] Site where to trigger the event. Undefined won't check the site.
* @return {CoreEventObserver} Observer to stop listening.
*/
- on(eventName: string, callBack: (value: any) => void) : CoreEventObserver {
+ on(eventName: string, callBack: (value: any) => void, siteId?: string) : CoreEventObserver {
// If it's a unique event and has been triggered already, call the callBack.
// We don't need to create an observer because the event won't be triggered again.
if (this.uniqueEvents[eventName]) {
@@ -84,7 +85,11 @@ export class CoreEventsProvider {
this.observables[eventName] = new Subject();
}
- let subscription = this.observables[eventName].subscribe(callBack);
+ let subscription = this.observables[eventName].subscribe((value: any) => {
+ if (!siteId || value.siteId == siteId) {
+ callBack(value);
+ }
+ });
// Create and return a CoreEventObserver.
return {
@@ -100,10 +105,17 @@ export class CoreEventsProvider {
*
* @param {string} event Name of the event to trigger.
* @param {any} [data] Data to pass to the observers.
+ * @param {string} [siteId] Site where to trigger the event. Undefined means no Site.
*/
- trigger(eventName: string, data?: any) : void {
+ trigger(eventName: string, data?: any, siteId?: string) : void {
this.logger.debug(`Event '${eventName}' triggered.`);
if (this.observables[eventName]) {
+ if (siteId) {
+ if (!data) {
+ data = {};
+ }
+ data.siteId = siteId;
+ }
this.observables[eventName].next(data);
}
}
@@ -113,12 +125,21 @@ export class CoreEventsProvider {
*
* @param {string} event Name of the event to trigger.
* @param {any} data Data to pass to the observers.
+ * @param {string} [siteId] Site where to trigger the event. Undefined means no Site.
*/
- triggerUnique(eventName: string, data: any) : void {
+ triggerUnique(eventName: string, data: any, siteId?: string) : void {
if (this.uniqueEvents[eventName]) {
this.logger.debug(`Unique event '${eventName}' ignored because it was already triggered.`);
} else {
this.logger.debug(`Unique event '${eventName}' triggered.`);
+
+ if (siteId) {
+ if (!data) {
+ data = {};
+ }
+ data.siteId = siteId;
+ }
+
// Store the data so it can be passed to observers that register from now on.
this.uniqueEvents[eventName] = {
data: data