<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<!--
This file was generated by Devel::Cover Version 1.26
Devel::Cover is copyright 2001-2012, Paul Johnson (paul@pjcj.net)
Devel::Cover is free. It is licensed under the same terms as Perl itself.
The latest version of Devel::Cover should be available from my homepage:
-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
<meta http-equiv="Content-Language" content="en-us"></meta>
<link rel="stylesheet" type="text/css" href="cover.css"></link>
<link rel="stylesheet" type="text/css" href="cover.css"></link>
<title>File Coverage: lib/Yukki/Web/Controller/Page.pm</title>
</head>
<body>
<h1>File Coverage</h1>
<table>
<tr><td class="h" align="right">File:</td><td align="left">lib/Yukki/Web/Controller/Page.pm</td></tr>
<tr><td class="h" align="right">Coverage:</td><td align="left" class="c0">32.0%</td></tr>
</table>
<div><br/></div>
<table>
<tr><th>line</th><th>stmt</th><th>bran</th><th>cond</th><th>sub</th><th>pod</th><th>time</th><th>code</th></tr>
<tr><td class="h">1</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">package Yukki::Web::Controller::Page;</td></tr>
<tr><td class="h">2</td><td colspan="7"></td></tr><tr><td class="h">3</td><td><div class="c3">1</div><div class="c3">1</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-Web-Controller-Page-pm--subroutine.html#L3">1</a></div></td><td></td><td><div>1095</div><div>5</div></td><td class="s">use v5.24;</td></tr>
<tr><td class="h">4</td><td><div class="c3">1</div><div class="c3">1</div><div class="c3">1</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-Web-Controller-Page-pm--subroutine.html#L4">1</a></div></td><td></td><td><div>6</div><div>2</div><div>7</div></td><td class="s">use utf8;</td></tr>
<tr><td class="h">5</td><td><div class="c3">1</div><div class="c3">1</div><div class="c3">1</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-Web-Controller-Page-pm--subroutine.html#L5">1</a></div></td><td></td><td><div>21</div><div>3</div><div>6</div></td><td class="s">use Moo;</td></tr>
<tr><td class="h">6</td><td colspan="7"></td></tr><tr><td class="h">7</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">with 'Yukki::Web::Controller';</td></tr>
<tr><td class="h">8</td><td colspan="7"></td></tr><tr><td class="h">9</td><td><div class="c3">1</div><div class="c3">1</div><div class="c3">1</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-Web-Controller-Page-pm--subroutine.html#L9">1</a></div></td><td></td><td><div>409</div><div>3</div><div>62</div></td><td class="s">use Try::Tiny;</td></tr>
<tr><td class="h">10</td><td><div class="c3">1</div><div class="c3">1</div><div class="c3">1</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-Web-Controller-Page-pm--subroutine.html#L10">1</a></div></td><td></td><td><div>6</div><div>3</div><div>7</div></td><td class="s">use Yukki::Error qw( http_throw );</td></tr>
<tr><td class="h">11</td><td colspan="7"></td></tr><tr><td class="h">12</td><td><div class="c3">1</div><div class="c3">1</div><div class="c3">1</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-Web-Controller-Page-pm--subroutine.html#L12">1</a></div></td><td></td><td><div>355</div><div>3</div><div>6</div></td><td class="s">use namespace::clean;</td></tr>
<tr><td class="h">13</td><td colspan="7"></td></tr><tr><td class="h">14</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"># ABSTRACT: controller for viewing and editing pages</td></tr>
<tr><td class="h">15</td><td colspan="7"></td></tr><tr><td class="h">16 - 26</td><td colspan="6"></td><td class="s"><pre>=head1 DESCRIPTION
Controller for viewing and editing pages
=head1 METHODS
=head2 fire
On a view request routes to L</view_page>, edit request to L</edit_page>, preview request to L</preview_page>, and attach request to L</upload_attachment>.
=cut</pre></td></tr>
<tr><td class="h">27</td><td colspan="7"></td></tr><tr><td class="h">28</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">sub fire {</td></tr>
<tr><td class="h">29</td><td><div class="c3">1</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-Web-Controller-Page-pm--subroutine.html#L29">1</a></div></td><td><div class="c3">1</div></td><td><div>3</div></td><td class="s"> my ($self, $ctx) = @_;</td></tr>
<tr><td class="h">30</td><td colspan="7"></td></tr><tr><td class="h">31</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>13</div></td><td class="s"> my $action = $ctx->request->path_parameters->{action};</td></tr>
<tr><td class="h">32</td><td><div class="c3">1</div><div class="c3">1</div></td><td><div class="c0" title="T/-"><a href="lib-Yukki-Web-Controller-Page-pm--branch.html#L32">50</a></div><div class="c0" title="-/-"><a href="lib-Yukki-Web-Controller-Page-pm--branch.html#L32">0</a></div><div class="c0" title="-/-"><a href="lib-Yukki-Web-Controller-Page-pm--branch.html#L32">0</a></div><div class="c0" title="-/-"><a href="lib-Yukki-Web-Controller-Page-pm--branch.html#L32">0</a></div><div class="c0" title="-/-"><a href="lib-Yukki-Web-Controller-Page-pm--branch.html#L32">0</a></div><div class="c0" title="-/-"><a href="lib-Yukki-Web-Controller-Page-pm--branch.html#L32">0</a></div><div class="c0" title="-/-"><a href="lib-Yukki-Web-Controller-Page-pm--branch.html#L32">0</a></div><div class="c0" title="-/-"><a href="lib-Yukki-Web-Controller-Page-pm--branch.html#L32">0</a></div></td><td></td><td></td><td></td><td><div>21</div><div>4</div></td><td class="s"> if ($action eq 'view') { $self->view_page($ctx) }</td></tr>
<tr><td class="h">33</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> elsif ($action eq 'edit') { $self->edit_page($ctx) }</td></tr>
<tr><td class="h">34</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> elsif ($action eq 'history') { $self->view_history($ctx) }</td></tr>
<tr><td class="h">35</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> elsif ($action eq 'diff') { $self->view_diff($ctx) }</td></tr>
<tr><td class="h">36</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> elsif ($action eq 'preview') { $self->preview_page($ctx) }</td></tr>
<tr><td class="h">37</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> elsif ($action eq 'attach') { $self->upload_attachment($ctx) }</td></tr>
<tr><td class="h">38</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> elsif ($action eq 'rename') { $self->rename_page($ctx) }</td></tr>
<tr><td class="h">39</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> elsif ($action eq 'remove') { $self->remove_page($ctx) }</td></tr>
<tr><td class="h">40</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> else {</td></tr>
<tr><td class="h">41</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> http_throw('That page action does not exist.', {</td></tr>
<tr><td class="h">42</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> status => 'NotFound',</td></tr>
<tr><td class="h">43</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> });</td></tr>
<tr><td class="h">44</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> }</td></tr>
<tr><td class="h">45</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">}</td></tr>
<tr><td class="h">46</td><td colspan="7"></td></tr><tr><td class="h">47 - 51</td><td colspan="6"></td><td class="s"><pre>=head2 repo_name_and_path
This is a helper for looking up the repository name and path for the request.
=cut</pre></td></tr>
<tr><td class="h">52</td><td colspan="7"></td></tr><tr><td class="h">53</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">sub repo_name_and_path {</td></tr>
<tr><td class="h">54</td><td><div class="c3">1</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-Web-Controller-Page-pm--subroutine.html#L54">1</a></div></td><td><div class="c3">1</div></td><td><div>2</div></td><td class="s"> my ($self, $ctx) = @_;</td></tr>
<tr><td class="h">55</td><td colspan="7"></td></tr><tr><td class="h">56</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>13</div></td><td class="s"> my $repo_name = $ctx->request->path_parameters->{repository};</td></tr>
<tr><td class="h">57</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>28</div></td><td class="s"> my $path = $ctx->request->path_parameters->{page};</td></tr>
<tr><td class="h">58</td><td colspan="7"></td></tr><tr><td class="h">59</td><td><div class="c3">1</div></td><td><div class="c0" title="T/-"><a href="lib-Yukki-Web-Controller-Page-pm--branch.html#L59">50</a></div></td><td></td><td></td><td></td><td><div>18</div></td><td class="s"> if (not defined $path) {</td></tr>
<tr><td class="h">60</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> my $repo_config</td></tr>
<tr><td class="h">61</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>14</div></td><td class="s"> = $self->app->settings->repositories->{$repo_name};</td></tr>
<tr><td class="h">62</td><td colspan="7"></td></tr><tr><td class="h">63</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>6</div></td><td class="s"> my $path_str = $repo_config->default_page;</td></tr>
<tr><td class="h">64</td><td colspan="7"></td></tr><tr><td class="h">65</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>5</div></td><td class="s"> $path = [ split m{/}, $path_str ];</td></tr>
<tr><td class="h">66</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> }</td></tr>
<tr><td class="h">67</td><td colspan="7"></td></tr><tr><td class="h">68</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>7</div></td><td class="s"> return ($repo_name, $path);</td></tr>
<tr><td class="h">69</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">}</td></tr>
<tr><td class="h">70</td><td colspan="7"></td></tr><tr><td class="h">71 - 75</td><td colspan="6"></td><td class="s"><pre>=head2 lookup_page
Given a repository name and page, returns a L<Yukki::Model::File> for it.
=cut</pre></td></tr>
<tr><td class="h">76</td><td colspan="7"></td></tr><tr><td class="h">77</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">sub lookup_page {</td></tr>
<tr><td class="h">78</td><td><div class="c3">1</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-Web-Controller-Page-pm--subroutine.html#L78">1</a></div></td><td><div class="c3">1</div></td><td><div>2</div></td><td class="s"> my ($self, $repo_name, $page) = @_;</td></tr>
<tr><td class="h">79</td><td colspan="7"></td></tr><tr><td class="h">80</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>15</div></td><td class="s"> my $repository = $self->model('Repository', { name => $repo_name });</td></tr>
<tr><td class="h">81</td><td colspan="7"></td></tr><tr><td class="h">82</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>1877</div></td><td class="s"> my $final_part = pop @$page;</td></tr>
<tr><td class="h">83</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>1</div></td><td class="s"> my $filetype;</td></tr>
<tr><td class="h">84</td><td><div class="c3">1</div></td><td><div class="c0" title="T/-"><a href="lib-Yukki-Web-Controller-Page-pm--branch.html#L84">50</a></div></td><td></td><td></td><td></td><td><div>9</div></td><td class="s"> if ($final_part =~ s/\.(?<filetype>[a-z0-9]+)$//) {</td></tr>
<tr><td class="h">85</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>15</div></td><td class="s"> $filetype = $+{filetype};</td></tr>
<tr><td class="h">86</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> }</td></tr>
<tr><td class="h">87</td><td colspan="7"></td></tr><tr><td class="h">88</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>3</div></td><td class="s"> my $path = join '/', @$page, $final_part;</td></tr>
<tr><td class="h">89</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>4</div></td><td class="s"> return $repository->file({ path => $path, filetype => $filetype });</td></tr>
<tr><td class="h">90</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">}</td></tr>
<tr><td class="h">91</td><td colspan="7"></td></tr><tr><td class="h">92 - 97</td><td colspan="6"></td><td class="s"><pre>=head2 view_page
Tells either L<Yukki::Web::View::Page/blank> or L<Yukki::Web::View::Page/view>
to show the page.
=cut</pre></td></tr>
<tr><td class="h">98</td><td colspan="7"></td></tr><tr><td class="h">99</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">sub view_page {</td></tr>
<tr><td class="h">100</td><td><div class="c3">1</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-Web-Controller-Page-pm--subroutine.html#L100">1</a></div></td><td><div class="c3">1</div></td><td><div>2</div></td><td class="s"> my ($self, $ctx) = @_;</td></tr>
<tr><td class="h">101</td><td colspan="7"></td></tr><tr><td class="h">102</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>3</div></td><td class="s"> my ($repo_name, $path) = $self->repo_name_and_path($ctx);</td></tr>
<tr><td class="h">103</td><td colspan="7"></td></tr><tr><td class="h">104</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>3</div></td><td class="s"> my $page = $self->lookup_page($repo_name, $path);</td></tr>
<tr><td class="h">105</td><td colspan="7"></td></tr><tr><td class="h">106</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>99</div></td><td class="s"> my $breadcrumb = $self->breadcrumb($page->repository, $path);</td></tr>
<tr><td class="h">107</td><td colspan="7"></td></tr><tr><td class="h">108</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>1</div></td><td class="s"> my $body;</td></tr>
<tr><td class="h">109</td><td><div class="c3">1</div></td><td><div class="c0" title="-/F"><a href="lib-Yukki-Web-Controller-Page-pm--branch.html#L109">50</a></div></td><td></td><td></td><td></td><td><div>4</div></td><td class="s"> if (not $page->exists) {</td></tr>
<tr><td class="h">110</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> my @files = $page->list_files;</td></tr>
<tr><td class="h">111</td><td colspan="7"></td></tr><tr><td class="h">112</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> $body = $self->view('Page')->blank($ctx, {</td></tr>
<tr><td class="h">113</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> title => $page->file_name,</td></tr>
<tr><td class="h">114</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> breadcrumb => $breadcrumb,</td></tr>
<tr><td class="h">115</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> repository => $repo_name,</td></tr>
<tr><td class="h">116</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> page => $page->full_path,</td></tr>
<tr><td class="h">117</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> files => \@files,</td></tr>
<tr><td class="h">118</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> });</td></tr>
<tr><td class="h">119</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> }</td></tr>
<tr><td class="h">120</td><td colspan="7"></td></tr><tr><td class="h">121</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> else {</td></tr>
<tr><td class="h">122</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>119</div></td><td class="s"> $body = $self->view('Page')->view($ctx, {</td></tr>
<tr><td class="h">123</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> title => $page->title,</td></tr>
<tr><td class="h">124</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> breadcrumb => $breadcrumb,</td></tr>
<tr><td class="h">125</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> repository => $repo_name,</td></tr>
<tr><td class="h">126</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> page => $page->full_path,</td></tr>
<tr><td class="h">127</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> file => $page,</td></tr>
<tr><td class="h">128</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> });</td></tr>
<tr><td class="h">129</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> }</td></tr>
<tr><td class="h">130</td><td colspan="7"></td></tr><tr><td class="h">131</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>37584</div></td><td class="s"> $ctx->response->body($body);</td></tr>
<tr><td class="h">132</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">}</td></tr>
<tr><td class="h">133</td><td colspan="7"></td></tr><tr><td class="h">134 - 138</td><td colspan="6"></td><td class="s"><pre>=head2 edit_page
Displays or processes the edit form for a page using.
=cut</pre></td></tr>
<tr><td class="h">139</td><td colspan="7"></td></tr><tr><td class="h">140</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">sub edit_page {</td></tr>
<tr><td class="h">141</td><td><div class="c0">0</div></td><td></td><td></td><td><div class="c0"><a href="lib-Yukki-Web-Controller-Page-pm--subroutine.html#L141">0</a></div></td><td><div class="c3">1</div></td><td><div>0</div></td><td class="s"> my ($self, $ctx) = @_;</td></tr>
<tr><td class="h">142</td><td colspan="7"></td></tr><tr><td class="h">143</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> my ($repo_name, $path) = $self->repo_name_and_path($ctx);</td></tr>
<tr><td class="h">144</td><td colspan="7"></td></tr><tr><td class="h">145</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> my $page = $self->lookup_page($repo_name, $path);</td></tr>
<tr><td class="h">146</td><td colspan="7"></td></tr><tr><td class="h">147</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> my $breadcrumb = $self->breadcrumb($page->repository, $path);</td></tr>
<tr><td class="h">148</td><td colspan="7"></td></tr><tr><td class="h">149</td><td><div class="c0">0</div></td><td><div class="c0" title="-/-"><a href="lib-Yukki-Web-Controller-Page-pm--branch.html#L149">0</a></div></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> if ($ctx->request->method eq 'POST') {</td></tr>
<tr><td class="h">150</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> my $new_content = $ctx->request->parameters->{yukkitext};</td></tr>
<tr><td class="h">151</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> my $position = $ctx->request->parameters->{yukkitext_position};</td></tr>
<tr><td class="h">152</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> my $comment = $ctx->request->parameters->{comment};</td></tr>
<tr><td class="h">153</td><td colspan="7"></td></tr><tr><td class="h">154</td><td><div class="c0">0</div></td><td><div class="c0" title="-/-"><a href="lib-Yukki-Web-Controller-Page-pm--branch.html#L154">0</a></div></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> if (my $user = $ctx->session->{user}) {</td></tr>
<tr><td class="h">155</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> $page->author_name($user->{name});</td></tr>
<tr><td class="h">156</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> $page->author_email($user->{email});</td></tr>
<tr><td class="h">157</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> }</td></tr>
<tr><td class="h">158</td><td colspan="7"></td></tr><tr><td class="h">159</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> $page->store({</td></tr>
<tr><td class="h">160</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> content => $new_content,</td></tr>
<tr><td class="h">161</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> comment => $comment,</td></tr>
<tr><td class="h">162</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> });</td></tr>
<tr><td class="h">163</td><td colspan="7"></td></tr><tr><td class="h">164</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> $ctx->response->redirect(join '/', '/page/edit', $repo_name, $page->full_path, '?yukkitext_position='.$position);</td></tr>
<tr><td class="h">165</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> return;</td></tr>
<tr><td class="h">166</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> }</td></tr>
<tr><td class="h">167</td><td colspan="7"></td></tr><tr><td class="h">168</td><td><div class="c0">0</div><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div><div>0</div></td><td class="s"> my @attachments = grep { $_->filetype ne 'yukki' } $page->list_files;</td></tr>
<tr><td class="h">169</td><td><div class="c0">0</div></td><td></td><td><div class="c0"><a href="lib-Yukki-Web-Controller-Page-pm--condition.html#L169">0</a></div></td><td></td><td></td><td><div>0</div></td><td class="s"> my $position = $ctx->request->parameters->{yukkitext_position} // -1;</td></tr>
<tr><td class="h">170</td><td colspan="7"></td></tr><tr><td class="h">171</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> $ctx->response->body(</td></tr>
<tr><td class="h">172</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> $self->view('Page')->edit($ctx, {</td></tr>
<tr><td class="h">173</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> title => $page->title,</td></tr>
<tr><td class="h">174</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> breadcrumb => $breadcrumb,</td></tr>
<tr><td class="h">175</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> repository => $repo_name,</td></tr>
<tr><td class="h">176</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> page => $page->full_path,</td></tr>
<tr><td class="h">177</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> position => $position,</td></tr>
<tr><td class="h">178</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> file => $page,</td></tr>
<tr><td class="h">179</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> attachments => \@attachments,</td></tr>
<tr><td class="h">180</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> })</td></tr>
<tr><td class="h">181</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> );</td></tr>
<tr><td class="h">182</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">}</td></tr>
<tr><td class="h">183</td><td colspan="7"></td></tr><tr><td class="h">184 - 188</td><td colspan="6"></td><td class="s"><pre>=head2 rename_page
Displays the rename page form.
=cut</pre></td></tr>
<tr><td class="h">189</td><td colspan="7"></td></tr><tr><td class="h">190</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">sub rename_page {</td></tr>
<tr><td class="h">191</td><td><div class="c0">0</div></td><td></td><td></td><td><div class="c0"><a href="lib-Yukki-Web-Controller-Page-pm--subroutine.html#L191">0</a></div></td><td><div class="c3">1</div></td><td><div>0</div></td><td class="s"> my ($self, $ctx) = @_;</td></tr>
<tr><td class="h">192</td><td colspan="7"></td></tr><tr><td class="h">193</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> my ($repo_name, $path) = $self->repo_name_and_path($ctx);</td></tr>
<tr><td class="h">194</td><td colspan="7"></td></tr><tr><td class="h">195</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> my $page = $self->lookup_page($repo_name, $path);</td></tr>
<tr><td class="h">196</td><td colspan="7"></td></tr><tr><td class="h">197</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> my $breadcrumb = $self->breadcrumb($page->repository, $path);</td></tr>
<tr><td class="h">198</td><td colspan="7"></td></tr><tr><td class="h">199</td><td><div class="c0">0</div></td><td><div class="c0" title="-/-"><a href="lib-Yukki-Web-Controller-Page-pm--branch.html#L199">0</a></div></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> if ($ctx->request->method eq 'POST') {</td></tr>
<tr><td class="h">200</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> my $new_name = $ctx->request->parameters->{yukkiname_new};</td></tr>
<tr><td class="h">201</td><td colspan="7"></td></tr><tr><td class="h">202</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> my $part = qr{[_a-z0-9-.]+(?:\.[_a-z0-9-]+)*}i;</td></tr>
<tr><td class="h">203</td><td><div class="c0">0</div></td><td><div class="c0" title="-/-"><a href="lib-Yukki-Web-Controller-Page-pm--branch.html#L203">0</a></div></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> if ($new_name =~ m{^$part(?:/$part)*$}) {</td></tr>
<tr><td class="h">204</td><td colspan="7"></td></tr><tr><td class="h">205</td><td><div class="c0">0</div></td><td><div class="c0" title="-/-"><a href="lib-Yukki-Web-Controller-Page-pm--branch.html#L205">0</a></div></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> if (my $user = $ctx->session->{user}) {</td></tr>
<tr><td class="h">206</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> $page->author_name($user->{name});</td></tr>
<tr><td class="h">207</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> $page->author_email($user->{email});</td></tr>
<tr><td class="h">208</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> }</td></tr>
<tr><td class="h">209</td><td colspan="7"></td></tr><tr><td class="h">210</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> $page->rename({</td></tr>
<tr><td class="h">211</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> full_path => $new_name,</td></tr>
<tr><td class="h">212</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> comment => 'Renamed ' . $page->full_path . ' to ' . $new_name,</td></tr>
<tr><td class="h">213</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> });</td></tr>
<tr><td class="h">214</td><td colspan="7"></td></tr><tr><td class="h">215</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> $ctx->response->redirect(join '/', '/page/edit', $repo_name, $new_name);</td></tr>
<tr><td class="h">216</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> return;</td></tr>
<tr><td class="h">217</td><td colspan="7"></td></tr><tr><td class="h">218</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> }</td></tr>
<tr><td class="h">219</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> else {</td></tr>
<tr><td class="h">220</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> $ctx->add_errors('the new name must contain only letters, numbers, underscores, dashes, periods, and slashes');</td></tr>
<tr><td class="h">221</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> }</td></tr>
<tr><td class="h">222</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> }</td></tr>
<tr><td class="h">223</td><td colspan="7"></td></tr><tr><td class="h">224</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> $ctx->response->body(</td></tr>
<tr><td class="h">225</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> $self->view('Page')->rename($ctx, {</td></tr>
<tr><td class="h">226</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> title => $page->title,</td></tr>
<tr><td class="h">227</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> breadcrumb => $breadcrumb,</td></tr>
<tr><td class="h">228</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> repository => $repo_name,</td></tr>
<tr><td class="h">229</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> page => $page->full_path,</td></tr>
<tr><td class="h">230</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> file => $page,</td></tr>
<tr><td class="h">231</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> })</td></tr>
<tr><td class="h">232</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> );</td></tr>
<tr><td class="h">233</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">}</td></tr>
<tr><td class="h">234</td><td colspan="7"></td></tr><tr><td class="h">235 - 239</td><td colspan="6"></td><td class="s"><pre>=head2 remove_page
Displays the remove confirmation.
=cut</pre></td></tr>
<tr><td class="h">240</td><td colspan="7"></td></tr><tr><td class="h">241</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">sub remove_page {</td></tr>
<tr><td class="h">242</td><td><div class="c0">0</div></td><td></td><td></td><td><div class="c0"><a href="lib-Yukki-Web-Controller-Page-pm--subroutine.html#L242">0</a></div></td><td><div class="c3">1</div></td><td><div>0</div></td><td class="s"> my ($self, $ctx) = @_;</td></tr>
<tr><td class="h">243</td><td colspan="7"></td></tr><tr><td class="h">244</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> my ($repo_name, $path) = $self->repo_name_and_path($ctx);</td></tr>
<tr><td class="h">245</td><td colspan="7"></td></tr><tr><td class="h">246</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> my $page = $self->lookup_page($repo_name, $path);</td></tr>
<tr><td class="h">247</td><td colspan="7"></td></tr><tr><td class="h">248</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> my $breadcrumb = $self->breadcrumb($page->repository, $path);</td></tr>
<tr><td class="h">249</td><td colspan="7"></td></tr><tr><td class="h">250</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> my $confirmed = $ctx->request->body_parameters->{confirmed};</td></tr>
<tr><td class="h">251</td><td><div class="c0">0</div></td><td><div class="c0" title="-/-"><a href="lib-Yukki-Web-Controller-Page-pm--branch.html#L251">0</a></div></td><td><div class="c0"><a href="lib-Yukki-Web-Controller-Page-pm--condition.html#L251">0</a></div></td><td></td><td></td><td><div>0</div></td><td class="s"> if ($ctx->request->method eq 'POST' and $confirmed) {</td></tr>
<tr><td class="h">252</td><td><div class="c0">0</div></td><td></td><td><div class="c0"><a href="lib-Yukki-Web-Controller-Page-pm--condition.html#L252">0</a></div></td><td></td><td></td><td><div>0</div></td><td class="s"> my $return_to = $page->parent // $page->repository->default_file;</td></tr>
<tr><td class="h">253</td><td><div class="c0">0</div></td><td><div class="c0" title="-/-"><a href="lib-Yukki-Web-Controller-Page-pm--branch.html#L253">0</a></div></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> if ($return_to->full_path ne $page->full_path) {</td></tr>
<tr><td class="h">254</td><td><div class="c0">0</div></td><td><div class="c0" title="-/-"><a href="lib-Yukki-Web-Controller-Page-pm--branch.html#L254">0</a></div></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> if (my $user = $ctx->session->{user}) {</td></tr>
<tr><td class="h">255</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> $page->author_name($user->{name});</td></tr>
<tr><td class="h">256</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> $page->author_email($user->{email});</td></tr>
<tr><td class="h">257</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> }</td></tr>
<tr><td class="h">258</td><td colspan="7"></td></tr><tr><td class="h">259</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> $page->remove({</td></tr>
<tr><td class="h">260</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> comment => 'Removing ' . $page->full_path . ' from repository.',</td></tr>
<tr><td class="h">261</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> });</td></tr>
<tr><td class="h">262</td><td colspan="7"></td></tr><tr><td class="h">263</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> $ctx->response->redirect(join '/', '/page/view', $repo_name, $return_to->full_path);</td></tr>
<tr><td class="h">264</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> return;</td></tr>
<tr><td class="h">265</td><td colspan="7"></td></tr><tr><td class="h">266</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> }</td></tr>
<tr><td class="h">267</td><td colspan="7"></td></tr><tr><td class="h">268</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> else {</td></tr>
<tr><td class="h">269</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> $ctx->add_errors('you may not remove the top-most page of a repository');</td></tr>
<tr><td class="h">270</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> }</td></tr>
<tr><td class="h">271</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> }</td></tr>
<tr><td class="h">272</td><td colspan="7"></td></tr><tr><td class="h">273</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> $ctx->response->body(</td></tr>
<tr><td class="h">274</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> $self->view('Page')->remove($ctx, {</td></tr>
<tr><td class="h">275</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> title => $page->title,</td></tr>
<tr><td class="h">276</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> breadcrumb => $breadcrumb,</td></tr>
<tr><td class="h">277</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> repository => $repo_name,</td></tr>
<tr><td class="h">278</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> page => $page->full_path,</td></tr>
<tr><td class="h">279</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> file => $page,</td></tr>
<tr><td class="h">280</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> return_link => join('/', '/page/view', $repo_name, $page->full_path),</td></tr>
<tr><td class="h">281</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> })</td></tr>
<tr><td class="h">282</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> );</td></tr>
<tr><td class="h">283</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">}</td></tr>
<tr><td class="h">284</td><td colspan="7"></td></tr><tr><td class="h">285 - 289</td><td colspan="6"></td><td class="s"><pre>=head2 view_history
Displays the page's revision history.
=cut</pre></td></tr>
<tr><td class="h">290</td><td colspan="7"></td></tr><tr><td class="h">291</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">sub view_history {</td></tr>
<tr><td class="h">292</td><td><div class="c0">0</div></td><td></td><td></td><td><div class="c0"><a href="lib-Yukki-Web-Controller-Page-pm--subroutine.html#L292">0</a></div></td><td><div class="c3">1</div></td><td><div>0</div></td><td class="s"> my ($self, $ctx) = @_;</td></tr>
<tr><td class="h">293</td><td colspan="7"></td></tr><tr><td class="h">294</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> my ($repo_name, $path) = $self->repo_name_and_path($ctx);</td></tr>
<tr><td class="h">295</td><td colspan="7"></td></tr><tr><td class="h">296</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> my $page = $self->lookup_page($repo_name, $path);</td></tr>
<tr><td class="h">297</td><td colspan="7"></td></tr><tr><td class="h">298</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> my $breadcrumb = $self->breadcrumb($page->repository, $path);</td></tr>
<tr><td class="h">299</td><td colspan="7"></td></tr><tr><td class="h">300</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> $ctx->response->body(</td></tr>
<tr><td class="h">301</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> $self->view('Page')->history($ctx, {</td></tr>
<tr><td class="h">302</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> title => $page->title,</td></tr>
<tr><td class="h">303</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> breadcrumb => $breadcrumb,</td></tr>
<tr><td class="h">304</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> repository => $repo_name,</td></tr>
<tr><td class="h">305</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> page => $page->full_path,</td></tr>
<tr><td class="h">306</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> revisions => [ $page->history ],</td></tr>
<tr><td class="h">307</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> })</td></tr>
<tr><td class="h">308</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> );</td></tr>
<tr><td class="h">309</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">}</td></tr>
<tr><td class="h">310</td><td colspan="7"></td></tr><tr><td class="h">311 - 315</td><td colspan="6"></td><td class="s"><pre>=head2 view_diff
Displays a diff of the page.
=cut</pre></td></tr>
<tr><td class="h">316</td><td colspan="7"></td></tr><tr><td class="h">317</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">sub view_diff {</td></tr>
<tr><td class="h">318</td><td><div class="c0">0</div></td><td></td><td></td><td><div class="c0"><a href="lib-Yukki-Web-Controller-Page-pm--subroutine.html#L318">0</a></div></td><td><div class="c3">1</div></td><td><div>0</div></td><td class="s"> my ($self, $ctx) = @_;</td></tr>
<tr><td class="h">319</td><td colspan="7"></td></tr><tr><td class="h">320</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> my ($repo_name, $path) = $self->repo_name_and_path($ctx);</td></tr>
<tr><td class="h">321</td><td colspan="7"></td></tr><tr><td class="h">322</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> my $page = $self->lookup_page($repo_name, $path);</td></tr>
<tr><td class="h">323</td><td colspan="7"></td></tr><tr><td class="h">324</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> my $breadcrumb = $self->breadcrumb($page->repository, $path);</td></tr>
<tr><td class="h">325</td><td colspan="7"></td></tr><tr><td class="h">326</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> my $r1 = $ctx->request->query_parameters->{r1};</td></tr>
<tr><td class="h">327</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> my $r2 = $ctx->request->query_parameters->{r2};</td></tr>
<tr><td class="h">328</td><td colspan="7"></td></tr><tr><td class="h">329</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> try {</td></tr>
<tr><td class="h">330</td><td colspan="7"></td></tr><tr><td class="h">331</td><td><div class="c0">0</div></td><td></td><td></td><td><div class="c0"><a href="lib-Yukki-Web-Controller-Page-pm--subroutine.html#L331">0</a></div></td><td></td><td><div>0</div></td><td class="s"> my $diff = '';</td></tr>
<tr><td class="h">332</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> for my $chunk ($page->diff($r1, $r2)) {</td></tr>
<tr><td class="h">333</td><td><div class="c0">0</div><div class="c0">0</div></td><td><div class="c0" title="-/-"><a href="lib-Yukki-Web-Controller-Page-pm--branch.html#L333">0</a></div><div class="c0" title="-/-"><a href="lib-Yukki-Web-Controller-Page-pm--branch.html#L333">0</a></div><div class="c0" title="-/-"><a href="lib-Yukki-Web-Controller-Page-pm--branch.html#L333">0</a></div></td><td></td><td></td><td></td><td><div>0</div><div>0</div></td><td class="s"> if ($chunk->[0] eq ' ') { $diff .= $chunk->[1] }</td></tr>
<tr><td class="h">334</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> elsif ($chunk->[0] eq '+') { $diff .= sprintf '<ins markdown="1">%s</ins>', $chunk->[1] }</td></tr>
<tr><td class="h">335</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> elsif ($chunk->[0] eq '-') { $diff .= sprintf '<del markdown="1">%s</del>', $chunk->[1] }</td></tr>
<tr><td class="h">336</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> else { warn "unknown chunk type $chunk->[0]" }</td></tr>
<tr><td class="h">337</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> }</td></tr>
<tr><td class="h">338</td><td colspan="7"></td></tr><tr><td class="h">339</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> my $file_preview = $page->file_preview(</td></tr>
<tr><td class="h">340</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> content => $diff,</td></tr>
<tr><td class="h">341</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> );</td></tr>
<tr><td class="h">342</td><td colspan="7"></td></tr><tr><td class="h">343</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> $ctx->response->body(</td></tr>
<tr><td class="h">344</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> $self->view('Page')->diff($ctx, {</td></tr>
<tr><td class="h">345</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> title => $page->title,</td></tr>
<tr><td class="h">346</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> breadcrumb => $breadcrumb,</td></tr>
<tr><td class="h">347</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> repository => $repo_name,</td></tr>
<tr><td class="h">348</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> page => $page->full_path,</td></tr>
<tr><td class="h">349</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> file => $file_preview,</td></tr>
<tr><td class="h">350</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> })</td></tr>
<tr><td class="h">351</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> );</td></tr>
<tr><td class="h">352</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> }</td></tr>
<tr><td class="h">353</td><td colspan="7"></td></tr><tr><td class="h">354</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> catch {</td></tr>
<tr><td class="h">355</td><td><div class="c0">0</div></td><td></td><td></td><td><div class="c0"><a href="lib-Yukki-Web-Controller-Page-pm--subroutine.html#L355">0</a></div></td><td></td><td><div>0</div></td><td class="s"> my $ERROR = $_;</td></tr>
<tr><td class="h">356</td><td><div class="c0">0</div></td><td><div class="c0" title="-/-"><a href="lib-Yukki-Web-Controller-Page-pm--branch.html#L356">0</a></div></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> if ("$_" =~ /usage: git diff/) {</td></tr>
<tr><td class="h">357</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> http_throw 'Diffs will not work with git versions before 1.7.2. Please use a newer version of git. If you are using a newer version of git, please file a support issue.';</td></tr>
<tr><td class="h">358</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> }</td></tr>
<tr><td class="h">359</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> die $ERROR;</td></tr>
<tr><td class="h">360</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> };</td></tr>
<tr><td class="h">361</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">}</td></tr>
<tr><td class="h">362</td><td colspan="7"></td></tr><tr><td class="h">363 - 367</td><td colspan="6"></td><td class="s"><pre>=head2 preview_page
Shows the preview for an edit to a page using L<Yukki::Web::View::Page/preview>..
=cut</pre></td></tr>
<tr><td class="h">368</td><td colspan="7"></td></tr><tr><td class="h">369</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">sub preview_page {</td></tr>
<tr><td class="h">370</td><td><div class="c0">0</div></td><td></td><td></td><td><div class="c0"><a href="lib-Yukki-Web-Controller-Page-pm--subroutine.html#L370">0</a></div></td><td><div class="c3">1</div></td><td><div>0</div></td><td class="s"> my ($self, $ctx) = @_;</td></tr>
<tr><td class="h">371</td><td colspan="7"></td></tr><tr><td class="h">372</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> my ($repo_name, $path) = $self->repo_name_and_path($ctx);</td></tr>
<tr><td class="h">373</td><td colspan="7"></td></tr><tr><td class="h">374</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> my $page = $self->lookup_page($repo_name, $path);</td></tr>
<tr><td class="h">375</td><td colspan="7"></td></tr><tr><td class="h">376</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> my $breadcrumb = $self->breadcrumb($page->repository, $path);</td></tr>
<tr><td class="h">377</td><td colspan="7"></td></tr><tr><td class="h">378</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> my $content = $ctx->request->body_parameters->{yukkitext};</td></tr>
<tr><td class="h">379</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> my $position = $ctx->request->parameters->{yukkitext_position};</td></tr>
<tr><td class="h">380</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> my $file_preview = $page->file_preview(</td></tr>
<tr><td class="h">381</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> content => $content,</td></tr>
<tr><td class="h">382</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> position => $position,</td></tr>
<tr><td class="h">383</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> );</td></tr>
<tr><td class="h">384</td><td colspan="7"></td></tr><tr><td class="h">385</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> $ctx->response->body(</td></tr>
<tr><td class="h">386</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> $self->view('Page')->preview($ctx, {</td></tr>
<tr><td class="h">387</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> title => $page->title,</td></tr>
<tr><td class="h">388</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> breadcrumb => $breadcrumb,</td></tr>
<tr><td class="h">389</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> repository => $repo_name,</td></tr>
<tr><td class="h">390</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> page => $page->full_path,</td></tr>
<tr><td class="h">391</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> file => $file_preview,</td></tr>
<tr><td class="h">392</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> })</td></tr>
<tr><td class="h">393</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> );</td></tr>
<tr><td class="h">394</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">}</td></tr>
<tr><td class="h">395</td><td colspan="7"></td></tr><tr><td class="h">396 - 400</td><td colspan="6"></td><td class="s"><pre>=head2 upload_attachment
This is a facade that wraps L<Yukki::Web::Controller::Attachment/upload>.
=cut</pre></td></tr>
<tr><td class="h">401</td><td colspan="7"></td></tr><tr><td class="h">402</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">sub upload_attachment {</td></tr>
<tr><td class="h">403</td><td><div class="c0">0</div></td><td></td><td></td><td><div class="c0"><a href="lib-Yukki-Web-Controller-Page-pm--subroutine.html#L403">0</a></div></td><td><div class="c3">1</div></td><td><div>0</div></td><td class="s"> my ($self, $ctx) = @_;</td></tr>
<tr><td class="h">404</td><td colspan="7"></td></tr><tr><td class="h">405</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> my $repo_name = $ctx->request->path_parameters->{repository};</td></tr>
<tr><td class="h">406</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> my $path = delete $ctx->request->path_parameters->{page};</td></tr>
<tr><td class="h">407</td><td colspan="7"></td></tr><tr><td class="h">408</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> my $page = $self->lookup_page($repo_name, $path);</td></tr>
<tr><td class="h">409</td><td colspan="7"></td></tr><tr><td class="h">410</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> my @file = split m{/}, $page->path;</td></tr>
<tr><td class="h">411</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> push @file, $ctx->request->uploads->{file}->filename;</td></tr>
<tr><td class="h">412</td><td colspan="7"></td></tr><tr><td class="h">413</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> $ctx->request->path_parameters->{action} = 'upload';</td></tr>
<tr><td class="h">414</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> $ctx->request->path_parameters->{file} = \@file;</td></tr>
<tr><td class="h">415</td><td colspan="7"></td></tr><tr><td class="h">416</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> $self->controller('Attachment')->fire($ctx);</td></tr>
<tr><td class="h">417</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">}</td></tr>
<tr><td class="h">418</td><td colspan="7"></td></tr><tr><td class="h">419 - 423</td><td colspan="6"></td><td class="s"><pre>=head2 breadcrumb
Given the repository and path, returns the breadcrumb.
=cut</pre></td></tr>
<tr><td class="h">424</td><td colspan="7"></td></tr><tr><td class="h">425</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">sub breadcrumb {</td></tr>
<tr><td class="h">426</td><td><div class="c3">1</div></td><td></td><td></td><td><div class="c3"><a href="lib-Yukki-Web-Controller-Page-pm--subroutine.html#L426">1</a></div></td><td><div class="c3">1</div></td><td><div>2</div></td><td class="s"> my ($self, $repository, $path_parts) = @_;</td></tr>
<tr><td class="h">427</td><td colspan="7"></td></tr><tr><td class="h">428</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>2</div></td><td class="s"> my @breadcrumb;</td></tr>
<tr><td class="h">429</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> my @path_acc;</td></tr>
<tr><td class="h">430</td><td colspan="7"></td></tr><tr><td class="h">431</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>12</div></td><td class="s"> push @breadcrumb, {</td></tr>
<tr><td class="h">432</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> label => $repository->title,</td></tr>
<tr><td class="h">433</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> href => join('/', '/page/view/', $repository->name),</td></tr>
<tr><td class="h">434</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> };</td></tr>
<tr><td class="h">435</td><td colspan="7"></td></tr><tr><td class="h">436</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>38</div></td><td class="s"> for my $path_part (@$path_parts) {</td></tr>
<tr><td class="h">437</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> push @path_acc, $path_part;</td></tr>
<tr><td class="h">438</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> my $file = $repository->file({</td></tr>
<tr><td class="h">439</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> path => join('/', @path_acc),</td></tr>
<tr><td class="h">440</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> filetype => 'yukki',</td></tr>
<tr><td class="h">441</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> });</td></tr>
<tr><td class="h">442</td><td colspan="7"></td></tr><tr><td class="h">443</td><td><div class="c0">0</div></td><td></td><td></td><td></td><td></td><td><div>0</div></td><td class="s"> push @breadcrumb, {</td></tr>
<tr><td class="h">444</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> label => $file->title,</td></tr>
<tr><td class="h">445</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> href => join('/', '/page/view', $repository->name, $file->full_path),</td></tr>
<tr><td class="h">446</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> };</td></tr>
<tr><td class="h">447</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s"> }</td></tr>
<tr><td class="h">448</td><td colspan="7"></td></tr><tr><td class="h">449</td><td><div class="c3">1</div></td><td></td><td></td><td></td><td></td><td><div>2</div></td><td class="s"> return \@breadcrumb;</td></tr>
<tr><td class="h">450</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">}</td></tr>
<tr><td class="h">451</td><td colspan="7"></td></tr><tr><td class="h">452</td><td></td><td></td><td></td><td></td><td></td><td></td><td class="s">1;</td></tr>
</table>
</body>
</html>