git.cweiske.de
/
phorkie.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5cec779
)
Single file editing
author
Christian Weiske
<cweiske@cweiske.de>
Thu, 4 Dec 2014 06:52:03 +0000
(07:52 +0100)
committer
Christian Weiske
<cweiske@cweiske.de>
Thu, 4 Dec 2014 06:52:03 +0000
(07:52 +0100)
README.rst
patch
|
blob
|
history
data/templates/display-file.htm
patch
|
blob
|
history
data/templates/edit.htm
patch
|
blob
|
history
src/phorkie/Repository.php
patch
|
blob
|
history
www/.htaccess
patch
|
blob
|
history
www/edit.php
patch
|
blob
|
history
diff --git
a/README.rst
b/README.rst
index a755d3a3879c0da2daf844df642fb318d94c5af8..841b473aed8e2816caddb6e8671b750cbed174b3 100644
(file)
--- a/
README.rst
+++ b/
README.rst
@@
-23,6
+23,7
@@
Features
- delete existing files
- replace file with upload
- multiple files in one paste
- delete existing files
- replace file with upload
- multiple files in one paste
+ - option to edit single files in a multi-file paste
- syntax highlighting with GeSHi
- rST and Markdown rendering
- image upload + display
- syntax highlighting with GeSHi
- rST and Markdown rendering
- image upload + display
@@
-297,6
+298,8
@@
URLs
Display page for paste
``/[0-9]/edit``
Edit the paste
Display page for paste
``/[0-9]/edit``
Edit the paste
+``/[0-9]/edit/(.+)``
+ Edit a single file of the paste
``/[0-9]+/raw/(.+)``
Display raw file contents
``/[0-9]/tool/[a-zA-Z]+/(.+)``
``/[0-9]+/raw/(.+)``
Display raw file contents
``/[0-9]/tool/[a-zA-Z]+/(.+)``
@@
-352,6
+355,7
@@
If you use nginx, place the following lines into your ``server`` block:
rewrite ^/([0-9]+)/delete/confirm$ /delete.php?id=$1&confirm=1;
rewrite ^/([0-9]+)/doap$ /doap.php?id=$1;
rewrite ^/([0-9]+)/edit$ /edit.php?id=$1;
rewrite ^/([0-9]+)/delete/confirm$ /delete.php?id=$1&confirm=1;
rewrite ^/([0-9]+)/doap$ /doap.php?id=$1;
rewrite ^/([0-9]+)/edit$ /edit.php?id=$1;
+ rewrite ^/([0-9]+)/edit/(.+)$ edit.php?id=$1&file=$2
rewrite ^/([0-9]+)/fork$ /fork.php?id=$1;
rewrite ^/([0-9]+)/raw/(.+)$ /raw.php?id=$1&file=$2;
rewrite ^/([0-9]+)/rev/(.+)$ /revision.php?id=$1&rev=$2;
rewrite ^/([0-9]+)/fork$ /fork.php?id=$1;
rewrite ^/([0-9]+)/raw/(.+)$ /raw.php?id=$1&file=$2;
rewrite ^/([0-9]+)/rev/(.+)$ /revision.php?id=$1&rev=$2;
@@
-361,8
+365,10
@@
If you use nginx, place the following lines into your ``server`` block:
rewrite ^/fork-remote$ /fork-remote.php;
rewrite ^/help$ /help.php;
rewrite ^/new$ /new.php;
rewrite ^/fork-remote$ /fork-remote.php;
rewrite ^/help$ /help.php;
rewrite ^/new$ /new.php;
+
rewrite ^/feed/new$ /feed-new.php;
rewrite ^/feed/updated$ /feed-updated.php;
rewrite ^/feed/new$ /feed-new.php;
rewrite ^/feed/updated$ /feed-updated.php;
+
rewrite ^/list$ /list.php;
rewrite ^/list/([0-9]+)$ /list.php?page=$1;
rewrite ^/list$ /list.php;
rewrite ^/list/([0-9]+)$ /list.php?page=$1;
diff --git
a/data/templates/display-file.htm
b/data/templates/display-file.htm
index ee3a3c2e74ff887979b76a25dc3c20b39626ba6e..67a584bb0ad858a1c39efb907b7047b9c93f80cd 100644
(file)
--- a/
data/templates/display-file.htm
+++ b/
data/templates/display-file.htm
@@
-4,6
+4,7
@@
{% for toolinfo in file.getToolInfos %}
<a class="btn btn-mini" href="{{toolinfo.getLink(file)}}" style="float: right;">{{toolinfo.getTitle}}</a>
{% endfor %}
{% for toolinfo in file.getToolInfos %}
<a class="btn btn-mini" href="{{toolinfo.getLink(file)}}" style="float: right;">{{toolinfo.getTitle}}</a>
{% endfor %}
+ <a class="btn btn-mini" href="{{repo.getLink('edit', file.getFilename)}}" style="float: right;" title="edit"><i class="icon-edit"></i></a>
<h3 id="{{file.getFilename|replace({' ': '-'})}}">{{file.getFilename}}<a class="anchorlink" href="{{repo.getLink('display')}}#{{file.getFilename|replace({' ': '-'})}}"></a></h3>
</div>
{{file.getRenderedContent(toolres)|raw}}
<h3 id="{{file.getFilename|replace({' ': '-'})}}">{{file.getFilename}}<a class="anchorlink" href="{{repo.getLink('display')}}#{{file.getFilename|replace({' ': '-'})}}"></a></h3>
</div>
{{file.getRenderedContent(toolres)|raw}}
diff --git
a/data/templates/edit.htm
b/data/templates/edit.htm
index 542bb344eb9dbb2d866b08061ed45570da68c648..401ed00b1c77f929e6c7474c58fefc4711c79d56 100644
(file)
--- a/
data/templates/edit.htm
+++ b/
data/templates/edit.htm
@@
-16,7
+16,9
@@
</div>
{% for fileid, file in repo.getFiles %}
</div>
{% for fileid, file in repo.getFiles %}
- {% include 'edit-file.htm' with {'file': file, 'fileid': fileid, 'newfile': false} %}
+ {% if not singlefile or file == singlefile %}
+ {% include 'edit-file.htm' with {'file': file, 'fileid': fileid, 'newfile': false} %}
+ {% endif %}
{% endfor %}
{% include 'edit-add.htm' %}
{% endfor %}
{% include 'edit-add.htm' %}
diff --git
a/src/phorkie/Repository.php
b/src/phorkie/Repository.php
index 9de2e1ab8995b8226e0e8845d9d5eb0866019879..467456b96821e81cd919927c734f098e2212bdb0 100644
(file)
--- a/
src/phorkie/Repository.php
+++ b/
src/phorkie/Repository.php
@@
-321,6
+321,9
@@
class Repository
{
if ($type == 'edit') {
$link = $this->id . '/edit';
{
if ($type == 'edit') {
$link = $this->id . '/edit';
+ if ($option !== null) {
+ $link .= '/' . urlencode($option);
+ }
} else if ($type == 'display') {
$link = $this->id;
} else if ($type == 'fork') {
} else if ($type == 'display') {
$link = $this->id;
} else if ($type == 'fork') {
diff --git
a/www/.htaccess
b/www/.htaccess
index bf8c5827de86c114638ab19984a216318e97802a..566d27c0ba38def12564fee2d4a2368c9256f85e 100644
(file)
--- a/
www/.htaccess
+++ b/
www/.htaccess
@@
-10,6
+10,7
@@
RewriteRule ^([0-9]+)/delete$ delete.php?id=$1
RewriteRule ^([0-9]+)/delete/confirm$ delete.php?id=$1&confirm=1
RewriteRule ^([0-9]+)/doap$ doap.php?id=$1
RewriteRule ^([0-9]+)/edit$ edit.php?id=$1
RewriteRule ^([0-9]+)/delete/confirm$ delete.php?id=$1&confirm=1
RewriteRule ^([0-9]+)/doap$ doap.php?id=$1
RewriteRule ^([0-9]+)/edit$ edit.php?id=$1
+RewriteRule ^([0-9]+)/edit/(.+)$ edit.php?id=$1&file=$2
RewriteRule ^([0-9]+)/fork$ fork.php?id=$1
RewriteRule ^([0-9]+)/linkback$ linkback.php?id=$1
RewriteRule ^([0-9]+)/raw/(.+)$ raw.php?id=$1&file=$2
RewriteRule ^([0-9]+)/fork$ fork.php?id=$1
RewriteRule ^([0-9]+)/linkback$ linkback.php?id=$1
RewriteRule ^([0-9]+)/raw/(.+)$ raw.php?id=$1&file=$2
diff --git
a/www/edit.php
b/www/edit.php
index d1853d246ce5c456b3d6c4884a72bd5f2bacddf4..e95ca3f5ed2dbf5441f79300dc5bfacdd8853308 100644
(file)
--- a/
www/edit.php
+++ b/
www/edit.php
@@
-14,10
+14,16
@@
if ($repopo->process($_POST, $_SESSION)) {
redirect($repo->getLink('display', null, true));
}
redirect($repo->getLink('display', null, true));
}
+$file = null;
+if (isset($_GET['file'])) {
+ $file = $repo->getFileByName($_GET['file']);
+}
+
render(
'edit',
array(
'repo' => $repo,
render(
'edit',
array(
'repo' => $repo,
+ 'singlefile' => $file,
'dh' => new \Date_HumanDiff(),
'htmlhelper' => new HtmlHelper(),
)
'dh' => new \Date_HumanDiff(),
'htmlhelper' => new HtmlHelper(),
)