A Basic Ajax Content Management Framework
A Basic Ajax Content Management Framework
On my one project, which I just took control of, tracks documents that the
webmaster is placing into a folder so it can be linked to multiple records in the
table in such. That part is not important, but I thought I would tell you where I
thought of this. As I was coding the checking to see if a file exists I was like man,
Ajax could be the missing link to those web content management tools out there.
You have a site builder like on Brinkster or any of the other free hosts. I was
always annoyed by how slow they were to react when navigating since it always
had to do the full page refresh to get the documents and such. If you had to go 10
files deep in the tree, I needed a beer and a bag of pretzels waiting for it to
happen.
So I just made a quick vb.net project that is not fancy. It is a basic framework for
you to be able to navigate through a directory on my web server and look at the
files. The code is a basic starting point for anyone that wants to create a way for a
user to look for files on the servewr. I see a lot of people saying that they want a
file input to be able to search the server. With this code, you can create it. If I had
more time, I would create a look like file browser, but I am busy with the book! If
anyone out there does it, send me an email and I will post a link on my blog to it.
Now, you really need to address security here since you are allowing people to
access the folder structure on the server! I did a very(infite+1) small check that I am
sure could be bypassed. If anyone has some good ideas on security for this, lets us
know!
The code here does three things:
1. Creates a Breadcrumb Navigation
2. Lists the Folders
3. Lists the Files
The Client Side Code
<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="testAj.aspx.vb" Inherits="datagrid.testAj"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>testAj</title>
<meta name="GENERATOR" content="Microsoft Visual
Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET
7.1">
<meta name="vs_defaultClientScript"
content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
<style> #Nav{ display: block; float: left; background:
#ffffff; font-size: 15px; width: 50%}
else{
document.getElementById("Nav").innerHTML = strText;
}
}
else{
alert("There was a problem retrieving the XML data:\n" +
reqXML.statusText);
}
}
</script>
</HEAD>
<body
onload="LoadXMLDoc('contentManagement.aspx','folder','DEFAULT')">
<form id="Form1" method="post" runat="server">
<span id="Nav"></span>
</form>
</body>
</HTML>
contentManagement.aspx
<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="contentManagement.aspx.vb" Inherits="datagrid.redirect"%>
contentManagement.aspx.vb
Imports System.IO
Imports System.Text
Public Class contentManagement
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
Private Sub InitializeComponent()
End Sub
'NOTE: The following placeholder declaration is required by the Web
Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region