Merge pull request #1981 from crazyserver/MOBILE-3002

Mobile 3002
main
Juan Leyva 2019-07-10 16:39:44 +02:00 committed by GitHub
commit 295b9f5932
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
58 changed files with 1691 additions and 11 deletions

View File

@ -27,10 +27,15 @@
"addon.badges.version": "badges",
"addon.badges.warnexpired": "badges",
"addon.block_activitymodules.pluginname": "block_activity_modules",
"addon.block_badges.pluginname": "block_badges",
"addon.block_blogmenu.pluginname": "block_blog_menu",
"addon.block_blogrecent.nocourses": "block_blog_recent",
"addon.block_blogtags.pluginname": "block_blog_tags",
"addon.block_calendarmonth.pluginname": "block_calendar_month",
"addon.block_calendarupcoming.pluginname": "block_calendar_upcoming",
"addon.block_comments.pluginname": "block_comments",
"addon.block_completionstatus.pluginname": "block_completionstatus",
"addon.block_glossaryrandom.pluginname": "block_glossary_random",
"addon.block_learningplans.pluginname": "block_lp",
"addon.block_myoverview.all": "block_myoverview",
"addon.block_myoverview.favourites": "block_myoverview",
@ -43,15 +48,20 @@
"addon.block_myoverview.past": "block_myoverview",
"addon.block_myoverview.pluginname": "block_myoverview",
"addon.block_myoverview.title": "block_myoverview",
"addon.block_newsitems.pluginname": "block_news_items",
"addon.block_onlineusers.pluginname": "block_online_users",
"addon.block_privatefiles.pluginname": "block_private_files",
"addon.block_recentlyaccessedcourses.nocourses": "block_recentlyaccessedcourses",
"addon.block_recentlyaccessedcourses.pluginname": "block_recentlyaccessedcourses",
"addon.block_recentlyaccesseditems.noitems": "block_recentlyaccesseditems",
"addon.block_recentlyaccesseditems.pluginname": "block_recentlyaccesseditems",
"addon.block_recentactivity.pluginname": "block_recent_activity",
"addon.block_rssclient.pluginname": "block_rss_client",
"addon.block_glossaryrandom.pluginname": "block_glossary_random",
"addon.block_selfcompletion.pluginname": "block_selfcompletion",
"addon.block_sitemainmenu.pluginname": "block_site_main_menu",
"addon.block_starredcourses.nocourses": "block_starredcourses",
"addon.block_starredcourses.pluginname": "block_starredcourses",
"addon.block_tags.pluginname": "block_tags",
"addon.block_timeline.duedate": "block_timeline",
"addon.block_timeline.next30days": "block_timeline",
"addon.block_timeline.next3months": "block_timeline",

View File

@ -0,0 +1,38 @@
// (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 { IonicModule } from 'ionic-angular';
import { TranslateModule } from '@ngx-translate/core';
import { CoreBlockDelegate } from '@core/block/providers/delegate';
import { AddonBlockBadgesHandler } from './providers/block-handler';
@NgModule({
declarations: [
],
imports: [
IonicModule,
TranslateModule.forChild()
],
exports: [
],
providers: [
AddonBlockBadgesHandler
]
})
export class AddonBlockBadgesModule {
constructor(blockDelegate: CoreBlockDelegate, blockHandler: AddonBlockBadgesHandler) {
blockDelegate.registerHandler(blockHandler);
}
}

View File

@ -0,0 +1,23 @@
.addon-block-badges core-block-pre-rendered {
.core-block-content {
ul.badges {
list-style: none;
@include margin-horizontal(0);
-webkit-padding-start: 0;
li {
position: relative;
display: inline-block;
padding-top: 1em;
text-align: center;
vertical-align: top;
width: 150px;
.badge-name {
display: block;
padding: 5px;
}
}
}
}
}

View File

@ -0,0 +1,3 @@
{
"pluginname": "Latest badges"
}

View File

@ -0,0 +1,52 @@
// (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 { Injectable, Injector } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { CoreBlockHandlerData } from '@core/block/providers/delegate';
import { CoreBlockPreRenderedComponent } from '@core/block/components/pre-rendered-block/pre-rendered-block';
import { CoreBlockBaseHandler } from '@core/block/classes/base-block-handler';
/**
* Block handler.
*/
@Injectable()
export class AddonBlockBadgesHandler extends CoreBlockBaseHandler {
name = 'AddonBlockBadges';
blockName = 'badges';
constructor(private translate: TranslateService) {
super();
}
/**
* Returns the data needed to render the block.
*
* @param {Injector} injector Injector.
* @param {any} block The block to render.
* @param {string} contextLevel The context where the block will be used.
* @param {number} instanceId The instance ID associated with the context level.
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data.
*/
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> {
return {
title: this.translate.instant('addon.block_badges.pluginname'),
class: 'addon-block-badges',
component: CoreBlockPreRenderedComponent
};
}
}

View File

@ -0,0 +1,38 @@
// (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 { IonicModule } from 'ionic-angular';
import { TranslateModule } from '@ngx-translate/core';
import { CoreBlockDelegate } from '@core/block/providers/delegate';
import { AddonBlockBlogMenuHandler } from './providers/block-handler';
@NgModule({
declarations: [
],
imports: [
IonicModule,
TranslateModule.forChild()
],
exports: [
],
providers: [
AddonBlockBlogMenuHandler
]
})
export class AddonBlockBlogMenuModule {
constructor(blockDelegate: CoreBlockDelegate, blockHandler: AddonBlockBlogMenuHandler) {
blockDelegate.registerHandler(blockHandler);
}
}

View File

@ -0,0 +1,16 @@
.addon-block-blog-menu core-block-pre-rendered {
.core-block-content {
ul.list {
list-style: none;
@include margin-horizontal(0);
-webkit-padding-start: 0;
li {
padding-bottom: 8px;
}
}
}
.core-block-footer {
display: none;
}
}

View File

@ -0,0 +1,3 @@
{
"pluginname": "Blog menu"
}

View File

@ -0,0 +1,52 @@
// (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 { Injectable, Injector } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { CoreBlockHandlerData } from '@core/block/providers/delegate';
import { CoreBlockPreRenderedComponent } from '@core/block/components/pre-rendered-block/pre-rendered-block';
import { CoreBlockBaseHandler } from '@core/block/classes/base-block-handler';
/**
* Block handler.
*/
@Injectable()
export class AddonBlockBlogMenuHandler extends CoreBlockBaseHandler {
name = 'AddonBlockBlogMenu';
blockName = 'blog_menu';
constructor(private translate: TranslateService) {
super();
}
/**
* Returns the data needed to render the block.
*
* @param {Injector} injector Injector.
* @param {any} block The block to render.
* @param {string} contextLevel The context where the block will be used.
* @param {number} instanceId The instance ID associated with the context level.
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data.
*/
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> {
return {
title: this.translate.instant('addon.block_blogmenu.pluginname'),
class: 'addon-block-blog-menu',
component: CoreBlockPreRenderedComponent
};
}
}

View File

@ -0,0 +1,38 @@
// (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 { IonicModule } from 'ionic-angular';
import { TranslateModule } from '@ngx-translate/core';
import { CoreBlockDelegate } from '@core/block/providers/delegate';
import { AddonBlockBlogRecentHandler } from './providers/block-handler';
@NgModule({
declarations: [
],
imports: [
IonicModule,
TranslateModule.forChild()
],
exports: [
],
providers: [
AddonBlockBlogRecentHandler
]
})
export class AddonBlockBlogRecentModule {
constructor(blockDelegate: CoreBlockDelegate, blockHandler: AddonBlockBlogRecentHandler) {
blockDelegate.registerHandler(blockHandler);
}
}

View File

@ -0,0 +1,13 @@
.addon-block-blog-recent core-block-pre-rendered {
.core-block-content {
ul.list {
list-style: none;
@include margin-horizontal(0);
-webkit-padding-start: 0;
li {
padding-bottom: 8px;
}
}
}
}

View File

@ -0,0 +1,3 @@
{
"pluginname": "Recent blog entries"
}

View File

@ -0,0 +1,52 @@
// (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 { Injectable, Injector } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { CoreBlockHandlerData } from '@core/block/providers/delegate';
import { CoreBlockPreRenderedComponent } from '@core/block/components/pre-rendered-block/pre-rendered-block';
import { CoreBlockBaseHandler } from '@core/block/classes/base-block-handler';
/**
* Block handler.
*/
@Injectable()
export class AddonBlockBlogRecentHandler extends CoreBlockBaseHandler {
name = 'AddonBlockBlogRecent';
blockName = 'blog_recent';
constructor(private translate: TranslateService) {
super();
}
/**
* Returns the data needed to render the block.
*
* @param {Injector} injector Injector.
* @param {any} block The block to render.
* @param {string} contextLevel The context where the block will be used.
* @param {number} instanceId The instance ID associated with the context level.
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data.
*/
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> {
return {
title: this.translate.instant('addon.block_blogrecent.pluginname'),
class: 'addon-block-blog-recent',
component: CoreBlockPreRenderedComponent
};
}
}

View File

@ -0,0 +1,38 @@
// (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 { IonicModule } from 'ionic-angular';
import { TranslateModule } from '@ngx-translate/core';
import { CoreBlockDelegate } from '@core/block/providers/delegate';
import { AddonBlockBlogTagsHandler } from './providers/block-handler';
@NgModule({
declarations: [
],
imports: [
IonicModule,
TranslateModule.forChild()
],
exports: [
],
providers: [
AddonBlockBlogTagsHandler
]
})
export class AddonBlockBlogTagsModule {
constructor(blockDelegate: CoreBlockDelegate, blockHandler: AddonBlockBlogTagsHandler) {
blockDelegate.registerHandler(blockHandler);
}
}

View File

@ -0,0 +1,82 @@
.addon-block-blog-tags core-block-pre-rendered {
.core-block-content {
ul.inline-list {
list-style: none;
@include margin-horizontal(0);
-webkit-padding-start: 0;
li {
padding: 0 .2em;
display: inline;
}
}
.s20 {
font-size: 1.5em;
font-weight: bold;
}
.s19 {
font-size: 1.5em;
}
.s18 {
font-size: 1.4em;
font-weight: bold;
}
.s17 {
font-size: 1.4em;
}
.s16 {
font-size: 1.3em;
font-weight: bold;
}
.s15 {
font-size: 1.3em;
}
.s14 {
font-size: 1.2em;
font-weight: bold;
}
.s13 {
font-size: 1.2em;
}
.s12,
.s11 {
font-size: 1.1em;
font-weight: bold;
}
.s10,
.s9 {
font-size: 1.1em;
}
.s8,
.s7 {
font-size: 1em;
font-weight: bold;
}
.s6,
.s5 {
font-size: 1em;
}
.s4,
.s3 {
font-size: 0.9em;
font-weight: bold;
}
.s2,
.s1 {
font-size: 0.9em;
}
}
}

View File

@ -0,0 +1,3 @@
{
"pluginname": "Blog tags"
}

View File

@ -0,0 +1,52 @@
// (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 { Injectable, Injector } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { CoreBlockHandlerData } from '@core/block/providers/delegate';
import { CoreBlockPreRenderedComponent } from '@core/block/components/pre-rendered-block/pre-rendered-block';
import { CoreBlockBaseHandler } from '@core/block/classes/base-block-handler';
/**
* Block handler.
*/
@Injectable()
export class AddonBlockBlogTagsHandler extends CoreBlockBaseHandler {
name = 'AddonBlockBlogTags';
blockName = 'blog_tags';
constructor(private translate: TranslateService) {
super();
}
/**
* Returns the data needed to render the block.
*
* @param {Injector} injector Injector.
* @param {any} block The block to render.
* @param {string} contextLevel The context where the block will be used.
* @param {number} instanceId The instance ID associated with the context level.
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data.
*/
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> {
return {
title: this.translate.instant('addon.block_blogtags.pluginname'),
class: 'addon-block-blog-tags',
component: CoreBlockPreRenderedComponent
};
}
}

View File

@ -0,0 +1,38 @@
// (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 { IonicModule } from 'ionic-angular';
import { TranslateModule } from '@ngx-translate/core';
import { CoreBlockDelegate } from '@core/block/providers/delegate';
import { AddonBlockGlossaryRandomHandler } from './providers/block-handler';
@NgModule({
declarations: [
],
imports: [
IonicModule,
TranslateModule.forChild()
],
exports: [
],
providers: [
AddonBlockGlossaryRandomHandler
]
})
export class AddonBlockGlossaryRandomModule {
constructor(blockDelegate: CoreBlockDelegate, blockHandler: AddonBlockGlossaryRandomHandler) {
blockDelegate.registerHandler(blockHandler);
}
}

View File

@ -0,0 +1,3 @@
{
"pluginname": "Random glossary entry"
}

View File

@ -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 { Injectable, Injector } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { CoreBlockHandlerData } from '@core/block/providers/delegate';
import { CoreBlockPreRenderedComponent } from '@core/block/components/pre-rendered-block/pre-rendered-block';
import { CoreBlockBaseHandler } from '@core/block/classes/base-block-handler';
/**
* Block handler.
*/
@Injectable()
export class AddonBlockGlossaryRandomHandler extends CoreBlockBaseHandler {
name = 'AddonBlockGlossaryRandom';
blockName = 'glossary_random';
constructor(private translate: TranslateService) {
super();
}
/**
* Returns the data needed to render the block.
*
* @param {Injector} injector Injector.
* @param {any} block The block to render.
* @param {string} contextLevel The context where the block will be used.
* @param {number} instanceId The instance ID associated with the context level.
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data.
*/
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> {
return {
title: block.contents.title || this.translate.instant('addon.block_glossaryrandom.pluginname'),
class: 'addon-block-glossary-random',
component: CoreBlockPreRenderedComponent
};
}
}

View File

@ -0,0 +1,36 @@
// (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 { IonicModule } from 'ionic-angular';
import { CoreBlockDelegate } from '@core/block/providers/delegate';
import { AddonBlockHtmlHandler } from './providers/block-handler';
@NgModule({
declarations: [
],
imports: [
IonicModule
],
exports: [
],
providers: [
AddonBlockHtmlHandler
]
})
export class AddonBlockHtmlModule {
constructor(blockDelegate: CoreBlockDelegate, blockHandler: AddonBlockHtmlHandler) {
blockDelegate.registerHandler(blockHandler);
}
}

View File

@ -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 { Injectable, Injector } from '@angular/core';
import { CoreBlockHandlerData } from '@core/block/providers/delegate';
import { CoreBlockPreRenderedComponent } from '@core/block/components/pre-rendered-block/pre-rendered-block';
import { CoreBlockBaseHandler } from '@core/block/classes/base-block-handler';
/**
* Block handler.
*/
@Injectable()
export class AddonBlockHtmlHandler extends CoreBlockBaseHandler {
name = 'AddonBlockHtml';
blockName = 'html';
constructor() {
super();
}
/**
* Returns the data needed to render the block.
*
* @param {Injector} injector Injector.
* @param {any} block The block to render.
* @param {string} contextLevel The context where the block will be used.
* @param {number} instanceId The instance ID associated with the context level.
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data.
*/
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> {
return {
title: block.contents.title,
class: 'addon-block-html',
component: CoreBlockPreRenderedComponent
};
}
}

View File

@ -0,0 +1,3 @@
{
"pluginname": "Latest announcements"
}

View File

@ -0,0 +1,38 @@
// (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 { IonicModule } from 'ionic-angular';
import { TranslateModule } from '@ngx-translate/core';
import { CoreBlockDelegate } from '@core/block/providers/delegate';
import { AddonBlockNewsItemsHandler } from './providers/block-handler';
@NgModule({
declarations: [
],
imports: [
IonicModule,
TranslateModule.forChild()
],
exports: [
],
providers: [
AddonBlockNewsItemsHandler
]
})
export class AddonBlockNewsItemsModule {
constructor(blockDelegate: CoreBlockDelegate, blockHandler: AddonBlockNewsItemsHandler) {
blockDelegate.registerHandler(blockHandler);
}
}

View File

@ -0,0 +1,26 @@
.addon-block-news-items core-block-pre-rendered {
.core-block-content {
.unlist {
list-style-type: none;
@include margin-horizontal(0);
-webkit-padding-start: 0;
li.post {
padding-bottom: 16px;
}
li.post:last-child {
padding-bottom: 0;
}
}
}
// Hide RSS link.
.core-block-footer {
a {
display: none;
}
a:first-child {
display: inline;
}
}
}

View File

@ -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 { Injectable, Injector } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { CoreBlockHandlerData } from '@core/block/providers/delegate';
import { CoreBlockPreRenderedComponent } from '@core/block/components/pre-rendered-block/pre-rendered-block';
import { CoreBlockBaseHandler } from '@core/block/classes/base-block-handler';
/**
* Block handler.
*/
@Injectable()
export class AddonBlockNewsItemsHandler extends CoreBlockBaseHandler {
name = 'AddonBlockNewsItems';
blockName = 'news_items';
constructor(private translate: TranslateService) {
super();
}
/**
* Returns the data needed to render the block.
*
* @param {Injector} injector Injector.
* @param {any} block The block to render.
* @param {string} contextLevel The context where the block will be used.
* @param {number} instanceId The instance ID associated with the context level.
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data.
*/
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> {
return {
title: this.translate.instant('addon.block_newsitems.pluginname'),
class: 'addon-block-news-items',
component: CoreBlockPreRenderedComponent
};
}
}

View File

@ -0,0 +1,3 @@
{
"pluginname": "Online users"
}

View File

@ -0,0 +1,38 @@
// (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 { IonicModule } from 'ionic-angular';
import { TranslateModule } from '@ngx-translate/core';
import { CoreBlockDelegate } from '@core/block/providers/delegate';
import { AddonBlockOnlineUsersHandler } from './providers/block-handler';
@NgModule({
declarations: [
],
imports: [
IonicModule,
TranslateModule.forChild()
],
exports: [
],
providers: [
AddonBlockOnlineUsersHandler
]
})
export class AddonBlockOnlineUsersModule {
constructor(blockDelegate: CoreBlockDelegate, blockHandler: AddonBlockOnlineUsersHandler) {
blockDelegate.registerHandler(blockHandler);
}
}

View File

@ -0,0 +1,40 @@
.addon-block-online-users core-block-pre-rendered .core-block-content {
.list {
@include margin-horizontal(0);
-webkit-padding-start: 0;
li.listentry {
clear: both;
list-style-type: none;
.user {
@include float(start);
position: relative;
padding-bottom: 16px;
.core-adapted-img-container {
display: inline;
@include margin-horizontal(0, 8px);
}
.userpicture {
vertical-align: text-bottom;
}
}
.message {
@include float(end);
margin-top: 3px;
}
.uservisibility { // No support on the app.
display: none;
}
}
}
.info {
text-align: center;
}
}

View File

@ -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 { Injectable, Injector } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { CoreBlockHandlerData } from '@core/block/providers/delegate';
import { CoreBlockPreRenderedComponent } from '@core/block/components/pre-rendered-block/pre-rendered-block';
import { CoreBlockBaseHandler } from '@core/block/classes/base-block-handler';
/**
* Block handler.
*/
@Injectable()
export class AddonBlockOnlineUsersHandler extends CoreBlockBaseHandler {
name = 'AddonBlockOnlineUsers';
blockName = 'online_users';
constructor(private translate: TranslateService) {
super();
}
/**
* Returns the data needed to render the block.
*
* @param {Injector} injector Injector.
* @param {any} block The block to render.
* @param {string} contextLevel The context where the block will be used.
* @param {number} instanceId The instance ID associated with the context level.
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data.
*/
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> {
return {
title: this.translate.instant('addon.block_onlineusers.pluginname'),
class: 'addon-block-online-users',
component: CoreBlockPreRenderedComponent
};
}
}

View File

@ -0,0 +1,3 @@
{
"pluginname": "Recent activity"
}

View File

@ -0,0 +1,52 @@
// (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 { Injectable, Injector } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { CoreBlockHandlerData } from '@core/block/providers/delegate';
import { CoreBlockPreRenderedComponent } from '@core/block/components/pre-rendered-block/pre-rendered-block';
import { CoreBlockBaseHandler } from '@core/block/classes/base-block-handler';
/**
* Block handler.
*/
@Injectable()
export class AddonBlockRecentActivityHandler extends CoreBlockBaseHandler {
name = 'AddonBlockRecentActivity';
blockName = 'recent_activity';
constructor(private translate: TranslateService) {
super();
}
/**
* Returns the data needed to render the block.
*
* @param {Injector} injector Injector.
* @param {any} block The block to render.
* @param {string} contextLevel The context where the block will be used.
* @param {number} instanceId The instance ID associated with the context level.
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data.
*/
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> {
return {
title: this.translate.instant('addon.block_recentactivity.pluginname'),
class: 'addon-block-recent-activity',
component: CoreBlockPreRenderedComponent
};
}
}

View File

@ -0,0 +1,38 @@
// (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 { IonicModule } from 'ionic-angular';
import { TranslateModule } from '@ngx-translate/core';
import { CoreBlockDelegate } from '@core/block/providers/delegate';
import { AddonBlockRecentActivityHandler } from './providers/block-handler';
@NgModule({
declarations: [
],
imports: [
IonicModule,
TranslateModule.forChild()
],
exports: [
],
providers: [
AddonBlockRecentActivityHandler
]
})
export class AddonBlockRecentActivityModule {
constructor(blockDelegate: CoreBlockDelegate, blockHandler: AddonBlockRecentActivityHandler) {
blockDelegate.registerHandler(blockHandler);
}
}

View File

@ -0,0 +1,20 @@
.addon-block-recent-activity core-block-pre-rendered {
.core-block-content {
.activitydate, .activityhead {
text-align: center;
}
.unlist {
list-style: none;
@include margin-horizontal(0);
-webkit-padding-start: 0;
li {
margin-bottom: 1em;
.head .date {
@include float(end);
}
}
}
}
}

View File

@ -0,0 +1,3 @@
{
"pluginname": "Remote RSS feeds"
}

View File

@ -0,0 +1,52 @@
// (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 { Injectable, Injector } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { CoreBlockHandlerData } from '@core/block/providers/delegate';
import { CoreBlockPreRenderedComponent } from '@core/block/components/pre-rendered-block/pre-rendered-block';
import { CoreBlockBaseHandler } from '@core/block/classes/base-block-handler';
/**
* Block handler.
*/
@Injectable()
export class AddonBlockRssClientHandler extends CoreBlockBaseHandler {
name = 'AddonBlockRssClient';
blockName = 'rss_client';
constructor(private translate: TranslateService) {
super();
}
/**
* Returns the data needed to render the block.
*
* @param {Injector} injector Injector.
* @param {any} block The block to render.
* @param {string} contextLevel The context where the block will be used.
* @param {number} instanceId The instance ID associated with the context level.
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data.
*/
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> {
return {
title: block.contents.title || this.translate.instant('addon.block_rssclient.pluginname'),
class: 'addon-block-rss-client',
component: CoreBlockPreRenderedComponent
};
}
}

View File

@ -0,0 +1,38 @@
// (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 { IonicModule } from 'ionic-angular';
import { TranslateModule } from '@ngx-translate/core';
import { CoreBlockDelegate } from '@core/block/providers/delegate';
import { AddonBlockRssClientHandler } from './providers/block-handler';
@NgModule({
declarations: [
],
imports: [
IonicModule,
TranslateModule.forChild()
],
exports: [
],
providers: [
AddonBlockRssClientHandler
]
})
export class AddonBlockRssClientModule {
constructor(blockDelegate: CoreBlockDelegate, blockHandler: AddonBlockRssClientHandler) {
blockDelegate.registerHandler(blockHandler);
}
}

View File

@ -0,0 +1,19 @@
.addon-block-rss-client core-block-pre-rendered {
.core-block-content {
.list {
list-style: none;
@include margin-horizontal(0);
-webkit-padding-start: 0;
li {
border-top: 1px solid $gray;
padding: 5px;
padding-bottom: 8px;
}
li:first-child {
border-top-width: 0;
}
}
}
}

View File

@ -0,0 +1,3 @@
{
"pluginname": "Tags"
}

View File

@ -0,0 +1,52 @@
// (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 { Injectable, Injector } from '@angular/core';
import { TranslateService } from '@ngx-translate/core';
import { CoreBlockHandlerData } from '@core/block/providers/delegate';
import { CoreBlockPreRenderedComponent } from '@core/block/components/pre-rendered-block/pre-rendered-block';
import { CoreBlockBaseHandler } from '@core/block/classes/base-block-handler';
/**
* Block handler.
*/
@Injectable()
export class AddonBlockTagsHandler extends CoreBlockBaseHandler {
name = 'AddonBlockTags';
blockName = 'tags';
constructor(private translate: TranslateService) {
super();
}
/**
* Returns the data needed to render the block.
*
* @param {Injector} injector Injector.
* @param {any} block The block to render.
* @param {string} contextLevel The context where the block will be used.
* @param {number} instanceId The instance ID associated with the context level.
* @return {CoreBlockHandlerData|Promise<CoreBlockHandlerData>} Data or promise resolved with the data.
*/
getDisplayData(injector: Injector, block: any, contextLevel: string, instanceId: number)
: CoreBlockHandlerData | Promise<CoreBlockHandlerData> {
return {
title: this.translate.instant('addon.block_tags.pluginname'),
class: 'addon-block-tags',
component: CoreBlockPreRenderedComponent
};
}
}

View File

@ -0,0 +1,38 @@
// (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 { IonicModule } from 'ionic-angular';
import { TranslateModule } from '@ngx-translate/core';
import { CoreBlockDelegate } from '@core/block/providers/delegate';
import { AddonBlockTagsHandler } from './providers/block-handler';
@NgModule({
declarations: [
],
imports: [
IonicModule,
TranslateModule.forChild()
],
exports: [
],
providers: [
AddonBlockTagsHandler
]
})
export class AddonBlockTagsModule {
constructor(blockDelegate: CoreBlockDelegate, blockHandler: AddonBlockTagsHandler) {
blockDelegate.registerHandler(blockHandler);
}
}

View File

@ -0,0 +1,100 @@
.addon-block-tags core-block-pre-rendered {
.core-block-content {
.tag_cloud {
text-align: center;
ul.inline-list {
list-style: none;
@include margin-horizontal(0);
-webkit-padding-start: 0;
li {
padding: 0 .2em;
display: inline;
}
}
}
.tag_cloud .s20 {
font-size: 2.7em;
}
.tag_cloud .s19 {
font-size: 2.6em;
}
.tag_cloud .s18 {
font-size: 2.5em;
}
.tag_cloud .s17 {
font-size: 2.4em;
}
.tag_cloud .s16 {
font-size: 2.3em;
}
.tag_cloud .s15 {
font-size: 2.2em;
}
.tag_cloud .s14 {
font-size: 2.1em;
}
.tag_cloud .s13 {
font-size: 2em;
}
.tag_cloud .s12 {
font-size: 1.9em;
}
.tag_cloud .s11 {
font-size: 1.8em;
}
.tag_cloud .s10 {
font-size: 1.7em;
}
.tag_cloud .s9 {
font-size: 1.6em;
}
.tag_cloud .s8 {
font-size: 1.5em;
}
.tag_cloud .s7 {
font-size: 1.4em;
}
.tag_cloud .s6 {
font-size: 1.3em;
}
.tag_cloud .s5 {
font-size: 1.2em;
}
.tag_cloud .s4 {
font-size: 1.1em;
}
.tag_cloud .s3 {
font-size: 1em;
}
.tag_cloud .s2 {
font-size: 0.9em;
}
.tag_cloud .s1 {
font-size: 0.8em;
}
.tag_cloud .s0 {
font-size: 0.7em;
}
}
}

View File

@ -28,6 +28,7 @@ import { AddonModForumSyncCronHandler } from './providers/sync-cron-handler';
import { AddonModForumIndexLinkHandler } from './providers/index-link-handler';
import { AddonModForumDiscussionLinkHandler } from './providers/discussion-link-handler';
import { AddonModForumListLinkHandler } from './providers/list-link-handler';
import { AddonModForumPostLinkHandler } from './providers/post-link-handler';
import { AddonModForumPushClickHandler } from './providers/push-click-handler';
import { AddonModForumComponentsModule } from './components/components.module';
import { CoreUpdateManagerProvider } from '@providers/update-manager';
@ -56,6 +57,7 @@ export const ADDON_MOD_FORUM_PROVIDERS: any[] = [
AddonModForumSyncCronHandler,
AddonModForumIndexLinkHandler,
AddonModForumListLinkHandler,
AddonModForumPostLinkHandler,
AddonModForumDiscussionLinkHandler,
AddonModForumPushClickHandler
]
@ -66,7 +68,8 @@ export class AddonModForumModule {
cronDelegate: CoreCronDelegate, syncHandler: AddonModForumSyncCronHandler, linksDelegate: CoreContentLinksDelegate,
indexHandler: AddonModForumIndexLinkHandler, discussionHandler: AddonModForumDiscussionLinkHandler,
updateManager: CoreUpdateManagerProvider, listLinkHandler: AddonModForumListLinkHandler,
pushNotificationsDelegate: CorePushNotificationsDelegate, pushClickHandler: AddonModForumPushClickHandler) {
pushNotificationsDelegate: CorePushNotificationsDelegate, pushClickHandler: AddonModForumPushClickHandler,
postLinkHandler: AddonModForumPostLinkHandler) {
moduleDelegate.registerHandler(moduleHandler);
prefetchDelegate.registerHandler(prefetchHandler);
@ -74,6 +77,7 @@ export class AddonModForumModule {
linksDelegate.registerHandler(indexHandler);
linksDelegate.registerHandler(discussionHandler);
linksDelegate.registerHandler(listLinkHandler);
linksDelegate.registerHandler(postLinkHandler);
pushNotificationsDelegate.registerClickHandler(pushClickHandler);
// Allow migrating the tables from the old app to the new schema.

View File

@ -354,6 +354,9 @@ export class AddonModForumDiscussionPage implements OnDestroy {
return Promise.reject('Invalid forum discussion.');
}
this.defaultSubject = this.translate.instant('addon.mod_forum.re') + ' ' + this.discussion.subject;
this.replyData.subject = this.defaultSubject;
if (this.discussion.userfullname && this.discussion.parent == 0 && this.forum.type == 'single') {
// Hide author for first post and type single.
this.discussion.userfullname = null;

View File

@ -16,6 +16,9 @@ import { Injectable } from '@angular/core';
import { CoreContentLinksModuleIndexHandler } from '@core/contentlinks/classes/module-index-handler';
import { CoreCourseHelperProvider } from '@core/course/providers/helper';
import { AddonModForumProvider } from './forum';
import { CoreContentLinksAction } from '@core/contentlinks/providers/delegate';
import { CoreCourseProvider } from '@core/course/providers/course';
import { CoreDomUtilsProvider } from '@providers/utils/dom';
/**
* Handler to treat links to forum index.
@ -24,8 +27,12 @@ import { AddonModForumProvider } from './forum';
export class AddonModForumIndexLinkHandler extends CoreContentLinksModuleIndexHandler {
name = 'AddonModForumIndexLinkHandler';
constructor(courseHelper: CoreCourseHelperProvider, protected forumProvider: AddonModForumProvider) {
constructor(courseHelper: CoreCourseHelperProvider, protected forumProvider: AddonModForumProvider,
private courseProvider: CoreCourseProvider, private domUtils: CoreDomUtilsProvider) {
super(courseHelper, 'AddonModForum', 'forum');
// Match the view.php URL with an id param.
this.pattern = new RegExp('\/mod\/forum\/view\.php.*([\&\?](f|id)=\\d+)');
}
/**
@ -41,4 +48,35 @@ export class AddonModForumIndexLinkHandler extends CoreContentLinksModuleIndexHa
isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise<boolean> {
return true;
}
/**
* Get the list of actions for a link (url).
*
* @param {string[]} siteIds List of sites the URL belongs to.
* @param {string} url The URL to treat.
* @param {any} params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1}
* @param {number} [courseId] Course ID related to the URL. Optional but recommended.
* @return {CoreContentLinksAction[]|Promise<CoreContentLinksAction[]>} List of (or promise resolved with list of) actions.
*/
getActions(siteIds: string[], url: string, params: any, courseId?: number):
CoreContentLinksAction[] | Promise<CoreContentLinksAction[]> {
if (typeof params.f != 'undefined') {
return [{
action: (siteId, navCtrl?): void => {
const modal = this.domUtils.showModalLoading(),
forumId = parseInt(params.f, 10);
this.courseProvider.getModuleBasicInfoByInstance(forumId, 'forum', siteId).then((module) => {
this.courseHelper.navigateToModule(parseInt(module.id, 10), siteId, module.course);
}).finally(() => {
// Just in case. In fact we need to dismiss the modal before showing a toast or error message.
modal.dismiss();
});
}
}];
}
return super.getActions(siteIds, url, params, courseId);
}
}

View File

@ -0,0 +1,84 @@
// (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 { Injectable } from '@angular/core';
import { CoreContentLinksHandlerBase } from '@core/contentlinks/classes/base-handler';
import { CoreContentLinksAction } from '@core/contentlinks/providers/delegate';
import { CoreContentLinksHelperProvider } from '@core/contentlinks/providers/helper';
import { CoreCourseProvider } from '@core/course/providers/course';
import { CoreDomUtilsProvider } from '@providers/utils/dom';
/**
* Content links handler for forum new discussion.
* Match mod/forum/post.php?forum=6 with a valid data.
*/
@Injectable()
export class AddonModForumPostLinkHandler extends CoreContentLinksHandlerBase {
name = 'AddonModForumPostLinkHandler';
featureName = 'CoreCourseModuleDelegate_AddonModForum';
pattern = /\/mod\/forum\/post\.php.*([\?\&](forum)=\d+)/;
constructor(private linkHelper: CoreContentLinksHelperProvider, private courseProvider: CoreCourseProvider,
private domUtils: CoreDomUtilsProvider) {
super();
}
/**
* Get the list of actions for a link (url).
*
* @param {string[]} siteIds List of sites the URL belongs to.
* @param {string} url The URL to treat.
* @param {any} params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1}
* @param {number} [courseId] Course ID related to the URL. Optional but recommended.
* @return {CoreContentLinksAction[]|Promise<CoreContentLinksAction[]>} List of (or promise resolved with list of) actions.
*/
getActions(siteIds: string[], url: string, params: any, courseId?: number):
CoreContentLinksAction[] | Promise<CoreContentLinksAction[]> {
return [{
action: (siteId, navCtrl?): void => {
const modal = this.domUtils.showModalLoading(),
forumId = parseInt(params.forum, 10);
this.courseProvider.getModuleBasicInfoByInstance(forumId, 'forum', siteId).then((module) => {
const pageParams = {
courseId: module.course,
cmId: module.id,
forumId: module.instance,
timeCreated: 0,
};
return this.linkHelper.goInSite(navCtrl, 'AddonModForumNewDiscussionPage', pageParams, siteId);
}).finally(() => {
// Just in case. In fact we need to dismiss the modal before showing a toast or error message.
modal.dismiss();
});
}
}];
}
/**
* Check if the handler is enabled for a certain site (site + user) and a URL.
* If not defined, defaults to true.
*
* @param {string} siteId The site ID.
* @param {string} url The URL to treat.
* @param {any} params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1}
* @param {number} [courseId] Course ID related to the URL. Optional but recommended.
* @return {boolean|Promise<boolean>} Whether the handler is enabled for the URL and site.
*/
isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise<boolean> {
return typeof params.forum != 'undefined';
}
}

View File

@ -27,6 +27,7 @@ import { AddonModGlossarySyncCronHandler } from './providers/sync-cron-handler';
import { AddonModGlossaryIndexLinkHandler } from './providers/index-link-handler';
import { AddonModGlossaryEntryLinkHandler } from './providers/entry-link-handler';
import { AddonModGlossaryListLinkHandler } from './providers/list-link-handler';
import { AddonModGlossaryEditLinkHandler } from './providers/edit-link-handler';
import { AddonModGlossaryComponentsModule } from './components/components.module';
import { CoreUpdateManagerProvider } from '@providers/update-manager';
@ -54,7 +55,8 @@ export const ADDON_MOD_GLOSSARY_PROVIDERS: any[] = [
AddonModGlossarySyncCronHandler,
AddonModGlossaryIndexLinkHandler,
AddonModGlossaryEntryLinkHandler,
AddonModGlossaryListLinkHandler
AddonModGlossaryListLinkHandler,
AddonModGlossaryEditLinkHandler
]
})
export class AddonModGlossaryModule {
@ -62,7 +64,8 @@ export class AddonModGlossaryModule {
prefetchDelegate: CoreCourseModulePrefetchDelegate, prefetchHandler: AddonModGlossaryPrefetchHandler,
cronDelegate: CoreCronDelegate, syncHandler: AddonModGlossarySyncCronHandler, linksDelegate: CoreContentLinksDelegate,
indexHandler: AddonModGlossaryIndexLinkHandler, discussionHandler: AddonModGlossaryEntryLinkHandler,
updateManager: CoreUpdateManagerProvider, listLinkHandler: AddonModGlossaryListLinkHandler) {
updateManager: CoreUpdateManagerProvider, listLinkHandler: AddonModGlossaryListLinkHandler,
editLinkHandler: AddonModGlossaryEditLinkHandler) {
moduleDelegate.registerHandler(moduleHandler);
prefetchDelegate.registerHandler(prefetchHandler);
@ -70,6 +73,7 @@ export class AddonModGlossaryModule {
linksDelegate.registerHandler(indexHandler);
linksDelegate.registerHandler(discussionHandler);
linksDelegate.registerHandler(listLinkHandler);
linksDelegate.registerHandler(editLinkHandler);
// Allow migrating the tables from the old app to the new schema.
updateManager.registerSiteTableMigration({

View File

@ -0,0 +1,85 @@
// (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 { Injectable } from '@angular/core';
import { CoreContentLinksHandlerBase } from '@core/contentlinks/classes/base-handler';
import { CoreContentLinksAction } from '@core/contentlinks/providers/delegate';
import { CoreContentLinksHelperProvider } from '@core/contentlinks/providers/helper';
import { CoreCourseProvider } from '@core/course/providers/course';
import { CoreDomUtilsProvider } from '@providers/utils/dom';
/**
* Content links handler for glossary new entry.
* Match mod/glossary/edit.php?cmid=6 with a valid data.
* Currently it only supports new entry.
*/
@Injectable()
export class AddonModGlossaryEditLinkHandler extends CoreContentLinksHandlerBase {
name = 'AddonModGlossaryEditLinkHandler';
featureName = 'CoreCourseModuleDelegate_AddonModGlossary';
pattern = /\/mod\/glossary\/edit\.php.*([\?\&](cmid)=\d+)/;
constructor(private linkHelper: CoreContentLinksHelperProvider, private courseProvider: CoreCourseProvider,
private domUtils: CoreDomUtilsProvider) {
super();
}
/**
* Get the list of actions for a link (url).
*
* @param {string[]} siteIds List of sites the URL belongs to.
* @param {string} url The URL to treat.
* @param {any} params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1}
* @param {number} [courseId] Course ID related to the URL. Optional but recommended.
* @return {CoreContentLinksAction[]|Promise<CoreContentLinksAction[]>} List of (or promise resolved with list of) actions.
*/
getActions(siteIds: string[], url: string, params: any, courseId?: number):
CoreContentLinksAction[] | Promise<CoreContentLinksAction[]> {
return [{
action: (siteId, navCtrl?): void => {
const modal = this.domUtils.showModalLoading(),
cmId = parseInt(params.cmid, 10);
this.courseProvider.getModuleBasicInfo(cmId, siteId).then((module) => {
const pageParams = {
courseId: module.course,
module: module,
glossary: module.module,
entry: null // It does not support entry editing.
};
return this.linkHelper.goInSite(navCtrl, 'AddonModGlossaryEditPage', pageParams, siteId);
}).finally(() => {
// Just in case. In fact we need to dismiss the modal before showing a toast or error message.
modal.dismiss();
});
}
}];
}
/**
* Check if the handler is enabled for a certain site (site + user) and a URL.
* If not defined, defaults to true.
*
* @param {string} siteId The site ID.
* @param {string} url The URL to treat.
* @param {any} params The params of the URL. E.g. 'mysite.com?id=1' -> {id: 1}
* @param {number} [courseId] Course ID related to the URL. Optional but recommended.
* @return {boolean|Promise<boolean>} Whether the handler is enabled for the URL and site.
*/
isEnabled(siteId: string, url: string, params: any, courseId?: number): boolean | Promise<boolean> {
return typeof params.cmid != 'undefined';
}
}

View File

@ -91,19 +91,30 @@ import { AddonCourseCompletionModule } from '@addon/coursecompletion/coursecompl
import { AddonUserProfileFieldModule } from '@addon/userprofilefield/userprofilefield.module';
import { AddonFilesModule } from '@addon/files/files.module';
import { AddonBlockActivityModulesModule } from '@addon/block/activitymodules/activitymodules.module';
import { AddonBlockBadgesModule } from '@addon/block/badges/badges.module';
import { AddonBlockBlogMenuModule } from '@addon/block/blogmenu/blogmenu.module';
import { AddonBlockBlogTagsModule } from '@addon/block/blogtags/blogtags.module';
import { AddonBlockBlogRecentModule } from '@addon/block/blogrecent/blogrecent.module';
import { AddonBlockCalendarMonthModule } from '@addon/block/calendarmonth/calendarmonth.module';
import { AddonBlockCalendarUpcomingModule } from '@addon/block/calendarupcoming/calendarupcoming.module';
import { AddonBlockCommentsModule } from '@addon/block/comments/comments.module';
import { AddonBlockCompletionStatusModule } from '@addon/block/completionstatus/completionstatus.module';
import { AddonBlockGlossaryRandomModule } from '@addon/block/glossaryrandom/glossaryrandom.module';
import { AddonBlockHtmlModule } from '@addon/block/html/html.module';
import { AddonBlockMyOverviewModule } from '@addon/block/myoverview/myoverview.module';
import { AddonBlockNewsItemsModule } from '@addon/block/newsitems/newsitems.module';
import { AddonBlockOnlineUsersModule } from '@addon/block/onlineusers/onlineusers.module';
import { AddonBlockLearningPlansModule } from '@addon/block/learningplans/learningplans.module';
import { AddonBlockPrivateFilesModule } from '@addon/block/privatefiles/privatefiles.module';
import { AddonBlockSiteMainMenuModule } from '@addon/block/sitemainmenu/sitemainmenu.module';
import { AddonBlockTimelineModule } from '@addon/block/timeline/timeline.module';
import { AddonBlockRecentlyAccessedCoursesModule } from '@addon/block/recentlyaccessedcourses/recentlyaccessedcourses.module';
import { AddonBlockRecentlyAccessedItemsModule } from '@addon/block/recentlyaccesseditems/recentlyaccesseditems.module';
import { AddonBlockRecentActivityModule } from '@addon/block/recentactivity/recentactivity.module';
import { AddonBlockRssClientModule } from '@addon/block/rssclient/rssclient.module';
import { AddonBlockStarredCoursesModule } from '@addon/block/starredcourses/starredcourses.module';
import { AddonBlockSelfCompletionModule } from '@addon/block/selfcompletion/selfcompletion.module';
import { AddonBlockTagsModule } from '@addon/block/tags/tags.module';
import { AddonModAssignModule } from '@addon/mod/assign/assign.module';
import { AddonModBookModule } from '@addon/mod/book/book.module';
import { AddonModChatModule } from '@addon/mod/chat/chat.module';
@ -220,19 +231,30 @@ export const CORE_PROVIDERS: any[] = [
AddonUserProfileFieldModule,
AddonFilesModule,
AddonBlockActivityModulesModule,
AddonBlockBadgesModule,
AddonBlockBlogMenuModule,
AddonBlockBlogRecentModule,
AddonBlockBlogTagsModule,
AddonBlockCalendarMonthModule,
AddonBlockCalendarUpcomingModule,
AddonBlockCommentsModule,
AddonBlockCompletionStatusModule,
AddonBlockGlossaryRandomModule,
AddonBlockHtmlModule,
AddonBlockLearningPlansModule,
AddonBlockMyOverviewModule,
AddonBlockNewsItemsModule,
AddonBlockOnlineUsersModule,
AddonBlockPrivateFilesModule,
AddonBlockSiteMainMenuModule,
AddonBlockTimelineModule,
AddonBlockRecentlyAccessedCoursesModule,
AddonBlockRecentlyAccessedItemsModule,
AddonBlockRecentActivityModule,
AddonBlockRssClientModule,
AddonBlockStarredCoursesModule,
AddonBlockSelfCompletionModule,
AddonBlockTagsModule,
AddonModAssignModule,
AddonModBookModule,
AddonModChatModule,

View File

@ -27,10 +27,15 @@
"addon.badges.version": "Version",
"addon.badges.warnexpired": "(This badge has expired!)",
"addon.block_activitymodules.pluginname": "Activities",
"addon.block_badges.pluginname": "Latest badges",
"addon.block_blogmenu.pluginname": "Blog menu",
"addon.block_blogrecent.pluginname": "Recent blog entries",
"addon.block_blogtags.pluginname": "Blog tags",
"addon.block_calendarmonth.pluginname": "Calendar",
"addon.block_calendarupcoming.pluginname": " Upcoming events",
"addon.block_comments.pluginname": "Comments",
"addon.block_completionstatus.pluginname": "Course completion status",
"addon.block_glossaryrandom.pluginname": "Random glossary entry",
"addon.block_learningplans.pluginname": "Learning plans",
"addon.block_myoverview.all": "All",
"addon.block_myoverview.favourites": "Starred",
@ -43,15 +48,20 @@
"addon.block_myoverview.past": "Past",
"addon.block_myoverview.pluginname": "Course overview",
"addon.block_myoverview.title": "Course name",
"addon.block_newsitems.pluginname": "Latest announcements",
"addon.block_onlineusers.pluginname": "Online users",
"addon.block_privatefiles.pluginname": "Private files",
"addon.block_recentactivity.pluginname": "Recent activity",
"addon.block_recentlyaccessedcourses.nocourses": "No recent courses",
"addon.block_recentlyaccessedcourses.pluginname": "Recently accessed courses",
"addon.block_recentlyaccesseditems.noitems": "No recent items",
"addon.block_recentlyaccesseditems.pluginname": "Recently accessed items",
"addon.block_rssclient.pluginname": "Remote RSS feeds",
"addon.block_selfcompletion.pluginname": "Self completion",
"addon.block_sitemainmenu.pluginname": "Main menu",
"addon.block_starredcourses.nocourses": "No starred courses",
"addon.block_starredcourses.pluginname": "Starred courses",
"addon.block_tags.pluginname": "Tags",
"addon.block_timeline.duedate": "Due date",
"addon.block_timeline.next30days": "Next 30 days",
"addon.block_timeline.next3months": "Next 3 months",

View File

@ -19,6 +19,7 @@ import { TranslateModule } from '@ngx-translate/core';
import { CoreDirectivesModule } from '@directives/directives.module';
import { CoreBlockComponent } from './block/block';
import { CoreBlockOnlyTitleComponent } from './only-title-block/only-title-block';
import { CoreBlockPreRenderedComponent } from './pre-rendered-block/pre-rendered-block';
import { CoreBlockCourseBlocksComponent } from './course-blocks/course-blocks';
import { CoreComponentsModule } from '@components/components.module';
@ -26,6 +27,7 @@ import { CoreComponentsModule } from '@components/components.module';
declarations: [
CoreBlockComponent,
CoreBlockOnlyTitleComponent,
CoreBlockPreRenderedComponent,
CoreBlockCourseBlocksComponent
],
imports: [
@ -40,10 +42,12 @@ import { CoreComponentsModule } from '@components/components.module';
exports: [
CoreBlockComponent,
CoreBlockOnlyTitleComponent,
CoreBlockPreRenderedComponent,
CoreBlockCourseBlocksComponent
],
entryComponents: [
CoreBlockOnlyTitleComponent,
CoreBlockPreRenderedComponent,
CoreBlockCourseBlocksComponent
]
})

View File

@ -0,0 +1,11 @@
<ion-item-divider text-wrap *ngIf="title">
<h2><core-format-text [text]="title"></core-format-text></h2>
</ion-item-divider>
<core-loading [hideUntil]="loaded" class="core-loading-center">
<ion-item *ngIf="block.contents.content" text-wrap class="core-block-content">
<core-format-text [text]="block.contents.content"></core-format-text>
</ion-item>
<ion-item *ngIf="block.contents.footer" text-wrap class="core-block-footer">
<core-format-text [text]="block.contents.footer"></core-format-text>
</ion-item>
</core-loading>

View File

@ -0,0 +1,40 @@
// (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 { Injector, OnInit, Component } from '@angular/core';
import { CoreBlockBaseComponent } from '../../classes/base-block-component';
/**
* Component to render blocks with pre-rendered HTML.
*/
@Component({
selector: 'core-block-pre-rendered',
templateUrl: 'core-block-pre-rendered.html'
})
export class CoreBlockPreRenderedComponent extends CoreBlockBaseComponent implements OnInit {
constructor(injector: Injector) {
super(injector, 'CoreBlockPreRenderedComponent');
}
/**
* Component being initialized.
*/
ngOnInit(): void {
super.ngOnInit();
this.fetchContentDefaultError = 'Error getting ' + this.block.contents.title + ' data.';
}
}

View File

@ -16,6 +16,7 @@ import { Injectable, Injector } from '@angular/core';
import { CoreCourseOptionsHandler, CoreCourseOptionsHandlerData } from '@core/course/providers/options-delegate';
import { CoreCourseProvider } from '@core/course/providers/course';
import { CoreBlockCourseBlocksComponent } from '../components/course-blocks/course-blocks';
import { CoreBlockDelegate } from './delegate';
/**
* Course nav handler.
@ -25,7 +26,7 @@ export class CoreBlockCourseBlocksCourseOptionHandler implements CoreCourseOptio
name = 'CoreCourseBlocks';
priority = 700;
constructor(private courseProvider: CoreCourseProvider) {}
constructor(private courseProvider: CoreCourseProvider, private blockDelegate: CoreBlockDelegate) {}
/**
* Should invalidate the data to determine if the handler is enabled for a certain course.
@ -45,7 +46,7 @@ export class CoreBlockCourseBlocksCourseOptionHandler implements CoreCourseOptio
* @return {boolean} Whether or not the handler is enabled on a site level.
*/
isEnabled(): boolean | Promise<boolean> {
return this.courseProvider.canGetCourseBlocks();
return this.courseProvider.canGetCourseBlocks() && !this.blockDelegate.areBlocksDisabledInCourses();
}
/**
@ -58,7 +59,9 @@ export class CoreBlockCourseBlocksCourseOptionHandler implements CoreCourseOptio
* @return {boolean|Promise<boolean>} True or promise resolved with true if enabled.
*/
isEnabledForCourse(courseId: number, accessData: any, navOptions?: any, admOptions?: any): boolean | Promise<boolean> {
return true;
return this.courseProvider.getCourseBlocks(courseId).then((blocks) => {
return blocks && blocks.length > 0;
});
}
/**

View File

@ -117,6 +117,18 @@ export class CoreBlockDelegate extends CoreDelegate {
return site.isFeatureDisabled('NoDelegate_SiteBlocks');
}
/**
* Check if blocks are disabled in a certain site for courses.
*
* @param {CoreSite} [site] Site. If not defined, use current site.
* @return {boolean} Whether it's disabled.
*/
areBlocksDisabledInCourses(site?: CoreSite): boolean {
site = site || this.sitesProvider.getCurrentSite();
return site.isFeatureDisabled('NoDelegate_CourseBlocks');
}
/**
* Check if blocks are disabled in a certain site.
*

View File

@ -272,7 +272,8 @@ export class CoreCourseProvider {
getCourseBlocks(courseId: number, siteId?: string): Promise<any[]> {
return this.sitesProvider.getSite(siteId).then((site) => {
const params = {
courseid: courseId
courseid: courseId,
returncontents: 1
},
preSets: CoreSiteWSPreSets = {
cacheKey: this.getCourseBlocksCacheKey(courseId),

View File

@ -47,6 +47,7 @@ export class CoreCoursesDashboardProvider {
getDashboardBlocks(userId?: number, siteId?: string): Promise<any[]> {
return this.sitesProvider.getSite(siteId).then((site) => {
const params = {
returncontents: 1
},
preSets = {
cacheKey: this.getDashboardBlocksCacheKey(userId),

View File

@ -4,9 +4,8 @@ ion-app.app-root .item core-format-text,
ion-app.app-root core-rich-text-editor .core-rte-editor {
@include core-headings();
font-size: 1.4rem;
p {
font-size: 1.4rem;
margin-bottom: 1rem;
}