1ed7b5f09Sandi<?php 215fae107Sandi/** 315fae107Sandi * HTML output functions 415fae107Sandi * 515fae107Sandi * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 615fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 715fae107Sandi */ 815fae107Sandi 9ed7b5f09Sandiif(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/'); 10e226efe1SAndreas Gohrif(!defined('NL')) define('NL',"\n"); 116bbae538Sandirequire_once(DOKU_INC.'inc/parserutils.php'); 12*fdb8d77bSTom N Harrisrequire_once(DOKU_INC.'inc/form.php'); 136bbae538Sandi 14f3f0262cSandi/** 15f3f0262cSandi * Convenience function to quickly build a wikilink 1615fae107Sandi * 1715fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 18f3f0262cSandi */ 1930f1737dSandifunction html_wikilink($id,$name=NULL,$search=''){ 20723d78dbSandi static $xhtml_renderer = NULL; 21723d78dbSandi if(is_null($xhtml_renderer)){ 22fdf3dcb9SMatthias Urlichs require_once(DOKU_INC.'inc/parser/xhtml.php'); 23723d78dbSandi $xhtml_renderer = new Doku_Renderer_xhtml(); 24f3f0262cSandi } 25f3f0262cSandi 26cffcc403Sandi return $xhtml_renderer->internallink($id,$name,$search,true); 27f3f0262cSandi} 28f3f0262cSandi 29f3f0262cSandi/** 30c19fe9c0Sandi * Helps building long attribute lists 31c19fe9c0Sandi * 32c19fe9c0Sandi * @author Andreas Gohr <andi@splitbrain.org> 33c19fe9c0Sandi */ 34c19fe9c0Sandifunction html_attbuild($attributes){ 35c19fe9c0Sandi $ret = ''; 36c19fe9c0Sandi foreach ( $attributes as $key => $value ) { 37c19fe9c0Sandi $ret .= $key.'="'.formtext($value).'" '; 38c19fe9c0Sandi } 39c19fe9c0Sandi return trim($ret); 40c19fe9c0Sandi} 41c19fe9c0Sandi 42c19fe9c0Sandi/** 43f3f0262cSandi * The loginform 4415fae107Sandi * 4515fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 46f3f0262cSandi */ 47f3f0262cSandifunction html_login(){ 48f3f0262cSandi global $lang; 49f3f0262cSandi global $conf; 50f3f0262cSandi global $ID; 51cd52f92dSchris global $auth; 52f3f0262cSandi 53c112d578Sandi print p_locale_xhtml('login'); 54*fdb8d77bSTom N Harris print '<div class="centeralign">'.NL; 55*fdb8d77bSTom N Harris $form = new Doku_Form('dw__login'); 56*fdb8d77bSTom N Harris $form->startFieldset($lang['btn_login']); 57*fdb8d77bSTom N Harris $form->addHidden('id', $ID); 58*fdb8d77bSTom N Harris $form->addHidden('do', 'login'); 59*fdb8d77bSTom N Harris $form->addElement(form_makeTextField('u', $_REQUEST['u'], $lang['user'], 'focus__this', 'block')); 60*fdb8d77bSTom N Harris $form->addElement(form_makePasswordField('p', $lang['pass'], '', 'block')); 61*fdb8d77bSTom N Harris $form->addElement(form_makeCheckboxField('r', '1', $lang['remember'], 'remember__me', 'simple')); 62*fdb8d77bSTom N Harris $form->addElement(form_makeButton('submit', '', $lang['btn_login'])); 63*fdb8d77bSTom N Harris $form->endFieldset(); 64*fdb8d77bSTom N Harris html_form('login', $form); 655b62573aSAndreas Gohr 666957b2eaSAndreas Gohr if($auth && $auth->canDo('addUser') && actionOK('register')){ 67f3f0262cSandi print '<p>'; 68f3f0262cSandi print $lang['reghere']; 691d5856cfSAndreas Gohr print ': <a href="'.wl($ID,'do=register').'" rel="nofollow" class="wikilink1">'.$lang['register'].'</a>'; 70f3f0262cSandi print '</p>'; 71f3f0262cSandi } 728b06d178Schris 736957b2eaSAndreas Gohr if ($auth && $auth->canDo('modPass') && actionOK('resendpwd')) { 748b06d178Schris print '<p>'; 758b06d178Schris print $lang['pwdforget']; 761d5856cfSAndreas Gohr print ': <a href="'.wl($ID,'do=resendpwd').'" rel="nofollow" class="wikilink1">'.$lang['btn_resendpwd'].'</a>'; 778b06d178Schris print '</p>'; 788b06d178Schris } 79*fdb8d77bSTom N Harris print '</div>'.NL; 80f3f0262cSandi} 81f3f0262cSandi 82f3f0262cSandi/** 8315fae107Sandi * prints a section editing button 8435dae8b0SBen Coburn * used as a callback in html_secedit 8515fae107Sandi * 8615fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 8715fae107Sandi */ 8835dae8b0SBen Coburnfunction html_secedit_button($matches){ 89f3f0262cSandi global $ID; 90041d7a86SBen Coburn global $INFO; 91041d7a86SBen Coburn 92041d7a86SBen Coburn $section = $matches[2]; 93041d7a86SBen Coburn $name = $matches[1]; 94041d7a86SBen Coburn 95f3f0262cSandi $secedit = ''; 96f3f0262cSandi $secedit .= '<div class="secedit">'; 97f3f0262cSandi $secedit .= html_btn('secedit',$ID,'', 98f3f0262cSandi array('do' => 'edit', 99306b2c85SDenis Simakov 'lines' => "$section", 100306b2c85SDenis Simakov 'rev' => $INFO['lastmod']), 10135dae8b0SBen Coburn 'post', $name); 102f3f0262cSandi $secedit .= '</div>'; 103f3f0262cSandi return $secedit; 104f3f0262cSandi} 105f3f0262cSandi 10615fae107Sandi/** 10715fae107Sandi * inserts section edit buttons if wanted or removes the markers 10815fae107Sandi * 10915fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 11015fae107Sandi */ 111f3f0262cSandifunction html_secedit($text,$show=true){ 112f3f0262cSandi global $INFO; 11335dae8b0SBen Coburn 114c112d578Sandi if($INFO['writable'] && $show && !$INFO['rev']){ 11535dae8b0SBen Coburn $text = preg_replace_callback('#<!-- SECTION "(.*?)" \[(\d+-\d*)\] -->#', 11635dae8b0SBen Coburn 'html_secedit_button', $text); 117f3f0262cSandi }else{ 11835dae8b0SBen Coburn $text = preg_replace('#<!-- SECTION "(.*?)" \[(\d+-\d*)\] -->#','',$text); 119f3f0262cSandi } 12035dae8b0SBen Coburn 121f3f0262cSandi return $text; 122f3f0262cSandi} 123f3f0262cSandi 124f3f0262cSandi/** 125d6c9c552Smatthiasgrimm * Just the back to top button (in its own form) 1266b13307fSandi * 1276b13307fSandi * @author Andreas Gohr <andi@splitbrain.org> 1286b13307fSandi */ 1296b13307fSandifunction html_topbtn(){ 1306b13307fSandi global $lang; 1316b13307fSandi 1326b13307fSandi $ret = ''; 13311ea018fSAndreas Gohr $ret = '<a class="nolink" href="#dokuwiki__top"><input type="button" class="button" value="'.$lang['btn_top'].'" onclick="window.scrollTo(0, 0)" title="'.$lang['btn_top'].'" /></a>'; 134df7b6005Sandi 1356b13307fSandi return $ret; 1366b13307fSandi} 1376b13307fSandi 1386b13307fSandi/** 139d67ca2c0Smatthiasgrimm * Displays a button (using its own form) 14035dae8b0SBen Coburn * If tooltip exists, the access key tooltip is replaced. 14115fae107Sandi * 14215fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 143f3f0262cSandi */ 14435dae8b0SBen Coburnfunction html_btn($name,$id,$akey,$params,$method='get',$tooltip=''){ 145f3f0262cSandi global $conf; 146f3f0262cSandi global $lang; 147f3f0262cSandi 148f3f0262cSandi $label = $lang['btn_'.$name]; 149f3f0262cSandi 150f3f0262cSandi $ret = ''; 15135dae8b0SBen Coburn $tip = ''; 152f3f0262cSandi 15349c713a3Sandi //filter id (without urlencoding) 15449c713a3Sandi $id = idfilter($id,false); 155f3f0262cSandi 156f3f0262cSandi //make nice URLs even for buttons 1576c7843b5Sandi if($conf['userewrite'] == 2){ 1586c7843b5Sandi $script = DOKU_BASE.DOKU_SCRIPT.'/'.$id; 1596c7843b5Sandi }elseif($conf['userewrite']){ 1606c7843b5Sandi $script = DOKU_BASE.$id; 1616c7843b5Sandi }else{ 1628b00ebcfSandi $script = DOKU_BASE.DOKU_SCRIPT; 163f3f0262cSandi $params['id'] = $id; 164f3f0262cSandi } 165f3f0262cSandi 1664beabca9SAnika Henke $ret .= '<form class="button" method="'.$method.'" action="'.$script.'"><div class="no">'; 167f3f0262cSandi 16806a4bf8fSAndreas Gohr if(is_array($params)){ 169f3f0262cSandi reset($params); 170f3f0262cSandi while (list($key, $val) = each($params)) { 171f3f0262cSandi $ret .= '<input type="hidden" name="'.$key.'" '; 172f3f0262cSandi $ret .= 'value="'.htmlspecialchars($val).'" />'; 173f3f0262cSandi } 17406a4bf8fSAndreas Gohr } 175f3f0262cSandi 17635dae8b0SBen Coburn if ($tooltip!='') { 17735dae8b0SBen Coburn $tip = htmlspecialchars($tooltip); 17811ea018fSAndreas Gohr }else{ 17911ea018fSAndreas Gohr $tip = htmlspecialchars($label); 18011ea018fSAndreas Gohr } 18111ea018fSAndreas Gohr 18211ea018fSAndreas Gohr $ret .= '<input type="submit" value="'.htmlspecialchars($label).'" class="button" '; 18311ea018fSAndreas Gohr if($akey){ 18411ea018fSAndreas Gohr $tip .= ' [ALT+'.strtoupper($akey).']'; 18511ea018fSAndreas Gohr $ret .= 'accesskey="'.$akey.'" '; 18635dae8b0SBen Coburn } 18735dae8b0SBen Coburn $ret .= 'title="'.$tip.'" '; 188f3f0262cSandi $ret .= '/>'; 1894beabca9SAnika Henke $ret .= '</div></form>'; 190f3f0262cSandi 191f3f0262cSandi return $ret; 192f3f0262cSandi} 193f3f0262cSandi 194f3f0262cSandi/** 19515fae107Sandi * show a wiki page 19615fae107Sandi * 19715fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 19815fae107Sandi */ 1996bbae538Sandifunction html_show($txt=''){ 200f3f0262cSandi global $ID; 201f3f0262cSandi global $REV; 202f3f0262cSandi global $HIGH; 203f3f0262cSandi //disable section editing for old revisions or in preview 2045400331dSandi if($txt || $REV){ 2056bbae538Sandi $secedit = false; 2066bbae538Sandi }else{ 2076bbae538Sandi $secedit = true; 208f3f0262cSandi } 209f3f0262cSandi 2106bbae538Sandi if ($txt){ 211f3f0262cSandi //PreviewHeader 21250835be7SAndreas Gohr print '<br id="scroll__here" />'; 213c112d578Sandi print p_locale_xhtml('preview'); 214f3f0262cSandi print '<div class="preview">'; 2159dc2c2afSandi print html_secedit(p_render('xhtml',p_get_instructions($txt),$info),$secedit); 21646723c19SAndreas Gohr print '<div class="clearer"></div>'; 217f3f0262cSandi print '</div>'; 2186bbae538Sandi 219f3f0262cSandi }else{ 220c112d578Sandi if ($REV) print p_locale_xhtml('showrev'); 221c112d578Sandi $html = p_wiki_xhtml($ID,$REV,true); 2226bbae538Sandi $html = html_secedit($html,$secedit); 223f3f0262cSandi print html_hilight($html,$HIGH); 224f3f0262cSandi } 225f3f0262cSandi} 226f3f0262cSandi 227f3f0262cSandi/** 228ee4c4a1bSAndreas Gohr * ask the user about how to handle an exisiting draft 229ee4c4a1bSAndreas Gohr * 230ee4c4a1bSAndreas Gohr * @author Andreas Gohr <andi@splitbrain.org> 231ee4c4a1bSAndreas Gohr */ 232ee4c4a1bSAndreas Gohrfunction html_draft(){ 233ee4c4a1bSAndreas Gohr global $INFO; 234ee4c4a1bSAndreas Gohr global $ID; 235ee4c4a1bSAndreas Gohr global $lang; 236ee4c4a1bSAndreas Gohr global $conf; 237ee4c4a1bSAndreas Gohr $draft = unserialize(io_readFile($INFO['draft'],false)); 238ee4c4a1bSAndreas Gohr $text = cleanText(con($draft['prefix'],$draft['text'],$draft['suffix'],true)); 239ee4c4a1bSAndreas Gohr 240*fdb8d77bSTom N Harris print p_locale_xhtml('draft'); 241*fdb8d77bSTom N Harris $form = new Doku_Form('dw__editform'); 242*fdb8d77bSTom N Harris $form->addHidden('id', $ID); 243*fdb8d77bSTom N Harris $form->addHidden('date', $draft['date']); 244*fdb8d77bSTom N Harris $form->addElement(form_makeWikiText($text, array('readonly'=>'readonly'))); 245*fdb8d77bSTom N Harris $form->addElement(form_makeOpenTag('div', array('id'=>'draft__status'))); 246*fdb8d77bSTom N Harris $form->addElement($lang['draftdate'].' '. date($conf['dformat'],filemtime($INFO['draft']))); 247*fdb8d77bSTom N Harris $form->addElement(form_makeCloseTag('div')); 248*fdb8d77bSTom N Harris $form->addElement(form_makeButton('submit', 'recover', $lang['btn_recover'], array('tabindex'=>'1'))); 249*fdb8d77bSTom N Harris $form->addElement(form_makeButton('submit', 'draftdel', $lang['btn_draftdel'], array('tabindex'=>'2'))); 250*fdb8d77bSTom N Harris $form->addElement(form_makeButton('submit', 'show', $lang['btn_cancel'], array('tabindex'=>'3'))); 251*fdb8d77bSTom N Harris html_form('draft', $form); 252ee4c4a1bSAndreas Gohr} 253ee4c4a1bSAndreas Gohr 254ee4c4a1bSAndreas Gohr/** 255f3f0262cSandi * Highlights searchqueries in HTML code 25615fae107Sandi * 25715fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 2587209be23SAndreas Gohr * @author Harry Fuecks <hfuecks@gmail.com> 259f3f0262cSandi */ 260f3f0262cSandifunction html_hilight($html,$query){ 2617209be23SAndreas Gohr //split at common delimiters 2629d9c165eSAndreas Gohr $queries = preg_split ('/[\s\'"\\\\`()\]\[?:!\.{};,#+*<>\\/]+/',$query,-1,PREG_SPLIT_NO_EMPTY); 263f3f0262cSandi foreach ($queries as $q){ 264f3f0262cSandi $q = preg_quote($q,'/'); 2657209be23SAndreas Gohr $html = preg_replace_callback("/((<[^>]*)|$q)/i",'html_hilight_callback',$html); 266f3f0262cSandi } 267f3f0262cSandi return $html; 268f3f0262cSandi} 269f3f0262cSandi 270f3f0262cSandi/** 2717209be23SAndreas Gohr * Callback used by html_hilight() 2727209be23SAndreas Gohr * 2737209be23SAndreas Gohr * @author Harry Fuecks <hfuecks@gmail.com> 2747209be23SAndreas Gohr */ 2757209be23SAndreas Gohrfunction html_hilight_callback($m) { 2767209be23SAndreas Gohr $hlight = unslash($m[0]); 2777209be23SAndreas Gohr if ( !isset($m[2])) { 278688774a0SAnika Henke $hlight = '<span class="search_hit">'.$hlight.'</span>'; 2797209be23SAndreas Gohr } 2807209be23SAndreas Gohr return $hlight; 2817209be23SAndreas Gohr} 2827209be23SAndreas Gohr 2837209be23SAndreas Gohr/** 28415fae107Sandi * Run a search and display the result 28515fae107Sandi * 28615fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 287f3f0262cSandi */ 288f3f0262cSandifunction html_search(){ 289ed7b5f09Sandi require_once(DOKU_INC.'inc/search.php'); 290506fa893SAndreas Gohr require_once(DOKU_INC.'inc/fulltext.php'); 291f3f0262cSandi global $conf; 292f3f0262cSandi global $QUERY; 293f3f0262cSandi global $ID; 294f3f0262cSandi global $lang; 295f3f0262cSandi 296c112d578Sandi print p_locale_xhtml('searchpage'); 297f3f0262cSandi flush(); 298f3f0262cSandi 299d0ab54f6SMichael Klier chi@chimeric.de //check if search is restricted to namespace 300d0ab54f6SMichael Klier chi@chimeric.de if(preg_match('/([^@]*)@([^@]*)/',$QUERY,$match)) { 301d0ab54f6SMichael Klier chi@chimeric.de $id = cleanID($match[1]); 302d0ab54f6SMichael Klier chi@chimeric.de if(empty($id)) { 303d0ab54f6SMichael Klier chi@chimeric.de print '<div class="nothing">'.$lang['nothingfound'].'</div>'; 304d0ab54f6SMichael Klier chi@chimeric.de flush(); 305d0ab54f6SMichael Klier chi@chimeric.de return; 306d0ab54f6SMichael Klier chi@chimeric.de } 307d0ab54f6SMichael Klier chi@chimeric.de } else { 308d0ab54f6SMichael Klier chi@chimeric.de $id = cleanID($QUERY); 309d0ab54f6SMichael Klier chi@chimeric.de } 310d0ab54f6SMichael Klier chi@chimeric.de 3114d9ff3d5Sandi //show progressbar 312e226efe1SAndreas Gohr print '<div class="centeralign" id="dw__loading">'.NL; 313e226efe1SAndreas Gohr print '<script type="text/javascript" charset="utf-8"><!--//--><![CDATA[//><!--'.NL; 314e226efe1SAndreas Gohr print 'showLoadBar();'.NL; 315e226efe1SAndreas Gohr print '//--><!]]></script>'.NL; 316e226efe1SAndreas Gohr print '<br /></div>'.NL; 3179edac8a8SAndreas Gohr flush(); 3184d9ff3d5Sandi 319f3f0262cSandi //do quick pagesearch 320f3f0262cSandi $data = array(); 321d0ab54f6SMichael Klier chi@chimeric.de 322d0ab54f6SMichael Klier chi@chimeric.de $data = ft_pageLookup($id); 323f3f0262cSandi if(count($data)){ 324f3f0262cSandi sort($data); 325f3f0262cSandi print '<div class="search_quickresult">'; 326746855cfSBen Coburn print '<h3>'.$lang['quickhits'].':</h3>'; 3274f732f0eSAnika Henke print '<ul class="search_quickhits">'; 328140c93f3SAnika Henke foreach($data as $id){ 3294f732f0eSAnika Henke print '<li> '; 330506fa893SAndreas Gohr print html_wikilink(':'.$id,$conf['useheading']?NULL:$id); 3314f732f0eSAnika Henke print '</li> '; 332f3f0262cSandi } 333140c93f3SAnika Henke print '</ul> '; 334f3f0262cSandi //clear float (see http://www.complexspiral.com/publications/containing-floats/) 335f3f0262cSandi print '<div class="clearer"> </div>'; 336f3f0262cSandi print '</div>'; 337f3f0262cSandi } 338f3f0262cSandi flush(); 339f3f0262cSandi 340f3f0262cSandi //do fulltext search 341506fa893SAndreas Gohr $data = ft_pageSearch($QUERY,$poswords); 342f3f0262cSandi if(count($data)){ 343506fa893SAndreas Gohr $num = 1; 344506fa893SAndreas Gohr foreach($data as $id => $cnt){ 345f3f0262cSandi print '<div class="search_result">'; 346506fa893SAndreas Gohr print html_wikilink(':'.$id,$conf['useheading']?NULL:$id,$poswords); 347506fa893SAndreas Gohr print ': <span class="search_cnt">'.$cnt.' '.$lang['hits'].'</span><br />'; 348506fa893SAndreas Gohr if($num < 15){ // create snippets for the first number of matches only #FIXME add to conf ? 349506fa893SAndreas Gohr print '<div class="search_snippet">'.ft_snippet($id,$poswords).'</div>'; 350506fa893SAndreas Gohr } 351f3f0262cSandi print '</div>'; 352506fa893SAndreas Gohr flush(); 353506fa893SAndreas Gohr $num++; 354f3f0262cSandi } 355f3f0262cSandi }else{ 356820fa24bSandi print '<div class="nothing">'.$lang['nothingfound'].'</div>'; 357f3f0262cSandi } 3584d9ff3d5Sandi 3594d9ff3d5Sandi //hide progressbar 360e226efe1SAndreas Gohr print '<script type="text/javascript" charset="utf-8"><!--//--><![CDATA[//><!--'.NL; 361e226efe1SAndreas Gohr print 'hideLoadBar("dw__loading");'.NL; 362e226efe1SAndreas Gohr print '//--><!]]></script>'.NL; 3639edac8a8SAndreas Gohr flush(); 364f3f0262cSandi} 365f3f0262cSandi 36615fae107Sandi/** 36715fae107Sandi * Display error on locked pages 36815fae107Sandi * 36915fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 37015fae107Sandi */ 371ee20e7d1Sandifunction html_locked(){ 372f3f0262cSandi global $ID; 373f3f0262cSandi global $conf; 374f3f0262cSandi global $lang; 37588f522e9Sandi global $INFO; 376f3f0262cSandi 377c9b4bd1eSBen Coburn $locktime = filemtime(wikiLockFN($ID)); 378f3f0262cSandi $expire = @date($conf['dformat'], $locktime + $conf['locktime'] ); 379f3f0262cSandi $min = round(($conf['locktime'] - (time() - $locktime) )/60); 380f3f0262cSandi 381c112d578Sandi print p_locale_xhtml('locked'); 382f3f0262cSandi print '<ul>'; 3830c6b58a8SAndreas Gohr print '<li><div class="li"><strong>'.$lang['lockedby'].':</strong> '.$INFO['locked'].'</li>'; 3840c6b58a8SAndreas Gohr print '<li><div class="li"><strong>'.$lang['lockexpire'].':</strong> '.$expire.' ('.$min.' min)</div></li>'; 385f3f0262cSandi print '</ul>'; 386f3f0262cSandi} 387f3f0262cSandi 38815fae107Sandi/** 38915fae107Sandi * list old revisions 39015fae107Sandi * 39115fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 39271726d78SBen Coburn * @author Ben Coburn <btcoburn@silicodon.net> 39315fae107Sandi */ 39471726d78SBen Coburnfunction html_revisions($first=0){ 395f3f0262cSandi global $ID; 396f3f0262cSandi global $INFO; 397f3f0262cSandi global $conf; 398f3f0262cSandi global $lang; 39971726d78SBen Coburn /* we need to get one additionally log entry to be able to 40071726d78SBen Coburn * decide if this is the last page or is there another one. 40171726d78SBen Coburn * see html_recent() 40271726d78SBen Coburn */ 40371726d78SBen Coburn $revisions = getRevisions($ID, $first, $conf['recent']+1); 40471726d78SBen Coburn if(count($revisions)==0 && $first!=0){ 40571726d78SBen Coburn $first=0; 40671726d78SBen Coburn $revisions = getRevisions($ID, $first, $conf['recent']+1);; 40771726d78SBen Coburn } 40871726d78SBen Coburn $hasNext = false; 40971726d78SBen Coburn if (count($revisions)>$conf['recent']) { 41071726d78SBen Coburn $hasNext = true; 41171726d78SBen Coburn array_pop($revisions); // remove extra log entry 41271726d78SBen Coburn } 41371726d78SBen Coburn 414f3f0262cSandi $date = @date($conf['dformat'],$INFO['lastmod']); 415f3f0262cSandi 416c112d578Sandi print p_locale_xhtml('revisions'); 41777707b04SAndreas Gohr print '<form action="'.wl($ID).'" method="post" id="page__revisions">'; 418f3f0262cSandi print '<ul>'; 41971726d78SBen Coburn if($INFO['exists'] && $first==0){ 420ebf1501fSBen Coburn print (isset($INFO['meta']) && isset($INFO['meta']['last_change']) && $INFO['meta']['last_change']['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) ? '<li class="minor">' : '<li>'; 4210c6b58a8SAndreas Gohr print '<div class="li">'; 42277707b04SAndreas Gohr print '<input type="checkbox" name="rev2[]" value="current" /> '; 423f9b2fe70Sandi 424f9b2fe70Sandi print $date; 425f9b2fe70Sandi 42602e51121SAnika Henke print ' <img src="'.DOKU_BASE.'lib/images/blank.gif" width="15" height="11" alt="" /> '; 427cffcc403Sandi 428f9b2fe70Sandi print '<a class="wikilink1" href="'.wl($ID).'">'.$ID.'</a> '; 429652610a2Sandi 43041396b71SAndreas Gohr print ' – '; 431652610a2Sandi print $INFO['sum']; 43288f522e9Sandi print ' <span class="user">'; 4335aa52fafSBen Coburn print (empty($INFO['editor']))?('('.$lang['external_edit'].')'):$INFO['editor']; 43488f522e9Sandi print '</span> '; 435652610a2Sandi 436652610a2Sandi print '('.$lang['current'].')'; 4370c6b58a8SAndreas Gohr print '</div>'; 438652610a2Sandi print '</li>'; 439f3f0262cSandi } 440f3f0262cSandi 441f3f0262cSandi foreach($revisions as $rev){ 442f3f0262cSandi $date = date($conf['dformat'],$rev); 443fb53bfe2SBen Coburn $info = getRevisionInfo($ID,$rev,true); 44477707b04SAndreas Gohr $exists = @file_exists(wikiFN($ID,$rev)); 44577707b04SAndreas Gohr 44677707b04SAndreas Gohr 447652610a2Sandi 448ebf1501fSBen Coburn print ($info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) ? '<li class="minor">' : '<li>'; 4490c6b58a8SAndreas Gohr print '<div class="li">'; 45077707b04SAndreas Gohr if($exists){ 45177707b04SAndreas Gohr print '<input type="checkbox" name="rev2[]" value="'.$rev.'" /> '; 45277707b04SAndreas Gohr }else{ 45377707b04SAndreas Gohr print '<img src="'.DOKU_BASE.'lib/images/blank.gif" width="14" height="11" alt="" /> '; 45477707b04SAndreas Gohr } 455f9b2fe70Sandi print $date; 456f9b2fe70Sandi 45777707b04SAndreas Gohr if($exists){ 458cffcc403Sandi print ' <a href="'.wl($ID,"rev=$rev,do=diff").'">'; 459d94f4568SAndreas Gohr $p = array(); 460d94f4568SAndreas Gohr $p['src'] = DOKU_BASE.'lib/images/diff.png'; 461d94f4568SAndreas Gohr $p['width'] = 15; 462d94f4568SAndreas Gohr $p['height'] = 11; 463d94f4568SAndreas Gohr $p['title'] = $lang['diff']; 464d94f4568SAndreas Gohr $p['alt'] = $lang['diff']; 465d94f4568SAndreas Gohr $att = buildAttributes($p); 466d94f4568SAndreas Gohr print "<img $att />"; 467cffcc403Sandi print '</a> '; 468cffcc403Sandi 469f9b2fe70Sandi print '<a class="wikilink1" href="'.wl($ID,"rev=$rev").'">'.$ID.'</a>'; 47041396b71SAndreas Gohr }else{ 47141396b71SAndreas Gohr print ' <img src="'.DOKU_BASE.'lib/images/blank.gif" width="15" height="11" alt="" /> '; 47241396b71SAndreas Gohr print $ID; 47341396b71SAndreas Gohr } 474f9b2fe70Sandi 47541396b71SAndreas Gohr print ' – '; 476f243a77fSandi print htmlspecialchars($info['sum']); 47788f522e9Sandi print ' <span class="user">'; 47888f522e9Sandi if($info['user']){ 47988f522e9Sandi print $info['user']; 48088f522e9Sandi }else{ 481652610a2Sandi print $info['ip']; 48288f522e9Sandi } 48388f522e9Sandi print '</span>'; 484652610a2Sandi 4850c6b58a8SAndreas Gohr print '</div>'; 486f3f0262cSandi print '</li>'; 487f3f0262cSandi } 488f3f0262cSandi print '</ul>'; 48977707b04SAndreas Gohr print '<input name="do[diff]" type="submit" value="'.$lang['diff2'].'" class="button" />'; 49077707b04SAndreas Gohr print '</form>'; 49171726d78SBen Coburn 49271726d78SBen Coburn print '<div class="pagenav">'; 49371726d78SBen Coburn $last = $first + $conf['recent']; 49471726d78SBen Coburn if ($first > 0) { 49571726d78SBen Coburn $first -= $conf['recent']; 49671726d78SBen Coburn if ($first < 0) $first = 0; 49771726d78SBen Coburn print '<div class="pagenav-prev">'; 498eeb83e57SBen Coburn print html_btn('newer',$ID,"p",array('do' => 'revisions', 'first' => $first)); 49971726d78SBen Coburn print '</div>'; 50071726d78SBen Coburn } 50171726d78SBen Coburn if ($hasNext) { 50271726d78SBen Coburn print '<div class="pagenav-next">'; 503eeb83e57SBen Coburn print html_btn('older',$ID,"n",array('do' => 'revisions', 'first' => $last)); 50471726d78SBen Coburn print '</div>'; 50571726d78SBen Coburn } 50671726d78SBen Coburn print '</div>'; 50771726d78SBen Coburn 508f3f0262cSandi} 509f3f0262cSandi 51015fae107Sandi/** 51115fae107Sandi * display recent changes 51215fae107Sandi * 51315fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 5145749f1ceSmatthiasgrimm * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net> 51571726d78SBen Coburn * @author Ben Coburn <btcoburn@silicodon.net> 51615fae107Sandi */ 517a39955b0Smatthiasgrimmfunction html_recent($first=0){ 518f3f0262cSandi global $conf; 519cffcc403Sandi global $lang; 520dbb00abcSEsther Brunner global $ID; 5215749f1ceSmatthiasgrimm /* we need to get one additionally log entry to be able to 5225749f1ceSmatthiasgrimm * decide if this is the last page or is there another one. 5235749f1ceSmatthiasgrimm * This is the cheapest solution to get this information. 5245749f1ceSmatthiasgrimm */ 525b6912aeaSAndreas Gohr $recents = getRecents($first,$conf['recent'] + 1,getNS($ID)); 5265749f1ceSmatthiasgrimm if(count($recents) == 0 && $first != 0){ 5275749f1ceSmatthiasgrimm $first=0; 52871726d78SBen Coburn $recents = getRecents($first,$conf['recent'] + 1,getNS($ID)); 5295749f1ceSmatthiasgrimm } 53071726d78SBen Coburn $hasNext = false; 53171726d78SBen Coburn if (count($recents)>$conf['recent']) { 53271726d78SBen Coburn $hasNext = true; 53371726d78SBen Coburn array_pop($recents); // remove extra log entry 53471726d78SBen Coburn } 535f3f0262cSandi 536c112d578Sandi print p_locale_xhtml('recent'); 537f3f0262cSandi print '<ul>'; 538a39955b0Smatthiasgrimm 539d437bcc4SAndreas Gohr foreach($recents as $recent){ 540d437bcc4SAndreas Gohr $date = date($conf['dformat'],$recent['date']); 541ebf1501fSBen Coburn print ($recent['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) ? '<li class="minor">' : '<li>'; 5420c6b58a8SAndreas Gohr print '<div class="li">'; 543cffcc403Sandi 544f9b2fe70Sandi print $date.' '; 545f9b2fe70Sandi 546d437bcc4SAndreas Gohr print '<a href="'.wl($recent['id'],"do=diff").'">'; 547d94f4568SAndreas Gohr $p = array(); 548d94f4568SAndreas Gohr $p['src'] = DOKU_BASE.'lib/images/diff.png'; 549d94f4568SAndreas Gohr $p['width'] = 15; 550d94f4568SAndreas Gohr $p['height'] = 11; 551d94f4568SAndreas Gohr $p['title'] = $lang['diff']; 552d94f4568SAndreas Gohr $p['alt'] = $lang['diff']; 553d94f4568SAndreas Gohr $att = buildAttributes($p); 554d94f4568SAndreas Gohr print "<img $att />"; 555cffcc403Sandi print '</a> '; 556cffcc403Sandi 557d437bcc4SAndreas Gohr print '<a href="'.wl($recent['id'],"do=revisions").'">'; 558d94f4568SAndreas Gohr $p = array(); 559d94f4568SAndreas Gohr $p['src'] = DOKU_BASE.'lib/images/history.png'; 560d94f4568SAndreas Gohr $p['width'] = 12; 561d94f4568SAndreas Gohr $p['height'] = 14; 562d94f4568SAndreas Gohr $p['title'] = $lang['btn_revs']; 563d94f4568SAndreas Gohr $p['alt'] = $lang['btn_revs']; 564d94f4568SAndreas Gohr $att = buildAttributes($p); 565d94f4568SAndreas Gohr print "<img $att />"; 566cffcc403Sandi print '</a> '; 567cffcc403Sandi 568d437bcc4SAndreas Gohr print html_wikilink(':'.$recent['id'],$conf['useheading']?NULL:$recent['id']); 56941396b71SAndreas Gohr print ' – '.htmlspecialchars($recent['sum']); 570b6912aeaSAndreas Gohr 57188f522e9Sandi print ' <span class="user">'; 572d437bcc4SAndreas Gohr if($recent['user']){ 573d437bcc4SAndreas Gohr print $recent['user']; 57488f522e9Sandi }else{ 575d437bcc4SAndreas Gohr print $recent['ip']; 57688f522e9Sandi } 57788f522e9Sandi print '</span>'; 578cffcc403Sandi 5790c6b58a8SAndreas Gohr print '</div>'; 580f3f0262cSandi print '</li>'; 581f3f0262cSandi } 582f3f0262cSandi print '</ul>'; 583a39955b0Smatthiasgrimm 584a39955b0Smatthiasgrimm print '<div class="pagenav">'; 5855749f1ceSmatthiasgrimm $last = $first + $conf['recent']; 586a39955b0Smatthiasgrimm if ($first > 0) { 587a39955b0Smatthiasgrimm $first -= $conf['recent']; 588a39955b0Smatthiasgrimm if ($first < 0) $first = 0; 589a39955b0Smatthiasgrimm print '<div class="pagenav-prev">'; 5905749f1ceSmatthiasgrimm print html_btn('newer','',"p",array('do' => 'recent', 'first' => $first)); 591a39955b0Smatthiasgrimm print '</div>'; 592a39955b0Smatthiasgrimm } 59371726d78SBen Coburn if ($hasNext) { 594a39955b0Smatthiasgrimm print '<div class="pagenav-next">'; 5955749f1ceSmatthiasgrimm print html_btn('older','',"n",array('do' => 'recent', 'first' => $last)); 596a39955b0Smatthiasgrimm print '</div>'; 597a39955b0Smatthiasgrimm } 598a39955b0Smatthiasgrimm print '</div>'; 599f3f0262cSandi} 600f3f0262cSandi 60115fae107Sandi/** 60215fae107Sandi * Display page index 60315fae107Sandi * 60415fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 60515fae107Sandi */ 606f3f0262cSandifunction html_index($ns){ 607ed7b5f09Sandi require_once(DOKU_INC.'inc/search.php'); 608f3f0262cSandi global $conf; 609f3f0262cSandi global $ID; 610f3f0262cSandi $dir = $conf['datadir']; 611f3f0262cSandi $ns = cleanID($ns); 61230f1737dSandi #fixme use appropriate function 613f3f0262cSandi if(empty($ns)){ 614f3f0262cSandi $ns = dirname(str_replace(':','/',$ID)); 615f3f0262cSandi if($ns == '.') $ns =''; 616f3f0262cSandi } 61788d3a917Sandi $ns = utf8_encodeFN(str_replace(':','/',$ns)); 618f3f0262cSandi 619a06884abSAndreas Gohr echo p_locale_xhtml('index'); 620a06884abSAndreas Gohr echo '<div id="index__tree">'; 621f3f0262cSandi 622f3f0262cSandi $data = array(); 623f3f0262cSandi search($data,$conf['datadir'],'search_index',array('ns' => $ns)); 624a06884abSAndreas Gohr echo html_buildlist($data,'idx','html_list_index','html_li_index'); 625a06884abSAndreas Gohr 626a06884abSAndreas Gohr echo '</div>'; 627f3f0262cSandi} 628f3f0262cSandi 629f3f0262cSandi/** 63015fae107Sandi * Index item formatter 63115fae107Sandi * 632f3f0262cSandi * User function for html_buildlist() 63315fae107Sandi * 63415fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 635f3f0262cSandi */ 636f3f0262cSandifunction html_list_index($item){ 637d98d4540SBen Coburn global $ID; 638f3f0262cSandi $ret = ''; 639f3f0262cSandi $base = ':'.$item['id']; 640f3f0262cSandi $base = substr($base,strrpos($base,':')+1); 641f3f0262cSandi if($item['type']=='d'){ 642ed7ecb79SAnika Henke $ret .= '<a href="'.wl($ID,'idx='.$item['id']).'" class="idx_dir"><strong>'; 643f3f0262cSandi $ret .= $base; 644ed7ecb79SAnika Henke $ret .= '</strong></a>'; 645f3f0262cSandi }else{ 646f3f0262cSandi $ret .= html_wikilink(':'.$item['id']); 647f3f0262cSandi } 648f3f0262cSandi return $ret; 649f3f0262cSandi} 650f3f0262cSandi 651f3f0262cSandi/** 652cb70c441Sandi * Index List item 653cb70c441Sandi * 654cb70c441Sandi * This user function is used in html_build_lidt to build the 655cb70c441Sandi * <li> tags for namespaces when displaying the page index 656cb70c441Sandi * it gives different classes to opened or closed "folders" 657cb70c441Sandi * 658cb70c441Sandi * @author Andreas Gohr <andi@splitbrain.org> 659cb70c441Sandi */ 660cb70c441Sandifunction html_li_index($item){ 661cb70c441Sandi if($item['type'] == "f"){ 662cb70c441Sandi return '<li class="level'.$item['level'].'">'; 663cb70c441Sandi }elseif($item['open']){ 664cb70c441Sandi return '<li class="open">'; 665cb70c441Sandi }else{ 666cb70c441Sandi return '<li class="closed">'; 667cb70c441Sandi } 668cb70c441Sandi} 669cb70c441Sandi 670cb70c441Sandi/** 671cb70c441Sandi * Default List item 672cb70c441Sandi * 673cb70c441Sandi * @author Andreas Gohr <andi@splitbrain.org> 674cb70c441Sandi */ 675cb70c441Sandifunction html_li_default($item){ 676cb70c441Sandi return '<li class="level'.$item['level'].'">'; 677cb70c441Sandi} 678cb70c441Sandi 679cb70c441Sandi/** 68015fae107Sandi * Build an unordered list 68115fae107Sandi * 682f3f0262cSandi * Build an unordered list from the given $data array 683f3f0262cSandi * Each item in the array has to have a 'level' property 684f3f0262cSandi * the item itself gets printed by the given $func user 685cb70c441Sandi * function. The second and optional function is used to 686cb70c441Sandi * print the <li> tag. Both user function need to accept 687cb70c441Sandi * a single item. 68815fae107Sandi * 689c5a8fd96SAndreas Gohr * Both user functions can be given as array to point to 690c5a8fd96SAndreas Gohr * a member of an object. 691c5a8fd96SAndreas Gohr * 69215fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 693f3f0262cSandi */ 694cb70c441Sandifunction html_buildlist($data,$class,$func,$lifunc='html_li_default'){ 695f3f0262cSandi $level = 0; 696f3f0262cSandi $opens = 0; 697f3f0262cSandi $ret = ''; 698f3f0262cSandi 699f3f0262cSandi foreach ($data as $item){ 700f3f0262cSandi 701f3f0262cSandi if( $item['level'] > $level ){ 702f3f0262cSandi //open new list 703df52d0feSandi for($i=0; $i<($item['level'] - $level); $i++){ 704df52d0feSandi if ($i) $ret .= "<li class=\"clear\">\n"; 705f3f0262cSandi $ret .= "\n<ul class=\"$class\">\n"; 706df52d0feSandi } 707f3f0262cSandi }elseif( $item['level'] < $level ){ 708f3f0262cSandi //close last item 709f3f0262cSandi $ret .= "</li>\n"; 710f3f0262cSandi for ($i=0; $i<($level - $item['level']); $i++){ 711f3f0262cSandi //close higher lists 712f3f0262cSandi $ret .= "</ul>\n</li>\n"; 713f3f0262cSandi } 714f3f0262cSandi }else{ 715f3f0262cSandi //close last item 716f3f0262cSandi $ret .= "</li>\n"; 717f3f0262cSandi } 718f3f0262cSandi 719f3f0262cSandi //remember current level 720f3f0262cSandi $level = $item['level']; 721f3f0262cSandi 722f3f0262cSandi //print item 72334dbe711Schris $ret .= call_user_func($lifunc,$item); 7240c6b58a8SAndreas Gohr $ret .= '<div class="li">'; 72534dbe711Schris 72634dbe711Schris $ret .= call_user_func($func,$item); 7270c6b58a8SAndreas Gohr $ret .= '</div>'; 728f3f0262cSandi } 729f3f0262cSandi 730f3f0262cSandi //close remaining items and lists 731f3f0262cSandi for ($i=0; $i < $level; $i++){ 732f3f0262cSandi $ret .= "</li></ul>\n"; 733f3f0262cSandi } 734f3f0262cSandi 735f3f0262cSandi return $ret; 736f3f0262cSandi} 737f3f0262cSandi 73815fae107Sandi/** 73915fae107Sandi * display backlinks 74015fae107Sandi * 74115fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 74215fae107Sandi */ 743f3f0262cSandifunction html_backlinks(){ 74454f4c056SAndreas Gohr require_once(DOKU_INC.'inc/fulltext.php'); 745f3f0262cSandi global $ID; 746f3f0262cSandi global $conf; 747f3f0262cSandi 748c112d578Sandi print p_locale_xhtml('backlinks'); 749f3f0262cSandi 75054f4c056SAndreas Gohr $data = ft_backlinks($ID); 751f3f0262cSandi 752f3f0262cSandi print '<ul class="idx">'; 75354f4c056SAndreas Gohr foreach($data as $blink){ 7540c6b58a8SAndreas Gohr print '<li><div class="li">'; 75554f4c056SAndreas Gohr print html_wikilink(':'.$blink,$conf['useheading']?NULL:$blink); 7560c6b58a8SAndreas Gohr print '</div></li>'; 757f3f0262cSandi } 758f3f0262cSandi print '</ul>'; 759f3f0262cSandi} 760f3f0262cSandi 76115fae107Sandi/** 76215fae107Sandi * show diff 76315fae107Sandi * 76415fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 76515fae107Sandi */ 766f3f0262cSandifunction html_diff($text='',$intro=true){ 767ed7b5f09Sandi require_once(DOKU_INC.'inc/DifferenceEngine.php'); 768f3f0262cSandi global $ID; 769f3f0262cSandi global $REV; 770f3f0262cSandi global $lang; 771f3f0262cSandi global $conf; 772e1bd90ffSAndreas Gohr 77377707b04SAndreas Gohr // we're trying to be clever here, revisions to compare can be either 77477707b04SAndreas Gohr // given as rev and rev2 parameters, with rev2 being optional. Or in an 77577707b04SAndreas Gohr // array in rev2. 77677707b04SAndreas Gohr $rev1 = $REV; 77777707b04SAndreas Gohr if(is_array($_REQUEST['rev2'])){ 77877707b04SAndreas Gohr $rev1 = (int) $_REQUEST['rev2'][0]; 77977707b04SAndreas Gohr $rev2 = (int) $_REQUEST['rev2'][1]; 780f3f0262cSandi }else{ 78177707b04SAndreas Gohr $rev2 = (int) $_REQUEST['rev2']; 7824d58bd99Sandi } 7834d58bd99Sandi 78477707b04SAndreas Gohr if($text){ // compare text to the most current revision 78577707b04SAndreas Gohr $l_rev = ''; 78677707b04SAndreas Gohr $l_text = rawWiki($ID,''); 78777707b04SAndreas Gohr $l_head = '<a class="wikilink1" href="'.wl($ID).'">'. 78877707b04SAndreas Gohr $ID.' '.date($conf['dformat'],@filemtime(wikiFN($ID))).'</a> '. 78977707b04SAndreas Gohr $lang['current']; 79077707b04SAndreas Gohr 79177707b04SAndreas Gohr $r_rev = ''; 79277707b04SAndreas Gohr $r_text = cleanText($text); 79377707b04SAndreas Gohr $r_head = $lang['yours']; 794e1bd90ffSAndreas Gohr }else{ 79577707b04SAndreas Gohr if($rev1 && $rev2){ // two specific revisions wanted 79677707b04SAndreas Gohr // make sure order is correct (older on the right) 79777707b04SAndreas Gohr if($rev1 < $rev2){ 79877707b04SAndreas Gohr $l_rev = $rev1; 79977707b04SAndreas Gohr $r_rev = $rev2; 80077707b04SAndreas Gohr }else{ 80177707b04SAndreas Gohr $l_rev = $rev2; 80277707b04SAndreas Gohr $r_rev = $rev1; 803e1bd90ffSAndreas Gohr } 80477707b04SAndreas Gohr }elseif($rev1){ // single revision given, compare to current 80577707b04SAndreas Gohr $r_rev = ''; 80677707b04SAndreas Gohr $l_rev = $rev1; 80777707b04SAndreas Gohr }else{ // no revision was given, compare previous to current 80877707b04SAndreas Gohr $r_rev = ''; 80977707b04SAndreas Gohr $revs = getRevisions($ID, 0, 1); 81077707b04SAndreas Gohr $l_rev = $revs[0]; 81177707b04SAndreas Gohr } 81277707b04SAndreas Gohr 81377707b04SAndreas Gohr $l_text = rawWiki($ID,$l_rev); 81477707b04SAndreas Gohr $r_text = rawWiki($ID,$r_rev); 81577707b04SAndreas Gohr 81677707b04SAndreas Gohr $l_head = '<a class="wikilink1" href="'.wl($ID,"rev=$l_rev").'">'. 81777707b04SAndreas Gohr $ID.' '.date($conf['dformat'],$l_rev).'</a>'; 81877707b04SAndreas Gohr 81977707b04SAndreas Gohr if($r_rev){ 82077707b04SAndreas Gohr $r_head = '<a class="wikilink1" href="'.wl($ID,"rev=$r_rev").'">'. 82177707b04SAndreas Gohr $ID.' '.date($conf['dformat'],$r_rev).'</a>'; 82277707b04SAndreas Gohr }else{ 82377707b04SAndreas Gohr $r_head = '<a class="wikilink1" href="'.wl($ID).'">'. 82477707b04SAndreas Gohr $ID.' '.date($conf['dformat'],@filemtime(wikiFN($ID))).'</a> '. 825f3f0262cSandi $lang['current']; 826f3f0262cSandi } 82777707b04SAndreas Gohr } 82877707b04SAndreas Gohr 82977707b04SAndreas Gohr $df = new Diff(explode("\n",htmlspecialchars($l_text)), 83077707b04SAndreas Gohr explode("\n",htmlspecialchars($r_text))); 83177707b04SAndreas Gohr 832f3f0262cSandi $tdf = new TableDiffFormatter(); 833c112d578Sandi if($intro) print p_locale_xhtml('diff'); 834f3f0262cSandi ?> 835daf4ca4eSAnika Henke <table class="diff"> 836f3f0262cSandi <tr> 837daf4ca4eSAnika Henke <th colspan="2"> 83877707b04SAndreas Gohr <?php echo $l_head?> 839daf4ca4eSAnika Henke </th> 840daf4ca4eSAnika Henke <th colspan="2"> 84177707b04SAndreas Gohr <?php echo $r_head?> 842daf4ca4eSAnika Henke </th> 843f3f0262cSandi </tr> 8444da078a3Smatthiasgrimm <?php echo $tdf->format($df)?> 845f3f0262cSandi </table> 8464da078a3Smatthiasgrimm <?php 847f3f0262cSandi} 848f3f0262cSandi 84915fae107Sandi/** 85015fae107Sandi * show warning on conflict detection 85115fae107Sandi * 85215fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 85315fae107Sandi */ 854f3f0262cSandifunction html_conflict($text,$summary){ 855f3f0262cSandi global $ID; 856f3f0262cSandi global $lang; 857f3f0262cSandi 858c112d578Sandi print p_locale_xhtml('conflict'); 859*fdb8d77bSTom N Harris $form = new Doku_Form('dw__editform'); 860*fdb8d77bSTom N Harris $form->addHidden('id', $ID); 861*fdb8d77bSTom N Harris $form->addHidden('wikitext', $text); 862*fdb8d77bSTom N Harris $form->addHidden('summary', $summary); 863*fdb8d77bSTom N Harris $form->addElement(form_makeButton('submit', 'save', $lang['btn_save'], array('accesskey'=>'s'))); 864*fdb8d77bSTom N Harris $form->addElement(form_makeButton('submit', 'cancel', $lang['btn_cancel'])); 865*fdb8d77bSTom N Harris html_form('conflict', $form); 866*fdb8d77bSTom N Harris print '<br /><br /><br /><br />'.NL; 867f3f0262cSandi} 868f3f0262cSandi 869f3f0262cSandi/** 87015fae107Sandi * Prints the global message array 87115fae107Sandi * 87215fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 873f3f0262cSandi */ 874f3f0262cSandifunction html_msgarea(){ 875f3f0262cSandi global $MSG; 876f3f0262cSandi 877f3f0262cSandi if(!isset($MSG)) return; 878f3f0262cSandi 879f3f0262cSandi foreach($MSG as $msg){ 880f3f0262cSandi print '<div class="'.$msg['lvl'].'">'; 881f3f0262cSandi print $msg['msg']; 882f3f0262cSandi print '</div>'; 883f3f0262cSandi } 884f3f0262cSandi} 885f3f0262cSandi 886f3f0262cSandi/** 887f3f0262cSandi * Prints the registration form 88815fae107Sandi * 88915fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 890f3f0262cSandi */ 891f3f0262cSandifunction html_register(){ 892f3f0262cSandi global $lang; 893cab2716aSmatthias.grimm global $conf; 894f3f0262cSandi global $ID; 895f3f0262cSandi 896c112d578Sandi print p_locale_xhtml('register'); 897*fdb8d77bSTom N Harris print '<div class="centeralign">'.NL; 898*fdb8d77bSTom N Harris $form = new Doku_Form('dw__register', wl($ID)); 899*fdb8d77bSTom N Harris $form->startFieldset($lang['register']); 900*fdb8d77bSTom N Harris $form->addHidden('do', 'register'); 901*fdb8d77bSTom N Harris $form->addHidden('save', '1'); 902*fdb8d77bSTom N Harris $form->addElement(form_makeTextField('login', $_POST['login'], $lang['user'], null, 'block', array('size'=>'50'))); 903cab2716aSmatthias.grimm if (!$conf['autopasswd']) { 904*fdb8d77bSTom N Harris $form->addElement(form_makePasswordField('pass', $lang['pass'], '', 'block', array('size'=>'50'))); 905*fdb8d77bSTom N Harris $form->addElement(form_makePasswordField('passchk', $lang['passchk'], '', 'block', array('size'=>'50'))); 906cab2716aSmatthias.grimm } 907*fdb8d77bSTom N Harris $form->addElement(form_makeTextField('fullname', $_POST['fullname'], $lang['fullname'], '', 'block', array('size'=>'50'))); 908*fdb8d77bSTom N Harris $form->addElement(form_makeTextField('email', $_POST['email'], $lang['email'], '', 'block', array('size'=>'50'))); 909*fdb8d77bSTom N Harris $form->addElement(form_makeButton('submit', '', $lang['register'])); 910*fdb8d77bSTom N Harris $form->endFieldset(); 911*fdb8d77bSTom N Harris html_form('register', $form); 912cab2716aSmatthias.grimm 913*fdb8d77bSTom N Harris print '</div>'.NL; 914f3f0262cSandi} 915f3f0262cSandi 916f3f0262cSandi/** 9178b06d178Schris * Print the update profile form 9188b06d178Schris * 9198b06d178Schris * @author Christopher Smith <chris@jalakai.co.uk> 9208b06d178Schris * @author Andreas Gohr <andi@splitbrain.org> 9218b06d178Schris */ 9228b06d178Schrisfunction html_updateprofile(){ 9238b06d178Schris global $lang; 9248b06d178Schris global $conf; 9258b06d178Schris global $ID; 9268b06d178Schris global $INFO; 92782fd59b6SAndreas Gohr global $auth; 9288b06d178Schris 9298b06d178Schris print p_locale_xhtml('updateprofile'); 9308b06d178Schris 9318b06d178Schris if (empty($_POST['fullname'])) $_POST['fullname'] = $INFO['userinfo']['name']; 9328b06d178Schris if (empty($_POST['email'])) $_POST['email'] = $INFO['userinfo']['mail']; 933*fdb8d77bSTom N Harris print '<div class="centeralign">'.NL; 934*fdb8d77bSTom N Harris $form = new Doku_Form('dw__register', wl($ID)); 935*fdb8d77bSTom N Harris $form->startFieldset($lang['profile']); 936*fdb8d77bSTom N Harris $form->addHidden('do', 'profile'); 937*fdb8d77bSTom N Harris $form->addHidden('save', '1'); 938*fdb8d77bSTom N Harris $form->addElement(form_makeTextField('fullname', $_SERVER['REMOTE_USER'], $lang['user'], '', 'block', array('size'=>'50', 'disabled'=>'disabled'))); 939*fdb8d77bSTom N Harris $attr = array('size'=>'50'); 940*fdb8d77bSTom N Harris if (!$auth->canDo('modName')) $attr['disabled'] = 'disabled'; 941*fdb8d77bSTom N Harris $form->addElement(form_makeTextField('fullname', $_POST['fullname'], $lang['fullname'], '', 'block', $attr)); 942*fdb8d77bSTom N Harris $form->addElement(form_makeTextField('email', $_POST['email'], $lang['email'], '', 'block', $attr)); 943*fdb8d77bSTom N Harris $form->addElement(form_makeTag('br')); 944*fdb8d77bSTom N Harris if ($auth->canDo('modPass')) { 945*fdb8d77bSTom N Harris $form->addElement(form_makePasswordField('newpass', $lang['newpass'], '', 'block', array('size'=>'50'))); 946*fdb8d77bSTom N Harris $form->addElement(form_makePasswordField('passchk', $lang['passchk'], '', 'block', array('size'=>'50'))); 947*fdb8d77bSTom N Harris } 948*fdb8d77bSTom N Harris if ($conf['profileconfirm']) { 949*fdb8d77bSTom N Harris $form->addElement(form_makeTag('br')); 950*fdb8d77bSTom N Harris $form->addElement(form_makePasswordField('oldpass', $lang['oldpass'], '', 'block', array('size'=>'50'))); 951*fdb8d77bSTom N Harris } 952*fdb8d77bSTom N Harris $form->addElement(form_makeButton('submit', '', $lang['btn_save'])); 953*fdb8d77bSTom N Harris $form->addElement(form_makeButton('reset', '', $lang['btn_reset'])); 954*fdb8d77bSTom N Harris $form->endFieldset(); 955*fdb8d77bSTom N Harris html_form('updateprofile', $form); 956*fdb8d77bSTom N Harris print '</div>'.NL; 9578b06d178Schris} 9588b06d178Schris 9598b06d178Schris/** 960f3f0262cSandi * This displays the edit form (lots of logic included) 96115fae107Sandi * 9627146cee2SAndreas Gohr * @fixme this is a huge lump of code and should be modularized 963016b6153SAndreas Gohr * @triggers HTML_PAGE_FROMTEMPLATE 964c9570649SAndreas Gohr * @triggers HTML_EDITFORM_INJECTION 96515fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 966f3f0262cSandi */ 967f3f0262cSandifunction html_edit($text=null,$include='edit'){ //FIXME: include needed? 968f3f0262cSandi global $ID; 969f3f0262cSandi global $REV; 970f3f0262cSandi global $DATE; 971f3f0262cSandi global $RANGE; 972f3f0262cSandi global $PRE; 973f3f0262cSandi global $SUF; 974f3f0262cSandi global $INFO; 975f3f0262cSandi global $SUM; 976f3f0262cSandi global $lang; 977f3f0262cSandi global $conf; 978f3f0262cSandi 979f3f0262cSandi //set summary default 980f3f0262cSandi if(!$SUM){ 981f3f0262cSandi if($REV){ 982f3f0262cSandi $SUM = $lang['restored']; 983f3f0262cSandi }elseif(!$INFO['exists']){ 984f3f0262cSandi $SUM = $lang['created']; 985f3f0262cSandi } 986f3f0262cSandi } 987f3f0262cSandi 988f3f0262cSandi //no text? Load it! 989f3f0262cSandi if(!isset($text)){ 990f3f0262cSandi $pr = false; //no preview mode 9917146cee2SAndreas Gohr if($INFO['exists']){ 992f3f0262cSandi if($RANGE){ 993f3f0262cSandi list($PRE,$text,$SUF) = rawWikiSlices($RANGE,$ID,$REV); 994f3f0262cSandi }else{ 995f3f0262cSandi $text = rawWiki($ID,$REV); 996f3f0262cSandi } 9978fe3bb00STom N Harris $check = md5($text); 9988fe3bb00STom N Harris $mod = false; 999f3f0262cSandi }else{ 10007146cee2SAndreas Gohr //try to load a pagetemplate 1001b7d5a5f0SAndreas Gohr $data = array($ID); 1002016b6153SAndreas Gohr $text = trigger_event('HTML_PAGE_FROMTEMPLATE',$data,'pageTemplate',true); 10038fe3bb00STom N Harris $check = md5(''); 10048fe3bb00STom N Harris $mod = $text!==''; 10057146cee2SAndreas Gohr } 10067146cee2SAndreas Gohr }else{ 1007f3f0262cSandi $pr = true; //preview mode 10088fe3bb00STom N Harris if (isset($_REQUEST['changecheck'])) { 10098fe3bb00STom N Harris $check = $_REQUEST['changecheck']; 10108fe3bb00STom N Harris $mod = md5($text)!==$check; 10118fe3bb00STom N Harris } else { 10128fe3bb00STom N Harris // Why? Assume default text is unmodified. 10138fe3bb00STom N Harris $check = md5($text); 10148fe3bb00STom N Harris $mod = false; 10158fe3bb00STom N Harris } 1016f3f0262cSandi } 1017f3f0262cSandi 1018f3f0262cSandi $wr = $INFO['writable']; 1019f3f0262cSandi if($wr){ 1020c112d578Sandi if ($REV) print p_locale_xhtml('editrev'); 1021c112d578Sandi print p_locale_xhtml($include); 1022f3f0262cSandi }else{ 1023409d7af7SAndreas Gohr // check pseudo action 'source' 1024409d7af7SAndreas Gohr if(!actionOK('source')){ 1025409d7af7SAndreas Gohr msg('Command disabled: source',-1); 1026409d7af7SAndreas Gohr return; 1027409d7af7SAndreas Gohr } 1028c112d578Sandi print p_locale_xhtml('read'); 1029f3f0262cSandi } 1030f3f0262cSandi if(!$DATE) $DATE = $INFO['lastmod']; 1031dc57ef04Sandi 1032dc57ef04Sandi 1033f3f0262cSandi?> 103463afe2a6SAnika Henke <div style="width:99%;"> 103542c7abd6SAndreas Gohr 103663afe2a6SAnika Henke <div class="toolbar"> 1037bb4866bdSchris <div id="draft__status"><?php if(!empty($INFO['draft'])) echo $lang['draftdate'].' '.date($conf['dformat']);?></div> 1038*fdb8d77bSTom N Harris <div id="tool__bar"><?php if($wr){?><a href="<?php echo DOKU_BASE?>lib/exe/mediamanager.php?ns=<?php echo $INFO['namespace']?>" 1039409d7af7SAndreas Gohr target="_blank"><?php echo $lang['mediaselect'] ?></a><?php }?></div> 104020d062caSAndreas Gohr 10414da078a3Smatthiasgrimm <?php if($wr){?> 1042e226efe1SAndreas Gohr <script type="text/javascript" charset="utf-8"><!--//--><![CDATA[//><!-- 10434da078a3Smatthiasgrimm <?php /* sets changed to true when previewed */?> 10448fe3bb00STom N Harris textChanged = <?php ($mod) ? print 'true' : print 'false' ?>; 1045e226efe1SAndreas Gohr //--><!]]></script> 104624a33b42SAndreas Gohr <span id="spell__action"></span> 104724a33b42SAndreas Gohr <div id="spell__suggest"></div> 1048ee4c4a1bSAndreas Gohr <?php } ?> 104963afe2a6SAnika Henke </div> 105024a33b42SAndreas Gohr <div id="spell__result"></div> 10514da078a3Smatthiasgrimm<?php 1052*fdb8d77bSTom N Harris $form = new Doku_Form('dw__editform'); 1053*fdb8d77bSTom N Harris $form->addHidden('id', $ID); 1054*fdb8d77bSTom N Harris $form->addHidden('rev', $REV); 1055*fdb8d77bSTom N Harris $form->addHidden('date', $DATE); 1056*fdb8d77bSTom N Harris $form->addHidden('prefix', $PRE); 1057*fdb8d77bSTom N Harris $form->addHidden('suffix', $SUF); 1058*fdb8d77bSTom N Harris $form->addHidden('changecheck', $check); 1059*fdb8d77bSTom N Harris $attr = array('tabindex'=>'1'); 1060*fdb8d77bSTom N Harris if (!$wr) $attr['readonly'] = 'readonly'; 1061*fdb8d77bSTom N Harris $form->addElement(form_makeWikiText($text, $attr)); 1062*fdb8d77bSTom N Harris $form->addElement(form_makeOpenTag('div', array('id'=>'wiki__editbar'))); 1063*fdb8d77bSTom N Harris $form->addElement(form_makeOpenTag('div', array('id'=>'size__ctl'))); 1064*fdb8d77bSTom N Harris $form->addElement(form_makeCloseTag('div')); 1065*fdb8d77bSTom N Harris if ($wr) { 1066*fdb8d77bSTom N Harris $form->addElement(form_makeOpenTag('div', array('class'=>'editButtons'))); 1067*fdb8d77bSTom N Harris $form->addElement(form_makeButton('submit', 'save', $lang['btn_save'], array('id'=>'edbtn__save', 'accesskey'=>'s', 'tabindex'=>'4'))); 1068*fdb8d77bSTom N Harris $form->addElement(form_makeButton('submit', 'preview', $lang['btn_preview'], array('id'=>'edbtn__preview', 'accesskey'=>'p', 'tabindex'=>'5'))); 1069*fdb8d77bSTom N Harris $form->addElement(form_makeButton('submit', 'draftdel', $lang['btn_cancel'], array('tabindex'=>'6'))); 1070*fdb8d77bSTom N Harris $form->addElement(form_makeCloseTag('div')); 1071*fdb8d77bSTom N Harris $form->addElement(form_makeOpenTag('div', array('class'=>'summary'))); 1072*fdb8d77bSTom N Harris $form->addElement(form_makeTextField('summary', $SUM, $lang['summary'], 'edit__summary', 'nowrap', array('size'=>'50', 'tabindex'=>'2'))); 1073*fdb8d77bSTom N Harris $elem = html_minoredit(); 1074*fdb8d77bSTom N Harris if ($elem) $form->addElement($elem); 1075*fdb8d77bSTom N Harris $form->addElement(form_makeCloseTag('div')); 1076*fdb8d77bSTom N Harris } 1077*fdb8d77bSTom N Harris $form->addElement(form_makeCloseTag('div')); 1078*fdb8d77bSTom N Harris html_form('edit', $form); 1079*fdb8d77bSTom N Harris print '</div>'.NL; 1080f3f0262cSandi} 1081f3f0262cSandi 1082f3f0262cSandi/** 1083b6912aeaSAndreas Gohr * Adds a checkbox for minor edits for logged in users 1084b6912aeaSAndreas Gohr * 1085b6912aeaSAndreas Gohr * @author Andrea Gohr <andi@splitbrain.org> 1086b6912aeaSAndreas Gohr */ 1087b6912aeaSAndreas Gohrfunction html_minoredit(){ 1088b6912aeaSAndreas Gohr global $conf; 1089b6912aeaSAndreas Gohr global $lang; 1090b6912aeaSAndreas Gohr // minor edits are for logged in users only 1091b6912aeaSAndreas Gohr if(!$conf['useacl'] || !$_SERVER['REMOTE_USER']){ 1092*fdb8d77bSTom N Harris return false; 1093b6912aeaSAndreas Gohr } 1094b6912aeaSAndreas Gohr 1095b6912aeaSAndreas Gohr $p = array(); 1096b6912aeaSAndreas Gohr $p['tabindex'] = 3; 1097bb4866bdSchris if(!empty($_REQUEST['minor'])) $p['checked']='checked'; 1098*fdb8d77bSTom N Harris return form_makeCheckboxField('minor', '1', $lang['minoredit'], 'minoredit', 'nowrap', $p); 1099b6912aeaSAndreas Gohr} 1100b6912aeaSAndreas Gohr 1101b6912aeaSAndreas Gohr/** 1102f3f0262cSandi * prints some debug info 110315fae107Sandi * 110415fae107Sandi * @author Andreas Gohr <andi@splitbrain.org> 1105f3f0262cSandi */ 1106f3f0262cSandifunction html_debug(){ 1107f3f0262cSandi global $conf; 1108d16a4edaSandi global $lang; 11095298a619SAndreas Gohr global $auth; 1110100a97e3SAndreas Gohr global $INFO; 1111100a97e3SAndreas Gohr 111228fb55ffSandi //remove sensitive data 111328fb55ffSandi $cnf = $conf; 111428fb55ffSandi $cnf['auth']='***'; 111528fb55ffSandi $cnf['notify']='***'; 11163dc3a5f1Sandi $cnf['ftp']='***'; 1117100a97e3SAndreas Gohr $nfo = $INFO; 1118100a97e3SAndreas Gohr $nfo['userinfo'] = '***'; 1119100a97e3SAndreas Gohr $ses = $_SESSION; 1120100a97e3SAndreas Gohr $ses[$conf['title']]['auth'] = '***'; 1121f3f0262cSandi 1122f3f0262cSandi print '<html><body>'; 1123f3f0262cSandi 1124f3f0262cSandi print '<p>When reporting bugs please send all the following '; 1125f3f0262cSandi print 'output as a mail to andi@splitbrain.org '; 1126f3f0262cSandi print 'The best way to do this is to save this page in your browser</p>'; 1127f3f0262cSandi 1128100a97e3SAndreas Gohr print '<b>$INFO:</b><pre>'; 1129100a97e3SAndreas Gohr print_r($nfo); 1130100a97e3SAndreas Gohr print '</pre>'; 1131100a97e3SAndreas Gohr 1132f3f0262cSandi print '<b>$_SERVER:</b><pre>'; 1133f3f0262cSandi print_r($_SERVER); 1134f3f0262cSandi print '</pre>'; 1135f3f0262cSandi 1136f3f0262cSandi print '<b>$conf:</b><pre>'; 113728fb55ffSandi print_r($cnf); 1138f3f0262cSandi print '</pre>'; 1139f3f0262cSandi 1140ed7b5f09Sandi print '<b>DOKU_BASE:</b><pre>'; 1141ed7b5f09Sandi print DOKU_BASE; 1142f3f0262cSandi print '</pre>'; 1143f3f0262cSandi 1144ed7b5f09Sandi print '<b>abs DOKU_BASE:</b><pre>'; 1145ed7b5f09Sandi print DOKU_URL; 1146ed7b5f09Sandi print '</pre>'; 1147ed7b5f09Sandi 1148ed7b5f09Sandi print '<b>rel DOKU_BASE:</b><pre>'; 1149f3f0262cSandi print dirname($_SERVER['PHP_SELF']).'/'; 1150f3f0262cSandi print '</pre>'; 1151f3f0262cSandi 1152f3f0262cSandi print '<b>PHP Version:</b><pre>'; 1153f3f0262cSandi print phpversion(); 1154f3f0262cSandi print '</pre>'; 1155f3f0262cSandi 1156f3f0262cSandi print '<b>locale:</b><pre>'; 1157f3f0262cSandi print setlocale(LC_ALL,0); 1158f3f0262cSandi print '</pre>'; 1159f3f0262cSandi 1160d16a4edaSandi print '<b>encoding:</b><pre>'; 1161d16a4edaSandi print $lang['encoding']; 1162d16a4edaSandi print '</pre>'; 1163d16a4edaSandi 11645298a619SAndreas Gohr if($auth){ 11655298a619SAndreas Gohr print '<b>Auth backend capabilities:</b><pre>'; 11665298a619SAndreas Gohr print_r($auth->cando); 11675298a619SAndreas Gohr print '</pre>'; 11685298a619SAndreas Gohr } 11695298a619SAndreas Gohr 11703aa54d7cSAndreas Gohr print '<b>$_SESSION:</b><pre>'; 1171100a97e3SAndreas Gohr print_r($ses); 11723aa54d7cSAndreas Gohr print '</pre>'; 11733aa54d7cSAndreas Gohr 1174f3f0262cSandi print '<b>Environment:</b><pre>'; 1175f3f0262cSandi print_r($_ENV); 1176f3f0262cSandi print '</pre>'; 1177f3f0262cSandi 1178f3f0262cSandi print '<b>PHP settings:</b><pre>'; 1179f3f0262cSandi $inis = ini_get_all(); 1180f3f0262cSandi print_r($inis); 1181f3f0262cSandi print '</pre>'; 1182f3f0262cSandi 1183f3f0262cSandi print '</body></html>'; 1184f3f0262cSandi} 1185f3f0262cSandi 1186c19fe9c0Sandifunction html_admin(){ 1187c19fe9c0Sandi global $ID; 1188f8cc712eSAndreas Gohr global $INFO; 1189c19fe9c0Sandi global $lang; 1190ca3a6df1SMatthias Grimm global $conf; 1191c19fe9c0Sandi 1192c112d578Sandi print p_locale_xhtml('admin'); 1193c19fe9c0Sandi 119411e2ce22Schris // build menu of admin functions from the plugins that handle them 119511e2ce22Schris $pluginlist = plugin_list('admin'); 119611e2ce22Schris $menu = array(); 119711e2ce22Schris foreach ($pluginlist as $p) { 119811e2ce22Schris if($obj =& plugin_load('admin',$p) === NULL) continue; 1199f8cc712eSAndreas Gohr 1200f8cc712eSAndreas Gohr // check permissions 1201f8cc712eSAndreas Gohr if($obj->forAdminOnly() && !$INFO['isadmin']) continue; 1202f8cc712eSAndreas Gohr 120311e2ce22Schris $menu[] = array('plugin' => $p, 120411e2ce22Schris 'prompt' => $obj->getMenuText($conf['lang']), 120511e2ce22Schris 'sort' => $obj->getMenuSort() 120611e2ce22Schris ); 120711e2ce22Schris } 120811e2ce22Schris 1209746855cfSBen Coburn usort($menu, 'p_sort_modes'); 121011e2ce22Schris 121111e2ce22Schris // output the menu 121211e2ce22Schris ptln('<ul>'); 121311e2ce22Schris 121411e2ce22Schris foreach ($menu as $item) { 121511e2ce22Schris if (!$item['prompt']) continue; 12160c6b58a8SAndreas Gohr ptln(' <li><div class="li"><a href="'.wl($ID, 'do=admin&page='.$item['plugin']).'">'.$item['prompt'].'</a></div></li>'); 121711e2ce22Schris } 121811e2ce22Schris 121911e2ce22Schris ptln('</ul>'); 1220ca3a6df1SMatthias Grimm} 1221c19fe9c0Sandi 12228b06d178Schris/** 12238b06d178Schris * Form to request a new password for an existing account 12248b06d178Schris * 12258b06d178Schris * @author Benoit Chesneau <benoit@bchesneau.info> 122611e2ce22Schris */ 12278b06d178Schrisfunction html_resendpwd() { 12288b06d178Schris global $lang; 12298b06d178Schris global $conf; 12308b06d178Schris global $ID; 1231c19fe9c0Sandi 12328b06d178Schris print p_locale_xhtml('resendpwd'); 1233*fdb8d77bSTom N Harris print '<div class="centeralign">'.NL; 1234*fdb8d77bSTom N Harris $form = new Doku_Form('dw__resendpwd', wl($ID)); 1235*fdb8d77bSTom N Harris $form->startFieldset($lang['resendpwd']); 1236*fdb8d77bSTom N Harris $form->addHidden('do', 'resendpwd'); 1237*fdb8d77bSTom N Harris $form->addHidden('save', '1'); 1238*fdb8d77bSTom N Harris $form->addElement(form_makeTag('br')); 1239*fdb8d77bSTom N Harris $form->addElement(form_makeTextField('login', $_POST['login'], $lang['user'], '', 'block')); 1240*fdb8d77bSTom N Harris $form->addElement(form_makeTag('br')); 1241*fdb8d77bSTom N Harris $form->addElement(form_makeTag('br')); 1242*fdb8d77bSTom N Harris $form->addElement(form_makeButton('submit', '', $lang['btn_resendpwd'])); 1243*fdb8d77bSTom N Harris $form->endFieldset(); 1244*fdb8d77bSTom N Harris html_form('resendpwd', $form); 1245*fdb8d77bSTom N Harris print '</div>'.NL; 1246*fdb8d77bSTom N Harris} 1247*fdb8d77bSTom N Harris 1248*fdb8d77bSTom N Harris/** 1249*fdb8d77bSTom N Harris * Output a Doku_Form object. 1250*fdb8d77bSTom N Harris * Triggers an event with the form name: HTML_{$name}FORM_OUTPUT 1251*fdb8d77bSTom N Harris * 1252*fdb8d77bSTom N Harris * @author Tom N Harris <tnharris@whoopdedo.org> 1253*fdb8d77bSTom N Harris */ 1254*fdb8d77bSTom N Harrisfunction html_form($name, &$form) { 1255*fdb8d77bSTom N Harris // Safety check in case the caller forgets. 1256*fdb8d77bSTom N Harris $form->endFieldset(); 1257*fdb8d77bSTom N Harris trigger_event('HTML_'.strtoupper($name).'FORM_OUTPUT', $form, 'html_form_output', false); 1258*fdb8d77bSTom N Harris} 1259*fdb8d77bSTom N Harris 1260*fdb8d77bSTom N Harris/** 1261*fdb8d77bSTom N Harris * Form print function. 1262*fdb8d77bSTom N Harris * Just calls printForm() on the data object. 1263*fdb8d77bSTom N Harris */ 1264*fdb8d77bSTom N Harrisfunction html_form_output($data) { 1265*fdb8d77bSTom N Harris $data->printForm(); 12668b06d178Schris} 1267340756e4Sandi 1268340756e4Sandi//Setup VIM: ex: et ts=2 enc=utf-8 : 1269