Not logged in. · Lost password · Register
Forum: General Help and Support Templates and Layout RSS
Mark minor changes and new pages
Modification of /inc/html.php
Avatar
Wolfgang_F. #1
Member since Jul 2007 · 24 posts
Group memberships: Members
Show profile · Link to this post
Subject: Mark minor changes and new pages
I modified my /inc/html.php to mark minor changes and new pages.

That way
  • minor changes are marked with a bold M if you look at recent changes or old revisions
  • if a page is new, "neu" (not "new" because my language is German) is displayed after summary in recent changes (maybe in lang.php a "new_page" entry would be a better idea) - my style "recent_new" looks that way:
.recent_new {
  color: #FF0000;
  line-height: 0.6em;
  font-size: 0.75em;
  position:relative;
  top:-7px;
  padding-left: 0.1em;
}


Have a look at http://www.heine-wiki.de/doku.php?do=recent
What do you think about it? Perhaps something like that should be included in one of the next DokuWiki-Releases (?)

The following code should be around line 420 - I don't know exactly because I have allready done some changes in my html.php
  1. /**
  2. * list old revisions
  3. *
  4. * @author Andreas Gohr <andi@splitbrain.org>
  5. * @author Ben Coburn <btcoburn@silicodon.net>
  6. */
  7. function html_revisions($first=0){
  8.  global $ID;
  9.  global $INFO;
  10.  global $conf;
  11.  global $lang;
  12.  /* we need to get one additionally log entry to be able to
  13.    * decide if this is the last page or is there another one.
  14.    * see html_recent()
  15.    */
  16.  $revisions = getRevisions($ID, $first, $conf['recent']+1);
  17.  if(count($revisions)==0 && $first!=0){
  18.     $first=0;
  19.     $revisions = getRevisions($ID, $first, $conf['recent']+1);;
  20.  }
  21.  $hasNext = false;
  22.  if (count($revisions)>$conf['recent']) {
  23.     $hasNext = true;
  24.     array_pop($revisions); // remove extra log entry
  25.  }
  26.  
  27.  $date = @date($conf['dformat'],$INFO['lastmod']);
  28.  
  29.  print p_locale_xhtml('revisions');
  30.  print '<ul>';
  31.  if($INFO['exists'] && $first==0){
  32.     print (isset($INFO['meta']) && isset($INFO['meta']['last_change']) && $INFO['meta']['last_change']['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) ? '<li class="minor">' : '<li>';
  33.     print '<div class="li">';
  34.  
  35.     print $date;
  36.  
  37.     print ' <img src="'.DOKU_BASE.'lib/images/blank.gif" width="15" height="11" alt="" /> ';
  38.  
  39.    /***********************  mark minor change  **************************************************/
  40.     print (isset($INFO['meta']) && isset($INFO['meta']['last_change']) && $INFO['meta']['last_change']['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) ? '<b>M</b> ' : '<img src="'.DOKU_BASE.'lib/images/blank.gif" width="17" height="11" alt="" />';
  41.    /**********************************************************************************************/
  42.  
  43.     print '<a class="wikilink1" href="'.wl($ID).'">'.$ID.'</a> ';
  44.  
  45.     print ' &ndash; ';
  46.  
  47.    /*********************** $lang['minoredit'] if summary is empty *******************************/
  48.    /**  print $INFO['sum']; changed line to: */
  49.     print (empty($INFO['sum']))?($lang['minoredit']):$INFO['sum'];
  50.    /**********************************************************************************************/
  51.  
  52.     print ' &ndash; ';
  53.     print ' <span class="user">';
  54.     print (empty($INFO['editor']))?('('.$lang['external_edit'].')'):$INFO['editor'];
  55.     print '</span> ';
  56.  
  57.     print '('.$lang['current'].')';
  58.     print '</div>';
  59.     print '</li>';
  60.  }
  61.  
  62.  foreach($revisions as $rev){
  63.     $date = date($conf['dformat'],$rev);
  64.     $info = getRevisionInfo($ID,$rev,true);
  65.  
  66.     print ($info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) ? '<li class="minor">' : '<li>';
  67.     print '<div class="li">';
  68.     print $date;
  69.  
  70.     if(@file_exists(wikiFN($ID,$rev))){
  71.       print ' <a href="'.wl($ID,"rev=$rev,do=diff").'">';
  72.       $p = array();
  73.       $p['src']    = DOKU_BASE.'lib/images/diff.png';
  74.       $p['width']  = 15;
  75.       $p['height'] = 11;
  76.       $p['title']  = $lang['diff'];
  77.       $p['alt']    = $lang['diff'];
  78.       $att = buildAttributes($p);
  79.       print "<img $att />";
  80.       print '</a> ';
  81.  
  82.    /***********************  mark minor changes  *************************************************/
  83.       print ($info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) ? '<b>M</b> ' : '<img src="'.DOKU_BASE.'lib/images/blank.gif" width="17" height="11" alt="" />';
  84.    /**********************************************************************************************/
  85.  
  86.       print '<a class="wikilink1" href="'.wl($ID,"rev=$rev").'">'.$ID.'</a>';
  87.     }else{
  88.       print ' <img src="'.DOKU_BASE.'lib/images/blank.gif" width="15" height="11" alt="" /> ';
  89.       print $ID;
  90.     }
  91.  
  92.     print ' &ndash; ';
  93.  
  94.    /*********************** $lang['minoredit'] if summary is empty *******************************/
  95.    /**   print htmlspecialchars($info['sum']);  changed line to: */
  96.     print (empty($info['sum']))?($lang['minoredit']):htmlspecialchars($info['sum']);
  97.    /**********************************************************************************************/
  98.  
  99.     print ' &ndash; ';
  100.     print ' <span class="user">';
  101.     if($info['user']){
  102.       print $info['user'];
  103.     }else{
  104.       print $info['ip'];
  105.     }
  106.     print '</span>';
  107.  
  108.     print '</div>';
  109.     print '</li>';
  110.  }
  111.  print '</ul>';
  112.  
  113.  print '<div class="pagenav">';
  114.  $last = $first + $conf['recent'];
  115.  if ($first > 0) {
  116.     $first -= $conf['recent'];
  117.     if ($first < 0) $first = 0;
  118.     print '<div class="pagenav-prev">';
  119.     print html_btn('newer',$ID,"p",array('do' => 'revisions', 'first' => $first));
  120.     print '</div>';
  121.  }
  122.  if ($hasNext) {
  123.     print '<div class="pagenav-next">';
  124.     print html_btn('older',$ID,"n",array('do' => 'revisions', 'first' => $last));
  125.     print '</div>';
  126.  }
  127.  print '</div>';
  128.  
  129. }
  130.  
  131. /**
  132. * display recent changes
  133. *
  134. * @author Andreas Gohr <andi@splitbrain.org>
  135. * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net>
  136. * @author Ben Coburn <btcoburn@silicodon.net>
  137. */
  138. function html_recent($first=0){
  139.  global $conf;
  140.  global $lang;
  141.  global $ID;
  142.  /* we need to get one additionally log entry to be able to
  143.    * decide if this is the last page or is there another one.
  144.    * This is the cheapest solution to get this information.
  145.    */
  146.  $recents = getRecents($first,$conf['recent'] + 1,getNS($ID));
  147.  if(count($recents) == 0 && $first != 0){
  148.     $first=0;
  149.     $recents = getRecents($first,$conf['recent'] + 1,getNS($ID));
  150.  }
  151.  $hasNext = false;
  152.  if (count($recents)>$conf['recent']) {
  153.     $hasNext = true;
  154.     array_pop($recents); // remove extra log entry
  155.  }
  156.  
  157.  print p_locale_xhtml('recent');
  158.  print '<ul>';
  159.  
  160.  foreach($recents as $recent){
  161.     $date = date($conf['dformat'],$recent['date']);
  162.     print ($recent['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) ? '<li class="minor">' : '<li>';
  163.     print '<div class="li">';
  164.  
  165.     print $date.' ';
  166.     print '<a href="'.wl($recent['id'],"do=diff").'">';
  167.     $p = array();
  168.     $p['src']    = DOKU_BASE.'lib/images/diff.png';
  169.     $p['width']  = 15;
  170.     $p['height'] = 11;
  171.     $p['title']  = $lang['diff'];
  172.     $p['alt']    = $lang['diff'];
  173.     $att = buildAttributes($p);
  174.     print "<img $att />";
  175.     print '</a> ';
  176.  
  177.     print '<a href="'.wl($recent['id'],"do=revisions").'">';
  178.     $p = array();
  179.     $p['src']    = DOKU_BASE.'lib/images/history.png';
  180.     $p['width']  = 12;
  181.     $p['height'] = 14;
  182.     $p['title']  = $lang['btn_revs'];
  183.     $p['alt']    = $lang['btn_revs'];
  184.     $att = buildAttributes($p);
  185.     print "<img $att />";
  186.     print '</a> ';
  187.  
  188.    /***********************  mark minor changes  *************************************************/
  189.     print ($recent['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) ? '<b>M</b> ' : '<img src="'.DOKU_BASE.'lib/images/blank.gif" width="17" height="11" alt="" />';
  190.    /**********************************************************************************************/
  191.  
  192.     print html_wikilink(':'.$recent['id'],$conf['useheading']?NULL:$recent['id']);
  193.  
  194.    /***********************  mark new pages  *****************************************************/
  195.     print ($recent['type']===DOKU_CHANGE_TYPE_CREATE) ? '<span class="recent_new">[neu]</span>' : '';
  196.    /**********************************************************************************************/
  197.  
  198.    /***********************  $lang['minoredit'] if summary is empty ******************************/
  199.    /*  print ' &ndash; '.htmlspecialchars($recent['sum']);  changed line to:  */
  200.     print ' &ndash; ';
  201.     print (empty($recent['sum']))?($lang['minoredit']):htmlspecialchars($recent['sum']);
  202.    /**********************************************************************************************/
  203.  
  204.     print ' <span class="user">';
  205.     print ' &ndash; ';
  206.     if($recent['user']){
  207.       print $recent['user'];
  208.     }else{
  209.       print $recent['ip'];
  210.     }
  211.     print '</span>';
  212.  
  213.     print '</div>';
  214.     print '</li>';
  215.  }
  216.  print '</ul>';
  217.  
  218.  print '<div class="pagenav">';
  219.  $last = $first + $conf['recent'];
  220.  if ($first > 0) {
  221.     $first -= $conf['recent'];
  222.     if ($first < 0) $first = 0;
  223.     print '<div class="pagenav-prev">';
  224.     print html_btn('newer','',"p",array('do' => 'recent', 'first' => $first));
  225.     print '</div>';
  226.  }
  227.  if ($hasNext) {
  228.     print '<div class="pagenav-next">';
  229.     print html_btn('older','',"n",array('do' => 'recent', 'first' => $last));
  230.     print '</div>';
  231.  }
  232.  print '</div>';
  233. }
This post was edited 2 times, last on 2007-10-29, 20:11 by Wolfgang_F..
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
Imprint
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2019-10-16, 07:46:36 (UTC +02:00)