Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

GuiEdit

Summary: Add graphical editing buttons, as in pmwiki.org's site
Version: n/a
Prerequisites: pmwiki-2.0.0
Status: Stable
Maintainer: Pm
Categories: Editing Layout

Question

Exactly, which part of the script do I copy and paste to use all of the MyGuiEdit buttons? Because I get an error screen when I try to do that. I don't understand.

Question

How can i add these buttons to my wiki?

Question

How do I get the graphical editing buttons on the Edit page?

Answer

Add the following in local/config.php file

  $EnableGUIButtons = 1;

That's all !

Options

Larger buttons

You may find the original buttons a bit small (22x22) so you can find a new set of larger buttons (34x32) here :

These buttons shall be installed in a new subdirectory of /pub directory, e.g. pub/guiedit32.
The following line shall be added in the local/config.php file

 $GUIButtonDirUrlFmt = '$FarmPubDirUrl/guiedit32'; 

New buttons

You can add new buttons by adding their description in local/config.php file.

This script adds a graphical button bar to the edit page form.

The buttons are placed in the $GUIButtons array; each button is specified by an array of five values:

  • the position of the button relative to others (a number)
  • the opening markup sequence
  • the closing markup sequence
  • the default text if none was highlighted
  • the text of the button, either (a) HTML markup or (b) the url of a gif/jpg/png image to be used for the button (along with optional "title" text in quotes).

The position is just an order number, you can have more than a difference of 1 between the numbers, which allow room to insert others buttons later.

The present positions are :

  • 'em' : 100
  • 'strong' : 110
  • 'pagelink' : 200
  • 'extlink' : 210
  • 'attach' : 220
  • 'big' : 300
  • 'small' : 310
  • 'sup' : 320
  • 'sub' : 330
  • 'h2' : 400
  • 'center' : 410

Others buttons, from sample-config file

  • For Heading - the difference with the existing is the image
  $GUIButtons['h2'] = array(400, '\\n!! ', '\\n', '$[Heading]',
                     '$GUIButtonDirUrlFmt/h2.gif"$[Heading]"');

  • For sub-heading
  $GUIButtons['h3'] = array(402, '\\n!!! ', '\\n', '$[Subheading]',
                     '$GUIButtonDirUrlFmt/h3.gif"$[Subheading]"');

  • For indenting text
  $GUIButtons['indent'] = array(500, '\\n->', '\\n', '$[Indented text]',
                     '$GUIButtonDirUrlFmt/indent.gif"$[Indented text]"');

  • For 'outdenting' text (indent start at second line)
  $GUIButtons['outdent'] = array(510, '\\n-<', '\\n', '$[Hanging indent]',
                     '$GUIButtonDirUrlFmt/outdent.gif"$[Hanging indent]"');

  • For ordered list
  $GUIButtons['ol'] = array(520, '\\n# ', '\\n', '$[Ordered list]',
                     '$GUIButtonDirUrlFmt/ol.gif"$[Ordered (numbered) list]"');

  • For unordered (bullet) list
  $GUIButtons['ul'] = array(530, '\\n* ', '\\n', '$[Unordered list]',
                     '$GUIButtonDirUrlFmt/ul.gif"$[Unordered (bullet) list]"');

  • For an horizontal rule
  $GUIButtons['hr'] = array(540, '\\n----\\n', '', '',
                     '$GUIButtonDirUrlFmt/hr.gif"$[Horizontal rule]"');

  • A template of simple table
  $GUIButtons['table'] = array(600,
                     '||border=1 width=80%\\n||$[!Hdr] ||$[!Hdr] ||$[!Hdr] ||\\n'.
                     '||     ||     ||     ||\\n||     ||     ||     ||\\n',
                     '', '', 
                     '$GUIButtonDirUrlFmt/table.gif"$[Table]"');

Miscellaneous buttons

  • Underlining the text
  $GUIButtons ['underline'] = array(95, '{+', '+}', '$[text]',
   '$GUIButtonDirUrlFmt/underline.gif"$[Underline]"'); 
  • A template of advanced table
  $GUIButtons ['advtable'] = array(610, 
    '(:table border=1 width=80%:)\\n(:cellnr:)\'\'\'$[Header]\'\'\'\\n'.
    '(:cell:)\'\'\'$[Header]\'\'\'\\n(:cell:)\'\'\'$[Header]\'\'\'\\n'.
    '(:cellnr:)\\n(:cell:)\\n(:cell:)\\n(:tableend:)\\n',
    '', '', '$GUIButtonDirUrlFmt/table2.gif"$[Advanced table]"'); 

  • Four Buttons for custom block styles. Below they are defined to give coloured backgrounds, but they can easily be changed to other styles using wiki styles definitions (see PmWiki/CustomWikiStyles).
   #Define custom styles s1 to s4:  
   $WikiStyle['s1']['background-color']='#def';
   $WikiStyle['s1']['padding']='3px';
   $WikiStyle['s2']['background-color']='#efd';
   $WikiStyle['s2']['padding']='3px';
   $WikiStyle['s3']['background-color']='#ffb';
   $WikiStyle['s3']['padding']='3px';
   $WikiStyle['s4']['background-color']='#fed';
   $WikiStyle['s4']['padding']='3px';

   #Button definitions creating %block s1% etc markup:
   $GUIButtons ['style1'] = array(500, '%25block s1%25', '', '',
     '$GUIButtonDirUrlFmt/st1.gif"$[Style 1]"');
   $GUIButtons ['style2'] = array(510, '%25block s2%25', '', '',
     '$GUIButtonDirUrlFmt/st2.gif"$[Style 2]"');
   $GUIButtons ['style3'] = array(520, '%25block s3%25', '', '',
     '$GUIButtonDirUrlFmt/st3.gif"$[Style 3]"');
   $GUIButtons ['style4'] = array(530, '%25block s4%25', '', '',
     '$GUIButtonDirUrlFmt/st4.gif"$[Style 4]"');

  • Enclosing text with [@ and @] for code samples.
   $GUIButtons['code'] = array(550, "[@", "@]", '$[Code]',
                  '$GUIButtonDirUrlFmt/code.gif"$[Code]"');

Buttons for Cookbook addons :

   $GUIButtons ['pagetoc'] = array(90, '\\n(:toc:)\\n', '', '',
     '$GUIButtonDirUrlFmt/toc.gif"$[Table of content]"');				

   $GUIButtons ['image'] = array(620, 'Img:', '', '$[MyImage.jpg]',
     '$GUIButtonDirUrlFmt/image.gif"$[Insert image]"');

   $GUIButtons ['snote'] = array(640, '{=', '=}', '$[text]',
     '$GUIButtonDirUrlFmt/snote.gif"$[Sticky note]"');	

  • Signature/datestamp for discussion (imageΔ only for 22x22 set)
   $GUIButtons['sig'] = array(460, '----\\n~~~:\\\\\\\\\n', '\\n ~~~~\\n\\n', '',
                  '$GUIButtonDirUrlFmt/sig.gif"$[Stamp your name and current date]"');
  • Button images for highlighting text and background
   $GUIButtons['hit'] = array(420, '%green%', '%%', '',
   '$GUIButtonDirUrlFmt/hightext.gif"$[Highlight the text color\\n(select text, then click here)]"');
   $GUIButtons['hib'] = array(440, '%bgcolor=yellow%', '%%', '',
                  '$GUIButtonDirUrlFmt/highbg.gif"$[Highlight the paper color]"');

Beautiful GUI Example:

Here the Buttons: MyGuiEdit.zipΔ

DWin - 08-Jan-07

The Listing also includes for the cookbook-add-ons. And I also added the already existing button-definitions, so you are able to shuffle all buttons like you want! (See the variable "$ArrayNumber" and "$SpaceNumber")

###### Excel-Spreads ######
      include_once('cookbook/tabtable.php');

###### Markup Extensions ######
      include_once("cookbook/extendmarkup.php");    # caused change in underline and strikeout
      include_once("cookbook/break_page.php");

###### Table of Content & Quick ToC  ######
      include_once("cookbook/pagetoc.php");
      include_once('cookbook/quicktoc.php');

###### GUI Buttons ######
      $GUIButtonDirUrlFmt = '/PmWiki/pub/MyGuiEdit';
      $GUIButtonSpace1 = '$GUIButtonDirUrlFmt/space1.gif';
      $GUIButtonSpace2 = '$GUIButtonDirUrlFmt/space2.gif';
      $GUIButtonSpace3 = '$GUIButtonDirUrlFmt/space3.gif';
      $GUIButtonSpace4 = '$GUIButtonDirUrlFmt/space4.gif';
      $ArrayCount = 0;
      $SpaceCount = 0;
      $GUIButtons ['pagetoc']     = array($ArrayCount++, '\\n(:toc Table of Contents:)\\n', '', '',
                                    '$GUIButtonDirUrlFmt/toc.gif"$[Table of content]"');
      $GUIButtons ['quicktoc']    = array($ArrayCount++, '\\n(:quicktoc:)\\n', '', '',
                                    '$GUIButtonDirUrlFmt/quicktoc.gif"$[Collapsable TOC]"');
      $GUIButtons [$SpaceCount++] = array($ArrayCount++, '', '', '', $GUIButtonSpace1);
      $GUIButtons ['bold']        = array($ArrayCount++, "'''", "'''", '$[Bold Text]',
                                    '$GUIButtonDirUrlFmt/bold.gif"$[Bold]"');
      $GUIButtons ['italic']      = array($ArrayCount++, "''", "''", '$[Italic Text]',
                                    '$GUIButtonDirUrlFmt/italic.gif"$[Italic]"');
      $GUIButtons ['underline']   = array($ArrayCount++, '{+', '+}', '$[Underlined Text]',
                                    '$GUIButtonDirUrlFmt/underline.gif"$[Underline]"');
      $GUIButtons ['strikout']    = array($ArrayCount++, '{-', '-}', 'Crossed Out Text',
                                    '$GUIButtonDirUrlFmt/strikethrough.gif"Strike Out"');
      $GUIButtons [$SpaceCount++] = array($ArrayCount++, '', '', '', $GUIButtonSpace1);
      $GUIButtons ['sup']         = array($ArrayCount++, "'^", "^'", '$[Superscript]',
                                    '$GUIButtonDirUrlFmt/sup.gif"Superscript"');
      $GUIButtons ['sub']         = array($ArrayCount++, "'_", "_'", '$[Subscript]',
                                    '$GUIButtonDirUrlFmt/sub.gif"Subscript"');
      $GUIButtons [$SpaceCount++] = array($ArrayCount++, '', '', '', $GUIButtonSpace1);
      $GUIButtons ['left']        = array($ArrayCount++, '%25left%25', '', '',
                                    '$GUIButtonDirUrlFmt/left.gif"$[Align Left]"');
      $GUIButtons ['center']      = array($ArrayCount++, '%25center%25', '', '',
                                    '$GUIButtonDirUrlFmt/center.gif"$[Align Center]"');
      $GUIButtons ['right']       = array($ArrayCount++, '%25right%25', '', '',
                                    '$GUIButtonDirUrlFmt/right.gif"$[Align Right]"');
      $GUIButtons [$SpaceCount++] = array($ArrayCount++, '', '', '', $GUIButtonSpace1);
      $GUIButtons ['indent']      = array($ArrayCount++, '\\n->', '\\n', '$[Indented text]',
                                    '$GUIButtonDirUrlFmt/indent.gif"$[Indented text]"');
      $GUIButtons ['outdent']     = array($ArrayCount++, '\\n-<', '\\n', '$[Hanging indent]',
                                    '$GUIButtonDirUrlFmt/outdent.gif"$[Hanging indent]"');
      $GUIButtons [$SpaceCount++] = array($ArrayCount++, '', '', '', $GUIButtonSpace1);
      $GUIButtons ['big']         = array($ArrayCount++, "'+", "+'", '$[Big Text]',
                                    '$GUIButtonDirUrlFmt/big.gif"Big Text"');
      $GUIButtons ['bigger']      = array($ArrayCount++, '[++', '++]', '$[MASSIVE Text]',
                                    '$GUIButtonDirUrlFmt/bigger.gif"Larger Text"');
      $GUIButtons ['small']       = array($ArrayCount++, "'-", "-'", '$[small text]',
                                    '$GUIButtonDirUrlFmt/small.gif"$[small text]"');
      $GUIButtons ['smaller']     = array($ArrayCount++, '[--', '--]', '$[tiny text]',
                                    '$GUIButtonDirUrlFmt/smaller.gif"$[tiny text]"');
      $GUIButtons [$SpaceCount++] = array($ArrayCount++, '', '', '', $GUIButtonSpace1);
      $GUIButtons ['h1']          = array($ArrayCount++, '\\n! ', '\\n', '$[Heading1]',
                                    '$GUIButtonDirUrlFmt/h1.gif"$[Heading1]"');
      $GUIButtons ['h2']          = array($ArrayCount++, '\\n----\\n!! ', '\\n', '$[Heading2]',
                                    '$GUIButtonDirUrlFmt/h2.gif"$[Heading2]"');
      $GUIButtons ['h3']          = array($ArrayCount++, '\\n!!! ', '\\n', '$[Heading3]',
                                    '$GUIButtonDirUrlFmt/h3.gif"$[Heading3]"');
      $GUIButtons ['h4']          = array($ArrayCount++, '\\n!!!! ', '\\n', '$[Heading4]',
                                    '$GUIButtonDirUrlFmt/h4.gif"$[Heading4]"');
      $GUIButtons [$SpaceCount++] = array($ArrayCount++, '', '', '', $GUIButtonSpace1);
      $GUIButtons ['table']       = array($ArrayCount++, '||border=1 width=80%25\\n||!Hdr ||!Hdr ||!Hdr ||\\n
||     ||     ||     ||\\n||     ||     ||     ||\\n', '', '',
                                     '$GUIButtonDirUrlFmt/table.gif"$[Table]"');
#Must be changed to one line!
      $GUIButtons ['advtable']    = array($ArrayCount++, "(:table border=1 width=80%25:)\\n
(:cellnr:)'''Header'''\\n(:cell:)'''Header'''\\n(:cell:)'''Header'''\\n
(:cellnr:)\\n(:cell:)\\n(:cell:)\\n(:tableend:)\\n",'', '',
                                    '$GUIButtonDirUrlFmt/tableadv.gif"$[Advanced table]"');
#Must be changed to one line!
      $GUIButtons ['tabtable']    = array($ArrayCount++, '', '', '',
                                    "<input type='image' name='tabtable' src='\$GUIButtonDirUrlFmt/excel.gif' 
                                    title='$[Convert tabs to table]' />");
#Must be changed to one line - the $ must be escaped !
      $GUIButtons [$SpaceCount++] = array($ArrayCount++, '\\n->', '\\n', '$[2nd Line]', '<br \>');
      $GUIButtons ['pagelink']    = array($ArrayCount++, '[[',']]', '$[Page link]',
                                    '$GUIButtonDirUrlFmt/pagelink.gif"Link to internal page"');
      $GUIButtons ['extlink']     = array($ArrayCount++, '[[',']]', '$[http:// | link text]',
                                    '$GUIButtonDirUrlFmt/extlink.gif"Link to external page"');
      $GUIButtons [$SpaceCount++] = array($ArrayCount++, '', '', '', $GUIButtonSpace1);
      $GUIButtons ['attach']      = array($ArrayCount++, 'Attach:','', '$[file.ext]',
                                    '$GUIButtonDirUrlFmt/attach.gif"Attach File"');
      $GUIButtons ['image']       = array($ArrayCount++, 
                                    '%25rframe text-align=left height=50px margin-top=7px margin-left=10px%25 [[',
                                    " | SameImageName.jpg%22MOUSE HOVER TEXT%22]] | '-SUBTITLE-'", '$[ImageName.jpg]',
                                    '$GUIButtonDirUrlFmt/image.gif"Thumbnail of Image floating right"');
      $GUIButtons ['pdf']         = array($ArrayCount++, '%25lframe text-align=center margin-right=10px%25 [[',
                                    " | Attach:pdf.gif%22MOUSE HOVER TEXT%22]] | '-SUBTITLE-'", '$[PDFfile.pdf]',
                                    '$GUIButtonDirUrlFmt/pdf.gif"$[Link to PDF-File float left]"');
# "Attach:pdf.gif" must be exchanged by the path of your pdf.gif in your GuiEdit-Directory!
      $GUIButtons [$SpaceCount++] = array($ArrayCount++, '', '', '', $GUIButtonSpace1);
      $GUIButtons ['anchor']      = array($ArrayCount++, '[[#', ']]', '$[Anchor Name]',
                                    '$GUIButtonDirUrlFmt/anchor.gif"$[Invisible Anchor to Link To]"');
      $GUIButtons ['anchorlink']  = array($ArrayCount++, '[[#', '| text]]', '$[Anchor Name]',
                                    '$GUIButtonDirUrlFmt/anchorlink.gif"$[Link to Anchor in SAME page]"');
      $GUIButtons ['anchor2']     = array($ArrayCount++, '[[', '#AnchorName | text]]', '$[PageName]',
                                    '$GUIButtonDirUrlFmt/anchor2.gif"$[Link to Anchor on DIFFERENT page]"');
      $GUIButtons [$SpaceCount++] = array($ArrayCount++, '', '', '', $GUIButtonSpace1);
      $GUIButtons ['ol']          = array($ArrayCount++, '\\n# ', '\\n', '$[Ordered list]',
                                    '$GUIButtonDirUrlFmt/ol.gif"$[Ordered (numbered) list]"');
      $GUIButtons ['ul']          = array($ArrayCount++, '\\n* ', '\\n', '$[Unordered list]',
                                    '$GUIButtonDirUrlFmt/ul.gif"$[Unordered (bullet) list]"');
      $GUIButtons ['hr']          = array($ArrayCount++, '\\n----\\n', '', '',
                                    '$GUIButtonDirUrlFmt/hr.gif"$[Horizontal rule]"');
      $GUIButtons [$SpaceCount++] = array($ArrayCount++, '', '', '', $GUIButtonSpace1);
      $GUIButtons ['snote']       = array($ArrayCount++, '{=', '=}', '$[text]',
                                    '$GUIButtonDirUrlFmt/snote.gif"$[Sticky note]"');
      $GUIButtons ['sig']         = array($ArrayCount++, '----\\n[[~]] January 08, 2007, at 12:49 PM', '', '',
                                    '$GUIButtonDirUrlFmt/sig.gif"$[Stamp your name and current date]"');
      $GUIButtons [$SpaceCount++] = array($ArrayCount++, '', '', '', $GUIButtonSpace1);
      $GUIButtons ['textblue']    = array($ArrayCount++, '%25blue%25', '%25%25', '$[Blue Text]',
                                    '$GUIButtonDirUrlFmt/hightextblue.gif"$[Blue Text]"');
      $GUIButtons ['textgreen']   = array($ArrayCount++, '%25green%25', '%25%25', '$[Green Text]',
                                    '$GUIButtonDirUrlFmt/hightextgreen.gif"$[Green Text]"');
      $GUIButtons ['textred']     = array($ArrayCount++, '%25red%25', '%25%25', '$[Red Text]',
                                    '$GUIButtonDirUrlFmt/hightextred.gif"$[Red Text]"');
      $GUIButtons ['textyellow']  = array($ArrayCount++, '%25yellow%25', '%25%25', '$[Yellow Text]',
                                    '$GUIButtonDirUrlFmt/hightextyellow.gif"$[Yellow Text]"');
      $GUIButtons [$SpaceCount++] = array($ArrayCount++, '', '', '', $GUIButtonSpace1);
      $GUIButtons ['bgblue']      = array($ArrayCount++, '%25bgcolor=blue%25', '%25%25', '$[Background Blue]',
                                    '$GUIButtonDirUrlFmt/highbgblue.gif"$[Blue Text]"');
      $GUIButtons ['bggreen']     = array($ArrayCount++, '%25bgcolor=green%25', '%25%25', '$[Background Green]',
                                    '$GUIButtonDirUrlFmt/highbggreen.gif"$[Green Text]"');
      $GUIButtons ['bgred']       = array($ArrayCount++, '%25bgcolor=red%25', '%25%25', '$[Background Red]',
                                    '$GUIButtonDirUrlFmt/highbgred.gif"$[Red Text]"');
      $GUIButtons ['bgyellow']    = array($ArrayCount++, '%25bgcolor=yellow%25', '%25%25', '$[Background Yellow]',
                                    '$GUIButtonDirUrlFmt/highbgyellow.gif"$[Yellow Text]"');
      $GUIButtons [$SpaceCount++] = array($ArrayCount++, '', '', '',$GUIButtonSpace1);
      $GUIButtons ['nextline']    = array($ArrayCount++, '\\\\\\\\\\n', '', '',
                                    '$GUIButtonDirUrlFmt/nextline.gif"Line Break"');
      $GUIButtons ['nextline2']   = array($ArrayCount++, '\\\\\\\\\\\\\\n', '', '',
                                    '$GUIButtonDirUrlFmt/nextline2.gif"2 Line Breaks"');
      $GUIButtons ['return']      = array($ArrayCount++, '[[<<]] \\n', '', '',
                                    '$GUIButtonDirUrlFmt/return.gif"Return"');
      $GUIButtons [$SpaceCount++] = array($ArrayCount++, '', '', '',$GUIButtonSpace1);
      $GUIButtons ['code']        = array($ArrayCount++, '[%40', '%40]', '$[UnCoded Text]',
                                    '$GUIButtonDirUrlFmt/code.gif"Preformated Code"');

Conditional buttons

I run a company knowledgebase. We use custom buttons to input predefined text blocks, and people in different groups need to use different text. Rather than having loads of buttons on screen that most users don't need, I have worked out how to have different users see different buttons. (This application requires AuthUser to be active.)

First, copy this text (taken from guiedit.php and edited slightly) into local/config.php:

 Markup('e_guibuttons_dns', 'directives',
   '/\\(:e_guibuttons_dns:\\)/e',
   "Keep(FmtPageName(GUIButtonCode_dns(\$pagename), \$pagename))");

 function GUIButtonCode_dns($pagename) {
   global $GUIButtons_dns;
   $cmpfn = create_function('$a,$b', 'return $a[0]-$b[0];');
   usort($GUIButtons_dns, $cmpfn);
   $out = "<script language='javascript' type='text/javascript'>\n";
   foreach ($GUIButtons_dns as $k => $g) {
     if (!$g) continue;
     @list($when, $mopen, $mclose, $mtext, $tag, $mkey) = $g;
     if ($tag{0} == '<') { 
         $out .= "document.write(\"$tag\");\n";
         continue; 
     }
     if (preg_match('/^(.*\\.(gif|jpg|png))("([^"]+)")?$/', $tag, $m)) {
       $title = (@$m[4] > '') ? "title='{$m[4]}'" : '';
       $tag = "<img src='{$m[1]}' $title style='border:0px;' />";
     }
     $mopen = str_replace(array('\\', "'"), array('\\\\', "\\\\'"), $mopen);
     $mclose = str_replace(array('\\', "'"), array('\\\\', "\\\\'"), $mclose);
     $mtext = str_replace(array('\\', "'"), array('\\\\', "\\\\'"), $mtext);
     $out .= 
       "insButton(\"$mopen\", \"$mclose\", '$mtext', \"$tag\", \"$mkey\");\n";
   }
   $out .= '</script>';
   return $out;
 }

The bits in red of course don't need to be "_dns" -- use whatever suffix you like.

Then add buttons to the new $GUIButtons_dns array by adding lines like this to local/config.php:

 $GUIButtons_dns['h2'] = array(400, '\\n!! ', '\\n', 'Heading',
                     '$GUIButtonDirUrlFmt/h2.gif"Heading"');

Then edit Site.EditForm. Change:

(:input e_form:)[[#top]](:e_guibuttons:)\\

to:

(:input e_form:)[[#top]](:e_guibuttons:)(:if authgroup @dns:)(:e_guibuttons_dns:)(:if:)\\

What you now have is an extra array of buttons that can only be seen by users who are members of the @dns group. If you're not using AuthUser, there are no doubt other applications for this. Perhaps some buttons that are only visible in certain page groups?

Cheers.

  ~ Joseph Kynaston Reeves(approve links)

Discussion


02/10/2009

Question

To use the buttons with the array above located in config.php it looks like I have to comment out the array that is located in pmwiki/scripts/guiedit.php, otherwise the new array on config.php will place its buttons before the default buttons. Is this true, or am I missing something? If true, then it slightly complicates updating pmwiki.

Jonathan


21/01/2008

Q: a wiki-GUIButton

Is it possible to have a button to write the text of another choosen model of page (same pmwiki) ?

$GUIButtons ['pagetext'] = array($ArrayCount++, 'text of the another pmwikipage PageName', ...);

Thanks. FidelioEspoir

A:


An improvement to the script can be to allow an undo. On some browser/installation 'Ctrl-Z' works, but not on all.


Q: Is it possible to add a 2nd row of buttons below the first one ? jmi Also curious about this as well -cs

A: Yes. The fifth parameter is either a URL or HTML. Simply use <br />. DaveG


Is it possible to realize a button for newline \\??? Solution is simple the linebreaks nolinebreaks markup!!!


Q:In Opera and Khtml the text is inlined at the end of the document, not at the cursor position. - Schlaefer

This is a known limitation of Opera -- Opera doesn't provide the ability to find the current cursor position or insert text into the middle of a <textarea> element. I don't know about Khtml, but I suspect it's the same thing. --Pm
19 Aug 2006 - I've heard that latest versions of Opera and Safari should somehow support text insertion in the middle of a <textarea>. This is also what I've found written at http://www.alexking.org/blog/2004/06/03/js-quicktags-under-lgpl -- Luigi

I didn't know that. I choose not to output the buttonbar by putting the following at the beginning of insButton()

 var clientPC = navigator.userAgent.toLowerCase(); 
 var BrowserIsSafari = ((clientPC.indexOf('applewebkit')!=-1)
                 && (clientPC.indexOf('spoofer')==-1));
 var BrowserIsOpera = clientPC.indexOf('opera')!=-1;
 if (BrowserIsSafari || BrowserIsOpera) return;

Schlaefer

Q: My edit screen does not include the "save and edit", "preview", "cancel" and summary and author boxes at the bottom of the screen. I installed pmwiki 2.0.13 on 2/17/2006. Cari

Looks like some of the Site pages didn't get loaded. Perhaps re-install?

Q: Have you considered a "remove all formatting markup" button? --Karl

Q: I love the the way these buttons look and function, but how do I get these buttons to appear on a page that's not in edit-mode, for instance one where FoxCommentBox is being used? GuiButtons allows for a (:guibuttons:) markup, why can't this one? Also, where are the smileys?


Q: Is it possible use single quotes (') in the default text that is inserted by GuiButtons when no markup is selected?

A: Yes, but you need to write it \\&apos; in the forth argument of the defining array:

  $GUIButtons ['mybutton']    =      array($ArrayCount++, 
                                      "prefix - no problem:'''",
                                      "''' suffix",
                                      "\\&apos;\\&apos;default\\&apos;\\&apos;",
                                      '$GUIButtonDirUrlFmt/my.gif"$[tooltip]"');
 Frank

I've combined the two recipes, GuiEdit (on this page) with GuiButtons. It is not exactly the same - it's my own personal setup, therefore not all of the specialty buttons listed above are included (though it'd be easy to copy and paste them right back in). The smiley's have also been added, and can easily be turned on with $Smileys = true; - just be sure to declared this before you include the recipe.

To get started, just 1) download ao.guiedit.phpΔ and call include_once("$FarmD/cookbook/ao.guiedit.php"); in config.php, and 2) download the buttons folder MyGuiEdit2.zipΔ, and place the folder 'MyGuiEdit' in your '/pmwiki/pub' directory. Note that this collection is only different from the 'MyGuiEdit.zip' offered above in that it contains a 'smileys' folder containing the smiley icons that are provided with the GuiButtons recipe.

Once uploaded & included: As with GuiButtons, the markup (:guibuttons:) is now available to call these buttons wherever you want on a page, without needing to be in edit-mode, which is useful for pages with FoxCommentBox, where users might be posting a comment on page that they're browsing. For it to work, be sure to add id=text to your input textbox, like so:

                (:input textarea id=text name=comment cols=60 rows=6:)

See GuiButtons for more details...

overtones99 June 29, 2008, at 06:43 PM

I modified overtones99's GuiEdit AIO version as follows:

  • Test with pmwiki 2.2.15
  • Add $RecipeInfo = "2010-05-03 AIO"
  • Fix use of % in color,bgcolor,left/right/center,image,table
  • Fix image markup issue
  • Various fixes and a couple of string changes to enable effective translations ( XL )
  • Replace H1 button with preformatted text button, in line with the thinking that H1 is reserved for page title. Uncomment/comment 2/2 lines to get H1 back.
  • You can download the modified version here ao.guiedit-2010-05-03.phpΔ.
  • Find a list of translation strings here.

Problems

See also

An example of the big button bar, with the button as defined above :

http://cncloisirs.com/Fonctionnement.BacASable?action=edit

Note : you can also find on this edit window a removal of menu, header and footer described here : layout edit modified

Translation

The text associated with the button can be translated in a given language via the XLPage. See the appropriated paragraph in the Localization.XLPageTemplate and for Cookbook buttons in Localization.XLPageCookbookTemplate

SteP May 03, 2010, at 08:40 AM: text strings grepped from ao.guiedit-2010-05-03.php:

  • 99% compatible with overtones99's version, except for a couple of strings
  • do not use quotes in the translated strings, as they will likely break javascript code
  'Bold Text' => '',
  'Bold' => '',
  'Italic Text' => '',
  'Italic' => '',
  'Underlined Text' => '',
  'Underline' => '',
  'Crossed Out Text' => '',
  'Strike Thru' => '',
  'Superscript' => '',
  'Subscript' => '',
  'Align Left' => '',
  'Align Center' => '',
  'Align Right' => '',
  'Indented text' => '',
  'Hanging indent' => '',
  'Big Text' => '',
  'Bigger Text' => '',
  'Larger Text' => '',
  'small text' => '',
  'smaller text' => '',
  'tiny text' => '',
  'Text or code' => '',
  'Preformatted text' => '',
  'Keep as is' => '',
  'Heading1' => '',
  'Heading2' => '',
  'Heading3' => '',
  'Heading4' => '',
  'Table' => '',
  'Advanced table' => '',
  'Stamp your name and current date' => '',
  '2nd Line' => '',
  'Page link' => '',
  'http:// | link text' => '',
  'AnchorName' => '',
  'Invisible Anchor to Link To' => '',
  '| text' => '',
  'Link to Anchor in SAME page' => '',
  '#AnchorName | text' => '',
  'PageName' => '',
  'Link to Anchor on DIFFERENT page' => '',
  'file.ext' => '',
  'Attach File' => '',
  'ImageName.jpg' => '',
  'SameImageName.jpg' => '',
  'MOUSE HOVER TEXT' => '',
  '-SUBTITLE-' => '',
  'Thumbnail of Image floating right' => '',
  'Ordered list' => '',
  'Numbered list element' => '',
  'Unordered list' => '',
  'Bullet list element' => '',
  'Horizontal rule' => '',
  'Blue Text' => '',
  'Green Text' => '',
  'Red Text' => '',
  'Yellow Text' => '',
  'Background Blue' => '',
  'Blue Background' => '',
  'Background Green' => '',
  'Green Background' => '',
  'Background Red' => '',
  'Red Background' => '',
  'Background Yellow' => '',
  'Yellow Background' => '',
  'Line Break' => '',
  '2 Line Breaks' => '',
  ' Return' => '',
  'Happy' => '',
  'Wink' => '',
  'Cool' => '',
  'Confused' => '',
  'Eek' => '',
  'Roll eyes' => '',
  'Sad' => '',
  'Mad' => '',
  'Big grin' => '',

Contributors


I've copied everything in what I think is the right place, but can't get any Gui buttons at all!!! Help!!! Promsan July 24, 2009, at 07:07 AMPromsan

User notes +2: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.

Edit - History - Print - Recent Changes - Search
Page last modified on December 22, 2011, at 05:28 PM