Tarjei Huse wrote:

> Heres a simple snippet I made to do the job. Just include the snippet in a
> page and point your browser to that page. There you'll find a form where you
> can insert the id :)
> Tarjei
>
> <---- here be snippets ---->
> <h1> Approve pages</h1>
> <?
> /*
>
> NU_approve snippet.
>
> This snippet aproves all the pages on a given tree with the id(id). Include
> it in a page and it will display a form.
> */
>
> // page logic:
> if ($form_page_approve == 1 )
> {
> walk_tree($rootid);
> } else {
> form_page_approve();
> }
>
> function walk_tree ($rootid)
> {
> if ( mgd_walk_page_tree(approve_page, $rootid,15,&$user,true) ) {
> echo "Pages approved";
> } else {
> echo "Something's not working.  :(";
> }
> }
>
> function approve_page($id,$level,&$user)
> {
> $pageobject = mgd_get_page($id);
> if ($pageobject) {
> $pageobject->parameter("approval","status","always");
> if ($pageobject->update())
> { echo "Approved"; } else { echo "Page $id not approved"; }

this should really do something like
if ($eleobjs = mgd_list_page_element($id)) while ($eleobjs->fetch()) {
  $eleobj = mgd_get_page_element($eleobjs->id);
  $eleobj->update();
}
if ($eleobjs = $pageobject->listattachments()) while ($eleobjs->fetch()) {
  $eleobj = mgd_get_attachment($eleobjs->id);
  $eleobj->update();
}
// can i do the same on record_extensions ($object->parameters!)

As you will need to update the depended elements otherwise replication will not
occur if they have been updated after the page was updated..



>
> }
>
> function form_page_approve()
> {
> echo "<p>Insert root page for aproval<br>";
> echo "<form action=\"$PHP_SELF\">
> <input type=hidden value=1 name=form_page_approve>
> <input type=text name=rootid maxlength=5><br>";
> echo "<input type=submit value=approve>";
> }
>
> ?>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to