Compare commits
151 Commits
feature.is
...
release-1.
Author | SHA1 | Date | |
---|---|---|---|
|
6a44af34e1 | ||
|
7342566c6e | ||
|
bfc568967b | ||
|
154597c09c | ||
|
8f886155b0 | ||
|
df1130b4c9 | ||
|
c9f2575469 | ||
|
5101ae5f35 | ||
|
aa09862059 | ||
|
884f50155c | ||
|
cf684c1514 | ||
|
91b189b75f | ||
|
623c562054 | ||
|
8a9f8c66e8 | ||
|
81f433085a | ||
|
6e59a0a526 | ||
|
8397d86313 | ||
|
b0ac05b608 | ||
|
48c3989ae3 | ||
|
b949b7e83a | ||
|
ad7fad9fbe | ||
|
d2db3b16d2 | ||
|
ae11b1de4a | ||
|
6f620e3f54 | ||
|
810b753edf | ||
|
958fb1b9ad | ||
|
48992adefa | ||
|
d95e1e13e5 | ||
|
381dc5b8f7 | ||
|
464c1a8ef5 | ||
|
e5b10a8494 | ||
|
ffc49b9ea6 | ||
|
0efc14dd6f | ||
|
4fb15ccb7d | ||
|
234b70845c | ||
|
6abd0b6faa | ||
|
fef2bd15bf | ||
|
74d07d8fb8 | ||
|
473e9153ed | ||
|
efa10c9afd | ||
|
7438a2bf19 | ||
|
2e0995abac | ||
|
c84afd0f78 | ||
|
b1276dff6c | ||
|
b413b7ee89 | ||
|
f19f07ec59 | ||
|
83761c66c5 | ||
|
d0e2977746 | ||
|
1be91e5a2a | ||
|
15d4d1aa7d | ||
|
708b90fccd | ||
|
ac7a4c4aa5 | ||
|
b90246a239 | ||
|
a9d327d54f | ||
|
eb8fd0aa55 | ||
|
813184f06c | ||
|
ef2d3a9af9 | ||
|
9a8bd464a3 | ||
|
9e2ea7404b | ||
|
160d11b89b | ||
|
d860f299fd | ||
|
33882d4fa7 | ||
|
85978a4d18 | ||
|
e1e7696d53 | ||
|
695428075b | ||
|
e7c2e721b4 | ||
|
13fad756ab | ||
|
1f0791df0e | ||
|
a2c832a130 | ||
|
b17de014ec | ||
|
b1b72190e1 | ||
|
2ff2f888bc | ||
|
57c2389aae | ||
|
d54c86f813 | ||
|
05a9697007 | ||
|
945429abf0 | ||
|
a016bcb51b | ||
|
f2b1ce795c | ||
|
3a8c56acc4 | ||
|
7b2552f940 | ||
|
324b202215 | ||
|
2c2da6082a | ||
|
dd3fbbd7e4 | ||
|
9bbcd571ec | ||
|
bbc185bf3b | ||
|
d1bcdcda20 | ||
|
6d55602ef3 | ||
|
6e7c9f7c4b | ||
|
5427aab456 | ||
|
4879d64989 | ||
|
dab8ea63fc | ||
|
b03d7a04a0 | ||
|
ef5b93e3f7 | ||
|
69ae1c08ef | ||
|
8e4f828cc6 | ||
|
c4f92f4569 | ||
|
c4d2b99656 | ||
|
d4fe88adab | ||
|
69d0e8313a | ||
|
11a234e135 | ||
|
2f30e4e2f6 | ||
|
118ca9f11f | ||
|
24fc41ee0d | ||
|
c00dbac5e0 | ||
|
d7857c5126 | ||
|
ac6be0d3c0 | ||
|
7ff6f09f67 | ||
|
00b576c5a3 | ||
|
2a33510c96 | ||
|
d1f79d906d | ||
|
aa043f14ac | ||
|
638b28399e | ||
|
1d86f036a3 | ||
|
2f6e0f0a22 | ||
|
1b1b00a10c | ||
|
8693418d39 | ||
|
8ff15368ce | ||
|
32cde534bd | ||
|
c0e26133bd | ||
|
592c2ff9ff | ||
|
30efd0a2db | ||
|
20c3f14cc8 | ||
|
80313c88c8 | ||
|
cab1c09ffc | ||
|
c421919092 | ||
|
d350876bc1 | ||
|
de09c8af56 | ||
|
998f4576fe | ||
|
06c57f7da6 | ||
|
4d5418a601 | ||
|
95cc7f627f | ||
|
2aab4eea3b | ||
|
5bbff9f5a6 | ||
|
b5fcf1636a | ||
|
13012be5d7 | ||
|
ca2ef814fb | ||
|
b9407f6aee | ||
|
d079838818 | ||
|
81ce4688df | ||
|
ee33cc1832 | ||
|
82bb18fe10 | ||
|
8987ca7db6 | ||
|
8066fd8982 | ||
|
a96d8c05a7 | ||
|
4238a5dd50 | ||
|
94da55d15e | ||
|
09979b8551 | ||
|
5b82efa0be | ||
|
8502a36481 | ||
|
bbf1a1882a | ||
|
5322cdf609 |
19
.gitignore
vendored
19
.gitignore
vendored
@@ -1,14 +1,19 @@
|
||||
*~
|
||||
tmp
|
||||
.buildpath
|
||||
.externalToolBuilders
|
||||
.project
|
||||
.settings
|
||||
.tx/config
|
||||
attachments
|
||||
indefero-*.zip
|
||||
src/IDF/conf/idf.php
|
||||
src/IDF/conf/idf.test.php
|
||||
www/test.php
|
||||
www/media/upload
|
||||
src/IDF/gettexttemplates
|
||||
indefero-*.zip
|
||||
src/IDF/conf/path.php
|
||||
.tx/config
|
||||
src/IDF/gettexttemplates
|
||||
src/IDF/locale/idf.pot.bak
|
||||
test/config.php
|
||||
test/test.db
|
||||
test/tmp
|
||||
test/config.php
|
||||
tmp
|
||||
www/media/upload
|
||||
www/test.php
|
||||
|
6
AUTHORS
6
AUTHORS
@@ -12,26 +12,32 @@ Much appreciated contributors (in alphabetical order):
|
||||
Brian Armstrong <brianar>
|
||||
Charles Melbye <charlie@yourwiki.net>
|
||||
Ciaran Gultnieks <ciaran@ciarang.com>
|
||||
Daniel Steudler <steudlerdaniel@gmail.com>
|
||||
David Feeney <davidf>
|
||||
Denis Kot <denis.kot@gmail.com> - Russian translation
|
||||
Dmitry Dulepov <dmitryd>
|
||||
Fernando Sayago Gil <mikados.mikados@gmail.com> - Spanish translation
|
||||
Gert van Valkenhoef <gertvv>
|
||||
Jakub Viták <mainiak@gmail.com> - Czech translation
|
||||
Janez Troha <http://www.dz0ny.info> - Slovenian translation
|
||||
Jean-Philippe Fleury <jpfleury>
|
||||
Jerry <lxb429@gmail.com> - Chinese translation
|
||||
Julien Issler <julien@issler.net>
|
||||
Litew <litew9@gmail.com> - Russian translation
|
||||
Ludovic Bellière <xrogaan>
|
||||
Manuel Eidenberger <eidenberger@gmail.com>
|
||||
Matthew Dawson <mjd>
|
||||
Matías Halles <matias@halles.cl>
|
||||
Mehdi Kabab <http://pioupioum.fr/>
|
||||
Nicolas Lassalle <nicolas@beroot.org> - Subversion support
|
||||
Ozan <uobasar@gmail.com> - Turkish translation
|
||||
Patrick Georgi <patrick.georgi@coresystems.de>
|
||||
Pedro Kiefer <pedro@kiefer.com.br> - Brazilian Portuguese translation
|
||||
Raphaël Emourgeon <raphael>
|
||||
Samuel Suther <info@suther.de> - German translation
|
||||
Sindre R. Myren <sindrero@stud.ntnu.no>
|
||||
Stewart Platt <stew@futurete.ch>
|
||||
Stéphane Baron <sbaron>
|
||||
Thomas Keller <me@thomaskeller.biz> - Monotone support
|
||||
Vladimir Solomatin <slash>
|
||||
William Martin <william.martin@lcpc.fr>
|
||||
|
10
Makefile
10
Makefile
@@ -62,11 +62,11 @@ pot-update: pluf_path
|
||||
fi
|
||||
touch src/IDF/locale/idf.pot;
|
||||
# Extract string
|
||||
@cd src; php $(PLUF_PATH)/extracttemplates.php IDF/conf/idf.php IDF/gettexttemplates
|
||||
@cd src; php "$(PLUF_PATH)/extracttemplates.php" IDF/conf/idf.php IDF/gettexttemplates
|
||||
@cd src; for phpfile in `find . -iname "*.php"`; do \
|
||||
printf "Parsing file : "$$phpfile"\n"; \
|
||||
xgettext -o idf.pot -p ./IDF/locale/ --from-code=UTF-8 -j \
|
||||
--keyword --keyword=__ --keyword=_n:1,2 -L PHP $$phpfile ; \
|
||||
--keyword --keyword=__ --keyword=_n:1,2 -L PHP "$$phpfile" ; \
|
||||
done
|
||||
# Remove tmp folder
|
||||
rm -Rf src/IDF/gettexttemplates
|
||||
@@ -76,7 +76,7 @@ pot-update: pluf_path
|
||||
po-update: pluf_path
|
||||
@for pofile in `ls src/IDF/locale/*/idf.po`; do \
|
||||
printf "Updating file : "$$pofile"\n"; \
|
||||
msgmerge -v -U $$pofile src/IDF/locale/idf.pot; \
|
||||
msgmerge -v -U "$$pofile" src/IDF/locale/idf.pot; \
|
||||
printf "\n"; \
|
||||
done
|
||||
|
||||
@@ -144,7 +144,7 @@ po-stats:
|
||||
--pretty=format:%h`.zip
|
||||
|
||||
db-install:
|
||||
@cd src && php $(PLUF_PATH)/migrate.php --conf=IDF/conf/idf.php -a -d -i
|
||||
@cd src && php "$(PLUF_PATH)/migrate.php" --conf=IDF/conf/idf.php -a -d -i
|
||||
|
||||
db-update:
|
||||
@cd src && php $(PLUF_PATH)/migrate.php --conf=IDF/conf/idf.php -a -d
|
||||
@cd src && php "$(PLUF_PATH)/migrate.php" --conf=IDF/conf/idf.php -a -d
|
||||
|
100
NEWS.mdtext
100
NEWS.mdtext
@@ -1,23 +1,111 @@
|
||||
# InDefero 1.2 - xxx xxx xx xx:xx 2011 UTC
|
||||
# InDefero 1.2.1 - XXX XXX XX XX:XX:XX UTC 201X
|
||||
|
||||
ATTENTION: You need Pluf [324ae60b](http://projects.ceondo.com/p/pluf/source/commit/324ae60b)
|
||||
## Bugfixes
|
||||
|
||||
- The diff view now renders properly in Firefox when a minimum font size
|
||||
is configured or the user zooms the web page (fixes issue 773)
|
||||
|
||||
## Language and Translations
|
||||
|
||||
- Multiple fixes to English source strings (fixes issues 763, 766, and 772,
|
||||
thanks to JP Fleury!)
|
||||
|
||||
# InDefero 1.2 - Sun Nov 6 23:04:00 UTC 2011
|
||||
|
||||
ATTENTION: You need Pluf [46b7f251](http://projects.ceondo.com/p/pluf/source/commit/46b7f251)
|
||||
or newer to properly run this version of Indefero!
|
||||
|
||||
## New Features
|
||||
|
||||
- Indefero's issue tracker can now bi-directionally link issues with variable, configurable
|
||||
terms, such as "is related to", "is blocked by" or "is duplicated by" (issue 638)
|
||||
- Indefero's issue tracker can now bi-directionally link issues with variable,
|
||||
configurable terms, such as "is related to", "is blocked by" or
|
||||
"is duplicated by" (issue 638)
|
||||
- When you search for issues, the results can further be refined by issue state
|
||||
(open or closed) and label (partially implements issue 548)
|
||||
- Source and diff views now make characters like line endings, tabs and other
|
||||
"invisible" control characters visible on hover and cope with long lines much
|
||||
better (issue 636)
|
||||
- Mercurial source views now show parent revisions (if any) and detailed change
|
||||
information
|
||||
- Subversion source views now show detailed change information (issue 622)
|
||||
- File download URLs now contain the file name rather than the upload id;
|
||||
old links still work though (issues 559 and 686)
|
||||
- monotone file and directory attributes are displayed in the tree and file view
|
||||
(needs a monotone with an interface version of 13.1 or newer)
|
||||
- The context area is now kept in view when a page scrolls down several pages
|
||||
- A summary section has been added to the issue tracker with statistics about
|
||||
open / closed issues, unresolved issues grouped by tags and owners
|
||||
- The project list and title has gathered a customizable icon for each project
|
||||
- The download section now provides MD5 checksums for uploaded files
|
||||
- Wiki pages now come with a designated stylesheet for printer output (issue 713)
|
||||
|
||||
## Bugfixes
|
||||
|
||||
- Git's cron job doesn't erase manually added keys anymore (issue 247)
|
||||
- The SVN interface acts more robust if an underlying repository has been
|
||||
restructured (issues 364 and 721)
|
||||
- monotone zip archive entries now all carry the revision date as mtime (issue 645)
|
||||
- Timeline only displays filter options for items a user has actually access to (issue 655)
|
||||
- Fix the self-link of the RSS feed (issue 666)
|
||||
- The timeline only now only displays filter options for items a user has
|
||||
actually access to (issue 655)
|
||||
- The log, tags and branches parsers for Mercurial are more robust now (issue 663)
|
||||
- Several SSH public key parsing issues have been fixed and the check for existing,
|
||||
uploaded keys has been improved (issue 679)
|
||||
- Diff views now show empty context lines for git and hg again (issue 688)
|
||||
- The SVN command line client no longer accidential tries to store the login
|
||||
credentials we give him as arguments for the user executing the SVN command
|
||||
- The usher section in the forge administration no longer displays a bogus
|
||||
server enty in case no monotone server is configured in the connected
|
||||
usher instance
|
||||
- A timeout that popped up when Usher is restarted has been fixed (issue 695)
|
||||
- The SyncMonotone plugin now cleans up partial artifacts it created during the
|
||||
addition of a new project or monotone key, in case an error popped up in the
|
||||
middle (issue 697)
|
||||
- Indefero now sends the MD5 checksum as HTTP header when downloading a file from the
|
||||
download area; additionally, a unneeded redirect has been removed (issue 716)
|
||||
- Source links without a specific revision did not work due to a wrong regex
|
||||
(issue 730)
|
||||
- Avatar URL generation use correctly the configuration (issue 732)
|
||||
- The SyncGit plugin no longer fails to remove a non-existing post-update hook
|
||||
on repository creation (issue 752)
|
||||
- When uploading a project logo, an existing uploaded file with the same name
|
||||
no longer leads to an error, but is simple overwritten (fixes issue 740)
|
||||
- The error detection and reporting in the SyncMonotone plugin has been improved
|
||||
- The branch links users of the Subversion frontend get when they enter a wrong
|
||||
revision are fixed; this list is now also only displayed (for any SCM) if
|
||||
there are actually branches available in the repository
|
||||
- If git's author name is not encoded in an UTF-8 compatible encoding, skip the
|
||||
author lookup, as we have no information what the author string is actually
|
||||
encoded in
|
||||
- Indefero no longer displays an empty parents paragraph in the commit view for
|
||||
root revisions of a git repository
|
||||
- Indefero now only shows the tags of the closed and not the open issues in the
|
||||
closed issues list
|
||||
|
||||
## Documentation
|
||||
|
||||
- The documentation on the setup of the monotone plugin has been improved.
|
||||
|
||||
## Translations
|
||||
|
||||
- The Russian translation has been enabled by default (thanks for all the great
|
||||
work, Denis Kot and Litew!)
|
||||
- Brazilian Portuguese translation started (thanks to Pedro Kiefer!)
|
||||
- Turkish translation started (thanks to Ozan!)
|
||||
|
||||
# InDefero 1.1.2 - Thu May 26 07:42:25 2011 UTC
|
||||
|
||||
## Bugfixes
|
||||
|
||||
- Fix tags extraction from git repository (issue 675)
|
||||
- Fix SSH validation method (issue 671)
|
||||
- Fix malformed URL in the RSS (issue 666)
|
||||
- Fix validateRevision call for Mercurial Scm (issue 657)
|
||||
|
||||
## Translations
|
||||
|
||||
- Missing word in French translation (issue 672)
|
||||
- Update Spanish translation
|
||||
|
||||
# InDefero 1.1.1 - Mon Mar 28 15:52 2011 UTC
|
||||
|
||||
## Bugfixes
|
||||
|
@@ -25,7 +25,7 @@ If you install monotone from source (<http://monotone.ca/downloads.php>),
|
||||
please follow the `INSTALL` document which comes with the software.
|
||||
It contains detailed instructions, including all needed dependencies.
|
||||
|
||||
## Choose your indefero setup
|
||||
## Choose your indefero (IDF) setup
|
||||
|
||||
The monotone plugin can be used in several different ways:
|
||||
|
||||
@@ -112,14 +112,40 @@ The monotone plugin can be used in several different ways:
|
||||
^D
|
||||
$ chmod 600 usher.conf
|
||||
|
||||
**ATTENTION:** Do _not_ configure a default monotone server key in `usher.conf`,
|
||||
otherwise the individual server key that IDF creates for each project is
|
||||
not used and this could cause problems.
|
||||
|
||||
Your indefero www user needs later write access to `usher.conf` and
|
||||
`projects/`. There are two ways of setting this up:
|
||||
|
||||
* Make the usher user the web user, for example via Apache's `suexec`
|
||||
* Use acls, like this:
|
||||
* Make the usher user the web user, for example via Apache's `suexec`.
|
||||
This is however a bit clumsy.
|
||||
* Preferred: Use Access Control Lists (ACLs), like this:
|
||||
|
||||
#
|
||||
# Linux
|
||||
#
|
||||
$ setfacl -m u:www:rw usher.conf
|
||||
$ setfacl -m d:u:www:rwx projects/
|
||||
$ setfacl -m d:u:usher:rwx projects/
|
||||
#
|
||||
# FreeBSD
|
||||
#
|
||||
$ setfacl -m user:www:rw::allow usher.conf
|
||||
$ setfacl -m user:www:rwxp:fd:allow projects/
|
||||
$ setfacl -m user:usher:rwxp:fd:allow projects/
|
||||
#
|
||||
# Mac OS X
|
||||
#
|
||||
chmod +a '_www allow read,write' usher.conf
|
||||
chmod +a '_www allow read,write,delete,add_file,add_subdirectory,file_inherit,directory_inherit' projects/
|
||||
chmod +a 'usher allow read,write,delete,add_file,add_subdirectory,file_inherit,directory_inherit' projects/
|
||||
|
||||
In each example's last line, `usher` is the user which is executing
|
||||
the usher instance. **It is very important to add this line, otherwise
|
||||
usher won't be able to read and write into the initial file system
|
||||
setup IDF creates!**
|
||||
|
||||
5. Wrap a daemonizer around usher, for example supervise from daemontools
|
||||
(<http://cr.yp.to/damontools.html>):
|
||||
|
@@ -235,7 +235,7 @@ class IDF_Commit extends Pluf_Model
|
||||
</tr>
|
||||
<tr class="extra">
|
||||
<td colspan="2">
|
||||
<div class="helptext right">'.sprintf(__('Commit %s, by %s'), '<a href="'.$url.'" class="mono">'.$this->scm_id.'</a>', $user).'</div></td></tr>';
|
||||
<div class="helptext right">'.sprintf(__('Commit %1$s, by %2$s'), '<a href="'.$url.'" class="mono">'.$this->scm_id.'</a>', $user).'</div></td></tr>';
|
||||
return Pluf_Template::markSafe($out);
|
||||
}
|
||||
|
||||
@@ -326,7 +326,7 @@ class IDF_Commit extends Pluf_Model
|
||||
foreach ($addresses as $address) {
|
||||
$email = new Pluf_Mail(Pluf::f('from_email'),
|
||||
$address,
|
||||
sprintf(__('New Commit %s - %s (%s)'),
|
||||
sprintf(__('New Commit %1$s - %2$s (%3$s)'),
|
||||
$this->scm_id, $this->summary,
|
||||
$this->get_project()->shortname));
|
||||
$email->addTextMessage($text_email);
|
||||
|
231
src/IDF/Diff.php
231
src/IDF/Diff.php
@@ -35,9 +35,7 @@ class IDF_Diff
|
||||
public function __construct($diff, $path_strip_level = 0)
|
||||
{
|
||||
$this->path_strip_level = $path_strip_level;
|
||||
// this works because in unified diff format even empty lines are
|
||||
// either prefixed with a '+', '-' or ' '
|
||||
$this->lines = preg_split("/\015\012|\015|\012/", $diff, -1, PREG_SPLIT_NO_EMPTY);
|
||||
$this->lines = IDF_FileUtil::splitIntoLines($diff, true);
|
||||
}
|
||||
|
||||
public function parse()
|
||||
@@ -66,12 +64,12 @@ class IDF_Diff
|
||||
}
|
||||
|
||||
// use new file name by default
|
||||
preg_match("/^\+\+\+ ([^\t]+)/", $newfileline, $m);
|
||||
preg_match("/^\+\+\+ ([^\t\n\r]+)/", $newfileline, $m);
|
||||
$current_file = $m[1];
|
||||
if ($current_file === '/dev/null') {
|
||||
// except if it's /dev/null, use the old one instead
|
||||
// eg. mtn 0.48 and newer
|
||||
preg_match("/^--- ([^\t]+)/", $oldfileline, $m);
|
||||
preg_match("/^--- ([^\t\r\n]+)/", $oldfileline, $m);
|
||||
$current_file = $m[1];
|
||||
}
|
||||
if ($this->path_strip_level > 0) {
|
||||
@@ -101,11 +99,12 @@ class IDF_Diff
|
||||
$files[$current_file]['chunks'][] = array();
|
||||
|
||||
while ($i < $diffsize && ($addlines >= 0 || $dellines >= 0)) {
|
||||
$linetype = $this->lines[$i] != '' ? $this->lines[$i][0] : ' ';
|
||||
$linetype = $this->lines[$i] != '' ? $this->lines[$i][0] : false;
|
||||
$content = substr($this->lines[$i], 1);
|
||||
switch ($linetype) {
|
||||
case ' ':
|
||||
$files[$current_file]['chunks'][$current_chunk][] =
|
||||
array($delstart, $addstart, substr($this->lines[$i++], 1));
|
||||
array($delstart, $addstart, $content);
|
||||
$dellines--;
|
||||
$addlines--;
|
||||
$delstart++;
|
||||
@@ -113,23 +112,26 @@ class IDF_Diff
|
||||
break;
|
||||
case '+':
|
||||
$files[$current_file]['chunks'][$current_chunk][] =
|
||||
array('', $addstart, substr($this->lines[$i++], 1));
|
||||
array('', $addstart, $content);
|
||||
$addlines--;
|
||||
$addstart++;
|
||||
break;
|
||||
case '-':
|
||||
$files[$current_file]['chunks'][$current_chunk][] =
|
||||
array($delstart, '', substr($this->lines[$i++], 1));
|
||||
array($delstart, '', $content);
|
||||
$dellines--;
|
||||
$delstart++;
|
||||
break;
|
||||
case '\\':
|
||||
// ignore newline handling for now, see issue 636
|
||||
$i++;
|
||||
// no new line at the end of this file; remove pseudo new line from last line
|
||||
$cur = count($files[$current_file]['chunks'][$current_chunk]) - 1;
|
||||
$files[$current_file]['chunks'][$current_chunk][$cur][2] =
|
||||
rtrim($files[$current_file]['chunks'][$current_chunk][$cur][2], "\r\n");
|
||||
continue;
|
||||
default:
|
||||
break 2;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
$current_chunk++;
|
||||
}
|
||||
@@ -144,46 +146,92 @@ class IDF_Diff
|
||||
public function as_html()
|
||||
{
|
||||
$out = '';
|
||||
foreach ($this->files as $filename=>$file) {
|
||||
foreach ($this->files as $filename => $file) {
|
||||
$pretty = '';
|
||||
$fileinfo = IDF_FileUtil::getMimeType($filename);
|
||||
if (IDF_FileUtil::isSupportedExtension($fileinfo[2])) {
|
||||
$pretty = ' prettyprint';
|
||||
}
|
||||
$out .= "\n".'<table class="diff" summary="">'."\n";
|
||||
$out .= '<tr id="diff-'.md5($filename).'"><th colspan="3">'.Pluf_esc($filename).'</th></tr>'."\n";
|
||||
|
||||
$cc = 1;
|
||||
$offsets = array();
|
||||
$contents = array();
|
||||
|
||||
foreach ($file['chunks'] as $chunk) {
|
||||
foreach ($chunk as $line) {
|
||||
if ($line[0] and $line[1]) {
|
||||
$class = 'diff-c';
|
||||
} elseif ($line[0]) {
|
||||
$class = 'diff-r';
|
||||
list($left, $right, $content) = $line;
|
||||
if ($left and $right) {
|
||||
$class = 'context';
|
||||
} elseif ($left) {
|
||||
$class = 'removed';
|
||||
} else {
|
||||
$class = 'diff-a';
|
||||
$class = 'added';
|
||||
}
|
||||
$line_content = self::padLine(Pluf_esc($line[2]));
|
||||
$out .= sprintf('<tr class="diff-line"><td class="diff-lc">%s</td><td class="diff-lc">%s</td><td class="%s%s mono">%s</td></tr>'."\n", $line[0], $line[1], $class, $pretty, $line_content);
|
||||
|
||||
$offsets[] = sprintf('<td>%s</td><td>%s</td>', $left, $right);
|
||||
$content = IDF_FileUtil::emphasizeControlCharacters(Pluf_esc($content));
|
||||
$contents[] = sprintf('<td class="%s%s mono">%s</td>', $class, $pretty, $content);
|
||||
}
|
||||
if (count($file['chunks']) > $cc) {
|
||||
$offsets[] = '<td class="next">...</td><td class="next">...</td>';
|
||||
$contents[] = '<td class="next"></td>';
|
||||
}
|
||||
if (count($file['chunks']) > $cc)
|
||||
$out .= '<tr class="diff-next"><td>...</td><td>...</td><td> </td></tr>'."\n";
|
||||
$cc++;
|
||||
}
|
||||
$out .= '</table>';
|
||||
}
|
||||
return Pluf_Template::markSafe($out);
|
||||
}
|
||||
|
||||
public static function padLine($line)
|
||||
{
|
||||
$line = str_replace("\t", ' ', $line);
|
||||
$n = strlen($line);
|
||||
for ($i=0;$i<$n;$i++) {
|
||||
if (substr($line, $i, 1) != ' ') {
|
||||
break;
|
||||
list($added, $removed) = end($file['chunks_def']);
|
||||
|
||||
$added = $added[0] + $added[1];
|
||||
$leftwidth = 0;
|
||||
if ($added > 0)
|
||||
$leftwidth = ((ceil(log10($added)) + 1) * 8) + 17;
|
||||
|
||||
$removed = $removed[0] + $removed[1];
|
||||
$rightwidth = 0;
|
||||
if ($removed > 0)
|
||||
$rightwidth = ((ceil(log10($removed)) + 1) * 8) + 17;
|
||||
|
||||
// we need to correct the width of a single column a little
|
||||
// to take less space and to hide the empty one
|
||||
$class = '';
|
||||
if ($leftwidth == 0) {
|
||||
$class = 'left-hidden';
|
||||
$rightwidth -= floor(log10($removed));
|
||||
}
|
||||
else if ($rightwidth == 0) {
|
||||
$class = 'right-hidden';
|
||||
$leftwidth -= floor(log10($added));
|
||||
}
|
||||
|
||||
$inner_linecounts =
|
||||
'<table class="diff-linecounts '.$class.'">' ."\n".
|
||||
'<colgroup><col width="'.$leftwidth.'" /><col width="'. $rightwidth.'" /></colgroup>' ."\n".
|
||||
'<tr class="line">' .
|
||||
implode('</tr>'."\n".'<tr class="line">', $offsets).
|
||||
'</tr>' ."\n".
|
||||
'</table>' ."\n";
|
||||
|
||||
|
||||
$inner_contents =
|
||||
'<table class="diff-contents">' ."\n".
|
||||
'<tr class="line">' .
|
||||
implode('</tr>'."\n".'<tr class="line">', $contents) .
|
||||
'</tr>' ."\n".
|
||||
'</table>' ."\n";
|
||||
|
||||
$out .= '<table class="diff unified">' ."\n".
|
||||
'<colgroup><col width="'.($leftwidth + $rightwidth + 1).'" /><col width="*" /></colgroup>' ."\n".
|
||||
'<tr id="diff-'.md5($filename).'">'.
|
||||
'<th colspan="2">'.Pluf_esc($filename).'</th>'.
|
||||
'</tr>' ."\n".
|
||||
'<tr>' .
|
||||
'<td>'. $inner_linecounts .'</td>'. "\n".
|
||||
'<td><div class="scroll">'. $inner_contents .'</div></td>'.
|
||||
'</tr>' ."\n".
|
||||
'</table>' ."\n";
|
||||
}
|
||||
return str_repeat(' ', $i).substr($line, $i);
|
||||
|
||||
return Pluf_Template::markSafe($out);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -208,12 +256,12 @@ class IDF_Diff
|
||||
*/
|
||||
public function fileCompare($orig, $chunks, $filename, $context=10)
|
||||
{
|
||||
$orig_lines = preg_split("/\015\012|\015|\012/", $orig);
|
||||
$orig_lines = IDF_FileUtil::splitIntoLines($orig);
|
||||
$new_chunks = $this->mergeChunks($orig_lines, $chunks, $context);
|
||||
return $this->renderCompared($new_chunks, $filename);
|
||||
}
|
||||
|
||||
public function mergeChunks($orig_lines, $chunks, $context=10)
|
||||
private function mergeChunks($orig_lines, $chunks, $context=10)
|
||||
{
|
||||
$spans = array();
|
||||
$new_chunks = array();
|
||||
@@ -310,38 +358,115 @@ class IDF_Diff
|
||||
return $nnew_chunks;
|
||||
}
|
||||
|
||||
public function renderCompared($chunks, $filename)
|
||||
private function renderCompared($chunks, $filename)
|
||||
{
|
||||
$fileinfo = IDF_FileUtil::getMimeType($filename);
|
||||
$pretty = '';
|
||||
if (IDF_FileUtil::isSupportedExtension($fileinfo[2])) {
|
||||
$pretty = ' prettyprint';
|
||||
}
|
||||
$out = '';
|
||||
|
||||
$cc = 1;
|
||||
$i = 0;
|
||||
$left_offsets = array();
|
||||
$left_contents = array();
|
||||
$right_offsets = array();
|
||||
$right_contents = array();
|
||||
|
||||
$max_lineno_left = $max_lineno_right = 0;
|
||||
|
||||
foreach ($chunks as $chunk) {
|
||||
foreach ($chunk as $line) {
|
||||
$line1 = ' ';
|
||||
$line2 = ' ';
|
||||
$line[2] = (strlen($line[2])) ? self::padLine(Pluf_esc($line[2])) : ' ';
|
||||
$left = '';
|
||||
$right = '';
|
||||
$content = IDF_FileUtil::emphasizeControlCharacters(Pluf_esc($line[2]));
|
||||
|
||||
if ($line[0] and $line[1]) {
|
||||
$class = 'diff-c';
|
||||
$line1 = $line2 = $line[2];
|
||||
$class = 'context';
|
||||
$left = $right = $content;
|
||||
} elseif ($line[0]) {
|
||||
$class = 'diff-r';
|
||||
$line1 = $line[2];
|
||||
$class = 'removed';
|
||||
$left = $content;
|
||||
} else {
|
||||
$class = 'diff-a';
|
||||
$line2 = $line[2];
|
||||
$class = 'added';
|
||||
$right = $content;
|
||||
}
|
||||
$out .= sprintf('<tr class="diff-line"><td class="diff-lc">%s</td><td class="%s mono%s"><code>%s</code></td><td class="diff-lc">%s</td><td class="%s mono%s"><code>%s</code></td></tr>'."\n", $line[0], $class, $pretty, $line1, $line[1], $class, $pretty, $line2);
|
||||
|
||||
$left_offsets[] = sprintf('<td>%s</td>', $line[0]);
|
||||
$right_offsets[] = sprintf('<td>%s</td>', $line[1]);
|
||||
$left_contents[] = sprintf('<td class="%s%s mono">%s</td>', $class, $pretty, $left);
|
||||
$right_contents[] = sprintf('<td class="%s%s mono">%s</td>', $class, $pretty, $right);
|
||||
|
||||
$max_lineno_left = max($max_lineno_left, $line[0]);
|
||||
$max_lineno_right = max($max_lineno_right, $line[1]);
|
||||
}
|
||||
|
||||
if (count($chunks) > $cc) {
|
||||
$left_offsets[] = '<td class="next">...</td>';
|
||||
$right_offsets[] = '<td class="next">...</td>';
|
||||
$left_contents[] = '<td></td>';
|
||||
$right_contents[] = '<td></td>';
|
||||
}
|
||||
if (count($chunks) > $cc)
|
||||
$out .= '<tr class="diff-next"><td>...</td><td> </td><td>...</td><td> </td></tr>'."\n";
|
||||
$cc++;
|
||||
$i++;
|
||||
}
|
||||
|
||||
$leftwidth = 1;
|
||||
if ($max_lineno_left > 0)
|
||||
$leftwidth = ((ceil(log10($max_lineno_left)) + 1) * 8) + 17;
|
||||
|
||||
$rightwidth = 1;
|
||||
if ($max_lineno_right > 0)
|
||||
$rightwidth = ((ceil(log10($max_lineno_right)) + 1) * 8) + 17;
|
||||
|
||||
$inner_linecounts_left =
|
||||
'<table class="diff-linecounts">' ."\n".
|
||||
'<colgroup><col width="'.$leftwidth.'" /></colgroup>' ."\n".
|
||||
'<tr class="line">' .
|
||||
implode('</tr>'."\n".'<tr class="line">', $left_offsets).
|
||||
'</tr>' ."\n".
|
||||
'</table>' ."\n";
|
||||
|
||||
$inner_linecounts_right =
|
||||
'<table class="diff-linecounts">' ."\n".
|
||||
'<colgroup><col width="'.$rightwidth.'" /></colgroup>' ."\n".
|
||||
'<tr class="line">' .
|
||||
implode('</tr>'."\n".'<tr class="line">', $right_offsets).
|
||||
'</tr>' ."\n".
|
||||
'</table>' ."\n";
|
||||
|
||||
$inner_contents_left =
|
||||
'<table class="diff-contents">' ."\n".
|
||||
'<tr class="line">' .
|
||||
implode('</tr>'."\n".'<tr class="line">', $left_contents) .
|
||||
'</tr>' ."\n".
|
||||
'</table>' ."\n";
|
||||
|
||||
$inner_contents_right =
|
||||
'<table class="diff-contents">' ."\n".
|
||||
'<tr class="line">' .
|
||||
implode('</tr>'."\n".'<tr class="line">', $right_contents) .
|
||||
'</tr>' ."\n".
|
||||
'</table>' ."\n";
|
||||
|
||||
$out =
|
||||
'<table class="diff context">' ."\n".
|
||||
'<colgroup>' .
|
||||
'<col width="'.($leftwidth + 1).'" /><col width="*" />' .
|
||||
'<col width="'.($rightwidth + 1).'" /><col width="*" />' .
|
||||
'</colgroup>' ."\n".
|
||||
'<tr id="diff-'.md5($filename).'">'.
|
||||
'<th colspan="4">'.Pluf_esc($filename).'</th>'.
|
||||
'</tr>' ."\n".
|
||||
'<tr>' .
|
||||
'<th colspan="2">'.__('Old').'</th><th colspan="2">'.__('New').'</th>' .
|
||||
'</tr>'.
|
||||
'<tr>' .
|
||||
'<td>'. $inner_linecounts_left .'</td>'. "\n".
|
||||
'<td><div class="scroll">'. $inner_contents_left .'</div></td>'. "\n".
|
||||
'<td>'. $inner_linecounts_right .'</td>'. "\n".
|
||||
'<td><div class="scroll">'. $inner_contents_right .'</div></td>'. "\n".
|
||||
'</tr>' ."\n".
|
||||
'</table>' ."\n";
|
||||
|
||||
return Pluf_Template::markSafe($out);
|
||||
}
|
||||
}
|
||||
|
@@ -65,9 +65,9 @@ class IDF_FileUtil
|
||||
}
|
||||
$table = array();
|
||||
$i = 1;
|
||||
foreach (preg_split("/\015\012|\015|\012/", $content) as $line) {
|
||||
foreach (self::splitIntoLines($content) as $line) {
|
||||
$table[] = '<tr class="c-line"><td class="code-lc" id="L'.$i.'"><a href="#L'.$i.'">'.$i.'</a></td>'
|
||||
.'<td class="code mono'.$pretty.'">'.IDF_Diff::padLine(Pluf_esc($line)).'</td></tr>';
|
||||
.'<td class="code mono'.$pretty.'">'.self::emphasizeControlCharacters(Pluf_esc($line)).'</td></tr>';
|
||||
$i++;
|
||||
}
|
||||
return Pluf_Template::markSafe(implode("\n", $table));
|
||||
@@ -143,6 +143,56 @@ class IDF_FileUtil
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Splits a string into separate lines while retaining the individual
|
||||
* line ending character for every line.
|
||||
*
|
||||
* OS9 line endings are not supported.
|
||||
*
|
||||
* @param string content
|
||||
* @param boolean if true, skip completely empty lines
|
||||
* @return string
|
||||
*/
|
||||
public static function splitIntoLines($content, $skipEmpty = false)
|
||||
{
|
||||
$flags = PREG_SPLIT_OFFSET_CAPTURE;
|
||||
if ($skipEmpty) $flags |= PREG_SPLIT_NO_EMPTY;
|
||||
$splitted = preg_split("/\r\n|\n/", $content, -1, $flags);
|
||||
|
||||
$last_off = -1;
|
||||
$lines = array();
|
||||
while (($split = array_shift($splitted)) !== null) {
|
||||
if ($last_off != -1) {
|
||||
$lines[] .= substr($content, $last_off, $split[1] - $last_off);
|
||||
}
|
||||
$last_off = $split[1];
|
||||
}
|
||||
$lines[] = substr($content, $last_off);
|
||||
return $lines;
|
||||
}
|
||||
|
||||
/**
|
||||
* This translates most of the C0 ASCII control characters into
|
||||
* their visual counterparts in the 0x24## unicode plane
|
||||
* (http://en.wikipedia.org/wiki/C0_and_C1_control_codes).
|
||||
*
|
||||
* We could add DEL (0x7F) to this set, but unfortunately this
|
||||
* is not nicely mapped to 0x247F in the control plane, but 0x2421
|
||||
* and adding an if expression below just for this is a little bit
|
||||
* of a hassle. And of course, the more esoteric ones from C1 are
|
||||
* missing as well...
|
||||
*
|
||||
* @param string $content
|
||||
* @return string
|
||||
*/
|
||||
public static function emphasizeControlCharacters($content)
|
||||
{
|
||||
return preg_replace(
|
||||
'/([\x00-\x1F])/ue',
|
||||
'"<span class=\"ctrl-char\" title=\"0x".bin2hex("\\1")."\">$".bin2hex("\\1")."</span>"',
|
||||
$content);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find if a given mime type is a text file.
|
||||
* This uses the output of the self::getMimeType function.
|
||||
|
@@ -199,7 +199,7 @@ class IDF_Form_Admin_ProjectCreate extends Pluf_Form
|
||||
$mtn_master_branch)) {
|
||||
throw new Pluf_Form_Invalid(__(
|
||||
'The master branch is empty or contains illegal characters, '.
|
||||
'please use only letters, digits, dashs and dots as separators.'
|
||||
'please use only letters, digits, dashes and dots as separators.'
|
||||
));
|
||||
}
|
||||
|
||||
|
@@ -161,7 +161,7 @@ class IDF_Form_Admin_UserUpdate extends Pluf_Form
|
||||
'label' => __('Staff'),
|
||||
'initial' => $this->user->staff,
|
||||
'widget' => 'Pluf_Form_Widget_CheckboxInput',
|
||||
'help_text' => __('If you give staff rights to a user, you really need to trust them.'),
|
||||
'help_text' => __('If you give staff rights to a user, you really need to trust him.'),
|
||||
));
|
||||
}
|
||||
|
||||
|
@@ -214,7 +214,7 @@ class IDF_Form_IssueCreate extends Pluf_Form
|
||||
else $count[$class] += 1;
|
||||
if (in_array($class, $onemax) and $count[$class] > 1) {
|
||||
if (!isset($this->errors['label'.$i])) $this->errors['label'.$i] = array();
|
||||
$this->errors['label'.$i][] = sprintf(__('You cannot provide more than label from the %s class to an issue.'), $class);
|
||||
$this->errors['label'.$i][] = sprintf(__('You cannot provide more than one label from the %s class to an issue.'), $class);
|
||||
throw new Pluf_Form_Invalid(__('You provided an invalid label.'));
|
||||
}
|
||||
}
|
||||
|
@@ -94,7 +94,7 @@ duplicates, is duplicated by';
|
||||
{
|
||||
$this->fields['labels_issue_template'] = new Pluf_Form_Field_Varchar(
|
||||
array('required' => false,
|
||||
'label' => __('Define an issue template to hint to the reporter to provide certain information'),
|
||||
'label' => __('Define an issue template to hint the reporter to provide certain information'),
|
||||
'initial' => self::init_template,
|
||||
'widget_attrs' => array('rows' => 7,
|
||||
'cols' => 75),
|
||||
|
@@ -67,6 +67,7 @@ class IDF_Form_ProjectConf extends Pluf_Form
|
||||
'move_function_params' =>
|
||||
array('upload_path' => $upload_path,
|
||||
'upload_path_create' => true,
|
||||
'upload_overwrite' => true,
|
||||
'file_name' => $filename,
|
||||
)
|
||||
));
|
||||
|
@@ -94,7 +94,7 @@ class IDF_Form_Register extends Pluf_Form
|
||||
{
|
||||
$this->cleaned_data['email'] = mb_strtolower(trim($this->cleaned_data['email']));
|
||||
if (Pluf::factory('IDF_EmailAddress')->get_user_for_email_address($this->cleaned_data['email']) != null) {
|
||||
throw new Pluf_Form_Invalid(sprintf(__('The email "%s" is already used. If you need to, click on the help link to recover your password.'), $this->cleaned_data['email']));
|
||||
throw new Pluf_Form_Invalid(sprintf(__('The email "%1$s" is already used. If you need to, you can <a href="%2$s">recover your password</a>.'), $this->cleaned_data['email'], Pluf_HTTP_URL_urlForView('IDF_Views::passwordRecoveryAsk')));
|
||||
}
|
||||
return $this->cleaned_data['email'];
|
||||
}
|
||||
|
@@ -107,7 +107,7 @@ class IDF_Form_RegisterConfirmation extends Pluf_Form
|
||||
throw new Pluf_Form_Invalid($error);
|
||||
}
|
||||
if ($users[0]->active) {
|
||||
throw new Pluf_Form_Invalid(__('This account has already been confirmed. Maybe should you try to recover your password using the help link.'));
|
||||
throw new Pluf_Form_Invalid(sprintf(__('This account has already been confirmed. Maybe should you try to <a href="%s">recover your password</a>.'), Pluf_HTTP_URL_urlForView('IDF_Views::passwordRecoveryAsk')));
|
||||
}
|
||||
$this->_user_id = $email_id[1];
|
||||
return $this->cleaned_data['key'];
|
||||
|
@@ -55,7 +55,7 @@ class IDF_Form_SourceConf extends Pluf_Form
|
||||
array('required' => false,
|
||||
'label' => __('Webhook URL'),
|
||||
'initial' => $this->conf->getVal('webhook_url', ''),
|
||||
'help_text' => sprintf(__('Learn more about the <a href="%s">post-commit web hooks</a>.'), $url),
|
||||
'help_text' => sprintf(__('Learn more about the <a href="%s">post-commit webhooks</a>.'), $url),
|
||||
'widget_attrs' => array('size' => 35),
|
||||
));
|
||||
|
||||
|
@@ -106,7 +106,7 @@ class IDF_Form_UpdateUpload extends Pluf_Form
|
||||
else $count[$class] += 1;
|
||||
if (in_array($class, $onemax) and $count[$class] > 1) {
|
||||
if (!isset($this->errors['label'.$i])) $this->errors['label'.$i] = array();
|
||||
$this->errors['label'.$i][] = sprintf(__('You cannot provide more than label from the %s class to an issue.'), $class);
|
||||
$this->errors['label'.$i][] = sprintf(__('You cannot provide more than one label from the %s class to an issue.'), $class);
|
||||
throw new Pluf_Form_Invalid(__('You provided an invalid label.'));
|
||||
}
|
||||
}
|
||||
|
@@ -116,7 +116,7 @@ class IDF_Form_Upload extends Pluf_Form
|
||||
else $count[$class] += 1;
|
||||
if (in_array($class, $onemax) and $count[$class] > 1) {
|
||||
if (!isset($this->errors['label'.$i])) $this->errors['label'.$i] = array();
|
||||
$this->errors['label'.$i][] = sprintf(__('You cannot provide more than label from the %s class to an issue.'), $class);
|
||||
$this->errors['label'.$i][] = sprintf(__('You cannot provide more than one label from the %s class to an issue.'), $class);
|
||||
throw new Pluf_Form_Invalid(__('You provided an invalid label.'));
|
||||
}
|
||||
}
|
||||
|
@@ -56,7 +56,7 @@ class IDF_Form_UserAccount extends Pluf_Form
|
||||
|
||||
$this->fields['email'] = new Pluf_Form_Field_Email(
|
||||
array('required' => true,
|
||||
'label' => __('Your mail'),
|
||||
'label' => __('Your email'),
|
||||
'initial' => $this->user->email,
|
||||
'help_text' => __('If you change your email address, an email will be sent to the new address to confirm it.'),
|
||||
));
|
||||
@@ -168,9 +168,9 @@ class IDF_Form_UserAccount extends Pluf_Form
|
||||
|
||||
$this->fields['secondary_mail'] = new Pluf_Form_Field_Email(
|
||||
array('required' => false,
|
||||
'label' => __('Add a secondary mail address'),
|
||||
'label' => __('Add a secondary email address'),
|
||||
'initial' => '',
|
||||
'help_text' => __('You will get a mail to confirm that you own the address you specify.'),
|
||||
'help_text' => __('You will get an email to confirm that you own the address you specify.'),
|
||||
));
|
||||
}
|
||||
|
||||
@@ -317,8 +317,15 @@ class IDF_Form_UserAccount extends Pluf_Form
|
||||
return '';
|
||||
}
|
||||
|
||||
if (preg_match('#^ssh\-[a-z]{3}\s\S+(\s\S+)?$#', $key)) {
|
||||
$key = str_replace(array("\n", "\r"), '', $key);
|
||||
$keysearch = '';
|
||||
if (preg_match('#^(ssh\-(?:dss|rsa)\s+\S+)(.*)#', $key, $m)) {
|
||||
$basekey = preg_replace('/\s+/', ' ', $m[1]);
|
||||
$comment = trim(preg_replace('/[\r\n]/', ' ', $m[2]));
|
||||
|
||||
$keysearch = $basekey.'%';
|
||||
$key = $basekey;
|
||||
if (!empty($comment))
|
||||
$key .= ' '.$comment;
|
||||
|
||||
if (Pluf::f('idf_strong_key_check', false)) {
|
||||
|
||||
@@ -337,7 +344,9 @@ class IDF_Form_UserAccount extends Pluf_Form
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (preg_match('#^\[pubkey [^\]]+\]\s*\S+\s*\[end\]$#', $key)) {
|
||||
else if (preg_match('#^\[pubkey [^\]]+\]\s*(\S+)\s*\[end\]$#', $key, $m)) {
|
||||
$keysearch = '%'.$m[1].'%';
|
||||
|
||||
if (Pluf::f('idf_strong_key_check', false)) {
|
||||
|
||||
// if monotone can read it, it should be valid
|
||||
@@ -367,7 +376,7 @@ class IDF_Form_UserAccount extends Pluf_Form
|
||||
if ($user) {
|
||||
$ruser = Pluf::factory('Pluf_User', $user);
|
||||
if ($ruser->id > 0) {
|
||||
$sql = new Pluf_SQL('content=%s', array($key));
|
||||
$sql = new Pluf_SQL('content LIKE %s AND user=%s', array($keysearch, $ruser->id));
|
||||
$keys = Pluf::factory('IDF_Key')->getList(array('filter' => $sql->gen()));
|
||||
if (count($keys) > 0) {
|
||||
throw new Pluf_Form_Invalid(
|
||||
|
@@ -147,7 +147,7 @@ Add your content here. Format your content with:
|
||||
else $count[$class] += 1;
|
||||
if (in_array($class, $onemax) and $count[$class] > 1) {
|
||||
if (!isset($this->errors['label'.$i])) $this->errors['label'.$i] = array();
|
||||
$this->errors['label'.$i][] = sprintf(__('You cannot provide more than label from the %s class to a page.'), $class);
|
||||
$this->errors['label'.$i][] = sprintf(__('You cannot provide more than one label from the %s class to a page.'), $class);
|
||||
throw new Pluf_Form_Invalid(__('You provided an invalid label.'));
|
||||
}
|
||||
}
|
||||
|
@@ -158,7 +158,7 @@ class IDF_Form_WikiUpdate extends Pluf_Form
|
||||
else $count[$class] += 1;
|
||||
if (in_array($class, $onemax) and $count[$class] > 1) {
|
||||
if (!isset($this->errors['label'.$i])) $this->errors['label'.$i] = array();
|
||||
$this->errors['label'.$i][] = sprintf(__('You cannot provide more than label from the %s class to a page.'), $class);
|
||||
$this->errors['label'.$i][] = sprintf(__('You cannot provide more than one label from the %s class to a page.'), $class);
|
||||
throw new Pluf_Form_Invalid(__('You provided an invalid label.'));
|
||||
}
|
||||
}
|
||||
|
@@ -211,7 +211,7 @@ class IDF_Issue extends Pluf_Model
|
||||
$ic = (in_array($this->status, $request->project->getTagIdsByStatus('closed'))) ? 'issue-c' : 'issue-o';
|
||||
$out .= sprintf(__('<a href="%1$s" class="%2$s" title="View issue">Issue %3$d</a>, %4$s'), $url, $ic, $this->id, Pluf_esc($this->summary)).'</td>';
|
||||
$out .= "\n".'<tr class="extra"><td colspan="2">
|
||||
<div class="helptext right">'.sprintf(__('Creation of <a href="%s" class="%s">issue %d</a>, by %s'), $url, $ic, $this->id, $user).'</div></td></tr>';
|
||||
<div class="helptext right">'.sprintf(__('Creation of <a href="%1$s" class="%2$s">issue %3$d</a>, by %4$s'), $url, $ic, $this->id, $user).'</div></td></tr>';
|
||||
return Pluf_Template::markSafe($out);
|
||||
}
|
||||
|
||||
@@ -221,7 +221,7 @@ class IDF_Issue extends Pluf_Model
|
||||
.Pluf_HTTP_URL_urlForView('IDF_Views_Issue::view',
|
||||
array($request->project->shortname,
|
||||
$this->id));
|
||||
$title = sprintf(__('%s: Issue %d created - %s'),
|
||||
$title = sprintf(__('%1$s: Issue %2$d created - %3$s'),
|
||||
$request->project->name,
|
||||
$this->id, $this->summary);
|
||||
$cts = $this->get_comments_list(array('order' => 'id ASC',
|
||||
@@ -287,7 +287,7 @@ class IDF_Issue extends Pluf_Model
|
||||
foreach ($to_email as $email_lang) {
|
||||
Pluf_Translation::loadSetLocale($email_lang[1]);
|
||||
$email = new Pluf_Mail(Pluf::f('from_email'), $email_lang[0],
|
||||
sprintf(__('Issue %s - %s (%s)'),
|
||||
sprintf(__('Issue %1$s - %2$s (%3$s)'),
|
||||
$this->id, $this->summary, $prj->shortname));
|
||||
$tmpl = new Pluf_Template('idf/issues/issue-created-email.txt');
|
||||
$email->addTextMessage($tmpl->render($context));
|
||||
@@ -333,7 +333,7 @@ class IDF_Issue extends Pluf_Model
|
||||
}
|
||||
Pluf_Translation::loadSetLocale($email_lang[1]);
|
||||
$email = new Pluf_Mail(Pluf::f('from_email'), $email_lang[0],
|
||||
sprintf(__('Updated Issue %s - %s (%s)'),
|
||||
sprintf(__('Updated Issue %1$s - %2$s (%3$s)'),
|
||||
$this->id, $this->summary, $prj->shortname));
|
||||
$tmpl = new Pluf_Template('idf/issues/issue-updated-email.txt');
|
||||
$email->addTextMessage($tmpl->render($context));
|
||||
@@ -343,4 +343,4 @@ class IDF_Issue extends Pluf_Model
|
||||
}
|
||||
Pluf_Translation::loadSetLocale($current_locale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -177,7 +177,7 @@ class IDF_IssueComment extends Pluf_Model
|
||||
}
|
||||
$out .= '</td></tr>';
|
||||
$out .= "\n".'<tr class="extra"><td colspan="2">
|
||||
<div class="helptext right">'.sprintf(__('Comment on <a href="%s" class="%s">issue %d</a>, by %s'), $url, $ic, $issue->id, $user).'</div></td></tr>';
|
||||
<div class="helptext right">'.sprintf(__('Comment on <a href="%1$s" class="%2$s">issue %3$d</a>, by %4$s'), $url, $ic, $issue->id, $user).'</div></td></tr>';
|
||||
return Pluf_Template::markSafe($out);
|
||||
}
|
||||
|
||||
@@ -188,7 +188,7 @@ class IDF_IssueComment extends Pluf_Model
|
||||
.Pluf_HTTP_URL_urlForView('IDF_Views_Issue::view',
|
||||
array($request->project->shortname,
|
||||
$issue->id));
|
||||
$title = sprintf(__('%s: Comment on issue %d - %s'),
|
||||
$title = sprintf(__('%1$s: Comment on issue %2$d - %3$s'),
|
||||
Pluf_esc($request->project->name),
|
||||
$issue->id, Pluf_esc($issue->summary));
|
||||
$url .= '#ic'.$this->id;
|
||||
|
@@ -80,7 +80,7 @@ class IDF_Key extends Pluf_Model
|
||||
if (preg_match('#^\[pubkey ([^\]]+)\]\s*(\S+)\s*\[end\]$#', $this->content, $m)) {
|
||||
return array('mtn', $m[1], $m[2]);
|
||||
}
|
||||
else if (preg_match('#^ssh\-[a-z]{3}\s(\S+)(?:\s(\S*))?$#', $this->content, $m)) {
|
||||
else if (preg_match('#^ssh\-(?:dss|rsa)\s(\S+)(?:\s(.*))?$#', $this->content, $m)) {
|
||||
if (!isset($m[2])) {
|
||||
$m[2] = "";
|
||||
}
|
||||
|
@@ -88,6 +88,7 @@ class IDF_Middleware
|
||||
'showuser' => 'IDF_Template_ShowUser',
|
||||
'ashowuser' => 'IDF_Template_AssignShowUser',
|
||||
'appversion' => 'IDF_Template_AppVersion',
|
||||
'upload' => 'IDF_Template_Tag_UploadUrl',
|
||||
));
|
||||
$params['modifiers'] = array_merge($params['modifiers'],
|
||||
array(
|
||||
|
63
src/IDF/Migrations/18DownloadMD5.php
Normal file
63
src/IDF/Migrations/18DownloadMD5.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# This file is part of InDefero, an open source project management application.
|
||||
# Copyright (C) 2008-2011 Céondo Ltd and contributors.
|
||||
#
|
||||
# InDefero is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# InDefero is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/**
|
||||
* Add the md5 column for the download model.
|
||||
*/
|
||||
|
||||
function IDF_Migrations_18DownloadMD5_up($params=null)
|
||||
{
|
||||
// Add the row
|
||||
$table = Pluf::factory('IDF_Upload')->getSqlTable();
|
||||
$sql = array();
|
||||
$sql['PostgreSQL'] = 'ALTER TABLE '.$table.' ADD COLUMN "md5" VARCHAR(32) DEFAULT \'\'';
|
||||
$sql['MySQL'] = 'ALTER TABLE '.$table.' ADD COLUMN `md5` VARCHAR(32) DEFAULT \'\'';
|
||||
$db = Pluf::db();
|
||||
$engine = Pluf::f('db_engine');
|
||||
if (!isset($sql[$engine])) {
|
||||
throw new Exception('SQLite complex migration not supported.');
|
||||
}
|
||||
$db->execute($sql[$engine]);
|
||||
|
||||
// Process md5 of already uploaded file
|
||||
$files = Pluf::factory('IDF_Upload')->getList();
|
||||
foreach ($files as $f) {
|
||||
$f->md5 = md5_file (Pluf::f('upload_path') . '/' . $f->get_project()->shortname . '/files/' . $f->file);
|
||||
$f->update();
|
||||
}
|
||||
}
|
||||
|
||||
function IDF_Migrations_18DownloadMD5_down($params=null)
|
||||
{
|
||||
// Remove the row
|
||||
$table = Pluf::factory('IDF_Upload')->getSqlTable();
|
||||
$sql = array();
|
||||
$sql['PostgreSQL'] = 'ALTER TABLE '.$table.' DROP COLUMN "md5"';
|
||||
$sql['MySQL'] = 'ALTER TABLE '.$table.' DROP COLUMN `md5`';
|
||||
$db = Pluf::db();
|
||||
$engine = Pluf::f('db_engine');
|
||||
if (!isset($sql[$engine])) {
|
||||
throw new Exception('SQLite complex migration not supported.');
|
||||
}
|
||||
$db->execute($sql[$engine]);
|
||||
}
|
@@ -59,6 +59,16 @@ class IDF_Plugin_SyncGit_Cron
|
||||
$out .= sprintf($template, $cmd, $key->login, $content)."\n";
|
||||
}
|
||||
}
|
||||
$out = "# indefero start" . PHP_EOL . $out . "# indefero end" . PHP_EOL;
|
||||
|
||||
// We update only the part of the file between IDF_START / IDF_END comment
|
||||
$original_keys = file_get_contents($authorized_keys);
|
||||
if (strstr($original_keys, "# indefero start") && strstr($original_keys, "# indefero end")) {
|
||||
$out = preg_replace('/(#\sindefero\sstart).+(#\sindefero\send\s\s?)/isU',
|
||||
$out, $original_keys);
|
||||
} else {
|
||||
$out .= $original_keys;
|
||||
}
|
||||
file_put_contents($authorized_keys, $out, LOCK_EX);
|
||||
}
|
||||
|
||||
|
@@ -210,22 +210,23 @@ class IDF_Plugin_SyncGit_Serve
|
||||
// Indefero's one.
|
||||
$p = realpath(dirname(__FILE__).'/../../../../scripts/git-post-update');
|
||||
$p = Pluf::f('idf_plugin_syncgit_post_update', $p);
|
||||
if (!@unlink($fullpath.'/hooks/post-update')) {
|
||||
$post_update_hook = $fullpath.'/hooks/post-update';
|
||||
if (file_exists($post_update_hook) && !@unlink($post_update_hook)) {
|
||||
Pluf_Log::warn(array('IDF_Plugin_Git_Serve::initRepository',
|
||||
'post-update hook removal error.',
|
||||
$fullpath.'/hooks/post-update'));
|
||||
$post_update_hook));
|
||||
return;
|
||||
}
|
||||
$out = array();
|
||||
$res = 0;
|
||||
exec(sprintf(Pluf::f('idf_exec_cmd_prefix', '').'ln -s %s %s',
|
||||
escapeshellarg($p),
|
||||
escapeshellarg($fullpath.'/hooks/post-update')),
|
||||
escapeshellarg($post_update_hook)),
|
||||
$out, $res);
|
||||
if ($res != 0) {
|
||||
Pluf_Log::warn(array('IDF_Plugin_Git_Serve::initRepository',
|
||||
'post-update hook creation error.',
|
||||
$fullpath.'/hooks/post-update'));
|
||||
$post_update_hook));
|
||||
return;
|
||||
}
|
||||
Pluf_Log::debug(array('IDF_Plugin_Git_Serve::initRepository',
|
||||
|
@@ -27,6 +27,18 @@
|
||||
*/
|
||||
class IDF_Plugin_SyncMonotone
|
||||
{
|
||||
private $old_err_rep = 0;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->old_err_rep = error_reporting(0);
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
error_reporting($this->old_err_rep);
|
||||
}
|
||||
|
||||
/**
|
||||
* Entry point of the plugin.
|
||||
*/
|
||||
@@ -80,24 +92,33 @@ class IDF_Plugin_SyncMonotone
|
||||
return;
|
||||
}
|
||||
|
||||
// This guard cleans up on any kind of error, and here is how it works:
|
||||
// As long as the guard is not committed, it keeps a reference to
|
||||
// the given project. When the guard is destroyed and the reference
|
||||
// is still present, it deletes the object. The deletion indirectly
|
||||
// also calls into this plugin again, as the project delete hook
|
||||
// will be called, that removes any changes we've made during the
|
||||
// process.
|
||||
$projectGuard = new IDF_Plugin_SyncMonotone_ModelGuard($project);
|
||||
|
||||
$projecttempl = Pluf::f('mtn_repositories', false);
|
||||
if ($projecttempl === false) {
|
||||
throw new IDF_Scm_Exception(
|
||||
__('"mtn_repositories" must be defined in your configuration file.')
|
||||
$this->_diagnoseProblem(
|
||||
__('"mtn_repositories" must be defined in your configuration file')
|
||||
);
|
||||
}
|
||||
|
||||
$usher_config = Pluf::f('mtn_usher_conf', false);
|
||||
if (!$usher_config || !is_writable($usher_config)) {
|
||||
throw new IDF_Scm_Exception(
|
||||
__('"mtn_usher_conf" does not exist or is not writable.')
|
||||
$this->_diagnoseProblem(
|
||||
__('"mtn_usher_conf" does not exist or is not writable')
|
||||
);
|
||||
}
|
||||
|
||||
$mtnpostpush = realpath(dirname(__FILE__) . '/../../../scripts/mtn-post-push');
|
||||
if (!file_exists($mtnpostpush)) {
|
||||
throw new IDF_Scm_Exception(sprintf(
|
||||
__('Could not find mtn-post-push script "%s".'), $mtnpostpush
|
||||
$this->_diagnoseProblem(sprintf(
|
||||
__('Could not find mtn-post-push script "%s"'), $mtnpostpush
|
||||
));
|
||||
}
|
||||
|
||||
@@ -110,13 +131,12 @@ class IDF_Plugin_SyncMonotone
|
||||
'monotonerc.in',
|
||||
'remote-automate-permissions.in',
|
||||
'hooks.d/',
|
||||
// this is linked and not copied to be able to update
|
||||
// the list of read-only commands on upgrades
|
||||
'hooks.d/indefero_authorize_remote_automate.conf',
|
||||
'hooks.d/indefero_authorize_remote_automate.lua',
|
||||
'hooks.d/indefero_post_push.conf.in',
|
||||
'hooks.d/indefero_post_push.lua',
|
||||
);
|
||||
// enable remote command execution of read-only commands
|
||||
// only for public projects
|
||||
if (!$project->private) {
|
||||
// this is linked and not copied to be able to update
|
||||
// the list of read-only commands on upgrades
|
||||
@@ -131,8 +151,8 @@ class IDF_Plugin_SyncMonotone
|
||||
}
|
||||
foreach ($confdir_contents as $content) {
|
||||
if (!file_exists($confdir.$content)) {
|
||||
throw new IDF_Scm_Exception(sprintf(
|
||||
__('The configuration file %s is missing.'), $content
|
||||
$this->_diagnoseProblem(sprintf(
|
||||
__('The configuration file "%s" is missing'), $content
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -140,14 +160,15 @@ class IDF_Plugin_SyncMonotone
|
||||
$shortname = $project->shortname;
|
||||
$projectpath = sprintf($projecttempl, $shortname);
|
||||
if (file_exists($projectpath)) {
|
||||
throw new IDF_Scm_Exception(sprintf(
|
||||
__('The project path %s already exists.'), $projectpath
|
||||
$this->_diagnoseProblem(sprintf(
|
||||
__('The project path "%s" already exists'), $projectpath
|
||||
));
|
||||
}
|
||||
|
||||
if (!mkdir($projectpath)) {
|
||||
throw new IDF_Scm_Exception(sprintf(
|
||||
__('The project path %s could not be created.'), $projectpath
|
||||
if (!@mkdir($projectpath)) {
|
||||
$this->_diagnoseProblem(sprintf(
|
||||
__('The project path "%s" could not be created'),
|
||||
$projectpath
|
||||
));
|
||||
}
|
||||
|
||||
@@ -156,7 +177,7 @@ class IDF_Plugin_SyncMonotone
|
||||
//
|
||||
$dbfile = $projectpath.'/database.mtn';
|
||||
$cmd = sprintf('db init -d %s', escapeshellarg($dbfile));
|
||||
self::_mtn_exec($cmd);
|
||||
$this->_mtn_exec($cmd);
|
||||
|
||||
//
|
||||
// step 2) create a server key
|
||||
@@ -175,16 +196,17 @@ class IDF_Plugin_SyncMonotone
|
||||
escapeshellarg($projectpath),
|
||||
escapeshellarg($serverkey)
|
||||
);
|
||||
self::_mtn_exec($cmd);
|
||||
$this->_mtn_exec($cmd);
|
||||
|
||||
//
|
||||
// step 3) create a client key, and save it in IDF
|
||||
//
|
||||
$keydir = Pluf::f('tmp_folder').'/mtn-client-keys';
|
||||
if (!file_exists($keydir)) {
|
||||
if (!mkdir($keydir)) {
|
||||
throw new IDF_Scm_Exception(sprintf(
|
||||
__('The key directory %s could not be created.'), $keydir
|
||||
if (!@mkdir($keydir)) {
|
||||
$this->_diagnoseProblem(sprintf(
|
||||
__('The key directory "%s" could not be created'),
|
||||
$keydir
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -194,14 +216,14 @@ class IDF_Plugin_SyncMonotone
|
||||
escapeshellarg($keydir),
|
||||
escapeshellarg($clientkey_name)
|
||||
);
|
||||
$keyinfo = self::_mtn_exec($cmd);
|
||||
$keyinfo = $this->_mtn_exec($cmd);
|
||||
|
||||
$parsed_keyinfo = array();
|
||||
try {
|
||||
$parsed_keyinfo = IDF_Scm_Monotone_BasicIO::parse($keyinfo);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
throw new IDF_Scm_Exception(sprintf(
|
||||
$this->_diagnoseProblem(sprintf(
|
||||
__('Could not parse key information: %s'), $e->getMessage()
|
||||
));
|
||||
}
|
||||
@@ -219,13 +241,13 @@ class IDF_Plugin_SyncMonotone
|
||||
escapeshellarg($keydir),
|
||||
escapeshellarg($clientkey_hash)
|
||||
);
|
||||
$clientkey_pubdata = self::_mtn_exec($cmd);
|
||||
$clientkey_pubdata = $this->_mtn_exec($cmd);
|
||||
|
||||
$cmd = sprintf('au put_public_key --db=%s %s',
|
||||
escapeshellarg($dbfile),
|
||||
escapeshellarg($clientkey_pubdata)
|
||||
);
|
||||
self::_mtn_exec($cmd);
|
||||
$this->_mtn_exec($cmd);
|
||||
|
||||
//
|
||||
// step 4) setup the configuration
|
||||
@@ -238,18 +260,20 @@ class IDF_Plugin_SyncMonotone
|
||||
foreach ($confdir_contents as $content) {
|
||||
$filepath = $projectpath.'/'.$content;
|
||||
if (substr($content, -1) == '/') {
|
||||
if (!mkdir($filepath)) {
|
||||
throw new IDF_Scm_Exception(sprintf(
|
||||
__('Could not create configuration directory "%s"'), $filepath
|
||||
if (!@mkdir($filepath)) {
|
||||
$this->_diagnoseProblem(sprintf(
|
||||
__('Could not create configuration directory "%s"'),
|
||||
$filepath
|
||||
));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (substr($content, -3) != '.in') {
|
||||
if (!symlink($confdir.$content, $filepath)) {
|
||||
IDF_Scm_Exception(sprintf(
|
||||
__('Could not create symlink "%s"'), $filepath
|
||||
if (!@symlink($confdir.$content, $filepath)) {
|
||||
$this->_diagnoseProblem(sprintf(
|
||||
__('Could not create symlink for configuration file "%s"'),
|
||||
$filepath
|
||||
));
|
||||
}
|
||||
continue;
|
||||
@@ -264,9 +288,10 @@ class IDF_Plugin_SyncMonotone
|
||||
|
||||
// remove the .in
|
||||
$filepath = substr($filepath, 0, -3);
|
||||
if (file_put_contents($filepath, $filecontents, LOCK_EX) === false) {
|
||||
throw new IDF_Scm_Exception(sprintf(
|
||||
__('Could not write configuration file "%s"'), $filepath
|
||||
if (@file_put_contents($filepath, $filecontents, LOCK_EX) === false) {
|
||||
$this->_diagnoseProblem(sprintf(
|
||||
__('Could not write configuration file "%s"'),
|
||||
$filepath
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -280,8 +305,8 @@ class IDF_Plugin_SyncMonotone
|
||||
$parsed_config = IDF_Scm_Monotone_BasicIO::parse($usher_rc);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
throw new IDF_Scm_Exception(sprintf(
|
||||
__('Could not parse usher configuration in "%s": %s'),
|
||||
$this->_diagnoseProblem(sprintf(
|
||||
__('Could not parse usher configuration in "%1$s": %2$s'),
|
||||
$usher_config, $e->getMessage()
|
||||
));
|
||||
}
|
||||
@@ -291,7 +316,7 @@ class IDF_Plugin_SyncMonotone
|
||||
foreach ($stanzas as $stanza_line) {
|
||||
if ($stanza_line['key'] == 'server' &&
|
||||
$stanza_line['values'][0] == $shortname) {
|
||||
throw new IDF_Scm_Exception(sprintf(
|
||||
$this->_diagnoseProblem(sprintf(
|
||||
__('usher configuration already contains a server '.
|
||||
'entry named "%s"'),
|
||||
$shortname
|
||||
@@ -315,9 +340,10 @@ class IDF_Plugin_SyncMonotone
|
||||
|
||||
// FIXME: more sanity - what happens on failing writes? we do not
|
||||
// have a backup copy of usher.conf around...
|
||||
if (file_put_contents($usher_config, $usher_rc, LOCK_EX) === false) {
|
||||
throw new IDF_Scm_Exception(sprintf(
|
||||
__('Could not write usher configuration file "%s"'), $usher_config
|
||||
if (@file_put_contents($usher_config, $usher_rc, LOCK_EX) === false) {
|
||||
$this->_diagnoseProblem(sprintf(
|
||||
__('Could not write usher configuration file "%s"'),
|
||||
$usher_config
|
||||
));
|
||||
}
|
||||
|
||||
@@ -325,6 +351,9 @@ class IDF_Plugin_SyncMonotone
|
||||
// step 6) reload usher to pick up the new configuration
|
||||
//
|
||||
IDF_Scm_Monotone_Usher::reload();
|
||||
|
||||
// commit the guard, so the newly created project is not deleted
|
||||
$projectGuard->commit();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -345,8 +374,8 @@ class IDF_Plugin_SyncMonotone
|
||||
$mtn = IDF_Scm_Monotone::factory($project);
|
||||
$stdio = $mtn->getStdio();
|
||||
|
||||
$projectpath = self::_get_project_path($project);
|
||||
$auth_ids = self::_get_authorized_user_ids($project);
|
||||
$projectpath = $this->_get_project_path($project);
|
||||
$auth_ids = $this->_get_authorized_user_ids($project);
|
||||
$key_ids = array();
|
||||
foreach ($auth_ids as $auth_id) {
|
||||
$sql = new Pluf_SQL('user=%s', array($auth_id));
|
||||
@@ -361,9 +390,10 @@ class IDF_Plugin_SyncMonotone
|
||||
|
||||
$write_permissions = implode("\n", $key_ids);
|
||||
$rcfile = $projectpath.'/write-permissions';
|
||||
if (file_put_contents($rcfile, $write_permissions, LOCK_EX) === false) {
|
||||
throw new IDF_Scm_Exception(sprintf(
|
||||
__('Could not write write-permissions file "%s"'), $rcfile
|
||||
if (@file_put_contents($rcfile, $write_permissions, LOCK_EX) === false) {
|
||||
$this->_diagnoseProblem(sprintf(
|
||||
__('Could not write write-permissions file "%s"'),
|
||||
$rcfile
|
||||
));
|
||||
}
|
||||
|
||||
@@ -382,11 +412,13 @@ class IDF_Plugin_SyncMonotone
|
||||
array('key' => 'allow', 'values' => array('*')),
|
||||
);
|
||||
}
|
||||
|
||||
$read_permissions = IDF_Scm_Monotone_BasicIO::compile(array($stanza));
|
||||
$rcfile = $projectpath.'/read-permissions';
|
||||
if (file_put_contents($rcfile, $read_permissions, LOCK_EX) === false) {
|
||||
throw new IDF_Scm_Exception(sprintf(
|
||||
__('Could not write read-permissions file "%s"'), $rcfile
|
||||
if (@file_put_contents($rcfile, $read_permissions, LOCK_EX) === false) {
|
||||
$this->_diagnoseProblem(sprintf(
|
||||
__('Could not write read-permissions file "%s"'),
|
||||
$rcfile
|
||||
));
|
||||
}
|
||||
|
||||
@@ -401,16 +433,16 @@ class IDF_Plugin_SyncMonotone
|
||||
|
||||
$serverRestartRequired = false;
|
||||
if ($project->private && file_exists($projectfile) && is_link($projectfile)) {
|
||||
if (!unlink($projectfile)) {
|
||||
IDF_Scm_Exception(sprintf(
|
||||
if (!@unlink($projectfile)) {
|
||||
$this->_diagnoseProblem(sprintf(
|
||||
__('Could not remove symlink "%s"'), $projectfile
|
||||
));
|
||||
}
|
||||
$serverRestartRequired = true;
|
||||
} else
|
||||
if (!$project->private && !file_exists($projectfile)) {
|
||||
if (!symlink($templatefile, $projectfile)) {
|
||||
throw new IDF_Scm_Exception(sprintf(
|
||||
if (!@symlink($templatefile, $projectfile)) {
|
||||
$this->_diagnoseProblem(sprintf(
|
||||
__('Could not create symlink "%s"'), $projectfile
|
||||
));
|
||||
}
|
||||
@@ -422,6 +454,9 @@ class IDF_Plugin_SyncMonotone
|
||||
// seems to be ignored when the server should be started
|
||||
// again immediately afterwards
|
||||
IDF_Scm_Monotone_Usher::killServer($project->shortname);
|
||||
// give usher some time to cool down, otherwise it might hang
|
||||
// (see https://code.monotone.ca/p/contrib/issues/175/)
|
||||
sleep(2);
|
||||
IDF_Scm_Monotone_Usher::startServer($project->shortname);
|
||||
}
|
||||
}
|
||||
@@ -443,8 +478,8 @@ class IDF_Plugin_SyncMonotone
|
||||
|
||||
$usher_config = Pluf::f('mtn_usher_conf', false);
|
||||
if (!$usher_config || !is_writable($usher_config)) {
|
||||
throw new IDF_Scm_Exception(
|
||||
__('"mtn_usher_conf" does not exist or is not writable.')
|
||||
$this->_diagnoseProblem(
|
||||
__('"mtn_usher_conf" does not exist or is not writable')
|
||||
);
|
||||
}
|
||||
|
||||
@@ -453,16 +488,16 @@ class IDF_Plugin_SyncMonotone
|
||||
|
||||
$projecttempl = Pluf::f('mtn_repositories', false);
|
||||
if ($projecttempl === false) {
|
||||
throw new IDF_Scm_Exception(
|
||||
__('"mtn_repositories" must be defined in your configuration file.')
|
||||
$this->_diagnoseProblem(
|
||||
__('"mtn_repositories" must be defined in your configuration file')
|
||||
);
|
||||
}
|
||||
|
||||
$projectpath = sprintf($projecttempl, $shortname);
|
||||
if (file_exists($projectpath)) {
|
||||
if (!self::_delete_recursive($projectpath)) {
|
||||
throw new IDF_Scm_Exception(sprintf(
|
||||
__('One or more paths underknees %s could not be deleted.'), $projectpath
|
||||
if (!$this->_delete_recursive($projectpath)) {
|
||||
$this->_diagnoseProblem(sprintf(
|
||||
__('One or more paths underneath %s could not be deleted'), $projectpath
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -473,8 +508,9 @@ class IDF_Plugin_SyncMonotone
|
||||
if ($keyname && $keyhash &&
|
||||
file_exists($keydir .'/'. $keyname . '.' . $keyhash)) {
|
||||
if (!@unlink($keydir .'/'. $keyname . '.' . $keyhash)) {
|
||||
throw new IDF_Scm_Exception(sprintf(
|
||||
__('Could not delete client private key %s'), $keyname
|
||||
$this->_diagnoseProblem(sprintf(
|
||||
__('Could not delete client private key "%s"'),
|
||||
$keyname
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -485,8 +521,8 @@ class IDF_Plugin_SyncMonotone
|
||||
$parsed_config = IDF_Scm_Monotone_BasicIO::parse($usher_rc);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
throw new IDF_Scm_Exception(sprintf(
|
||||
__('Could not parse usher configuration in "%s": %s'),
|
||||
$this->_diagnoseProblem(sprintf(
|
||||
__('Could not parse usher configuration in "%1$s": %2$s'),
|
||||
$usher_config, $e->getMessage()
|
||||
));
|
||||
}
|
||||
@@ -505,9 +541,10 @@ class IDF_Plugin_SyncMonotone
|
||||
|
||||
// FIXME: more sanity - what happens on failing writes? we do not
|
||||
// have a backup copy of usher.conf around...
|
||||
if (file_put_contents($usher_config, $usher_rc, LOCK_EX) === false) {
|
||||
throw new IDF_Scm_Exception(sprintf(
|
||||
__('Could not write usher configuration file "%s"'), $usher_config
|
||||
if (@file_put_contents($usher_config, $usher_rc, LOCK_EX) === false) {
|
||||
$this->_diagnoseProblem(sprintf(
|
||||
__('Could not write usher configuration file "%s"'),
|
||||
$usher_config
|
||||
));
|
||||
}
|
||||
|
||||
@@ -528,6 +565,8 @@ class IDF_Plugin_SyncMonotone
|
||||
return;
|
||||
}
|
||||
|
||||
$keyGuard = new IDF_Plugin_SyncMonotone_ModelGuard($key);
|
||||
|
||||
foreach (Pluf::factory('IDF_Project')->getList() as $project) {
|
||||
$conf = new IDF_Conf();
|
||||
$conf->setProject($project);
|
||||
@@ -535,8 +574,8 @@ class IDF_Plugin_SyncMonotone
|
||||
if ($scm != 'mtn')
|
||||
continue;
|
||||
|
||||
$projectpath = self::_get_project_path($project);
|
||||
$auth_ids = self::_get_authorized_user_ids($project);
|
||||
$projectpath = $this->_get_project_path($project);
|
||||
$auth_ids = $this->_get_authorized_user_ids($project);
|
||||
if (!in_array($key->user, $auth_ids))
|
||||
continue;
|
||||
|
||||
@@ -556,8 +595,8 @@ class IDF_Plugin_SyncMonotone
|
||||
$parsed_read_perms = IDF_Scm_Monotone_BasicIO::parse($read_perms);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
throw new IDF_Scm_Exception(sprintf(
|
||||
__('Could not parse read-permissions for project "%s": %s'),
|
||||
$this->_diagnoseProblem(sprintf(
|
||||
__('Could not parse read-permissions for project "%1$s": %2$s'),
|
||||
$shortname, $e->getMessage()
|
||||
));
|
||||
}
|
||||
@@ -598,10 +637,11 @@ class IDF_Plugin_SyncMonotone
|
||||
|
||||
$read_perms = IDF_Scm_Monotone_BasicIO::compile($parsed_read_perms);
|
||||
|
||||
if (file_put_contents($projectpath.'/read-permissions',
|
||||
if (@file_put_contents($projectpath.'/read-permissions',
|
||||
$read_perms, LOCK_EX) === false) {
|
||||
throw new IDF_Scm_Exception(sprintf(
|
||||
__('Could not write read-permissions for project "%s"'), $shortname
|
||||
$this->_diagnoseProblem(sprintf(
|
||||
__('Could not write read-permissions for project "%s"'),
|
||||
$shortname
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -611,9 +651,9 @@ class IDF_Plugin_SyncMonotone
|
||||
if (!in_array('*', $lines) && !in_array($mtn_key_id, $lines)) {
|
||||
$lines[] = $mtn_key_id;
|
||||
}
|
||||
if (file_put_contents($projectpath.'/write-permissions',
|
||||
if (@file_put_contents($projectpath.'/write-permissions',
|
||||
implode("\n", $lines) . "\n", LOCK_EX) === false) {
|
||||
throw new IDF_Scm_Exception(sprintf(
|
||||
$this->_diagnoseProblem(sprintf(
|
||||
__('Could not write write-permissions file for project "%s"'),
|
||||
$shortname
|
||||
));
|
||||
@@ -623,6 +663,8 @@ class IDF_Plugin_SyncMonotone
|
||||
$stdio = $mtn->getStdio();
|
||||
$stdio->exec(array('put_public_key', $key->content));
|
||||
}
|
||||
|
||||
$keyGuard->commit();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -651,8 +693,8 @@ class IDF_Plugin_SyncMonotone
|
||||
if ($scm != 'mtn')
|
||||
continue;
|
||||
|
||||
$projectpath = self::_get_project_path($project);
|
||||
$auth_ids = self::_get_authorized_user_ids($project);
|
||||
$projectpath = $this->_get_project_path($project);
|
||||
$auth_ids = $this->_get_authorized_user_ids($project);
|
||||
if (!in_array($key->user, $auth_ids))
|
||||
continue;
|
||||
|
||||
@@ -672,8 +714,8 @@ class IDF_Plugin_SyncMonotone
|
||||
$parsed_read_perms = IDF_Scm_Monotone_BasicIO::parse($read_perms);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
throw new IDF_Scm_Exception(sprintf(
|
||||
__('Could not parse read-permissions for project "%s": %s'),
|
||||
$this->_diagnoseProblem(sprintf(
|
||||
__('Could not parse read-permissions for project "%1$s": %2$s'),
|
||||
$shortname, $e->getMessage()
|
||||
));
|
||||
}
|
||||
@@ -693,10 +735,11 @@ class IDF_Plugin_SyncMonotone
|
||||
|
||||
$read_perms = IDF_Scm_Monotone_BasicIO::compile($parsed_read_perms);
|
||||
|
||||
if (file_put_contents($projectpath.'/read-permissions',
|
||||
if (@file_put_contents($projectpath.'/read-permissions',
|
||||
$read_perms, LOCK_EX) === false) {
|
||||
throw new IDF_Scm_Exception(sprintf(
|
||||
__('Could not write read-permissions for project "%s"'), $shortname
|
||||
$this->_diagnoseProblem(sprintf(
|
||||
__('Could not write read-permissions for project "%s"'),
|
||||
$shortname
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -711,9 +754,9 @@ class IDF_Plugin_SyncMonotone
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (file_put_contents($projectpath.'/write-permissions',
|
||||
implode("\n", $lines) . "\n", LOCK_EX) === false) {
|
||||
throw new IDF_Scm_Exception(sprintf(
|
||||
if (@file_put_contents($projectpath.'/write-permissions',
|
||||
implode("\n", $lines) . "\n", LOCK_EX) === false) {
|
||||
$this->_diagnoseProblem(sprintf(
|
||||
__('Could not write write-permissions file for project "%s"'),
|
||||
$shortname
|
||||
));
|
||||
@@ -762,7 +805,43 @@ class IDF_Plugin_SyncMonotone
|
||||
));
|
||||
}
|
||||
|
||||
private static function _get_authorized_user_ids($project)
|
||||
private function _get_project_path($project)
|
||||
{
|
||||
$projecttempl = Pluf::f('mtn_repositories', false);
|
||||
if ($projecttempl === false) {
|
||||
$this->_diagnoseProblem(
|
||||
__('"mtn_repositories" must be defined in your configuration file.')
|
||||
);
|
||||
}
|
||||
|
||||
$projectpath = sprintf($projecttempl, $project->shortname);
|
||||
if (!file_exists($projectpath)) {
|
||||
$this->_diagnoseProblem(sprintf(
|
||||
__('The project path %s does not exists.'), $projectpath
|
||||
));
|
||||
}
|
||||
return $projectpath;
|
||||
}
|
||||
|
||||
private function _mtn_exec($cmd)
|
||||
{
|
||||
$fullcmd = sprintf('%s %s %s',
|
||||
Pluf::f('idf_exec_cmd_prefix', ''),
|
||||
Pluf::f('mtn_path', 'mtn'),
|
||||
$cmd
|
||||
);
|
||||
|
||||
$output = $return = null;
|
||||
exec($fullcmd, $output, $return);
|
||||
if ($return != 0) {
|
||||
$this->_diagnoseProblem(sprintf(
|
||||
__('The command "%s" could not be executed.'), $cmd
|
||||
));
|
||||
}
|
||||
return implode("\n", $output);
|
||||
}
|
||||
|
||||
private function _get_authorized_user_ids($project)
|
||||
{
|
||||
$mem = $project->getMembershipData();
|
||||
$members = array_merge((array)$mem['members'],
|
||||
@@ -775,43 +854,7 @@ class IDF_Plugin_SyncMonotone
|
||||
return $userids;
|
||||
}
|
||||
|
||||
private static function _get_project_path($project)
|
||||
{
|
||||
$projecttempl = Pluf::f('mtn_repositories', false);
|
||||
if ($projecttempl === false) {
|
||||
throw new IDF_Scm_Exception(
|
||||
__('"mtn_repositories" must be defined in your configuration file.')
|
||||
);
|
||||
}
|
||||
|
||||
$projectpath = sprintf($projecttempl, $project->shortname);
|
||||
if (!file_exists($projectpath)) {
|
||||
throw new IDF_Scm_Exception(sprintf(
|
||||
__('The project path %s does not exists.'), $projectpath
|
||||
));
|
||||
}
|
||||
return $projectpath;
|
||||
}
|
||||
|
||||
private static function _mtn_exec($cmd)
|
||||
{
|
||||
$fullcmd = sprintf('%s %s %s',
|
||||
Pluf::f('idf_exec_cmd_prefix', ''),
|
||||
Pluf::f('mtn_path', 'mtn'),
|
||||
$cmd
|
||||
);
|
||||
|
||||
$output = $return = null;
|
||||
exec($fullcmd, $output, $return);
|
||||
if ($return != 0) {
|
||||
throw new IDF_Scm_Exception(sprintf(
|
||||
__('The command "%s" could not be executed.'), $cmd
|
||||
));
|
||||
}
|
||||
return implode("\n", $output);
|
||||
}
|
||||
|
||||
private static function _delete_recursive($path)
|
||||
private function _delete_recursive($path)
|
||||
{
|
||||
if (is_file($path) || is_link($path)) {
|
||||
return @unlink($path);
|
||||
@@ -821,10 +864,48 @@ class IDF_Plugin_SyncMonotone
|
||||
$scan = glob(rtrim($path, '/') . '/*');
|
||||
$status = 0;
|
||||
foreach ($scan as $subpath) {
|
||||
$status |= self::_delete_recursive($subpath);
|
||||
$status |= $this->_delete_recursive($subpath);
|
||||
}
|
||||
$status |= rmdir($path);
|
||||
$status |= @rmdir($path);
|
||||
return $status;
|
||||
}
|
||||
}
|
||||
|
||||
private function _diagnoseProblem($msg)
|
||||
{
|
||||
$system_err = error_get_last();
|
||||
if (!empty($system_err)) {
|
||||
$msg .= ': '.$system_err['message'];
|
||||
}
|
||||
|
||||
error_reporting($this->old_err_rep);
|
||||
throw new IDF_Scm_Exception($msg);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A simple helper class that deletes the model instance if
|
||||
* it is not committed
|
||||
*/
|
||||
class IDF_Plugin_SyncMonotone_ModelGuard
|
||||
{
|
||||
private $model;
|
||||
|
||||
public function __construct(Pluf_Model $m)
|
||||
{
|
||||
$this->model = $m;
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
if ($this->model == null)
|
||||
return;
|
||||
$this->model->delete();
|
||||
}
|
||||
|
||||
public function commit()
|
||||
{
|
||||
$this->model = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -67,7 +67,7 @@ class IDF_Project extends Pluf_Model
|
||||
'blank' => false,
|
||||
'size' => 50,
|
||||
'verbose' => __('short name'),
|
||||
'help_text' => __('Used in the url to access the project, must be short with only letters and numbers.'),
|
||||
'help_text' => __('Used in the URL to access the project, must be short with only letters and numbers.'),
|
||||
'unique' => true,
|
||||
),
|
||||
'shortdesc' =>
|
||||
@@ -84,7 +84,7 @@ class IDF_Project extends Pluf_Model
|
||||
'blank' => false,
|
||||
'size' => 250,
|
||||
'verbose' => __('description'),
|
||||
'help_text' => __('The description can be extended using the markdown syntax.'),
|
||||
'help_text' => __('The description can be extended using the Markdown syntax.'),
|
||||
),
|
||||
'private' =>
|
||||
array(
|
||||
@@ -140,7 +140,48 @@ class IDF_Project extends Pluf_Model
|
||||
* @param IDF_Tag Subfilter with a label (null)
|
||||
* @return int Count
|
||||
*/
|
||||
public function getIssueCountByStatus($status='open', $label=null)
|
||||
public function getIssueCountByOwner($status='open')
|
||||
{
|
||||
switch ($status) {
|
||||
case 'open':
|
||||
$tags = implode(',', $this->getTagIdsByStatus('open'));
|
||||
break;
|
||||
case 'closed':
|
||||
default:
|
||||
$tags = implode(',', $this->getTagIdsByStatus('closed'));
|
||||
break;
|
||||
}
|
||||
$sqlIssueTable = Pluf::factory('IDF_Issue')->getSqlTable();
|
||||
$query = "SELECT uid AS id,COUNT(uid) AS nb
|
||||
FROM (
|
||||
SELECT COALESCE(owner, -1) AS uid
|
||||
FROM $sqlIssueTable
|
||||
WHERE status IN ($tags)
|
||||
) AS ff
|
||||
GROUP BY uid";
|
||||
|
||||
$db = Pluf::db();
|
||||
$dbData = $db->select($query);
|
||||
$ownerStatistics = array();
|
||||
foreach ($dbData as $k => $v) {
|
||||
$key = ($v['id'] === '-1') ? null : $v['id'];
|
||||
$ownerStatistics[$key] = (int)$v['nb'];
|
||||
}
|
||||
|
||||
arsort($ownerStatistics);
|
||||
|
||||
return $ownerStatistics;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of open/closed issues.
|
||||
*
|
||||
* @param string Status ('open'), 'closed'
|
||||
* @param IDF_Tag Subfilter with a label (null)
|
||||
* @param array Restrict further to a list of ids
|
||||
* @return int Count
|
||||
*/
|
||||
public function getIssueCountByStatus($status='open', $label=null, $ids=array())
|
||||
{
|
||||
switch ($status) {
|
||||
case 'open':
|
||||
@@ -163,12 +204,48 @@ class IDF_Project extends Pluf_Model
|
||||
$sql2 = new Pluf_SQL('idf_tag_id=%s', array($label->id));
|
||||
$sql->SAnd($sql2);
|
||||
}
|
||||
if (count($ids) > 0) {
|
||||
$sql2 = new Pluf_SQL(sprintf('id IN (%s)', implode(', ', $ids)));
|
||||
$sql->SAnd($sql2);
|
||||
}
|
||||
$params = array('filter' => $sql->gen());
|
||||
if (!is_null($label)) { $params['view'] = 'join_tags'; }
|
||||
$gissue = new IDF_Issue();
|
||||
return $gissue->getCount($params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the tags for a specific list of issues.
|
||||
*
|
||||
* @param string Status ('open') or 'closed'
|
||||
* @param array A list of issue ids
|
||||
* @return array An array of tag objects
|
||||
*/
|
||||
public function getTagsByIssues($issue_ids=array())
|
||||
{
|
||||
// make the below query always a valid one
|
||||
if (count($issue_ids) == 0) $issue_ids[] = 0;
|
||||
|
||||
$assocTable = $this->_con->pfx.'idf_issue_idf_tag_assoc';
|
||||
$query = sprintf(
|
||||
'SELECT DISTINCT idf_tag_id FROM %s '.
|
||||
'WHERE idf_issue_id IN (%s) '.
|
||||
'GROUP BY idf_tag_id',
|
||||
$assocTable, implode(',', $issue_ids)
|
||||
);
|
||||
|
||||
$db = Pluf::db();
|
||||
$dbData = $db->select($query);
|
||||
$ids = array(0);
|
||||
foreach ($dbData as $data) {
|
||||
$ids[] = $data['idf_tag_id'];
|
||||
}
|
||||
|
||||
$sql = new Pluf_SQL(sprintf('id IN (%s)', implode(', ', $ids)));
|
||||
$model = new IDF_Tag();
|
||||
return $model->getList(array('filter' => $sql->gen()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the open/closed tag ids as they are often used when doing
|
||||
* listings.
|
||||
@@ -375,7 +452,11 @@ class IDF_Project extends Pluf_Model
|
||||
foreach ($this->_con->select($sql) as $idc) {
|
||||
$tag = new IDF_Tag($idc['id']);
|
||||
$tag->nb_use = $idc['nb_use'];
|
||||
$tags[] = $tag;
|
||||
// group by class
|
||||
if (!array_key_exists($tag->class, $tags)) {
|
||||
$tags[$tag->class] = array();
|
||||
}
|
||||
$tags[$tag->class][] = $tag;
|
||||
}
|
||||
return new Pluf_Template_ContextVars($tags);
|
||||
}
|
||||
|
@@ -138,7 +138,7 @@ class IDF_Review_Comment extends Pluf_Model
|
||||
$ic = (in_array($review->status, $request->project->getTagIdsByStatus('closed'))) ? 'issue-c' : 'issue-o';
|
||||
$out .= sprintf(__('<a href="%1$s" class="%2$s" title="View review">Review %3$d</a>, %4$s'), $url, $ic, $review->id, Pluf_esc($review->summary)).'</td>';
|
||||
$out .= "\n".'<tr class="extra"><td colspan="2">
|
||||
<div class="helptext right">'.sprintf(__('Update of <a href="%s" class="%s">review %d</a>, by %s'), $url, $ic, $review->id, $user).'</div></td></tr>';
|
||||
<div class="helptext right">'.sprintf(__('Update of <a href="%1$s" class="%2$s">review %3$d</a>, by %4$s'), $url, $ic, $review->id, $user).'</div></td></tr>';
|
||||
return Pluf_Template::markSafe($out);
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ class IDF_Review_Comment extends Pluf_Model
|
||||
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Review::view',
|
||||
array($request->project->shortname,
|
||||
$review->id));
|
||||
$title = sprintf(__('%s: Updated review %d - %s'),
|
||||
$title = sprintf(__('%1$s: Updated review %2$d - %3$s'),
|
||||
Pluf_esc($request->project->name),
|
||||
$review->id, Pluf_esc($review->summary));
|
||||
$url .= '#ic'.$this->id;
|
||||
@@ -213,7 +213,7 @@ class IDF_Review_Comment extends Pluf_Model
|
||||
foreach ($to_email as $email_lang) {
|
||||
Pluf_Translation::loadSetLocale($email_lang[1]);
|
||||
$email = new Pluf_Mail(Pluf::f('from_email'), $email_lang[0],
|
||||
sprintf(__('Updated Code Review %s - %s (%s)'),
|
||||
sprintf(__('Updated Code Review %1$s - %2$s (%3$s)'),
|
||||
$review->id, $review->summary, $prj->shortname));
|
||||
|
||||
$email->addTextMessage($tmpl->render($context));
|
||||
|
@@ -150,7 +150,7 @@ class IDF_Review_Patch extends Pluf_Model
|
||||
$ic = (in_array($review->status, $request->project->getTagIdsByStatus('closed'))) ? 'issue-c' : 'issue-o';
|
||||
$out .= sprintf(__('<a href="%1$s" class="%2$s" title="View review">Review %3$d</a>, %4$s'), $url, $ic, $review->id, Pluf_esc($review->summary)).'</td>';
|
||||
$out .= "\n".'<tr class="extra"><td colspan="2">
|
||||
<div class="helptext right">'.sprintf(__('Creation of <a href="%s" class="%s">review %d</a>, by %s'), $url, $ic, $review->id, $user).'</div></td></tr>';
|
||||
<div class="helptext right">'.sprintf(__('Creation of <a href="%1$s" class="%2$s">review %3$d</a>, by %4$s'), $url, $ic, $review->id, $user).'</div></td></tr>';
|
||||
return Pluf_Template::markSafe($out);
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ class IDF_Review_Patch extends Pluf_Model
|
||||
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Review::view',
|
||||
array($request->project->shortname,
|
||||
$review->id));
|
||||
$title = sprintf(__('%s: Creation of Review %d - %s'),
|
||||
$title = sprintf(__('%1$s: Creation of Review %2$d - %3$s'),
|
||||
Pluf_esc($request->project->name),
|
||||
$review->id, Pluf_esc($review->summary));
|
||||
$date = Pluf_Date::gmDateToGmString($this->creation_dtime);
|
||||
@@ -201,7 +201,7 @@ class IDF_Review_Patch extends Pluf_Model
|
||||
foreach ($addresses as $address) {
|
||||
$email = new Pluf_Mail(Pluf::f('from_email'),
|
||||
$address,
|
||||
sprintf(__('New Code Review %s - %s (%s)'),
|
||||
sprintf(__('New Code Review %1$s - %2$s (%3$s)'),
|
||||
$this->get_review()->id,
|
||||
$this->get_review()->summary,
|
||||
$this->get_review()->get_project()->shortname));
|
||||
|
@@ -88,22 +88,36 @@ class IDF_Scm
|
||||
}
|
||||
|
||||
/**
|
||||
* Run exec and log some information.
|
||||
* Runs the given command and log some information.
|
||||
*
|
||||
* A previous version used plain exec(), but this should not be used
|
||||
* for various reasons, one being that this command does not preserve
|
||||
* trailing whitespace, which is essential for proper diff parsing.
|
||||
*
|
||||
* @param $caller Calling method
|
||||
* @param $cmd Command to run
|
||||
* @param &$out Array of output
|
||||
* @param &$return Return value
|
||||
* @return string Last line of the command
|
||||
*/
|
||||
public static function exec($caller, $cmd, &$out=null, &$return=null)
|
||||
{
|
||||
$return = -1;
|
||||
Pluf_Log::stime('timer');
|
||||
$ret = exec($cmd, $out, $return);
|
||||
$fp = popen($cmd, 'r');
|
||||
$buf = '';
|
||||
if ($fp !== false) {
|
||||
while (!feof($fp)) {
|
||||
$buf .= fread($fp, 1024);
|
||||
}
|
||||
$return = pclose($fp);
|
||||
}
|
||||
$out = preg_split('/\r\n|\r|\n/', $buf);
|
||||
$elem = count($out);
|
||||
if ($elem > 0 && $out[$elem-1] === '')
|
||||
unset($out[$elem-1]);
|
||||
Pluf_Log::perf(array($caller, $cmd, Pluf_Log::etime('timer', 'total_exec')));
|
||||
Pluf_Log::debug(array($caller, $cmd, $out));
|
||||
Pluf_Log::inc('exec_calls');
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -325,7 +339,8 @@ class IDF_Scm
|
||||
* stdClass object {
|
||||
* 'additions' => array('path/to/file', 'path/to/directory', ...),
|
||||
* 'deletions' => array('path/to/file', 'path/to/directory', ...),
|
||||
* 'renames' => array('old/path/to/file' => 'new/path/to/file', ...)
|
||||
* 'renames' => array('old/path/to/file' => 'new/path/to/file', ...),
|
||||
* 'copies' => array('path/to/source' => 'path/to/target', ...),
|
||||
* 'patches' => array('path/to/file', ...),
|
||||
* 'properties' => array('path/to/file' => array(
|
||||
* 'propname' => 'propvalue', 'deletedprop' => null, ...)
|
||||
|
@@ -67,6 +67,7 @@ class IDF_Scm_Git extends IDF_Scm
|
||||
'additions' => array(),
|
||||
'deletions' => array(),
|
||||
'renames' => array(),
|
||||
'copies' => array(),
|
||||
'patches' => array(),
|
||||
'properties' => array(),
|
||||
);
|
||||
@@ -86,7 +87,7 @@ class IDF_Scm_Git extends IDF_Scm
|
||||
$filename = trim(substr($line, 1));
|
||||
$return->patches[] = $filename;
|
||||
} else if ($action == 'R') {
|
||||
$matches = split ("\t", $line);
|
||||
$matches = preg_split("/\t/", $line);
|
||||
$return->renames[$matches[1]] = $matches[2];
|
||||
}
|
||||
}
|
||||
@@ -209,7 +210,7 @@ class IDF_Scm_Git extends IDF_Scm
|
||||
return $this->cache['tags'];
|
||||
}
|
||||
$cmd = Pluf::f('idf_exec_cmd_prefix', '')
|
||||
.sprintf('GIT_DIR=%s %s for-each-ref --format="%%(taggerdate:iso)%%(committerdate:iso) %%(objectname) %%(refname)" refs/tags',
|
||||
.sprintf('GIT_DIR=%s %s for-each-ref --format="%%(objectname) %%(refname)" refs/tags',
|
||||
escapeshellarg($this->repo),
|
||||
Pluf::f('git_path', 'git'));
|
||||
self::exec('IDF_Scm_Git::getTags', $cmd, $out, $return);
|
||||
@@ -218,18 +219,15 @@ class IDF_Scm_Git extends IDF_Scm
|
||||
$cmd, $return,
|
||||
implode("\n", $out)));
|
||||
}
|
||||
rsort($out);
|
||||
$res = array();
|
||||
foreach ($out as $b) {
|
||||
$elts = explode(' ', $b, 5);
|
||||
$tag = substr(trim($elts[4]), 10);
|
||||
if (false !== strpos($tag, '/')) {
|
||||
$res[$elts[3]] = $b;
|
||||
} else {
|
||||
$res[$tag] = '';
|
||||
}
|
||||
$elts = explode(' ', $b, 2);
|
||||
$tag = substr(trim($elts[1]), 10); // Remove refs/tags/ prefix
|
||||
$res[$tag] = '';
|
||||
}
|
||||
krsort($res);
|
||||
$this->cache['tags'] = $res;
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
@@ -348,6 +346,14 @@ class IDF_Scm_Git extends IDF_Scm
|
||||
if (!preg_match('/<(.*)>/', $author, $match)) {
|
||||
return null;
|
||||
}
|
||||
// FIXME: newer git versions know a i18n.commitencoding setting which
|
||||
// leads to another header, "encoding", with which we _could_ try to
|
||||
// decode the string into utf8. Unfortunately this does not always
|
||||
// work, especially not in older repos, so we would then still have
|
||||
// to supply some fallback.
|
||||
if (!mb_check_encoding($match[1], 'UTF-8')) {
|
||||
return null;
|
||||
}
|
||||
$sql = new Pluf_SQL('login=%s', array($match[1]));
|
||||
$users = Pluf::factory('Pluf_User')->getList(array('filter'=>$sql->gen()));
|
||||
if ($users->count() > 0) {
|
||||
@@ -501,33 +507,27 @@ class IDF_Scm_Git extends IDF_Scm
|
||||
"'".$this->mediumtree_fmt."'",
|
||||
escapeshellarg($commit));
|
||||
}
|
||||
$out = array();
|
||||
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
|
||||
self::exec('IDF_Scm_Git::getCommit', $cmd, $out, $ret);
|
||||
if ($ret != 0 or count($out) == 0) {
|
||||
$out = self::shell_exec('IDF_Scm_Git::getCommit', $cmd);
|
||||
if (strlen($out) == 0) {
|
||||
return false;
|
||||
}
|
||||
if ($getdiff) {
|
||||
$log = array();
|
||||
$change = array();
|
||||
$inchange = false;
|
||||
foreach ($out as $line) {
|
||||
if (!$inchange and 0 === strpos($line, 'diff --git a')) {
|
||||
$inchange = true;
|
||||
}
|
||||
if ($inchange) {
|
||||
$change[] = $line;
|
||||
} else {
|
||||
$log[] = $line;
|
||||
}
|
||||
}
|
||||
$out = self::parseLog($log);
|
||||
$out[0]->diff = implode("\n", $change);
|
||||
} else {
|
||||
$out = self::parseLog($out);
|
||||
$out[0]->diff = '';
|
||||
|
||||
$diffStart = false;
|
||||
if (preg_match('/^diff (?:--git a|--cc)/m', $out, $m, PREG_OFFSET_CAPTURE)) {
|
||||
$diffStart = $m[0][1];
|
||||
}
|
||||
|
||||
$diff = '';
|
||||
if ($diffStart !== false) {
|
||||
$log = substr($out, 0, $diffStart);
|
||||
$diff = substr($out, $diffStart);
|
||||
} else {
|
||||
$log = $out;
|
||||
}
|
||||
|
||||
$out = self::parseLog(preg_split('/\r\n|\n/', $log));
|
||||
$out[0]->diff = $diff;
|
||||
$out[0]->branch = implode(', ', $this->inBranches($out[0]->commit, null));
|
||||
return $out[0];
|
||||
}
|
||||
@@ -640,7 +640,11 @@ class IDF_Scm_Git extends IDF_Scm
|
||||
$c['full_message'] = IDF_Commit::toUTF8($c['full_message']);
|
||||
$c['title'] = IDF_Commit::toUTF8($c['title']);
|
||||
if (isset($c['parents'])) {
|
||||
$c['parents'] = explode(' ', trim($c['parents']));
|
||||
$c['parents'] = preg_split('/ /', trim($c['parents']), -1, PREG_SPLIT_NO_EMPTY);
|
||||
} else {
|
||||
// this is actually an error state because we should _always_
|
||||
// be able to parse the parents line with every git version
|
||||
$c['parents'] = null;
|
||||
}
|
||||
$res[] = (object) $c;
|
||||
return $res;
|
||||
|
@@ -22,19 +22,77 @@
|
||||
# ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/**
|
||||
* Mercurial utils.
|
||||
* A simple RAII helper that manages style files to format hg's log output
|
||||
*/
|
||||
class IDF_Scm_Mercurial_LogStyle
|
||||
{
|
||||
const FULL_LOG = 1;
|
||||
const CHANGES = 2;
|
||||
|
||||
public function __construct($type)
|
||||
{
|
||||
$this->file = tempnam(Pluf::f('tmp_folder'), 'hg-log-style-');
|
||||
|
||||
if ($type == self::FULL_LOG) {
|
||||
$style = 'changeset = "'
|
||||
. 'changeset: {node|short}\n'
|
||||
. 'branch: {branch}\n'
|
||||
. 'author: {author}\n'
|
||||
. 'date: {date|isodate}\n'
|
||||
. 'parents: {parents}\n\n'
|
||||
. '{desc}\n'
|
||||
. '\0\n"'
|
||||
. "\n"
|
||||
. 'parent = "{node|short} "'
|
||||
. "\n";
|
||||
} elseif ($type == self::CHANGES) {
|
||||
$style = 'changeset = "'
|
||||
. 'file_mods: {file_mods}\n'
|
||||
. 'file_adds: {file_adds}\n'
|
||||
. 'file_dels: {file_dels}\n'
|
||||
. 'file_copies: {file_copies}\n\n'
|
||||
. '\0\n"'
|
||||
. "\n"
|
||||
. 'file_mod = "{file_mod}\0"'
|
||||
. "\n"
|
||||
. 'file_add = "{file_add}\0"'
|
||||
. "\n"
|
||||
. 'file_del = "{file_del}\0"'
|
||||
. "\n"
|
||||
. 'file_copy = "{source}\0{name}\0"'
|
||||
. "\n";
|
||||
} else {
|
||||
throw new IDF_Scm_Exception('invalid type ' . $type);
|
||||
}
|
||||
|
||||
file_put_contents($this->file, $style);
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
@unlink($this->file);
|
||||
}
|
||||
|
||||
public function get()
|
||||
{
|
||||
return $this->file;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Main SCM class for Mercurial
|
||||
*
|
||||
* Note: Some commands take a --debug option, this is not lousy coding, but
|
||||
* totally wanted, as hg returns additional / different data in this
|
||||
* mode on which this largely depends.
|
||||
*/
|
||||
class IDF_Scm_Mercurial extends IDF_Scm
|
||||
{
|
||||
protected $hg_log_template;
|
||||
|
||||
public function __construct($repo, $project=null)
|
||||
{
|
||||
$this->repo = $repo;
|
||||
$this->project = $project;
|
||||
$this->hg_log_template = "'".'changeset: {rev}:{node|short}\nauthor: {author}\ndate: {date|isodate}\nfiles: {files}\n{desc}\n'."'";
|
||||
}
|
||||
}
|
||||
|
||||
public function getRepositorySize()
|
||||
{
|
||||
@@ -158,7 +216,8 @@ class IDF_Scm_Mercurial extends IDF_Scm
|
||||
throw new Exception(sprintf(__('Not a valid tree: %s.'), $tree));
|
||||
}
|
||||
$cmd_tmpl = Pluf::f('hg_path', 'hg').' manifest -R %s --debug -r %s';
|
||||
$cmd = sprintf($cmd_tmpl, escapeshellarg($this->repo), $tree, ($recurse) ? '' : '');
|
||||
$cmd = sprintf($cmd_tmpl, escapeshellarg($this->repo),
|
||||
escapeshellarg($tree));
|
||||
$out = array();
|
||||
$res = array();
|
||||
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
|
||||
@@ -208,7 +267,8 @@ class IDF_Scm_Mercurial extends IDF_Scm
|
||||
public function getPathInfo($totest, $commit='tip')
|
||||
{
|
||||
$cmd_tmpl = Pluf::f('hg_path', 'hg').' manifest -R %s --debug -r %s';
|
||||
$cmd = sprintf($cmd_tmpl, escapeshellarg($this->repo), $commit);
|
||||
$cmd = sprintf($cmd_tmpl, escapeshellarg($this->repo),
|
||||
escapeshellarg($commit));
|
||||
$out = array();
|
||||
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
|
||||
self::exec('IDF_Scm_Mercurial::getPathInfo', $cmd, $out);
|
||||
@@ -284,7 +344,7 @@ class IDF_Scm_Mercurial extends IDF_Scm
|
||||
self::exec('IDF_Scm_Mercurial::getBranches', $cmd, $out);
|
||||
$res = array();
|
||||
foreach ($out as $b) {
|
||||
preg_match('/(\S+).*\S+:(\S+)/', $b, $match);
|
||||
preg_match('/(.+?)\s+\S+:(\S+)/', $b, $match);
|
||||
$res[$match[1]] = '';
|
||||
}
|
||||
$this->cache['branches'] = $res;
|
||||
@@ -308,7 +368,7 @@ class IDF_Scm_Mercurial extends IDF_Scm
|
||||
self::exec('IDF_Scm_Mercurial::getTags', $cmd, $out);
|
||||
$res = array();
|
||||
foreach ($out as $b) {
|
||||
preg_match('/(\S+).*\S+:(\S+)/', $b, $match);
|
||||
preg_match('/(.+?)\s+\S+:(\S+)/', $b, $match);
|
||||
$res[$match[1]] = '';
|
||||
}
|
||||
$this->cache['tags'] = $res;
|
||||
@@ -339,33 +399,92 @@ class IDF_Scm_Mercurial extends IDF_Scm
|
||||
if ($this->validateRevision($commit) != IDF_Scm::REVISION_VALID) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$logStyle = new IDF_Scm_Mercurial_LogStyle(IDF_Scm_Mercurial_LogStyle::FULL_LOG);
|
||||
$tmpl = ($getdiff)
|
||||
? Pluf::f('hg_path', 'hg').' log -p -r %s -R %s --template %s'
|
||||
: Pluf::f('hg_path', 'hg').' log -r %s -R %s --template %s';
|
||||
? Pluf::f('hg_path', 'hg').' log --debug -p -r %s -R %s --style %s'
|
||||
: Pluf::f('hg_path', 'hg').' log --debug -r %s -R %s --style %s';
|
||||
$cmd = sprintf($tmpl,
|
||||
escapeshellarg($commit),
|
||||
escapeshellarg($this->repo),
|
||||
$this->hg_log_template);
|
||||
escapeshellarg($logStyle->get()));
|
||||
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
|
||||
$out = self::shell_exec('IDF_Scm_Mercurial::getCommit', $cmd);
|
||||
if (strlen($out) == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$diffStart = strpos($out, 'diff -r');
|
||||
$diff = '';
|
||||
if ($diffStart !== false) {
|
||||
$log = substr($out, 0, $diffStart);
|
||||
$diff = substr($out, $diffStart);
|
||||
} else {
|
||||
$log = $out;
|
||||
}
|
||||
|
||||
$out = self::parseLog(preg_split('/\r\n|\n/', $log));
|
||||
$out[0]->diff = $diff;
|
||||
return $out[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IDF_Scm::getChanges()
|
||||
*/
|
||||
public function getChanges($commit)
|
||||
{
|
||||
if ($this->validateRevision($commit) != IDF_Scm::REVISION_VALID) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$logStyle = new IDF_Scm_Mercurial_LogStyle(IDF_Scm_Mercurial_LogStyle::CHANGES);
|
||||
$tmpl = Pluf::f('hg_path', 'hg').' log --debug -r %s -R %s --style %s';
|
||||
$cmd = sprintf($tmpl,
|
||||
escapeshellarg($commit),
|
||||
escapeshellarg($this->repo),
|
||||
escapeshellarg($logStyle->get()));
|
||||
$out = array();
|
||||
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
|
||||
self::exec('IDF_Scm_Mercurial::getCommit', $cmd, $out);
|
||||
$log = array();
|
||||
$change = array();
|
||||
$inchange = false;
|
||||
foreach ($out as $line) {
|
||||
if (!$inchange and 0 === strpos($line, 'diff -r')) {
|
||||
$inchange = true;
|
||||
self::exec('IDF_Scm_Mercurial::getChanges', $cmd, $out);
|
||||
$log = self::parseLog($out);
|
||||
// we expect only one log entry that contains all the needed information
|
||||
$log = $log[0];
|
||||
|
||||
$return = (object) array(
|
||||
'additions' => preg_split('/\0/', $log->file_adds, -1, PREG_SPLIT_NO_EMPTY),
|
||||
'deletions' => preg_split('/\0/', $log->file_dels, -1, PREG_SPLIT_NO_EMPTY),
|
||||
'patches' => preg_split('/\0/', $log->file_mods, -1, PREG_SPLIT_NO_EMPTY),
|
||||
// hg has no support for built-in attributes, so this keeps empty
|
||||
'properties' => array(),
|
||||
// these two are filled below
|
||||
'copies' => array(),
|
||||
'renames' => array(),
|
||||
);
|
||||
|
||||
$file_copies = preg_split('/\0/', $log->file_copies, -1, PREG_SPLIT_NO_EMPTY);
|
||||
|
||||
// copies are treated as renames if they have an add _and_ a drop;
|
||||
// only if they only have an add, but no drop, they're treated as copies
|
||||
for ($i=0; $i<count($file_copies); $i+=2) {
|
||||
$src = $file_copies[$i];
|
||||
$trg = $file_copies[$i+1];
|
||||
$srcidx = array_search($src, $return->deletions);
|
||||
$trgidx = array_search($trg, $return->additions);
|
||||
if ($srcidx !== false && $trgidx !== false) {
|
||||
$return->renames[$src] = $trg;
|
||||
unset($return->deletions[$srcidx]);
|
||||
unset($return->additions[$trgidx]);
|
||||
continue;
|
||||
}
|
||||
if ($inchange) {
|
||||
$change[] = $line;
|
||||
} else {
|
||||
$log[] = $line;
|
||||
if ($srcidx === false && $trgidx !== false) {
|
||||
$return->copies[$src] = $trg;
|
||||
unset($return->additions[$trgidx]);
|
||||
continue;
|
||||
}
|
||||
// file sutures (counter-operation to copy) not supported
|
||||
}
|
||||
$out = self::parseLog($log, 4);
|
||||
$out[0]->diff = implode("\n", $change);
|
||||
return $out[0];
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -388,54 +507,65 @@ class IDF_Scm_Mercurial extends IDF_Scm
|
||||
*/
|
||||
public function getChangeLog($commit='tip', $n=10)
|
||||
{
|
||||
$cmd = sprintf(Pluf::f('hg_path', 'hg').' log -R %s -l%s --template %s', escapeshellarg($this->repo), $n, $this->hg_log_template, $commit);
|
||||
$logStyle = new IDF_Scm_Mercurial_LogStyle(IDF_Scm_Mercurial_LogStyle::FULL_LOG);
|
||||
|
||||
// hg accepts revision IDs as arguments to --branch / -b as well and
|
||||
// uses the branch of the revision in question to filter the other
|
||||
// revisions
|
||||
$cmd = sprintf(Pluf::f('hg_path', 'hg').' log --debug -R %s -l%s --style %s -b %s',
|
||||
escapeshellarg($this->repo),
|
||||
$n,
|
||||
escapeshellarg($logStyle->get()),
|
||||
escapeshellarg($commit));
|
||||
$out = array();
|
||||
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
|
||||
self::exec('IDF_Scm_Mercurial::getChangeLog', $cmd, $out);
|
||||
return self::parseLog($out, 4);
|
||||
return self::parseLog($out);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the log lines of a --pretty=medium log output.
|
||||
* Parse the log lines of our custom style format.
|
||||
*
|
||||
* @param array Lines.
|
||||
* @param int Number of lines in the headers (3)
|
||||
* @return array Change log.
|
||||
*/
|
||||
|
||||
public static function parseLog($lines, $hdrs=3)
|
||||
public static function parseLog($lines)
|
||||
{
|
||||
$res = array();
|
||||
$c = array();
|
||||
$i = 0;
|
||||
$hdrs += 1;
|
||||
$headers_processed = false;
|
||||
foreach ($lines as $line) {
|
||||
$i++;
|
||||
if (0 === strpos($line, 'changeset:')) {
|
||||
if ($line == "\0") {
|
||||
$headers_processed = false;
|
||||
if (count($c) > 0) {
|
||||
$c['full_message'] = trim($c['full_message']);
|
||||
if (array_key_exists('full_message', $c))
|
||||
$c['full_message'] = trim($c['full_message']);
|
||||
$res[] = (object) $c;
|
||||
}
|
||||
$c = array();
|
||||
$c['commit'] = substr(strrchr($line, ':'), 1);
|
||||
$c['full_message'] = '';
|
||||
$i=1;
|
||||
continue;
|
||||
|
||||
}
|
||||
if ($i == $hdrs) {
|
||||
$c['title'] = trim($line);
|
||||
continue;
|
||||
}
|
||||
$match = array();
|
||||
if (preg_match('/^(\S+):\s*(.*)/', $line, $match)) {
|
||||
if (!$headers_processed && empty($line)) {
|
||||
$headers_processed = true;
|
||||
continue;
|
||||
}
|
||||
if (!$headers_processed && preg_match('/^(\S+):\s*(.*)/', $line, $match)) {
|
||||
$match[1] = strtolower($match[1]);
|
||||
if ($match[1] == 'user') {
|
||||
if ($match[1] == 'changeset') {
|
||||
$c = array();
|
||||
$c['commit'] = $match[2];
|
||||
$c['tree'] = $c['commit'];
|
||||
$c['full_message'] = '';
|
||||
} elseif ($match[1] == 'author') {
|
||||
$c['author'] = $match[2];
|
||||
} elseif ($match[1] == 'summary') {
|
||||
$c['title'] = $match[2];
|
||||
} elseif ($match[1] == 'branch') {
|
||||
$c['branch'] = $match[2];
|
||||
$c['branch'] = empty($match[2]) ? 'default' : $match[2];
|
||||
} elseif ($match[1] == 'parents') {
|
||||
$parents = preg_split('/\s+/', $match[2], -1, PREG_SPLIT_NO_EMPTY);
|
||||
for ($i=0, $j=count($parents); $i<$j; ++$i) {
|
||||
if ($parents[$i] == '000000000000')
|
||||
unset($parents[$i]);
|
||||
}
|
||||
$c['parents'] = $parents;
|
||||
} else {
|
||||
$c[$match[1]] = trim($match[2]);
|
||||
}
|
||||
@@ -444,15 +574,14 @@ class IDF_Scm_Mercurial extends IDF_Scm
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if ($i > ($hdrs+1)) {
|
||||
$c['full_message'] .= trim($line)."\n";
|
||||
if ($headers_processed) {
|
||||
if (empty($c['title']))
|
||||
$c['title'] = trim($line);
|
||||
else
|
||||
$c['full_message'] .= trim($line)."\n";
|
||||
continue;
|
||||
}
|
||||
}
|
||||
$c['tree'] = !empty($c['commit']) ? trim($c['commit']) : '';
|
||||
$c['branch'] = empty($c['branch']) ? 'default' : $c['branch'];
|
||||
$c['full_message'] = !empty($c['full_message']) ? trim($c['full_message']) : '';
|
||||
$res[] = (object) $c;
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
@@ -31,10 +31,10 @@ class IDF_Scm_Monotone extends IDF_Scm
|
||||
/** the minimum supported interface version */
|
||||
public static $MIN_INTERFACE_VERSION = 13.0;
|
||||
|
||||
private $stdio;
|
||||
|
||||
private static $instances = array();
|
||||
|
||||
private $stdio;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
@@ -609,6 +609,7 @@ class IDF_Scm_Monotone extends IDF_Scm
|
||||
'additions' => array(),
|
||||
'deletions' => array(),
|
||||
'renames' => array(),
|
||||
'copies' => array(),
|
||||
'patches' => array(),
|
||||
'properties' => array(),
|
||||
);
|
||||
@@ -698,6 +699,29 @@ class IDF_Scm_Monotone extends IDF_Scm
|
||||
return (object) $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IDF_Scm::getProperties()
|
||||
*/
|
||||
public function getProperties($rev, $path='')
|
||||
{
|
||||
$out = $this->stdio->exec(array('interface_version'));
|
||||
// support for querying file attributes of committed revisions
|
||||
// was added for mtn 1.1 (interface version 13.1)
|
||||
if (floatval($out) < 13.1)
|
||||
return array();
|
||||
|
||||
$out = $this->stdio->exec(array('get_attributes', $path), array('r' => $rev));
|
||||
$stanzas = IDF_Scm_Monotone_BasicIO::parse($out);
|
||||
$res = array();
|
||||
|
||||
foreach ($stanzas as $stanza) {
|
||||
$line = $stanza[0];
|
||||
$res[$line['values'][0]] = $line['values'][1];
|
||||
}
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IDF_Scm::getExtraProperties
|
||||
*/
|
||||
|
@@ -48,7 +48,7 @@ class IDF_Scm_Monotone_Usher
|
||||
if ($conn == 'none')
|
||||
return array();
|
||||
|
||||
return preg_split('/[ ]/', $conn);
|
||||
return preg_split('/[ ]/', $conn, -1, PREG_SPLIT_NO_EMPTY);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,10 +73,10 @@ class IDF_Scm_Monotone_Usher
|
||||
if ($conn == 'none')
|
||||
return array();
|
||||
|
||||
$single_conns = preg_split('/[ ]/', $conn);
|
||||
$single_conns = preg_split('/[ ]/', $conn, -1, PREG_SPLIT_NO_EMPTY);
|
||||
$ret = array();
|
||||
foreach ($single_conns as $conn) {
|
||||
preg_match('/\((\w+)\)([^:]+):(\d+)/', $conn, $matches);
|
||||
preg_match('/\(([^)]+)\)([^:]+):(\d+)/', $conn, $matches);
|
||||
$ret[$matches[1]][] = (object)array(
|
||||
'server' => $matches[1],
|
||||
'address' => $matches[2],
|
||||
|
@@ -33,7 +33,6 @@
|
||||
*/
|
||||
class IDF_Scm_Svn extends IDF_Scm
|
||||
{
|
||||
|
||||
public $username = '';
|
||||
public $password = '';
|
||||
private $assoc = array('dir' => 'tree',
|
||||
@@ -48,11 +47,7 @@ class IDF_Scm_Svn extends IDF_Scm
|
||||
|
||||
public function isAvailable()
|
||||
{
|
||||
$cmd = sprintf(Pluf::f('svn_path', 'svn').' info --xml --username=%s --password=%s %s',
|
||||
escapeshellarg($this->username),
|
||||
escapeshellarg($this->password),
|
||||
escapeshellarg($this->repo));
|
||||
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
|
||||
$cmd = $this->svnCmd(array('info', '--xml'), $this->repo);
|
||||
$xmlInfo = self::shell_exec('IDF_Scm_Svn::isAvailable', $cmd);
|
||||
|
||||
try {
|
||||
@@ -163,12 +158,7 @@ class IDF_Scm_Svn extends IDF_Scm
|
||||
return IDF_Scm::REVISION_VALID;
|
||||
}
|
||||
|
||||
$cmd = sprintf(Pluf::f('svn_path', 'svn').' info --username=%s --password=%s %s@%s',
|
||||
escapeshellarg($this->username),
|
||||
escapeshellarg($this->password),
|
||||
escapeshellarg($this->repo),
|
||||
escapeshellarg($rev));
|
||||
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
|
||||
$cmd = $this->svnCmd(array('info'), $this->repo, $rev);
|
||||
self::exec('IDF_Scm_Svn::validateRevision', $cmd, $out, $ret);
|
||||
|
||||
if ($ret == 0)
|
||||
@@ -176,7 +166,6 @@ class IDF_Scm_Svn extends IDF_Scm
|
||||
return IDF_Scm::REVISION_INVALID;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test a given object hash.
|
||||
*
|
||||
@@ -191,12 +180,9 @@ class IDF_Scm_Svn extends IDF_Scm
|
||||
}
|
||||
|
||||
// Else, test the path on revision
|
||||
$cmd = sprintf(Pluf::f('svn_path', 'svn').' info --xml --username=%s --password=%s %s@%s',
|
||||
escapeshellarg($this->username),
|
||||
escapeshellarg($this->password),
|
||||
escapeshellarg($this->repo.'/'.self::smartEncode($path)),
|
||||
escapeshellarg($rev));
|
||||
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
|
||||
$cmd = $this->svnCmd(array('info', '--xml'),
|
||||
$this->repo.'/'.self::smartEncode($path),
|
||||
$rev);
|
||||
$xmlInfo = self::shell_exec('IDF_Scm_Svn::testHash', $cmd);
|
||||
|
||||
// If exception is thrown, return false
|
||||
@@ -218,12 +204,9 @@ class IDF_Scm_Svn extends IDF_Scm
|
||||
|
||||
public function getTree($commit, $folder='/', $branch=null)
|
||||
{
|
||||
$cmd = sprintf(Pluf::f('svn_path', 'svn').' ls --xml --username=%s --password=%s %s@%s',
|
||||
escapeshellarg($this->username),
|
||||
escapeshellarg($this->password),
|
||||
escapeshellarg($this->repo.'/'.self::smartEncode($folder)),
|
||||
escapeshellarg($commit));
|
||||
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
|
||||
$cmd = $this->svnCmd(array('ls', '--xml'),
|
||||
$this->repo.'/'.self::smartEncode($folder),
|
||||
$commit);
|
||||
$xml = simplexml_load_string(self::shell_exec('IDF_Scm_Svn::getTree', $cmd));
|
||||
$res = array();
|
||||
$folder = (strlen($folder) and ($folder != '/')) ? $folder.'/' : '';
|
||||
@@ -248,7 +231,6 @@ class IDF_Scm_Svn extends IDF_Scm
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the commit message of a revision revision.
|
||||
*
|
||||
@@ -260,12 +242,7 @@ class IDF_Scm_Svn extends IDF_Scm
|
||||
if (isset($this->cache['commitmess'][$rev])) {
|
||||
return $this->cache['commitmess'][$rev];
|
||||
}
|
||||
$cmd = sprintf(Pluf::f('svn_path', 'svn').' log --xml --limit 1 --username=%s --password=%s %s@%s',
|
||||
escapeshellarg($this->username),
|
||||
escapeshellarg($this->password),
|
||||
escapeshellarg($this->repo),
|
||||
escapeshellarg($rev));
|
||||
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
|
||||
$cmd = $this->svnCmd(array('log', '--xml', '--limit', '1'), $this->repo, $rev);
|
||||
try {
|
||||
$xml = simplexml_load_string(self::shell_exec('IDF_Scm_Svn::getCommitMessage', $cmd));
|
||||
$this->cache['commitmess'][$rev] = (string) $xml->logentry->msg;
|
||||
@@ -281,12 +258,8 @@ class IDF_Scm_Svn extends IDF_Scm
|
||||
if ($rev == null) {
|
||||
$rev = 'HEAD';
|
||||
}
|
||||
$cmd = sprintf(Pluf::f('svn_path', 'svn').' info --xml --username=%s --password=%s %s@%s',
|
||||
escapeshellarg($this->username),
|
||||
escapeshellarg($this->password),
|
||||
escapeshellarg($this->repo.'/'.self::smartEncode($filename)),
|
||||
escapeshellarg($rev));
|
||||
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
|
||||
$cmd = $this->svnCmd(array('info', '--xml'),
|
||||
$this->repo.'/'.self::smartEncode($filename), $rev);
|
||||
$xml = simplexml_load_string(self::shell_exec('IDF_Scm_Svn::getPathInfo', $cmd));
|
||||
if (!isset($xml->entry)) {
|
||||
return false;
|
||||
@@ -308,12 +281,9 @@ class IDF_Scm_Svn extends IDF_Scm
|
||||
|
||||
public function getFile($def, $cmd_only=false)
|
||||
{
|
||||
$cmd = sprintf(Pluf::f('svn_path', 'svn').' cat --username=%s --password=%s %s@%s',
|
||||
escapeshellarg($this->username),
|
||||
escapeshellarg($this->password),
|
||||
escapeshellarg($this->repo.'/'.self::smartEncode($def->fullpath)),
|
||||
escapeshellarg($def->rev));
|
||||
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
|
||||
$cmd = $this->svnCmd(array('cat'),
|
||||
$this->repo.'/'.self::smartEncode($def->fullpath),
|
||||
$def->rev);
|
||||
return ($cmd_only) ?
|
||||
$cmd : self::shell_exec('IDF_Scm_Svn::getFile', $cmd);
|
||||
}
|
||||
@@ -329,11 +299,7 @@ class IDF_Scm_Svn extends IDF_Scm
|
||||
return $this->cache['branches'];
|
||||
}
|
||||
$res = array();
|
||||
$cmd = sprintf(Pluf::f('svn_path', 'svn').' ls --username=%s --password=%s %s@HEAD',
|
||||
escapeshellarg($this->username),
|
||||
escapeshellarg($this->password),
|
||||
escapeshellarg($this->repo.'/branches'));
|
||||
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
|
||||
$cmd = $this->svnCmd(array('ls'), $this->repo.'/branches', 'HEAD');
|
||||
self::exec('IDF_Scm_Svn::getBranches', $cmd, $out, $ret);
|
||||
if ($ret == 0) {
|
||||
foreach ($out as $entry) {
|
||||
@@ -344,11 +310,8 @@ class IDF_Scm_Svn extends IDF_Scm
|
||||
}
|
||||
}
|
||||
ksort($res);
|
||||
$cmd = sprintf(Pluf::f('svn_path', 'svn').' info --username=%s --password=%s %s@HEAD',
|
||||
escapeshellarg($this->username),
|
||||
escapeshellarg($this->password),
|
||||
escapeshellarg($this->repo.'/trunk'));
|
||||
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
|
||||
|
||||
$cmd = $this->svnCmd(array('info'), $this->repo.'/trunk', 'HEAD');
|
||||
self::exec('IDF_Scm_Svn::getBranches', $cmd, $out, $ret);
|
||||
if ($ret == 0) {
|
||||
$res = array('trunk' => 'trunk') + $res;
|
||||
@@ -368,11 +331,7 @@ class IDF_Scm_Svn extends IDF_Scm
|
||||
return $this->cache['tags'];
|
||||
}
|
||||
$res = array();
|
||||
$cmd = sprintf(Pluf::f('svn_path', 'svn').' ls --username=%s --password=%s %s@HEAD',
|
||||
escapeshellarg($this->username),
|
||||
escapeshellarg($this->password),
|
||||
escapeshellarg($this->repo.'/tags'));
|
||||
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
|
||||
$cmd = $this->svnCmd(array('ls'), $this->repo.'/tags', 'HEAD');
|
||||
self::exec('IDF_Scm_Svn::getTags', $cmd, $out, $ret);
|
||||
if ($ret == 0) {
|
||||
foreach ($out as $entry) {
|
||||
@@ -412,7 +371,6 @@ class IDF_Scm_Svn extends IDF_Scm
|
||||
return array();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get commit details.
|
||||
*
|
||||
@@ -426,12 +384,8 @@ class IDF_Scm_Svn extends IDF_Scm
|
||||
return false;
|
||||
}
|
||||
$res = array();
|
||||
$cmd = sprintf(Pluf::f('svn_path', 'svn').' log --xml --limit 1 -v --username=%s --password=%s %s@%s',
|
||||
escapeshellarg($this->username),
|
||||
escapeshellarg($this->password),
|
||||
escapeshellarg($this->repo),
|
||||
escapeshellarg($commit));
|
||||
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
|
||||
$cmd = $this->svnCmd(array('log', '--xml', '--limit', '1', '-v'),
|
||||
$this->repo, $commit);
|
||||
$xmlRes = self::shell_exec('IDF_Scm_Svn::getCommit', $cmd);
|
||||
$xml = simplexml_load_string($xmlRes);
|
||||
$res['author'] = (string) $xml->logentry->author;
|
||||
@@ -473,15 +427,87 @@ class IDF_Scm_Svn extends IDF_Scm
|
||||
private function getDiff($rev='HEAD')
|
||||
{
|
||||
$res = array();
|
||||
$cmd = sprintf(Pluf::f('svn_path', 'svn').' diff -c %s --username=%s --password=%s %s',
|
||||
escapeshellarg($rev),
|
||||
escapeshellarg($this->username),
|
||||
escapeshellarg($this->password),
|
||||
escapeshellarg($this->repo));
|
||||
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
|
||||
$cmd = $this->svnCmd(array('diff', '-c', $rev), $this->repo);
|
||||
return self::shell_exec('IDF_Scm_Svn::getDiff', $cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see IDF_Scm::getChanges()
|
||||
*/
|
||||
public function getChanges($commit)
|
||||
{
|
||||
if ($this->validateRevision($commit) != IDF_Scm::REVISION_VALID) {
|
||||
return null;
|
||||
}
|
||||
$cmd = $this->svnCmd(array('log', '--xml', '-v'), $this->repo, $commit);
|
||||
$out = array();
|
||||
$out = self::shell_exec('IDF_Scm_Svn::getChanges', $cmd);
|
||||
$xml = simplexml_load_string($out);
|
||||
if (count($xml) == 0) {
|
||||
return null;
|
||||
}
|
||||
$entry = current($xml);
|
||||
|
||||
$return = (object) array(
|
||||
'additions' => array(),
|
||||
'deletions' => array(),
|
||||
'patches' => array(),
|
||||
// while SVN has support for attributes, we cannot see their changes
|
||||
// in the log's XML unfortunately
|
||||
'properties' => array(),
|
||||
'copies' => array(),
|
||||
'renames' => array(),
|
||||
);
|
||||
|
||||
foreach ($entry->paths->path as $p) {
|
||||
$path = (string) $p;
|
||||
foreach ($p->attributes() as $k => $v) {
|
||||
$key = (string) $k;
|
||||
$val = (string) $v;
|
||||
if ($key != 'action')
|
||||
continue;
|
||||
if ($val == 'M')
|
||||
$return->patches[] = $path;
|
||||
else if ($val == 'A')
|
||||
$return->additions[] = $path;
|
||||
else if ($val == 'D')
|
||||
$return->deletions[] = $path;
|
||||
}
|
||||
}
|
||||
|
||||
// copies are treated as renames if they have an add _and_ a drop;
|
||||
// only if they only have an add, but no drop, they're treated as copies
|
||||
foreach ($entry->paths->path as $p) {
|
||||
$trg = (string) $p;
|
||||
$src = null;
|
||||
foreach ($p->attributes() as $k => $v) {
|
||||
if ((string) $k == 'copyfrom-path') {
|
||||
$src = (string) $v;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($src == null)
|
||||
continue;
|
||||
|
||||
$srcidx = array_search($src, $return->deletions);
|
||||
$trgidx = array_search($trg, $return->additions);
|
||||
if ($srcidx !== false && $trgidx !== false) {
|
||||
$return->renames[$src] = $trg;
|
||||
unset($return->deletions[$srcidx]);
|
||||
unset($return->additions[$trgidx]);
|
||||
continue;
|
||||
}
|
||||
if ($srcidx === false && $trgidx !== false) {
|
||||
$return->copies[$src] = $trg;
|
||||
unset($return->additions[$trgidx]);
|
||||
continue;
|
||||
}
|
||||
// file sutures (counter-operation to copy) not supported
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get latest changes.
|
||||
@@ -491,20 +517,15 @@ class IDF_Scm_Svn extends IDF_Scm
|
||||
*
|
||||
* @return array Changes.
|
||||
*/
|
||||
public function getChangeLog($branch=null, $n=10)
|
||||
public function getChangeLog($rev=null, $n=10)
|
||||
{
|
||||
if ($branch != 'HEAD' and !preg_match('/^\d+$/', $branch)) {
|
||||
if ($rev != 'HEAD' and !preg_match('/^\d+$/', $rev)) {
|
||||
// we accept only revisions or HEAD
|
||||
$branch = 'HEAD';
|
||||
$rev = 'HEAD';
|
||||
}
|
||||
$res = array();
|
||||
$cmd = sprintf(Pluf::f('svn_path', 'svn').' log --xml -v --limit %s --username=%s --password=%s %s@%s',
|
||||
escapeshellarg($n),
|
||||
escapeshellarg($this->username),
|
||||
escapeshellarg($this->password),
|
||||
escapeshellarg($this->repo),
|
||||
escapeshellarg($branch));
|
||||
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
|
||||
$cmd = $this->svnCmd(array('log', '--xml', '-v', '--limit', $n),
|
||||
$this->repo.'@'.$rev);
|
||||
$xmlRes = self::shell_exec('IDF_Scm_Svn::getChangeLog', $cmd);
|
||||
$xml = simplexml_load_string($xmlRes);
|
||||
foreach ($xml->logentry as $entry) {
|
||||
@@ -520,7 +541,6 @@ class IDF_Scm_Svn extends IDF_Scm
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get additionnals properties on path and revision
|
||||
*
|
||||
@@ -531,12 +551,8 @@ class IDF_Scm_Svn extends IDF_Scm
|
||||
public function getProperties($rev, $path='')
|
||||
{
|
||||
$res = array();
|
||||
$cmd = sprintf(Pluf::f('svn_path', 'svn').' proplist --xml --username=%s --password=%s %s@%s',
|
||||
escapeshellarg($this->username),
|
||||
escapeshellarg($this->password),
|
||||
escapeshellarg($this->repo.'/'.self::smartEncode($path)),
|
||||
escapeshellarg($rev));
|
||||
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
|
||||
$cmd = $this->svnCmd(array('proplist', '--xml'),
|
||||
$this->repo.'/'.self::smartEncode($path), $rev);
|
||||
$xmlProps = self::shell_exec('IDF_Scm_Svn::getProperties', $cmd);
|
||||
$props = simplexml_load_string($xmlProps);
|
||||
|
||||
@@ -554,7 +570,6 @@ class IDF_Scm_Svn extends IDF_Scm
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a specific additionnal property on path and revision
|
||||
*
|
||||
@@ -566,20 +581,14 @@ class IDF_Scm_Svn extends IDF_Scm
|
||||
private function getProperty($property, $rev, $path='')
|
||||
{
|
||||
$res = array();
|
||||
$cmd = sprintf(Pluf::f('svn_path', 'svn').' propget --xml %s --username=%s --password=%s %s@%s',
|
||||
escapeshellarg($property),
|
||||
escapeshellarg($this->username),
|
||||
escapeshellarg($this->password),
|
||||
escapeshellarg($this->repo.'/'.self::smartEncode($path)),
|
||||
escapeshellarg($rev));
|
||||
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
|
||||
$cmd = $this->svnCmd(array('propget', $property, '--xml'),
|
||||
$this->repo.'/'.self::smartEncode($path), $rev);
|
||||
$xmlProp = self::shell_exec('IDF_Scm_Svn::getProperty', $cmd);
|
||||
$prop = simplexml_load_string($xmlProp);
|
||||
|
||||
return (string) $prop->target->property;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the number of the last commit in the repository.
|
||||
*
|
||||
@@ -590,16 +599,38 @@ class IDF_Scm_Svn extends IDF_Scm
|
||||
public function getLastCommit($rev='HEAD')
|
||||
{
|
||||
$xmlInfo = '';
|
||||
$cmd = sprintf(Pluf::f('svn_path', 'svn').' info --xml --username=%s --password=%s %s@%s',
|
||||
escapeshellarg($this->username),
|
||||
escapeshellarg($this->password),
|
||||
escapeshellarg($this->repo),
|
||||
escapeshellarg($rev));
|
||||
$cmd = Pluf::f('idf_exec_cmd_prefix', '').$cmd;
|
||||
$cmd = $this->svnCmd(array('info', '--xml'), $this->repo, $rev);
|
||||
$xmlInfo = self::shell_exec('IDF_Scm_Svn::getLastCommit', $cmd);
|
||||
|
||||
$xml = simplexml_load_string($xmlInfo);
|
||||
return (string) $xml->entry->commit['revision'];
|
||||
}
|
||||
|
||||
private function svnCmd($args = array(), $repoarg = null, $revarg = null)
|
||||
{
|
||||
$cmdline = array();
|
||||
$cmdline[] = Pluf::f('idf_exec_cmd_prefix', '');
|
||||
$cmdline[] = Pluf::f('svn_path', 'svn');
|
||||
$cmdline[] = '--no-auth-cache';
|
||||
$cmdline[] = '--username='.escapeshellarg($this->username);
|
||||
$cmdline[] = '--password='.escapeshellarg($this->password);
|
||||
|
||||
foreach ($args as $arg) {
|
||||
$cmdline[] = escapeshellarg($arg);
|
||||
}
|
||||
|
||||
if ($repoarg != null) {
|
||||
if ($revarg != null) {
|
||||
$repoarg .= '@'.$revarg;
|
||||
}
|
||||
$cmdline[] = escapeshellarg($repoarg);
|
||||
}
|
||||
|
||||
if ($revarg != null) {
|
||||
$cmdline[] = '--revision='.escapeshellarg($revarg);
|
||||
}
|
||||
|
||||
return implode(' ', $cmdline);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -22,7 +22,7 @@
|
||||
# ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/**
|
||||
* Storage of the occurence of the words.
|
||||
* Storage of the occurrence of the words.
|
||||
*/
|
||||
class IDF_Search_Occ extends Pluf_Model
|
||||
{
|
||||
@@ -30,7 +30,7 @@ class IDF_Search_Occ extends Pluf_Model
|
||||
|
||||
function init()
|
||||
{
|
||||
$this->_a['verbose'] = __('occurence');
|
||||
$this->_a['verbose'] = __('occurrence');
|
||||
$this->_a['table'] = 'idf_search_occs';
|
||||
$this->_a['model'] = 'IDF_Search_Occ';
|
||||
$this->_a['cols'] = array(
|
||||
@@ -72,13 +72,13 @@ class IDF_Search_Occ extends Pluf_Model
|
||||
array(
|
||||
'type' => 'Pluf_DB_Field_Integer',
|
||||
'blank' => false,
|
||||
'verbose' => __('occurences'),
|
||||
'verbose' => __('occurrences'),
|
||||
),
|
||||
'pondocc' =>
|
||||
array(
|
||||
'type' => 'Pluf_DB_Field_Float',
|
||||
'blank' => false,
|
||||
'verbose' => __('ponderated occurence'),
|
||||
'verbose' => __('ponderated occurrence'),
|
||||
),
|
||||
);
|
||||
$this->_a['idx'] = array(
|
||||
|
@@ -58,7 +58,7 @@ class IDF_Template_IssueComment extends Pluf_Template_Tag
|
||||
implode('|', $nouns);
|
||||
$text = IDF_Template_safePregReplace('#((?:'.$prefix.')(?:\s+r?))([0-9a-f]{1,40}((?:\s+and|\s+or|,)\s+r?[0-9a-f]{1,40})*)\b#i',
|
||||
array($this, 'callbackCommits'), $text);
|
||||
$text = IDF_Template_safePregReplace('=(src:)([^\s@#,\(\)\\\\]+(?:(\\\\)[\s@#][^\s@#,\(\)\\\\]+){0,})+(?:\@([^\s#,]+))(?:#(\d+))?=im',
|
||||
$text = IDF_Template_safePregReplace('=(src:)([^\s@#,\(\)\\\\]+(?:(\\\\)[\s@#][^\s@#,\(\)\\\\]+){0,})+(?:\@([^\s#,]+))?(?:#(\d+))?=im',
|
||||
array($this, 'callbackSource'), $text);
|
||||
}
|
||||
if ($wordwrap) $text = Pluf_Text::wrapHtml($text, 69, "\n");
|
||||
|
@@ -90,40 +90,69 @@ class IDF_Template_MarkdownPrefilter extends Pluf_Text_HTML_Filter
|
||||
);
|
||||
|
||||
public $allowed = array(
|
||||
'a' => array('href', 'title', 'rel'),
|
||||
'abbr' => array('title'),
|
||||
'address' => array(),
|
||||
'b' => array(),
|
||||
'blockquote' => array(),
|
||||
'br' => array(),
|
||||
'caption' => array(),
|
||||
'code' => array(),
|
||||
'dd' => array(),
|
||||
'del' => array('cite', 'class', 'datetime', 'dir', 'id', 'title'),
|
||||
'div' => array('align', 'class'),
|
||||
'dl' => array(),
|
||||
'dt' => array(),
|
||||
'em' => array(),
|
||||
'h1' => array('id'),
|
||||
'h2' => array('id'),
|
||||
'h3' => array('id'),
|
||||
'h4' => array('id'),
|
||||
'h5' => array('id'),
|
||||
'h6' => array('id'),
|
||||
'hr' => array(),
|
||||
'i' => array(),
|
||||
'img' => array('src', 'class', 'alt', 'height', 'width', 'style'),
|
||||
'ins' => array('cite', 'class', 'datetime', 'dir', 'id', 'title'),
|
||||
'li' => array(),
|
||||
'ol' => array(),
|
||||
'p' => array('align', 'class'),
|
||||
'pre' => array(),
|
||||
'strong' => array(),
|
||||
'table' => array('summary'),
|
||||
'td' => array('style'),
|
||||
'th' => array(),
|
||||
'tr' => array(),
|
||||
'ul' => array(),
|
||||
'a' => array('class', 'dir', 'id', 'style', 'title',
|
||||
'href', 'hreflang', 'rel'),
|
||||
'abbr' => array('class', 'dir', 'id', 'style', 'title'),
|
||||
'address' => array('class', 'dir', 'id', 'style', 'title'),
|
||||
'b' => array('class', 'dir', 'id', 'style', 'title'),
|
||||
'blockquote' => array('class', 'dir', 'id', 'style', 'title',
|
||||
'cite'),
|
||||
'br' => array('class', 'id', 'style', 'title'),
|
||||
'caption' => array('class', 'dir', 'id', 'style', 'title',
|
||||
'align'), // deprecated attribute),
|
||||
'code' => array('class', 'dir', 'id', 'style', 'title'),
|
||||
'dd' => array('class', 'dir', 'id', 'style', 'title'),
|
||||
'del' => array('class', 'dir', 'id', 'style', 'title',
|
||||
'cite', 'datetime'),
|
||||
'div' => array('class', 'dir', 'id', 'style', 'title',
|
||||
'align'), // deprecated attribute
|
||||
'dl' => array('class', 'dir', 'id', 'style', 'title'),
|
||||
'dt' => array('class', 'dir', 'id', 'style', 'title'),
|
||||
'em' => array('class', 'dir', 'id', 'style', 'title'),
|
||||
'font' => array('class', 'dir', 'id', 'style', 'title', // deprecated element
|
||||
'color', 'face', 'size'), // deprecated attribute
|
||||
'h1' => array('class', 'dir', 'id', 'style', 'title',
|
||||
'align'), // deprecated attribute
|
||||
'h2' => array('class', 'dir', 'id', 'style', 'title',
|
||||
'align'), // deprecated attribute
|
||||
'h3' => array('class', 'dir', 'id', 'style', 'title',
|
||||
'align'), // deprecated attribute
|
||||
'h4' => array('class', 'dir', 'id', 'style', 'title',
|
||||
'align'), // deprecated attribute
|
||||
'h5' => array('class', 'dir', 'id', 'style', 'title',
|
||||
'align'), // deprecated attribute
|
||||
'h6' => array('class', 'dir', 'id', 'style', 'title',
|
||||
'align'), // deprecated attribute
|
||||
'hr' => array('class', 'dir', 'id', 'style', 'title',
|
||||
'align', 'noshade', 'size', 'width'), // deprecated attribute
|
||||
'i' => array('class', 'dir', 'id', 'style', 'title'),
|
||||
'img' => array('class', 'dir', 'id', 'style', 'title',
|
||||
'src', 'alt', 'height', 'width'),
|
||||
'ins' => array('class', 'dir', 'id', 'style', 'title',
|
||||
'cite', 'datetime'),
|
||||
'li' => array('class', 'dir', 'id', 'style', 'title',
|
||||
'type'), // deprecated attribute
|
||||
'ol' => array('class', 'dir', 'id', 'style', 'title',
|
||||
'type'), // deprecated attribute
|
||||
'p' => array('class', 'dir', 'id', 'style', 'title',
|
||||
'align'), // deprecated attribute
|
||||
'pre' => array('class', 'dir', 'id', 'style', 'title',
|
||||
'width'), // deprecated attribute
|
||||
'strong' => array('class', 'dir', 'id', 'style', 'title'),
|
||||
'table' => array('class', 'dir', 'id', 'style', 'title',
|
||||
'border', 'cellpadding', 'cellspacing', 'frame', 'rules', 'summary', 'width',
|
||||
'align', 'bgcolor'), // deprecated attribute
|
||||
'td' => array('class', 'dir', 'id', 'style', 'title',
|
||||
'align', 'colspan', 'headers', 'rowspan', 'scope', 'valign',
|
||||
'bgcolor', 'height', 'nowrap', 'width'), // deprecated attribute
|
||||
'th' => array('class', 'dir', 'id', 'style', 'title',
|
||||
'align', 'colspan', 'rowspan', 'scope', 'valign',
|
||||
'bgcolor', 'height', 'nowrap', 'width'), // deprecated attribute
|
||||
'tr' => array('class', 'dir', 'id', 'style', 'title',
|
||||
'align', 'valign',
|
||||
'bgcolor'), // deprecated attribute
|
||||
'ul' => array('class', 'dir', 'id', 'style', 'title',
|
||||
'type'), // deprecated attribute
|
||||
);
|
||||
// tags which should always be self-closing (e.g. "<img />")
|
||||
public $no_close = array(
|
||||
|
35
src/IDF/Template/Tag/UploadUrl.php
Normal file
35
src/IDF/Template/Tag/UploadUrl.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# This file is part of InDefero, an open source project management application.
|
||||
# Copyright (C) 2011 Céondo Ltd and contributors.
|
||||
#
|
||||
# InDefero is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# InDefero is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# ***** END LICENSE BLOCK ***** */
|
||||
|
||||
class IDF_Template_Tag_UploadUrl extends Pluf_Template_Tag
|
||||
{
|
||||
function start($file='')
|
||||
{
|
||||
echo IDF_Template_Tag_UploadUrl::url($file);
|
||||
}
|
||||
|
||||
public static function url($file='')
|
||||
{
|
||||
return Pluf::f('url_upload', Pluf_Template_Tag_MediaUrl::url() . '/upload') . $file;
|
||||
}
|
||||
}
|
@@ -32,21 +32,24 @@ class IDF_Tests_TestDiff extends UnitTestCase
|
||||
parent::__construct('Test the diff parser.');
|
||||
}
|
||||
|
||||
public function testBinaryDiff()
|
||||
{
|
||||
$diff_content = file_get_contents(dirname(__FILE__).'/test-diff.diff');
|
||||
$orig = file_get_contents(dirname(__FILE__).'/test-diff-view.html');
|
||||
$diff = new IDF_Diff($diff_content);
|
||||
$diff->parse();
|
||||
$def = $diff->files['src/IDF/templates/idf/issues/view.html'];
|
||||
|
||||
$orig_lines = preg_split("/\015\012|\015|\012/", $orig);
|
||||
$merged = $diff->mergeChunks($orig_lines, $def, 10);
|
||||
$lchunk = end($merged);
|
||||
$lline = end($lchunk);
|
||||
$this->assertEqual(array('', '166', '{/if}{/block}'),
|
||||
$lline);
|
||||
}
|
||||
//
|
||||
// IDF_Diff::mergeChunks() is now private, so this test needs to be rewritten
|
||||
//
|
||||
//public function testBinaryDiff()
|
||||
//{
|
||||
// $diff_content = file_get_contents(dirname(__FILE__).'/test-diff.diff');
|
||||
// $orig = file_get_contents(dirname(__FILE__).'/test-diff-view.html');
|
||||
// $diff = new IDF_Diff($diff_content);
|
||||
// $diff->parse();
|
||||
// $def = $diff->files['src/IDF/templates/idf/issues/view.html'];
|
||||
//
|
||||
// $orig_lines = preg_split("/\015\012|\015|\012/", $orig);
|
||||
// $merged = $diff->mergeChunks($orig_lines, $def, 10);
|
||||
// $lchunk = end($merged);
|
||||
// $lline = end($lchunk);
|
||||
// $this->assertEqual(array('', '166', '{/if}{/block}'),
|
||||
// $lline);
|
||||
//}
|
||||
|
||||
public function testDiffWithHeaders()
|
||||
{
|
||||
|
@@ -77,6 +77,12 @@ class IDF_Upload extends Pluf_Model
|
||||
'default' => 0,
|
||||
'verbose' => __('file size in bytes'),
|
||||
),
|
||||
'md5' =>
|
||||
array(
|
||||
'type' => 'Pluf_DB_Field_Text',
|
||||
'blank' => true,
|
||||
'verbose' => __('MD5'),
|
||||
),
|
||||
'submitter' =>
|
||||
array(
|
||||
'type' => 'Pluf_DB_Field_Foreignkey',
|
||||
@@ -144,6 +150,7 @@ class IDF_Upload extends Pluf_Model
|
||||
if ($this->id == '') {
|
||||
$this->creation_dtime = gmdate('Y-m-d H:i:s');
|
||||
$this->modif_dtime = gmdate('Y-m-d H:i:s');
|
||||
$this->md5 = md5_file ($this->getFullPath());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,6 +167,11 @@ class IDF_Upload extends Pluf_Model
|
||||
return Pluf::f('url_upload').'/'.$project->shortname.'/files/'.$this->file;
|
||||
}
|
||||
|
||||
function getFullPath()
|
||||
{
|
||||
return(Pluf::f('upload_path').'/'.$this->get_project()->shortname.'/files/'.$this->file);
|
||||
}
|
||||
|
||||
/**
|
||||
* We drop the information from the timeline.
|
||||
*/
|
||||
@@ -189,7 +201,7 @@ class IDF_Upload extends Pluf_Model
|
||||
$out .= sprintf(__('<a href="%1$s" title="View download">Download %2$d</a>, %3$s'), $url, $this->id, Pluf_esc($this->summary)).'</td>';
|
||||
$out .= '</tr>';
|
||||
$out .= "\n".'<tr class="extra"><td colspan="2">
|
||||
<div class="helptext right">'.sprintf(__('Addition of <a href="%s">download %d</a>, by %s'), $url, $this->id, $user).'</div></td></tr>';
|
||||
<div class="helptext right">'.sprintf(__('Addition of <a href="%1$s">download %2$d</a>, by %3$s'), $url, $this->id, $user).'</div></td></tr>';
|
||||
return Pluf_Template::markSafe($out);
|
||||
}
|
||||
|
||||
@@ -199,7 +211,7 @@ class IDF_Upload extends Pluf_Model
|
||||
.Pluf_HTTP_URL_urlForView('IDF_Views_Download::view',
|
||||
array($request->project->shortname,
|
||||
$this->id));
|
||||
$title = sprintf(__('%s: Download %d added - %s'),
|
||||
$title = sprintf(__('%1$s: Download %2$d added - %3$s'),
|
||||
$request->project->name,
|
||||
$this->id, $this->summary);
|
||||
$date = Pluf_Date::gmDateToGmString($this->creation_dtime);
|
||||
@@ -241,7 +253,7 @@ class IDF_Upload extends Pluf_Model
|
||||
foreach ($addresses as $address) {
|
||||
$email = new Pluf_Mail(Pluf::f('from_email'),
|
||||
$address,
|
||||
sprintf(__('New download - %s (%s)'),
|
||||
sprintf(__('New download - %1$s (%2$s)'),
|
||||
$this->summary,
|
||||
$this->get_project()->shortname));
|
||||
$email->addTextMessage($text_email);
|
||||
@@ -249,4 +261,4 @@ class IDF_Upload extends Pluf_Model
|
||||
}
|
||||
Pluf_Translation::loadSetLocale($current_locale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -59,7 +59,7 @@ class IDF_Views_Download
|
||||
$sql .= ' AND id NOT IN ('.implode(',', $ids).')';
|
||||
}
|
||||
$pag->forced_where = new Pluf_SQL($sql, array($prj->id));
|
||||
|
||||
|
||||
$list_display = array(
|
||||
'file' => __('File'),
|
||||
array('summary', 'IDF_Views_Download_SummaryAndLabels', __('Summary')),
|
||||
@@ -79,7 +79,7 @@ class IDF_Views_Download
|
||||
'dlabel' => $dtag,
|
||||
),
|
||||
$request);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -99,17 +99,17 @@ class IDF_Views_Download
|
||||
$deprecated = Pluf_Model_InArray($dtag, $tags);
|
||||
if ($request->method == 'POST' and
|
||||
true === IDF_Precondition::projectMemberOrOwner($request)) {
|
||||
|
||||
|
||||
$form = new IDF_Form_UpdateUpload($request->POST,
|
||||
array('project' => $prj,
|
||||
'upload' => $upload,
|
||||
'user' => $request->user));
|
||||
if ($form->isValid()) {
|
||||
$upload = $form->save();
|
||||
$urlfile = Pluf_HTTP_URL_urlForView('IDF_Views_Download::view',
|
||||
$urlfile = Pluf_HTTP_URL_urlForView('IDF_Views_Download::view',
|
||||
array($prj->shortname, $upload->id));
|
||||
$request->user->setMessage(sprintf(__('The file <a href="%1$s">%2$s</a> has been updated.'), $urlfile, Pluf_esc($upload->file)));
|
||||
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Download::index',
|
||||
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Download::index',
|
||||
array($prj->shortname));
|
||||
return new Pluf_HTTP_Response_Redirect($url);
|
||||
}
|
||||
@@ -162,7 +162,7 @@ class IDF_Views_Download
|
||||
* [description]
|
||||
*
|
||||
* This signal allows an application to perform a set of tasks
|
||||
* just before the deletion of the corresponding object in the
|
||||
* just before the deletion of the corresponding object in the
|
||||
* database but just after the deletion from the storage.
|
||||
*
|
||||
* [parameters]
|
||||
@@ -171,11 +171,11 @@ class IDF_Views_Download
|
||||
*
|
||||
*/
|
||||
$params = array('upload' => $upload);
|
||||
Pluf_Signal::send('IDF_Upload::delete',
|
||||
Pluf_Signal::send('IDF_Upload::delete',
|
||||
'IDF_Views_Download', $params);
|
||||
$upload->delete();
|
||||
$request->user->setMessage(__('The file has been deleted.'));
|
||||
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Download::index',
|
||||
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Download::index',
|
||||
array($prj->shortname));
|
||||
return new Pluf_HTTP_Response_Redirect($url);
|
||||
}
|
||||
@@ -190,17 +190,37 @@ class IDF_Views_Download
|
||||
}
|
||||
|
||||
/**
|
||||
* Download a file.
|
||||
* Download the file with the given name.
|
||||
*/
|
||||
public $download_precond = array('IDF_Precondition::accessDownloads');
|
||||
public function download($request, $match)
|
||||
{
|
||||
$prj = $request->project;
|
||||
$upload = Pluf_Shortcuts_GetObjectOr404('IDF_Upload', $match[2]);
|
||||
$sql = new Pluf_SQL('file=%s', array($match[2]));
|
||||
$upload = Pluf::factory('IDF_Upload')->getOne(array('filter' => $sql->gen()));
|
||||
if (!$upload) throw new Pluf_HTTP_Error404();
|
||||
$prj->inOr404($upload);
|
||||
$upload->downloads += 1;
|
||||
$upload->update();
|
||||
return new Pluf_HTTP_Response_Redirect($upload->getAbsoluteUrl($prj));
|
||||
$path = $upload->getFullPath();
|
||||
$mime = IDF_FileUtil::getMimeType($path);
|
||||
$render = new Pluf_HTTP_Response_File($path, $mime[0]);
|
||||
$render->headers["Content-MD5"] = $upload->md5;
|
||||
return $render;
|
||||
}
|
||||
|
||||
/**
|
||||
* Download the file with the given ID (for legacy links).
|
||||
*/
|
||||
public $downloadById_precond = array('IDF_Precondition::accessDownloads');
|
||||
public function downloadById($request, $match)
|
||||
{
|
||||
$upload = Pluf_Shortcuts_GetObjectOr404('IDF_Upload', $match[2]);
|
||||
return new Pluf_HTTP_Response_Redirect(
|
||||
Pluf_HTTP_URL_urlForView('IDF_Views_Download::download', array(
|
||||
$match[1], $upload->file
|
||||
)), 301
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -218,10 +238,10 @@ class IDF_Views_Download
|
||||
'user' => $request->user));
|
||||
if ($form->isValid()) {
|
||||
$upload = $form->save();
|
||||
$urlfile = Pluf_HTTP_URL_urlForView('IDF_Views_Download::view',
|
||||
$urlfile = Pluf_HTTP_URL_urlForView('IDF_Views_Download::view',
|
||||
array($prj->shortname, $upload->id));
|
||||
$request->user->setMessage(sprintf(__('The <a href="%s">file</a> has been uploaded.'), $urlfile));
|
||||
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Download::index',
|
||||
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Download::index',
|
||||
array($prj->shortname));
|
||||
return new Pluf_HTTP_Response_Redirect($url);
|
||||
}
|
||||
@@ -246,7 +266,7 @@ class IDF_Views_Download
|
||||
{
|
||||
$conf = new IDF_Conf();
|
||||
$conf->setProject($project);
|
||||
$st = preg_split("/\015\012|\015|\012/",
|
||||
$st = preg_split("/\015\012|\015|\012/",
|
||||
$conf->getVal('labels_download_predefined', IDF_Form_UploadConf::init_predefined), -1, PREG_SPLIT_NO_EMPTY);
|
||||
$auto = '';
|
||||
foreach ($st as $s) {
|
||||
@@ -299,13 +319,11 @@ class IDF_Views_Download
|
||||
$pag->no_results_text = __('No downloads were found.');
|
||||
$pag->sort_order = array('creation_dtime', 'DESC');
|
||||
$pag->setFromRequest($request);
|
||||
$tags = $prj->getTagCloud('downloads');
|
||||
return Pluf_Shortcuts_RenderToResponse('idf/downloads/index.html',
|
||||
array(
|
||||
'page_title' => $title,
|
||||
'label' => $tag,
|
||||
'downloads' => $pag,
|
||||
'tags' => $tags,
|
||||
'dlabel' => $dtag,
|
||||
),
|
||||
$request);
|
||||
@@ -354,7 +372,7 @@ function IDF_Views_Download_SummaryAndLabels($field, $down, $extra='')
|
||||
{
|
||||
$tags = array();
|
||||
foreach ($down->get_tags_list() as $tag) {
|
||||
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Download::listLabel',
|
||||
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Download::listLabel',
|
||||
array($down->shortname, $tag->id));
|
||||
$tags[] = sprintf('<a href="%s" class="label">%s</a>', $url, Pluf_esc((string) $tag));
|
||||
}
|
||||
|
@@ -71,12 +71,91 @@ class IDF_Views_Issue
|
||||
'page_title' => $title,
|
||||
'open' => $open,
|
||||
'closed' => $closed,
|
||||
'issues' => $pag);
|
||||
'issues' => $pag,
|
||||
'cloud' => 'issues',
|
||||
);
|
||||
if ($api) return $params;
|
||||
return Pluf_Shortcuts_RenderToResponse('idf/issues/index.html',
|
||||
$params, $request);
|
||||
}
|
||||
|
||||
/**
|
||||
* View the issue summary.
|
||||
* TODO Add thoses data in cache, and process it only after an issue update
|
||||
*/
|
||||
public $summary_precond = array('IDF_Precondition::accessIssues');
|
||||
public function summary($request, $match)
|
||||
{
|
||||
$tagStatistics = array();
|
||||
$ownerStatistics = array();
|
||||
$status = array();
|
||||
$isTrackerEmpty = false;
|
||||
|
||||
$prj = $request->project;
|
||||
$opened = $prj->getIssueCountByStatus('open');
|
||||
$closed = $prj->getIssueCountByStatus('closed');
|
||||
|
||||
// Check if the tracker is empty
|
||||
if ($opened === 0 && $closed === 0) {
|
||||
$isTrackerEmpty = true;
|
||||
} else {
|
||||
if ($opened > 0 || $closed > 0) {
|
||||
// Issue status statistics
|
||||
$status['Open'] = array($opened, (int)(100 * $opened / ($opened + $closed)));
|
||||
$status['Closed'] = array($closed, (int)(100 * $closed / ($opened + $closed)));
|
||||
}
|
||||
|
||||
if ($opened > 0) {
|
||||
// Issue owner statistics
|
||||
$owners = $prj->getIssueCountByOwner('open');
|
||||
foreach ($owners as $user => $nb) {
|
||||
if ($user === '') {
|
||||
$key = __('Not assigned');
|
||||
$login = null;
|
||||
} else {
|
||||
$obj = Pluf::factory('Pluf_User')->getOne(array('filter'=>'id='.$user));
|
||||
$key = $obj->first_name . ' ' . $obj->last_name;
|
||||
$login = $obj->login;
|
||||
}
|
||||
$ownerStatistics[$key] = array($nb, (int)(100 * $nb / $opened), $login);
|
||||
}
|
||||
|
||||
// Issue class tag statistics
|
||||
$grouped_tags = $prj->getTagCloud();
|
||||
foreach ($grouped_tags as $class => $tags) {
|
||||
foreach ($tags as $tag) {
|
||||
$tagStatistics[$class][$tag->name] = array($tag->nb_use, $tag->id);
|
||||
}
|
||||
}
|
||||
foreach($tagStatistics as $k => $v) {
|
||||
$nbIssueInClass = 0;
|
||||
foreach ($v as $val) {
|
||||
$nbIssueInClass += $val[0];
|
||||
}
|
||||
foreach ($v as $kk => $vv) {
|
||||
$tagStatistics[$k][$kk] = array($vv[0], (int)(100 * $vv[0] / $nbIssueInClass), $vv[1]);
|
||||
}
|
||||
}
|
||||
|
||||
// Sort
|
||||
krsort($tagStatistics);
|
||||
arsort($ownerStatistics);
|
||||
}
|
||||
}
|
||||
|
||||
$title = sprintf(__('Summary of tracked issues in %s.'), (string) $prj);
|
||||
|
||||
return Pluf_Shortcuts_RenderToResponse('idf/issues/summary.html',
|
||||
array('page_title' => $title,
|
||||
'trackerEmpty' => $isTrackerEmpty,
|
||||
'project' => $prj,
|
||||
'tagStatistics' => $tagStatistics,
|
||||
'ownerStatistics' => $ownerStatistics,
|
||||
'status' => $status,
|
||||
),
|
||||
$request);
|
||||
}
|
||||
|
||||
/**
|
||||
* View the issues watch list of a given user.
|
||||
* Limited to a specified project
|
||||
@@ -240,42 +319,55 @@ class IDF_Views_Issue
|
||||
*
|
||||
* Only open issues are shown.
|
||||
*/
|
||||
public $myIssues_precond = array('IDF_Precondition::accessIssues',
|
||||
'Pluf_Precondition::loginRequired');
|
||||
public function myIssues($request, $match)
|
||||
public $userIssues_precond = array('IDF_Precondition::accessIssues');
|
||||
public function userIssues($request, $match)
|
||||
{
|
||||
$prj = $request->project;
|
||||
|
||||
$sql = new Pluf_SQL('login=%s', array($match[2]));
|
||||
$user = Pluf::factory('Pluf_User')->getOne(array('filter' => $sql->gen()));
|
||||
if ($user === null) {
|
||||
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Issue::index',
|
||||
array($prj->shortname));
|
||||
return new Pluf_HTTP_Response_Redirect($url);
|
||||
}
|
||||
|
||||
$otags = $prj->getTagIdsByStatus('open');
|
||||
$ctags = $prj->getTagIdsByStatus('closed');
|
||||
if (count($otags) == 0) $otags[] = 0;
|
||||
if (count($ctags) == 0) $ctags[] = 0;
|
||||
switch ($match[2]) {
|
||||
switch ($match[3]) {
|
||||
case 'submit':
|
||||
$title = sprintf(__('My Submitted %s Issues'), (string) $prj);
|
||||
$f_sql = new Pluf_SQL('project=%s AND submitter=%s AND status IN ('.implode(', ', $otags).')', array($prj->id, $request->user->id));
|
||||
$titleFormat = __('%1$s %2$s Submitted %3$s Issues');
|
||||
$f_sql = new Pluf_SQL('project=%s AND submitter=%s AND status IN ('.implode(', ', $otags).')', array($prj->id, $user->id));
|
||||
break;
|
||||
case 'submitclosed':
|
||||
$title = sprintf(__('My Closed Submitted %s Issues'), (string) $prj);
|
||||
$f_sql = new Pluf_SQL('project=%s AND submitter=%s AND status IN ('.implode(', ', $ctags).')', array($prj->id, $request->user->id));
|
||||
$titleFormat = __('%1$s %2$s Closed Submitted %3$s Issues');
|
||||
$f_sql = new Pluf_SQL('project=%s AND submitter=%s AND status IN ('.implode(', ', $ctags).')', array($prj->id, $user->id));
|
||||
break;
|
||||
case 'ownerclosed':
|
||||
$title = sprintf(__('My Closed Working %s Issues'), (string) $prj);
|
||||
$f_sql = new Pluf_SQL('project=%s AND owner=%s AND status IN ('.implode(', ', $ctags).')', array($prj->id, $request->user->id));
|
||||
$titleFormat = __('%1$s %2$s Closed Working %3$s Issues');
|
||||
$f_sql = new Pluf_SQL('project=%s AND owner=%s AND status IN ('.implode(', ', $ctags).')', array($prj->id, $user->id));
|
||||
break;
|
||||
default:
|
||||
$title = sprintf(__('My Working %s Issues'), (string) $prj);
|
||||
$f_sql = new Pluf_SQL('project=%s AND owner=%s AND status IN ('.implode(', ', $otags).')', array($prj->id, $request->user->id));
|
||||
$titleFormat = __('%1$s %2$s Working %3$s Issues');
|
||||
$f_sql = new Pluf_SQL('project=%s AND owner=%s AND status IN ('.implode(', ', $otags).')', array($prj->id, $user->id));
|
||||
break;
|
||||
}
|
||||
$title = sprintf($titleFormat,
|
||||
$user->first_name,
|
||||
$user->last_name,
|
||||
(string) $prj);
|
||||
|
||||
// Get stats about the issues
|
||||
$sql = new Pluf_SQL('project=%s AND submitter=%s AND status IN ('.implode(', ', $otags).')', array($prj->id, $request->user->id));
|
||||
$sql = new Pluf_SQL('project=%s AND submitter=%s AND status IN ('.implode(', ', $otags).')', array($prj->id, $user->id));
|
||||
$nb_submit = Pluf::factory('IDF_Issue')->getCount(array('filter'=>$sql->gen()));
|
||||
$sql = new Pluf_SQL('project=%s AND owner=%s AND status IN ('.implode(', ', $otags).')', array($prj->id, $request->user->id));
|
||||
$sql = new Pluf_SQL('project=%s AND owner=%s AND status IN ('.implode(', ', $otags).')', array($prj->id, $user->id));
|
||||
$nb_owner = Pluf::factory('IDF_Issue')->getCount(array('filter'=>$sql->gen()));
|
||||
// Closed issues
|
||||
$sql = new Pluf_SQL('project=%s AND submitter=%s AND status IN ('.implode(', ', $ctags).')', array($prj->id, $request->user->id));
|
||||
$sql = new Pluf_SQL('project=%s AND submitter=%s AND status IN ('.implode(', ', $ctags).')', array($prj->id, $user->id));
|
||||
$nb_submit_closed = Pluf::factory('IDF_Issue')->getCount(array('filter'=>$sql->gen()));
|
||||
$sql = new Pluf_SQL('project=%s AND owner=%s AND status IN ('.implode(', ', $ctags).')', array($prj->id, $request->user->id));
|
||||
$sql = new Pluf_SQL('project=%s AND owner=%s AND status IN ('.implode(', ', $ctags).')', array($prj->id, $user->id));
|
||||
$nb_owner_closed = Pluf::factory('IDF_Issue')->getCount(array('filter'=>$sql->gen()));
|
||||
|
||||
// Paginator to paginate the issues
|
||||
@@ -286,7 +378,7 @@ class IDF_Views_Issue
|
||||
'current_user' => $request->user);
|
||||
$pag->summary = __('This table shows the open issues.');
|
||||
$pag->forced_where = $f_sql;
|
||||
$pag->action = array('IDF_Views_Issue::myIssues', array($prj->shortname, $match[2]));
|
||||
$pag->action = array('IDF_Views_Issue::userIssues', array($prj->shortname, $match[2]));
|
||||
$pag->sort_order = array('modif_dtime', 'ASC'); // will be reverted
|
||||
$pag->sort_reverse_order = array('modif_dtime');
|
||||
$pag->sort_link_title = true;
|
||||
@@ -301,9 +393,10 @@ class IDF_Views_Issue
|
||||
$pag->items_per_page = 10;
|
||||
$pag->no_results_text = __('No issues were found.');
|
||||
$pag->setFromRequest($request);
|
||||
return Pluf_Shortcuts_RenderToResponse('idf/issues/my-issues.html',
|
||||
return Pluf_Shortcuts_RenderToResponse('idf/issues/userIssues.html',
|
||||
array('project' => $prj,
|
||||
'page_title' => $title,
|
||||
'login' => $user->login,
|
||||
'nb_submit' => $nb_submit,
|
||||
'nb_owner' => $nb_owner,
|
||||
'nb_submit_closed' => $nb_submit_closed,
|
||||
@@ -334,7 +427,7 @@ class IDF_Views_Issue
|
||||
array($prj->shortname, $issue->id));
|
||||
$issue->notify($request->conf);
|
||||
if ($api) return $issue;
|
||||
$request->user->setMessage(sprintf(__('<a href="%s">Issue %d</a> has been created.'), $url, $issue->id));
|
||||
$request->user->setMessage(sprintf(__('<a href="%1$s">Issue %2$d</a> has been created.'), $url, $issue->id));
|
||||
return new Pluf_HTTP_Response_Redirect($url);
|
||||
}
|
||||
} else {
|
||||
@@ -356,45 +449,142 @@ class IDF_Views_Issue
|
||||
|
||||
public $search_precond = array('IDF_Precondition::accessIssues');
|
||||
public function search($request, $match)
|
||||
{
|
||||
$query = !isset($request->REQUEST['q']) ? '' : $request->REQUEST['q'];
|
||||
return $this->doSearch($request, $query, 'open');
|
||||
}
|
||||
|
||||
public $searchStatus_precond = array('IDF_Precondition::accessIssues');
|
||||
public function searchStatus($request, $match)
|
||||
{
|
||||
$query = !isset($request->REQUEST['q']) ? '' : $request->REQUEST['q'];
|
||||
$status = in_array($match[2], array('open', 'closed')) ? $match[2] : 'open';
|
||||
return $this->doSearch($request, $query, $status);
|
||||
}
|
||||
|
||||
public $searchLabel_precond = array('IDF_Precondition::accessIssues');
|
||||
public function searchLabel($request, $match)
|
||||
{
|
||||
$query = !isset($request->REQUEST['q']) ? '' : $request->REQUEST['q'];
|
||||
$tag_id = intval($match[2]);
|
||||
$status = in_array($match[3], array('open', 'closed')) ? $match[3] : 'open';
|
||||
return $this->doSearch($request, $query, $status, $tag_id);
|
||||
}
|
||||
|
||||
private function doSearch($request, $query, $status, $tag_id=null)
|
||||
{
|
||||
$prj = $request->project;
|
||||
if (!isset($request->REQUEST['q']) or trim($request->REQUEST['q']) == '') {
|
||||
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Issue::index',
|
||||
array($prj->shortname));
|
||||
if (trim($query) == '') {
|
||||
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Issue::index', array($prj->shortname));
|
||||
return new Pluf_HTTP_Response_Redirect($url);
|
||||
}
|
||||
$q = $request->REQUEST['q'];
|
||||
$title = sprintf(__('Search Issues - %s'), $q);
|
||||
$issues = new Pluf_Search_ResultSet(IDF_Search::mySearch($q, $prj, 'IDF_Issue'));
|
||||
if (count($issues) > 100) {
|
||||
// no more than 100 results as we do not care
|
||||
$issues->results = array_slice($issues->results, 0, 100);
|
||||
|
||||
$tag = null;
|
||||
if ($tag_id !== null) {
|
||||
$tag = Pluf_Shortcuts_GetObjectOr404('IDF_Tag', $tag_id);
|
||||
}
|
||||
|
||||
$title = sprintf(__('Search issues - %s'), $query);
|
||||
if ($status === 'closed') {
|
||||
$title = sprintf(__('Search closed issues - %s'), $query);
|
||||
}
|
||||
|
||||
// using Plufs ResultSet implementation here is inefficient, because
|
||||
// it makes a SELECT for each item and does not allow for further
|
||||
// filtering neither, so we just return the ids and filter by them
|
||||
// and other things in the next round
|
||||
$results = IDF_Search::mySearch($query, $prj, 'IDF_Issue');
|
||||
|
||||
$issue_ids = array(0);
|
||||
foreach ($results as $result) {
|
||||
$issue_ids[] = $result['model_id'];
|
||||
}
|
||||
|
||||
$otags = $prj->getTagIdsByStatus($status);
|
||||
if (count($otags) == 0) $otags[] = 0;
|
||||
$sql = new Pluf_SQL(
|
||||
'id IN ('.implode(',', $issue_ids).') '.
|
||||
'AND status IN ('.implode(', ', $otags).') '.
|
||||
($tag_id !== null ? 'AND idf_tag_id='.$tag_id.' ' : '')
|
||||
);
|
||||
$model = new IDF_Issue();
|
||||
$issues = $model->getList(array('filter' => $sql->gen(), 'view' => 'join_tags'));
|
||||
|
||||
// we unfortunately loose the original sort order,
|
||||
// so we manually have to apply it here again
|
||||
$sorted_issues = new ArrayObject();
|
||||
$filtered_issue_ids = array(0);
|
||||
foreach ($issue_ids as $issue_id) {
|
||||
foreach ($issues as $issue) {
|
||||
if ($issue->id != $issue_id)
|
||||
continue;
|
||||
if (array_key_exists($issue_id, $sorted_issues))
|
||||
continue;
|
||||
$sorted_issues[$issue_id] = $issue;
|
||||
$filtered_issue_ids[] = $issue_id;
|
||||
}
|
||||
}
|
||||
|
||||
$pag = new Pluf_Paginator();
|
||||
$pag->items = $issues;
|
||||
$pag->class = 'recent-issues';
|
||||
$pag->item_extra_props = array('project_m' => $prj,
|
||||
'shortname' => $prj->shortname,
|
||||
'current_user' => $request->user);
|
||||
$pag->items = $sorted_issues;
|
||||
$pag->item_extra_props = array(
|
||||
'project_m' => $prj,
|
||||
'shortname' => $prj->shortname,
|
||||
'current_user' => $request->user
|
||||
);
|
||||
$pag->summary = __('This table shows the found issues.');
|
||||
$pag->action = array('IDF_Views_Issue::search', array($prj->shortname), array('q'=> $q));
|
||||
$pag->extra_classes = array('a-c', '', 'a-c', '');
|
||||
$list_display = array(
|
||||
'id' => __('Id'),
|
||||
array('summary', 'IDF_Views_Issue_SummaryAndLabels', __('Summary')),
|
||||
array('status', 'IDF_Views_Issue_ShowStatus', __('Status')),
|
||||
array('modif_dtime', 'Pluf_Paginator_DateAgo', __('Last Updated')),
|
||||
);
|
||||
$pag->configure($list_display);
|
||||
$pag->items_per_page = 100;
|
||||
$pag->configure(array(
|
||||
'id' => __('Id'),
|
||||
array('summary', 'IDF_Views_Issue_SummaryAndLabels', __('Summary')),
|
||||
array('status', 'IDF_Views_Issue_ShowStatus', __('Status')),
|
||||
array('modif_dtime', 'Pluf_Paginator_DateAgo', __('Last Updated')),
|
||||
));
|
||||
// disable paginating
|
||||
$pag->items_per_page = PHP_INT_MAX;
|
||||
$pag->no_results_text = __('No issues were found.');
|
||||
$pag->setFromRequest($request);
|
||||
$params = array('page_title' => $title,
|
||||
'issues' => $pag,
|
||||
'q' => $q,
|
||||
);
|
||||
return Pluf_Shortcuts_RenderToResponse('idf/issues/search.html', $params, $request);
|
||||
|
||||
if ($tag_id === null) {
|
||||
$pag->action = array('IDF_Views_Issue::searchStatus',
|
||||
array($prj->shortname, $status),
|
||||
array('q'=> $query),
|
||||
);
|
||||
} else {
|
||||
$pag->action = array('IDF_Views_Issue::searchLabel',
|
||||
array($prj->shortname, $tag_id, $status),
|
||||
array('q'=> $query),
|
||||
);
|
||||
}
|
||||
|
||||
// get stats about the issues
|
||||
$open = $prj->getIssueCountByStatus('open', $tag, $issue_ids);
|
||||
$closed = $prj->getIssueCountByStatus('closed', $tag, $issue_ids);
|
||||
|
||||
// query the available tags for this search result
|
||||
$all_tags = $prj->getTagsByIssues($filtered_issue_ids);
|
||||
$grouped_tags = array();
|
||||
foreach ($all_tags as $atag) {
|
||||
// group by class
|
||||
if (!array_key_exists($atag->class, $grouped_tags)) {
|
||||
$grouped_tags[$atag->class] = array();
|
||||
}
|
||||
$grouped_tags[$atag->class][] = $atag;
|
||||
}
|
||||
|
||||
$params = array(
|
||||
'page_title' => $title,
|
||||
'issues' => $pag,
|
||||
'query' => $query,
|
||||
'status' => $status,
|
||||
'open' => $open,
|
||||
'closed' => $closed,
|
||||
'tag' => $tag,
|
||||
'all_tags' => $grouped_tags,
|
||||
);
|
||||
|
||||
return Pluf_Shortcuts_RenderToResponse('idf/issues/search.html', $params, $request);
|
||||
}
|
||||
|
||||
public $view_precond = array('IDF_Precondition::accessIssues');
|
||||
@@ -408,7 +598,7 @@ class IDF_Views_Issue
|
||||
|
||||
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Issue::view',
|
||||
array($prj->shortname, $issue->id));
|
||||
$title = Pluf_Template::markSafe(sprintf(__('Issue <a href="%s">%d</a>: %s'), $url, $issue->id, $issue->summary));
|
||||
$title = Pluf_Template::markSafe(sprintf(__('Issue <a href="%1$s">%2$d</a>: %3$s'), $url, $issue->id, $issue->summary));
|
||||
$form = false; // The form is available only if logged in.
|
||||
$starred = false;
|
||||
$closed = in_array($issue->status, $prj->getTagIdsByStatus('closed'));
|
||||
@@ -432,7 +622,7 @@ class IDF_Views_Issue
|
||||
$issue->notify($request->conf, false);
|
||||
$comments = $issue->get_comments_list(array('order' => 'id DESC'));
|
||||
$url .= '#ic' . $comments[0]->id;
|
||||
$request->user->setMessage(sprintf(__('<a href="%s">Issue %d</a> has been updated.'), $url, $issue->id));
|
||||
$request->user->setMessage(sprintf(__('<a href="%1$s">Issue %2$d</a> has been updated.'), $url, $issue->id));
|
||||
return new Pluf_HTTP_Response_Redirect($url);
|
||||
}
|
||||
} else {
|
||||
@@ -542,6 +732,13 @@ class IDF_Views_Issue
|
||||
{
|
||||
$prj = $request->project;
|
||||
$status = $match[2];
|
||||
|
||||
if (mb_strtolower($status) == 'open') {
|
||||
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Issue::index',
|
||||
array($prj->shortname));
|
||||
return new Pluf_HTTP_Response_Redirect($url);
|
||||
}
|
||||
|
||||
$title = sprintf(__('%s Closed Issues'), (string) $prj);
|
||||
// Get stats about the issues
|
||||
$open = $prj->getIssueCountByStatus('open');
|
||||
@@ -674,7 +871,13 @@ class IDF_Views_Issue
|
||||
else {
|
||||
// ID-based search
|
||||
if (is_numeric($query)) {
|
||||
$sql = new Pluf_SQL('project=%s AND id LIKE %s', array($prj->id, $query.'%'));
|
||||
$sql = 'project=%s AND CAST(id AS VARCHAR) LIKE %s';
|
||||
// MySQL can't cast to VARCHAR and a CAST to CHAR converts
|
||||
// the whole number, not just the first digit
|
||||
if (strtolower(Pluf::f('db_engine')) == 'mysql') {
|
||||
$sql = 'project=%s AND CAST(id AS CHAR) LIKE %s';
|
||||
}
|
||||
$sql = new Pluf_SQL($sql, array($prj->id, $query.'%'));
|
||||
$tmp = Pluf::factory('IDF_Issue')->getList(array(
|
||||
'filter' => $sql->gen(),
|
||||
'order' => 'id ASC'
|
||||
@@ -790,9 +993,8 @@ class IDF_Views_Issue
|
||||
$r = $project->getRelationsFromConfig();
|
||||
$auto['auto_relation_types'] = '';
|
||||
foreach ($r as $rt) {
|
||||
$esc = Pluf_esc($rt);
|
||||
$auto['auto_relation_types'] .= sprintf('{ name: "%s", to: "%s" }, ',
|
||||
$esc, $esc);
|
||||
Pluf_esc(__($rt)), Pluf_esc($rt));
|
||||
}
|
||||
$auto['auto_relation_types'] = substr($auto['auto_relation_types'], 0, -2);
|
||||
return $auto;
|
||||
|
@@ -91,7 +91,7 @@ class IDF_Views_Review
|
||||
$review = $form->save();
|
||||
$urlr = Pluf_HTTP_URL_urlForView('IDF_Views_Review::view',
|
||||
array($prj->shortname, $review->id));
|
||||
$request->user->setMessage(sprintf(__('The <a href="%s">code review %d</a> has been created.'), $urlr, $review->id));
|
||||
$request->user->setMessage(sprintf(__('The <a href="%1$s">code review %2$d</a> has been created.'), $urlr, $review->id));
|
||||
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Review::index',
|
||||
array($prj->shortname));
|
||||
return new Pluf_HTTP_Response_Redirect($url);
|
||||
@@ -137,7 +137,7 @@ class IDF_Views_Review
|
||||
$prj->inOr404($review);
|
||||
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Review::view',
|
||||
array($prj->shortname, $review->id));
|
||||
$title = Pluf_Template::markSafe(sprintf(__('Review <a href="%s">%d</a>: %s'), $url, $review->id, $review->summary));
|
||||
$title = Pluf_Template::markSafe(sprintf(__('Review <a href="%1$s">%2$d</a>: %3$s'), $url, $review->id, $review->summary));
|
||||
|
||||
$patches = $review->get_patches_list();
|
||||
$patch = $patches[0];
|
||||
@@ -157,7 +157,7 @@ class IDF_Views_Review
|
||||
$review = $patch->get_review();
|
||||
$urlr = Pluf_HTTP_URL_urlForView('IDF_Views_Review::view',
|
||||
array($prj->shortname, $review->id));
|
||||
$request->user->setMessage(sprintf(__('Your <a href="%s">code review %d</a> has been published.'), $urlr, $review->id));
|
||||
$request->user->setMessage(sprintf(__('Your <a href="%1$s">code review %2$d</a> has been published.'), $urlr, $review->id));
|
||||
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Review::index',
|
||||
array($prj->shortname));
|
||||
$review_comment->notify($request->conf);
|
||||
|
@@ -58,7 +58,7 @@ class IDF_Views_Source
|
||||
$title = sprintf(__('%s Invalid Revision'), (string) $request->project);
|
||||
$scm = IDF_Scm::get($request->project);
|
||||
$branches = $scm->getBranches();
|
||||
|
||||
|
||||
$commit = $match[2];
|
||||
$params = array(
|
||||
'page_title' => $title,
|
||||
@@ -66,7 +66,8 @@ class IDF_Views_Source
|
||||
'commit' => $commit,
|
||||
'branches' => $branches,
|
||||
);
|
||||
return Pluf_Shortcuts_RenderToResponse('idf/source/invalid_revision.html',
|
||||
$scmConf = $request->conf->getVal('scm', 'git');
|
||||
return Pluf_Shortcuts_RenderToResponse('idf/source/'.$scmConf.'/invalid_revision.html',
|
||||
$params, $request);
|
||||
}
|
||||
|
||||
@@ -301,18 +302,13 @@ class IDF_Views_Source
|
||||
throw new Exception('could not retrieve commit object for '. $commit);
|
||||
}
|
||||
$title = sprintf(__('%s Commit Details'), (string) $request->project);
|
||||
$page_title = sprintf(__('%s Commit Details - %s'), (string) $request->project, $commit);
|
||||
$page_title = sprintf(__('%1$s Commit Details - %2$s'), (string) $request->project, $commit);
|
||||
$rcommit = IDF_Commit::getOrAdd($cobject, $request->project);
|
||||
$diff = new IDF_Diff($cobject->diff, $scm->getDiffPathStripLevel());
|
||||
$cobject->diff = null;
|
||||
$diff->parse();
|
||||
$scmConf = $request->conf->getVal('scm', 'git');
|
||||
try {
|
||||
$changes = $scm->getChanges($commit);
|
||||
} catch (Exception $e) {
|
||||
// getChanges is not yes supported by this backend.
|
||||
$changes = array();
|
||||
}
|
||||
$changes = $scm->getChanges($commit);
|
||||
$branches = $scm->getBranches();
|
||||
$in_branches = $scm->inBranches($cobject->commit, '');
|
||||
$tags = $scm->getTags();
|
||||
@@ -477,7 +473,7 @@ class IDF_Views_Source
|
||||
}
|
||||
|
||||
// compare two nodes of different types, directories ("tree")
|
||||
// should come before files ("blob")
|
||||
// should come before files ("blob")
|
||||
if ($a->type > $b->type) {
|
||||
return -1;
|
||||
}
|
||||
|
@@ -152,13 +152,11 @@ class IDF_Views_Wiki
|
||||
$pag->items_per_page = 25;
|
||||
$pag->no_results_text = __('No documentation pages were found.');
|
||||
$pag->setFromRequest($request);
|
||||
$tags = $prj->getTagCloud('wiki');
|
||||
return Pluf_Shortcuts_RenderToResponse('idf/wiki/index.html',
|
||||
array(
|
||||
'page_title' => $title,
|
||||
'label' => $tag,
|
||||
'pages' => $pag,
|
||||
'tags' => $tags,
|
||||
'dlabel' => $dtag,
|
||||
),
|
||||
$request);
|
||||
@@ -183,7 +181,7 @@ class IDF_Views_Wiki
|
||||
$page = $form->save();
|
||||
$urlpage = Pluf_HTTP_URL_urlForView('IDF_Views_Wiki::view',
|
||||
array($prj->shortname, $page->title));
|
||||
$request->user->setMessage(sprintf(__('The page <a href="%s">%s</a> has been created.'), $urlpage, Pluf_esc($page->title)));
|
||||
$request->user->setMessage(sprintf(__('The page <a href="%1$s">%2$s</a> has been created.'), $urlpage, Pluf_esc($page->title)));
|
||||
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Wiki::index',
|
||||
array($prj->shortname));
|
||||
return new Pluf_HTTP_Response_Redirect($url);
|
||||
@@ -321,7 +319,7 @@ class IDF_Views_Wiki
|
||||
$page = $form->save();
|
||||
$urlpage = Pluf_HTTP_URL_urlForView('IDF_Views_Wiki::view',
|
||||
array($prj->shortname, $page->title));
|
||||
$request->user->setMessage(sprintf(__('The page <a href="%s">%s</a> has been updated.'), $urlpage, Pluf_esc($page->title)));
|
||||
$request->user->setMessage(sprintf(__('The page <a href="%1$s">%2$s</a> has been updated.'), $urlpage, Pluf_esc($page->title)));
|
||||
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Wiki::index',
|
||||
array($prj->shortname));
|
||||
return new Pluf_HTTP_Response_Redirect($url);
|
||||
|
@@ -195,7 +195,7 @@ class IDF_WikiPage extends Pluf_Model
|
||||
$user = $stag->start($this->get_submitter(), $request, '', false);
|
||||
$out .= sprintf(__('<a href="%1$s" title="View page">%2$s</a>, %3$s'), $url, Pluf_esc($this->title), Pluf_esc($this->summary)).'</td>';
|
||||
$out .= "\n".'<tr class="extra"><td colspan="2">
|
||||
<div class="helptext right">'.sprintf(__('Creation of <a href="%s">page %s</a>, by %s'), $url, Pluf_esc($this->title), $user).'</div></td></tr>';
|
||||
<div class="helptext right">'.sprintf(__('Creation of <a href="%1$s">page %2$s</a>, by %3$s'), $url, Pluf_esc($this->title), $user).'</div></td></tr>';
|
||||
return Pluf_Template::markSafe($out);
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ class IDF_WikiPage extends Pluf_Model
|
||||
.Pluf_HTTP_URL_urlForView('IDF_Views_Wiki::view',
|
||||
array($request->project->shortname,
|
||||
$this->title));
|
||||
$title = sprintf(__('%s: Documentation page %s added - %s'),
|
||||
$title = sprintf(__('%1$s: Documentation page %2$s added - %3$s'),
|
||||
$request->project->name,
|
||||
$this->title, $this->summary);
|
||||
$date = Pluf_Date::gmDateToGmString($this->creation_dtime);
|
||||
@@ -221,4 +221,4 @@ class IDF_WikiPage extends Pluf_Model
|
||||
$tmpl = new Pluf_Template('idf/wiki/feedfragment.xml');
|
||||
return $tmpl->render($context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -186,7 +186,7 @@ class IDF_WikiRevision extends Pluf_Model
|
||||
}
|
||||
$out .= '</td></tr>';
|
||||
$out .= "\n".'<tr class="extra"><td colspan="2">
|
||||
<div class="helptext right">'.sprintf(__('Change of <a href="%s">%s</a>, by %s'), $url, Pluf_esc($page->title), $user).'</div></td></tr>';
|
||||
<div class="helptext right">'.sprintf(__('Change of <a href="%1$s">%2$s</a>, by %3$s'), $url, Pluf_esc($page->title), $user).'</div></td></tr>';
|
||||
return Pluf_Template::markSafe($out);
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ class IDF_WikiRevision extends Pluf_Model
|
||||
array($request->project->shortname,
|
||||
$page->title));
|
||||
}
|
||||
$title = sprintf(__('%s: Documentation page %s updated - %s'),
|
||||
$title = sprintf(__('%1$s: Documentation page %2$s updated - %3$s'),
|
||||
$request->project->name,
|
||||
$page->title, $page->summary);
|
||||
$date = Pluf_Date::gmDateToGmString($this->creation_dtime);
|
||||
@@ -259,13 +259,13 @@ class IDF_WikiRevision extends Pluf_Model
|
||||
);
|
||||
if ($create) {
|
||||
$template = 'idf/wiki/wiki-created-email.txt';
|
||||
$title = sprintf(__('New Documentation Page %s - %s (%s)'),
|
||||
$title = sprintf(__('New Documentation Page %1$s - %2$s (%3$s)'),
|
||||
$this->get_wikipage()->title,
|
||||
$this->get_wikipage()->summary,
|
||||
$this->get_wikipage()->get_project()->shortname);
|
||||
} else {
|
||||
$template = 'idf/wiki/wiki-updated-email.txt';
|
||||
$title = sprintf(__('Documentation Page Changed %s - %s (%s)'),
|
||||
$title = sprintf(__('Documentation Page Changed %1$s - %2$s (%3$s)'),
|
||||
$this->get_wikipage()->title,
|
||||
$this->get_wikipage()->summary,
|
||||
$this->get_wikipage()->get_project()->shortname);
|
||||
|
@@ -119,7 +119,7 @@ $cfg['time_zone'] = 'Europe/Berlin';
|
||||
# Configure which languages should be available in your forge.
|
||||
# If you want to enable an additional language, ensure that the
|
||||
# language file in question resides in 'src/IDF/locale'.
|
||||
$cfg['languages'] = array('en', 'fr', 'de', 'es_ES');
|
||||
$cfg['languages'] = array('en', 'fr', 'de', 'es_ES', 'ru');
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------- #
|
||||
|
@@ -118,11 +118,26 @@ $ctl[] = array('regex' => '#^/p/([\-\w]+)/issues/$#',
|
||||
'model' => 'IDF_Views_Issue',
|
||||
'method' => 'index');
|
||||
|
||||
$ctl[] = array('regex' => '#^/p/([\-\w]+)/issues/summary/$#',
|
||||
'base' => $base,
|
||||
'model' => 'IDF_Views_Issue',
|
||||
'method' => 'summary');
|
||||
|
||||
$ctl[] = array('regex' => '#^/p/([\-\w]+)/issues/search/$#',
|
||||
'base' => $base,
|
||||
'model' => 'IDF_Views_Issue',
|
||||
'method' => 'search');
|
||||
|
||||
$ctl[] = array('regex' => '#^/p/([\-\w]+)/issues/search/status/(\w+)/$#',
|
||||
'base' => $base,
|
||||
'model' => 'IDF_Views_Issue',
|
||||
'method' => 'searchStatus');
|
||||
|
||||
$ctl[] = array('regex' => '#^/p/([\-\w]+)/issues/search/label/(\d+)/(\w+)/$#',
|
||||
'base' => $base,
|
||||
'model' => 'IDF_Views_Issue',
|
||||
'method' => 'searchLabel');
|
||||
|
||||
$ctl[] = array('regex' => '#^/p/([\-\w]+)/issues/(\d+)/$#',
|
||||
'base' => $base,
|
||||
'model' => 'IDF_Views_Issue',
|
||||
@@ -148,10 +163,10 @@ $ctl[] = array('regex' => '#^/p/([\-\w]+)/issues/create/$#',
|
||||
'model' => 'IDF_Views_Issue',
|
||||
'method' => 'create');
|
||||
|
||||
$ctl[] = array('regex' => '#^/p/([\-\w]+)/issues/my/(\w+)/$#',
|
||||
$ctl[] = array('regex' => '#^/p/([\-\w]+)/issues/(.*)/(\w+)/$#',
|
||||
'base' => $base,
|
||||
'model' => 'IDF_Views_Issue',
|
||||
'method' => 'myIssues');
|
||||
'method' => 'userIssues');
|
||||
|
||||
$ctl[] = array('regex' => '#^/p/([\-\w]+)/issues/attachment/(\d+)/(.*)$#',
|
||||
'base' => $base,
|
||||
@@ -299,11 +314,16 @@ $ctl[] = array('regex' => '#^/p/([\-\w]+)/downloads/(\d+)/$#',
|
||||
'model' => 'IDF_Views_Download',
|
||||
'method' => 'view');
|
||||
|
||||
$ctl[] = array('regex' => '#^/p/([\-\w]+)/downloads/(\d+)/get/$#',
|
||||
$ctl[] = array('regex' => '#^/p/([\-\w]+)/downloads/get/(.+)$#',
|
||||
'base' => $base,
|
||||
'model' => 'IDF_Views_Download',
|
||||
'method' => 'download');
|
||||
|
||||
$ctl[] = array('regex' => '#^/p/([\-\w]+)/downloads/(\d+)/get/$#',
|
||||
'base' => $base,
|
||||
'model' => 'IDF_Views_Download',
|
||||
'method' => 'downloadById');
|
||||
|
||||
$ctl[] = array('regex' => '#^/p/([\-\w]+)/downloads/create/$#',
|
||||
'base' => $base,
|
||||
'model' => 'IDF_Views_Download',
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
4587
src/IDF/locale/pt_BR/idf.po
Normal file
4587
src/IDF/locale/pt_BR/idf.po
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
4581
src/IDF/locale/tr/idf.po
Normal file
4581
src/IDF/locale/tr/idf.po
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -14,7 +14,7 @@
|
||||
<tr>
|
||||
<th> </th>
|
||||
<th class="a-c"><strong>{trans 'Access Rights'}</strong></th>
|
||||
<th class="a-c"><strong>{trans 'Notification Email'}</strong></th>
|
||||
<th class="a-c"><strong>{trans 'Notification Emails'}</strong></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><strong>{$form.f.downloads_access_rights.labelTag}:</strong></th>
|
||||
|
@@ -70,7 +70,6 @@
|
||||
<div id="ft">{block foot}{/block}</div>
|
||||
</div>
|
||||
{include 'idf/js-hotkeys.html'}
|
||||
{include 'idf/list-filter.html'}
|
||||
{block javascript}{/block}
|
||||
{if $project}
|
||||
<script type="text/javascript" charset="utf-8">{literal}
|
||||
|
@@ -49,7 +49,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="yui-b context">{block context}{/block}</div>
|
||||
<div class="yui-b context" id="context">{block context}{/block}</div>
|
||||
</div>
|
||||
<div id="ft">{block foot}{/block}</div>
|
||||
</div>
|
||||
|
@@ -66,7 +66,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="yui-b context">{block context}{/block}</div>
|
||||
<div class="yui-b context" id="context">{block context}{/block}</div>
|
||||
</div>
|
||||
<div id="ft">{block foot}{/block}</div>
|
||||
</div>
|
||||
@@ -84,6 +84,21 @@ $(document).ready(function(){
|
||||
else if (frag.length > 3 && frag.substring(0, 3) == '#ic') {
|
||||
$(frag).addClass("issue-comment-focus");
|
||||
}
|
||||
|
||||
var contextTop = $('div#context').position().top;
|
||||
var contextFixEnabled = true;
|
||||
$(window).scroll(function() {
|
||||
if (!contextFixEnabled || $(window).scrollTop() < contextTop)
|
||||
$('div#context').css('position', 'relative');
|
||||
else
|
||||
$('div#context').css('position', 'fixed');
|
||||
});
|
||||
$(window).resize(function() {
|
||||
contextFixEnabled =
|
||||
$('div#context').offset().top + $('div#context').height() <
|
||||
$(window).height();
|
||||
});
|
||||
$(window).resize();
|
||||
});
|
||||
//]]>{/literal}
|
||||
</script>{/if}
|
||||
|
@@ -3,7 +3,7 @@
|
||||
{block body}
|
||||
|
||||
<div class="download-file">
|
||||
<a href="{url 'IDF_Views_Download::download', array($project.shortname, $file.id)}">{$file}</a> - {$file.filesize|size}
|
||||
<a href="{url 'IDF_Views_Download::download', array($project.shortname, $file.file)}">{$file}</a> - {$file.filesize|size}
|
||||
</div>
|
||||
|
||||
<p>{blocktrans}<strong>Attention!</strong> If you want to delete a specific version of your software, maybe, someone is depending on this specific version to run his systems. Are you sure, you will not affect anybody when removing this file?{/blocktrans}</p>
|
||||
@@ -15,7 +15,7 @@
|
||||
<table class="form" summary="">
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td><input type="submit" value="{trans 'Delete File'}" name="submit" /> | <a href="{url 'IDF_Views_Download::index', array($project.shortname)}">{trans 'Cancel'}</a>
|
||||
<td><input type="submit" value="{trans 'Delete File'}" name="submit" /> | <a href="{url 'IDF_Views_Download::index', array($project.shortname)}">{trans 'Cancel'}</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@@ -4,7 +4,9 @@
|
||||
|
||||
<div class="download-file">
|
||||
{if $deprecated}<p class="smaller">{blocktrans}<strong>Attention!</strong> This file is marked as deprecated, download it only if you are sure you need this specific version.{/blocktrans}</p>{/if}
|
||||
<a href="{url 'IDF_Views_Download::download', array($project.shortname, $file.id)}">{$file}</a> - {$file.filesize|size}
|
||||
<a href="{url 'IDF_Views_Download::download', array($project.shortname, $file.file)}">{$file}</a> - {$file.filesize|size}
|
||||
<br />
|
||||
<span class="helptext">{trans 'md5:'} {$file.md5}</span>
|
||||
</div>
|
||||
{if $file.changelog}
|
||||
<h2 class="changes">{trans 'Changes'}</h2>
|
||||
|
@@ -8,12 +8,18 @@
|
||||
<th>{trans "address"}</th>
|
||||
<th>{trans "port"}</th>
|
||||
</tr>
|
||||
{if count($connections) == 0}
|
||||
<tr>
|
||||
<td colspan="2" align="center">{trans 'No connections found.'}</td>
|
||||
</tr>
|
||||
{else}
|
||||
{foreach $connections as $connection}
|
||||
<tr>
|
||||
<td>{$connection.address}</td>
|
||||
<td>{$connection.port}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</table>
|
||||
{/block}
|
||||
|
||||
|
@@ -9,6 +9,11 @@
|
||||
<th>{trans "status"}</th>
|
||||
<th>{trans "action"}</th>
|
||||
</tr>
|
||||
{if count($servers) == 0}
|
||||
<tr>
|
||||
<td colspan="3" align="center">{trans 'No monotone servers configured.'}</td>
|
||||
</tr>
|
||||
{else}
|
||||
{foreach $servers as $server}
|
||||
<tr>
|
||||
<td>{$server.name}</td>
|
||||
@@ -31,6 +36,7 @@
|
||||
{/if}
|
||||
</tr>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</table>
|
||||
{/block}
|
||||
|
||||
|
@@ -2,11 +2,15 @@
|
||||
{block tabissues} class="active"{/block}
|
||||
{block subtabs}
|
||||
<div id="sub-tabs">
|
||||
<a {if $inOpenIssues}class="active" {/if}href="{url 'IDF_Views_Issue::index', array($project.shortname)}">{trans 'Open Issues'}</a>
|
||||
{if !$user.isAnonymous()} | <a {if $inCreate}class="active" {/if}href="{url 'IDF_Views_Issue::create', array($project.shortname)}">{trans 'New Issue'}</a> | <a {if $inMyIssues}class="active" {/if}href="{url 'IDF_Views_Issue::myIssues', array($project.shortname, 'submit')}">{trans 'My Issues'}</a>
|
||||
| <a {if $inWatchList}class="active" {/if}href="{url 'IDF_Views_Issue::watchList', array($project.shortname, 'open')}">{trans 'My watch list'}</a>{/if} |
|
||||
<form class="star" action="{url 'IDF_Views_Issue::search', array($project.shortname)}" method="get">
|
||||
<input accesskey="4" type="text" value="{$q}" name="q" size="20" />
|
||||
<a {if $inSummaryIssues}class="active" {/if}href="{url 'IDF_Views_Issue::summary', array($project.shortname)}">{trans 'Summary'}</a>
|
||||
| <a {if $inAllIssues}class="active" {/if}href="{url 'IDF_Views_Issue::index', array($project.shortname)}">{trans 'All Issues'}</a>
|
||||
{if !$user.isAnonymous()}
|
||||
| <a {if $inMyIssues}class="active" {/if}href="{url 'IDF_Views_Issue::userIssues', array($project.shortname, $user.login, 'submit')}">{trans 'My Issues'}</a>
|
||||
| <a {if $inWatchList}class="active" {/if}href="{url 'IDF_Views_Issue::watchList', array($project.shortname, 'open')}">{trans 'My watch list'}</a>
|
||||
| <a {if $inCreate}class="active" {/if}href="{url 'IDF_Views_Issue::create', array($project.shortname)}">{trans 'New Issue'}</a>
|
||||
{/if}
|
||||
| <form class="star" action="{url 'IDF_Views_Issue::search', array($project.shortname)}" method="get">
|
||||
<input accesskey="4" type="text" value="{$query}" name="q" size="20" />
|
||||
<input type="submit" name="s" value="{trans 'Search'}" />
|
||||
</form>
|
||||
{if $inIssue} |
|
||||
|
@@ -1,5 +1,5 @@
|
||||
{extends "idf/issues/base.html"}
|
||||
{block docclass}yui-t1{/block}
|
||||
{block docclass}yui-t1{assign $inAllIssues=true}{/block}
|
||||
{block body}
|
||||
{$issues.render}
|
||||
{if !$user.isAnonymous()}
|
||||
@@ -8,16 +8,15 @@
|
||||
|
||||
{/block}
|
||||
{block context}
|
||||
<p><strong>{trans 'Label:'}</strong>
|
||||
{aurl 'url', 'IDF_Views_Issue::listLabel', array($project.shortname, $label.id, 'open')}
|
||||
<a href="{$url}" class="label"><strong>{$label.class}:</strong>{$label.name}</a></p>
|
||||
{aurl 'open_url', 'IDF_Views_Issue::listLabel', array($project.shortname, $label.id, 'open')}
|
||||
{aurl 'closed_url', 'IDF_Views_Issue::listLabel', array($project.shortname, $label.id, 'closed')}
|
||||
{blocktrans}<p><strong>Open issues:</strong> <a href="{$open_url}">{$open}</a></p>
|
||||
<p><strong>Closed issues:</strong> <a href="{$closed_url}">{$closed}</a></p>
|
||||
{/blocktrans}{if $completion}
|
||||
{/blocktrans}
|
||||
<p><strong>{trans 'Label:'}</strong>
|
||||
{aurl 'url', 'IDF_Views_Issue::listLabel', array($project.shortname, $label.id, 'open')}
|
||||
<a href="{$url}" class="label"><strong>{$label.class}:</strong>{$label.name}</a></p>
|
||||
{if $completion}
|
||||
<p><strong>{trans 'Completion:'}</strong> {$completion}</p>
|
||||
{/if}
|
||||
|
||||
|
||||
{/block}
|
||||
|
@@ -10,12 +10,22 @@
|
||||
{if $attachments.count() > 0}
|
||||
<hr align="left" class="attach" />
|
||||
<ul>
|
||||
{foreach $attachments as $a}<li><a href="{url 'IDF_Views_Issue::viewAttachment', array($project.shortname, $a.id, $a.filename)}">{$a.filename}</a> - {$a.filesize|ssize}</li>{/foreach}
|
||||
{foreach $attachments as $a}<li><a href="{url 'IDF_Views_Issue::viewAttachment', array($project.shortname, $a.id, $a.filename)}">{$a.filename}</a> - {$a.filesize|ssize}</li>{/foreach}
|
||||
</ul>{/if}
|
||||
{if $c.changes}
|
||||
{foreach $c.changes as $w => $v}
|
||||
<strong>{if $w == 'su'}{trans 'Summary:'}{/if}{if $w == 'st'}{trans 'Status:'}{/if}{if $w == 'ow'}{trans 'Owner:'}{/if}{if $w == 'lb'}{trans 'Labels:'}{/if}</strong> {if $w == 'lb'}{assign $l = implode(', ', $v)}{$l}{else}{$v}{/if}<br />
|
||||
<strong>{if $w == 'su'}{trans 'Summary:'}{/if}{if $w == 'st'}{trans 'Status:'}{/if}{if $w == 'ow'}{trans 'Owner:'}{/if}{if $w == 'lb'}{trans 'Labels:'}{/if}{if $w == 'rel'}{trans 'Relations:'}{/if}</strong>
|
||||
{if $w == 'lb' or $w == 'rel'}
|
||||
{foreach $v as $t => $ls}
|
||||
{foreach $ls as $l}
|
||||
{if $t == 'rem'}<s>{/if}{$l}{if $t == 'rem'}</s>{/if}
|
||||
{/foreach}
|
||||
{/foreach}
|
||||
{else}
|
||||
{$v}
|
||||
{/if}<br />
|
||||
{/foreach}
|
||||
{/if}
|
||||
</div></content>
|
||||
</entry>
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
{extends "idf/issues/base.html"}
|
||||
{block docclass}yui-t2{assign $inOpenIssues=true}{/block}
|
||||
{block docclass}yui-t2{assign $inAllIssues=true}{/block}
|
||||
{block body}
|
||||
{$issues.render}
|
||||
{if !$user.isAnonymous()}
|
||||
@@ -13,6 +13,5 @@
|
||||
{blocktrans}<p><strong>Open issues:</strong> <a href="{$open_url}">{$open}</a></p>
|
||||
<p><strong>Closed issues:</strong> <a href="{$closed_url}">{$closed}</a></p>{/blocktrans}
|
||||
{assign $cloud_url = 'IDF_Views_Issue::listLabel'}
|
||||
{assign $cloud = 'issues'}
|
||||
{include 'idf/tags-cloud.html'}
|
||||
{/block}
|
||||
|
@@ -16,7 +16,7 @@
|
||||
|
||||
{if strlen($c.content) > 0}{$c.content|safe}{/if}{if $c.changedIssue()}
|
||||
{foreach $c.changes as $w => $v}
|
||||
{if $w == 'su'}{trans 'Summary:'}{/if}{if $w == 'st'}{trans 'Status:'}{/if}{if $w == 'ow'}{trans 'Owner:'}{/if}{if $w == 'lb'}{trans 'Labels:'}{/if} {if $w == 'lb'}{assign $l = implode(', ', $v)}{$l}{else}{$v}{/if}{/foreach}{/if}{assign $attachments = $c.get_attachment_list()}{if $attachments.count() > 0}
|
||||
{if $w == 'su'}{trans 'Summary:'}{/if}{if $w == 'st'}{trans 'Status:'}{/if}{if $w == 'ow'}{trans 'Owner:'}{/if}{if $w == 'lb'}{trans 'Labels:'}{/if}{if $w == 'rel'}{trans 'Relations:'}{/if} {if $w == 'lb' or $w == 'rel'}{foreach $v as $t => $ls}{foreach $ls as $l}{if $t == 'rem'}-{/if}{$l} {/foreach}{/foreach}{else}{$v}{/if}{/foreach}{/if}{assign $attachments = $c.get_attachment_list()}{if $attachments.count() > 0}
|
||||
|
||||
{trans 'Attachments:'}{foreach $attachments as $a}
|
||||
- {$a.filename|safe} - {$a.filesize|ssize}
|
||||
|
@@ -68,6 +68,9 @@
|
||||
return row.to;
|
||||
}
|
||||
});
|
||||
{/literal}
|
||||
{if $issue}
|
||||
{literal}
|
||||
$("#id_relation_issue" + idx).autocomplete("{/literal}{url 'IDF_Views_Issue::autoCompleteIssueList', array($project.shortname, $issue.id)}{literal}", {
|
||||
minChars: 0,
|
||||
width: 310,
|
||||
@@ -83,6 +86,9 @@
|
||||
return row[1];
|
||||
}
|
||||
});
|
||||
{/literal}
|
||||
{/if}
|
||||
{literal}
|
||||
}
|
||||
});
|
||||
{/literal} //-->
|
||||
|
@@ -8,5 +8,25 @@
|
||||
|
||||
{/block}
|
||||
{block context}
|
||||
<p><strong>{trans 'Found issues:'}</strong> {$issues.nb_items}</p>
|
||||
{aurl 'open_url', 'IDF_Views_Issue::searchStatus', array($project.shortname, 'open'), array('q' => $query)}
|
||||
{aurl 'closed_url', 'IDF_Views_Issue::searchStatus', array($project.shortname, 'closed'), array('q' => $query)}
|
||||
{if $tag != null}
|
||||
{aurl 'open_url', 'IDF_Views_Issue::searchLabel', array($project.shortname, $tag.id, 'open'), array('q' => $query)}
|
||||
{aurl 'closed_url', 'IDF_Views_Issue::searchLabel', array($project.shortname, $tag.id, 'closed'), array('q' => $query)}
|
||||
{/if}
|
||||
{blocktrans}
|
||||
<p><strong>Found open issues:</strong> <a href="{$open_url}">{$open}</a></p>
|
||||
<p><strong>Found closed issues:</strong> <a href="{$closed_url}">{$closed}</a></p>{/blocktrans}
|
||||
{if $tag !== null}
|
||||
{blocktrans}<p><strong>Label:</strong>
|
||||
<a href="{$open_url}" class="label"><strong>{$tag.class}:</strong>{$tag.name}</a></p>{/blocktrans}
|
||||
{else}
|
||||
{* yes, this is duplicated from tags-cloud.html, but the code there cannot be easily overridden *}
|
||||
<div id="tagscloud" class="smaller"><dl>{foreach $all_tags as $class => $labels}
|
||||
<dt class="label">{$class}</dt>
|
||||
{foreach $labels as $idx => $label}
|
||||
{aurl 'url', 'IDF_Views_Issue::searchLabel', array($project.shortname, $label.id, $status), array('q'=> $query)}
|
||||
<dd><a href="{$url}" class="label">{$label.name}{if $idx != count($labels) - 1},{/if}</a></dd>
|
||||
{/foreach}{/foreach}</dl></p>
|
||||
{/if}
|
||||
{/block}
|
||||
|
100
src/IDF/templates/idf/issues/summary.html
Normal file
100
src/IDF/templates/idf/issues/summary.html
Normal file
@@ -0,0 +1,100 @@
|
||||
{extends "idf/issues/base.html"}
|
||||
|
||||
{block docclass}yui-t2{assign $inSummaryIssues=true}{/block}
|
||||
|
||||
{block body}
|
||||
{if $trackerEmpty}
|
||||
{aurl 'create_url', 'IDF_Views_Issue::create', array($project.shortname)}
|
||||
<p>{blocktrans}The issue tracker is empty.<br /><a href="{$create_url}">Create your first issue</a>.{/blocktrans}</p>
|
||||
{else}
|
||||
<div class='issue-summary'>
|
||||
{foreach $tagStatistics as $key => $class}
|
||||
<div>
|
||||
<h2>{blocktrans}Unresolved: By {$key}{/blocktrans}</h2>
|
||||
<table class='issue-summary'>
|
||||
<tbody>
|
||||
{foreach $class as $key => $value}
|
||||
<tr>
|
||||
<td class="name"><a href="{url 'IDF_Views_Issue::listLabel', array($project.shortname, $value[2], 'open')}">{$key}</a></td>
|
||||
<td class="count">{$value[0]}</td>
|
||||
<td class="graph">
|
||||
<table class='graph'>
|
||||
<tbody><tr>
|
||||
<td style="width:{$value[1] * 0.8 + 1}%" class="graph-color" valign="center">
|
||||
<div class="colour-bar"></div>
|
||||
</td>
|
||||
<td class="graph-percent">{$value[1]}%</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
|
||||
<div class='issue-summary'>
|
||||
{if $status}
|
||||
<div>
|
||||
<h2>{blocktrans}Status Summary{/blocktrans}</h2>
|
||||
<table class='issue-summary'>
|
||||
<tbody>
|
||||
{foreach $status as $key => $value}
|
||||
<tr>
|
||||
<td class="name"><a href="{url 'IDF_Views_Issue::listStatus', array($project.shortname, $key)}">{$key}</a></td>
|
||||
<td class="count">{$value[0]}</td>
|
||||
<td class="graph">
|
||||
<table class='graph'>
|
||||
<tbody><tr>
|
||||
<td style="width:{$value[1] * 0.8 + 1}%" class="graph-color" valign="center">
|
||||
<div class="colour-bar"></div>
|
||||
</td>
|
||||
<td class="graph-percent">{$value[1]}%</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{if $ownerStatistics}
|
||||
<div>
|
||||
<h2>{blocktrans}Unresolved: By Assignee{/blocktrans}</h2>
|
||||
<table class='issue-summary'>
|
||||
<tbody>
|
||||
{foreach $ownerStatistics as $key => $value}
|
||||
<tr>
|
||||
<td class="name">
|
||||
{if !empty($value[2])}
|
||||
{aurl 'url', 'IDF_Views_Issue::userIssues', array($project.shortname, $value[2], 'owner')}
|
||||
<a href="{$url}">{$key}</a>
|
||||
{else}{$key}{/if}
|
||||
</td>
|
||||
<td class="count">{$value[0]}</td>
|
||||
<td class="graph">
|
||||
<table class='graph'>
|
||||
<tbody><tr>
|
||||
<td style="width:{$value[1] * 0.8 + 1}%" class="graph-color" valign="center">
|
||||
<div class="colour-bar"></div>
|
||||
</td>
|
||||
<td class="graph-percent">{$value[1]}%</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
{/block}
|
@@ -1,5 +1,5 @@
|
||||
{extends "idf/issues/base.html"}
|
||||
{block docclass}yui-t2{assign $inMyIssues = true}{/block}
|
||||
{block docclass}yui-t2{if $user.login == $login}{assign $inMyIssues = true}{/if}{/block}
|
||||
{block body}
|
||||
{$issues.render}
|
||||
{if !$user.isAnonymous()}
|
||||
@@ -8,10 +8,10 @@
|
||||
|
||||
{/block}
|
||||
{block context}
|
||||
{aurl 'owner_url', 'IDF_Views_Issue::myIssues', array($project.shortname, 'owner')}
|
||||
{aurl 'submit_url', 'IDF_Views_Issue::myIssues', array($project.shortname, 'submit')}
|
||||
{aurl 'owner_closed_url', 'IDF_Views_Issue::myIssues', array($project.shortname, 'ownerclosed')}
|
||||
{aurl 'submit_closed_url', 'IDF_Views_Issue::myIssues', array($project.shortname, 'submitclosed')}
|
||||
{aurl 'owner_url', 'IDF_Views_Issue::userIssues', array($project.shortname, $login, 'owner')}
|
||||
{aurl 'submit_url', 'IDF_Views_Issue::userIssues', array($project.shortname, $login, 'submit')}
|
||||
{aurl 'owner_closed_url', 'IDF_Views_Issue::userIssues', array($project.shortname, $login, 'ownerclosed')}
|
||||
{aurl 'submit_closed_url', 'IDF_Views_Issue::userIssues', array($project.shortname, $login, 'submitclosed')}
|
||||
<p><strong>{trans 'Submitted issues:'}</strong> <a href="{$submit_url}">{$nb_submit}</a>
|
||||
{if $nb_submit_closed}<br /><span class="helptext">{blocktrans $nb_submit_closed}See the <a href="{$submit_closed_url}">{$nb_submit_closed} closed</a>.{plural}See the <a href="{$submit_closed_url}">{$nb_submit_closed} closed</a>.{/blocktrans}</span>{/if}</p>
|
||||
{if $nb_owner > 0}
|
@@ -3,11 +3,11 @@
|
||||
{block body}
|
||||
<div class="issue-prev-next">
|
||||
{if $previous_issue_id}
|
||||
<a href="{url 'IDF_Views_Issue::view', array($project.shortname, $previous_issue_id)}" title="{if $closed}{trans 'Click here to view the previous closed issue'}{else}{trans 'Click here to view the previous open issue'}{/if}">Previous issue</a>
|
||||
<a href="{url 'IDF_Views_Issue::view', array($project.shortname, $previous_issue_id)}" title="{if $closed}{trans 'View the previous closed issue'}{else}{trans 'View the previous open issue'}{/if}">Previous issue</a>
|
||||
{/if}
|
||||
{if $previous_issue_id and $next_issue_id} - {/if}
|
||||
{if $next_issue_id}
|
||||
<a href="{url 'IDF_Views_Issue::view', array($project.shortname, $next_issue_id)}" title="{if $closed}{trans 'Click here to view the next closed issue'}{else}{trans 'Click here to view the next open issue'}{/if}">Next issue</a>
|
||||
<a href="{url 'IDF_Views_Issue::view', array($project.shortname, $next_issue_id)}" title="{if $closed}{trans 'View the next closed issue'}{else}{trans 'View the next open issue'}{/if}">Next issue</a>
|
||||
{/if}
|
||||
</div>
|
||||
{assign $i = 0}
|
||||
@@ -17,7 +17,7 @@
|
||||
{assign $submitter_data = $c.get_submitter_data()}
|
||||
<div class="issue-comment{if $i == 0} issue-comment-first{/if}{if $i == ($nc-1)} issue-comment-last{/if}" id="ic{$c.id}">
|
||||
{if $submitter_data.avatar != ''}
|
||||
<img style="float:right; position: relative; max-height: 60px; max-width: 60px;" src="{media}/upload/avatars/{$submitter_data.avatar}" alt=" " />
|
||||
<img style="float:right; position: relative; max-height: 60px; max-width: 60px;" src="{upload}/avatars/{$submitter_data.avatar}" alt=" " />
|
||||
{else}
|
||||
<img style="float:right; position: relative; max-height: 60px; max-width: 60px;" src="http://www.gravatar.com/avatar/{$submitter.email|md5}.jpg?s=60&d={media}/idf/img/spacer.gif" alt=" " />
|
||||
{/if}
|
||||
@@ -190,6 +190,7 @@
|
||||
{if count($related_issues) > 0}
|
||||
{foreach $related_issues as $verb => $rel_issues}
|
||||
<p>
|
||||
{assign $verb = __($verb)}
|
||||
<strong>{blocktrans}This issue {$verb}{/blocktrans}</strong><br />
|
||||
{foreach $rel_issues as $rel_issue}
|
||||
<span class="label">
|
||||
|
@@ -10,8 +10,8 @@
|
||||
{if $hasWikiAccess}{hotkey 'Shift+o', 'IDF_Views_Wiki::index', array($project.shortname)}{/if}
|
||||
{if $hasSourceAccess}{hotkey 'Shift+s', 'IDF_Views_Source::treeBase', array($project.shortname, $project.getScmRoot())}{/if}
|
||||
{if $hasIssuesAccess and !$user.isAnonymous()}
|
||||
{hotkey 'Shift+m', 'IDF_Views_Issue::myIssues', array($project.shortname, 'submit')}
|
||||
{hotkey 'Shift+w', 'IDF_Views_Issue::myIssues', array($project.shortname, 'owner')}
|
||||
{hotkey 'Shift+m', 'IDF_Views_Issue::userIssues', array($project.shortname, $user.login, 'submit')}
|
||||
{hotkey 'Shift+w', 'IDF_Views_Issue::userIssues', array($project.shortname, $user.login, 'owner')}
|
||||
{/if}{/if} //-->
|
||||
</script>
|
||||
|
||||
|
@@ -30,6 +30,6 @@ document.getElementById('id_login').focus()
|
||||
<div class="issue-submit-info">
|
||||
<h3>{trans 'Welcome.'}</h3>
|
||||
{aurl 'url', 'IDF_Views::register', array()}
|
||||
<p>{blocktrans}If you don't have an account yet, you can create one <a href="{$url}">here</a>.{/blocktrans}</a></p>
|
||||
<p>{blocktrans}You can <a href="{$url}">create an account</a> if you don't have one yet.{/blocktrans}</a></p>
|
||||
<p>{trans 'It takes less than a minute to create your account.'}</p></div>
|
||||
{/block}
|
||||
|
@@ -15,14 +15,14 @@
|
||||
{foreach $downloads as $download}
|
||||
<span class="label"><a href="{url 'IDF_Views_Download::view', array($project.shortname, $download.id)}" title="{$download.summary}">{$download}</a></span><br />
|
||||
{/foreach}
|
||||
<span class="label"> </span><span class="note"><a href="{url 'IDF_Views_Download::index', array($project.shortname)}">{trans 'show more...'}</a></span>
|
||||
<span class="label"> </span><span class="note"><a href="{url 'IDF_Views_Download::index', array($project.shortname)}" title="{trans 'Show more featured downloads'}">{trans 'show more...'}</a></span>
|
||||
{/if}
|
||||
{if count($pages) > 0}
|
||||
<p><strong>{trans 'Featured Documentation'}</strong><br />
|
||||
{foreach $pages as $page}
|
||||
<span class="label"><a href="{url 'IDF_Views_Wiki::view', array($project.shortname, $page.title)}" title="{$page.summary}">{$page.title}</a></span><br />
|
||||
{/foreach}
|
||||
<span class="label"> </span><span class="note"><a href="{url 'IDF_Views_Wiki::index', array($project.shortname)}">{trans 'show more...'}</a></span>
|
||||
<span class="label"> </span><span class="note"><a href="{url 'IDF_Views_Wiki::index', array($project.shortname)}" title="{trans 'Show more featured documentation'}">{trans 'show more...'}</a></span>
|
||||
{/if}
|
||||
{assign $ko = 'owners'}
|
||||
{assign $km = 'members'}
|
||||
|
@@ -21,7 +21,9 @@
|
||||
{/if}
|
||||
{/foreach}
|
||||
</p>
|
||||
<p><strong>Subscribe to this timeline</strong><br /><img src="{media '/idf/img/rss.png'}" alt="{trans 'RSS'}" /> <a href="{$feedurl}" >Atom feeds</a></p>
|
||||
<p><strong>{trans 'Subscribe to this timeline'}</strong><br />
|
||||
<span class="label"><img src="{media '/idf/img/rss.png'}" alt="{trans 'RSS'}" /> <a href="{$feedurl}">{trans 'Atom feed'}</a></span>
|
||||
</p>
|
||||
{/block}
|
||||
|
||||
|
||||
|
@@ -34,7 +34,7 @@
|
||||
<td>
|
||||
{if $form.f.terms.errors}{$form.f.terms.fieldErrors}{/if}
|
||||
{$form.f.terms|unsafe} <strong>{$form.f.terms.labelTag}</strong><br />
|
||||
<span class="helptext">{blocktrans}Read the <a id="showterms" href="#theterms">terms and conditions</a> – basically <em>"Please be nice, we respect you"</em>.{/blocktrans}</span>
|
||||
<span class="helptext">{blocktrans}Read the <a id="showterms" href="#theterms">terms and conditions</a> – basically <em>"Please be nice, we respect you"</em>.{/blocktrans}</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -49,7 +49,7 @@
|
||||
<div class="issue-submit-info">
|
||||
<p>{trans 'Be sure to provide a valid email address, as we are sending a validation link by email.'}</p>
|
||||
{aurl 'url', 'IDF_Views::passwordRecoveryAsk'}
|
||||
<p>{blocktrans}If you have just forgotten your login information, then there is no need to create a new account. Just go <a href="{$url}">here</a> to recover your login name and password.{/blocktrans}</p>
|
||||
<p>{blocktrans}If you have just forgotten your login information, then there is no need to create a new account. You can just <a href="{$url}">recover your login name and password</a>.{/blocktrans}</p>
|
||||
<p><strong>{trans 'Did you know?'}</strong><br />
|
||||
{aurl 'url', 'IDF_Views::faq'}
|
||||
{blocktrans}With your account, you will able to participate in the life of all the projects hosted here. Participating in a software project must be fun, so if you have troubles, you can <a href="{$url}">let us know about your issues at anytime</a>!{/blocktrans}</p>
|
||||
|
@@ -4,7 +4,7 @@
|
||||
<div id="sub-tabs">
|
||||
<a {if $inOpenReviews}class="active" {/if}href="{url 'IDF_Views_Review::index', array($project.shortname)}">{trans 'Open Reviews'}</a> {*
|
||||
|
||||
{if !$user.isAnonymous()} | <a {if $inCreate}class="active" {/if}href="{url 'IDF_Views_Issue::create', array($project.shortname)}">{trans 'New Issue'}</a> | <a {if $inMyIssues}class="active" {/if}href="{url 'IDF_Views_Issue::myIssues', array($project.shortname, 'submit')}">{trans 'My Issues'}</a>{/if} |
|
||||
{if !$user.isAnonymous()} | <a {if $inCreate}class="active" {/if}href="{url 'IDF_Views_Issue::create', array($project.shortname)}">{trans 'New Issue'}</a> | <a {if $inMyIssues}class="active" {/if}href="{url 'IDF_Views_Issue::userIssues', array($project.shortname, $user.login, 'submit')}">{trans 'My Issues'}</a>{/if} |
|
||||
<form class="star" action="{url 'IDF_Views_Issue::search', array($project.shortname)}" method="get">
|
||||
<input accesskey="4" type="text" value="{$q}" name="q" size="20" />
|
||||
<input type="submit" name="s" value="{trans 'Search'}" />
|
||||
|
@@ -5,17 +5,4 @@
|
||||
{if !$user.isAnonymous()}
|
||||
{aurl 'url', 'IDF_Views_Review::create', array($project.shortname)}
|
||||
<p><a href="{$url}"><img style="vertical-align: text-bottom;" src="{media '/idf/img/add.png'}" alt="+" align="bottom" /></a> <a href="{$url}">{trans 'Start Code Review'}</a></p>{/if}
|
||||
|
||||
{/block}
|
||||
{block context}
|
||||
{*
|
||||
{aurl 'open_url', 'IDF_Views_Issue::index', array($project.shortname)}
|
||||
{aurl 'closed_url', 'IDF_Views_Issue::listStatus', array($project.shortname, 'closed')}
|
||||
{blocktrans}<p><strong>Open issues:</strong> <a href="{$open_url}">{$open}</a></p>
|
||||
<p><strong>Closed issues:</strong> <a href="{$closed_url}">{$closed}</a></p>{/blocktrans}
|
||||
{assign $class = ''}{assign $i = 0}
|
||||
<p class="smaller">{foreach $project.getTagCloud($cloud) as $label}
|
||||
{aurl 'url', 'IDF_Views_Issue::listLabel', array($project.shortname, $label.id, 'open')}
|
||||
{if $class != $label.class}{if $i != 0}<br />{/if}<strong class="label">{$label.class}:</strong> {/if}
|
||||
<a href="{$url}" class="label">{$label.name}</a>,{assign $class = $label.class}{assign $i = $i + 1}{/foreach}</p>
|
||||
*}{/block}
|
||||
|
@@ -10,8 +10,26 @@
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
<table class="disp" summary="">
|
||||
<tr><td>
|
||||
{if !$user.isAnonymous()}
|
||||
<div class="issue-submit-info" style="width: 50%; float: right; position: relative;">
|
||||
<p><strong>{trans 'How to Participate in a Code Review'}</strong></p>
|
||||
|
||||
<p>{blocktrans}Code review is a process in which
|
||||
after or before changes are commited into the code repository,
|
||||
different people discuss the code changes. The goal is
|
||||
to <strong>improve the quality of the code and the
|
||||
contributions</strong>, as such, you must be pragmatic when writing
|
||||
your review. Correctly mention the line numbers (in the old or in the
|
||||
new file) and try to keep a good balance between seriousness and fun.
|
||||
{/blocktrans}</p>
|
||||
<p>{blocktrans}
|
||||
<strong>Proposing code for review is intimidating</strong>, you know
|
||||
you will receive critics, so please, as a reviewer, <strong>keep this
|
||||
process fun</strong>, use it to help your contributor learn your
|
||||
coding standards and the structure of the code and <strong>make them want
|
||||
to propose more contributions</strong>.
|
||||
{/blocktrans}</p></div>
|
||||
{/if}
|
||||
<table class="commit" summary="">
|
||||
<tr>
|
||||
<th><strong>{trans 'Created:'}</strong></th><td>{$patch.creation_dtime|date:"%Y-%m-%d %H:%M:%S"} ({$patch.creation_dtime|dateago})</td>
|
||||
@@ -45,39 +63,12 @@
|
||||
<th> </th><td><a href="{$url}"><img style="vertical-align: text-bottom;" src="{media '/idf/img/package-grey.png'}" alt="{trans 'Archive'}" align="bottom" /></a> <a href="{$url}" class="soft">{trans 'Download the corresponding diff file'}</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td><td>
|
||||
{if !$user.isAnonymous()}
|
||||
<div class="issue-submit-info" style="width: 90%; float: right; position: relative;">
|
||||
<p><strong>{trans 'How to Participate in a Code Review'}</strong></p>
|
||||
|
||||
<p>{blocktrans}Code review is a process in which
|
||||
after or before changes are commited into the code repository,
|
||||
different people discuss the code changes. The goal is
|
||||
to <strong>improve the quality of the code and the
|
||||
contributions</strong>, as such, you must be pragmatic when writing
|
||||
your review. Correctly mention the line numbers (in the old or in the
|
||||
new file) and try to keep a good balance between seriousness and fun.
|
||||
{/blocktrans}</p>
|
||||
<p>{blocktrans}
|
||||
<strong>Proposing code for review is intimidating</strong>, you know
|
||||
you will receive critics, so please, as a reviewer, <strong>keep this
|
||||
process fun</strong>, use it to help your contributor learn your
|
||||
coding standards and the structure of the code and <strong>make them want
|
||||
to propose more contributions</strong>.
|
||||
{/blocktrans}</p></div>
|
||||
{/if}
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
<form method="post" action=".">
|
||||
{foreach $files as $file=>$def}
|
||||
<table class="diff" summary=" ">
|
||||
<tbody>
|
||||
<tr id="diff-{$file|md5}"><th colspan="4">{$file}</th></tr>
|
||||
<tr><th colspan="2">{trans 'Old'}</th><th colspan="2">{trans 'New'}</th></tr>
|
||||
{$def[0]}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{$def[0]}
|
||||
|
||||
{assign $fcomments = $def[2]}
|
||||
{assign $nc = $fcomments.count()}
|
||||
{assign $i = 1}
|
||||
@@ -109,7 +100,7 @@ to propose more contributions</strong>.
|
||||
{foreach $comments as $c}{ashowuser 'submitter', $c.get_submitter(), $request}{assign $submitter = $c.get_submitter()}{assign $submitter_data = $c.get_submitter_data()}
|
||||
<div class="issue-comment{if $i == 1} issue-comment-first{/if}{if $i == ($nc)} issue-comment-last{/if}" id="ic{$c.id}">
|
||||
{if $submitter_data.avatar != ''}
|
||||
<img style="float:right; position: relative; max-height: 60px; max-width: 60px;" src="{media}/upload/avatars/{$submitter_data.avatar}" alt=" " />
|
||||
<img style="float:right; position: relative; max-height: 60px; max-width: 60px;" src="{upload}/avatars/{$submitter_data.avatar}" alt=" " />
|
||||
{else}
|
||||
<img style="float:right; position: relative;" src="http://www.gravatar.com/avatar/{$submitter.email|md5}.jpg?s=60&d={media}/idf/img/spacer.gif" alt=" " />
|
||||
{/if}
|
||||
|
@@ -34,6 +34,9 @@
|
||||
{foreach $changes.renames as $oldname => $newname}
|
||||
<tr><td><span class="scm-action renamed" title="{trans 'renamed'}">R</span></td><td><a href="{url 'IDF_Views_Source::tree', array($project.shortname, $commit, $newname)}">{$oldname} → {$newname}</a></td></tr>
|
||||
{/foreach}
|
||||
{foreach $changes.copies as $srcname => $destname}
|
||||
<tr><td><span class="scm-action copied" title="{trans 'copied'}">C</span></td><td><a href="{url 'IDF_Views_Source::tree', array($project.shortname, $commit, $destname)}">{$srcname} → {$destname}</a></td></tr>
|
||||
{/foreach}
|
||||
{foreach $changes.additions as $filename}
|
||||
<tr><td><span class="scm-action added" title="{trans 'added'}">A</span></td><td><a href="{url 'IDF_Views_Source::tree', array($project.shortname, $commit, $filename)}">{$filename}</a>{if !empty($diff.files[$filename])} (<a href="#diff-{$filename|md5}">{trans 'full'}</a>){/if}</td></tr>
|
||||
{/foreach}
|
||||
@@ -41,7 +44,7 @@
|
||||
<tr><td><span class="scm-action patched" title="{trans 'modified'}">M</span></td><td><a href="{url 'IDF_Views_Source::tree', array($project.shortname, $commit, $filename)}">{$filename}</a>{if !empty($diff.files[$filename])}{assign $ndiff = count($diff.files[$filename]['chunks'])} (<a href="#diff-{$filename|md5}">{blocktrans $ndiff}{$ndiff} diff{plural}{$ndiff} diffs{/blocktrans}</a>){/if}</td></tr>
|
||||
{/foreach}
|
||||
{foreach $changes.properties as $filename => $properties}
|
||||
<tr><td><span class="scm-action property-changed" title="{trans 'properies changed'}">P</span></td><td><a href="{url 'IDF_Views_Source::tree', array($project.shortname, $commit, $filename)}">{$filename}</a>
|
||||
<tr><td><span class="scm-action property-changed" title="{trans 'properties changed'}">P</span></td><td><a href="{url 'IDF_Views_Source::tree', array($project.shortname, $commit, $filename)}">{$filename}</a>
|
||||
<table class="properties">
|
||||
{foreach $properties as $key => $value}
|
||||
<tr><td>{$key}</td>
|
||||
|
2
src/IDF/templates/idf/source/git/invalid_revision.html
Normal file
2
src/IDF/templates/idf/source/git/invalid_revision.html
Normal file
@@ -0,0 +1,2 @@
|
||||
{extends "idf/source/invalid_revision.html"}
|
||||
|
@@ -32,13 +32,13 @@
|
||||
<tr>
|
||||
<td class="fileicon"><img src="{media '/idf/img/'~$file.type~'.png'}" alt="{$file.type}" /></td>
|
||||
{if $file.type != 'extern'}
|
||||
<td{if $file.type == 'tree'} colspan="4"{/if}><a href="{$url}">{$file.file}</a></td>{else}<td><a href="#" title="{$file.hash}">{$file.file}</a></td>{/if}
|
||||
<td{if $file.type == 'tree'} colspan="4"{/if}><a href="{$url}"><nobr>{$file.file}</nobr></a></td>{else}<td><a href="#" title="{$file.hash}"><nobr>{$file.file}</nobr></a></td>{/if}
|
||||
{if $file.type == 'blob'}
|
||||
{if isset($file.date) and $file.log != '----'}
|
||||
<td><span class="smaller">{$file.date|dateago:"without"}</span></td>
|
||||
<td><span class="smaller"><nobr>{$file.date|dateago:"without"}</nobr></span></td>
|
||||
<td><span class="smaller">{$file.author|strip_tags|trim}{trans ':'} {issuetext $file.log, $request, true, false}</span></td>
|
||||
{else}<td colspan="2"></td>{/if}
|
||||
<td>{$file.size|size}</td>{/if}
|
||||
<td><nobr>{$file.size|size}</nobr></td>{/if}
|
||||
{if $file.type == 'extern'}
|
||||
<td colspan="3">{$file.extern}</td>
|
||||
{/if}
|
||||
|
@@ -5,6 +5,7 @@
|
||||
<p>{blocktrans}The branch or revision <b>{$commit}</b> is not valid or does not exist
|
||||
in this repository.{/blocktrans}</p>
|
||||
|
||||
{if count($branches) > 0}
|
||||
<p>{blocktrans}The following list shows all available branches:{/blocktrans}</p>
|
||||
<ul>
|
||||
{foreach $branches as $branch => $path}
|
||||
@@ -14,6 +15,7 @@ in this repository.{/blocktrans}</p>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{/if}
|
||||
|
||||
{if $isOwner or $isMember}
|
||||
{aurl 'url', 'IDF_Views_Source::help', array($project.shortname)}
|
||||
|
@@ -0,0 +1,2 @@
|
||||
{extends "idf/source/invalid_revision.html"}
|
||||
|
@@ -5,12 +5,25 @@
|
||||
<h2 class="top"><a href="{url 'IDF_Views_Source::treeBase', array($project.shortname, $commit)}">{trans 'Root'}</a><span class="sep">/</span>{if $breadcrumb}{$breadcrumb|safe}{/if}</h2>
|
||||
|
||||
<table class="code" summary=" ">
|
||||
{if !$tree_in and !$tags_in}
|
||||
{if (!$tree_in and !$tags_in) or $props}
|
||||
{aurl 'url', 'IDF_Views_Source::commit', array($project.shortname, $commit)}
|
||||
<tfoot>
|
||||
<tr><th colspan="2">{blocktrans}Source at commit <a class="mono" href="{$url}">{$commit}</a> created {$cobject.date|dateago}.{/blocktrans}<br/>
|
||||
<span class="smaller">{blocktrans}By {$cobject.author|strip_tags|trim}, {$cobject.title}{/blocktrans}</span>
|
||||
</th></tr>
|
||||
{if $props}
|
||||
<tr><th colspan="2">
|
||||
<ul>
|
||||
{foreach $props as $prop => $val}
|
||||
<li>{blocktrans}Property <strong>{$prop}</strong> set to <em>{$val}</em>{/blocktrans}</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</th></tr>
|
||||
{/if}
|
||||
{if !$tree_in and !$tags_in}
|
||||
<tr>
|
||||
<th colspan="2">{blocktrans}Source at commit <a class="mono" href="{$url}">{$commit}</a> created {$cobject.date|dateago}.{/blocktrans}<br/>
|
||||
<span class="smaller">{blocktrans}By {$cobject.author|strip_tags|trim}, {$cobject.title}{/blocktrans}</span>
|
||||
</th>
|
||||
</tr>
|
||||
{/if}
|
||||
</tfoot>
|
||||
{/if}
|
||||
<tbody>
|
||||
|
2
src/IDF/templates/idf/source/mtn/invalid_revision.html
Normal file
2
src/IDF/templates/idf/source/mtn/invalid_revision.html
Normal file
@@ -0,0 +1,2 @@
|
||||
{extends "idf/source/invalid_revision.html"}
|
||||
|
@@ -11,14 +11,27 @@
|
||||
<th>{trans 'Message'}</th>
|
||||
<th>{trans 'Size'}</th>
|
||||
</tr>
|
||||
</thead>{if !$tree_in and !$tags_in}
|
||||
</thead>
|
||||
{if (!$tree_in and !$tags_in) or $props}
|
||||
{aurl 'url', 'IDF_Views_Source::commit', array($project.shortname, $commit)}
|
||||
<tfoot>
|
||||
<tr><th colspan="5">{blocktrans}Source at commit <a class="mono" href="{$url}">{$commit}</a> created {$cobject.date|dateago}.{/blocktrans}<br/>
|
||||
<span class="smaller">{blocktrans}By {$cobject.author|strip_tags|trim}, {$cobject.title}{/blocktrans}</span>
|
||||
</th></tr>
|
||||
{if $props}
|
||||
<tr><th colspan="5">
|
||||
<ul>
|
||||
{foreach $props as $prop => $val}
|
||||
<li>{blocktrans}Property <strong>{$prop}</strong> set to <em>{$val}</em>{/blocktrans}</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</th></tr>
|
||||
{/if}
|
||||
{if !$tree_in and !$tags_in}
|
||||
<tr><th colspan="5">{blocktrans}Source at commit <a class="mono" href="{$url}">{$commit}</a> created {$cobject.date|dateago}.{/blocktrans}<br/>
|
||||
<span class="smaller">{blocktrans}By {$cobject.author|strip_tags|trim}, {$cobject.title}{/blocktrans}</span>
|
||||
</th></tr>
|
||||
{/if}
|
||||
{/if}
|
||||
</tfoot>
|
||||
{/if}<tbody>
|
||||
<tbody>
|
||||
{if $base}
|
||||
<tr>
|
||||
<td> </td>
|
||||
|
@@ -4,7 +4,7 @@
|
||||
<p><strong>{trans 'Revision:'}</strong> {$commit}</p>
|
||||
<p>
|
||||
<input accesskey="4" type="text" value="{$commit}" name="rev" size="5" />
|
||||
<input type="submit" name="s" value="{trans 'Go to revision'}" />
|
||||
<input type="submit" name="s" value="{trans 'Switch'}" />
|
||||
</p>
|
||||
</form>
|
||||
{/block}
|
||||
|
@@ -4,7 +4,7 @@
|
||||
<p><strong>{trans 'Revision:'}</strong> {$commit}</p>
|
||||
<p>
|
||||
<input accesskey="4" type="text" value="{$commit}" name="rev" size="5"/>
|
||||
<input type="submit" name="s" value="{trans 'Go to revision'}"/>
|
||||
<input type="submit" name="s" value="{trans 'Switch'}"/>
|
||||
</p>
|
||||
</form>
|
||||
{/block}
|
||||
|
@@ -6,13 +6,13 @@
|
||||
|
||||
<table class="code" summary=" ">
|
||||
{if !$tree_in || $props}
|
||||
{aurl 'url', 'IDF_Views_Source::commit', array($project.shortname, $commit)}
|
||||
{aurl 'url', 'IDF_Views_Source::commit', array($project.shortname, $commit)}
|
||||
<tfoot>
|
||||
{if $props}
|
||||
<tr><th colspan="2">
|
||||
<ul>
|
||||
{foreach $props as $prop => $val}
|
||||
<li>{trans 'Property'} <strong>{$prop}</strong> {trans 'set to:'} <em>{$val}</em></li>
|
||||
<li>{blocktrans}Property <strong>{$prop}</strong> set to <em>{$val}</em>{/blocktrans}</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</th></tr>
|
||||
@@ -38,7 +38,7 @@
|
||||
<p>
|
||||
<input accesskey="4" type="text" value="{$commit}" name="rev" size="5" />
|
||||
<input type="hidden" name="sourcefile" value="{$base}"/>
|
||||
<input type="submit" name="s" value="{trans 'Go to revision'}" /></p>
|
||||
<input type="submit" name="s" value="{trans 'Switch'}" /></p>
|
||||
</form>
|
||||
{/block}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user