Skip to content

Commit dfdac17

Browse files
committed
MOBILE-1461 wiki: Wiki module added
1 parent 23ef7f4 commit dfdac17

File tree

13 files changed

+1343
-2
lines changed

13 files changed

+1343
-2
lines changed

www/addons/mod_wiki/controllers/index.js

Lines changed: 481 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// (C) Copyright 2015 Martin Dougiamas
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
angular.module('mm.addons.mod_wiki')
16+
17+
/**
18+
* Wiki map controller.
19+
*
20+
* @module mm.addons.mod_wiki
21+
* @ngdoc controller
22+
* @name mmaModWikiMapCtrl
23+
*/
24+
.controller('mmaModWikiMapCtrl', function($scope, $mmEvents, mmaModWikiSubwikiPagesLoaded, $stateParams) {
25+
$scope.map = [];
26+
27+
$scope.constructMap = function(subwikiPages) {
28+
var initialLetter = false,
29+
letter = {};
30+
31+
$scope.map = [];
32+
33+
angular.forEach(subwikiPages, function(page) {
34+
// Should we create a new grouping?
35+
if (page.title.charAt(0).toLocaleUpperCase() !== initialLetter) {
36+
initialLetter = page.title.charAt(0).toLocaleUpperCase();
37+
letter = {label: initialLetter, pages: []};
38+
39+
$scope.map.push(letter);
40+
}
41+
42+
// Add the subwiki to the currently active grouping.
43+
letter.pages.push(page);
44+
});
45+
};
46+
47+
var obsLoaded = $scope.$on(mmaModWikiSubwikiPagesLoaded, function(event, subwikiPages) {
48+
$scope.constructMap(subwikiPages);
49+
});
50+
51+
$scope.constructMap($scope.subwikiPages);
52+
53+
$scope.$on('$destroy', obsLoaded);
54+
});

www/addons/mod_wiki/lang/en.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"errorloadingpage": "An error occured while loading page.",
3+
"errornowikiavailable": "There's no wiki available to be shown.",
4+
"gowikihome": "Go Wiki home",
5+
"map": "Map",
6+
"notingroup": "Not in group",
7+
"subwiki": "Subwiki",
8+
"viewpage": "View page"
9+
}

www/addons/mod_wiki/main.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
// (C) Copyright 2015 Martin Dougiamas
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
angular.module('mm.addons.mod_wiki', [])
16+
17+
.constant('mmaModWikiSubwikiPagesLoaded', 'mma_mod_wiki_subwiki_pages_loaded')
18+
19+
.config(function($stateProvider) {
20+
21+
$stateProvider
22+
23+
.state('site.mod_wiki', {
24+
url: '/mod_wiki',
25+
params: {
26+
module: null,
27+
courseid: null,
28+
pageid: null,
29+
pagetitle: null,
30+
wikiid: null,
31+
subwikiid: null,
32+
action: null
33+
},
34+
views: {
35+
'site': {
36+
controller: 'mmaModWikiIndexCtrl',
37+
templateUrl: 'addons/mod_wiki/templates/index.html'
38+
}
39+
}
40+
});
41+
42+
})
43+
44+
.config(function($mmCourseDelegateProvider, $mmContentLinksDelegateProvider) {
45+
$mmCourseDelegateProvider.registerContentHandler('mmaModWiki', 'wiki', '$mmaModWikiHandlers.courseContent');
46+
$mmContentLinksDelegateProvider.registerLinkHandler('mmaModWiki', '$mmaModWikiHandlers.linksHandler');
47+
})
48+
49+
.run(function($mmEvents, mmCoreEventLogout, $mmaModWiki) {
50+
// Clear cache for SubwikiLists
51+
$mmEvents.on(mmCoreEventLogout, $mmaModWiki.clearSubwikiList);
52+
});
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
$mma-mod-wiki-toc-level-padding: 12px !default;
2+
$mma-mod-wiki-newentry-link-color: red !default;
3+
$mma-mod-wiki-toc-title-color: #666 !default;
4+
$mma-mod-wiki-toc-border-color: #bbb !default;
5+
$mma-mod-wiki-toc-background-color: #eee !default;
6+
7+
.wiki-toc {
8+
border: 1px solid $mma-mod-wiki-toc-border-color;
9+
background: $mma-mod-wiki-toc-background-color;
10+
margin: 16px;
11+
padding: 8px;
12+
}
13+
14+
15+
.wiki-toc-title {
16+
color: $mma-mod-wiki-toc-title-color;
17+
font-size: 1.1em;
18+
font-variant: small-caps;
19+
text-align: center;
20+
}
21+
22+
.wiki-toc-section {
23+
padding: 0;
24+
margin: 2px 8px;
25+
}
26+
27+
.wiki-toc-section-2 {
28+
padding-left: $mma-mod-wiki-toc-level-padding;
29+
}
30+
31+
.wiki-toc-section-3 {
32+
padding-left: $mma-mod-wiki-toc-level-padding * 2;
33+
}
34+
35+
.mm-site_mod_wiki .wiki_newentry {
36+
color: $mma-mod-wiki-newentry-link-color;
37+
font-style: italic;
38+
}
39+
40+
/* Hide edit section links */
41+
a.wiki_edit_section {
42+
display: none;
43+
}
44+
45+
.mma-mod_wiki-subwiki-picker .item-divider {
46+
font-weight: bold;
47+
}

0 commit comments

Comments
 (0)