On Wed, Sep 17, 2008 at 9:22 AM, Linly <[EMAIL PROTECTED]> wrote:
>
> This is a help calling. :)
>
> Thank for Dan's new version (2.33) of BoltWire, I've done a
> interesting LineEdit or ParaEdit solution, eh, almost.
>
> What I've done was:
>
> 1) Install the ShowHide plugin:
>
> http://boltwire.com/index.php?p=resources.solutions.showhide
>
> 2) Create an action page name it as "action.paraedit".
>
> 3) Put these code inside "action.paraedit":
>
> <code>
> [(include page={p} lines=1..1)]`
> [(showhide id=line1 show='Edit1' type=button)]<box id=line1>
> [form]`
> [box content_1 rows=5 cols=50][(include page={p} lines=1)][box]
> [session target {p}]
> [session log content="{=content_1}" flags="line=1"][submit]
> [session index pages={p}][form] </box>
> `
> [(include page={p} lines=2..2)]`
> [(showhide id=line2 show='Edit2' hide='Hide' type=button)]
> <box id=line2>
> [form]`
> [box content_2 rows=5 cols=50][(include page={p} lines=2..2)][box]
> [session target {p}]
> [session log content="{=content_2}" flags="line=2"][submit]
> [session index pages={p}][form] </box>`
> `
> [(include page={p} lines=3..3)]`
> [(showhide id=line3 show='Edit3' hide='Hide' type=button)]
> <box id=line3>
> [form]`
> [box content_3 rows=5 cols=50][(include page={p} lines=3..3)][box]
> [session target {p}]
> [session log content="{=content_3}" flags="line=3"][submit]
> [session index pages={p}][form] </box>`
> </code>
>
> 4) Open any page with the additional url "&action=paraedit". And you
> will get a three-lines-ParaEdit function.
>
> ===================================
>
> If I want to edit a long article, which is the reason why we need Line/
> ParaEdit for, I have to extent the code manually. It can not
> automatically detect how many lines the target page contain.
>
> It's somehow a stupid solution, but it can edit the single paragraph
> (every "\n") right after it.
It would be easy enough to develop a countline function, something like:
function BOLTFcountlines($args) {
global $pageLink;
$page = $args[''][0];
if ($page == '') $page = $pageLink;
$content = BOLTloadpage($page);
$lines = explode("\n", $content);
return count($lines);
}
But it seems it would be better to get it to return something like
this: 1,2,3,4,5,6,7,8,9,10... etc
Which could be done with just a line or two more...
function BOLTFcountlines($args) {
global $pageLink;
$page = $args[''][0];
if ($page == '') $page = $pageLink;
$content = BOLTloadpage($page);
$lines = explode("\n", $content);
$lines = array_reverse($lines);
return implode(',', $lines);
}
(Actually, this would give 0,1,2,... But you get the idea).
Then you could use the list capability to take this value and generate
the output you want dynamically...
[(list "{(countlines)}" fmt="[form][text content "<(include {p}
lines={+p}..{+p}>"][submit change][session log content='{=content}'
flags='line={+p}'][form]")]
This is not tested of course--just off the top of my head--but it might work...
If you wanted to be able to change multiple lines in one shot, we'd
have to make this a bit more complex.
Also, what I'd like to see is a way to add little [(editline)]
functions automatically into a page. But I don't see any way to have a
function take the content of a page and rewrite it, unless you are
importing it from another page (like an edit line action) and can
process it that way. Well, just thinking out loud. Not at home at the
moment so can only suggest some ideas...
Cheers,
Dan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"BoltWire" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/boltwire?hl=en
-~----------~----~----~----~------~----~------~--~---