Two Scenarios

Last post 12-12-2005, 5:00 PM by cangelly. 9 replies.
Sort Posts: Previous Next
  •  12-08-2005, 9:18 AM 13570

    Two Scenarios

    I have a situation where I needed to use Adam's UNC path approach. This works with a few exceptions (illustrated in the image below).

    Some of my settings for the control (named cntrlCuteEditor) are as follows:

    cntrlCuteEditor.AutoConfigure = CuteEditor.AutoConfigure.None
    cntrlCuteEditor.UseRelativeLinks = True
    cntrlCuteEditor.RemoveServerNamesFromUrl = True
    cntrlCuteEditor.AutoParseClasses = True
    cntrlCuteEditor.BaseHref = ' never assigned a value
    cntrlCuteEditor.EditorWysiwygModeCss = "/external/" & siteFolder & "/css/" & stylesheet 
    ' stylesheet is a value like "main.css"

    As you can see, I'm very close to achieving what I need in Scenario 1. However, after I save the page (at which time I strip out the /external/siteName string which was only there to pacify the ImageGalleryPath and FilesGalleryPath properties) and then re-load the CuteEditor control with these saved changes my image links are broken. It seems like a Catch 22 in that the reason my image links are broken is because there is no BaseHref property value assigned...but if I assign a value to BaseHref the CSS isn't correctly applied and I don't see the images initially after having picked them from the gallery.

    Any ideas?

    UPDATE: I've confirmed that after I save my cntrlCuteEditor.EditorWysiwygModeCss its value is still "/external/siteName/css/main.css". In my save method, if I set cntrlCuteEditor.BaseHref = "http://www.someite.com/" then my images appear of course. However, the CSS then is not applied anymore because of the EditorWysiwygModeCss still using that virtual directory path. How can I get EditorWysiwygModeCss to point to my CSS file once BaseHref has been set? The CSS file is obviously on a physically different machine than where the application running CuteEditor is located (hence my need to use a virtual directory pointing to a UNC path). If I could just do the following it would work:  cntrlCuteEditor.EditorWysiwygModeCss = "http://www.somesite.com/css/main.css" ...but, I understand that  EditorWysiwygModeCss requires a virtual directory value so I need another workaroundt. 

    NOTE
    : I'm not using CuteEditor's save method. I wrote my own that grabs cntrlCuteEditor.XHTML and writes that value to the database.


  •  12-09-2005, 2:00 PM 13640 in reply to 13570

    Re: Two Scenarios

    Adam,

    I know you must be very busy and this is free support so I don't want to type in uppercase or create a thread with "URGENT" in the title. However, if you do find time to respond to this it would be appreciated.

    I've included a quick diagram below which basically illustrates my environment mentioned in the first post of this thread. I hope this helps to paint a better picture for you.

    Thanks,
    Clay


  •  12-09-2005, 3:34 PM 13643 in reply to 13570

    Re: Two Scenarios

    Clay,
     
    In the "/external/sitename/mockup/uploads/images/oarlogo.gif", what's your wwwroot path?

    Can you explain your file structure?

    For example

    /bin
    /edit.aspx
    /CuteSoft_clients/CuteEditor/



     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  12-09-2005, 3:53 PM 13645 in reply to 13643

    Re: Two Scenarios

    Adam,

    Please note that the fileserver3 in red below is on our external network. fileserver2 in blue is on our internal network.

    My wwwroot path for that is:

    \\fileserver3\sharename\Inetpub\wwwroot\

    The entire full path to the image would be:

    \\fileserver3\sharename\Inetpub\wwwroot\siteName\mockup\uploads\images\oarlogo.gif



    My file structure is as follows: (note, I installed the CuteEditor.dll into the GAC per these instructions which works great, so I don't have a CuteEditor.dll in my \cms_admin\bin directory)

    \\fileserver2\sharename\Inetpub\wwwroot\
            \cms_admin
                 \bin
                       cms_admin.dll
                       ourframework.dll

                 editpage.aspx  <-- this is the page (and related editpage.vb) that uses the CuteEditor control.
           
            \CuteEditor
                 \bin
                 \Configuration
                 \Dialogs
                 \Help
                 \ImageEditor
                 \Images
                 \Languages
                 \Templates
                 \Themes
             




     
  •  12-09-2005, 4:07 PM 13646 in reply to 13645

    Re: Two Scenarios

    Clay,

    Can you create a virtual diractory (name it mockup) under \\fileserver2\sharename\Inetpub\wwwroot\ and point it to \\fileserver3\sharename\Inetpub\wwwroot\siteName\mockup\?

     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  12-09-2005, 4:15 PM 13647 in reply to 13646

    Re: Two Scenarios

    Adam,

    I can, but that won't be a viable long-term approach for us which is why the virtual directory I created named external points to one level higher at \\fileserver3\sharename\Inetpub\wwwroot\siteName


    I'll do this though and post back here with my results.

    Thanks for the assistance on this Adam.
  •  12-09-2005, 4:56 PM 13651 in reply to 13647

    Re: Two Scenarios

    Adam,

    Creating a virtual directory named "mockup" under \\fileserver2\sharename\Inetpub\wwwroot\ and pointing it to \\fileserver3\sharename\Inetpub\wwwroot\siteName\mockup\ did solve my problem of the images not appearing after I save the changes (as stated in Scenario 1 of the first post in this thread).

    I'm guessing that this is a test you wanted to see the result of. It worked, which is great, but I'm not surprised since the creation of this additional virtual directory named "mockup".

    The reason this isn't a viable long-term solution is because we have various different content at that directory level (\\fileserver3\sharename\Inetpub\wwwroot\siteName\lots of different folders here with content) and we don't want to introduce the ongoing maintenance tasks of creating a new virtual directory for each one, creating new virtual directories each time a new content section is added, etc. I hope that makes sense...so in other words we really want to just have the one virtual directory named external which points here:  \\fileserver3\sharename\Inetpub\wwwroot\siteName   ...and we then programmatically pull in the content folder name (in this example "mockup") from SQL Server at runtime.


  •  12-10-2005, 4:26 PM 13676 in reply to 13651

    Re: Two Scenarios

    cangelly,
     
    If you want to use the absolute path like (\\fileserver3\sharename\Inetpub\wwwroot\siteName\),  you should reference the use the following format:

    <img src="file:\\c:\images\example.gif" width=200 height=200/>

    The following format is not valid:

    <img src="c:\images\example.gif" width=200 height=200/>

    Or

    <img src="\\fileserver3\images\example.gif" width=200 height=200/>

    That's why I suggest you create a virtual directory and use the relative path:

    <img src="/mockup/example.gif" width=200 height=200/>




     
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  12-11-2005, 10:13 PM 13701 in reply to 13676

    Re: Two Scenarios

    Adam,

    If I try to use a an absolute path (for properties such as ImageGalleryPath and EditorWysiwygModeCss) such as this:

    \\fileserver3\images\

    I receive an error stating that a virtual directory is expected. I would never hardcode a drive letter in a production application so that's not really a good option.

    I understand your suggestion for creating a virtual directory that uses a relative path. That's what I'm doing now, just at one directory level higher. Again though, it isn't a good option to make a virtual directory for each and every site (we have 20 separate areas of content and that will continue to increase) which is what this implies:

    <img src="/mockup/example.gif" width=200 height=200/>

    I was just hoping that there was some property or method of the CuteEditor control that I might be missing that would accomodate this kind of environment.

  •  12-12-2005, 5:00 PM 13766 in reply to 13701

    Re: Two Scenarios

    I came up with a workaround for my situation and wanted to share with others that might encounter something similar.

    A few overall settings are:
    • Editor.BaseHref is never assigned a value
    • Editor.UseRelativeLinks = True
    • Editor.RemoveServerNamesFromUrl = True
    • Editor.EditorWysiwygModeCss = "/css/" & stylesheet   ' if internet = 0
    • Editor.EditorWysiwygModeCss = "/external/" & siteName & "/css/" & stylesheet   ' if internet = 1
    Below is my conditional code to handle necessary pathing adjustments.

    'NOTE: If the variable internet = 0 then we're dealing with an intranet site. If internet = 1 then we're dealing with an external web site.

    ' ------------------------------------------------------------------------------------------------------
    ' Pathing adjustment right before the page content (Editor.XHTML) is saved to SQL Server
    '
    ------------------------------------------------------------------------------------------------------
    Dim xhtmlContent As String

    xhtmlContent = cntrlCuteEditor.XHTML

    If (internet = 1) Then
        xhtmlContent = xhtmlContent.Replace("/external/" & siteName, "")
        xhtmlContent = xhtmlContent.Replace("http://www." & siteName & ".com", "")
    End
    If
    xhtmlContent = xhtmlContent.Replace("/" & folderName + "/", "")
    '
    ------------------------------------------------------------------------------------------------------

    ...
    ...

    ' ------------------------------------------------------------------------------------------------------
    ' Pathing adjustment after the page has been saved to SQL Server
    ' and right before the content is then re-assigned to Editor.Text
    ' -----------------------
    -------------------------------------------------------------------------------
    '
    ' Intranet site

    If (internet = 0) Then
        If (pageContent.IndexOf(folderName) < 0) Then
            Editor.Text = pageContent.Replace("uploads", "/" & folderName & "/uploads")
        End If

    ' External web site
    ElseIf (pageContent.IndexOf("http") < 0) Then
        Editor.Text = pageContent.Replace("uploads", "http://www." & siteName & ".com" & "/" & folderName + "/uploads")
    End If
    ' ------------------------------------------------------------------------------------------------------


     The only undesirable effect with this is that once an image is selected with the Insert Image button, the path is /external/siteName/uploads/images/image.jpg in order for the CuteEditor control to display the image. Once I save the page content I strip /external/siteName/ out of the path before updating SQL Server. Then, whenever the page is loaded again to be edited I stuff the image path with the pathing prefix that I need. This works though, and there's no appreciable downside for the end-user.


View as RSS news feed in XML