>Are the $up and $type topic variables now modifiable under
>1.2.6 beta2?

How innovative. I'm answering my own question...

Yes...they are modifiable now since you made the following
changes to the code...

page element #3 - code-init for article page:

<?    
if ($create || $modify) {    
  $calstart = ($sday && $smonth && $syear) ?
"$sday.$smonth.$syear" : '';    
  if ($calstart && $eday && $emonth && $eyear)     
    $caldays = 
ceil((mktime(0,0,0,$emonth,$eday,$eyear)-mktime(0,0,0,$smonth,$sday,$syear))
/ (60*60*24));    
  else    
    $caldays = 0;    
}    
    
if ($argc == 1) $id = $argv[0];    
if ($create) $id = mgd_create_article($up, $topic, $name,
$title, $abstract, $content, $author, $url, $calstart,
$caldays, $icon, $view, $print, $extra1, $extra2, $extra3,
$type);    
if ($modify && $id) mgd_update_article($id, $topic, $name,
$title, $abstract, $content, $author, $url, $calstart,
$caldays, $icon, $view, $print, $extra1, $extra2, $extra3);  
if ($id && isset($score)) mgd_update_article_score($id,
$score);    
if ($id && isset($lock)) mgd_toggle_article_lock($id);    
if ($id && isset($approve)) mgd_approve_article($id);

/* The following two lines are new functions for 1.2.6 which
   enable the modification of the reply to and type fields.
*/
if ($id && isset($up)) mgd_update_article_replyto($id, $up); 
if ($id && isset($type)) mgd_update_article_type($id,
$type); 
    
if ($id) $article = mgd_get_article($id);    
if ($article) $topic = $article->topic;    
?>


Ah...great...now to modify the article code.... Now I'm
going to get lazy and not comment the code...You'll have to
diff it to find the changes...How rude!
page #29 Article Admin:

<? if ($article || $action == 'create') {      
     if ($action == 'modify') {     
        $up          = $article->up;      
        $topic       = $article->topic;      
        $name        = $article->name;      
        $title       = $article->title;      
        $abstract    = $article->abstract;      
        $content     = $article->content;      
        $author      = $article->author;      
        $url         = $article->url;      
        $startdate   = $article->startdate;      
        $caldays     = $article->caldays;      
        $icon        = $article->icon;      
        $view        = $article->view;      
        $print       = $article->print;      
        $extra1      = $article->extra1;      
        $extra2      = $article->extra2;      
        $extra3      = $article->extra3;    
        $type            = $article->type;      
     } elseif ($action == 'create') {      
        $author      = $midgard->user;      
        $startdate   = 0;      
        $caldays     = 0;      
        $type = 0;      
        $icon = $view = $print = 0;      
     } ?>      
      
<? /* ARTICLE HEADER */ ?>      
<? if ($action == 'create') { ?>      
<h1>New article</h2>      
<? } else { ?>      
<h2><a href="&(mgdroot);/topic/article/&(article.id);.html"
class="navi">&(article.title);</a>      
    (article #&(article.id);)</h2>      
<? } ?>      
      
<? if ($action == 'delete') { ?>      
<?   if ($confirm && mgd_delete_article($article->id)) { ?>      
<p>Article record deleted.</p>      
<p><a href="&(mgdroot);/topic/&(article.topic);.html"
class="navi">&(mgdleft:h); Return to topic</a>.</p>      
<?   } else { ?>      
<p>Do you really want to delete this article record?</p>      
<p><a href="&(mgdroot);/topic/article/&(article.id);.html?action=delete&confirm=1"
class="navi">&(mgdok:h); Yes, delete</a>.      
   <a href="&(mgdroot);/topic/article/&(article.id);.html"
class="navi">&(mgdcancel:h); No, do not delete</a>.</p>      
<?   } ?>      
<? } else { ?>      
      
<? if ($action == 'create') { ?>      
<form method="post" action="&(mgdroot);/topic/article/">      
<? } elseif ($action) { ?>      
<form method="post" action="&(mgdroot);/topic/article/&(article.id);.html">      
<? } ?>      
      
<? /* ARTICLE METADATA */ ?>      
<table border="0" bgcolor="f0f0f0" cellspacing="0"
cellpadding="4">      
  <tr><td><p>Location:</p></td>      
      <td><p>      
<? if ($topic) {      
     function twalk($id) {global $mgdroot;       
       if (!$id || !($t = mgd_get_topic($id))) return;      
       twalk($t->up);      
       printf('/ <a href="%s/topic/%d.html">%s</a> ',
$mgdroot, $t->id, htmlentities($t->name));      
     }      
     twalk($topic);      
   } else { ?>      
unknown      
<? } ?>      
<? if ($action) { ?><input type="hidden" name="topic"
value="&(topic);"><? } ?>      
          </p></td></tr>      
<? if ($action) { ?>      
  <tr><td><p>Title:</p></td>      
      <td><input type="text" name="title" value="&(title);"
size="40"></td></tr>      
<? } ?>      
  <tr><td><p>Name:</p></td>      
      <td><? if ($action) { ?><input type="text" name="name"
value="&(name);" size="40"><? } elseif ($article->name) {
?><p>&(article.name);</p><? } else { ?>&nbsp;<? }
?></td></tr>      
  <tr><td><p>Author:</p></td>      
      <td>      
<? if ($action) { ?>      
<select name="author">      
<? if ($p = mgd_list_persons()) while ($p->fetch()) { ?>      
  <option value="&(p.id);"<? if ($author == $p->id) echo '
selected'; ?>>&(p.rname);</option>      
<? } ?>      
</select>      
<? } else {?>      
<p><? if ($p = mgd_get_person($article->author))      
        printf('<a href="%s/group/person/%d.html">%s</a>',
$mgdroot, $p->id,      
               htmlentities($p->name));      
      else      
        echo 'unknown'; ?></p>      
<? } ?>      
          </td></tr>      
<? if (!$action) { ?>      
  <tr><td><p>Score:</p></td>      
      <td><p><? if (!$action && $article->score)      
                  printf('<a href="%s/topic/article/%d.html?score=%d"
class="navi">%s</a>',      
                         $mgdroot, $article->id,
$article->score - 1, $mgdleft);      
                printf(' %d ', $article->score);      
                if (!$action)      
                  printf('<a href="%s/topic/article/%d.html?score=%d"
class="navi">%s</a>',      
                         $mgdroot, $article->id,
$article->score + 1, $mgdright); ?></p></td></tr>      
  <tr><td><p>Created:</p></td>      
      <td><p><? echo strftime('%c', $article->created);      
                if ($p = mgd_get_person($article->creator))      
                  printf(' by <a
href="%s/group/person/%d.html">%s</a>',      
                         $mgdroot, $p->id,
htmlentities($p->name)); ?></p></td></tr>      
  <tr><td><p>Modified:</p></td>      
      <td><p><? if ($article->revised > $article->created) {      
                  echo strftime('%c', $article->revised);      
                  if ($p = mgd_get_person($article->revisor))      
                    printf(' by <a
href="%s/group/person/%d.html">%s</a>',      
                           $mgdroot, $p->id,
htmlentities($p->name));      
                  printf(' revision %d',
$article->revision);      
                } else      
                  echo 'never'; ?></p></td></tr>      
  <tr><td><p>Approved:</p></td>      
      <td><p><? if ($article->approved) {      
                  echo strftime('%c', $article->approved);      
                  if ($p = mgd_get_person($article->approver))      
                    printf(' by <a
href="%s/group/person/%d.html">%s</a>',      
                           $mgdroot, $p->id,
htmlentities($p->name));      
                  if ($article->revised >
$article->approved)      
                    echo ' modified recently';      
                } else      
                  echo 'never'; ?></p></td></tr>      
  <tr><td><p>Locked:</p></td>      
      <td><p><? if ($article->locker) {      
                  echo strftime('%c', $article->locked);      
                  if ($p = mgd_get_person($article->locker))      
                    printf(' by <a
href="%s/group/person/%d.html">%s</a>',      
                           $mgdroot, $p->id,
htmlentities($p->name));      
                  else      
                    printf(' by person #%d',
$article->locker);      
                } else      
                  echo 'not locked'; ?></p></td></tr>      
<? } ?>      
      
<? if ($action) {      
     if ($startdate) {      
       $sdate = getdate($startdate);      
       $sday   = $sdate['mday'];      
       $smonth = $sdate['mon'];      
       $syear  = $sdate['year'];      
       $edate = getdate($startdate + $caldays*60*60*24);      
       $eday   = $edate['mday'];      
       $emonth = $edate['mon'];      
       $eyear  = $edate['year'];      
     } else      
       $sday = $smonth = $syear = $eday = $emonth = $eyear =
0;      
     $mon = array(0 => 'NA', 1 => 'January', 2 =>
'February', 3 => 'March',      
                  4 => 'April', 5 => 'May', 6 => 'June', 7
=> 'July',      
                  8 => 'August', 9 => 'September', 10 =>
'October',      
                  11 => 'November', 12 => 'December'); ?>      
  <tr><td><p>Start date:</p></td>      
      <td><select name="sday"><? for ($i = 0; $i < 32; $i++)
echo '<option value="', $i, (($sday == $i) ? '" selected>' :
'">'), $i ? $i : 'NA', '</option>'; ?></select>      
          <select name="smonth"><? reset($mon); while
(list($i,$n) = each($mon)) { echo '<option value="', $i,
(($smonth == $i) ? '" selected>' : '">'), $n, '</option>'; }
?></select>      
          <select name="syear"><option value="0"<? if
(!$syear) echo ' selected'; ?>>NA</option><? for ($i = 1997;
$i < 2020; $i++) { echo '<option value="', $i, (($syear ==
$i) ? '" selected>' : '">'), $i, '</option>'; }
?></select></td></tr>      
  <tr><td><p>End date:</p></td>      
      <td><select name="eday"><? for ($i = 0; $i < 32; $i++)
echo '<option value="', $i, (($eday == $i) ? '" selected>' :
'">'), $i ? $i : 'NA', '</option>'; ?></select>      
          <select name="emonth"><? reset($mon); while
(list($i,$n) = each($mon)) { echo '<option value="', $i,
(($emonth == $i) ? '" selected>' : '">'), $n, '</option>'; }
?></select>      
          <select name="eyear"><option value="0"<? if
(!$eyear) echo ' selected'; ?>>NA</option><? for ($i = 1997;
$i < 2020; $i++) { echo '<option value="', $i, (($eyear ==
$i) ? '" selected>' : '">'), $i, '</option>'; }
?></select></td></tr>      
<? } else { ?>      
  <tr><td><p>Calendar:</p></td>      
      <td><p><? if ($article->startdate) {      
                  echo strftime('%d %b %Y',
$article->startdate);      
                  if ($article->caldays)      
                    echo ' - ', strftime('%d %b %Y',
$article->startdate + $article->caldays*60*60*24);      
                } else      
                  echo 'not set'; ?></p></td></tr>      
<? } ?>      
  <tr><td><p>Prev. Page:</p></td>      
      <td><? if ($action) { ?><input type="text" name="up"
value="&(up);" size="40"><? } elseif ($article->up) {
?><p><a href="&(article.up);">&(article.up);</a></p><? }
else { ?>&nbsp;<? } ?></td></tr>    
  <tr><td><p>Url:</p></td>      
      <td><? if ($action) { ?><input type="text" name="url"
value="&(url);" size="40"><? } elseif ($article->url) {
?><p><a href="&(article.url);">&(article.url);</a></p><? }
else { ?>&nbsp;<? } ?></td></tr>      
</table>      
      
<? /* ADMINISTRATION LINKS */ ?>      
<p>      
<? if ($action) { ?>      
<input type="submit" name="&(action);" value="Submit">      
<input type="reset" value="Reset">      
<? } else { ?>      
<?php   if ($article->up): ?>      
<a href="&(mgdroot);/topic/article/&(article.up);.html"
class="navi">&(mgdleft:h);&nbsp;Parent&nbsp;article</a>      
<?php   else: ?>      
<a href="&(mgdroot);/topic/&(article.topic);.html"
class="navi">&(mgdleft:h);&nbsp;Go&nbsp;to&nbsp;topic</a>      
<?php   endif; ?>      
<a href="&(mgdroot);/topic/article/&(article.id);.html?action=modify"
class="navi">&(mgdedit:h);&nbsp;Modify</a>      
<a href="&(mgdroot);/topic/article/&(article.id);.html?action=delete"
class="navi">&(mgddel:h);&nbsp;Delete</a>      
<a href="&(mgdroot);/topic/article/&(article.id);.html?approve=1"
class="navi">&(mgdok:h);&nbsp;Approve</a>      
<a href="&(mgdroot);/topic/article/&(article.id);.html?lock=1"
class="navi"><? echo $article->locker ? "$mgdon&nbsp;Unlock"
: "$mgdoff&nbsp;Lock"; ?></a>      
<? } ?>      
</p>      
    
<h3>Byline:</h3>    
<? if ($action) { ?><input type="text" name="extra1"
value="&(extra1);" size="40"><? } else {
?><p>&(article.extra1);</p><? } ?>      
   
<h3>Blurb:</h3>   
<? if ($action) { ?><input type="text" name="extra2"
value="&(extra2);" size="50"><? } else {
?><p>&(article.extra2);</p><? } ?>   
      
<? /* ARTICLE CONTENT */ ?>      
<h3>Abstract:</h3>      
<? if ($action) { ?>      
<textarea name="abstract" rows="5" cols="60"
wrap="soft">&(abstract);</textarea>      
<? } else { ?>      
<p class="abstract">      
&(article.abstract);      
</p>      
<? } ?>      
      
<h3>Content:</h3>      
<? if ($action) { ?>      
<textarea name="content" rows="10" cols="60"
wrap="soft">&(content);</textarea>      
<? } else { ?>      
<P>&(article.content);</P>      
<? } ?>      
      
<h3>Extra information:</h3>      
<table border="0" cellspacing="5">      
  <tr><td><p>Type:</p></td><td><? if ($action) { ?><input
type="text" name="type" value="&(type);" size="5"><? } else
{ ?><p>&(article.type);</p><? } ?></td></tr>      
  <tr><td><p>IDs:</p></td><td>      
<? if ($action) { ?>      
<input type="text" name="icon" value="&(icon);" size="5">      
<input type="text" name="view" value="&(view);" size="5">      
<input type="text" name="print" value="&(print);" size="5">      
<? } else { ?>      
<p>icon: &(article.icon);, view: &(article.view);, print:
&(article.print);</p>      
<? } ?>      
     </td></tr>      
   
  <tr><td><p>Related articles:</p></td><td><? if ($action) {
?><input type="text" name="extra3" value="&(extra3);"
size="40"><? } else { ?><p>&(article.extra3);</p><? }
?></td></tr>   
</table>      
    
<?php if ($r = mgd_list_reply_articles($article->id)): ?>      
<h3>Replies</h3>      
<ul>    
<?php   while ($r->fetch()): ?>      
  <li><a href="&(mgdroot);/topic/article/&(r.id);.html">&(r.title);</a></li>      
<?php   endwhile; ?>      
</ul>      
<?php endif; ?>      
      
<? if ($action) { ?>      
</form>      
<? } ?>      
      
<? } ?>      
      
<? } ?>


(By the way, PLEASE NOTE that I've REPURPOSED all the Extra
fields for "Byline", "Blurb" and "Related Articles"
functionality. It was done to meet the content needs of
RadioDigest.)

I'm SURE there is a better way of doing this, and I'm SURE
I've made some mistakes. However, it seems to work just
spiffy.

Alexander, Emiliano, et all, probably have a slicker Admin
Interface up their sleves...

--
This is The Midgard Project's mailing list. For more information,
please visit the project's web site at http://www.midgard-project.org

To unsubscribe the list, send an empty email message to address
[EMAIL PROTECTED]

Reply via email to