Re: how to install and use cute editor

  •  03-10-2009, 6:52 AM

    Re: how to install and use cute editor

    Dear Adam,
     
    Thank you very much for your quick reply.
     
    But maybe I was unclear: What I mean is that I don't understand How can I proceed in order to implement the CuteEditor on my existing site.
     
    So, only to clarify, kindly find below the code placed on the page that allows me to modify the existing content:
     

    <%

    %>

    <script  language="JavaScript">
    <!-- Hide from older browsers...

    //Function to check form is filled in correctly before submitting
    function CheckForm () {
     
     var errorMsg = "";
     
     //Check for an News Title
     if (document.frmNews.title.value==""){
      errorMsg += "\n\tTitle \t\t- Enter a title for the News Item";
     }
     
     //Check for an News Title
     if (document.frmNews.shortNews.value==""){
      errorMsg += "\n\tShort News \t- Enter a Short News Item to display";
     }
     
     //Check for news Item
     if (document.frmNews.newsItem.value==""){
      errorMsg += "\n\tNews Item \t- Enter a News Item to post";
     }
     
     //If there is a problem with the form then display an error
     if (errorMsg != ""){
      msg = "____________________________________________________________________\n\n";
      msg += "Your News Item has not been submitted because there are problem(s) with the form.\n";
      msg += "Please correct the problem(s) and re-submit the form.\n";
      msg += "____________________________________________________________________\n\n";
      msg += "The following field(s) need to be corrected: -\n";
      
      errorMsg += alert(msg + errorMsg + "\n\n");
      return false;
     }
     
     return true;
    }

    //Function to format text in the text box
    function FormatTextShort(command, option){
     
       frames.shortMessage.document.execCommand(command, true, option);
       frames.shortMessage.focus();
    }

    //Function to add image
    function AddImageShort(){ 
     imagePath = prompt('Enter the web address of the image', 'http://');    
     
     if ((imagePath != null) && (imagePath != "")){     
      frames.shortMessage.document.execCommand('InsertImage', false, imagePath);
        frames.shortMessage.focus();
     }
     frames.shortMessage.focus();   
    }


    //Function to format text in the text box
    function FormatText(command, option){
     
       frames.message.document.execCommand(command, true, option);
       frames.message.focus();
    }

    //Function to add image
    function AddImage(){ 
     imagePath = prompt('Enter the web address of the image', 'http://');    
     
     if ((imagePath != null) && (imagePath != "")){     
      frames.message.document.execCommand('InsertImage', false, imagePath);
        frames.message.focus();
     }
     frames.message.focus();   
    }


    //Function to clear form
    function ResetForm(){

     if (window.confirm('Are you sure you want to clear the e-mail you have entered?')){
       frames.message.document.body.innerHTML = '';
       return true;
      }
      return false;  
    }

    //Function to open pop up window
    function openWin(theURL,winName,features) {
       window.open(theURL,winName,features);
    }
    // -->
    </script>
    <link href="../../images/delete.css" rel="stylesheet" type="text/css">

    <link href="../../gioia_tours_expert_driver_guides_12_days_tour/default.css" rel="stylesheet" type="text/css" />
    <link href="../../css/style.css" rel="stylesheet" type="text/css" />
    <div align="center">
     <font face="Verdana, Arial, Helvetica, sans-serif" size="2">
     
      <% If strMode = "edit" then
      %>
      <a href="../../gioia_tours_expert_driver_guides_12_days_tour/news/edit_news_item_form.asp?NewsID=<% = Request.QueryString("NewsID") %>">
      <%
     Else
      %>
      </a><a href="../../gioia_tours_expert_driver_guides_12_days_tour/news/add_news_form.asp">
      <%
     End If
     %>
      Click here to use HTML Editor</a><br>
     </font>
    </div>
    <form method=post name="frmNews" action="../../gioia_tours_expert_driver_guides_12_days_tour/news/add_news.asp" onSubmit="return CheckForm();" onReset="return ResetForm();">
     <table border="0" cellspacing="0" cellpadding="1" bgcolor="#ffffff" align="center">
        <tr>
          <td>
            <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#FFFFFF">
              <tr>
                <td height="199">
           <table width="960" border="0" align="center">
            <tr>
             <td colspan="2" class="text" align="left"></td>
            </tr>
            <tr bgcolor="#FFFFFF" >
             <td align="right" width="15%" height="12"></td>
             <td height="12" width="86%"> <input type="text" name="title" size="30" maxlength="100" value="<% = strNewsTitle %>"> </td>
            </tr>
            <tr>
             <td valign="bottom" align="right" height="22"><span class="text"></span></td>
             <td height="22" valign="bottom"><table width="100%" border="0" cellspacing="0" cellpadding="1">
               <tr>
                <td> <select  onChange="FormatTextShort('FontName', selectShortText.options[selectShortText.selectedIndex].value);document.frmNews.selectShortText.options[0].selected = true;" >
                  <option value="0">-- Font Type --</option>
         <option value class="txt_red">Testo Rosso</option>
                  <option value= style="font-family:Arial, Helvetica, sans-serif; font-style:italic; color:#009966;">Arial</option>
                  <option value="Times New Roman, Times, serif sdg">Times</option>
                  <option value="Courier New, Courier, mono">Courier New</option>
                  <option value="Verdana, Arial, Helvetica, sans-serif">Verdana</option>
         <option value="Comic Sans MS">Comic Sans MS</option>
                 </select> <select name="selectShortFontSize" onChange="FormatTextShort('FontSize', selectShortFontSize.options[selectShortFontSize.selectedIndex].value);document.frmNews.selectShortFontSize.options[0].selected = true;" >
                  <option value="0" selected>-- Font Size --</option>
                  <option value="1">1</option>
                  <option value="2">2</option>
                  <option value="3">3</option>
                  <option value="4">4</option>
                  <option value="5">5</option>
                  <option value="6">6</option>
                  <option value="7">7</option>
                 </select> <select name="selectShortFontColour" onChange="FormatTextShort('ForeColor', selectShortFontColour.options[selectShortFontColour.selectedIndex].value);document.frmNews.selectShortFontColour.options[0].selected = true;" >
                  <option value="0" selected>-- Font Colour --</option>
                  <option value="black">Black</option>
                  <option value="white">White</option>
                  <option value="blue">Blue</option>
                  <option value="red">Red</option>
                  <option value="green">Green</option>
                  <option value="yellow">Yellow</option>
                  <option value="orange">Orange</option>
                  <option value="brown">Brown</option>
                  <option value="magenta">Magenta</option>
                  <option value="cyan">Cyan</option>
                  <option value="limegreen">Lime Green</option>
                 </select> </td>
               </tr>
               <tr>
                <td><img src="../../gioia_tours_expert_driver_guides_12_days_tour/news/news_images/post_button_cut.gif" width="25" height="24" align="absmiddle" onClick="FormatTextShort('cut')" style="cursor: hand;" alt="Cut"> <img src="../../gioia_tours_expert_driver_guides_12_days_tour/news/news_images/post_button_copy.gif" width="25" height="24" align="absmiddle" onClick="FormatTextShort('copy')" style="cursor: hand;" alt="Copy"> <img src="../../gioia_tours_expert_driver_guides_12_days_tour/news/news_images/post_button_paste.gif" width="25" height="24" align="absmiddle" onClick="FormatTextShort('paste')" style="cursor: hand;" alt="Paste"> <img src="../../gioia_tours_expert_driver_guides_12_days_tour/news/news_images/post_button_bold.gif" width="25" height="24" align="absmiddle" alt="Bold" onClick="FormatTextShort('bold', '')" style="cursor: hand;">
                 <img src="../../gioia_tours_expert_driver_guides_12_days_tour/news/news_images/post_button_italic.gif" width="25" height="24"  align="absmiddle" alt="Italic" onClick="FormatTextShort('italic', '')" style="cursor: hand;"> <img src="../../gioia_tours_expert_driver_guides_12_days_tour/news/news_images/post_button_underline.gif" width="25" height="24" align="absmiddle" alt="Underline" onClick="FormatTextShort('underline', '')" style="cursor: hand;"> <img src="../../gioia_tours_expert_driver_guides_12_days_tour/news/news_images/post_button_left_just.gif" width="25" height="24" align="absmiddle" onClick="FormatTextShort('JustifyLeft', '')" style="cursor: hand;" alt="Left Justify">
                 <img src="../../gioia_tours_expert_driver_guides_12_days_tour/news/news_images/post_button_centre.gif" width="25" height="24" align="absmiddle" border="0" alt="Centre Justify" onClick="FormatTextShort('JustifyCenter', '')" style="cursor: hand;"> <img src="../../gioia_tours_expert_driver_guides_12_days_tour/news/news_images/post_button_right_just.gif" width="25" height="24" align="absmiddle" onClick="FormatTextShort('JustifyRight', '')" style="cursor: hand;" alt="Right Justify"> <img src="../../gioia_tours_expert_driver_guides_12_days_tour/news/news_images/post_button_list.gif" width="25" height="24" align="absmiddle" border="0" alt="Unordered List" onClick="FormatTextShort('InsertUnorderedList', '')" style="cursor: hand;">
                 <img src="../../gioia_tours_expert_driver_guides_12_days_tour/news/news_images/post_button_outdent.gif" width="25" height="24" align="absmiddle" onClick="FormatTextShort('Outdent', '')" style="cursor: hand;" alt="Outdent"> <img src="../../gioia_tours_expert_driver_guides_12_days_tour/news/news_images/post_button_indent.gif" width="25" height="24" align="absmiddle" border="0" alt="Indent" onClick="FormatTextShort('indent', '')" style="cursor: hand;"> <img src="../../gioia_tours_expert_driver_guides_12_days_tour/news/news_images/post_button_hyperlink.gif" width="25" height="24" align="absmiddle" border="0" alt="Add Hyperlink" onClick="FormatTextShort('createLink')" style="cursor: hand;">
                 <img src="../../gioia_tours_expert_driver_guides_12_days_tour/news/news_images/post_button_image.gif" width="25" height="24" align="absmiddle" border="0" alt="Add Image" onClick="AddImageShort()" style="cursor: hand;"> </td>
               </tr>
              </table></td>
            </tr>
            <tr>
             <td valign="top" align="right"></td>
             <td valign="bottom"> <%
    'This bit creates a random number to add to the end of the iframe link as IE will cashe the page
    'Randomise the system timer
    Randomize Timer
    %> <script language="javascript">
         
           //Create an iframe and turn on the design mode for it
           document.write ('<iframe src="adv_message_textbox.asp?NoCache=<% = CInt(RND * 2000) %><% If strMode = "edit" Then Response.Write("&mode=edit&NewsItem=" & CLng(Request.QueryString("NewsID"))) %>&item=short" id="shortMessage" width="790" height="500"></iframe>')
                         frames.shortMessage.document.designMode = "On";
                     
                        </script>
              <!-- Display a message for IE users with JavaScript turned off -->
              <noscript>
              <br>
             
              JavaScript must be enabled on your web browser for you to you the WYSIWYG e-mail editor!</noscript> </td>
            </tr>
            <tr>
             <td valign="bottom" align="right" width="15%"></td>
             <td width="960" valign="bottom"> <table width="100%" border="0" cellspacing="0" cellpadding="1">
              
               <tr>
               
               </tr>
              </table></td>
            </tr>
            <tr>
             <td valign="top" align="right" width="15%" ></td>
             <td width="960" valign="top"> <%
    'This bit creates a random number to add to the end of the iframe link as IE will cashe the page
    'Randomise the system timer
    Randomize Timer
    %> <script language="javascript">
         
           //Create an iframe and turn on the design mode for it
           document.write ('<iframe src="adv_message_textbox.asp?NoCache=<% = CInt(RND * 2000) %><% If strMode = "edit" Then Response.Write("&mode=edit&NewsItem=" & CLng(Request.QueryString("NewsID"))) %>&item=long" id="message" width="0" height="0"></iframe>')
                         frames.message.document.designMode = "On";
                     
                        </script>
              <!-- Display a message for IE users with JavaScript turned off -->
              <noscript>
             
              JavaScript must be enabled on your web browser for you to you the WYSIWYG e-mail editor!</noscript> </td>
            </tr>
            <tr>
             <td valign="top" align="right"></td>
             <td align="center">
              </td>
            </tr>
           
            <td>
      
      </div></td>
            </tr>
           </table>
                </td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
     
     
     
     
     
     
     
     
      <div align="center"> <input type="hidden" name="mode" value="<% = strMode %>"> <input type="hidden" name="NewsID" value="<% = lngNewsID %>">
              <input name="shortNews" type="hidden" id="shortNews" value="">
              <input type="hidden" name="newsItem" value=""> <input type="hidden" name="browser" value="IE">
                                <%
                                If strMode="edit" Then
                                %> <input type="submit" name="Submit" value="Update Web Page" OnClick="document.frmNews.newsItem.value = frames.message.document.body.innerHTML; document.frmNews.shortNews.value = frames.shortMessage.document.body.innerHTML;"> <%
                                Else
                                %> <input type="submit" name="Submit" value="Add News Item" OnClick="document.frmNews.newsItem.value = frames.message.document.body.innerHTML; document.frmNews.shortNews.value = frames.shortMessage.document.body.innerHTML;"> <%
                                End If
                                %>  </div>
     
     
     
     
    </form>
     
     
     
     
    Do you have any suggestion on it ?
     
    Many thanks
View Complete Thread