Permalink
Browse files

refs #10119 - updating the filenames and save functionality of cheat.php

  • Loading branch information...
phiggins42 committed Oct 15, 2009
1 parent cc40b1a commit a9f58a7688a2163b168c47d3d225e107e94959e2
Showing with 23 additions and 14 deletions.
  1. +18 −11 docscripts/cheat.php
  2. +5 −3 docscripts/cheat/lib.js
View
@@ -19,9 +19,14 @@
$head .= "<style type='text/css'>" . file_get_contents("cheat/cheat.css") ."</style></head><body>";
$page = $head . $_POST['body'] . "<div class='note'><p>Dojo " . $_POST['version'] .
" Docs generated " . date("Y-m-d") . "</p></div>" . $foot;
- file_put_contents("./cheat.html", stripslashes($page));
+
+ if(is_writable("./cheat.html")){
+ file_put_contents("./cheat.html", stripslashes($page));
+ }else{
+ header("HTTP", true, 500);
+ print "Unwritable File: cheat.html";
+ }
die;
-
}
print $head;
@@ -88,6 +93,13 @@
ap.addIn("dojo.Color.prototype", ap.getUl("Colors"));
}
+ var finish = function(){
+ ap.sortFields("container");
+ ap.buildNav();
+ ap.hasTag("build") && ap.save();
+
+ }
+
if(ap.hasTag("includeDijit")){
dojo.require("dijit.dijit");
dojo.addOnLoad(function(){
@@ -97,24 +109,19 @@
ap.addIn("dijit._Templated.prototype", null, "dijit");
ap.addIn("dijit.WidgetSet.prototype", ap.getUl("Widget-Access"));
ap.addIn("dijit.popup", ap.getUl("Widget-Control"));
-
- ap.sortFields("container");
- ap.buildNav();
-
+ finish();
});
}else{
-
- ap.sortFields("container");
- ap.buildNav();
-
+ finish();
}
dojo.connect(dojo.global, "onkeypress", function(e){
if(e.keyCode == dojo.keys.ESCAPE && e.ctrlKey){
ap.save();
}
- })
+ });
+
});
</script>
View
@@ -239,11 +239,13 @@ dojo.provide("util.docscripts.cheat.lib");
save: function(){
dojo.xhrPost({
- url:"api-gen.php",
+ url:"cheat.php",
content: { body: dojo.body().innerHTML, version: dojo.version.toString() },
load: function(response){
- console.log('complete', response);
- window.location.href = "./api.html";
+ window.location.href = "./cheat.html";
+ },
+ error: function(er){
+ console.log("Error in saving:", er.responseText);
}
});
},

0 comments on commit a9f58a7

Please sign in to comment.