......@@ -3,7 +3,7 @@
var module = angular.module('profile-admin.services', ['ngResource']);
module.factory('UserProfile', function($resource){
return $resource('/api/profile/:userId', {}, {
return $resource(BASE_API_URL + '/profile/:userId', {}, {
});
});
......
......@@ -180,7 +180,7 @@
};
$scope.getUsers = function(val) {
return $http.get('/api/user_search', {
return $http.get(BASE_API_URL + '/user_search', {
params: {
name: val,
sensor: false
......
......@@ -5,13 +5,13 @@
var module = angular.module('users-admin.services', ['ngResource']);
module.factory('UserAdmin', function($resource){
return $resource('/api/user_admin/:user_id', {}, {
return $resource(BASE_API_URL + '/user_admin/:user_id', {}, {
update: {method: 'PUT'}
});
});
module.factory('GroupAdmin', function($resource){
return $resource('/api/group_admin/:id', {}, {
return $resource(BASE_API_URL + '/group_admin/:id', {}, {
update: {method: 'PUT'}
});
});
......
......@@ -86,7 +86,7 @@
*/
app.factory('CourseProfessor', ['$resource', function($resource) {
return $resource('/api/course_professor/:id', {'id':'@id'}, {
return $resource(BASE_API_URL + '/course_professor/:id', {'id':'@id'}, {
'update': {
'method': 'PUT'
}
......@@ -100,7 +100,7 @@
*/
app.factory('CourseAuthor', ['$resource', function($resource) {
return $resource('/api/course_author/:id', {'id':'@id'}, {
return $resource(BASE_API_URL + '/course_author/:id', {'id':'@id'}, {
'update': {
'method': 'PUT'
}
......@@ -112,7 +112,7 @@
* Provide a Course class.
*/
app.factory('Course', ['$resource', function($resource) {
var Course = $resource('/api/course/:id', {'id':'@id'});
var Course = $resource(BASE_API_URL + '/course/:id', {'id':'@id'});
Course.prototype.isDraft = function() { return this.status === 'draft'; };
Course.prototype.isListed = function() { return this.status === 'listed'; };
......@@ -153,7 +153,7 @@
'method': 'PUT'
}
};
var Professor = $resource('/api/user/:id', {'id':'@id'}, resourceConfig);
var Professor = $resource(BASE_API_URL + '/user/:id', {'id':'@id'}, resourceConfig);
Professor.prototype.getName = function() {
var name = this.name;
if(!name && (this.first_name || this.last_name)) {
......@@ -172,7 +172,7 @@
var resourceConfig = {
'update': {'method': 'PUT'}
};
var Lesson = $resource('/api/lessons/:id', {'id':'@id'}, resourceConfig);
var Lesson = $resource(BASE_API_URL + '/lessons/:id', {'id':'@id'}, resourceConfig);
Lesson.prototype.countVideos = function() {
return (this.units || []).reduce(function(c, u){
return u.video ? c + 1 : c;
......@@ -190,19 +190,19 @@
}]);
app.factory('CourseStudent', function($resource){
return $resource('/api/course_student/:id',
return $resource(BASE_API_URL + '/course_student/:id',
{'id' : '@id'},
{'update': {'method': 'PUT'} });
});
app.factory('CertificationProcess', function($resource){
return $resource('/api/certification_process/:certificateId',
return $resource(BASE_API_URL + '/certification_process/:certificateId',
{'certificateId' : '@id'},
{'update': {'method': 'PUT'} });
});
app.factory('CourseCertification', function($resource){
return $resource('/api/course_certification/:link_hash',
return $resource(BASE_API_URL + '/course_certification/:link_hash',
{'link_hash' : '@id' },
{'update': {method: 'PUT'}
});
......@@ -212,13 +212,13 @@
* Basic model class to Evaluation
*/
app.factory('Evaluation', function($resource){
return $resource('/api/evaluation/:id', {'id' : '@id'}, {
return $resource(BASE_API_URL + '/evaluation/:id', {'id' : '@id'}, {
'update': {'method': 'PUT'}
});
});
app.factory('CertificateTemplate', function($resource){
return $resource('/api/certificate_template/:course', {}, {
return $resource(BASE_API_URL + '/certificate_template/:course', {}, {
'update' : {'method' : 'PUT'},
});
});
......@@ -229,7 +229,7 @@
*/
app.factory('StudentSearch', ['$http', function($http){
return function(val, course_id) {
return $http.get('/api/student_search', {
return $http.get(BASE_API_URL + '/student_search', {
params: {
name: val,
course: course_id,
......@@ -258,7 +258,7 @@
app.factory('Class', function($resource){
return $resource('/api/course_classes/:id', {'id' : '@id'}, {
return $resource(BASE_API_URL + '/course_classes/:id', {'id' : '@id'}, {
'update': {'method': 'PUT'}
});
});
......
......@@ -4,24 +4,24 @@
var app = angular.module('core.services', []);
app.factory('Course', function($resource){
return $resource('/api/course/:courseId', {}, {
return $resource(BASE_API_URL + '/course/:courseId', {}, {
update: {method: 'PUT'}
});
});
app.factory('CarouselCourse', function($resource){
return $resource('/api/course_carousel/:courseId', {}, {
return $resource(BASE_API_URL + '/course_carousel/:courseId', {}, {
});
});
app.factory('FlatPage', function($resource){
return $resource('/api/flatpage/:flatpageId', {}, {
return $resource(BASE_API_URL + '/flatpage/:flatpageId', {}, {
update: {method: 'PUT'}
});
});
app.factory('Twitter', function($resource){
return $resource('/api/twitter/', {}, {
return $resource(BASE_API_URL + '/twitter/', {}, {
});
});
......
......@@ -6,15 +6,15 @@
angular.module('courseMaterial.services', ['ngRoute', 'ngResource']).
factory('CourseMaterial', function($resource){
return $resource('/api/course_material/:course/', {}, {
return $resource(BASE_API_URL + '/course_material/:course/', {}, {
update: {method: 'PUT'}
});
}).
factory('CourseMaterialFile', function($resource){
return $resource('/api/course_material_file/:id/', {}, {
return $resource(BASE_API_URL + '/course_material_file/:id/', {}, {
});
}).
factory('Course', function($resource){
return $resource('/api/course/:id');
return $resource(BASE_API_URL + '/course/:id');
});
})(angular);
......@@ -4,13 +4,13 @@
var app = angular.module('lesson.services', []);
app.factory('Answer', function($resource){
return $resource('/api/answer/:activityId', {}, {
return $resource(BASE_API_URL + '/answer/:activityId', {}, {
update: {method: 'PUT'}
});
});
app.factory('Progress', ['$resource', function($resource){
var Progress = $resource('/api/student_progress/:unit', {}, {
var Progress = $resource(BASE_API_URL + '/student_progress/:unit', {}, {
'update': { method:'PUT' }
});
......@@ -23,11 +23,11 @@
}]);
app.factory('Lesson', ['$resource', function($resource){
return $resource('/api/lessons/:id/');
return $resource(BASE_API_URL + '/lessons/:id/');
}]);
app.factory('Unit', ['$resource', function($resource){
return $resource('/api/unit/:id/');
return $resource(BASE_API_URL + '/unit/:id/');
}]);
/**
......@@ -36,7 +36,7 @@
*/
app.factory('SimpleLesson', ['$resource', function($resource){
var resourceConfig = {};
var SimpleLesson = $resource('/api/simple_lessons/:id', {'id':'@id'}, resourceConfig);
var SimpleLesson = $resource(BASE_API_URL + '/simple_lessons/:id', {'id':'@id'}, resourceConfig);
return SimpleLesson;
}]);
......@@ -68,15 +68,15 @@
]);
app.factory('Student', function($resource) {
return $resource('/api/course_student/', {}, {});
return $resource(BASE_API_URL + '/course_student/', {}, {});
});
app.factory('CourseCertification', function($resource) {
return $resource('/api/course_certification/', {}, {});
return $resource(BASE_API_URL + '/course_certification/', {}, {});
});
app.factory('ClassActivity', function($resource) {
return $resource('/api/course_class_activities/', {}, {});
return $resource(BASE_API_URL + '/course_class_activities/', {}, {});
});
app.factory('resolveActivityTemplate', ['STATIC_URL', function(STATIC_URL) {
......
......@@ -4,7 +4,7 @@
var module = angular.module('main-nav.services', ['ngRoute', 'ngResource']);
module.factory('Message', function($resource){
return $resource('/api/professor_message/:messageId', {}, {
return $resource(BASE_API_URL + '/professor_message/:messageId', {}, {
});
});
......
(function (angular) {
'use strict';
// Declare app level module which depends on filters, and services
angular.module('markdown', ['markdown.filters']);
})(angular);
(function (angular, Markdown) {
'use strict';
angular.module('markdown.directives', []).
directive('markdowneditor', function(){
return {
"restrict": 'A',
"controller": ['$scope', '$element', function($scope, $element) {
$element.find('textarea').attr('id', "wmd-input");
$element.find('.js-button-bar').attr('id', "wmd-button-bar");
var editor = new Markdown.Editor(Markdown.getSanitizingConverter());
editor.run();
}],
"link": function(scope, element) {
var read = function read(evt){
scope.new_text = evt.currentTarget.value;
};
element.find('textarea').on('blur change', read);
}
};
});
})(angular, Markdown);
(function (angular, Markdown) {
'use strict';
angular.module('markdown.filters', ["ngSanitize"]).
filter('markdown', ['$window', function($window) {
return function(text) {
return text ? Markdown.getSanitizingConverter().makeHtml(text) : "";
};
}]);
})(angular, Markdown);
......@@ -4,17 +4,17 @@
/* Services */
angular.module('notes.services', ['ngResource']).
factory('Note', function($resource){
return $resource('/api/note/:note_id', {}, {
return $resource(BASE_API_URL + '/note/:note_id', {}, {
update: {method: 'PUT'},
get: {method: 'GET', isArray: true}
});
}).
factory('CourseUserNotes', function($resource){
return $resource('/api/user_notes/:course_slug', {}, {
return $resource(BASE_API_URL + '/user_notes/:course_slug', {}, {
});
}).
factory('UserNotes', function($resource){
return $resource('/api/user_notes/', {}, {
return $resource(BASE_API_URL + '/user_notes/', {}, {
});
});
})(angular);
This diff is collapsed.
This diff is collapsed.
(function () {
var output, Converter;
if (typeof exports === "object" && typeof require === "function") { // we're in a CommonJS (e.g. Node.js) module
output = exports;
Converter = require("./Markdown.Converter").Converter;
} else {
output = window.Markdown;
Converter = output.Converter;
}
output.getSanitizingConverter = function () {
var converter = new Converter();
converter.hooks.chain("postConversion", sanitizeHtml);
converter.hooks.chain("postConversion", balanceTags);
return converter;
};
function sanitizeHtml(html) {
return html.replace(/<[^>]*>?/gi, sanitizeTag);
}
// (tags that can be opened/closed) | (tags that stand alone)
var basic_tag_whitelist = /^(<\/?(b|blockquote|code|del|dd|dl|dt|em|h1|h2|h3|i|kbd|li|ol|p|s|sup|sub|strong|strike|ul)>|<(br|hr)\s?\/?>)$/i;
// <a href="url..." optional title>|</a>
var a_white = /^(<a\shref="(https?:(\/\/|\/)|ftp:(\/\/|\/)|mailto:|magnet:)[-A-Za-z0-9+&@#\/%?=~_|!:,.;\(\)]+"(\stitle="[^"<>]+")+"(\starget="[^"<>]+")?\s?>|<\/a>)$/i;
// <img src="url..." optional width optional height optional alt optional title
var img_white = /^(<img\ssrc="(https?:\/\/|\/)[-A-Za-z0-9+&@#\/%?=~_|!:,.;\(\)]+"(\swidth="\d{1,3}")?(\sheight="\d{1,3}")?(\salt="[^"<>]*")?(\stitle="[^"<>]*")?\s?\/?>)$/i;
// <pre optional class="prettyprint linenums">|</pre> for twitter bootstrap
var pre_white = /^(<pre(\sclass="prettyprint linenums")?>|<\/pre>)$/i;
function sanitizeTag(tag) {
if (tag.match(basic_tag_whitelist) || tag.match(a_white) || tag.match(img_white) || tag.match(pre_white))
return tag;
else
return "";
}
/// <summary>
/// attempt to balance HTML tags in the html string
/// by removing any unmatched opening or closing tags
/// IMPORTANT: we *assume* HTML has *already* been
/// sanitized and is safe/sane before balancing!
///
/// adapted from CODESNIPPET: A8591DBA-D1D3-11DE-947C-BA5556D89593
/// </summary>
function balanceTags(html) {
if (html == "")
return "";
var re = /<\/?\w+[^>]*(\s|$|>)/g;
// convert everything to lower case; this makes
// our case insensitive comparisons easier
var tags = html.toLowerCase().match(re);
// no HTML tags present? nothing to do; exit now
var tagcount = (tags || []).length;
if (tagcount == 0)
return html;
var tagname, tag;
var ignoredtags = "<p><img><br><li><hr>";
var match;
var tagpaired = [];
var tagremove = [];
var needsRemoval = false;
// loop through matched tags in forward order
for (var ctag = 0; ctag < tagcount; ctag++) {
tagname = tags[ctag].replace(/<\/?(\w+).*/, "$1");
// skip any already paired tags
// and skip tags in our ignore list; assume they're self-closed
if (tagpaired[ctag] || ignoredtags.search("<" + tagname + ">") > -1)
continue;
tag = tags[ctag];
match = -1;
if (!/^<\//.test(tag)) {
// this is an opening tag
// search forwards (next tags), look for closing tags
for (var ntag = ctag + 1; ntag < tagcount; ntag++) {
if (!tagpaired[ntag] && tags[ntag] == "</" + tagname + ">") {
match = ntag;
break;
}
}
}
if (match == -1)
needsRemoval = tagremove[ctag] = true; // mark for removal
else
tagpaired[match] = true; // mark paired
}
if (!needsRemoval)
return html;
// delete all orphaned tags from the string
var ctag = 0;
html = html.replace(re, function (match) {
var res = tagremove[ctag] ? "" : match;
ctag++;
return res;
});
return html;
}
})();
......@@ -3,7 +3,7 @@
var module = angular.module('profile.services', ['ngResource']);
module.factory('UserProfile', function($resource){
return $resource('/api/profile/:userId', {}, {
return $resource(BASE_API_URL + '/profile/:userId', {}, {
});
});
......
......@@ -4,13 +4,13 @@
/* Services */
angular.module('reports.services', ['ngResource']).
factory('CourseUserReport', function($resource){
return $resource('/api/reports', {}, {
return $resource(BASE_API_URL + '/reports', {}, {
});
}).factory('LessonsUserProgress', function($resource){
return $resource('/api/lessons_user_progress/:courseId', {}, {
return $resource(BASE_API_URL + '/lessons_user_progress/:courseId', {}, {
});
}).factory('CourseStats', function($resource){
return $resource('/api/course_stats/:courseId', {}, {
return $resource(BASE_API_URL + '/course_stats/:courseId', {}, {
});
}).factory('GeneralSummary', function($resource){
return $resource('/paralapraca/api/summary', {}, {
......
......@@ -5,8 +5,8 @@
<div class="row">
{% if course_intro_admin %}
<div class="col-md-8">
<div class="help-text"><i class="fa fa-caret-down" aria-hidden="true"></i> Edite abaixo o nome e o link do módulo</div>
<div class="editable-title"><input type="text" ng-model="course.name" placeholder="{% trans 'Course name' %}"></div>
<div class="help-text"><i class="fa fa-caret-down" aria-hidden="true"></i> Edite abaixo o nome e o link do curso</div>
<div class="editable-title"><input type="text" ng-model="course.name" placeholder="Nome do curso"></div>
<div class="course-slug clearfix">
<label>http://{{ site.domain }}/course/</label>
{% verbatim %}
......@@ -18,8 +18,8 @@
<div class="col-md-8">
<h2 class="course-name">{{ course.name }}</h2>
{% include "_course-details-inline.html" with course=course %}
<div class="editable-title"><input type="text" ng-model="lesson.name" placeholder="Nome do capítulo"></div>
<div class="editable-secondary-title"><input type="text" ng-model="lesson.desc" placeholder="Descrição do capítulo"></div>
<div class="editable-title"><input type="text" ng-model="lesson.name" placeholder="Nome da aula"></div>
<div class="editable-secondary-title"><input type="text" ng-model="lesson.desc" placeholder="Descrição da aula"></div>
<nav class="chapters" ng-show="lesson.name">
<div class="btn-group">
......@@ -43,8 +43,8 @@
class="intro{% if course_intro_admin %} active{% endif %}">{% trans 'Home' %}</a>
<a ng-href="{% url 'courses_legacy:administration.course_material' course.id %}"
class="materials{% if '/material/' in request.path %} active{% endif %}">Menu de<br> referências</a>
<!-- <a ng-href="{% url 'courses_legacy:administration.forum' course.id %}"
class="forum{% if '/forum/' in request.path %} active{% endif %}">{% trans 'Forum' %}</a> -->
{# <a ng-href="{% url 'courses_legacy:administration.forum' course.id %}" #}
{# class="forum{% if '/forum/' in request.path %} active{% endif %}">{% trans 'Forum' %}</a> #}
<div class="dropdown">
<a class="tools course-tools dropdown-toggle{% if '/messages/' in request.path or '/message/' in request.path or '/reports/' in request.path or '/permissions/' in request.path %} active{% endif %}"
data-original-title="{% trans 'Tools' %}"
......