Live Support, Chat and HTML Editor
Welcome to Support forums Sign in | Join | Help Messenger
in Search

Select an image outside of Cute Editor?

Last post 07-17-2007, 3:09 PM by dotcom. 20 replies.
Page 1 of 2 (21 items)   1 2 Next >
Sort Posts: Previous Next
  •  04-22-2005, 9:33 AM 6050

    Select an image outside of Cute Editor?

    Hi,
     
    I'm creating a CMS for a website and I need to give users the ability to enter info related to articles that they wish to post to the site. Among the fields are Date, Title, Body and Thumbnail Image. The Date and Title I take care of with regular text input boxes, the Body is sorted with Cute Editor, however, the Thumbnail Image has me stuck...I would like to use the Cute Editor Insert Image window to allow users to either select an existing image, or to upload a new one from their PC.
     
    The thing is, I don't want them to necessarily see the Cute Editor interface just for this...it would be preferred if the Editor were "hidden" and the Insert Image were invoked by clicking on a button. Once they have selected/uploaded their image, the src for that image would then be passed to a hidden input field for when the user hits the Submit button.
     
    Has anyone been able to do anything similar? I would be very interested in any info on how to go about this.
     
    Thanks in advance.
  •  04-25-2005, 2:37 PM 6117 in reply to 6050

    Re: Select an image outside of Cute Editor?

    20+ views and no replies? Was I too ambiguous with my problem? Or has nobody come across a similar situation?
  •  04-29-2005, 2:34 PM 6312 in reply to 6117

    Re: Select an image outside of Cute Editor?

    Any thoughts Adam?
  •  04-29-2005, 2:41 PM 6313 in reply to 6312

    Re: Select an image outside of Cute Editor?

    optik,

    I think the user (iTim)  find a solution to call the 'Downloadable Files' dialog window from outside the editor.
     
    This is jjano's input

    How to: Use the image selector from CuteEditor outside of the editor itself
     
     
    Hope it helps.
     
     

    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

  •  05-01-2005, 4:16 PM 6336 in reply to 6313

    Re: Select an image outside of Cute Editor?

    Adam,
    The link you provided was to iTim's profile, and even after searching for all his posts, I still haven't found the thread regarding calling the downloadable files dialog window from outside the editor. Could you provide me with the direct link to the thread please.
     
    Thanks.
  •  05-01-2005, 6:16 PM 6339 in reply to 6336

    Re: Select an image outside of Cute Editor?

    optik,
     
    iTim didn't get a chance post his solution in the forums. Please contact iTim by sending him email through the forums and PM.
     
     

    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

  •  05-02-2005, 8:28 AM 6346 in reply to 6339

    Re: Select an image outside of Cute Editor?

    Ah, now I understand. Sorry about that.
     
    Thanks!
  •  05-03-2005, 3:41 PM 6379 in reply to 6346

    Re: Select an image outside of Cute Editor?

    No reply from iTim...

    Can you tell me what js function I need to call in order to invoke the Insert Image window please Adam...
     
    I'm trying to do something like the following:

     
    [myButton] --> onclick = "callImageInsert()"
     


    function callImageInsert()
    {
    var editor1 = document.getElementById('<%=Editor1.ClientID%>');

    var editdoc=editor1.GetDocument();

    editdoc.insertImage();
    }
     
     
    Understand?
  •  05-03-2005, 6:25 PM 6381 in reply to 6379

    Re: Select an image outside of Cute Editor?

    I figured it out!!!
     
    I ended up finding little bits and pieces here and there on the forums...specifically...
    and
     
    Piecing them together, I was able to get the desired effect...if anyone should ever need help with something like this, you can try to get a hold of me at slyczar at gmail.com
     
    Thanks for all your help nonetheless.
     
    Thanks to this breakthrough, I've recommended that we go ahead and purchase our Developer Team License!
  •  05-15-2006, 12:08 PM 19159 in reply to 6381

    Re: Select an image outside of Cute Editor?

    Guys,
     
    We put everything together and create an online demo:
     

    How to use CuteEditor as an image selector?
    How to use CuteEditor as an image selector?( Demo1 |  Demo2 )
    This example demonstrates how to use CuteEditor as an image selector


    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

  •  05-16-2006, 1:25 PM 19196 in reply to 19159

    Re: Select an image outside of Cute Editor?

    How can i access the source-code of the above mentioned demo?
     
    Regards
    Fredrik
  •  05-16-2006, 1:35 PM 19197 in reply to 19196

    Re: Select an image outside of Cute Editor?

    Fredrik,
     
    Please download the version 5.3.
     
    The source code of the above example is included in the download package.
     
     

    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

  •  07-10-2007, 5:54 PM 31448 in reply to 19159

    Re: Select an image outside of Cute Editor?

    The demo is great, and I have successfully adapted it for a site that needed to use the Image and File dialogs at times without showing the editor (Javascript code listed below). Using CuteEditor .NET 6 (.NET 1.1). It all works perfectly with IE7.
     
    However, that's as good as it gets. With Firefox 2.0.0.3 it displays the insert image dialog but when you select an image, it throws various errors (see below) and doesn't return to the calling script.
     
    With Opera 9.2 it doesn't even show the dialog, nor on the Mac. See below for Opera error.
     
    I suspect the problems have to do with the way the editor is rendered in each browser, but don't know how to resolve this. Can anyone help, please?
     
    Paul
     
     
    Firefox Errors
    Error: obj has no properties
    Source File: http://etrader.lab.dotcomsoftwaresolutions.co.uk/CuteSoft_Client/CuteEditor/Dialogs/Load.ashx?type=dialogscript&file=Dialog_InsertGallery.js
    Line: 1
     
    Error: cell.all has no properties
    Source File: http://etrader.lab.dotcomsoftwaresolutions.co.uk/BackOffice/UpdateShop.aspx
    Line: 38
     
    Error: cell.all has no properties
    Source File: http://etrader.lab.dotcomsoftwaresolutions.co.uk/BackOffice/UpdateShop.aspx
    Line: 38
     
    Error: editdoc has no properties
    Source File: http://etrader.lab.dotcomsoftwaresolutions.co.uk/CuteSoft_Client/CuteEditor/Dialogs/Load.ashx?type=dialogscript&file=Dialog_InsertGallery.js
    Line: 1
     
    Opera Error
    Event thread: click
    Error:
    name: TypeError
    message: Statement on line 5: Type mismatch (usually a non-object value used where an object is required)
    Backtrace:
      Line 5 of linked script http://etrader.lab.dotcomsoftwaresolutions.co.uk/Script/Resource.js
        editor.FocusDocument();
      Line 1 of  script
        callInsertImage("CE_editLogo_ID", "hidLogo");
      At unknown location
        [statement source code not available]
     
    Javascript Code
    function callInsertImage(editorClientId, targetControl)
    {
       var editor = document.getElementById(editorClientId);
       editor.FocusDocument();
       var editdoc = editor.GetDocument(); 
       editor.ExecCommand('new');
       editor.ExecCommand('ImageGalleryByBrowsing');
       InputURL(editorClientId, targetControl);
    }
    function InputURL(editorClientId, targetControl)

       var editor = document.getElementById(editorClientId);
       var editdoc = editor.GetDocument();
       var imgs = editdoc.getElementsByTagName("img");
       if(imgs.length>0) 
       {
          var filename = imgs[imgs.length-1].src;
          document.getElementById(targetControl).value = filename;
       }
       else
       {
          document.getElementById(targetControl).value = "";
       } 
       document.forms["Form1"].submit();
    }

    Paul Taylor
    Dotcom Software Solutions
    Filed under:
  •  07-11-2007, 6:55 PM 31488 in reply to 31448

    Re: Select an image outside of Cute Editor?

    OK, I have solved some of the problems here. In my Javascript, I had not allowed for the fact that Mozilla and Opera open the Insert Image dialog asynchronously, so the code has to loop waiting for the user to select an image. In the sample code that ships with CE 6.0, the setTimeout command is used for this purpose (see below).
     
    However, there's still a problem with this. If the user clicks the cancel button on the dialog, the javascript keeps running in a loop until the browser is closed. Apart from being inefficient, this leaves no way of taking an alternative action on cancel, which I need to do. Is there no other way of determining that the dialog has been closed other than testing to see if an image has been selected?
     
    Any help appreciated.
     
    Paul
     
    <Script Language="javascript">
        function callInsertImage() 
        { 
       var editor1 = document.getElementById('<%=Editor1.ClientID%>');
                editor1.FocusDocument(); 
                var editdoc = editor1.GetDocument(); 
                editor1.ExecCommand('new');
                editor1.ExecCommand('ImageGalleryByBrowsing');
                InputURL();
                document.getElementById("imageFld").focus();
        }   
       
        function InputURL()
        {
      var editor1 = document.getElementById('<%=Editor1.ClientID%>');
            var editdoc = editor1.GetDocument(); 
            var imgs = editdoc.getElementsByTagName("img");
            if(imgs.length>0) 
            { document.getElementById("imageFld").value = imgs[imgs.length-1].src;
            } 
            else
            {
       setTimeout(InputURL,500);
            } 
        }      
    </script>

    Paul Taylor
    Dotcom Software Solutions
  •  07-12-2007, 12:56 PM 31501 in reply to 31488

    Re: Select an image outside of Cute Editor?

    Paul,
     
    The following example has been tested in all browsers. Please download the version 6.0 and find the source code of this example. Please make sure this example works for you first. Then modify it to meet your requirements.
     
    How to use CuteEditor as an image selector?
    How to use CuteEditor as an image selector?( Demo1 |  Demo2 )
    This example demonstrates how to use CuteEditor as an image selector

    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

Page 1 of 2 (21 items)   1 2 Next >
View as RSS news feed in XML