<% Option Explicit %> DevEdit Test -- Load/Save File
<% 'Include the DevEdit class file %> <% 'Set this variable to the name of the file you want to load, edit and then save 'This example assumes we're loading myfile.html in the same directory as where 'the "de" folder exists const myFileName = "templates/layout1.html" 'Create a new DevEdit class object dim myDE set myDE = new DevEdit 'Set the path to the "de" folder setDevEditPath("/magazine/de") 'myDE.HideSaveButton 'myDE.HideFullScreenButton 'myDE.HideBoldButton 'myDE.HideUnderlineButton 'myDE.HideItalicButton 'myDE.HideStrikethroughButton 'myDE.HideNumberListButton 'myDE.HideBulletListButton 'myDE.HideDecreaseIndentButton 'myDE.HideIncreaseIndentButton 'myDE.HideLeftAlignButton 'myDE.HideCenterAlignButton 'myDE.HideRightAlignButton 'myDE.HideJustifyButton 'myDE.HideHorizontalRuleButton 'myDE.HideLinkButton 'myDE.HideAnchorButton 'myDE.HideMailLinkButton 'myDE.HideHelpButton 'myDE.HideFontList 'myDE.HideSizeList 'myDE.HideFormatList 'myDE.HideStyleList 'myDE.HideForeColorButton 'myDE.HideBackColorButton 'myDE.HideTableButton 'myDE.HideFormButton 'myDE.HideImageButton 'myDE.HideFlashButton 'myDE.DisableFlashUploading 'myDE.DisableFlashDeleting 'myDE.DisableInsertFlashFromWeb 'myDE.HideTextBoxButton 'myDE.HideSymbolButton 'myDE.HidePropertiesButton 'myDE.HideCleanHTMLButton 'myDE.HideAbsolutePositionButton 'myDE.HideGuidelinesButton 'myDE.HideSpellingButton 'myDE.HideRemoveTextFormattingButton 'myDE.HideSuperScriptButton 'myDE.HideSubScriptButton myDE.DisableSourceMode 'myDE.DisablePreviewMode 'myDE.DisableImageUploading 'myDE.DisableImageDeleting 'myDE.DisableInsertImageFromWeb 'myDE.DisableXHTMLFormatting 'myDE.DisableSingleLineReturn 'Set the name of this DevEdit class myDE.SetName "myDevEditControl" myDE.SetLanguage DE_AMERICAN myDE.SetPathType DE_PATH_TYPE_FULL myDE.SetImagePath("/webimages") myDE.SetDocumentType DE_DOC_TYPE_HTML_PAGE myDE.SetImageDisplayType DE_IMAGE_TYPE_THUMBNAIL myDE.SetFlashDisplayType de_FLASH_TYPE_THUMBNAIL myDE.EnableGuidelines myDE.SetTextAreaDimensions 60, 30 ' Use the AddCustomInsert function to add some custom inserts myDE.AddCustomInsert "DevEdit Logo", "" myDE.AddCustomInsert "Red Text", "Red Text" ' Use the AddCustomLink function to add some custom links myDE.AddCustomLink "DevEdit Website", "http://www.devedit.com", "_blank" myDE.AddCustomLink "Interspire Website", "www.interspire.com", "" ' Use the AddImageLibrary function to add an image library myDE.AddImageLibrary "Image Library #1", "/images/42040/" myDE.AddImageLibrary "Image Library #2", "/images/41999/" myDE.AddImageLibrary "Image Library #3", "/images/41220/" myDE.AddImageLibrary "Image Library #4", "/images/42122/" ' Use the AddFlashLibrary function to add flash libraries myDE.AddFlashLibrary "Flash Library #1", "/flash_files" myDE.AddFlashLibrary "Flash Library #2", "/flash_files/other" dim objFSO, objFile, val set objFSO = Server.CreateObject("Scripting.FileSystemObject") 'If the form hasn't been posted (i.e. the DevEdit control sent no HTML) 'then read in the contents of the file if myDE.GetValue(false) = "" then 'Read the file contents set objFile = objFSO.OpenTextFile(Server.MapPath(myFileName), 1) val = objFile.ReadAll else 'Save the file contents set objFile = objFSO.OpenTextFile(Server.MapPath(myFileName), 2) objFile.WriteLine myDE.GetValue(false) val = myDE.GetValue(false) end if set objFSO = Nothing myDE.SetValue val myDE.ShowControl "90%", "80%", "/webimages" %>