From c4dd46e66677325e05aa73220768b8dadee6100e Mon Sep 17 00:00:00 2001 From: Aron Fyodor Asor Date: Tue, 1 Sep 2015 11:46:50 -0700 Subject: [PATCH 1/6] Delete the initdconfig management command. Fixes #4137. These platform specific configuration files should be done within the installers. --- .../management/commands/initdconfig.py | 103 ------------------ 1 file changed, 103 deletions(-) delete mode 100644 kalite/distributed/management/commands/initdconfig.py diff --git a/kalite/distributed/management/commands/initdconfig.py b/kalite/distributed/management/commands/initdconfig.py deleted file mode 100644 index 474b201075..0000000000 --- a/kalite/distributed/management/commands/initdconfig.py +++ /dev/null @@ -1,103 +0,0 @@ -""" -""" -import getpass -import os -import sys -import warnings - -from django.conf import settings -from django.core.management.base import BaseCommand - -from kalite.shared.warnings import RemovedInKALite_v015_Warning - -script_template = """#!/bin/sh - -# Author: Foundation for Learning Equality -# -# /etc/init.d/kalite - -### BEGIN INIT INFO -# Provides: kalite -# Required-Start: $local_fs $remote_fs $network $syslog $named -# Required-Stop: -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: ka-lite daemon, a local Khan Academy content server -### END INIT INFO - -set -e - -. /lib/lsb/init-functions - -case "$1" in - start) - # run ka-lite as another user, the one who generated this file - su %(user)s -c "%(executable_path)s start" - ;; - stop) - "%(executable_path)s" stop - ;; - restart) - $0 stop - sleep 1 - $0 start - ;; - status) - "%(executable_path)s" status - ;; - *) - log_success_msg "Usage: /etc/init.d/kalite {start|stop|restart|status}" - exit 1 -esac - -""" - -if sys.platform == 'darwin': - # TODO(cpauya): Set the StandardOutPath key so that /dev/stdout or /dev/tty can be used. Reason is if user runs: - # `launchctl load -w $HOME/Library/LaunchAgents/org.learningequality.kalite.plist` - # then the output of `kalite start` are not shown on the terminal but instead on - # `/tmp/kalite.out`. There must be a way to set it to display on the user's terminal. - script_template = """ - - - - - Label - org.learningequality.kalite - Program - %(executable_path)s start - RunAtLoad - - StandardOutPath - /tmp/kalite.out - StandardErrorPath - /tmp/kalite.err - WorkingDirectory - %(cwd)s - - - """ - - -class Command(BaseCommand): - help = "Print init.d startup script for the server daemon." - - def handle(self, *args, **options): - - warnings.warn("Use of the initdconfig command will be removed in 0.15," - "in favor of having the run-at-boot functionality implemented by the installers.", DeprecationWarning) - - if settings.IS_SOURCE: - executable_path = os.path.abspath(os.path.join(settings.PROJECT_PATH, "..", "bin", "kalite")) - cwd = settings.PROJECT_PATH - else: - executable_path = "kalite" - cwd = "/" - - self.stdout.write( - script_template % { - "executable_path": executable_path, - "cwd": cwd, - "user": getpass.getuser(), - } - ) From f60b065922d0dca79f2b7f5bc5e346cc2b988926 Mon Sep 17 00:00:00 2001 From: Michael Gallaspy Date: Tue, 1 Sep 2015 12:00:00 -0700 Subject: [PATCH 2/6] Remove duplicate requirements These requirements are duplicated in `requirements_test.txt`, resulting in an error when you run `pip install -r requirements_dev.txt`. --- requirements_dev.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/requirements_dev.txt b/requirements_dev.txt index fbb4693aec..e90b466b01 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -2,6 +2,3 @@ werkzeug # Not sure about version django-debug-toolbar # Version was not described in previously bundled files, used by kalite.testing app pyyaml==3.11 -hachoir-core==1.3.3 -hachoir-parser==1.3.4 -hachoir-metadata==1.3.3 \ No newline at end of file From d9fbaa42a1da8af35cf47efadf10bdfd5b8b61b7 Mon Sep 17 00:00:00 2001 From: Richard Tibbles Date: Tue, 1 Sep 2015 12:58:34 -0700 Subject: [PATCH 3/6] Properly override fancytree LESS. --- kalite/updates/static/css/updates/update_videos.less | 5 +++++ .../static/js/updates/bundle_modules/update_videos.js | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/kalite/updates/static/css/updates/update_videos.less b/kalite/updates/static/css/updates/update_videos.less index 84ed1088f9..8bc542f040 100644 --- a/kalite/updates/static/css/updates/update_videos.less +++ b/kalite/updates/static/css/updates/update_videos.less @@ -1,3 +1,8 @@ +@import "../../../../../node_modules/jquery.fancytree/dist/skin-common.less"; + +@fancy-inline-sprites: true; +@fancy-image-dir: "../../../../../node_modules/jquery.fancytree/dist/skin-vista"; + #content_tree .complete span.fancytree-icon { margin-top: 2px; background: url(/static/images/distributed/circle-complete.png) no-repeat; diff --git a/kalite/updates/static/js/updates/bundle_modules/update_videos.js b/kalite/updates/static/js/updates/bundle_modules/update_videos.js index 5a8ca28bf3..09f2ae5cc2 100644 --- a/kalite/updates/static/js/updates/bundle_modules/update_videos.js +++ b/kalite/updates/static/js/updates/bundle_modules/update_videos.js @@ -6,7 +6,6 @@ var base = require("updates/base"); var connectivity = require("utils/connectivity"); var sprintf = require("sprintf-js").sprintf; -require("jquery.fancytree/dist/skin-vista/ui.fancytree.less"); require("../../../css/updates/update_videos.less"); // Callback functions From 88c26c8c8b4f7aa7e53514899cfdb8b4d416c119 Mon Sep 17 00:00:00 2001 From: Richard Tibbles Date: Tue, 1 Sep 2015 14:25:50 -0700 Subject: [PATCH 4/6] Prevents erroneously setting model to not active. --- kalite/distributed/static/js/distributed/topics/views.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/kalite/distributed/static/js/distributed/topics/views.js b/kalite/distributed/static/js/distributed/topics/views.js index 5c0efbc81f..275f444cc0 100644 --- a/kalite/distributed/static/js/distributed/topics/views.js +++ b/kalite/distributed/static/js/distributed/topics/views.js @@ -115,8 +115,6 @@ var ContentAreaView = BaseView.extend({ this.currently_shown_view.remove(); } } - - this.model.set("active", false); } }); From a75ed15cbd3168c87a78d9db960ac0c12312d44c Mon Sep 17 00:00:00 2001 From: Richard Tibbles Date: Tue, 1 Sep 2015 16:02:32 -0700 Subject: [PATCH 5/6] Fix back button behaviour for sidebar. --- kalite/distributed/static/js/distributed/topics/views.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kalite/distributed/static/js/distributed/topics/views.js b/kalite/distributed/static/js/distributed/topics/views.js index 5c0efbc81f..97ee46dc69 100644 --- a/kalite/distributed/static/js/distributed/topics/views.js +++ b/kalite/distributed/static/js/distributed/topics/views.js @@ -635,6 +635,10 @@ var TopicContainerOuterView = BaseView.extend({ } } } + if (!pruned && (paths.length < check_views.length)) { + // Double check that paths and check_views are the same length + this.remove_topic_views(check_views.length - paths.length); + } if (callback) { this.stopListening(this, "inner_view_added"); From 3532f8aee0968ada148e2af211344c96e0e4661a Mon Sep 17 00:00:00 2001 From: Richard Tibbles Date: Tue, 1 Sep 2015 16:12:41 -0700 Subject: [PATCH 6/6] Put language pack management functions in the global scope to interact with the horrible horrible horrible onclick properties of some dynamically rendered HTML that should be in a template and be being listened to. I feel sick. --- .../static/js/updates/bundle_modules/update_languages.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kalite/updates/static/js/updates/bundle_modules/update_languages.js b/kalite/updates/static/js/updates/bundle_modules/update_languages.js index 6adee55ed8..f2678ef231 100644 --- a/kalite/updates/static/js/updates/bundle_modules/update_languages.js +++ b/kalite/updates/static/js/updates/bundle_modules/update_languages.js @@ -236,6 +236,8 @@ function start_languagepack_download(lang_code) { }); } +window.start_languagepack_download = start_languagepack_download; + // when we make a selection on the language pack select box, enable the 'Get Language' Button function select_lang_pack( event ) { var lang_code = event.data.caller_value; @@ -287,6 +289,8 @@ function set_server_language(lang) { }); } +window.set_server_language = set_server_language; + function update_server_status() { connectivity.with_online_status("server", function(server_is_online) { // We assume the distributed server is offline; if it's online, then we enable buttons that only work with internet.