Re: Problem : CE as file manager does not insert file in input.

  •  11-28-2008, 2:12 PM

    Re: Problem : CE as file manager does not insert file in input.

    The online demo is fixed.
     
    Please use the following code:
     
    <?php include_once("CuteEditor_Files/include_CuteEditor.php") ; ?>
    <html> 
        <head>
      <title>Use CuteEditor as file manager -- PHP Content Management, PHP WYSIWYG, PHP HTML Editor, PHP Text Editor</title>
       <link rel="stylesheet" href="php.css" type="text/css" />
     </head>
        <body>
     <form name="theForm" action="Get_HtmlContent.php" method="post">
         <h1>Use CuteEditor as a file manager</h1>
         <hr />
         <div class="infoBox">This example demonstrates how to use CuteEditor as an image selector.</div>
         <br />
            <input name="imageFld" type="text" id="imageFld" style="width:300px;" />
            <input name="Change" id="Change" type="button" value="File Manager" onclick="callInsertImage()" />  
          <br />
             
              <?php
                  $editor=new CuteEditor();
                  $editor->ID="Editor1";
                  $editor->Text="";
                  $editor->FilesPath="CuteEditor_Files";
                  $editor->ShowBottomBar=false;
                  $editor->AutoConfigure="None";
                  $editor->ThemeType="OfficeXP";
                  $editor->Width=1;
                  $editor->Height=1;
                  $editor->Draw();
                  $ClientID=$editor->ClientID();
                  $editor=null;
                 
                  //use $_POST["Editor1"]to catch the data
              ?>
          <br/><br/> 
                    
                  <Script Language="javascript">
                    function callInsertImage() 
                    { 
                        var editor1 = document.getElementById('CE_Editor1_ID');
                        editor1.FocusDocument(); 
                        var editdoc = editor1.GetDocument(); 
                        editor1.ExecCommand('new');
                        editor1.ExecCommand('insertdocument');
                        InputURL();
                        document.getElementById("imageFld").focus();
                    }   
                   
                    function InputURL()
                    {
                        var editor1 = document.getElementById('CE_Editor1_ID');
                        var editdoc = editor1.GetDocument(); 
                        var links = editdoc.getElementsByTagName("a");
                      if(links.length>0&&links[links.length-1].href!="") 
                        { 
                          document.getElementById("imageFld").value = links[links.length-1].href;
                        } 
                        else
                        {
                          setTimeout(InputURL,500);
                        } 
                    }      
                </script>
      </form>
     </body>
    </html>

    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

View Complete Thread