Loading ...
Sorry, an error occurred while loading the content.

Can anyone help with yui text editor

Expand Messages
  • zoranpekez
    Can anyone help with yui text editor I have used Ritch text editor form yui library, and it posts texts to my forum fine. However, there is a problem with
    Message 1 of 2 , Aug 29, 2009
    • 0 Attachment
      Can anyone help with yui text editor
      I have used Ritch text editor form yui library, and it posts texts to my forum fine.
      However, there is a problem with deleting texts form the forum pages, because, I can not make delete button perform the following function.

      When editing and also deleting a thread, variable $vars needs to be sent together with the post. Diference is that when editing, on submit the page posts on itself, while when deleting the page is posted to kill.php.

      // to specify the extra trailing variables to send via POST along with the form I use:
      $vars = ($postID ? "?postID=".$postID : ($new_thread ? "?new_thread=true" : ""));

      // if this is a post edit, create $vars that will delete the post if sent to kill.php
      else if submited on itself and if this is a new thread, than if will edit the text or submit a new thread.
      // this uses the javascript function from forum.inc to prompt the user
      // to make sure theyre sure
      if ($postID) {
      $vars = "?postID=".$postID;
      echo "<FORM onSubmit='return areYouSure(\"Do you really want to remove this post?\")'
      ACTION='kill.php?postID=".$postID."' METHOD='POST'>";
      }

      Now this is from file YUI.js that controls the Rich Text Editor:

      YAHOO.util.Event.onDOMReady(initialiseMe);


      function initialiseMe() {
      var postEditor = new YAHOO.widget.Editor('postBody',{
      height:'200px',
      width:'575px',
      dompath:true,
      animate:true,
      hadleSubmit:false
      });
      postEditor.render();

      // and this creates panel that holds the text editor:

      var postBodyPanel=new YAHOO.widget.Panel('win',{
      width:'600px',
      fixedcenter:false,
      underlay:'shadow',
      close:false,
      visible:true
      });
      //postBodyPanel.setHeader("");


      // and this creates the spaceholders for submit and delete buttons:

      postBodyPanel.setFooter("<div id='submitBTN'></div><div id='deleteBTN'></div>");


      //setup submit button
      var oSubmitButton = new YAHOO.widget.Button({
      id: 'submitButton',
      type:'button',
      label:'Submit',
      container:'submitBTN'
      });
      //event hedling
      oSubmitButton.addListener('click',function() {
      postEditor.saveHTML();
      document.postEntry.submit();
      });


      postBodyPanel.render();
      }


      Can you suggest how to create delete button as well.
    • zoran pekez
      Can anyone help with yui text editor I have used Ritch text editor form yui library, and it posts texts to my forum fine.  However, there is a problem with
      Message 2 of 2 , Aug 30, 2009
      • 0 Attachment
        Can anyone help with yui text editor
        I have used Ritch text editor form yui library, and it posts texts to my forum fine.
         However, there is a problem with deleting texts form the forum pages, because, I can not make delete button perform the following function.

        When editing and also deleting a thread, variable $vars needs to be sent together with the post. Diference is that when editing, on submit the page posts on itself, while when deleting the page is posted to kill.php.

        // to specify the extra trailing variables to send via POST along with the form I use:
        $vars = ($postID ? "?postID=".$postID : ($new_thread ? "?new_thread=true" : ""));

        // if this is a post edit, create $vars that will delete the post if sent to kill.php
         else if submited on itself and if this is a new thread, than if will edit the text or submit a new thread.
        // this uses the javascript function from forum.inc to prompt the user
        // to make sure theyre sure
        if ($postID) {
            $vars = "?postID=".$postID;
            echo "<FORM onSubmit='return areYouSure(\"Do you really want to remove this post?\")'
                ACTION='kill.php?postID=".$postID."' METHOD='POST'>";
        }

        Now this is from file YUI.js that controls the Rich Text Editor:

        YAHOO.util.Event.onDOMReady(initialiseMe);


        function initialiseMe() {
            var postEditor = new YAHOO.widget.Editor('postBody',{
                            height:'200px',
                            width:'575px',
                            dompath:true,
                            animate:true,
                            hadleSubmit:false
                            });
            postEditor.render();

        // and this creates panel that holds the text editor:

                var postBodyPanel=new YAHOO.widget.Panel('win',{         
                                        width:'600px',
                                        fixedcenter:false,
                                        underlay:'shadow',
                                        close:false,
                                        visible:true
                                                     });   
                //postBodyPanel.setHeader("");
           

        // and this creates the spaceholders for submit and delete buttons:

            postBodyPanel.setFooter("<div id='submitBTN'></div><div id='deleteBTN'></div>");
               

        //setup submit button
                var oSubmitButton = new YAHOO.widget.Button({
                                                    id:    'submitButton',
                                                    type:'button',
                                                    label:'Submit',
                                                    container:'submitBTN'                                           
                                                            });
                //event hedling
                oSubmitButton.addListener('click',function() {
                                            postEditor.saveHTML();
                                            document.postEntry.submit();                               
                                        });
               

                postBodyPanel.render();
            }
           

        Can you suggest how to create delete button as well.

      Your message has been successfully submitted and would be delivered to recipients shortly.