Merge pull request #1751 from crazyserver/MOBILE-2858

Mobile 2858
main
Juan Leyva 2019-02-05 18:44:45 +01:00 committed by GitHub
commit 1b13ffd444
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 7 deletions

View File

@ -555,6 +555,10 @@ export class CoreCoursesProvider {
* @return {Promise<any>} Promise resolved with administration options for each course. * @return {Promise<any>} Promise resolved with administration options for each course.
*/ */
getUserAdministrationOptions(courseIds: number[], siteId?: string): Promise<any> { getUserAdministrationOptions(courseIds: number[], siteId?: string): Promise<any> {
if (!courseIds || courseIds.length == 0) {
return Promise.resolve({});
}
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
const params = { const params = {
courseids: courseIds courseids: courseIds
@ -597,6 +601,10 @@ export class CoreCoursesProvider {
* @return {Promise<any>} Promise resolved with navigation options for each course. * @return {Promise<any>} Promise resolved with navigation options for each course.
*/ */
getUserNavigationOptions(courseIds: number[], siteId?: string): Promise<any> { getUserNavigationOptions(courseIds: number[], siteId?: string): Promise<any> {
if (!courseIds || courseIds.length == 0) {
return Promise.resolve({});
}
return this.sitesProvider.getSite(siteId).then((site) => { return this.sitesProvider.getSite(siteId).then((site) => {
const params = { const params = {
courseids: courseIds courseids: courseIds

View File

@ -85,6 +85,10 @@ export class CoreGradesHelperProvider {
let content = String(tableRow[name].content); let content = String(tableRow[name].content);
if (name == 'itemname') { if (name == 'itemname') {
row['id'] = parseInt(tableRow[name].id.split('_')[1], 10);
row['colspan'] = tableRow[name].colspan;
row['rowspan'] = (tableRow['leader'] && tableRow['leader'].rowspan) || 1;
this.setRowIcon(row, content); this.setRowIcon(row, content);
row['rowclass'] = tableRow[name].class.indexOf('leveleven') < 0 ? 'odd' : 'even'; row['rowclass'] = tableRow[name].class.indexOf('leveleven') < 0 ? 'odd' : 'even';
row['rowclass'] += tableRow[name].class.indexOf('hidden') >= 0 ? ' hidden' : ''; row['rowclass'] += tableRow[name].class.indexOf('hidden') >= 0 ? ' hidden' : '';
@ -92,10 +96,6 @@ export class CoreGradesHelperProvider {
content = content.replace(/<\/span>/gi, '\n'); content = content.replace(/<\/span>/gi, '\n');
content = this.textUtils.cleanTags(content); content = this.textUtils.cleanTags(content);
row['id'] = parseInt(tableRow[name].id.split('_')[1], 10);
row['colspan'] = tableRow[name].colspan;
row['rowspan'] = (tableRow['leader'] && tableRow['leader'].rowspan) || 1;
name = 'gradeitem'; name = 'gradeitem';
} else { } else {
content = this.textUtils.replaceNewLines(content, '<br>'); content = this.textUtils.replaceNewLines(content, '<br>');
@ -439,9 +439,17 @@ export class CoreGradesHelperProvider {
row['image'] = this.courseProvider.getModuleIconSrc(module[1], row['image'] = this.courseProvider.getModuleIconSrc(module[1],
this.domUtils.convertToElement(text).querySelector('img').getAttribute('src')); this.domUtils.convertToElement(text).querySelector('img').getAttribute('src'));
} }
} else if (text.indexOf('src=') > -1) { } else {
const src = text.match(/src="([^"]*)"/); if (row['rowspan']) {
row['image'] = src[1]; row['itemtype'] = 'category';
row['icon'] = 'fa-folder';
} else if (text.indexOf('src=') > -1) {
const src = text.match(/src="([^"]*)"/);
row['image'] = src[1];
} else if (text.indexOf('<i ') > -1) {
const src = text.match(/class="fa-([^ ]*)"/);
row['icon'] = src[1];
}
} }
return row; return row;