Skip to content

Commit

Permalink
Moved js files into explorer
Browse files Browse the repository at this point in the history
  • Loading branch information
kriszyp committed Oct 11, 2010
1 parent 21c8733 commit 5efac57
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 17 deletions.
2 changes: 1 addition & 1 deletion lib/persvr.js
Expand Up @@ -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]);
};
Expand Down
4 changes: 2 additions & 2 deletions public/explorer.html
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
41 changes: 27 additions & 14 deletions public/explorer/explorer.js
Expand Up @@ -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',
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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],
Expand All @@ -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();
Expand All @@ -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();
});
}
}
Expand Down Expand Up @@ -216,3 +227,5 @@ function startExplorer(){

}



File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 5efac57

Please sign in to comment.