Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions upgrade.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ information provided here is intended especially for developers.

* The function $mmaModBook#getChapterContent now requires to receive the result of $mmaModBook#getContentsMap instead of module.contents.
* The events obtained using $mmaMessages#getDiscussionEventName are deprecated. Now you should just use the event mmaMessagesNewMessageEvent and you will receive the site ID and user ID as parameters.
* Directive "mm-browser" has been renamed to "mm-link" to be more coherent with its functionality.

=== 2.9 ===

Expand Down
4 changes: 2 additions & 2 deletions www/addons/mod_assign/templates/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<ion-view>
<ion-nav-title><mm-format-text watch="true">{{ title }}</mm-format-text></ion-nav-title>
<ion-nav-buttons side="secondary">
<a class="button button-icon ion-ios-browsers-outline" ng-href="{{assignurl}}" mm-browser></a>
<a class="button button-icon ion-ios-browsers-outline" ng-href="{{assignurl}}" mm-link></a>
</ion-nav-buttons>
<ion-content padding="true" mm-state-class>
<ion-refresher pulling-text="{{ 'mm.core.pulltorefresh' | translate }}" ng-if="assignmentLoaded" on-refresh="refreshAssignment()"></ion-refresher>
Expand Down Expand Up @@ -41,7 +41,7 @@ <h2>{{ 'mma.mod_assign.cutoffdate' | translate }}</h2>
</div>
</div>
<div ng-if="assign && !canviewsubmissions">
<a class="button button-block" ng-href="{{assignurl}}" mm-browser>{{ 'mma.mod_assign.addsubmission' | translate }}</a>
<a class="button button-block" ng-href="{{assignurl}}" mm-link>{{ 'mma.mod_assign.addsubmission' | translate }}</a>
</div>
</mm-loading>
</ion-content>
Expand Down
2 changes: 1 addition & 1 deletion www/addons/mod_book/templates/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<ion-view>
<ion-nav-title><mm-format-text watch="true">{{ title }}</mm-format-text></ion-nav-title>
<ion-nav-buttons side="secondary">
<a ng-href="{{externalUrl}}" class="button button-icon ion-ios-browsers-outline" mm-browser></a>
<a ng-href="{{externalUrl}}" class="button button-icon ion-ios-browsers-outline" mm-link></a>
<button class="button button-icon ion-more" ng-click="popover.show($event)">
</button>
</div>
Expand Down
2 changes: 1 addition & 1 deletion www/addons/mod_chat/templates/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<ion-view>
<ion-nav-title><mm-format-text watch="true">{{ title }}</mm-format-text></ion-nav-title>
<ion-nav-buttons side="secondary">
<a class="button button-icon ion-ios-browsers-outline" ng-href="{{moduleurl}}" mm-browser ></a>
<a class="button button-icon ion-ios-browsers-outline" ng-href="{{moduleurl}}" mm-link ></a>
</ion-nav-buttons>

<ion-content padding="true" mm-state-class>
Expand Down
2 changes: 1 addition & 1 deletion www/addons/mod_choice/templates/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<ion-view>
<ion-nav-title><mm-format-text watch="true">{{ title }}</mm-format-text></ion-nav-title>
<ion-nav-buttons side="secondary">
<a class="button button-icon ion-ios-browsers-outline" ng-href="{{moduleurl}}" mm-browser ></a>
<a class="button button-icon ion-ios-browsers-outline" ng-href="{{moduleurl}}" mm-link ></a>
</ion-nav-buttons>
<ion-content mm-state-class>
<ion-refresher pulling-text="{{ 'mm.core.pulltorefresh' | translate }}" ng-if="choiceLoaded" on-refresh="refreshChoice()"></ion-refresher>
Expand Down
2 changes: 1 addition & 1 deletion www/addons/mod_folder/templates/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<ion-view>
<ion-nav-title><mm-format-text watch="true">{{ title }}</mm-format-text></ion-nav-title>
<ion-nav-buttons side="secondary">
<a ng-if="moduleurl" class="button button-icon ion-ios-browsers-outline" ng-href="{{moduleurl}}" mm-browser ></a>
<a ng-if="moduleurl" class="button button-icon ion-ios-browsers-outline" ng-href="{{moduleurl}}" mm-link ></a>
</ion-nav-buttons>
<ion-content padding="true" mm-state-class>
<ion-refresher pulling-text="{{ 'mm.core.pulltorefresh' | translate }}" ng-if="canReload" on-refresh="refreshFolder()"></ion-refresher>
Expand Down
2 changes: 1 addition & 1 deletion www/addons/mod_forum/templates/discussions.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<ion-view>
<ion-nav-title><mm-format-text watch="true">{{ title }}</mm-format-text></ion-nav-title>
<ion-nav-buttons side="secondary">
<a class="button button-icon ion-ios-browsers-outline" ng-href="{{moduleurl}}" mm-browser aria-label="{{ 'mm.core.openinbrowser' | translate }}"></a>
<a class="button button-icon ion-ios-browsers-outline" ng-href="{{moduleurl}}" mm-link aria-label="{{ 'mm.core.openinbrowser' | translate }}"></a>
</ion-nav-buttons>
<mm-split-view load-when="discussionsLoaded" component="mmaModForumDiscussionsList">
<ion-content delegate-handle="mmaModForumDiscussionsScroll" mm-state-class>
Expand Down
2 changes: 1 addition & 1 deletion www/addons/mod_glossary/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<ion-nav-title><mm-format-text watch="true">{{ title }}</mm-format-text></ion-nav-title>
<ion-nav-buttons side="secondary">
<button class="button button-icon ion-funnel" ng-click="pickMode($event)" aria-label="{{ 'mma.mod_glossary.browsemode' | translate }}"></button>
<a ng-href="{{externalUrl}}" class="button button-icon ion-ios-browsers-outline" mm-browser></a>
<a ng-href="{{externalUrl}}" class="button button-icon ion-ios-browsers-outline" mm-link></a>
</ion-nav-buttons>

<mm-split-view load-when="loaded" component="mmaModGlossaryEntryList">
Expand Down
2 changes: 1 addition & 1 deletion www/addons/mod_imscp/templates/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<ion-view>
<ion-nav-title><mm-format-text watch="true">{{ title }}</mm-format-text></ion-nav-title>
<ion-nav-buttons side="secondary">
<a ng-href="{{externalUrl}}" class="button button-icon ion-ios-browsers-outline" mm-browser></a>
<a ng-href="{{externalUrl}}" class="button button-icon ion-ios-browsers-outline" mm-link></a>
<button class="button button-icon ion-more" ng-click="popover.show($event)">
</button>
</ion-nav-buttons>
Expand Down
2 changes: 1 addition & 1 deletion www/addons/mod_page/templates/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<ion-view>
<ion-nav-title><mm-format-text watch="true">{{ title }}</mm-format-text></ion-nav-title>
<ion-nav-buttons side="secondary">
<a ng-href="{{externalUrl}}" class="button button-icon ion-ios-browsers-outline" mm-browser></a>
<a ng-href="{{externalUrl}}" class="button button-icon ion-ios-browsers-outline" mm-link></a>
</ion-nav-buttons>
<ion-content padding="true" mm-state-class>
<ion-refresher pulling-text="{{ 'mm.core.pulltorefresh' | translate }}" on-refresh="doRefresh()" ng-if="loaded"></ion-refresher>
Expand Down
2 changes: 1 addition & 1 deletion www/addons/mod_resource/directives/html_link.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ angular.module('mm.addons.mod_resource')
.directive('mmaModResourceHtmlLink', function() {
return {
restrict: 'A',
priority: 99, // Must be lower than mm-browser, or anything listening for a click event.
priority: 99, // Must be lower than mm-link, or anything listening for a click event.
link: function(scope, element, attrs) {
element.on('click', function(event) {
var href = element[0].getAttribute('data-href');
Expand Down
2 changes: 1 addition & 1 deletion www/addons/mod_resource/templates/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<ion-view>
<ion-nav-title><mm-format-text watch="true">{{ title }}</mm-format-text></ion-nav-title>
<ion-nav-buttons side="secondary">
<a ng-href="{{externalUrl}}" class="button button-icon ion-ios-browsers-outline" mm-browser></a>
<a ng-href="{{externalUrl}}" class="button button-icon ion-ios-browsers-outline" mm-link></a>
</ion-nav-buttons>
<ion-content padding="true" mm-state-class>
<ion-refresher pulling-text="{{ 'mm.core.pulltorefresh' | translate }}" on-refresh="doRefresh()" ng-if="loaded"></ion-refresher>
Expand Down
4 changes: 2 additions & 2 deletions www/addons/mod_scorm/templates/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<ion-view>
<ion-nav-title><mm-format-text watch="true">{{ title }}</mm-format-text></ion-nav-title>
<ion-nav-buttons side="secondary">
<a class="button button-icon ion-ios-browsers-outline" ng-href="{{moduleUrl}}" mm-browser aria-label="{{ 'mm.core.openinbrowser' | translate }}"></a>
<a class="button button-icon ion-ios-browsers-outline" ng-href="{{moduleUrl}}" mm-link aria-label="{{ 'mm.core.openinbrowser' | translate }}"></a>
</ion-nav-buttons>
<ion-content padding="true" delegate-handle="mmaModScormIndexScroll" mm-state-class>
<ion-refresher pulling-text="{{ 'mm.core.pulltorefresh' | translate }}" ng-if="scormLoaded" on-refresh="refreshScorm()">
Expand Down Expand Up @@ -81,7 +81,7 @@
<!-- Open in browser button -->
<div class="card padding" ng-if="errorMessage">
<p class="mma-mod-scorm-warning">{{ errorMessage | translate }}</strong></p>
<a class="button button-block" ng-href="{{moduleUrl}}" mm-browser>{{ 'mm.core.openinbrowser' | translate }}</a>
<a class="button button-block" ng-href="{{moduleUrl}}" mm-link>{{ 'mm.core.openinbrowser' | translate }}</a>
</div>
<!-- Warning that you don't have any more attempts -->
<div class="card padding" ng-if="!errorMessage && scorm.attemptsLeft <= 0">
Expand Down
4 changes: 2 additions & 2 deletions www/addons/mod_survey/templates/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<ion-view>
<ion-nav-title><mm-format-text watch="true">{{ title }}</mm-format-text></ion-nav-title>
<ion-nav-buttons side="secondary">
<a class="button button-icon ion-ios-browsers-outline" ng-href="{{moduleurl}}" mm-browser ></a>
<a class="button button-icon ion-ios-browsers-outline" ng-href="{{moduleurl}}" mm-link ></a>
</ion-nav-buttons>
<ion-content delegate-handle="mmaModSurveyScroll" mm-state-class>
<ion-refresher pulling-text="{{ 'mm.core.pulltorefresh' | translate }}" ng-if="surveyLoaded" on-refresh="refreshSurvey()"></ion-refresher>
Expand All @@ -11,7 +11,7 @@
<!-- Survey already done -->
<section class="card padding" ng-if="survey.surveydone">
<p class="padding">{{ 'mma.mod_survey.surveycompletednograph' | translate }}</p>
<a class="button button-block" ng-href="{{moduleurl}}" mm-browser>{{ 'mma.mod_survey.results' | translate }}</a>
<a class="button button-block" ng-href="{{moduleurl}}" mm-link>{{ 'mma.mod_survey.results' | translate }}</a>
</section>

<!-- Survey questions -->
Expand Down
2 changes: 1 addition & 1 deletion www/core/components/course/templates/modcontent.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ <h2 class="item-body">{{ 'mm.course.whoops' | translate }}</h2>
<p ng-if="url" class="item-body">{{ 'mm.course.activitynotyetviewablegothere' | translate }}</p>
<p ng-if="!url" class="item-body">{{ 'mm.course.activitynotyetviewable' | translate }}</p>
</div>
<a ng-if="url" href="{{ url }}" mm-browser class="button button-block"><i class="icon ion-ios-browsers-outline"></i> {{ 'mm.course.gotothesite' | translate }}</a>
<a ng-if="url" href="{{ url }}" mm-link class="button button-block"><i class="icon ion-ios-browsers-outline"></i> {{ 'mm.course.gotothesite' | translate }}</a>
</ion-content>
</ion-view>
4 changes: 2 additions & 2 deletions www/core/components/settings/templates/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ <h2>{{appname}}</h2>
</li>
<li class="item item-text-wrap">
<h2>Apache 2.0</h2>
<p><a href="http://www.apache.org/licenses/LICENSE-2.0" mm-browser>http://www.apache.org/licenses/LICENSE-2.0</a></p>
<p><a href="http://www.apache.org/licenses/LICENSE-2.0" mm-link>http://www.apache.org/licenses/LICENSE-2.0</a></p>
</li>
<li class="item item-divider">
<p>{{ 'mm.settings.deviceinfo' | translate }}</p>
Expand All @@ -24,7 +24,7 @@ <h2>Apache 2.0</h2>
</li>
<li class="item item-text-wrap" ng-if="filesystemroot">
<p class="item-heading">{{ 'mm.settings.filesystemroot' | translate}}</p>
<a ng-if="fsclickable" ng-href="{{filesystemroot}}" mm-browser>{{ filesystemroot }}</a>
<a ng-if="fsclickable" ng-href="{{filesystemroot}}" mm-link>{{ filesystemroot }}</a>
<p ng-if="!fsclickable">{{ filesystemroot }}</p>
</li>
<li class="item item-text-wrap" ng-if="navigator && navigator.userAgent">
Expand Down
4 changes: 2 additions & 2 deletions www/core/components/sidemenu/templates/menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ <h2>{{siteinfo.fullname}}</h2>
</a>
</li>
<li>
<a menu-close class="item item-icon-left" ng-href="{{siteinfo.siteurl}}" mm-browser title="{{ 'mm.sidemenu.website' | translate}}">
<a menu-close class="item item-icon-left" ng-href="{{siteinfo.siteurl}}" mm-link title="{{ 'mm.sidemenu.website' | translate}}">
<i class="icon ion-earth"></i>{{ 'mm.sidemenu.website' | translate}}
</a>
</li>
<li>
<a menu-close class="item item-icon-left" ng-href="{{docsurl}}" mm-browser title="{{ 'mm.sidemenu.help' | translate}}">
<a menu-close class="item item-icon-left" ng-href="{{docsurl}}" mm-link title="{{ 'mm.sidemenu.help' | translate}}">
<i class="icon ion-help-buoy"></i>{{ 'mm.sidemenu.help' | translate}}
</a>
</li>
Expand Down
12 changes: 6 additions & 6 deletions www/core/components/user/templates/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,34 @@ <h2>{{ 'mm.user.contact' | translate}}</h2>
<div class="item" ng-if="user.email">
<p class="item-heading">{{ 'mm.user.email' | translate}}</p>
<p>
<a href="mailto:{{user.email}}" mm-browser>
<a href="mailto:{{user.email}}" mm-link>
<mm-format-text watch="true" clean="true">{{user.email}}</mm-format-text>
</a>
</p>
</div>
<div class="item" ng-if="user.phone1">
<p class="item-heading">{{ 'mm.user.phone1' | translate}}</p>
<p>
<a href="tel:{{user.phone1}}" mm-browser>
<a href="tel:{{user.phone1}}" mm-link>
<mm-format-text watch="true" clean="true">{{user.phone1}}</mm-format-text>
</a>
</p>
</div>
<div class="item" ng-if="user.phone2">
<p class="item-heading">{{ 'mm.user.phone2' | translate}}</p>
<p>
<a href="tel:{{user.phone2}}" mm-browser>
<a href="tel:{{user.phone2}}" mm-link>
<mm-format-text watch="true" clean="true">{{user.phone2}}</mm-format-text>
</a>
</p>
</div>
<div class="item" ng-if="user.address">
<p class="item-heading">{{ 'mm.user.address' | translate}}</p>
<p>
<a ng-if="isAndroid" href="geo:0,0?q={{user.encodedAddress}}" mm-browser>
<a ng-if="isAndroid" href="geo:0,0?q={{user.encodedAddress}}" mm-link>
<mm-format-text watch="true" clean="true">{{user.address}}</mm-format-text>
</a>
<a ng-if="!isAndroid" href="http://maps.google.com?q={{user.encodedAddress}}" mm-browser>
<a ng-if="!isAndroid" href="http://maps.google.com?q={{user.encodedAddress}}" mm-link>
<mm-format-text watch="true" clean="true">{{user.address}}</mm-format-text>
</a>
</p>
Expand All @@ -65,7 +65,7 @@ <h2>{{ 'mm.user.details' | translate}}</h2>
<div class="item" ng-if="user.url">
<p class="item-heading">{{ 'mm.user.webpage' | translate}}</p>
<p>
<a href="{{user.url}}" mm-browser>
<a href="{{user.url}}" mm-link>
<mm-format-text watch="true" clean="true">{{user.url}}</mm-format-text>
</a>
</p>
Expand Down
4 changes: 2 additions & 2 deletions www/core/directives/formattext.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,9 @@ angular.module('mm.core')
dom = angular.element('<div>').html(formatted); // Convert the content into DOM.

// Walk through the content to find the links and add our directive to it.
// Important: We need to look for links first because in 'img' we add new links without mm-browser.
// Important: We need to look for links first because in 'img' we add new links without mm-link.
angular.forEach(dom.find('a'), function(anchor) {
anchor.setAttribute('mm-browser', '');
anchor.setAttribute('mm-link', '');
anchor.setAttribute('capture-link', true);
addExternalContent(anchor, component, componentId, siteId);
});
Expand Down
21 changes: 15 additions & 6 deletions www/core/directives/browser.js → www/core/directives/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,32 @@ angular.module('mm.core')
*
* @module mm.core
* @ngdoc directive
* @name mmBrowser
* @name mmLink
*
* @param {Boolean} [captureLink=false] If the link needs to be captured by the app.
*/
.directive('mmBrowser', function($mmUtil, $mmContentLinksHelper) {
.directive('mmLink', function($mmUtil, $mmContentLinksHelper, $location) {

/**
* Convenience function to open file or url in the browser.
* Convenience function to correctly navigate, open file or url in the browser.
*
* @param {String} href HREF to be opened
*/
function openInBrowser(href) {
function navigate(href) {
if (href.indexOf('cdvfile://') === 0 || href.indexOf('file://') === 0) {
// We have a local file.
$mmUtil.openFile(href).catch(function(error) {
$mmUtil.showErrorModal(error);
});
} else if (href.charAt(0) == '#'){
href = href.substr(1);
// In site links
if (href.charAt(0) == '/') {
$location.url(href);
} else {
// Look for id or name
$mmUtil.scrollToElement(document, "#" + href + ", [name='" + href + "']");
}
} else {
// It's an external link, we will open with browser.
$mmUtil.openInBrowser(href);
Expand All @@ -55,11 +64,11 @@ angular.module('mm.core')
if (attrs.captureLink && attrs.captureLink !== 'false') {
$mmContentLinksHelper.handleLink(href).then(function(treated) {
if (!treated) {
openInBrowser(href);
navigate(href);
}
});
} else {
openInBrowser(href);
navigate(href);
}
}
});
Expand Down
2 changes: 1 addition & 1 deletion www/core/lib/sitesmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ angular.module('mm.core')
*/
function validateSiteInfo(infos) {
if (!infos.firstname || !infos.lastname) {
var moodleLink = '<a mm-browser href="' + infos.siteurl + '">' + infos.siteurl + '</a>';
var moodleLink = '<a mm-link href="' + infos.siteurl + '">' + infos.siteurl + '</a>';
return {error: 'mm.core.requireduserdatamissing', params: {'$a': moodleLink}};
}
return true;
Expand Down
Loading