forked from CIT/Vmeda.Online
		
	MOBILE-3002 block: Add Remote RSS block feature
This commit is contained in:
		
							parent
							
								
									cac7f0bc12
								
							
						
					
					
						commit
						a549e70d5f
					
				| @ -55,6 +55,7 @@ | |||||||
|   "addon.block_recentlyaccessedcourses.pluginname": "block_recentlyaccessedcourses", |   "addon.block_recentlyaccessedcourses.pluginname": "block_recentlyaccessedcourses", | ||||||
|   "addon.block_recentlyaccesseditems.noitems": "block_recentlyaccesseditems", |   "addon.block_recentlyaccesseditems.noitems": "block_recentlyaccesseditems", | ||||||
|   "addon.block_recentactivity.pluginname": "block_recent_activity", |   "addon.block_recentactivity.pluginname": "block_recent_activity", | ||||||
|  |   "addon.block_rssclient.pluginname": "block_rss_client", | ||||||
|   "addon.block_glossaryrandom.pluginname": "block_glossary_random", |   "addon.block_glossaryrandom.pluginname": "block_glossary_random", | ||||||
|   "addon.block_selfcompletion.pluginname": "block_selfcompletion", |   "addon.block_selfcompletion.pluginname": "block_selfcompletion", | ||||||
|   "addon.block_sitemainmenu.pluginname": "block_site_main_menu", |   "addon.block_sitemainmenu.pluginname": "block_site_main_menu", | ||||||
|  | |||||||
							
								
								
									
										3
									
								
								src/addon/block/rssclient/lang/en.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								src/addon/block/rssclient/lang/en.json
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,3 @@ | |||||||
|  | { | ||||||
|  |     "pluginname": "Remote RSS feeds" | ||||||
|  | } | ||||||
							
								
								
									
										52
									
								
								src/addon/block/rssclient/providers/block-handler.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								src/addon/block/rssclient/providers/block-handler.ts
									
									
									
									
									
										Normal 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 | ||||||
|  |         }; | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										38
									
								
								src/addon/block/rssclient/rssclient.module.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								src/addon/block/rssclient/rssclient.module.ts
									
									
									
									
									
										Normal 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); | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										19
									
								
								src/addon/block/rssclient/rssclient.scss
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								src/addon/block/rssclient/rssclient.scss
									
									
									
									
									
										Normal 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; | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -111,6 +111,7 @@ import { AddonBlockTimelineModule } from '@addon/block/timeline/timeline.module' | |||||||
| import { AddonBlockRecentlyAccessedCoursesModule } from '@addon/block/recentlyaccessedcourses/recentlyaccessedcourses.module'; | import { AddonBlockRecentlyAccessedCoursesModule } from '@addon/block/recentlyaccessedcourses/recentlyaccessedcourses.module'; | ||||||
| import { AddonBlockRecentlyAccessedItemsModule } from '@addon/block/recentlyaccesseditems/recentlyaccesseditems.module'; | import { AddonBlockRecentlyAccessedItemsModule } from '@addon/block/recentlyaccesseditems/recentlyaccesseditems.module'; | ||||||
| import { AddonBlockRecentActivityModule } from '@addon/block/recentactivity/recentactivity.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 { AddonBlockStarredCoursesModule } from '@addon/block/starredcourses/starredcourses.module'; | ||||||
| import { AddonBlockSelfCompletionModule } from '@addon/block/selfcompletion/selfcompletion.module'; | import { AddonBlockSelfCompletionModule } from '@addon/block/selfcompletion/selfcompletion.module'; | ||||||
| import { AddonBlockTagsModule } from '@addon/block/tags/tags.module'; | import { AddonBlockTagsModule } from '@addon/block/tags/tags.module'; | ||||||
| @ -250,6 +251,7 @@ export const CORE_PROVIDERS: any[] = [ | |||||||
|         AddonBlockRecentlyAccessedCoursesModule, |         AddonBlockRecentlyAccessedCoursesModule, | ||||||
|         AddonBlockRecentlyAccessedItemsModule, |         AddonBlockRecentlyAccessedItemsModule, | ||||||
|         AddonBlockRecentActivityModule, |         AddonBlockRecentActivityModule, | ||||||
|  |         AddonBlockRssClientModule, | ||||||
|         AddonBlockStarredCoursesModule, |         AddonBlockStarredCoursesModule, | ||||||
|         AddonBlockSelfCompletionModule, |         AddonBlockSelfCompletionModule, | ||||||
|         AddonBlockTagsModule, |         AddonBlockTagsModule, | ||||||
|  | |||||||
| @ -56,6 +56,7 @@ | |||||||
|     "addon.block_recentlyaccessedcourses.pluginname": "Recently accessed courses", |     "addon.block_recentlyaccessedcourses.pluginname": "Recently accessed courses", | ||||||
|     "addon.block_recentlyaccesseditems.noitems": "No recent items", |     "addon.block_recentlyaccesseditems.noitems": "No recent items", | ||||||
|     "addon.block_recentlyaccesseditems.pluginname": "Recently accessed items", |     "addon.block_recentlyaccesseditems.pluginname": "Recently accessed items", | ||||||
|  |     "addon.block_rssclient.pluginname": "Remote RSS feeds", | ||||||
|     "addon.block_selfcompletion.pluginname": "Self completion", |     "addon.block_selfcompletion.pluginname": "Self completion", | ||||||
|     "addon.block_sitemainmenu.pluginname": "Main menu", |     "addon.block_sitemainmenu.pluginname": "Main menu", | ||||||
|     "addon.block_starredcourses.nocourses": "No starred courses", |     "addon.block_starredcourses.nocourses": "No starred courses", | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user