MOBILE-3445 siteplugins: Let plugins disable PTR
parent
743aa6c7db
commit
312a81f3ee
|
@ -98,7 +98,8 @@ export class CoreSitePluginsCourseOptionHandler extends CoreSitePluginsBaseHandl
|
||||||
args: {
|
args: {
|
||||||
courseid: course.id
|
courseid: course.id
|
||||||
},
|
},
|
||||||
initResult: this.initResult
|
initResult: this.initResult,
|
||||||
|
ptrEnabled: this.handlerSchema.ptrenabled,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,8 @@ export class CoreSitePluginsMainMenuHandler extends CoreSitePluginsBaseHandler i
|
||||||
title: this.title,
|
title: this.title,
|
||||||
component: this.plugin.component,
|
component: this.plugin.component,
|
||||||
method: this.handlerSchema.method,
|
method: this.handlerSchema.method,
|
||||||
initResult: this.initResult
|
initResult: this.initResult,
|
||||||
|
ptrEnabled: this.handlerSchema.ptrenabled,
|
||||||
},
|
},
|
||||||
onlyInMore: true
|
onlyInMore: true
|
||||||
};
|
};
|
||||||
|
|
|
@ -40,7 +40,8 @@ export class CoreSitePluginsMessageOutputHandler extends CoreSitePluginsBaseHand
|
||||||
title: this.title,
|
title: this.title,
|
||||||
component: this.plugin.component,
|
component: this.plugin.component,
|
||||||
method: this.handlerSchema.method,
|
method: this.handlerSchema.method,
|
||||||
initResult: this.initResult
|
initResult: this.initResult,
|
||||||
|
ptrEnabled: this.handlerSchema.ptrenabled,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,8 @@ export class CoreSitePluginsSettingsHandler extends CoreSitePluginsBaseHandler i
|
||||||
title: this.title,
|
title: this.title,
|
||||||
component: this.plugin.component,
|
component: this.plugin.component,
|
||||||
method: this.handlerSchema.method,
|
method: this.handlerSchema.method,
|
||||||
initResult: this.initResult
|
initResult: this.initResult,
|
||||||
|
ptrEnabled: this.handlerSchema.ptrenabled,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,7 +94,8 @@ export class CoreSitePluginsUserProfileHandler extends CoreSitePluginsBaseHandle
|
||||||
courseid: courseId,
|
courseid: courseId,
|
||||||
userid: user.id
|
userid: user.id
|
||||||
},
|
},
|
||||||
initResult: this.initResult
|
initResult: this.initResult,
|
||||||
|
ptrEnabled: this.handlerSchema.ptrenabled,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<ion-content>
|
<ion-content>
|
||||||
<ion-refresher [enabled]="content && content.dataLoaded" (ionRefresh)="refreshData($event)">
|
<ion-refresher [enabled]="ptrEnabled && content && content.dataLoaded" (ionRefresh)="refreshData($event)">
|
||||||
<ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
|
<ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
|
||||||
</ion-refresher>
|
</ion-refresher>
|
||||||
<core-site-plugins-plugin-content *ngIf="component && method" [component]="component" [method]="method" [args]="args" [initResult]="initResult"></core-site-plugins-plugin-content>
|
<core-site-plugins-plugin-content *ngIf="component && method" [component]="component" [method]="method" [args]="args" [initResult]="initResult"></core-site-plugins-plugin-content>
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
import { Component, OnInit, Input, ViewChild } from '@angular/core';
|
import { Component, OnInit, Input, ViewChild } from '@angular/core';
|
||||||
|
import { CoreUtils } from '@providers/utils/utils';
|
||||||
import { CoreSitePluginsProvider } from '../../providers/siteplugins';
|
import { CoreSitePluginsProvider } from '../../providers/siteplugins';
|
||||||
import { CoreSitePluginsPluginContentComponent } from '../plugin-content/plugin-content';
|
import { CoreSitePluginsPluginContentComponent } from '../plugin-content/plugin-content';
|
||||||
|
|
||||||
|
@ -33,6 +34,7 @@ export class CoreSitePluginsCourseOptionComponent implements OnInit {
|
||||||
method: string;
|
method: string;
|
||||||
args: any;
|
args: any;
|
||||||
initResult: any;
|
initResult: any;
|
||||||
|
ptrEnabled = true;
|
||||||
|
|
||||||
constructor(protected sitePluginsProvider: CoreSitePluginsProvider) { }
|
constructor(protected sitePluginsProvider: CoreSitePluginsProvider) { }
|
||||||
|
|
||||||
|
@ -49,6 +51,7 @@ export class CoreSitePluginsCourseOptionComponent implements OnInit {
|
||||||
courseid: this.courseId,
|
courseid: this.courseId,
|
||||||
};
|
};
|
||||||
this.initResult = handler.initResult;
|
this.initResult = handler.initResult;
|
||||||
|
this.ptrEnabled = !CoreUtils.instance.isFalseOrZero(handler.handlerSchema.ptrenabled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,7 @@ export class CoreSitePluginsModuleIndexComponent implements OnInit, OnDestroy, C
|
||||||
displayRefresh = true;
|
displayRefresh = true;
|
||||||
displayPrefetch = true;
|
displayPrefetch = true;
|
||||||
displaySize = true;
|
displaySize = true;
|
||||||
|
ptrEnabled = true;
|
||||||
|
|
||||||
jsData: any; // Data to pass to the component.
|
jsData: any; // Data to pass to the component.
|
||||||
|
|
||||||
|
@ -92,6 +93,7 @@ export class CoreSitePluginsModuleIndexComponent implements OnInit, OnDestroy, C
|
||||||
this.displayRefresh = !this.utils.isFalseOrZero(handler.handlerSchema.displayrefresh);
|
this.displayRefresh = !this.utils.isFalseOrZero(handler.handlerSchema.displayrefresh);
|
||||||
this.displayPrefetch = !this.utils.isFalseOrZero(handler.handlerSchema.displayprefetch);
|
this.displayPrefetch = !this.utils.isFalseOrZero(handler.handlerSchema.displayprefetch);
|
||||||
this.displaySize = !this.utils.isFalseOrZero(handler.handlerSchema.displaysize);
|
this.displaySize = !this.utils.isFalseOrZero(handler.handlerSchema.displaysize);
|
||||||
|
this.ptrEnabled = !this.utils.isFalseOrZero(handler.handlerSchema.ptrenabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the data for the context menu.
|
// Get the data for the context menu.
|
||||||
|
|
|
@ -63,6 +63,7 @@ export class CoreSitePluginsOnlyTitleBlockComponent extends CoreBlockBaseCompon
|
||||||
contextlevel: this.contextLevel,
|
contextlevel: this.contextLevel,
|
||||||
instanceid: this.instanceId,
|
instanceid: this.instanceId,
|
||||||
},
|
},
|
||||||
|
ptrEnabled: handler.handlerSchema.ptrenabled,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,8 +129,10 @@ export class CoreSitePluginsPluginContentComponent implements OnInit, DoCheck {
|
||||||
* @param jsData JS variables to pass to the new view so they can be used in the template or JS.
|
* @param jsData JS variables to pass to the new view so they can be used in the template or JS.
|
||||||
* If true is supplied instead of an object, all initial variables from current page will be copied.
|
* If true is supplied instead of an object, all initial variables from current page will be copied.
|
||||||
* @param preSets The preSets for the WS call of the new content.
|
* @param preSets The preSets for the WS call of the new content.
|
||||||
|
* @param ptrEnabled Whether PTR should be enabled in the new page. Defaults to true.
|
||||||
*/
|
*/
|
||||||
openContent(title: string, args: any, component?: string, method?: string, jsData?: any, preSets?: any): void {
|
openContent(title: string, args: any, component?: string, method?: string, jsData?: any, preSets?: any,
|
||||||
|
ptrEnabled?: boolean): void {
|
||||||
if (jsData === true) {
|
if (jsData === true) {
|
||||||
jsData = this.data;
|
jsData = this.data;
|
||||||
}
|
}
|
||||||
|
@ -142,7 +144,8 @@ export class CoreSitePluginsPluginContentComponent implements OnInit, DoCheck {
|
||||||
args: args,
|
args: args,
|
||||||
initResult: this.initResult,
|
initResult: this.initResult,
|
||||||
jsData: jsData,
|
jsData: jsData,
|
||||||
preSets: preSets
|
preSets: preSets,
|
||||||
|
ptrEnabled: ptrEnabled,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,7 @@ export class CoreSitePluginsCallWSNewContentDirective extends CoreSitePluginsCal
|
||||||
@Input() jsData: any; // JS variables to pass to the new page so they can be used in the template or JS.
|
@Input() jsData: any; // JS variables to pass to the new page so they can be used in the template or JS.
|
||||||
// If true is supplied instead of an object, all initial variables from current page will be copied.
|
// If true is supplied instead of an object, all initial variables from current page will be copied.
|
||||||
@Input() newContentPreSets: any; // The preSets for the WS call of the new content.
|
@Input() newContentPreSets: any; // The preSets for the WS call of the new content.
|
||||||
|
@Input() ptrEnabled: boolean | string; // Whether PTR should be enabled in the new page. Defaults to true.
|
||||||
|
|
||||||
constructor(element: ElementRef, translate: TranslateService, domUtils: CoreDomUtilsProvider,
|
constructor(element: ElementRef, translate: TranslateService, domUtils: CoreDomUtilsProvider,
|
||||||
sitePluginsProvider: CoreSitePluginsProvider, @Optional() parentContent: CoreSitePluginsPluginContentComponent,
|
sitePluginsProvider: CoreSitePluginsProvider, @Optional() parentContent: CoreSitePluginsPluginContentComponent,
|
||||||
|
@ -102,7 +103,8 @@ export class CoreSitePluginsCallWSNewContentDirective extends CoreSitePluginsCal
|
||||||
args: args,
|
args: args,
|
||||||
initResult: this.parentContent && this.parentContent.initResult,
|
initResult: this.parentContent && this.parentContent.initResult,
|
||||||
jsData: jsData,
|
jsData: jsData,
|
||||||
preSets: this.newContentPreSets
|
preSets: this.newContentPreSets,
|
||||||
|
ptrEnabled: this.ptrEnabled,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,6 +54,7 @@ export class CoreSitePluginsNewContentDirective implements OnInit {
|
||||||
@Input() jsData: any; // JS variables to pass to the new page so they can be used in the template or JS.
|
@Input() jsData: any; // JS variables to pass to the new page so they can be used in the template or JS.
|
||||||
// If true is supplied instead of an object, all initial variables from current page will be copied.
|
// If true is supplied instead of an object, all initial variables from current page will be copied.
|
||||||
@Input() preSets: any; // The preSets for the WS call of the new content.
|
@Input() preSets: any; // The preSets for the WS call of the new content.
|
||||||
|
@Input() ptrEnabled: boolean | string; // Whether PTR should be enabled in the new page. Defaults to true.
|
||||||
|
|
||||||
protected element: HTMLElement;
|
protected element: HTMLElement;
|
||||||
|
|
||||||
|
@ -99,7 +100,8 @@ export class CoreSitePluginsNewContentDirective implements OnInit {
|
||||||
args: args,
|
args: args,
|
||||||
initResult: this.parentContent && this.parentContent.initResult,
|
initResult: this.parentContent && this.parentContent.initResult,
|
||||||
jsData: jsData,
|
jsData: jsData,
|
||||||
preSets: this.preSets
|
preSets: this.preSets,
|
||||||
|
ptrEnabled: this.ptrEnabled,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
</ion-navbar>
|
</ion-navbar>
|
||||||
</ion-header>
|
</ion-header>
|
||||||
<ion-content>
|
<ion-content>
|
||||||
<ion-refresher [enabled]="content && content.content && content.content.dataLoaded" (ionRefresh)="refreshData($event)">
|
<ion-refresher [enabled]="content && content.ptrEnabled && content.content && content.content.dataLoaded" (ionRefresh)="refreshData($event)">
|
||||||
<ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
|
<ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
|
||||||
</ion-refresher>
|
</ion-refresher>
|
||||||
<core-site-plugins-module-index [module]="module" [courseId]="courseId" [pageTitle]="title"></core-site-plugins-module-index>
|
<core-site-plugins-module-index [module]="module" [courseId]="courseId" [pageTitle]="title"></core-site-plugins-module-index>
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
</ion-navbar>
|
</ion-navbar>
|
||||||
</ion-header>
|
</ion-header>
|
||||||
<ion-content>
|
<ion-content>
|
||||||
<ion-refresher [enabled]="content && content.dataLoaded" (ionRefresh)="refreshData($event)">
|
<ion-refresher [enabled]="ptrEnabled && content && content.dataLoaded" (ionRefresh)="refreshData($event)">
|
||||||
<ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
|
<ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
|
||||||
</ion-refresher>
|
</ion-refresher>
|
||||||
<core-site-plugins-plugin-content [component]="component" [method]="method" [args]="args" [preSets]="preSets" [initResult]="initResult" [data]="jsData" [pageTitle]="title"></core-site-plugins-plugin-content>
|
<core-site-plugins-plugin-content [component]="component" [method]="method" [args]="args" [preSets]="preSets" [initResult]="initResult" [data]="jsData" [pageTitle]="title"></core-site-plugins-plugin-content>
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
import { Component, ViewChild } from '@angular/core';
|
import { Component, ViewChild } from '@angular/core';
|
||||||
import { IonicPage, NavParams } from 'ionic-angular';
|
import { IonicPage, NavParams } from 'ionic-angular';
|
||||||
|
import { CoreUtils } from '@providers/utils/utils';
|
||||||
import { CoreSitePluginsPluginContentComponent } from '../../components/plugin-content/plugin-content';
|
import { CoreSitePluginsPluginContentComponent } from '../../components/plugin-content/plugin-content';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,6 +36,7 @@ export class CoreSitePluginsPluginPage {
|
||||||
initResult: any;
|
initResult: any;
|
||||||
jsData: any; // JS variables to pass to the plugin so they can be used in the template or JS.
|
jsData: any; // JS variables to pass to the plugin so they can be used in the template or JS.
|
||||||
preSets: any; // The preSets for the WS call.
|
preSets: any; // The preSets for the WS call.
|
||||||
|
ptrEnabled: boolean;
|
||||||
|
|
||||||
constructor(params: NavParams) {
|
constructor(params: NavParams) {
|
||||||
this.title = params.get('title');
|
this.title = params.get('title');
|
||||||
|
@ -44,6 +46,7 @@ export class CoreSitePluginsPluginPage {
|
||||||
this.initResult = params.get('initResult');
|
this.initResult = params.get('initResult');
|
||||||
this.jsData = params.get('jsData');
|
this.jsData = params.get('jsData');
|
||||||
this.preSets = params.get('preSets');
|
this.preSets = params.get('preSets');
|
||||||
|
this.ptrEnabled = !CoreUtils.instance.isFalseOrZero(params.get('ptrEnabled'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue