We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 13137
    • 204 Posts
    I am sure that some body most have asked or found out how to add TinyMCE to the summary block, but I have searched, and for the life of me cant find anything about it.

    I would like to add basic bottons to the summary, like Bold, Italic, colors, etc., not the full monty.

    Anyone have some pointers on how to go about in doing this?

    Thanks for any help.
      • 13137
      • 204 Posts
      OK then. Since this is getting plenty of  views, but no answers, I will assume that others may or may not have interest in doing this too, but dont know how. Will, I decided to grow a pair of cajones and finger it out on my own.

      For those of you interested, it was a fairly simple fix, just editing two files, nothing else. And those files are the following:

      manager/actions/mutate_content.dynamic.php
      Line 571 add

      id="mceSummary" after <textarea

      then


      <a style=" text-decoration:none; color:#5F8D00" class="comment" href="javascript:toggleEditor(’mceSummary’);">.:: <img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/logging.gif" alt="Editor" align="absmiddle"> Editor ::.</a>


      before </td>

      so it should now look like:
      <td valign="top"><textarea id="mceSummary" name="introtext" class="inputBox" rows="3" style="width:300px;" onchange="documentDirty=true;"><?php echo htmlspecialchars(stripslashes($content['introtext']));?></textarea>  <img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/b02_trans.gif" onmouseover="this.src='media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/b02.gif';" onmouseout="this.src='media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/b02_trans.gif';" alt="<?php echo $_lang['document_summary_help']; ?>" onclick="alert(this.alt);" style="cursor:help;" spellcheck="true"/><br><a style=" text-decoration:none; color:#5F8D00" class="comment" href="javascript:toggleEditor('mceSummery');">.:: <img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/logging.gif" alt="Editor" align="absmiddle"> Editor ::.</a></td> 


      assets/plugins/tinymce212/tinymce.functions.php
      Line 211 add
      /*--------------// TinyMCE for Summary //---------------*/
      
      // General options
      tinyMCE.init({
      	mode : "none",
          theme : "advanced",
      	editor_selector : "mceSummary",
          plugins : "advimage,emotions,paste",
          theme_advanced_toolbar_align : "left",
          language : 'en',
      
      // Theme options
          theme_advanced_buttons1 : 
      
      "pastetext,pasteword,|,emotions,image,bold,italic,underline,separator,strikethrough,bullist,numlist,undo,redo,foreco
      
      lor,backcolor",
      	theme_advanced_buttons2 : ""
      });
      
      function toggleEditor(id) {
      	if (!tinyMCE.getInstanceById(id))
      		tinyMCE.execCommand('mceAddControl', false, id);
      	else
      		tinyMCE.execCommand('mceRemoveControl', false, id);
      }
      
      /*-------------------// end //-------------------------*/

      Between
      });
      and
      {$tinyCallback}

      Now under the the Summary field, you should see a new icon, that when clicked, will show your editor.
      My copy of TinyMCE was v2.1.2, but it should work the same in later versions if placed between the last comment noted.

      Hope this is of use to someone else...
        • 13137
        • 204 Posts
        This mod works nicely, but could anybody more familiar with TinyMCE tell me:

        How it can select the manager language?
        Right now it has language : ’en’,
        I cant figure out how to select automatically.

        Why it isn’t loading "advanced images" only the normal images with out the browse function?

        Any help would be much appreciated. huh
          • 4018
          • 1,131 Posts
          Instead of hacking the core code, why not just add a template variable for this? Then, if you don’t want the default summary field to show up you could always hide it with the ManagerManager plugin. I’ve been using ManagerManager for a while and find it to be a godsend for hiding unnecessary fields and even relabeling/repurposing fields. I just don’t think hacking the core code is a good idea when there is a workaround that works just as good. A simple richtext template variable will do just fine. smiley
            Jeff Whitfield

            "I like my coffee hot and strong, like I like my women, hot and strong... with a spoon in them."
            • 29076
            • 615 Posts
            Quote from: Bravado at Feb 06, 2009, 08:12 AM

            Instead of hacking the core code, why not just add a template variable for this? Then, if you don’t want the default summary field to show up you could always hide it with the ManagerManager plugin. I’ve been using ManagerManager for a while and find it to be a godsend for hiding unnecessary fields and even relabeling/repurposing fields. I just don’t think hacking the core code is a good idea when there is a workaround that works just as good. A simple richtext template variable will do just fine. smiley
            This is my solution as well. And here you also have the opportunity to remove the richtext TV from parts of your site by making another template and not assign the TV to that template. Easy. smiley
              I think, thererfor I am! But what I am, and why...?
              • 13137
              • 204 Posts
              Please enlighten me some more then.  wink

              I haven’t used ManagerManager therefor have not the slightest idea how to go about setting up a TV to do so.  huh

              Have you already done this? Could you give some step-by-step instructions on how to go about this? (dowloading ManagerManager now...)
                • 30223
                • 1,010 Posts
                ManagerManager comes with excellent documentation (.../plugins/managermanager/docs/) but basically thsi is what you need to:

                Create a new TV,
                Variable Name: mySummary,
                Caption: Summary
                Input Type: RichText
                Leave the rest empty.
                Assign it to the templates you want to use it in.

                Then in mm_rules.inc.php (in the managermanager folder) put these lines:
                <?php
                mm_hideFields('introtext');
                mm_moveFieldsToTab('tvmySummary', 'general');
                


                Then wherever you use [*intro_text*] use [*mySummary*] instead. This will also work with Ditto but you’d have to look that up yourself.

                Wouldn’t it be great if ManagerManager had a mm_synch_fields_on_save(); fucntion? That way you’d be able to synch the two fields with mm_synch_fields_on_save(’mySummary’,’introtext’); The current mm_synch_fields() wouldn’t work as tinyMCE takes control of the TV field content and besides wouldn’t get the chance to run it’s cleanup code. (I’m not even sure if synch_fields works with TVs )
                  • 13137
                  • 204 Posts
                  OK, that works nicely. Much appreciated.
                  The only problem I experienced was needing to add my own copy of JQuiry instead of using Googles.

                  The only down side I see is that there would be times when no summary is entered, and it would be nice if it could create its own summary like Ditto does now, the first XX amount of letters would be used in a blog/news post.

                  The other would be in an upgrade situation, where there is already a intro_text in use.

                  You mentioned a pseudo code:
                  $output = getTemplateVarOutput('mySummary');
                  if(! $output ) $output='[*introtext*]';
                  return $output;


                  Will take a look at that too, But I think it would probably be better just to use the new mySummary and if not in use figure out how to pull some sort of summary over to the post listings.
                    • 4018
                    • 1,131 Posts
                    Ah, great solution! Didn’t think to use ManagerManager and a plugin to top it off. Good idea! laugh
                      Jeff Whitfield

                      "I like my coffee hot and strong, like I like my women, hot and strong... with a spoon in them."
                      • 22770
                      • 285 Posts
                      Quote from: islander at Feb 08, 2009, 03:34 PM


                      You mentioned a pseudo code:
                      $output = getTemplateVarOutput('mySummary');
                      if(! $output ) $output='[*introtext*]';
                      return $output;


                      Will take a look at that too, But I think it would probably be better just to use the new mySummary and if not in use figure out how to pull some sort of summary over to the post listings.

                      You could also use PHx to do this. Admittedly, your little snippet is probably more efficient, but once you’ve started to use PHx in your templates, you’ll find it has a lot of power in such situations.