Summary: Split a wiki page into separately editable sections with an edit link for each section
Version: 2.1.8 dated: 2008-03-03
Prerequisites: at least PmWiki 2.1.6, last tested with version 2.2.0-beta51.
Status: Stable
Solution
- Download sectionedit.phpΔ and save it in the cookbook directory
- When you run PmWiki/WikiFarms add
include_once("$FarmD/cookbook/sectionedit.php"); to your farmconfig.php or config.php. Otherwise add include_once("cookbook/sectionedit.php"); to your config.php
Information
This recipe is based on break-page.php written by Schlaefer. This version here contains some enhancements and additional bugfixes. I created a new cookbook recipe as a beginner wouldn't find this really nice feature (which might be missed when someone knows e.g. MediaWiki).
Sections are automatically generated by default. Every heading in the wiki text then marks the beginning of a new section. By default the sections are generated in MediaWiki style. This means, when editing a section beginning with a header the section contains everything (even subheadings) until a new section with the same or higher heading level starts. This behaviour can be switched to standard style. See Customization for details. To edit simply click on the edit link above the desired section. To edit the section in a new window do a right-click on the edit window and select open in new window (depending on your browser).
When editing a section you'll see either the heading or the ==== markup at the beginning. If you're now removing the ==== at the top you are adding the actual section at the end of the section before. By the way: You don't have to place ==== in a separate line, just at the beginning of a line is enough.
Sections are also automatically generated for included pages. This behaviour can be deactivated (see below). When editing the main page you will only edit the text of that page, i.e. you'll see the (:include ... :) markup. At the beginning of the included page always an additional edit link will be inserted to have the possibility to edit the very first part of the included page. After saving that file you get back to the main page where you started.
Links for editing section are only visible when you have "edit" rights, i.e. authenticated for edit.
Take a look at the source when you're interested in the history. The history for the 1.x versions can be found in the archive.
This recipe also supports Site.EditForm.
BTW:
Pm activated the sectionedit script on this page.
Caveats
When editing a section the section marker is visible in the edit window. You should not remove the marker (==== or a heading) otherwise the currently edited text is not a section anymore.
When placing (:if anything :) directly before the section markers. you will see e.g. ====(:ifend:) at the beginning of the edited text. Don't get confused from the fact you don't see the starting (:if anything :). It simply belongs to the section before.
Limitations
Not really a limitation, but you should keep it in your mind: Sections are only generated for the main wiki page. Every other text that is included through the skin will not contain any section editing capabilities.
Well not really a limitation more kind of warning. If it happens that a section of a page or different sections of the same page are edited, you'll get a message that the page has changed (see SimultaneousEdits for more information). You then are editing the whole wiki page, not only the actual section. The reason is simply that otherwise you won't see or recognize the conflicts correctly.
When previewing you won't see any "edit section" links. This is normal behaviour.
Apparently does not work with the following skins: BeeblebroxNetGila, SimpleSkin, SinorcaSkin
To make section edit work with Sinorca and BeeblebroxNetGila, just change "clear:both" to "clear:none" inside div.sectionedit css rule.
CarlosAB July 22, 2007, at 03:28 PM
SectonEdit does not work with FoxForum, since FoxForum uses one (:include...:) markup for each message. Use FoxEdit for individual message editing. HansB
Possible Customization
These Customizations have to be set before including the script!
$SectionEditWithoutHeaders = true;
Disables the automatic generation of sections, i.e. only ==== works for marking the beginning of a new section.
$SectionEditAutoDepth = 2;
This variable defines up to which level the headings are used to mark the beginning of a new section. Default is 6 which means all headings are used. If you define e.g. 2 (as staed above) only the headings ! and !! will start a new section. !!! will be handled as normal text. Of course this variable only has an effect when $SectionEditWithoutHeaders is false.
$SectionEditMediaWikiStyle = false;
Disables the default MediaWiki autosectioning style. The default value is true. Following a small example to illustrate the differences.
value:TRUE (sections) FALSE (sections) meanings:
Text Text Start of section: \
!Head1 \ !Head1 \ Middle of section: |
Text | Text / End of section: /
!!Head2 \ | !!Head2 \
Text | | Text /
!!!Head3 \ | | !!!Head3 \
Text | | | Text /
==== \ | | | ==== \
Text / | | | Text /
!!!!Head4 \ | | | !!!!Head4 \
Text / / | | Text /
!!!Head5 \ | | !!!Head5 \
Text / / / Text /
!Head6 \ !Head6 \
Text / Text /
$SectionEditInIncludes = false;
Disables the creation of sections for included pages. Default value is true.
Horizontal Line Sectioning:
This means that every horizontal line ---- is used for starting a new section.
To enable this option set the variable
$SectionEditHorzLines = true;
By default the value is false;
See also markups: (:horzsections:) and (:nohorzsections:)
In you CSS file you can change the look of the edit link by assigning properties to:
div.sectionedit
For example, the following CSS statements creates a MediaWiki-like look and feel with the editing link floating on the right side of the first line of the section:
div.sectionedit { float:right; margin-left:5px; }
Provided Markup
The directives below work also when placed in the GroupHeader or GroupFooter and can be used within conditional markup.
====
After this markup a new section begins. The setting of $SectionEditAuto doesn't have any influence on this markup. This markup should be located at the beginning of a line.
(:nosections:)
This markup disables the separation into sections. Could be used for e.g. ConditionalMarkup or other purposes.
(:autosections:)
This markup overrides the settings of $SectionEditWithoutHeaders. When you use it the automatic generation of sections is actived ($SectionEditWithoutHeaders = false;). This must be placed before the first section heading or the edit section links will edit incorrect sections.
(:noautosections:)
With this markup the automatic generation of sections is deactivated. ($SectionEditInIncludes = false:).
(:nosectionsinincludes:)
This markup disables the generation of sections for included pages.
(:horzsections:)
This markup enables the generation of sections for each horizontal line.
(:nohorzsections:)
This markup disables the generation of sections for each horizontal line.
Changing the default (Edit Section↓) labels
If you wish to change the default labels of the edit links, e.g. to 'edit', set this in config.php:
XLSDV('en', array('(Edit Section ↓)'=>'edit'));
The last quoted string will replace "(Edit Section ↓)".
If instead of English language, you are using Internationalizations, see the next section.
To hide the "Edit Section↓" (or other, customized as above) links only while printing the page, you can create a file pub/css/local.css (if it doesn't already exist) and add the following code:
@media print {
.sectionedit {display: none; visibility:hidden;}
}
Translateable Strings
Add this to your XLPage or XLPageCookbook (if it's already contained in one of these files you don't have to add it, of course):
### Strings for SectionEdit
'(Edit Section ↓)' => '',
'Section' => '',
'of' => '',
and you are able to change the section edit link to whatever you like
Development
Since version 1.3.7 I included checking for PHP version to fix a PHP 4.1.2 problem. Currently this fix is only applied when PHP 4.1.2 is used. Please report when your version does have the same problem so I could include it to the fix list. Problem description: In the very last section the first character got lost (e.g. "===" instead of "====" or "!!" instead of "!!!") in editing and browsing.
Development Archive
Comments
See Also
More Wikipedia-like Experience:
Contributors
Discussion
- It seems sectionedit is incompatible with ROEPatterns/ROSPatterns. When a page is edited through the "edit section" link, ROEPatterns/ROSPatterns are not applied. Any way to fix this? pwuille May 30, 2008, at 08:31 AM
====
- Wouldnt it be nicer if the edit link would be shown on the same line as the first line of the section instead of the line before? Marc Seibert August 26, 2005, at 11:52 AM
Well you can simply achieve this with the correct CSS code. Just change $HTMLStylesFmt['sectionedit'] after the include. Add float:right; into it or into your CSS file. Maybe I'll inlude that in a later version, we'll see. - Klonk
I included it in version 1.3.3 but removed it again in 1.3.4 as it brought more problems than it had benefits. Of course you can do it on your own and maybe you won't run in display problems (e.g. with %rframe%) - Klonk August 30, 2005, at 03:32 PM
====
- Hi Klonk, nice work, thanxs. Is there a other way to change the section link from (Edit Section X) to Edit Section than to do it in the sourcecode? and, what would it take to just show the Section Edit link, if the user has the permission to edit? grz noskule August 31, 2005, at 11:49 AM
Change the display text in your XLPage (see above which strings to use). Regarding permission just write (:if ! auth edit:)(:nosections:)(:ifend:) somwhere in your text. Placing this in the GroupHeader or GroupFooter does not work at the moment - Klonk August 31, 2005, at 01:28 PM
hm, and if I would write it in
Site.GroupHeader it sould work for all groups? This would be extra nice but I'm not shure if this is the pmwiki way . ..
noskule September 01, 2005, at 07:22 AM
AFAIK no, it shouldn't work then for the whole wiki only for the Site group. Currently I try to find a better way to check the GroupHeader and GroupFooter. - Klonk September 01, 2005, at 09:04 AM
With release of version 2.0 the above markup works in GroupHeader and GroupFooter and also within conditional markup. - Klonk September 28, 2005, at 08:51 AM
====
September 06, 2005, at 10:35 AM : 'Moved Edit Links below Sections' \\
I edited my sectionedit.php source in order to move the section edit links down to the bottom of each section. Is there another way of doing this without editing the source document??
I edited lines 243 to this
$out2[] ="
".$p[$i];
$out2[] = Keep("<div class='sectionedit'>$editlink[$i]</div>")";
//$out2[] ="
".$p[$i];
====
Hi Klonk, I absolutely enjoy this script.
I would like to have the background either change color, or the text to change color when I hover over the Edit Section link and would like to do this using CSS. This would make it much easier to locate each section because I do have pages with many sections that are close together. Do you have any sugestions on how to incorporate the CSS?
This is easy just add div.sectionedit a:hover{ color:#f00;background-color:#0f0;}. The used colors are just examples. - Klonk.
it's doesn't work. the output is <div class='sectionedit'><a href='http://pmwiki-2.0.11/index.php?n=Main.HomePage?action=edit&s=1&auto=y&from=Main.HomePage(approve links)'>
(Edit Section ↓)</a></div> and the "a" class is not define
- It does work. You have to edit the file sectionedit.php because that is where the css is located for the section edit link.
- Of course, this didn't work for me as I hope because I wanted the whole background to change color and only the link background changes color with this code. I decided not to make an issue out of it. Navet October 20, 2005, at 02:04 PM
A related quick tip:
For 'stealthy' links, which are hidden unless you put the mouse near where you expect them to be try replacing:
/*** defines the layout of the section edit links */
SDV($HTMLStylesFmt['sectionedit'], "
div.sectionedit { text-align:right;font-size:smaller;clear:both;}
");
with
/*** defines the layout of the section edit links */
SDV($HTMLStylesFmt['sectionedit'], "
div.sectionedit { text-align:right;font-size:smaller;clear:both;}
div.sectionedit a { color: #ffffff}
div.sectionedit a:visited { color: #ffffff}
div.sectionedit:hover a { color: #999999}
div.sectionedit:hover a:visited { color: #999999}
div.sectionedit:hover a:hover { color: #0033cc}
");
====
Version 2.0 works great. Looks sharp!.
Feature Request: Would it be possible to change $SectionEditAutoDepth to an array so I can set the values of headings to edit. For example I would like to only edit headings 2 and 4 only. Not 1~4.
I don't know that much about preg_split , but believe it to be able to take array values. Maybe instead of a $SectionEditAutoDepth, creat an array:
$SectionEdit[Level] = 2;
$SectionEdit[Level] = 4;
Good work Klonk.- navet September 28, 2005, at 12:42 PM
I don't think it is a good idea to include it in the standard version, but I it should be possible. The only problem I see is when using MediaWiki style. I'll think about that - Klonk September 29, 2005, at 01:22 AM
OK, I looked at the code and decided not to do that. Giving such a feature would only make sense when it could be adjusted with different stuff e.g. make it possible to use ---- also for autosectioning. But then we run heavily into problems with MediaWiki style. What should be considered as borders for the sections? To include such a feature would be possible though but I want to avoid creeping featurism. Let's discuss on the mailinglist - Klonk September 29, 2005, at 01:56 AM
What is the latest on this? Is it now possible? I'd like to do pretty much the same thing (no edit heading for level 1 which is redundant to the way I have pages laid out, and clutters the head of the pages). Mainly what I'm looking at, I think, is starting the autosectioning from level 2 down - which could be done as navet was suggesting or perhaps imply another approach? Thanks for any info. - Don, 28 Oct. 2007
====
There seems to be a problem using SectionEdit together with Numbered Headers or Page Table Of Contents.
With Numbered Headers the headers display correctly, but SectionEdit inserts the text %block margin-top=0px% before each of the links in the contents table. I bodged this to work by inserting another preg_replace into numtoc.php to remove the offending markup, but presumably the real answer would be for sectionedit.php to spot that it is a contents table link, not a real header.
Sure, but how should the script know that? Every header in the wiki text (source) is used as a border for a section. And each header that is used as a border gets the %block margin-top=0px% which is a simple style and sets the margin. In my opinion the Numbered Headers script gets the whole header and displays it, but does not recognize when a style is applied try a header (with section edit deactivated) with e.g. %newwin% and you'll see it in the table also. - Klonk
With Page Table Of Contents the contents table is fine, but the headers are not rendered properly.
Changing the order of the Includes in config.php doesn't seem to change anything.
Mark Hodson? October 09, 2005, at 08:20 AM
Currently I have tried the all 3 extensions of TOC (Page Table Of Contents, Numbered Headers, and the Quick Page Table Of Contents). All 3 of them don't work correctly with SectionEdit. This should be fixed. Other Wikis can handle both features well (just to metntion some: dokuwiki, twiki,mediawiki and there are more). Please, Can anything be done here ?
Maybe one of the 3 TOC extensions should be merged with SectionEdit to give at least one working solution.
====
I had two sites implemented. one works perfectly. the other works with a warning
Warning: Cannot modify header information - headers already sent by (output started at
/data/httpd/pmwiki-2.0.12/cookbook/sectionedit.php:493) in /data/httpd/pmwiki-2.0.12/pmwiki.php on line 709
what gives? both sites have identical HTTPd/PHP
This looks like some text was output at one location and not at the other. Please check the PHP-Setting regaring showing of errors/warnings. Maybe something differs there - Klonk November 07, 2005, at 08:29 AM
You are right there, both servers have the same error message in HTTPd error_log files. One also shows the message on HTML pages. One server was using startand packages from CentOS 4.1, the other uses Whitebox Enterprise Linux 3, both are clones of Redhat Enterprise Linux 3/4. How should it be fixed? the error logs are growing ...
I have no idea... I don't have a server available that runs Linux currently, therefore it's difficult to reproduce it, as with windows and other linux server (including on my own homepage) work perfectly. FYI I locally installed PHP 4.4.0 and just changed the force_cgi-redirect setting and chnaged the reporting to show only errors and warnings, i.e. error_reporting = E_ALL & ~(E_NOTICE | E_USER_NOTICE) ; Please try and tell me whether this helps... - Klonk November 16, 2005, at 02:34 AM
I have another idea: edit sectionedit.php and remove at the very end the lines from ?> and following. The script only has 489 lines therefore I assume there are some empty lines after the ?>. As the ending ?> is not necessary anymore with PmWiki this might help (I just left it as I didn't encounter any problems yet) -Klonk November 16, 2005, at 02:38 AM
No. it does not help
I configured PHP so that NO errors/warnings show up on web pages. however, it does show in HTTP error_log file.
The 2nd trick does not work though. same errors
Hmm, very strange. I got such errors only when I added some code to display varables, but not anymore when I removed those commands. Do you have the latest version of the sectionedit script? I noticed that I forgot to remove this additional display in a former version... - Klonk November 17, 2005, at 01:31 AM
====
Hi, using php 5 and Apache 2 on Windows, I get the following errors on the page
Warning: array_merge() [function.array-merge]: Argument #2 is not an array in C:\Program Files\Apache Group\Apache2\htdocs\pmwiki\cookbook\sectionedit.php on line 264
Warning: array_unique() [function.array-unique]: The argument should be an array in C:\Program Files\Apache Group\Apache2\htdocs\pmwiki\cookbook\sectionedit.php on line 266
Warning: in_array() [function.in-array]: Wrong datatype for second argument in C:\Program Files\Apache Group\Apache2\htdocs\pmwiki\cookbook\sectionedit.php on line 287
Warning: in_array() [function.in-array]: Wrong datatype for second argument in C:\Program Files\Apache Group\Apache2\htdocs\pmwiki\cookbook\sectionedit.php on line 287
Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files\Apache Group\Apache2\htdocs\pmwiki\cookbook\sectionedit.php:264) in C:\Program Files\Apache Group\Apache2\htdocs\pmwiki\pmwiki.php on line 766
When I comment out the offending lines and references, everything seems to work ok. I don't use includes so it is not a problem for me but I thought I would raise the issue for someone to look into (I don't know any php otherwise I would!)
Also, can anyone help me move the section edit links to the bottom of the section in the latest release?
Dav Bacci 25th Jan 2006
Hi, using php 5 and Apache 2 on Mac X same problem, a php5 problem !!
Trt editing the lines that show the "array" type error by adding "(array)" in front of the offensive variable. This will cast that variable as an Array, which should fix the problem. BenWilson February 05, 2006, at 12:37 PM
Maybe you can specify this for PHP-Beginners... ;-). This here are the lines:
$SectionEditIncludes = array_merge($SectionEditIncludes,$args['']);
/*remove double page entries*/
$SectionEditIncludes = array_unique($SectionEditIncludes);
what's to do? - Chris
Hi,
I'm not even a beginner with PHP, but I did it this way and stopped getting those warnings:
$SectionEditIncludes = array_merge((array)$SectionEditIncludes,(array)$args['']);
/*remove double page entries*/
$SectionEditIncludes = array_unique((array)$SectionEditIncludes);
Jahvetti
====
SectionEdit works okay for me except under the following circumstances when the section being edited overwrites the whole page:
- Open an "Edit Section"
- Edit it
- Hit "Save and Edit"
- Hit "Cancel"
If instead, I replace (4) with: Hit "Save", then the page is saved successfully. test
(Looking at the history seems to confirm that SectionEdit deletes everything bar the section being edited on "Save and Edit", then adds it all back on "Save".)
Is this a bug or a feature?
Marc 2006/06/27
Do you really have the version 2.0.3? (Please check in the PHP source) This bug should be fixed (at here the described problem does not occur). Maybe you should redownload the script, I uploaded the latest version again. -Klonk July 07, 2006, at 02:22 AM
I have exactly the same problem with PmWiki 2.1.26 and sectionedit 2.0.3. One additional information: After a "Save and Edit" the whole page is replaced by the section, which can be verified by looking at the page with an second browser. This behaviour is very dangerous and annoying, though sectionedit is a really great feature. juergen 2006/09/16
Same with sectionedit 2.0.4. An additional information might be, that I have $SectionEditWithoutHeaders = true; and $SectionEditInIncludes = false; in my local.conf. juergen 2006/09/19
OK, I'll look into it (again(. How did you do it? "Save and Edit" then "Cancel"? Because this is the only way I can reproduce it. Please try "Save and Edit" (you could try it several times) and then leave then page with "Save". Do you still only see the edited section?? - Klonk September 20, 2006, at 03:22 AM
Please download evrsion 2.0.5. Now this problem should be (finally) fixed. Please try and report. Thanks. - Klonk September 20, 2006, at 04:03 AM
Tested with 2.0.5 and 2.1.0, both work fine. Many thanks ! juergen 2006/09/21
Jipieh!! Thanks for the report. So I finally found the bug! - Klonk September 21, 2006, at 08:46 AM
Found one little problem with 2.1.0, worked with 2.0.5, though. Preview dosn't work. Fixed it by removing the comment-character (#) in line 457. juergen 2006/09/22
Uups optimized too much, I fixed it in version 2.1.1 (with another improvement/bugfix) and uploaded it again - Klonk September 22, 2006, at 03:00 AM
In my installation (German) a bug appears, when I activate sectionedit.
The second heading is no longer displayed as a heading, but with exclamation marks.
If I insert an exclamationmark in the lines between all is okey.
If I add &action=test all is also working
If I use preview the same
Only without action this problem is there??
Pages with headings created without sectionedit on are also displayed right, even if it is on!
Many greetings
hh(at)11h.de
(4.Juli.2006)
my testcode:
test
test this line is no heading any longer
mORE TESTING
mORE TESTING
test
Do you really have the version 2.0.3? (Please check in the PHP source) This bug should be fixed (at here the described problem does not occur). Maybe you should redownload the script, I uploaded the latest version again. -Klonk July 07, 2006, at 02:22 AM
I am using version 2.1.3 of this cookbook and pmwiki-2.1.26. I have the same problem that my second heading is without formating. 2006-12-10 k2s?
====
Hi. First of all, thanks for your great extension!
Now, it also happens to me the thing of "SectionEdit deletes everything bat the section being edited". Using version, 2.0.3. This is not so bad.
The problem is, if I get to a sectioned page through eg. Main.mypage it works perfect, but, if I get to the page through Main.mypage?action=view , the "edit section" links do not appear. This I checked it consistently through various pages.
Any idea to fix this? Inigo August 11, 2006, at 10:51 AM
Use "Main.mypage?action=browse" then it works. Pm has changed this somewhen in the past. If you want to work it also with vie go to the end of sectionedit.php and locate "$action == 'browse'". Replace it with "$action == 'browse' | $action == 'view'" - Klonk September 18, 2006, at 08:35 AM
Works now in version 2.0.4 - Klonk September 18, 2006, at 09:02 AM
Thanks, that was it! Inigo? October 04, 2006, at 05:16 PM
====
August 20 2006
Hello,
I tried sectionedit with logon status:
(:if authid:)====(:ifend:)
and when I try to edit the section, it is empty (while it is not without the conditional markup). Any idea ?
Nicolas, August 20, 2006, at 02:11 PM
Put "====" in a new line - Klonk September 18, 2006, at 08:35 AM
Sinces version 2.1.0 (:if auth edit:)<link to edit section>(:ifend:) is default. I.e. editlinks are only visible when you are allowed to edit the text. If you have no right to edit the text the section-editlinks are confusing. Comments on that? - Klonk September 21, 2006, at 02:51 AM
It might happen that you get an empty edit box when doing the above example, I fixed this with version 2.1.1 - Klonk September 22, 2006, at 04:41 AM
Could this be made optional? For pages that I always edit, I have to choose to edit the entire page (to enter my password), then go back to select the section. I'd like to do this optionally per page, or site.
====
Found a new bug, introduced around 2.1.
If the first line of a page is a heading I get a line like (:sectionedit Main.Test Main.Test:) at the top of the page.
Insert something other above the heading to fix that.
Tested with sectionedit 2.1.2 and a fresh install of pmwiki 2.1.26, no other cookbook extensions installed.
juergen 2006/09/23
This is fixed with version 2.1.3. I had to change regex more than I thought it is necessary. - Klonk September 24, 2006, at 01:14 AM
I have a similar problem (using pmwiki-2.2.0-beta58 and section edit 2.1.3). I also get a line like (:sectionedit Articles.TestGerman Articles.Test:) if the first line of a page is a heading or contains a footnote (created using the extendmarkup.php).
Torsten July 20, 2007, at 02:26 PM Besides I just discovered that ((:nosectionsinincludes:) doesn't work for me. And I found out that the sectionedit works for the section that comes BEFORE the "Edit Section↓" when it is in an included page. i.e. on the page
Test it works correctly (it works for the section that comes AFTER "Edit Section↓") whereas it modifies the section that comes BEFORE if the page
Test is included on another page using (:include Test:). And as decribed further down in this discussion the second heading is not rendered as heading but displays with two exclamation in front of it (both on included and not included pages). But when I click on the "Edit Section↓" next to that second (not rendered) heading on pages that are included it doesn't open the markup for the section that comes before or after the "Edit Section↓" but the edit-markup for the whole included page. I hope anyone finds this information useful.
Torsten July 20, 2007, at 02:58 PM
I have the same issue, thank you for the work around. jtankers October 3, 2007
====
I am using SectionEdit with RequireAuthor. I find that when the unsuspecting author tries to edit and then save one section (using SectionEdit's 'Edit Section') without entering an author name, the message is displayed up on top saying the author name is required but in the edit window, the text for the whole page is loaded so when she does save it correctly she duplicates the whole page in the place just that section should be. I'm running a huge wiki for a University MBA program and I don't want to remove either the Edit Section functionality or the Require Author functionality.
CCharles?
Do I assume correctly, that you mean the RequireAuthor setting in the config? What do you do exactly? "Save" or "Save and Edit" ? Please provide an exact procedure how to reproduce this problem, as it works here on my local installation. Do you use the latest version? - Klonk October 09, 2006, at 03:48 PM
sectionedit ate my form!
I believe that I've found a bug in sectionedit (v2.1.3 - 2006-09-22)
The following markup and template should produce a list of radio buttons - one for each group - and a button; all within a form, naturally.
Page markup:
(:pagelist fmt=#grpradio:)
some more text
Local template
!!!fmt=#grpradio
list of all the group names
[[#grpradio]]
(:if equal {<$Group} :)
(:input form "{$PageUrl}":)
(:if ! equal {<$Group} {=$Group} :)
* (:input radio n {=$Group}:) {=$Group}
(:if equal {>$Group} :)
(:input submit value="Try It":)
(:input end:)
(:if:)
[[#grpradioend]]
However, with sectionedit.php active, the <form> is absent from the HTML.
With sectionedit.php:
<div class='vspace'></div><div class='fpltemplate'></div>
<p class='vspace'>some more text
</p>
</div>
Without sectionedit.php:
<div class='vspace'></div><div class='fpltemplate'>
<form action='http://niff/~admin/pmwiki/index.php?n=Site.LocalTemplates(approve links)' method='post'>
<ul><li><input type='radio' name='n' value='Main' /> Main
</li><li><input type='radio' name='n' value='PmWiki' /> <span class='wikiword'>PmWiki</span>
</li><li><input type='radio' name='n' value='Site' /> Site
</li></ul><p><input type='submit' value='Try It' class='inputbutton' />
</p></form>
</div>
<p class='vspace'>some more text
</p>
</div>
To further test this, I installed a new version of PmWiki, with only the necessary changes to run the above test and the problem remained.
One more thing: the <form> displays correctly when previewing the edit
Marc November 22, 2006, at 07:36 AM
Is there an opposite directive to (:nosections:)?
I really like this recipe. Once in a while I need to disable the feature using
(:nosections:), so I wonder if it is possible to do something like this:
!! Section ...
bla bla
(:nosections:)
...
(:sections:)
!! Section
where the imagined new directive (:sections:) enables editing of sections again.
Btw, it should probably be called something other than (:sections:).
best regards, Christian
====
Note
My Pmwiki (ver.2.1.27) have a problem with the sectionedit-script(ver.2.1.3)
With the Button {Save&Edit} don't have any problems, but only {Save} ,however the userrights are set,
the script brings the Abort-Messages from pmwiki.php (function ResolvePageName):
PmWiki can't process your request
?invalid page name
We are sorry for any inconvenience.
So must refresh the browser and the script works fine!
The Problem is only in IE6 and Windows-Explorer actual, MozillaFirefox and IE7 don't have any problems with the script!!!
Have any pmwiki-user the same problem?
Thanks for answers!!! -Kai- 04.04.07
Note: This problem exists only with IIS-Webserver, with Apache the script works fine!! -Kai- 13.04.07
==> kai - i have the same setup and am using ie6 at work so unable to update to ie7. using the same script on a different setup works fine with ie7. would appreciate any assistance to get round the problem thanks david 12/05/07
Is it possible to avoid the "Section Edit" labels when printing ?
==== Hi, Klonk
I really appreciate your script, but something annoying is that if I print my page, the "Section Edit" labels appear on the printed page. Is there any means to change the CSS or something else to avoid that? I have never changed any CSS, thus please could you give me all the instruction if it is the way to solve the problem. PhilB? April 28, 2007, at 12:01 AM
See above "translateable strings". Simply Change the "translation" for your local installation - Klonk May 23, 2007, at 06:42 AM
Hi,
I have hit a bug which destroys the formatting of all sections except the one you are editing.
- Create a page with multiple sections
- Edit one section and make any change
- Save the document
- The section you edited is okay, but the linefeeds disappear from all other sections.
I think this is browser dependent: it only happens when I use w3m (a text-based browser which opens a text editor when you edit textareas).
I am using: pmwiki 2.1.27, sectionedit 2.1.6, w3m 0.5.1 (on Linux), vim 6.3 . I was using other extensions but I disabled them all and I still get the bug.
I can't reproduce the bug using lynx, Safari or Firefox. I can mail "before and after" versions of a page that demonstrates the bug from my wiki.d directory if you want.
Editing the entire page (with the edit link at the top) works fine. It is just the "Edit this section" bits that break things.
-- Paul Nijjar
Question:SectionEdit not work with Glossary?
--R. Serra
SectionEdit simultaneos edit incompatibility
Hello! My wiki configuration
FreeBSD 6.2 (Virtual Private Server)
apache-2.2.6_2
php5-5.2.4_1
PmWiki Version: pmwiki-2.2.0-beta68
PmWiki VersionNum: 2001968
SectionEdit: 2.1.6
No other cookbook recipes
- Open up two browser windows and select the same section of a page to be edited in each window.
- In one browser window, make some changes. Save those changes.
- In the second browser window, make some different changes to the same section and hit "save". You see simultaneous edit message, but the edit form shows only the section had been edited -- not the whole page as expected. If you hit "save" the corrections made in the first window are lost (but you can see them in history).
You can see the bug at http://cgmail.spb.ru/index.php?n=Main.WikiSandbox(approve links)
-- Pavel
Issue with Categories (SH - 6 Dec 2007)
> When categories is used the first time and saved by sectionedit, the
> click on categories does not generate the list of pages corresponding
> to this category, ... the entire page must be saved to produce the expected
> result.
> Bug ?
''comment from PM
I think so. The SectionEdit recipe appears to be overriding
PmWiki's default edit sequence, such that the pageindex isn't
updated properly whenever the page is updated.
Well in fact I simply took the handleedit function and modified it a little bit. Modification was simply done to additionally handle $prechunk and $postchunk (the parts before and after the actual edited section) and to split/combine the page text. To be honest I have no clue where from within the original Handledit function this update of the pageindex is called Klonk December 07, 2007, at 12:06 PM
Bug in parameter handling
There's a bug in the parameter handling code for includes in this recipe.
Line 308:
/* keeps all parameters but pagenames*/
foreach($args as $k => $v) $argsparam = ($k != '#' && !is_array($v) ) ? " ".$k."=".$v : "";
This deletes all parameters except for the last one! The correct code is:
/* keeps all parameters but pagenames*/
$argsparam = '';
foreach($args as $k => $v) $argsparam .= ($k != '#' && !is_array($v) ) ? " ".$k."=".$v : "";
-- Ivo
fixed in version 2.1.8. Thanks - Klonk March 03, 2008, at 10:11 AM
I wish "section edit button" append to heading text.
example code)
<h2>This is heading level-2 text. <a href="...">Edit Section</a> </h2>
...
How edit this recipe code? or Anyone help me to offer $var?
thanks your regards. from Hooney / 2008-02-19
Hey, thanks for the great work.\\
I think I've found a bug though, (maybe).
In our setup we are using ExternAuth and it seems to be working just fine.
BUT
if a person has edit sections in a page and has also specified a list of
users/groups who can edit that page they are the only ones who can view it as well.
So, when you say click on a profile for instance that has edit sections but the author has restricted editing and you're not in the group then you're disallowed from viewing the page.
Even more interestingly, even though you clicked view it's trying to escalate your privs to edit.
What I was wondering was, is it possible to only invoke edit when a person clicks on edit section and/or hid the edit section link if they only have view privs?
Thank you,
Frederick
-- Fixed my own issue :)
UTSL
had to uncomment
if (!CondAuth($pagename, 'edit'))
return ($text);
This allows them to view the page but NOT edit
And when they click on the Edit Section link they get an edit denied
Will look into hiding edit section link if not allowed to edit
...