Permalink
Browse files

Moved js files into explorer

  • Loading branch information...
1 parent 21c8733 commit 5efac5741d461a7b50b5e110574077c34491559e @kriszyp committed Oct 11, 2010
View
@@ -12,7 +12,7 @@ load = function(id){
var parts = id.split("/");
var model = modelModule;
for(var i = 1; i < parts.length - 1; i++){
- model = model.openObjectStore(parts[i]);
+ model = model.get(parts[i]);
}
return model.get(parts[i]);
};
View
@@ -16,7 +16,7 @@
djConfig={
parseOnLoad: true,
baseUrl: "./",
- modulePaths: { persevere: "js/dojo-persevere" }
+ modulePaths: { persevere: "explorer/js/dojo-persevere" }
};
</script>
<script type="text/javascript" src="http://o.aolcdn.com/dojo/1.4/dojo/dojo.xd.js"></script>
@@ -51,7 +51,7 @@
<a href="/" alt="Persevere"><div id="logo"></div></a>
<ul id="subNav">
<li><a href="http://www.persvr.org/" class="navLink">about</a></li>
- <li><a href="index.htm" class="navLink">getting started</a></li>
+ <li><a href="http://www.sitepen.com/blog/2010/01/25/getting-started-with-pintura/" class="navLink">getting started</a></li>
<li><a href="http://docs.persvr.org/" class="navLink">documentation</a></li>
<li class="active"><a href="explorer.html" class="navLink">database explorer</a></li>
</ul>
@@ -51,7 +51,11 @@ function startExplorer(){
var path = location.pathname.match(/(.*\/)[^\/]*$/)[1];
var storesDfd = dojox.data.PersevereStore.getStores(path); // persevere stores are auto-generated
storesDfd.addErrback(function(e){
- alert("Could not load Persevere classes (Class table)." + (/404/.test(e.message) ? " Are you sure you are connected to Persevere and not just a generic web server like Apache?" : ""));
+ if(/416/.test(e.message) && !username){
+ signin();
+ }else{
+ alert("Could not load Persevere classes (Class table)." + (/404/.test(e.message) ? " Are you sure you are connected to Persevere and not just a generic web server like Apache?" : ""));
+ }
});
var cp = new dijit.layout.ContentPane({
id: 'storeExplorer',
@@ -92,10 +96,12 @@ function startExplorer(){
}else if(activeClassName == 'User'){
// special handling for users
dojo.require("persevere.Login");
- var login = new persevere.Login({onLoginSuccess: function(){}});
- login._showLogin = function(){};// do nothing when it tries to show the login
- dojo.body().appendChild(login.domNode);
- login._showRegister();
+ dojo.addOnLoad(function(){
+ var login = new persevere.Login({onLoginSuccess: function(){}});
+ login._showLogin = function(){};// do nothing when it tries to show the login
+ dojo.body().appendChild(login.domNode);
+ login._showRegister();
+ });
}else if(activeClassName == 'File'){
var fileDialog = this._fileDialog;
@@ -148,7 +154,7 @@ function startExplorer(){
var accessLevel = prompt("What access level would you like to grant (none, limited, read, execute, append, write, or full)?","full");
if(accessLevel){
dojo.rawXhrPost({
- url: "Class/User",
+ url: "User/",
postData: dojox.json.ref.toJson({
method:"grantAccess",
params:[username, selectedItem || {__id:activeStore.target + '/'}, accessLevel],
@@ -158,14 +164,24 @@ function startExplorer(){
}
}
});
+ function signin(){
+ dojo.require("persevere.Login");
+ dojo.addOnLoad(function(){
+ var login = new persevere.Login({onLoginSuccess: function(){
+ location.reload();
+ }});
+ dojo.body().appendChild(login.domNode);
+ login.startup();
+ });
+ }
function createSignInButton(){
//creates the signin/signout button, now or later
if(username){
addButton("Sign-out",function(){
if(confirm("Are you sure you want to sign out?")){
dojo.xhrPost({
- url: "Class/User",
- postData: dojo.toJson({method: "authenticate", id:"login", params:[null,null]}),
+ url: "User/",
+ postData: dojo.toJson({method: "authenticate", id:"login", user: null, password: null}),
handleAs: "json"
}).addCallback(function(){
location.reload();
@@ -174,12 +190,7 @@ function startExplorer(){
});
}else{
addButton("Sign-in",function(){
- dojo.require("persevere.Login");
- var login = new persevere.Login({onLoginSuccess: function(){
- location.reload();
- }});
- dojo.body().appendChild(login.domNode);
- login.startup();
+ signin();
});
}
}
@@ -216,3 +227,5 @@ function startExplorer(){
}
+
+

0 comments on commit 5efac57

Please sign in to comment.