We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20413
    • 2,877 Posts
    @uxello is that what’s going on here: http://modxcms.com/forums/index.php/topic,60277.0.html
      @hawproductions | http://mrhaw.com/

      Infograph: MODX Advanced Install in 7 steps:
      http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

      Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
      http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
      • 31178
      • 128 Posts
      Quote from: mrhaw at Feb 07, 2011, 11:19 AM

      @uxello is that what’s going on here: http://modxcms.com/forums/index.php/topic,60277.0.html

      Interesting thought but I don’t think so, as the fix I am suggesting is just for the frontend Quick Manager interface where the dirty flags need intercepting due to the fact that the iFrame window is simply closed from the Quick Manager cancel logic.
        • 16610
        • 634 Posts
        Quote from: uxello at Feb 07, 2011, 10:22 AM


        I have another suggestion for you Mikko ;-)

        When modifiying the resource content as a richtext field (TinyMCE) and then cancelling it brings up a ’Are you sure you want to navigate away...’ message from the TinyMCE autosave feature. But this is too late as the window is already closing. Also a modified standard text field change is not trapped due to the documentDirty=false statement in the cancel button.

        I worked around these issues by checking the TinyMCE dirty status in the onclick javascript. Thus the save and cancel buttons at around line 700ish of qm.inc.php could become:

        // Add action buttons --- uxello fix nav away messages
        $mc->addLine('var controls = "<div style=\"padding:4px 0;position:fixed;top:10px;right:-10px;z-index:1000\" id=\"qmcontrols\" class=\"actionButtons\"><ul><li><a href=\"#\" onclick=\"documentDirty=false;document.mutate.save.click();return false;\"><img src=\"media/style/'.$qm_theme.'/images/icons/save.png\" />'.$_lang['save'].'</a></li><li><a href=\"#\"  onclick=\"	alertcancel=documentDirty; 	 if (typeof(tinyMCE)!==\'undefined\') {var i, t = tinyMCE.editors;for (i in t){    if (t.hasOwnProperty(i)){        if (t[i].isDirty() ) alertcancel =true; }}}   continuecancel=true;				if (alertcancel) {continuecancel = confirm(\'Document has been modified. Continue cancel (changes will be lost)?\');} if (continuecancel) {  documentDirty=false;         if (typeof(tinyMCE)!==\'undefined\') {   var i, t = tinyMCE.editors;for (i in t){    if (t.hasOwnProperty(i)){    t[i].isNotDirty=true }}  }                        parent.'.$jq_mode.'.fn.colorbox.close();}  return false;\"><img src=\"media/style/'.$qm_theme.'/images/icons/stop.png\"/>'.$_lang['cancel'].'</a></li></ul></div>";');
        


        The code is a bit of a mess at the moment but it works ok for one TinyMCE editor in the resource. I have not figured out how to account for having a richtext TV. If you change the text in another TinyMCE instance then switch to one that has not been altered and cancel then it does not work... also no language config for the confirm so only 90% there.
        Of course if you are not using TinyMCE as the rich text editor it does not help!

        UPDATE: Now got it working for multiple TinyMCE instances.


        That sure looks like a intimidating line of code wink I’ll add this to todo list. Thanks again Uxello, your suggestions are always welcome!
          Mikko Lammi, Owner at Maagit
          • 31178
          • 128 Posts
          Quote from: Lammikko at Feb 08, 2011, 12:12 AM

          Quote from: uxello at Feb 07, 2011, 10:22 AM


          I have another suggestion for you Mikko ;-)

          When modifiying the resource content as a richtext field (TinyMCE) and then cancelling it brings up a ’Are you sure you want to navigate away...’ message from the TinyMCE autosave feature. But this is too late as the window is already closing. Also a modified standard text field change is not trapped due to the documentDirty=false statement in the cancel button.

          I worked around these issues by checking the TinyMCE dirty status in the onclick javascript. Thus the save and cancel buttons at around line 700ish of qm.inc.php could become:

          // Add action buttons --- uxello fix nav away messages
          $mc->addLine('var controls = "<div style=\"padding:4px 0;position:fixed;top:10px;right:-10px;z-index:1000\" id=\"qmcontrols\" class=\"actionButtons\"><ul><li><a href=\"#\" onclick=\"documentDirty=false;document.mutate.save.click();return false;\"><img src=\"media/style/'.$qm_theme.'/images/icons/save.png\" />'.$_lang['save'].'</a></li><li><a href=\"#\"  onclick=\"	alertcancel=documentDirty; 	 if (typeof(tinyMCE)!==\'undefined\') {var i, t = tinyMCE.editors;for (i in t){    if (t.hasOwnProperty(i)){        if (t[i].isDirty() ) alertcancel =true; }}}   continuecancel=true;				if (alertcancel) {continuecancel = confirm(\'Document has been modified. Continue cancel (changes will be lost)?\');} if (continuecancel) {  documentDirty=false;         if (typeof(tinyMCE)!==\'undefined\') {   var i, t = tinyMCE.editors;for (i in t){    if (t.hasOwnProperty(i)){    t[i].isNotDirty=true }}  }                        parent.'.$jq_mode.'.fn.colorbox.close();}  return false;\"><img src=\"media/style/'.$qm_theme.'/images/icons/stop.png\"/>'.$_lang['cancel'].'</a></li></ul></div>";');
          


          The code is a bit of a mess at the moment but it works ok for one TinyMCE editor in the resource. I have not figured out how to account for having a richtext TV. If you change the text in another TinyMCE instance then switch to one that has not been altered and cancel then it does not work... also no language config for the confirm so only 90% there.
          Of course if you are not using TinyMCE as the rich text editor it does not help!

          UPDATE: Now got it working for multiple TinyMCE instances.


          That sure looks like a intimidating line of code wink I’ll add this to todo list. Thanks again Uxello, your suggestions are always welcome!

          Hi again Mikko, I have reworked my code and also made it take account of clicking the close (cross) in the bottom right of the colorbox to clear any doc diry settings as it cannot be trapped by that stage (using cbox_cleanup binding). Modified file attached. Seach for ’uxello’ comments to find the changes. Hope it might be useful for you.

            • 16610
            • 634 Posts
            Quote from: uxello at Mar 01, 2011, 08:56 AM

            Hi again Mikko, I have reworked my code and also made it take account of clicking the close (cross) in the bottom right of the colorbox to clear any doc diry settings as it cannot be trapped by that stage (using cbox_cleanup binding). Modified file attached. Seach for ’uxello’ comments to find the changes. Hope it might be useful for you.

            Thank you Uxello, great work once again! I’m currently occupied in non-MODX-related project but I’ll return to QM+ development as soon as I’ll have the time.
              Mikko Lammi, Owner at Maagit