Indefero

Indefero Commit Details


Date:2010-04-26 17:02:47 (14 years 7 months ago)
Author:Thomas Keller
Branch:develop, feature-issue_links, feature.better-home, feature.content-md5, feature.diff-whitespace, feature.download-md5, feature.issue-links, feature.issue-of-others, feature.issue-summary, feature.search-filter, feature.webrepos, feature.wiki-default-page, master, release-1.1, release-1.2, release-1.3
Commit:18ba8d0ac55be7dbb09b0ac61d08cffce22cff6b
Parents: 9fd4334dec58e292e9a3c4e3c6ab776a6ee8d07c
Message:Some more files from the initial work

Changes:

File differences

src/IDF/Form/Admin/ProjectCreate.php
3838
3939
4040
41
4142
4243
4344
......
9293
9394
9495
96
97
98
99
100
101
102
103
95104
96105
97106
......
156165
157166
158167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
159183
160184
161185
......
184208
185209
186210
211
212
213
214
215
187216
188217
189218
......
222251
223252
224253
225
226
254
255
227256
228
257
229258
230259
231260
232261
233
262
234263
235264
236265
'git' => __('git'),
'svn' => __('Subversion'),
'mercurial' => __('mercurial'),
'mtn' => __('monotone'),
);
foreach (Pluf::f('allowed_scm', array()) as $key => $class) {
$choices[$options[$key]] = $key;
'widget' => 'Pluf_Form_Widget_PasswordInput',
));
$this->fields['mtn_master_branch'] = new Pluf_Form_Field_Varchar(
array('required' => false,
'label' => __('Master branch'),
'initial' => '',
'widget' => 'Pluf_Form_Widget_Input',
'help_text' => __('This should be a world-wide unique identifier for your project. A reverse DNS notation like "com.my-domain.my-project" is a good idea.'),
));
$this->fields['owners'] = new Pluf_Form_Field_Varchar(
array('required' => false,
'label' => __('Project owners'),
return $url;
}
public function clean_mtn_master_branch()
{
$mtn_master_branch = mb_strtolower($this->cleaned_data['mtn_master_branch']);
if (!preg_match('/^([\w\d]+([-][\w\d]+)*)(\.[\w\d]+([-][\w\d]+)*)*$/', $mtn_master_branch)) {
throw new Pluf_Form_Invalid(__('This master branch contains illegal characters, please use only letters, digits, dashs and dots as separators.'));
}
$sql = new Pluf_SQL('vkey=%s AND vdesc=%s', array("mtn_master_branch", $mtn_master_branch));
$l = Pluf::factory('IDF_Conf')->getList(array('filter'=>$sql->gen()));
if ($l->count() > 0) {
throw new Pluf_Form_Invalid(__('This master branch is already used. Please select another one.'));
}
return $mtn_master_branch;
}
public function clean_shortname()
{
$shortname = mb_strtolower($this->cleaned_data['shortname']);
$this->cleaned_data[$key] = '';
}
}
if ($this->cleaned_data['scm'] != 'mtn') {
$this->cleaned_data['mtn_master_branch'] = '';
}
/**
* [signal]
*
$project->create();
$conf = new IDF_Conf();
$conf->setProject($project);
$keys = array('scm', 'svn_remote_url',
'svn_username', 'svn_password');
$keys = array('scm', 'svn_remote_url', 'svn_username',
'svn_password', 'mtn_master_branch');
foreach ($keys as $key) {
$this->cleaned_data[$key] = (!empty($this->cleaned_data[$key])) ?
$this->cleaned_data[$key] = (!empty($this->cleaned_data[$key])) ?
$this->cleaned_data[$key] : '';
$conf->setVal($key, $this->cleaned_data[$key]);
}
$project->created();
IDF_Form_MembersConf::updateMemberships($project,
IDF_Form_MembersConf::updateMemberships($project,
$this->cleaned_data);
$project->membershipsUpdated();
return $project;
src/IDF/Project.php
3939
4040
4141
42
42
4343
4444
4545
......
5252
5353
5454
55
55
5656
5757
5858
......
113113
114114
115115
116
116
117117
118118
119119
......
181181
182182
183183
184
184
185185
186186
187187
......
197197
198198
199199
200
200
201201
202202
203203
......
289289
290290
291291
292
292
293293
294
294
295295
296296
297297
......
385385
386386
387387
388
388
389389
390390
391391
......
433433
434434
435435
436
437
438
436
437
438
439
439440
440441
441442
......
448449
449450
450451
451
452
452453
453454
454455
......
505506
506507
507508
508
509
509510
510511
511512
......
649650
650651
651652
652
653
653654
654655
655656
*
* @see self::isRestricted
*/
protected $_isRestricted = null;
protected $_isRestricted = null;
function init()
{
'id' =>
array(
'type' => 'Pluf_DB_Field_Sequence',
'blank' => true,
'blank' => true,
),
'name' =>
array(
return '';
}
function preSave($create=false)
{
if ($this->id == '') {
*/
public function getTagIdsByStatus($status='open', $cache_refresh=false)
{
if (!$cache_refresh
if (!$cache_refresh
and isset($this->_extra_cache['getTagIdsByStatus-'.$status])) {
return $this->_extra_cache['getTagIdsByStatus-'.$status];
}
break;
}
$tags = array();
foreach ($this->getTagsFromConfig($key, $default, 'Status') as $tag) {
foreach ($this->getTagsFromConfig($key, $default, 'Status') as $tag) {
$tags[] = (int) $tag->id;
}
$this->_extra_cache['getTagIdsByStatus-'.$status] = $tags;
if ($fmt == 'objects') {
return new Pluf_Template_ContextVars(array('members' => $members, 'owners' => $owners, 'authorized' => $authorized));
} else {
return array('members' => implode("\n", (array) $members),
return array('members' => implode("\n", (array) $members),
'owners' => implode("\n", (array) $owners),
'authorized' => implode("\n", (array) $authorized),
'authorized' => implode("\n", (array) $authorized),
);
}
}
public function getSourceAccessUrl($user=null)
{
$right = $this->getConf()->getVal('source_access_rights', 'all');
if (($user == null or $user->isAnonymous())
if (($user == null or $user->isAnonymous())
and $right == 'all' and !$this->private) {
return $this->getRemoteAccessUrl();
}
{
$conf = $this->getConf();
$roots = array(
'git' => 'master',
'svn' => 'HEAD',
'mercurial' => 'tip'
'git' => 'master',
'svn' => 'HEAD',
'mercurial' => 'tip',
'mtn' => 'h:',
);
$scm = $conf->getVal('scm', 'git');
return $roots[$scm];
* By convention, all the objects belonging to a project have the
* 'project' property set, so this is easy to check.
*
* @param Pluf_Model
* @param Pluf_Model
*/
public function inOr404($obj)
{
*
* [description]
*
* This signal allows an application to update the statistics
* This signal allows an application to update the statistics
* array of a project. For example to add the on disk size
* of the repository if available.
*
);
$conf = $this->getConf();
foreach ($tabs as $tab) {
if (!in_array($conf->getVal($tab, 'all'),
if (!in_array($conf->getVal($tab, 'all'),
array('all', 'none'))) {
$this->_isRestricted = true;
return true;
src/IDF/Views/Project.php
4444
4545
4646
47
47
4848
4949
5050
5151
52
52
5353
5454
5555
......
100100
101101
102102
103
103
104104
105105
106106
......
117117
118118
119119
120
120
121121
122122
123123
124124
125
125
126126
127127
128128
129
129
130130
131131
132132
......
188188
189189
190190
191
191
192192
193193
194194
......
207207
208208
209209
210
210
211211
212212
213213
......
235235
236236
237237
238
238
239239
240240
241241
......
445445
446446
447447
448
448
449449
450450
451451
......
519519
520520
521521
522
522523
523524
524525
if ($request->rights['hasDownloadsAccess']) {
$tags = IDF_Views_Download::getDownloadTags($prj);
// the first tag is the featured, the last is the deprecated.
$downloads = $tags[0]->get_idf_upload_list();
$downloads = $tags[0]->get_idf_upload_list();
}
$pages = array();
if ($request->rights['hasWikiAccess']) {
$tags = IDF_Views_Wiki::getWikiTags($prj);
$pages = $tags[0]->get_idf_wikipage_list();
$pages = $tags[0]->get_idf_wikipage_list();
}
return Pluf_Shortcuts_RenderToResponse('idf/project/home.html',
array(
$rights[] = '\'IDF_Dummy\'';
}
$sql = sprintf('model_class IN (%s)', implode(', ', $rights));
$pag->forced_where = new Pluf_SQL('project=%s AND '.$sql,
$pag->forced_where = new Pluf_SQL('project=%s AND '.$sql,
array($prj->id));
$pag->sort_order = array('creation_dtime', 'ASC');
$pag->sort_reverse_order = array('creation_dtime');
if ($request->rights['hasDownloadsAccess']) {
$tags = IDF_Views_Download::getDownloadTags($prj);
// the first tag is the featured, the last is the deprecated.
$downloads = $tags[0]->get_idf_upload_list();
$downloads = $tags[0]->get_idf_upload_list();
}
$pages = array();
if ($request->rights['hasWikiAccess']) {
$tags = IDF_Views_Wiki::getWikiTags($prj);
$pages = $tags[0]->get_idf_wikipage_list();
$pages = $tags[0]->get_idf_wikipage_list();
}
if (!$request->user->isAnonymous() and $prj->isRestricted()) {
$feedurl = Pluf_HTTP_URL_urlForView('idf_project_timeline_feed_auth',
array($prj->shortname,
array($prj->shortname,
IDF_Precondition::genFeedToken($prj, $request->user)));
} else {
$feedurl = Pluf_HTTP_URL_urlForView('idf_project_timeline_feed',
'nb' => 20,
);
$items = Pluf::factory('IDF_Timeline')->getList($params);
$set = new Pluf_Model_Set($items,
$set = new Pluf_Model_Set($items,
array('public_dtime' => 'public_dtime'));
$out = array();
foreach ($set as $item) {
$feedurl = Pluf::f('url_base').Pluf::f('idf_base').$request->query;
$viewurl = Pluf_HTTP_URL_urlForView('IDF_Views_Project::timeline',
array($prj->shortname));
$context = new Pluf_Template_Context_Request($request,
$context = new Pluf_Template_Context_Request($request,
array('body' => $out,
'date' => $date,
'title' => $title,
if ($form->isValid()) {
$prj = $form->save();
$request->user->setMessage(__('The project has been updated.'));
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Project::admin',
$url = Pluf_HTTP_URL_urlForView('IDF_Views_Project::admin',
array($prj->shortname));
return new Pluf_HTTP_Response_Redirect($url);
}
} else {
$params = array();
$keys = array('downloads_access_rights', 'source_access_rights',
'issues_access_rights', 'review_access_rights',
'issues_access_rights', 'review_access_rights',
'wiki_access_rights',
'downloads_notification_email',
'review_notification_email',
'git' => __('git'),
'svn' => __('Subversion'),
'mercurial' => __('mercurial'),
'mtn' => __('monotone'),
);
$repository_type = $options[$scm];
return Pluf_Shortcuts_RenderToResponse('idf/admin/source.html',
src/IDF/conf/idf.php-dist
2727
2828
2929
30
30
3131
32
32
3333
3434
35
36
37
35
36
37
3838
3939
4040
......
4444
4545
4646
47
47
4848
49
49
5050
5151
5252
......
6464
6565
6666
67
67
6868
6969
7070
......
7373
7474
7575
76
77
78
79
80
81
7682
7783
7884
......
9096
9197
9298
93
99
94100
95
101
96102
97103
98104
99105
100106
101
107
102108
103109
104110
......
109115
110116
111117
112
118
113119
114120
115121
......
120126
121127
122128
123
124
125
129
130
131
126132
127133
128134
......
130136
131137
132138
133
139
134140
135141
136
142
137143
138144
139145
......
150156
151157
152158
153
154
159
160
155161
156162
157163
158164
159165
160166
161
167
162168
163169
164170
165171
166172
167173
168
174
169175
170176
171177
......
203209
204210
205211
206
212
207213
208214
209215
210216
211217
218
212219
213220
214221
......
218225
219226
220227
221
222
228
229
223230
224231
225232
......
229236
230237
231238
232
233
239
240
234241
235242
236
243
237244
238245
# You must set them to false once everything is running ok.
#
$cfg['debug'] = true;
# It will help you catch errors at beginning when configuring your
# It will help you catch errors at beginning when configuring your
# SCM backend. It must be turned off in production.
$cfg['debug_scm'] = false;
$cfg['debug_scm'] = false;
#
# Note: By default, InDefero will not manage the repositories for
# you, you can enable the repositories management with the
# built-in plugins. The documentation of the plugins is available
# Note: By default, InDefero will not manage the repositories for
# you, you can enable the repositories management with the
# built-in plugins. The documentation of the plugins is available
# in the `doc/` folder.
#
# For example: '/path/to/my/project/.git'
#
# If you have multiple repositories, you need to put %s where you
# want the shortname of the project to be replaced.
# want the shortname of the project to be replaced.
# For example:
# - You have many projects on your local computer and want to use
# - You have many projects on your local computer and want to use
# InDefero to see them. Put: '/home/yourlogin/Projects/%s/.git'
# - You have many projects on a remote server with only "bare" git
# repositories. Put: '/home/git/repositories/%s.git'
$cfg['git_write_remote_url'] = 'git@localhost:%s.git';
# Same as for git, you can have multiple repositories, one for each
# project or a single one for all the projects.
# project or a single one for all the projects.
#
# In the case of subversion, the admin of a project can also select a
# remote repository from the web interface. From the web interface
$cfg['svn_repositories'] = 'file:///home/svn/repositories/%s';
$cfg['svn_remote_url'] = 'http://localhost/svn/%s';
# Same as for git, you can have multiple repositories, one for each
# project or a single one for all the projects.
$cfg['mtn_repositories'] = '/home/mtn/repositories/%s.mtn';
$cfg['mtn_branch_prefix'] = 'com.indefero.projects.';
$cfg['mtn_remote_url'] = 'mtn://localhost/~%s/%s%s';
# Mercurial repositories path
#$cfg['mercurial_repositories'] = '/home/mercurial/repositories/%s';
#$cfg['mercurial_remote_url'] = 'http://projects.ceondo.com/hg/%s';
$cfg['mail_port'] = 25;
# Paths/Url configuration.
#
#
# Examples:
# You have:
# You have:
# http://www.mydomain.com/myfolder/index.php
# Put:
# $cfg['idf_base'] = '/myfolder/index.php';
# $cfg['url_base'] = 'http://www.mydomain.com';
#
# You have mod_rewrite:
# You have mod_rewrite:
# http://www.mydomain.com/
# Put:
# $cfg['idf_base'] = '';
$cfg['idf_base'] = '/index.php';
$cfg['url_base'] = 'http://localhost';
# Url to access the media folder which is in the www folder
# Url to access the media folder which is in the www folder
# of the archive
$cfg['url_media'] = 'http://localhost/media';
$cfg['upload_path'] = '/home/www/indefero/www/media/upload';
#
# The following path *MUST NOT* be accessible through a web browser
# as user will be able to upload .html, .php files and this can
# create *TERRIBLE* security issues. In this folder, the attachments
# The following path *MUST NOT* be accessible through a web browser
# as user will be able to upload .html, .php files and this can
# create *TERRIBLE* security issues. In this folder, the attachments
# to the issues will be uploaded and we do not restrict the content type.
#
$cfg['upload_issue_path'] = '/home/www/indefero/attachments';
#
# write here a long random string unique for this installation. This
# is critical to put a long string, with at least 40 characters.
$cfg['secret_key'] = '';
$cfg['secret_key'] = '';
# the sender of all the emails.
$cfg['from_email'] = 'sender@example.com';
$cfg['from_email'] = 'sender@example.com';
# Email address for the bounced messages.
$cfg['bounce_email'] = 'no-reply@example.com';
$cfg['db_server'] = '';
$cfg['db_version'] = '5.1'; # Only needed for MySQL
# If you want to have different installations with the same DB
$cfg['db_table_prefix'] = 'indefero_';
# ** DO NOT USE SQLITE IN PRODUCTION **
$cfg['db_table_prefix'] = 'indefero_';
# ** DO NOT USE SQLITE IN PRODUCTION **
# This is not because of problems with the quality of the SQLite
# driver or with SQLite itself, this is due to the lack of migration
# support in Pluf for SQLite, this means we cannot modify the DB
# easily once it is loaded with data.
$cfg['db_engine'] = 'PostgreSQL'; # SQLite is also well tested or MySQL
$cfg['db_database'] = 'website'; # put absolute path to the db if you
# are using SQLite.
# are using SQLite.
#
# The extension of the downloads are limited. You can add extra
# extensions here. The list must start with a space.
# $cfg['idf_extra_upload_ext'] = ' ext1 ext2';
#
# By default, the size of the downloads is limited to 2MB.
# The php.ini upload_max_filesize configuration setting will
# The php.ini upload_max_filesize configuration setting will
# always have precedence.
# $cfg['max_upload_size'] = 2097152; // Size in bytes
$cfg['idf_views'] = dirname(__FILE__).'/urls.php';
# available languages
$cfg['languages'] = array('en', 'fr');
$cfg['languages'] = array('en', 'fr');
# SCM base configuration
$cfg['allowed_scm'] = array('git' => 'IDF_Scm_Git',
'svn' => 'IDF_Scm_Svn',
'mercurial' => 'IDF_Scm_Mercurial',
'mtn' => 'IDF_Scm_Monotone',
);
# If you want to use another memtypes database
# $cfg['idf_extra_text_ext'] = 'ext1 ext2 ext3';
# If you can execute the shell commands executed to get info
# from the scm with the user of your PHP process but it is
# not working from within PHP, this can be due to the environment
# from the scm with the user of your PHP process but it is
# not working from within PHP, this can be due to the environment
# variables not being set correctly. Note the trailing space.
# $cfg['idf_exec_cmd_prefix'] = '/usr/bin/env -i ';
# To know which path you need to provide, just run:
# $ which git
# from the command line. This will give you the path to git.
# $cfg['svn_path'] = 'svn';
# $cfg['svnlook_path'] = 'svnlook';
# $cfg['svn_path'] = 'svn';
# $cfg['svnlook_path'] = 'svnlook';
# $cfg['svnadmin_path'] = 'svnadmin';
# $cfg['hg_path'] = 'hg';
# $cfg['git_path'] = 'git';
# $cfg['git_path'] = 'git';
return $cfg;
src/IDF/templates/idf/gadmin/projects/create.html
5252
5353
5454
55
56
57
58
59
60
61
5562
5663
5764
......
7683
7784
7885
79
86
8087
8188
8289
......
112119
113120
114121
122
123
124
125
115126
116127
117128
118129
119130
120131
132
133
134
135
136
137
121138
122139
123140
{$form.f.svn_password|unsafe}
</td>
</tr>
<tr class="mtn-form">
<th>{$form.f.mtn_master_branch.labelTag}:</th>
<td>{if $form.f.mtn_master_branch.errors}{$form.f.mtn_master_branch.fieldErrors}{/if}
{$form.f.mtn_master_branch|unsafe}<br />
<span class="helptext">{$form.f.mtn_master_branch.help_text}</span>
</td>
</tr>
<tr>
<th><strong>{$form.f.owners.labelTag}:</strong></th>
<td>
<tr>
<td>&nbsp;</td>
<td>
<input type="submit" value="{trans 'Create Project'}" name="submit" />
<input type="submit" value="{trans 'Create Project'}" name="submit" />
</td>
</tr>
</table>
if ($("#id_scm option:selected").val() != "svn") {
$(".svn-form").hide();
}
// Hide if not mtn
if ($("#id_scm option:selected").val() != "mtn") {
$(".mtn-form").hide();
}
$("#id_scm").change(function () {
if ($("#id_scm option:selected").val() == "svn") {
$(".svn-form").show();
} else {
$(".svn-form").hide();
}
if ($("#id_scm option:selected").val() == "mtn") {
$(".mtn-form").show();
} else {
$(".mtn-form").hide();
}
});
});
</script>
src/IDF/templates/idf/source/mtn/help.html
33
44
55
6
6
77
88
99
1010
11
12
13
14
11
1512
1613
1714
......
1916
2017
2118
22
23
24
25
26
19
20
21
2722
2823
2924
{block body}
<p>{blocktrans}The team behind {$project} is using
the <strong>git</strong> software to manage the source
the <strong>monotone</strong> software to manage the source
code.{/blocktrans}</p>
<h3>{trans 'Command-Line Access'}</h3>
<p><kbd>git clone {$project.getSourceAccessUrl($user)}</kbd></p>
{aurl 'url', 'IDF_Views_User::myAccount'}
<p>{blocktrans}You may need to <a href="{$url}">provide your SSH key</a>. The synchronization of your SSH key can take a couple of minutes. You can learn more about <a href="http://www.google.com/search?q=public+ssh+key+authentication">SSH key authentification</a>.{/blocktrans}</p>
<p><kbd>mtn clone {$project.getSourceAccessUrl()}</kbd></p>
{if $isOwner or $isMember}
<h3>{trans 'First Commit'}</h3>
<p>{blocktrans}To make a first commit in the repository, perform the following steps:{/blocktrans}</p>
<pre>
git init
git add .
git commit -m "initial import"
git remote add origin {$project.getWriteRemoteAccessUrl($url)}
git push origin master
mtn add -R .
mtn commit -m "initial import"
mtn push {$project.getSourceAccessUrl()}
</pre>
{/if}

Archive Download the corresponding diff file

Page rendered in 0.09790s using 13 queries.