Permalink
Browse files

Merge branch 'feature/learning-pane'

  • Loading branch information...
2 parents 165a43f + a092e50 commit 0d0766a26aae0c9450deca306cca82287a2e0f21 @jjallaire jjallaire committed Jan 25, 2013
Showing with 7,022 additions and 229 deletions.
  1. +23 −0 NOTICE
  2. +1 −0 src/cpp/core/CMakeLists.txt
  3. +10 −2 src/cpp/core/FilePath.cpp
  4. +41 −0 src/cpp/core/HtmlUtils.cpp
  5. +11 −1 src/cpp/core/http/Response.cpp
  6. +31 −0 src/cpp/core/include/core/HtmlUtils.hpp
  7. +2 −0 src/cpp/core/include/core/http/Response.hpp
  8. +16 −4 src/cpp/core/include/core/text/DcfParser.hpp
  9. +55 −17 src/cpp/core/text/DcfParser.cpp
  10. +1 −0 src/cpp/server/ServerMain.cpp
  11. +7 −0 src/cpp/session/CMakeLists.txt
  12. +3 −0 src/cpp/session/SessionClientEvent.cpp
  13. +4 −0 src/cpp/session/SessionMain.cpp
  14. +17 −0 src/cpp/session/SessionModuleContext.cpp
  15. +2 −0 src/cpp/session/include/session/SessionModuleContext.hpp
  16. +1 −0 src/cpp/session/include/session/worker_safe/session/SessionClientEvent.hpp
  17. +3 −22 src/cpp/session/modules/SessionHTMLPreview.cpp
  18. +2 −0 src/cpp/session/modules/SessionHelp.R
  19. +9 −0 src/cpp/session/modules/SessionHelp.cpp
  20. +23 −0 src/cpp/session/modules/SessionLearning.R
  21. +158 −0 src/cpp/session/modules/learning/LearningState.cpp
  22. +57 −0 src/cpp/session/modules/learning/LearningState.hpp
  23. +418 −0 src/cpp/session/modules/learning/SessionLearning.cpp
  24. +48 −0 src/cpp/session/modules/learning/SessionLearning.hpp
  25. +289 −0 src/cpp/session/modules/learning/SlideParser.cpp
  26. +127 −0 src/cpp/session/modules/learning/SlideParser.hpp
  27. +311 −0 src/cpp/session/modules/learning/SlideRenderer.cpp
  28. +43 −0 src/cpp/session/modules/learning/SlideRenderer.hpp
  29. +16 −0 src/cpp/session/resources/learning/helpdoc.css
  30. +28 −0 src/cpp/session/resources/learning/helpdoc.html
  31. +10 −0 src/cpp/session/resources/learning/mathjax.html
  32. +19 −0 src/cpp/session/resources/learning/revealjs/LICENSE
  33. +1,311 −0 src/cpp/session/resources/learning/revealjs/css/reveal.css
  34. +7 −0 src/cpp/session/resources/learning/revealjs/css/reveal.min.css
  35. +64 −0 src/cpp/session/resources/learning/revealjs/css/shaders/tile-flip.fs
  36. +141 −0 src/cpp/session/resources/learning/revealjs/css/shaders/tile-flip.vs
  37. +152 −0 src/cpp/session/resources/learning/revealjs/css/theme/simple.css
  38. +1,674 −0 src/cpp/session/resources/learning/revealjs/js/reveal.js
  39. +8 −0 src/cpp/session/resources/learning/revealjs/js/reveal.min.js
  40. +2 −0 src/cpp/session/resources/learning/revealjs/lib/js/classList.js
  41. +8 −0 src/cpp/session/resources/learning/revealjs/lib/js/head.min.js
  42. +71 −0 src/cpp/session/resources/learning/slides.css
  43. +87 −0 src/cpp/session/resources/learning/slides.html
  44. +68 −0 src/cpp/session/resources/learning/slides.js
  45. +1 −1 src/cpp/tools/.gitignore
  46. +1 −0 src/cpp/tools/revealjs-version
  47. +37 −0 src/cpp/tools/sync-revealjs
  48. +4 −0 src/gwt/acesupport/acemode/markdown.js
  49. +112 −0 src/gwt/acesupport/acemode/markdown_folding.js
  50. +1 −0 src/gwt/build.xml
  51. +125 −0 src/gwt/src/org/rstudio/core/client/widget/ReloadableFrame.java
  52. +7 −0 src/gwt/src/org/rstudio/studio/client/RStudioGinModule.java
  53. +1 −4 src/gwt/src/org/rstudio/studio/client/application/Application.java
  54. +91 −0 src/gwt/src/org/rstudio/studio/client/common/filetypes/events/OpenLearningSourceFileEvent.java
  55. +22 −0 src/gwt/src/org/rstudio/studio/client/common/filetypes/events/OpenLearningSourceFileHandler.java
  56. +3 −73 src/gwt/src/org/rstudio/studio/client/htmlpreview/ui/HTMLPreviewPanel.java
  57. +1 −0 src/gwt/src/org/rstudio/studio/client/server/remote/ClientEvent.java
  58. +7 −0 src/gwt/src/org/rstudio/studio/client/server/remote/ClientEventDispatcher.java
  59. +19 −0 src/gwt/src/org/rstudio/studio/client/server/remote/RemoteServer.java
  60. +8 −0 src/gwt/src/org/rstudio/studio/client/workbench/commands/Commands.cmd.xml
  61. +5 −0 src/gwt/src/org/rstudio/studio/client/workbench/commands/Commands.java
  62. BIN src/gwt/src/org/rstudio/studio/client/workbench/commands/refreshLearning.png
  63. +14 −0 src/gwt/src/org/rstudio/studio/client/workbench/model/SessionInfo.java
  64. +3 −1 src/gwt/src/org/rstudio/studio/client/workbench/model/WorkbenchServerOperations.java
  65. +1 −1 src/gwt/src/org/rstudio/studio/client/workbench/prefs/views/PreferencesDialog.css
  66. +4 −3 src/gwt/src/org/rstudio/studio/client/workbench/ui/PaneConfig.java
  67. +30 −3 src/gwt/src/org/rstudio/studio/client/workbench/ui/PaneManager.java
  68. +15 −0 src/gwt/src/org/rstudio/studio/client/workbench/views/console/events/SendToConsoleEvent.java
  69. +70 −8 src/gwt/src/org/rstudio/studio/client/workbench/views/console/shell/Shell.java
  70. +2 −0 src/gwt/src/org/rstudio/studio/client/workbench/views/console/shell/editor/InputEditorDisplay.java
  71. +152 −0 src/gwt/src/org/rstudio/studio/client/workbench/views/learning/LearningPane.java
  72. +401 −0 src/gwt/src/org/rstudio/studio/client/workbench/views/learning/LearningPresenter.java
  73. +90 −0 src/gwt/src/org/rstudio/studio/client/workbench/views/learning/LearningTab.java
  74. +54 −0 src/gwt/src/org/rstudio/studio/client/workbench/views/learning/events/ShowLearningPaneEvent.java
  75. +32 −0 src/gwt/src/org/rstudio/studio/client/workbench/views/learning/model/LearningCommand.java
  76. +30 −0 src/gwt/src/org/rstudio/studio/client/workbench/views/learning/model/LearningServerOperations.java
  77. +41 −0 src/gwt/src/org/rstudio/studio/client/workbench/views/learning/model/LearningState.java
  78. +75 −23 src/gwt/src/org/rstudio/studio/client/workbench/views/source/Source.java
  79. +9 −1 src/gwt/src/org/rstudio/studio/client/workbench/views/source/SourceShim.java
  80. +5 −0 src/gwt/src/org/rstudio/studio/client/workbench/views/source/editors/EditingTarget.java
  81. +24 −0 ...rg/rstudio/studio/client/workbench/views/source/editors/codebrowser/CodeBrowserEditingTarget.java
  82. +9 −0 src/gwt/src/org/rstudio/studio/client/workbench/views/source/editors/text/AceEditor.java
  83. +1 −0 src/gwt/src/org/rstudio/studio/client/workbench/views/source/editors/text/DocDisplay.java
  84. +119 −65 src/gwt/src/org/rstudio/studio/client/workbench/views/source/editors/text/TextEditingTarget.java
  85. +7 −0 src/gwt/src/org/rstudio/studio/client/workbench/views/source/editors/text/ace/CodeModel.java
  86. +10 −0 .../org/rstudio/studio/client/workbench/views/source/editors/urlcontent/UrlContentEditingTarget.java
View
23 NOTICE
@@ -22,6 +22,7 @@ used by these components are included below):
- Sundown
- highlight.js
- MathJax
+- reveal.js
In addition, RStudio for Windows is bundled with binary copies of GNU
DiffUtils, GNU Grep, SumatraPDF, and several components of MSYS.
@@ -2790,3 +2791,25 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+reveal.js
+----------------------------------------------------------------------
+
+Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
@@ -38,6 +38,7 @@ set (CORE_SOURCE_FILES
FileUtils.cpp
GitGraph.cpp
Hash.cpp
+ HtmlUtils.cpp
Log.cpp
LogWriter.cpp
PerformanceTimer.cpp
View
@@ -452,12 +452,20 @@ MimeType s_mimeTypes[] =
{ "xpi", "application/x-xpinstall" },
{ "mp2", "audio/mpeg" },
- { "mp3", "audio/mpeg" },
{ "mpg", "video/mpeg" },
{ "mpeg", "video/mpeg" },
{ "flv", "video/x-flv" },
-
+
+ { "mp4", "video/mp4" },
+ { "webm", "video/webm" },
+ { "ogv", "video/ogg" },
+
+ { "mp3", "audio/mp3" },
+ { "wav", "audio/wav" },
+ { "oga", "audio/ogg" },
+ { "ogg", "audio/ogg" },
+
{ NULL, NULL }
};
View
@@ -0,0 +1,41 @@
+/*
+ * HtmlUtils.cpp
+ *
+ * Copyright (C) 2009-12 by RStudio, Inc.
+ *
+ * Unless you have received this program directly from RStudio pursuant
+ * to the terms of a commercial license agreement with RStudio, then
+ * this program is licensed to you under the terms of version 3 of the
+ * GNU Affero General Public License. This program is distributed WITHOUT
+ * ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,
+ * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the
+ * AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details.
+ *
+ */
+
+#include <core/RegexUtils.hpp>
+
+
+#include <boost/regex.hpp>
+
+
+
+namespace core {
+namespace html_utils {
+
+std::string defaultTitle(const std::string& htmlContent)
+{
+ boost::regex re("<[Hh]([1-6]).*?>(.*?)</[Hh]\\1>");
+ boost::smatch match;
+ if (boost::regex_search(htmlContent, match, re))
+ return match[2];
+ else
+ return "";
+}
+
+
+} // namespace html_utils
+} // namespace core
+
+
+
@@ -232,6 +232,7 @@ namespace status {
namespace Message {
const char * const Ok = "OK" ;
const char * const Created = "Created";
+ const char * const PartialContent = "Partial Content";
const char * const MovedPermanently = "Moved Permanently" ;
const char * const MovedTemporarily = "Moved Temporarily" ;
const char * const SeeOther = "See Other" ;
@@ -241,6 +242,7 @@ namespace Message {
const char * const Forbidden = "Forbidden" ;
const char * const NotFound = "Not Found" ;
const char * const MethodNotAllowed = "Method Not Allowed" ;
+ const char * const RangeNotSatisfiable = "Range Not Satisfyable";
const char * const InternalServerError = "Internal Server Error" ;
const char * const NotImplemented = "Not Implemented" ;
const char * const BadGateway = "Bad Gateway" ;
@@ -266,7 +268,11 @@ void Response::ensureStatusMessage() const
statusMessage_ = status::Message::Created;
break;
- case MovedPermanently:
+ case PartialContent:
+ statusMessage_ = status::Message::PartialContent;
+ break;
+
+ case MovedPermanently:
statusMessage_ = status::Message::MovedPermanently ;
break;
@@ -302,6 +308,10 @@ void Response::ensureStatusMessage() const
statusMessage_ = status::Message::MethodNotAllowed ;
break;
+ case RangeNotSatisfiable:
+ statusMessage_ = status::Message::RangeNotSatisfiable;
+ break;
+
case InternalServerError:
statusMessage_ = status::Message::InternalServerError ;
break;
@@ -0,0 +1,31 @@
+/*
+ * HtmlUtils.hpp
+ *
+ * Copyright (C) 2009-12 by RStudio, Inc.
+ *
+ * Unless you have received this program directly from RStudio pursuant
+ * to the terms of a commercial license agreement with RStudio, then
+ * this program is licensed to you under the terms of version 3 of the
+ * GNU Affero General Public License. This program is distributed WITHOUT
+ * ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,
+ * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the
+ * AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details.
+ *
+ */
+
+#ifndef CORE_HTML_UTILS_HPP
+#define CORE_HTML_UTILS_HPP
+
+#include <string>
+
+namespace core {
+namespace html_utils {
+
+std::string defaultTitle(const std::string& htmlContent);
+
+} // namespace regex_utils
+} // namespace core
+
+
+#endif // CORE_HTML_UTILS_HPP
+
@@ -46,6 +46,7 @@ namespace status {
enum Code {
Ok = 200,
Created = 201,
+ PartialContent = 206,
MovedPermanently = 301,
MovedTemporarily = 302,
SeeOther = 303,
@@ -55,6 +56,7 @@ enum Code {
Forbidden = 403,
NotFound = 404,
MethodNotAllowed = 405,
+ RangeNotSatisfiable = 416,
InternalServerError = 500 ,
NotImplemented = 501,
BadGateway = 502,
@@ -19,21 +19,33 @@
#include <string>
#include <map>
+#include <boost/function.hpp>
+
+
namespace core {
class Error;
class FilePath;
namespace text {
-core::Error parseDcfFile(const FilePath& dcfFilePath,
- bool preserveKeyCase,
- std::map<std::string,std::string>* pFields,
- std::string* pUserErrMsg);
+typedef boost::function<void(const std::pair<std::string,std::string>&)>
+ DcfFieldRecorder;
+
+Error parseDcfFile(const std::string& dcfFileContents,
+ bool preserveKeyCase,
+ DcfFieldRecorder recordField,
+ std::string* pUserErrMsg);
+
+Error parseDcfFile(const FilePath& dcfFilePath,
+ bool preserveKeyCase,
+ std::map<std::string,std::string>* pFields,
+ std::string* pUserErrMsg);
std::string dcfMultilineAsFolded(const std::string& line);
+
} // namespace text
} // namespace core
@@ -19,8 +19,11 @@
#include <string>
#include <vector>
+#include <map>
#include <boost/format.hpp>
+#include <boost/bind.hpp>
+#include <boost/function.hpp>
#include <boost/algorithm/string/trim.hpp>
#include <boost/algorithm/string/split.hpp>
@@ -30,27 +33,15 @@
#include <core/FilePath.hpp>
#include <core/FileSerializer.hpp>
+
namespace core {
namespace text {
-
-
-Error parseDcfFile(const FilePath& dcfFilePath,
+Error parseDcfFile(const std::string& dcfFileContents,
bool preserveKeyCase,
- std::map<std::string,std::string>* pFields,
+ DcfFieldRecorder recordField,
std::string* pUserErrMsg)
{
- // read the file
- std::string dcfFileContents;
- Error error = readStringFromFile(dcfFilePath,
- &dcfFileContents);
- if (error)
- {
- error.addProperty("dcf-file", dcfFilePath.absolutePath());
- *pUserErrMsg = error.summary();
- return error;
- }
-
// split into lines
std::vector<std::string> dcfLines;
boost::algorithm::split(dcfLines,
@@ -86,7 +77,7 @@ Error parseDcfFile(const FilePath& dcfFilePath,
// if we have a pending key & value then resolve it
if (!currentKey.empty())
{
- pFields->insert(std::make_pair(currentKey,currentValue));
+ recordField(std::make_pair(currentKey,currentValue));
currentKey.clear();
currentValue.clear();
}
@@ -121,16 +112,63 @@ Error parseDcfFile(const FilePath& dcfFilePath,
// resolve any pending key and value
if (!currentKey.empty())
- pFields->insert(std::make_pair(currentKey,currentValue));
+ recordField(std::make_pair(currentKey,currentValue));
return Success();
}
+
+Error parseDcfFile(const FilePath& dcfFilePath,
+ bool preserveKeyCase,
+ DcfFieldRecorder recordField,
+ std::string* pUserErrMsg)
+{
+ // read the file
+ std::string dcfFileContents;
+ Error error = readStringFromFile(dcfFilePath,
+ &dcfFileContents);
+ if (error)
+ {
+ error.addProperty("dcf-file", dcfFilePath.absolutePath());
+ *pUserErrMsg = error.summary();
+ return error;
+ }
+
+ return parseDcfFile(dcfFileContents,
+ preserveKeyCase,
+ recordField,
+ pUserErrMsg);
+}
+
+
+namespace {
+
+void mapInsert(std::map<std::string,std::string>* pMap,
+ const std::pair<std::string,std::string>& field)
+{
+ pMap->insert(field);
+}
+
+} // anonymous namespace
+
+
+Error parseDcfFile(const FilePath& dcfFilePath,
+ bool preserveKeyCase,
+ std::map<std::string,std::string>* pFields,
+ std::string* pUserErrMsg)
+{
+ return parseDcfFile(dcfFilePath,
+ preserveKeyCase,
+ boost::bind(mapInsert, pFields, _1),
+ pUserErrMsg);
+}
+
std::string dcfMultilineAsFolded(const std::string& line)
{
return boost::algorithm::trim_copy(
boost::regex_replace(line, boost::regex("\\s*\r?\n\\s*"), " "));
}
+
} // namespace dcf
} // namespace core
@@ -139,6 +139,7 @@ void httpServerAddHandlers()
uri_handlers::add("/file_show", secureAsyncHttpHandler(proxyContentRequest));
uri_handlers::add("/view_pdf", secureAsyncHttpHandler(proxyContentRequest));
uri_handlers::add("/agreement", secureAsyncHttpHandler(proxyContentRequest));
+ uri_handlers::add("/learning", secureAsyncHttpHandler(proxyContentRequest));
// content handlers which might be accessed outside the context of the
// workbench get secure + authentication when required
@@ -78,6 +78,10 @@ set (SESSION_SOURCE_FILES
modules/build/SessionBuildErrors.cpp
modules/build/SessionBuildUtils.cpp
modules/build/SessionSourceCpp.cpp
+ modules/learning/SessionLearning.cpp
+ modules/learning/LearningState.cpp
+ modules/learning/SlideParser.cpp
+ modules/learning/SlideRenderer.cpp
modules/tex/SessionCompilePdf.cpp
modules/tex/SessionCompilePdfSupervisor.cpp
modules/tex/SessionPdfLatex.cpp
@@ -260,6 +264,9 @@ if (NOT RSTUDIO_SESSION_WIN64)
file(GLOB JS_RESOURCE_FILES "resources/*.js")
install(FILES ${JS_RESOURCE_FILES}
DESTINATION ${RSTUDIO_INSTALL_SUPPORTING}/resources)
+ # learning
+ install(DIRECTORY "resources/learning"
+ DESTINATION ${RSTUDIO_INSTALL_SUPPORTING}/resources)
# R scripts
file(GLOB R_MODULE_SRC_FILES "${CMAKE_CURRENT_BINARY_DIR}/modules/R/*.R")
@@ -97,6 +97,7 @@ const int kSourceCppStarted = 69;
const int kSourceCppCompleted = 70;
const int kLoadedPackageUpdates = 71;
const int kActivatePane = 72;
+const int kShowLearningPane = 73;
}
void ClientEvent::init(int type, const json::Value& data)
@@ -250,6 +251,8 @@ std::string ClientEvent::typeName() const
return "loaded_package_updates";
case client_events::kActivatePane:
return "activate_pane";
+ case client_events::kShowLearningPane:
+ return "show_learning_pane";
default:
LOG_WARNING_MESSAGE("unexpected event type: " +
safe_convert::numberToString(type_));
Oops, something went wrong.

0 comments on commit 0d0766a

Please sign in to comment.