Changeset 7062
- Timestamp:
- 01/15/08 22:11:45 (10 months ago)
- Files:
-
- plugins/nahoWikiPlugin/trunk/lib/helper/nahoWikiHelper.php (modified) (8 diffs)
- plugins/nahoWikiPlugin/trunk/lib/model/plugin/PluginnahoWikiContentPeer.php (modified) (1 diff)
- plugins/nahoWikiPlugin/trunk/modules/nahoWiki/lib/BasenahoWikiActions.class.php (modified) (1 diff)
- plugins/nahoWikiPlugin/trunk/modules/nahoWiki/templates/_breadcrumbs.php (modified) (1 diff)
- plugins/nahoWikiPlugin/trunk/modules/nahoWiki/templates/_index.php (modified) (1 diff)
- plugins/nahoWikiPlugin/trunk/modules/nahoWiki/templates/_page_actions.php (modified) (1 diff)
- plugins/nahoWikiPlugin/trunk/modules/nahoWiki/templates/_page_history.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/nahoWikiPlugin/trunk/lib/helper/nahoWikiHelper.php
r7057 r7062 11 11 function link_to_diff($text, $page_name, $rev1, $rev2, $mode = 'inline') 12 12 { 13 return link_to($text, 'nahoWiki/diff?page=' . urlencode($page_name) . '&oldRevision=' . $rev1 . '&revision=' . $rev2 . '&mode=' . urlencode($mode));13 return link_to($text, 'nahoWiki/diff?page=' . $page_name . '&oldRevision=' . $rev1 . '&revision=' . $rev2 . '&mode=' . $mode); 14 14 } 15 15 … … 25 25 function link_to_raw_diff($text, $page_name, $rev1, $rev2, $mode = 'unified') 26 26 { 27 return link_to($text, 'nahoWiki/diff?page=' . urlencode($page_name) . '&oldRevision=' . $rev1 . '&revision=' . $rev2 . '&mode=' . urlencode($mode). '&raw=1');27 return link_to($text, 'nahoWiki/diff?page=' . $page_name . '&oldRevision=' . $rev1 . '&revision=' . $rev2 . '&mode=' . $mode . '&raw=1'); 28 28 } 29 29 … … 33 33 * @param string $page_name 34 34 * @param int $revision 35 * @param boolean $absolute 35 36 * 36 37 * @return string 37 38 */ 38 function url_for_wiki($page_name, $revision = null )39 function url_for_wiki($page_name, $revision = null, $absolute = false) 39 40 { 40 return url_for('nahoWiki/view?page=' . urlencode($page_name) . '&revision=' . $revision); 41 $url = 'nahoWiki/view?page=' . $page_name; 42 if (!is_null($revision)) { 43 $url .= '&revision=' . $revision; 44 } 45 46 return url_for($url, $absolute); 41 47 } 42 48 … … 46 52 * @param string $text text of the link (if null, we create it from the pagename+revision) 47 53 * @param string $page_name 48 * @param array $options params added to the link 49 * @param int $revision 54 * @param array $options params added to the link (you can add a 'revision' option to specifiy the revision of the page you want to link to) 50 55 * 51 56 * @return string 52 57 */ 53 function link_to_wiki($text, $page_name, $options = array() , $revision = null)58 function link_to_wiki($text, $page_name, $options = array()) 54 59 { 60 $url = 'nahoWiki/view?page=' . $page_name 61 if (isset($options['revision'])) { 62 $url .= '&revision=' . $revision; 63 } 55 64 if (is_null($text)) { 56 $text = htmlspecialchars( $page_name);57 if ( !is_null($revision)) {65 $text = htmlspecialchars(nahoWikiPagePeer::getBasename($page_name)); 66 if (isset($options['revision'])) { 58 67 $text .= ' rev. ' . $revision; 59 68 } 60 69 } 61 62 return link_to($text, 'nahoWiki/view?page=' . urlencode($page_name) . '&revision=' . $revision, $options);70 71 return link_to($text, $url, $options); 63 72 } 64 73 … … 68 77 * @param string $username 69 78 * @param int $revision 79 * @param boolean $absolute 70 80 * 71 81 * @return string 72 82 */ 73 function url_for_wiki_user($username, $revision = null )83 function url_for_wiki_user($username, $revision = null, $absolute = false) 74 84 { 75 return url_for_wiki( $text, 'user:' . $username);85 return url_for_wiki('user:' . $username, $revision, $absolute); 76 86 } 77 87 … … 81 91 * @param string $text text of the link 82 92 * @param string $username 83 * @param array $options params added to the link 93 * @param array $options params added to the link (you can add a 'revision' option to specifiy the revision of the page you want to link to) 84 94 * @param int $revision 85 95 * 86 96 * @return string 87 97 */ 88 function link_to_wiki_user($text, $username, $options = array() , $revision = null)98 function link_to_wiki_user($text, $username, $options = array()) 89 99 { 90 return link_to_wiki($text, 'user:' . $username, $options , $revision);100 return link_to_wiki($text, 'user:' . $username, $options); 91 101 } 92 102 … … 96 106 * @param string $page_name 97 107 * @param int $revision 108 * @param boolean $absolute 98 109 * 99 110 * @return string 100 111 */ 101 function url_for_wiki_discuss($page_name, $revision = null )112 function url_for_wiki_discuss($page_name, $revision = null, $absolute = false) 102 113 { 103 return url_for_wiki('discuss:' . $page_name, $revision );114 return url_for_wiki('discuss:' . $page_name, $revision, $absolute); 104 115 } 105 116 … … 114 125 * @return string 115 126 */ 116 function link_to_wiki_discuss($text, $page_name, $options = array() , $revision = null)127 function link_to_wiki_discuss($text, $page_name, $options = array()) 117 128 { 118 return link_to_wiki($text, 'discuss:' . $page_name, $options , $revision);129 return link_to_wiki($text, 'discuss:' . $page_name, $options); 119 130 } 120 131 plugins/nahoWikiPlugin/trunk/lib/model/plugin/PluginnahoWikiContentPeer.php
r7057 r7062 147 147 } 148 148 // Link 149 $url = 'nahoWiki/view?page=' . urlencode($replace['name']);149 $url = 'nahoWiki/view?page=' . $replace['name']; 150 150 if (@$replace['anchor']) { 151 151 $url .= '#' . $replace['anchor']; plugins/nahoWikiPlugin/trunk/modules/nahoWiki/lib/BasenahoWikiActions.class.php
r7057 r7062 55 55 56 56 // Generate the URI parameters to keep trace of the requested page 57 $this->uriParams = 'page=' . urlencode($this->page->getName());57 $this->uriParams = 'page=' . $this->page->getName(); 58 58 if ($this->revision->getRevision() != $this->page->getLatestRevision()) { 59 $this->uriParams .= '&revision=' . urlencode($this->revision->getRevision());59 $this->uriParams .= '&revision=' . $this->revision->getRevision(); 60 60 } 61 61 plugins/nahoWikiPlugin/trunk/modules/nahoWiki/templates/_breadcrumbs.php
r7057 r7062 1 <?php use_helper('nahoWiki') ?> 2 1 3 <div class="wiki-breadcrumbs"> 2 4 <?php $first = true; foreach ($breadcrumbs as $breadcrumb): ?> 3 5 <?php if (!$first): ?><span class="wiki-breadcrumbs-separator"><?php echo $breadcrumbs_separator ?></span><?php endif ?> 4 <?php echo link_to (nahoWikiPagePeer::getBasename($breadcrumb), 'nahoWiki/view?page=' . urlencode($breadcrumb)) ?>6 <?php echo link_to_wiki(null, $breadcrumb) ?> 5 7 <?php $first = false; endforeach ?> 6 8 </div> plugins/nahoWikiPlugin/trunk/modules/nahoWiki/templates/_index.php
r7057 r7062 9 9 include_partial('index', array('tree' => $elements, 'base' => $fullpath, 'uriParams' => $uriParams)); 10 10 } else { 11 echo link_to ($name, 'nahoWiki/view?page=' . urlencode($elements), 'class=wiki-link-page');11 echo link_to_wiki($name, $elements, 'class=wiki-link-page'); 12 12 } 13 13 ?> plugins/nahoWikiPlugin/trunk/modules/nahoWiki/templates/_page_actions.php
r7057 r7062 1 1 <ul class="wiki-actions"> 2 2 <?php if ($canView): ?> 3 <li class="wiki-action-view<?php echo $action == 'view' ? ' active' : '' ?>"><?php echo link_to(__('View'), 'nahoWiki/view?' . $uriParams) ?></li> 4 <li class="wiki-action-edit<?php echo $action == 'edit' ? ' active' : '' ?>"><?php echo link_to(__($canEdit ? 'Edit' : 'View source'), 'nahoWiki/edit?' . $uriParams) ?></li> 5 <li class="wiki-action-history<?php echo $action == 'history' || $action == 'diff' ? ' active' : '' ?>"><?php echo link_to(__('History'), 'nahoWiki/history?' . $uriParams) ?></li> 3 <li class="wiki-action-view<?php echo $action == 'view' ? ' active' : '' ?>"><?php 4 echo link_to(__('View'), 'nahoWiki/view?' . $uriParams) ?></li> 5 <li class="wiki-action-edit<?php echo $action == 'edit' ? ' active' : '' ?>"><?php 6 echo link_to(__($canEdit ? 'Edit' : 'View source'), 'nahoWiki/edit?' . $uriParams) ?></li> 7 <li class="wiki-action-history<?php echo $action == 'history' || $action == 'diff' ? ' active' : '' ?>"><?php 8 echo link_to(__('History'), 'nahoWiki/history?' . $uriParams) ?></li> 6 9 <?php endif ?> 7 <li class="wiki-action-index<?php echo $action == 'browse' ? ' active' : '' ?>"><?php echo link_to(__('Index'), 'nahoWiki/browse?' . $uriParams) ?></li> 10 <li class="wiki-action-index<?php echo $action == 'browse' ? ' active' : '' ?>"><?php 11 echo link_to(__('Index'), 'nahoWiki/browse?' . $uriParams) ?></li> 8 12 </ul> plugins/nahoWikiPlugin/trunk/modules/nahoWiki/templates/_page_history.php
r7057 r7062 1 <?php use_helper('Date', 'I18N' ) ?>1 <?php use_helper('Date', 'I18N', 'nahoWiki') ?> 2 2 3 3 <h1 class="wiki-title"><?php echo __('History of changes') ?></h1> … … 30 30 <td><?php echo radiobutton_tag('revision', $revision->getRevision(), $rev2 == $revision->getRevision()) ?></td> 31 31 <?php endif ?> 32 <td><?php echo link_to ($page->getName() . ' rev. ' . $revision->getRevision(), 'nahoWiki/view?page=' . urlencode($page->getName()) . '&revision=' . urlencode($revision->getRevision())) ?></td>32 <td><?php echo link_to_wiki(null, $page->getName(), array('revision' => $revision->getRevision())) ?></td> 33 33 <td><?php echo format_datetime($revision->getCreatedAt('U')) ?></td> 34 <td><?php echo link_to ($revision->getUserName(), 'nahoWiki/user?name=' . urlencode($revision->getUserName())) ?></td>34 <td><?php echo link_to_wiki_user(null, $revision->getUserName()) ?></td> 35 35 <td><em><?php echo $revision->getComment() ?></em></td> 36 36 </tr>