Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Online Code Editor

0.00/5 (No votes)
23 Oct 2008 1  
With Online Code Editor, you can edit your code online.

Introduction

With the Online Code Editor, you can edit your code online. It allows to write well-formatted source code with line enumeration, tab support, search and replace (with regexp), and live syntax highlighting (customizable).

Screenshot...

Background

The Online Code Editor is based on EditArea, a free JavaScript editor for source code, created by Christophe Dolivet. We added a file browser to manipulate files (load and save). The file browser is based on a tree, like MS Explorer. The script code of the tree was created by Geir Landrö.

Using the code

You just upload a page and a directory to your server, and then you can navigate the files and edit them.

Points of interest

This is the recursive directory script:

Sub RecursiveDir(ByVal Root As String, ByVal pID As Integer, _
                 ByVal ListFiles As Boolean)
    Dim Folder As New DirectoryInfo(Root)
    Dim SubFolder As DirectoryInfo
    Dim File As FileInfo
    For Each SubFolder In Folder.GetDirectories
        iID = iID + 1
        If LCase(SubFolder.Name) <> "_codeedit" Then
            Response.Write("d.add(" & iID & ", " & pID & _
                           ",""" & SubFolder.Name & _
                           """);" & vbLf)
        Call RecursiveDir(Root & "\" & SubFolder.Name, iID, ListFiles)
    Next

    If ListFiles Then
        For Each File In Folder.GetFiles("*.*")
            iID = iID + 1 If LCase(File.Name) <> "_codeedit.aspx" Then_
             Response.Write("d.add(" & iID & "," & _
                pID & ",""" & File.Name & _
                """,""_codeedit.aspx?side=right&screenwidth=" & _
                Trim(Request("screenwidth")) & "&screenheight=" & _
                Trim(Request("screenheight")) & "&file=" & _
            Server.UrlEncode(Root & "\" & File.Name) & """);" & vbLf)
        Next
    Else
        Response.Write("d.icon.node =""_CodeEdit/images/folder.gif"";" & vbLf)
    End If
End Sub

History

This is a rough version. We have plans to update it soon. Please visit our website to get any updated news.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here