From 3ea2b24b988016d875d3ebcba5fd319c61db0640 Mon Sep 17 00:00:00 2001 From: Kevin Luo Date: Fri, 26 Jul 2013 03:57:31 -0700 Subject: [PATCH] Add HTML editor for authoring bulk email message (adopted from CMS) --- {cms => common}/static/css/tiny-mce.css | 0 lms/djangoapps/instructor/views/legacy.py | 17 ++++++++++--- lms/envs/common.py | 5 ++++ lms/static/img/problem-editor-icons.png | Bin 0 -> 2307 bytes lms/static/sass/base/_variables.scss | 6 ++++- lms/static/sass/course.scss.mako | 1 + lms/static/sass/course/instructor/_email.scss | 18 +++++++++++++ .../courseware/instructor_dashboard.html | 24 +++++++++++++----- lms/templates/widgets/html-edit.html | 13 ++++++++++ 9 files changed, 73 insertions(+), 11 deletions(-) rename {cms => common}/static/css/tiny-mce.css (100%) create mode 100644 lms/static/img/problem-editor-icons.png create mode 100644 lms/templates/widgets/html-edit.html diff --git a/cms/static/css/tiny-mce.css b/common/static/css/tiny-mce.css similarity index 100% rename from cms/static/css/tiny-mce.css rename to common/static/css/tiny-mce.css diff --git a/lms/djangoapps/instructor/views/legacy.py b/lms/djangoapps/instructor/views/legacy.py index da67444d4a..0aacf516a8 100644 --- a/lms/djangoapps/instructor/views/legacy.py +++ b/lms/djangoapps/instructor/views/legacy.py @@ -23,9 +23,11 @@ from django.core.urlresolvers import reverse from django.core.mail import send_mail from django.utils import timezone +from xmodule_modifiers import wrap_xmodule import xmodule.graders as xmgraders from xmodule.modulestore.django import modulestore from xmodule.modulestore.exceptions import ItemNotFoundError +from xmodule.html_module import HtmlDescriptor from courseware import grades from courseware.access import (has_access, get_access_group_name, @@ -83,7 +85,7 @@ def instructor_dashboard(request, course_id): msg = '' to = None subject = None - html_message = None + html_message = '' problems = [] plots = [] datatable = {} @@ -785,6 +787,13 @@ s (~10k), it may take 1-2 hours to send all emails." else: instructor_tasks = None + # HTML editor for email + if idash_mode == 'Email': + html_module = HtmlDescriptor(course.system, {'data': html_message}) + editor = wrap_xmodule(html_module.get_html, html_module, 'xmodule_edit.html')() + else: + editor = None + # display course stats only if there is no other table to display: course_stats = None if not datatable: @@ -801,9 +810,9 @@ s (~10k), it may take 1-2 hours to send all emails." 'course_stats': course_stats, 'msg': msg, 'modeflag': {idash_mode: 'selectedmode'}, - 'to': to, # email - 'subject': subject, # email - 'message': html_message, # email + 'to': to, # email + 'subject': subject, # email + 'editor': editor, # email 'problems': problems, # psychometrics 'plots': plots, # psychometrics 'course_errors': modulestore().get_item_errors(course.location), diff --git a/lms/envs/common.py b/lms/envs/common.py index bb19a70993..51fba25e69 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -616,6 +616,11 @@ PIPELINE_JS = { 'output_filename': 'js/lms-main_vendor.js', 'test_order': 0, }, + 'module-descriptor-js': { + 'source_filenames': rooted_glob(COMMON_ROOT / 'static/', 'xmodule/descriptors/js/*.js'), + 'output_filename': 'js/lms-module-descriptors.js', + 'test_order': 8, + }, 'module-js': { 'source_filenames': rooted_glob(COMMON_ROOT / 'static', 'xmodule/modules/js/*.js'), 'output_filename': 'js/lms-modules.js', diff --git a/lms/static/img/problem-editor-icons.png b/lms/static/img/problem-editor-icons.png new file mode 100644 index 0000000000000000000000000000000000000000..27eb57b668a182b6a77c2556d2183a96084844a3 GIT binary patch literal 2307 zcmX|B3pmqlA6_a&yhTVwgsEQ1;Y$bl3axCVIj=d)X2WI);4o_l zWD^Wv`R$v*ERjr1!#9BBLo4~KA}pGjQ&3b}|0pFrduDdli9jA1dzPJ72*{p3{?DI3@gBY?XEz+l zXL9OYAAjH?3M&|U7L%A}h4bJvG&VG~);($l_KPUzrpFyYQA}GrIW_k#F!G-Ya_8Rtr{olZ8bF;O zV_;|`la-m8m2c@x42Wa^J|!cU;1|^0`^4PImC4F*zji&6kq{np8>9dhpaG=@M8w*Y ze63wP?1?^%`LFNa z+Q4Z84aU_IF!nCQ*o2glzu3UCvGIf3$pfLTUOwOfK;uYN59$I!B0%FE-Mv5$NH73! z^YZib3v&0q25KgdeSx5nXD#h>gO2$q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d00001 diff --git a/lms/static/sass/base/_variables.scss b/lms/static/sass/base/_variables.scss index 93297f4043..29fab36f1c 100644 --- a/lms/static/sass/base/_variables.scss +++ b/lms/static/sass/base/_variables.scss @@ -41,6 +41,10 @@ $green: rgb(37, 184, 90); $light-gray: #ddd; $dark-gray: #333; +// used by descriptor css +$lightGrey: #edf1f5; +$darkGrey: #8891a1; + // edx.org marketing site variables $m-gray: #8A8C8F; $m-gray-l1: #97999B; @@ -197,4 +201,4 @@ $homepage-bg-image: '../images/homepage-bg.jpg'; $login-banner-image: url(../images/bg-banner-login.png); $register-banner-image: url(../images/bg-banner-register.png); -$video-thumb-url: '../images/courses/video-thumb.jpg'; \ No newline at end of file +$video-thumb-url: '../images/courses/video-thumb.jpg'; diff --git a/lms/static/sass/course.scss.mako b/lms/static/sass/course.scss.mako index 93b0b681d4..bef3afa9cd 100644 --- a/lms/static/sass/course.scss.mako +++ b/lms/static/sass/course.scss.mako @@ -66,6 +66,7 @@ @import "course/instructor/instructor"; @import "course/instructor/instructor_2"; @import "course/instructor/email"; +@import "xmodule/descriptors/css/module-styles.scss"; // discussion @import "course/discussion/form-wmd-toolbar"; diff --git a/lms/static/sass/course/instructor/_email.scss b/lms/static/sass/course/instructor/_email.scss index ed33e985ab..bc38d64394 100644 --- a/lms/static/sass/course/instructor/_email.scss +++ b/lms/static/sass/course/instructor/_email.scss @@ -1,3 +1,21 @@ +.email-editor { + border: 1px solid #c8c8c8; +} + +.xmodule_edit { + ul { + margin: 0; + padding: 0; + margin-bottom: 10px; + list-style: none; + } + + a { + line-height: (16*1.48) + px; + line-height: 1.48rem; + } +} + .submit-email-action { margin-top: 10px; line-height: 1.3; diff --git a/lms/templates/courseware/instructor_dashboard.html b/lms/templates/courseware/instructor_dashboard.html index 71fc0646e6..35e15076fe 100644 --- a/lms/templates/courseware/instructor_dashboard.html +++ b/lms/templates/courseware/instructor_dashboard.html @@ -10,6 +10,12 @@ + + + + + + <%static:js group='module-descriptor-js'/> %if instructor_tasks is not None: %endif @@ -458,12 +464,11 @@ function goto( mode) %else: %endif - - %if message: - - %else: - - %endif + + +

Please try not to email students more than once a day. Important things to consider before sending: @@ -473,6 +478,13 @@ function goto( mode)
+ %endif diff --git a/lms/templates/widgets/html-edit.html b/lms/templates/widgets/html-edit.html new file mode 100644 index 0000000000..0cb0ca4f0a --- /dev/null +++ b/lms/templates/widgets/html-edit.html @@ -0,0 +1,13 @@ +<%! from django.utils.translation import ugettext as _ %> + +
+ + +
+ + +
+