Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
arnoudbuzing committed May 30, 2018
1 parent 651c683 commit 3d0569b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
12 changes: 12 additions & 0 deletions Prototypes/Cloud.wl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
CreateNotebookRenderAPI[] := Module[ {function,api,form},
function = Function[ Module[{nb, co}, nb = Import[URLDownload[#url]]; co = CloudPublish[nb]; HTTPRedirect[First[co]] ]];
api = APIFunction[{"url" -> "String"}, function, "CloudCDF"];
CloudDeploy[api, CloudObject["api/render-notebook"], Permissions -> "Public"];
form = FormFunction[{"url" -> "String"}, function, "CloudCDF"];
CloudDeploy[form, CloudObject["form/render-notebook"], Permissions -> "Public"];
];

RenderOnlineNotebook[ url_ ] := Module[{},
If[ Not @ $CloudConnected, CloudConnect[] ];
SystemOpen[ First[$CloudRootDirectory] <> "/api/render-notebook?url=" <> URLEncode[url]];
];
3 changes: 2 additions & 1 deletion Prototypes/PacletInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@
"Prototypes`$LocalAppDataDirectory",
"Prototypes`$LocalResourceObjects",
"Prototypes`$RoamingAppDataDirectory",
"Prototypes`$UUIDStringPattern", "Prototypes`LayeredGeoGraphics"},
"Prototypes`$UUIDStringPattern", "Prototypes`LayeredGeoGraphics",
"Prototypes`RenderOnlineNotebook","Prototypes`CreateNotebookRenderAPI"},
Context -> {"Prototypes`"} }
}
]
2 changes: 1 addition & 1 deletion Prototypes/Prototypes.wl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Begin["`Private`"];
Module[ {files},

(* load in any session *)
files = {"Build.wl", "Dataset.wl", "Files.wl",
files = {"Build.wl", "Dataset.wl", "Files.wl", "Cloud.wl",
"Image.wl", "Language.wl", "Paclet.wl", "Formats.wl",
"Resources.wl", "Search.wl", "String.wl", "Color.wl",
"Entities.wl", "WolframAlpha.wl", "Translation.wl","GeoGraphics.wl"};
Expand Down
3 changes: 3 additions & 0 deletions Prototypes/Usage.wl
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,6 @@ TranslationCell::usage = "TranslationCell[text,lang] prints a \"Text\" cell cont
GeoService::usage = "GeoService[name] provides GeoServer 'name' for geographical functions. Use GeoService[\"Properties\"] for a list. Use with GeoServer option.";
LayeredGeoGraphics::usage = "LayeredGeoGraphics[primitives,layers] creates a layered GeoGraphics map for the specified GeoService layers";
FormatDetect::usage = "FormatDetect[format,data] checks if 'data' (String/List/ByteArray) matches 'format' (PNG/JPG/GIF)";
(* cloud *)
CreateNotebookRenderAPI::usage = "CreateNotebookRenderAPI[] creates the cloud api functions used by RenderOnlineNotebook";
RenderOnlineNotebook::usage = "RenderOnlineNotebook[url] reads 'url' and opens a private editable copy";

0 comments on commit 3d0569b

Please sign in to comment.