@@ -21,17 +21,14 @@ angular.module('mm.addons.mod_resource')
2121 * @ngdoc controller
2222 * @name mmaModResourceIndexCtrl
2323 */
24- . controller ( 'mmaModResourceIndexCtrl' , function ( $scope , $stateParams , $mmUtil , $mmaModResource , $log , $mmApp , $mmCourse , $timeout ,
25- mmaModResourceComponent ) {
24+ . controller ( 'mmaModResourceIndexCtrl' , function ( $scope , $stateParams , $mmUtil , $mmaModResource , $log , $mmApp , $mmCourse , $timeout ) {
2625 $log = $log . getInstance ( 'mmaModResourceIndexCtrl' ) ;
2726
2827 var module = $stateParams . module || { } ,
2928 courseid = $stateParams . courseid ;
3029
3130 $scope . title = module . name ;
3231 $scope . description = module . description ;
33- $scope . component = mmaModResourceComponent ;
34- $scope . componentId = module . id ;
3532 $scope . externalUrl = module . url ;
3633 $scope . mode = false ;
3734 $scope . loaded = false ;
@@ -59,29 +56,6 @@ angular.module('mm.addons.mod_resource')
5956 $mmaModResource . logView ( module . instance ) . then ( function ( ) {
6057 $mmCourse . checkModuleCompletion ( courseid , module . completionstatus ) ;
6158 } ) ;
62- if ( downloadFailed && $mmApp . isOnline ( ) ) {
63- // We could load the main file but the download failed. Show error message.
64- $mmUtil . showErrorModal ( 'mm.core.errordownloadingsomefiles' , true ) ;
65- }
66- } ) . catch ( function ( ) {
67- $mmUtil . showErrorModal ( 'mma.mod_resource.errorwhileloadingthecontent' , true ) ;
68- } ) . finally ( function ( ) {
69- $scope . loaded = true ;
70- } ) ;
71- } ) ;
72- } else if ( $mmaModResource . isDisplayedInline ( module ) ) {
73- var downloadFailed = false ;
74- return $mmaModResource . downloadAllContent ( module ) . catch ( function ( err ) {
75- // Mark download as failed but go on since the main files could have been downloaded.
76- downloadFailed = true ;
77- } ) . finally ( function ( ) {
78- $mmaModResource . getResourceHtml ( module . contents , module . id ) . then ( function ( content ) {
79- $scope . mode = 'inline' ;
80- $scope . content = content ;
81- $mmaModResource . logView ( module . instance ) . then ( function ( ) {
82- $mmCourse . checkModuleCompletion ( courseid , module . completionstatus ) ;
83- } ) ;
84-
8559 if ( downloadFailed && $mmApp . isOnline ( ) ) {
8660 // We could load the main file but the download failed. Show error message.
8761 $mmUtil . showErrorModal ( 'mm.core.errordownloadingsomefiles' , true ) ;
@@ -119,18 +93,6 @@ angular.module('mm.addons.mod_resource')
11993 }
12094 }
12195
122- // Event sent by the directive mmaModResourceHtmlLink when we click an HTML link.
123- $scope . $on ( 'mmaModResourceHtmlLinkClicked' , function ( e , target ) {
124- $scope . loaded = false ;
125- $mmaModResource . getResourceHtml ( module . contents , module . id , target ) . then ( function ( content ) {
126- $scope . content = content ;
127- } ) . catch ( function ( ) {
128- $mmUtil . showErrorModal ( 'mma.mod_resource.errorwhileloadingthecontent' , true ) ;
129- } ) . finally ( function ( ) {
130- $scope . loaded = true ;
131- } ) ;
132- } ) ;
133-
13496 $scope . doRefresh = function ( ) {
13597 $mmaModResource . invalidateContent ( module . id ) . then ( function ( ) {
13698 return fetchContent ( ) ;
0 commit comments