Re: SAVE button not working in 6.6 version

  •  02-13-2014, 9:30 AM

    Re: SAVE button not working in 6.6 version

    Just for reference, I am pasting the code of the pageeditor.asp file that is having issues with latest version of the editor. This might be helpful.

     

    ======================================================================

     

    <!-- #include file = "ConnStr.asp" -->

    <!-- #include file = "../CuteEditor_Files/include_CuteEditor.asp" -->

    <%

    If Session("sIsLogin") = 1 Then




          Set rsColoring = CreateObject("ADODB.RecordSet")

          sql = "SELECT * from CustomColoring WHERE Active = 1"

          rsColoring.Open sql, objConn


          Set rs       = Server.CreateObject("ADODB.Recordset")

          sql = "SELECT * FROM Graphics ORDER BY ID"

          rs.open sql, objConn


          Do Until rs.EOF

             MyVar = rs("location")

                Select Case MyVar

                      Case "headerimage"

                            imageHeader = rs("imagename")

                            HeaderW = rs("defaultwidth")

                            HeaderH = rs("defaultheight")

                    Case "background"

                            imageBG = rs("imagename")

          End Select

          rs.MoveNext

          Loop

          rs.MoveFirst


          if title = "" then title = GTITLE

    MenuID = request.querystring("mid")


    If MenuID <> "" then

          'response.End()

          Set rsMenu = CreateObject("ADODB.RecordSet")

          sql = "SELECT * from MenuItems WHERE MenuID = " & MenuID


          rsMenu.Open sql, objConn


          MenuItem = replace(rsMenu("MenuItem"), " ", "")

          MenuItem = replace(replace(replace(MenuItem, "'", ""),"/",""),"\","")

    else

          MenuItem = request("menuitem")

    end if




    set fso = server.CreateObject("Scripting.FileSystemObject")


    calendarFileName = server.MapPath(".") & "\..\" & MenuItem & ".html"


    if Not fso.FileExists(calendarFileName) Then

          fso.CopyFile server.MapPath(".") & "\..\default.html", server.MapPath(".") & "\..\" & MenuItem & ".html"

          calendarFileName = server.MapPath(".") & "\..\" & MenuItem & ".html"

    end if


    if request.form("function") <> "save" then

          set calendarTextFile = fso.opentextfile(calendarFileName)

          if not calendarTextFile.AtEndOfLine then

                calendarContent = calendarTextFile.readall

          end if

          calendarTextFile.close

    elseif request.form("function") = "save" then

          on error resume next

          set calendarTextFile = fso.opentextfile(calendarFileName, 2)

          calendarTextFile.write request.form("calendarcontents")

          calendarTextFile.close

          if err.number <> 0 then

                response.Write(err.description)

          else

                response.Write("Saved.")

          end if

          on error goto 0

          response.End()

    end if


    %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">


    <html>


          <head>

                <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">

                <meta name="generator" content="Adobe GoLive">

                <title><%=rsColoring("DefaultTitle")%></title>


                <style>

                <!-- #include file="pta.css" -->

                </style>

                <style type="text/css" media="screen"><!--

    a:link { color: white; font-size: 9pt; font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: bold; line-height: 11pt; text-decoration: none }

    a:visited { color: white; font-size: 9pt; font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: bold; line-height: 11pt; text-decoration: none }

    a:hover { color: #556984; font-size: 9pt; font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: bold; line-height: 11pt; text-decoration: none }

    --></style>

          </head>


          <body background="../images/<%=imageBG%>" bgcolor="#ffffff" leftmargin="0" marginheight="0" marginwidth="0" topmargin="0">

                <div align="center">

                      <br>


          <script language="javascript">

          function xmlhttpPost(url, data) {

                var xmlHttpReq = false;

                var self = this;

                // Mozilla/Safari

                if (window.XMLHttpRequest) {

                      self.xmlHttpReq = new XMLHttpRequest();

                }

                // IE

                else if (window.ActiveXObject) {

                      self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");

                }

                self.xmlHttpReq.open('POST', url, true);

                self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');


                self.xmlHttpReq.onreadystatechange = function() {

                      if (self.xmlHttpReq.readyState == 4) {

                            alert(self.xmlHttpReq.responseText);

                      }

                }

                self.xmlHttpReq.send(data);

          }


          function SaveHtml()

          {

                var editor = obj_CalendarContents;

                contents = editor.getHTML();

                xmlhttpPost("<%= request.ServerVariables("SCRIPT_NAME") %>", "function=save&menuitem=<%=MenuItem%>&CalendarContents=" + escape(contents));

          }


          function redirect()

          {

          // Set the value of the href property of the location object to the address to which we want to redirect users_

                document.location.href = "menueditor.asp";

          }

          </script>


                      <table width="800" border="0" cellspacing="0" cellpadding="0" bgcolor="white" align="center>

                            <tr>

                                  <td colspan="2"><font color="#2e425b"><img src="../images/<%=imageHeader%>" alt="" width="<%=HeaderW%>" height="<%=HeaderH%> border="0"></font></td>

                            </tr>

                            <tr>

                                  <td bgcolor="#FFFFFF" colspan="2">

                                        <h1><%=rsMenu("MenuItem")%> Editor</h1><br><br>

                                        <font color=red><b><%=generalmsg%></b></font>

                                  </td>

                            </tr>

                            <tr>

                                  <td bgcolor="#FFFFFF" colspan="2">

                                        <h1><a style="color: #000000 " href="#" onclick="Popup=window.open('ptool.asp?new=1','Popup','toolbar=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=675,height=580, left=430,top=23'); return false;" target="_blank">+[Picture Utility]</a>

                                  </td>

                            </tr>

                            <tr>

                                  <td bgcolor="#FFFFFF" colspan="2">

                                        <h1><a style="color: #000000 " href="../webpage.asp?mid=<%=MenuID%>" target="_blank">+[Preview page]</a>

                                  </td>

                            </tr>

                            <tr>

                                        <td><div align="center">

                                        <%

                                        Dim editor

                                        Set editor = New CuteEditor

                                        editor.ID = "CalendarContents"

                                        editor.Text = calendarContent

                                        editor.FilesPath = "../CuteEditor_Files"

                                        editor.ImageGalleryPath = "/CuteEditor_Files/images/"

                                        editor.MaxImageSize = 500

                                        editor.ConfigurationPath = "../cute.xml"

                                        editor.Height = 600

                                        editor.Width = 584

                                        editor.AutoParseClasses = true

                                        editor.Draw()

                                        %></div>

                                  </td>

                                  </tr>

                                  <tr>

                                        <td align="center">

                                        <input type="button" name="Submit" value="Save" id="Submit" onClick="SaveHtml();" />

                                        <input type="button" name="Finish" value="Finish" id="Submit" onClick="redirect();" />

                                  </td>

                                  </tr>

                            <tr class="footer">

                                  <td colspan="2" bgcolor=<%=rsColoring("CssFooterColor")%>>

                                        <div align="center">

                                              <!-- #INCLUDE file="footer.asp" -->

                                        </div>

                                  </td>

                            </tr>


          </table>

          </div>

          </body>


    </html>

    <% else

          response.Redirect("default.asp?needlogin=1")

    End if %> 

    ====================================================================== 

View Complete Thread