InDefero

Sign in or create your account | Project List | Help

InDefero Commit Details

Date:2008-12-01 00:36:27 (1 year 3 months ago)
Author:Loic d'Anterroches
Commit:9c5156e6ef34fa536363d8fa6f72e6d224954117
Message:Added the first work on the administration area.

Files: src/IDF/Form/Admin/ProjectCreate.php (1 diff)
src/IDF/Form/Admin/ProjectUpdate.php (1 diff)
src/IDF/Form/MembersConf.php (1 diff)
src/IDF/Form/SourceConf.php (2 diffs)
src/IDF/Middleware.php (1 diff)
src/IDF/Project.php (1 diff)
src/IDF/Views/Admin.php (1 diff)
src/IDF/Views/Project.php (1 diff)
src/IDF/conf/urls.php (1 diff)
src/IDF/templates/idf/admin/source.html (3 diffs)
src/IDF/templates/idf/base-simple.html (1 diff)
src/IDF/templates/idf/base.html (1 diff)
src/IDF/templates/idf/gadmin/base.html (1 diff)
src/IDF/templates/idf/gadmin/home.html (1 diff)
src/IDF/templates/idf/gadmin/projects/base.html (1 diff)
src/IDF/templates/idf/gadmin/projects/create.html (1 diff)
src/IDF/templates/idf/gadmin/projects/index.html (1 diff)
src/IDF/templates/idf/gadmin/projects/update.html (1 diff)
src/IDF/templates/idf/index.html (1 diff)

Change Details

src/IDF/Form/Admin/ProjectCreate.php
1<?php
2/* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3/*
4# ***** BEGIN LICENSE BLOCK *****
5# This file is part of InDefero, an open source project management application.
6# Copyright (C) 2008 Céondo Ltd and contributors.
7#
8# InDefero is free software; you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation; either version 2 of the License, or
11# (at your option) any later version.
12#
13# InDefero is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this program; if not, write to the Free Software
20# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21#
22# ***** END LICENSE BLOCK ***** */
23
24
25/**
26 * Create a project.
27 *
28 * A kind of merge of the member configuration, overview and the
29 * former source tab.
30 *
31 */
32class IDF_Form_Admin_ProjectCreate extends Pluf_Form
33{
34    public function initFields($extra=array())
35    {
36        $choices = array();
37        $options = array(
38                         'git' => __('git'),
39                         'svn' => __('Subversion'),
40                         'mercurial' => __('mercurial'),
41                         );
42        foreach (Pluf::f('allowed_scm', array()) as $key => $class) {
43            $choices[$options[$key]] = $key;
44        }
45
46        $this->fields['name'] = new Pluf_Form_Field_Varchar(
47                                      array('required' => true,
48                                            'label' => __('Name'),
49                                            'initial' => '',
50                                            ));
51
52        $this->fields['shortname'] = new Pluf_Form_Field_Varchar(
53                                      array('required' => true,
54                                            'label' => __('Shortname'),
55                                            'initial' => 'myproject',
56                                            'help_text' => __('It must be unique for each project and composed only of letters and digits.'),
57                                            ));
58
59        $this->fields['scm'] = new Pluf_Form_Field_Varchar(
60                    array('required' => true,
61                          'label' => __('Repository type'),
62                          'initial' => 'git',
63                          'widget_attrs' => array('choices' => $choices),
64                          'widget' => 'Pluf_Form_Widget_SelectInput',
65                          ));
66
67        $this->fields['svn_remote_url'] = new Pluf_Form_Field_Varchar(
68                    array('required' => false,
69                          'label' => __('Remote Subversion repository'),
70                          'initial' => '',
71                          'widget_attrs' => array('size' => '30'),
72                          ));
73
74        $this->fields['svn_username'] = new Pluf_Form_Field_Varchar(
75                    array('required' => false,
76                          'label' => __('Repository username'),
77                          'initial' => '',
78                          'widget_attrs' => array('size' => '15'),
79                          ));
80
81        $this->fields['svn_password'] = new Pluf_Form_Field_Varchar(
82                    array('required' => false,
83                          'label' => __('Repository password'),
84                          'initial' => '',
85                          'widget' => 'Pluf_Form_Widget_PasswordInput',
86                          ));
87
88        $this->fields['owners'] = new Pluf_Form_Field_Varchar(
89                                      array('required' => false,
90                                            'label' => __('Project owners'),
91                                            'initial' => $extra['user']->login,
92                                            'widget' => 'Pluf_Form_Widget_TextareaInput',
93                                            'widget_attrs' => array('rows' => 5,
94                                                                    'cols' => 40),
95                                            ));
96
97        $this->fields['members'] = new Pluf_Form_Field_Varchar(
98                                      array('required' => false,
99                                            'label' => __('Project members'),
100                                            'initial' => '',
101                                            'widget_attrs' => array('rows' => 7,
102                                                                    'cols' => 40),
103                                            'widget' => 'Pluf_Form_Widget_TextareaInput',
104                                            ));
105    }
106
107    public function clean_svn_remote_url()
108    {
109        $url = trim($this->cleaned_data['svn_remote_url']);
110        if (strlen($url) == 0) return $url;
111        // we accept only starting with http(s):// to avoid people
112        // trying to access the local filesystem.
113        if (!preg_match('#^(http|https)://#', $url)) {
114            throw new Pluf_Form_Invalid(__('Only a remote repository available throught http or https are allowed. For example "http://somewhere.com/svn/trunk".'));
115        }
116        return $url;
117    }
118
119    public function clean_shortname()
120    {
121        $shortname = $this->cleaned_data['shortname'];
122        if (preg_match('/[^A-Za-z0-9]/', $shortname)) {
123            throw new Pluf_Form_Invalid(__('This shortname contains illegal characters, please use only letters and digits.'));
124        }
125        $sql = new Pluf_SQL('shortname=%s', array($shortname));
126        $l = Pluf::factory('IDF_Project')->getList(array('filter'=>$sql->gen()));
127        if ($l->count() > 0) {
128            throw new Pluf_Form_Invalid(__('This shortname is already used. Please select another one.'));
129        }
130        return $shortname;
131    }
132
133    public function clean()
134    {
135        if ($this->cleaned_data['scm'] != 'svn') {
136            foreach (array('svn_remote_url', 'svn_username', 'svn_password')
137                     as $key) {
138                $this->cleaned_data[$key] = '';
139            }
140        }
141        return $this->cleaned_data;
142    }
143
144    public function save($commit=true)
145    {
146        if (!$this->isValid()) {
147            throw new Exception(__('Cannot save the model from an invalid form.'));
148        }
149        $project = new IDF_Project();
150        $project->name = $this->cleaned_data['name'];
151        $project->shortname = $this->cleaned_data['shortname'];
152        $project->description = __('Write your project description here.');
153        $project->create();
154        $conf = new IDF_Conf();
155        $conf->setProject($project);
156        $keys = array('scm', 'svn_remote_url',
157                      'svn_username', 'svn_password');
158        foreach ($keys as $key) {
159            $conf->setVal($key, $this->cleaned_data[$key]);
160        }
161        $project->created();
162        IDF_Form_MembersConf::updateMemberships($project,
163                                                $this->cleaned_data);
164        $project->membershipsUpdated();
165        return $project;
166    }
167}
168
169
src/IDF/Form/Admin/ProjectUpdate.php
1<?php
2/* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3/*
4# ***** BEGIN LICENSE BLOCK *****
5# This file is part of InDefero, an open source project management application.
6# Copyright (C) 2008 Céondo Ltd and contributors.
7#
8# InDefero is free software; you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation; either version 2 of the License, or
11# (at your option) any later version.
12#
13# InDefero is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this program; if not, write to the Free Software
20# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21#
22# ***** END LICENSE BLOCK ***** */
23
24
25/**
26 * Update a project.
27 *
28 * A kind of merge of the member configuration and overview in the
29 * project administration area.
30 *
31 */
32class IDF_Form_Admin_ProjectUpdate extends Pluf_Form
33{
34    public $project = null;
35
36    public function initFields($extra=array())
37    {
38        $this->project = $extra['project'];
39        $members = $this->project->getMembershipData('string');
40        $this->fields['name'] = new Pluf_Form_Field_Varchar(
41                                      array('required' => true,
42                                            'label' => __('Name'),
43                                            'initial' => $this->project->name,
44                                            ));
45
46        $this->fields['owners'] = new Pluf_Form_Field_Varchar(
47                                      array('required' => false,
48                                            'label' => __('Project owners'),
49                                            'initial' => $members['owners'],
50                                            'widget' => 'Pluf_Form_Widget_TextareaInput',
51                                            'widget_attrs' => array('rows' => 5,
52                                                                    'cols' => 40),
53                                            ));
54        $this->fields['members'] = new Pluf_Form_Field_Varchar(
55                                      array('required' => false,
56                                            'label' => __('Project members'),
57                                            'initial' => $members['members'],
58                                            'widget_attrs' => array('rows' => 7,
59                                                                    'cols' => 40),
60                                            'widget' => 'Pluf_Form_Widget_TextareaInput',
61                                            ));
62    }
63
64    public function save($commit=true)
65    {
66        if (!$this->isValid()) {
67            throw new Exception(__('Cannot save the model from an invalid form.'));
68        }
69        IDF_Form_MembersConf::updateMemberships($this->project,
70                                                $this->cleaned_data);
71        $this->project->membershipsUpdated();
72        $this->project->name = $this->cleaned_data['name'];
73        $this->project->update();
74    }
75}
76
77
src/IDF/Form/MembersConf.php
6363        if (!$this->isValid()) {
6464            throw new Exception(__('Cannot save the model from an invalid form.'));
6565        }
66        self::updateMemberships($this->project, $this->cleaned_data);
67        $this->project->membershipsUpdated();
68    }
69
70    /**
71     * The update of the memberships is done in different places. This
72     * avoids duplicating code.
73     *
74     * @param IDF_Project The project
75     * @param array The new memberships data in 'owners' and 'members' keys
76     */
77    public static function updateMemberships($project, $cleaned_data)
78    {
6679        // remove all the permissions
67        $cm = $this->project->getMembershipData();
80        $cm = $project->getMembershipData();
6881        $def = array('owners' => Pluf_Permission::getFromString('IDF.project-owner'),
6982                     'members' => Pluf_Permission::getFromString('IDF.project-member'));
7083        $guser = new Pluf_User();
7184        foreach ($def as $key=>$perm) {
7285            foreach ($cm[$key] as $user) {
73                Pluf_RowPermission::remove($user, $this->project, $perm);
86                Pluf_RowPermission::remove($user, $project, $perm);
7487            }
75            foreach (preg_split("/\015\012|\015|\012|\,/", $this->cleaned_data[$key], -1, PREG_SPLIT_NO_EMPTY) as $login) {
88            foreach (preg_split("/\015\012|\015|\012|\,/", $cleaned_data[$key], -1, PREG_SPLIT_NO_EMPTY) as $login) {
7689                $sql = new Pluf_SQL('login=%s', array(trim($login)));
7790                $users = $guser->getList(array('filter'=>$sql->gen()));
7891                if ($users->count() == 1) {
79                    Pluf_RowPermission::add($users[0], $this->project, $perm);
92                    Pluf_RowPermission::add($users[0], $project, $perm);
8093                }
8194            }
8295        }
src/IDF/Form/SourceConf.php
2424
2525/**
2626 * Configuration of the source.
27 *
28 * Only the modification of the login/password for subversion is
29 * authorized.
2730 */
2831class IDF_Form_SourceConf extends Pluf_Form
2932{
...... 
3134    public function initFields($extra=array())
3235    {
3336        $this->conf = $extra['conf'];
34        $this->fields['scm'] = new Pluf_Form_Field_Varchar(
35                    array('required' => true,
36                          'label' => __('Repository type'),
37                          'initial' => $this->conf->getVal('scm', 'git'),
38                          'widget_attrs' => array('choices' =>
39                                  array(
40                                        __('git') => 'git',
41                                        __('Subversion') => 'svn',
42                                        __('mercurial') => 'mercurial',
43                                        )
44                                                  ),
45                          'widget' => 'Pluf_Form_Widget_SelectInput',
46                          ));
47        $this->fields['svn_remote_url'] = new Pluf_Form_Field_Varchar(
48                    array('required' => false,
49                          'label' => __('Remote Subversion repository'),
50                          'initial' => $this->conf->getVal('svn_remote_url', ''),
51                          'widget_attrs' => array('size' => '30'),
52                          ));
53
54        $this->fields['svn_username'] = new Pluf_Form_Field_Varchar(
37        if ($this->conf->getVal('scm', 'git') == 'svn') {
38            $this->fields['svn_username'] = new Pluf_Form_Field_Varchar(
5539                    array('required' => false,
5640                          'label' => __('Repository username'),
5741                          'initial' => $this->conf->getVal('svn_username', ''),
5842                          'widget_attrs' => array('size' => '15'),
5943                          ));
6044
61        $this->fields['svn_password'] = new Pluf_Form_Field_Varchar(
45            $this->fields['svn_password'] = new Pluf_Form_Field_Varchar(
6246                    array('required' => false,
6347                          'label' => __('Repository password'),
6448                          'initial' => $this->conf->getVal('svn_password', ''),
6549                          'widget' => 'Pluf_Form_Widget_PasswordInput',
6650                          ));
67    }
68
69    public function clean_svn_remote_url()
70    {
71        $url = trim($this->cleaned_data['svn_remote_url']);
72        if (strlen($url) == 0) return $url;
73        // we accept only starting with http(s):// to avoid people
74        // trying to access the local filesystem.
75        if (!preg_match('#^(http|https)://#', $url)) {
76            throw new Pluf_Form_Invalid(__('Only a remote repository available throught http or https are allowed. For example "http://somewhere.com/svn/trunk".'));
77        }
78        return $url;
79    }
80
81    public function clean()
82    {
83        if ($this->cleaned_data['scm'] == 'git') {
84            foreach (array('svn_remote_url', 'svn_username', 'svn_password')
85                     as $key) {
86                $this->cleaned_data[$key] = '';
87            }
8851        }
89        return $this->cleaned_data;
9052    }
9153}
9254
src/IDF/Middleware.php
7171{
7272    $c = array();
7373    $c['request'] = $request;
74    $c['isAdmin'] = ($request->user->administrator or $request->user->staff);
7475    if (isset($request->project)) {
7576        $c['project'] = $request->project;
7677        $c['isOwner'] = $request->user->hasPerm('IDF.project-owner',
src/IDF/Project.php
400400        }
401401        return $this->_pconf;
402402    }
403
403
404    /**
405     * Needs to be called when you update the memberships of a
406     * project.
407     *
408     * This will allow a plugin to, for example, update some access
409     * rights to a repository.
410     */
411    public function membershipsUpdated()
412    {
413        /**
414         * [signal]
415         *
416         * IDF_Project::membershipsUpdated
417         *
418         * [sender]
419         *
420         * IDF_Project
421         *
422         * [description]
423         *
424         * This signal allows an application to update the some access
425         * rights to a repository when the project memberships is
426         * updated.
427         *
428         * [parameters]
429         *
430         * array('project' => $project)
431         *
432         */
433        $params = array('project' => $this);
434        Pluf_Signal::send('IDF_Project::membershipsUpdated',
435                          'IDF_Project', $params);
436    }
437
438    /**
439     * Needs to be called when you create a project.
440     *
441     * We cannot put it into the postSave call as the configuration of
442     * the project is not defined at that time.
443     */
444    function created()
445    {
446        /**
447         * [signal]
448         *
449         * IDF_Project::created
450         *
451         * [sender]
452         *
453         * IDF_Project
454         *
455         * [description]
456         *
457         * This signal allows an application to perform special
458         * operations at the creation of a project.
459         *
460         * [parameters]
461         *
462         * array('project' => $project)
463         *
464         */
465        $params = array('project' => $this);
466        Pluf_Signal::send('IDF_Project::created',
467                          'IDF_Project', $params);
468    }
404469}
src/IDF/Views/Admin.php
1<?php
2/* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3/*
4# ***** BEGIN LICENSE BLOCK *****
5# This file is part of InDefero, an open source project management application.
6# Copyright (C) 2008 Céondo Ltd and contributors.
7#
8# InDefero is free software; you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation; either version 2 of the License, or
11# (at your option) any later version.
12#
13# InDefero is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this program; if not, write to the Free Software
20# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21#
22# ***** END LICENSE BLOCK ***** */
23
24Pluf::loadFunction('Pluf_HTTP_URL_urlForView');
25Pluf::loadFunction('Pluf_Shortcuts_RenderToResponse');
26Pluf::loadFunction('Pluf_Shortcuts_GetObjectOr404');
27Pluf::loadFunction('Pluf_Shortcuts_GetFormForModel');
28
29/**
30 * Administration's views.
31 */
32class IDF_Views_Admin
33{
34    /**
35     * Home page of the administration.
36     *
37     * It should provide an overview of the forge status.
38     */
39    public $home_precond = array('Pluf_Precondition::staffRequired');
40    public function home($request, $match)
41    {
42        $title = __('Administer');
43        return Pluf_Shortcuts_RenderToResponse('idf/gadmin/home.html',
44                                               array(
45                                                     'page_title' => $title,
46                                                     ),
47                                               $request);
48    }
49
50    /**
51     * Projects overview.
52     *
53     */
54    public $projects_precond = array('Pluf_Precondition::staffRequired');
55    public function projects($request, $match)
56    {
57        $title = __('Projects');
58        $pag = new Pluf_Paginator(new IDF_Project());
59        $pag->class = 'recent-issues';
60        $pag->summary = __('This table shows the projects in the forge.');
61        $pag->action = 'IDF_Views_Admin::projects';
62        $pag->edit_action = array('IDF_Views_Admin::projectUpdate', 'id');
63        $pag->sort_order = array('shortname', 'ASC');
64        $list_display = array(
65             'shortname' => __('Short Name'),
66             'name' => __('Name'),
67                              );
68        $pag->configure($list_display, array(),
69                        array('shortname'));
70        $pag->items_per_page = 25;
71        $pag->no_results_text = __('No projects were found.');
72        $pag->setFromRequest($request);
73        return Pluf_Shortcuts_RenderToResponse('idf/gadmin/projects/index.html',
74                                               array(
75                                                     'page_title' => $title,
76                                                     'projects' => $pag,
77                                                     ),
78                                               $request);
79    }
80
81    /**
82     * Edition of a project.
83     *
84     * One cannot switch from one source backend to another.
85     */
86    public $projectUpdate_precond = array('Pluf_Precondition::staffRequired');
87    public function projectUpdate($request, $match)
88    {
89        $project = Pluf_Shortcuts_GetObjectOr404('IDF_Project', $match[1]);
90        $title = sprintf(__('Update %s'), $project->name);
91        $params = array(
92                        'project' => $project,
93                        );
94        if ($request->method == 'POST') {
95            $form = new IDF_Form_Admin_ProjectUpdate($request->POST, $params);
96            if ($form->isValid()) {
97                $form->save();
98                $request->user->setMessage(__('The project has been updated.'));
99                $url = Pluf_HTTP_URL_urlForView('IDF_Views_Admin::projectUpdate',
100                                                array($project->id));
101                return new Pluf_HTTP_Response_Redirect($url);
102            }
103        } else {
104            $form = new IDF_Form_Admin_ProjectUpdate(null, $params);
105        }
106        return Pluf_Shortcuts_RenderToResponse('idf/gadmin/projects/update.html',
107                                               array(
108                                                     'page_title' => $title,
109                                                     'project' => $project,
110                                                     'form' => $form,
111                                                     ),
112                                               $request);
113    }
114
115    /**
116     * Creation of a project.
117     *
118     */
119    public $projectCreate_precond = array('Pluf_Precondition::staffRequired');
120    public function projectCreate($request, $match)
121    {
122        $title = __('Create Project');
123        $extra = array('user' => $request->user);
124        if ($request->method == 'POST') {
125            $form = new IDF_Form_Admin_ProjectCreate($request->POST, $extra);
126            if ($form->isValid()) {
127                $project = $form->save();
128                $request->user->setMessage(__('The project has been created.'));
129                $url = Pluf_HTTP_URL_urlForView('IDF_Views_Admin::projects');
130                return new Pluf_HTTP_Response_Redirect($url);
131            }
132        } else {
133            $form = new IDF_Form_Admin_ProjectCreate(null, $extra);
134        }
135        $base = Pluf::f('url_base').Pluf::f('idf_base').'/p/';
136        return Pluf_Shortcuts_RenderToResponse('idf/gadmin/projects/create.html',
137                                               array(
138                                                     'page_title' => $title,
139                                                     'form' => $form,
140                                                     'base_url' => $base,
141                                                     ),
142                                               $request);
143    }
144
145}
src/IDF/Views/Project.php
378378    {
379379        $prj = $request->project;
380380        $title = sprintf(__('%s Source'), (string) $prj);
381        $extra = array(
382                       'conf' => $request->conf,
383                       );
384        if ($request->method == 'POST') {
385            $form = new IDF_Form_SourceConf($request->POST, $extra);
386            if ($form->isValid()) {
387                foreach ($form->cleaned_data as $key=>$val) {
388                    $request->conf->setVal($key, $val);
381        $form = null;
382        $remote_svn = false;
383        if ($request->conf->getVal('scm') == 'svn' and
384            strlen($request->conf->getVal('svn_remote_url')) > 0) {
385            $remote_svn = true;
386            $extra = array(
387                           'conf' => $request->conf,
388                           );
389            if ($request->method == 'POST') {
390                $form = new IDF_Form_SourceConf($request->POST, $extra);
391                if ($form->isValid()) {
392                    foreach ($form->cleaned_data as $key=>$val) {
393                        $request->conf->setVal($key, $val);
394                    }
395                    $request->user->setMessage(__('The project source configuration has been saved.'));
396                    $url = Pluf_HTTP_URL_urlForView('IDF_Views_Project::adminSource',
397                                                    array($prj->shortname));
398                    return new Pluf_HTTP_Response_Redirect($url);
389399                }
390                $request->user->setMessage(__('The project source configuration has been saved.'));
391                $url = Pluf_HTTP_URL_urlForView('IDF_Views_Project::adminSource',
392                                                array($prj->shortname));
393                return new Pluf_HTTP_Response_Redirect($url);
394            }
395        } else {
396            $params = array();
397            $keys = array('scm', 'svn_remote_url',
398                          'svn_username', 'svn_password');
399            foreach ($keys as $key) {
400                $_val = $request->conf->getVal($key, false);
401                if ($_val !== false) {
402                    $params[$key] = $_val;
400            } else {
401                $params = array();
402                foreach (array('svn_username', 'svn_password') as $key) {
403                    $_val = $request->conf->getVal($key, false);
404                    if ($_val !== false) {
405                        $params[$key] = $_val;
406                    }
403407                }
408                if (count($params) == 0) {
409                    $params = null; //Nothing in the db, so new form.
410                }
411                $form = new IDF_Form_SourceConf($params, $extra);
404412            }
405            if (count($params) == 0) {
406                $params = null; //Nothing in the db, so new form.
407            }
408            $form = new IDF_Form_SourceConf($params, $extra);
409413        }
414        $scm = $request->conf->getVal('scm', 'git');
415        $options = array(
416                         'git' => __('git'),
417                         'svn' => __('Subversion'),
418                         'mercurial' => __('mercurial'),
419                         );
420        $repository_type = $options[$scm];
410421        return Pluf_Shortcuts_RenderToResponse('idf/admin/source.html',
411422                                               array(
423                                                     'remote_svn' => $remote_svn,
424                                                     'repository_access' => $prj->getRemoteAccessUrl(),
425                                                     'repository_type' => $repository_type,
412426                                                     'page_title' => $title,
413427                                                     'form' => $form,
414428                                                     ),
src/IDF/conf/urls.php
374374               'model' => 'IDF_Views_Api',
375375               'method' => 'issueCreate');
376376
377// ---------- FORGE ADMIN --------------------------------
378
379$ctl[] = array('regex' => '#^/admin/$#',
380               'base' => $base,
381               'priority' => 4,
382               'model' => 'IDF_Views_Admin',
383               'method' => 'home');
384
385$ctl[] = array('regex' => '#^/admin/projects/$#',
386               'base' => $base,
387               'priority' => 4,
388               'model' => 'IDF_Views_Admin',
389               'method' => 'projects');
390
391$ctl[] = array('regex' => '#^/admin/projects/(\d+)/$#',
392               'base' => $base,
393               'priority' => 4,
394               'model' => 'IDF_Views_Admin',
395               'method' => 'projectUpdate');
396
397$ctl[] = array('regex' => '#^/admin/projects/create/$#',
398               'base' => $base,
399               'priority' => 4,
400               'model' => 'IDF_Views_Admin',
401               'method' => 'projectCreate');
402
403
377404return $ctl;
src/IDF/templates/idf/admin/source.html
11{extends "idf/admin/base.html"}
22{block docclass}yui-t1{assign $inSource = true}{/block}
33{block body}
4{if $form.errors}
4{if $remote_svn and $form.errors}
55<div class="px-message-error">
66<p>{trans 'The form contains some errors. Please correct them to update the source configuration.'}</p>
77{if $form.get_top_errors}
...... 
1212<form method="post" action=".">
1313<table class="form" summary="">
1414<tr>
15<th><strong>{$form.f.scm.labelTag}:</strong></th>
16<td>{if $form.f.scm.errors}{$form.f.scm.fieldErrors}{/if}
17{$form.f.scm|unsafe}
15<th>{trans 'Repository type:'}</th>
16<td>{$repository_type}
1817</td>
1918</tr>
2019<tr>
21<th>{$form.f.svn_remote_url.labelTag}:</th>
22<td>{if $form.f.svn_remote_url.errors}{$form.f.svn_remote_url.fieldErrors}{/if}
23{$form.f.svn_remote_url|unsafe}
20<th>{trans 'Repository access:'}</th>
21<td>{$repository_access}
2422</td>
25</tr>
23</tr>{if $remote_svn}
2624<tr>
2725<th>{$form.f.svn_username.labelTag}:</th>
2826<td>{if $form.f.svn_username.errors}{$form.f.svn_username.fieldErrors}{/if}
...... 
4038<td>
4139<input type="submit" value="{trans 'Save Changes'}" name="submit" />
4240</td>
43</tr>
41</tr>{/if}
4442</table>
4543</form>
4644{/block}
4745{block context}
4846<div class="issue-submit-info">
49<p><strong>{trans 'Instructions:'}</strong></p>
50<p>{blocktrans}You can select the type of repository you want. In the case of subversion, you can use optionally a remote repository instead of the local one.{/blocktrans}</p>
47<p>{blocktrans}You can find here the current repository configuration of your project.{/blocktrans}</p>
5148</div>
5249{/block}
src/IDF/templates/idf/base-simple.html
3535  <div id="hd">
3636    <p class="top"><a href="#title" accesskey="2"></a>
3737{if !$user.isAnonymous()}{aurl 'url', 'IDF_Views_User::myAccount'}{blocktrans}Welcome, <strong><a class="userw" href="{$url}">{$user}</a></strong>.{/blocktrans} <a href="{url 'IDF_Views::logout'}">{trans 'Sign Out'}</a>{else}<a href="{url 'IDF_Views::login'}">{trans 'Sign in or create your account'}</a>{/if}
38{if $isAdmin}| <a href="{url 'IDF_Views_Admin::home'}">{trans 'Administer'}</a>{/if}
3839| <a href="{url 'IDF_Views::faq'}" title="{trans 'Help and accessibility features'}">{trans 'Help'}</a>
3940    </p>
4041      <h1 id="title" class="title">{block title}{$page_title}{/block}</h1>
41
4242  </div>
4343  <div id="bd">
4444    <div id="yui-main">
src/IDF/templates/idf/base.html
3737    <p class="top"><a href="#title" accesskey="2"></a>
3838{if !$user.isAnonymous()}{aurl 'url', 'IDF_Views_User::myAccount'}{blocktrans}Welcome, <strong><a class="userw" href="{$url}">{$user}</a></strong>.{/blocktrans} <a href="{url 'IDF_Views::logout'}">{trans 'Sign Out'}</a>{else}<a href="{url 'IDF_Views::login'}">{trans 'Sign in or create your account'}</a>{/if}
3939{if $project} | <a href="{url 'IDF_Views::index'}">{trans 'Project List'}</a>{/if}
40{if $isAdmin}| <a href="{url 'IDF_Views_Admin::home'}">{trans 'Administer'}</a>{/if}
4041| <a href="{url 'IDF_Views::faq'}" title="{trans 'Help and accessibility features'}">{trans 'Help'}</a>
4142    </p>
4243<div id="header">
src/IDF/templates/idf/gadmin/base.html
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2{*
3# ***** BEGIN LICENSE BLOCK *****
4# This file is part of InDefero, an open source project management application.
5# Copyright (C) 2008 Céondo Ltd and contributors.
6#
7# InDefero is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License as published by
9# the Free Software Foundation; either version 2 of the License, or
10# (at your option) any later version.
11#
12# InDefero is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program; if not, write to the Free Software
19# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20#
21# ***** END LICENSE BLOCK *****
22*}<html lang="en">
23<head>
24  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
25  <link rel="stylesheet" type="text/css" href="{media '/idf/css/yui.css'}" />
26  <link rel="stylesheet" type="text/css" href="{media '/idf/css/style.css'}" />
27  <!--[if lt IE 7]>
28  <link rel="stylesheet" type="text/css" href="{media '/idf/css/ie6.css'}" />
29  <![endif]-->
30  {block extraheader}{/block}
31  <title>{block pagetitle}{$page_title|strip_tags}{/block}</title>
32</head>
33<body>
34<div id="{block docid}doc3{/block}" class="{block docclass}yui-t3{/block}">
35  <div id="hd">
36    <p class="top"><a href="#title" accesskey="2"></a>
37{aurl 'url', 'IDF_Views_User::myAccount'}{blocktrans}Welcome, <strong><a class="userw" href="{$url}">{$user}</a></strong>.{/blocktrans} <a href="{url 'IDF_Views::logout'}">{trans 'Sign Out'}</a>
38| <a href="{url 'IDF_Views::index'}">{trans 'Project List'}</a>
39| <a href="{url 'IDF_Views::faq'}" title="{trans 'Help and accessibility features'}">{trans 'Help'}</a>
40    </p>
41<div id="header">
42<div id="main-tabs">
43  <a accesskey="1" href="{url 'IDF_Views_Admin::home'}"{block tabhome}{/block}>{trans 'Administer'}</a>
44  <a href="{url 'IDF_Views_Admin::projects'}"{block tabprojects}{/block}>{trans 'Projects'}</a>
45</div>
46<div id="sub-tabs">{block subtabs}{/block}</div>
47</div>
48      <h1 id="title" class="title">{block title}{$page_title}{/block}</h1>
49  </div>
50  <div id="bd">
51    <div id="yui-main">
52      <div class="yui-b">
53    <div class="yui-g">
54          {if $user and $user.id}{getmsgs $user}{/if}
55      <div class="content">{block body}{/block}</div>
56    </div>
57      </div>
58    </div>
59    <div class="yui-b context">{block context}{/block}</div>
60  </div>
61  <div id="ft">{block foot}{/block}</div>
62</div>
63<script type="text/javascript" src="{media '/idf/js/jquery-1.2.6.min.js'}"></script>
64{include 'idf/js-hotkeys.html'}
65{block javascript}{/block}
66</body>
67</html>
src/IDF/templates/idf/gadmin/home.html
1{extends "idf/gadmin/base.html"}
2{block docclass}yui-t2{/block}
3{block tabhome} class="active"{/block}
4{block subtabs}
5{trans 'Welcome'}
6{/block}
7{block body}
8<p>{blocktrans}You have here access to the administration of the forge.{/blocktrans}</p>
9{/block}
10{block context}
11
12{/block}
13
14{block foot}<div id="branding">Powered by <a href="http://www.indefero.net" title="InDefero, bug tracking and more">InDefero</a>,<br />a <a href="http://www.ceondo.com">Céondo Ltd</a> initiative.</div>{/block}
src/IDF/templates/idf/gadmin/projects/base.html
1{extends "idf/gadmin/base.html"}
2{block tabprojects} class="active"{/block}
3{block subtabs}
4<a {if $inIndex}class="active" {/if}href="{url 'IDF_Views_Admin::projects'}">{trans 'Project List'}</a> |
5<a {if $inCreate}class="active" {/if}href="{url 'IDF_Views_Admin::projectCreate'}">{trans 'Create Project'}</a>
6{/block}
src/IDF/templates/idf/gadmin/projects/create.html
1{extends "idf/gadmin/projects/base.html"}
2
3{block docclass}yui-t3{assign $inCreate=true}{/block}
4
5{block body}
6{if $form.errors}
7<div class="px-message-error">
8<p>{trans 'The form contains some errors. Please correct them to create the project.'}</p>
9{if $form.get_top_errors}
10{$form.render_top_errors|unsafe}
11{/if}
12</div>
13{/if}
14<form method="post" action=".">
15<table class="form" summary="">
16<tr>
17<th><strong>{$form.f.name.labelTag}:</strong></th>
18<td>
19{if $form.f.name.errors}{$form.f.name.fieldErrors}{/if}
20{$form.f.name|unsafe}
21</td>
22</tr>
23<tr>
24<th><strong>{$form.f.shortname.labelTag}:</strong></th>
25<td>
26{if $form.f.shortname.errors}{$form.f.shortname.fieldErrors}{/if}
27{$base_url}{$form.f.shortname|unsafe}/<br />
28<span class="helptext">{$form.f.shortname.help_text}</span>
29</td>
30</tr>
31<tr>
32<th><strong>{$form.f.scm.labelTag}:</strong></th>
33<td>{if $form.f.scm.errors}{$form.f.scm.fieldErrors}{/if}
34{$form.f.scm|unsafe}
35</td>
36</tr>
37<tr class="svn-form">
38<th>{$form.f.svn_remote_url.labelTag}:</th>
39<td>{if $form.f.svn_remote_url.errors}{$form.f.svn_remote_url.fieldErrors}{/if}
40{$form.f.svn_remote_url|unsafe}
41</td>
42</tr>
43<tr class="svn-form">
44<th>{$form.f.svn_username.labelTag}:</th>
45<td>{if $form.f.svn_username.errors}{$form.f.svn_username.fieldErrors}{/if}
46{$form.f.svn_username|unsafe}
47</td>
48</tr>
49<tr class="svn-form">
50<th>{$form.f.svn_password.labelTag}:</th>
51<td>{if $form.f.svn_password.errors}{$form.f.svn_password.fieldErrors}{/if}
52{$form.f.svn_password|unsafe}
53</td>
54</tr>
55<tr>
56<th><strong>{$form.f.owners.labelTag}:</strong></th>
57<td>
58{if $form.f.owners.errors}{$form.f.owners.fieldErrors}{/if}
59{$form.f.owners|unsafe}<br />
60<span class="helptext">{trans 'Provide at least one owner for the project.'}</span>
61</td>
62</tr>
63<tr>
64<th>{$form.f.members.labelTag}:</th>
65<td>
66{if $form.f.members.errors}{$form.f.members.fieldErrors}{/if}
67{$form.f.members|unsafe}
68</td>
69</tr>
70<tr>
71<td>&nbsp;</td>
72<td>
73<input type="submit" value="{trans 'Create Project'}" name="submit" />
74</td>
75</tr>
76</table>
77</form>
78
79{/block}
80
81{block context}
82<div class="issue-submit-info">
83<p><strong>{trans 'Instructions:'}</strong></p>
84<p>{blocktrans}You can select the type of repository you want. In the case of subversion, you can use optionally a remote repository instead of the local one.{/blocktrans}</p>
85<p>{blocktrans}<strong>Once you have defined the repository type, you cannot change it</strong>.{/blocktrans}</p>
86</div>
87<div class="issue-submit-info">
88{blocktrans}
89<p>Specify each person by its login. Each person must have already registered with the given login.</p>
90<p>Separate the logins with commas and/or new lines.</p>
91{/blocktrans}
92</div>
93<div class="issue-submit-info">
94{blocktrans}
95<p><strong>Notes:</strong></p>
96<p>A project owner may make any change to this project, including removing other project owners. You need to be carefull when you give owner rights.</p>
97<p>A project member will not have access to the administration area but will have more options available in the use of the project.</p>
98{/blocktrans}
99</div>
100{/block}
101
102{block javascript}{literal}
103<script type="text/javascript">
104$(document).ready(function() {
105    // Hide if not svn
106    if ($("#id_scm option:selected").val() != "svn") {
107        $(".svn-form").hide();
108    }
109    $("#id_scm").change(function () {
110        if ($("#id_scm option:selected").val() == "svn") {
111            $(".svn-form").show();
112        } else {
113            $(".svn-form").hide();
114        }
115    });
116});
117</script>
118{/literal}{/block}
119{*
120
121 $("select").change(function () {
122          var str = "";
123          $("select option:selected").each(function () {
124                str += $(this).text() + " ";
125              });
126          $("div").text(str);
127        })
128        .trigger('change');
129
130*}
src/IDF/templates/idf/gadmin/projects/index.html
1{extends "idf/gadmin/projects/base.html"}
2
3{block docclass}yui-t2{assign $inIndex=true}{/block}
4
5{block body}
6{$projects.render}
7{/block}
8
src/IDF/templates/idf/gadmin/projects/update.html
1{extends "idf/gadmin/projects/base.html"}
2{block body}
3{if $form.errors}
4<div class="px-message-error">
5<p>{trans 'The form contains some errors. Please correct them to update the project.'}</p>
6{if $form.get_top_errors}
7{$form.render_top_errors|unsafe}
8{/if}
9</div>
10{/if}
11<form method="post" action=".">
12<table class="form" summary="">
13<tr>
14<th><strong>{$form.f.name.labelTag}:</strong></th>
15<td>
16{if $form.f.name.errors}{$form.f.name.fieldErrors}{/if}
17{$form.f.name|unsafe}
18</td>
19</tr>
20<tr>
21<th><strong>{$form.f.owners.labelTag}:</strong></th>
22<td>
23{if $form.f.owners.errors}{$form.f.owners.fieldErrors}{/if}
24{$form.f.owners|unsafe}<br />
25<span class="helptext">{trans 'Provide at least one owner for the project.'}</span>
26</td>
27</tr>
28<tr>
29<th>{$form.f.members.labelTag}:</th>
30<td>
31{if $form.f.members.errors}{$form.f.members.fieldErrors}{/if}
32{$form.f.members|unsafe}
33</td>
34</tr>
35<tr>
36<td>&nbsp;</td>
37<td>
38<input type="submit" value="{trans 'Update Project'}" name="submit" />
39| <a href="{url 'IDF_Views_Admin::projects'}">{trans 'Cancel'}</a>
40</td>
41</tr>
42</table>
43</form>
44{/block}
45{block context}
46<div class="issue-submit-info">
47{blocktrans}
48<p><strong>Instructions:</strong></p>
49<p>Specify each person by its login. Each person must have already registered with the given login.</p>
50<p>Separate the logins with commas and/or new lines.</p>
51{/blocktrans}
52</div>
53<div class="issue-submit-info">
54{blocktrans}
55<p><strong>Notes:</strong></p>
56<p>A project owner may make any change to this project, including removing other project owners. You need to be carefull when you give owner rights.</p>
57<p>A project member will not have access to the administration area but will have more options available in the use of the project.</p>
58{/blocktrans}
59</div>
60{/block}
61
62
63
src/IDF/templates/idf/index.html
11{extends "idf/base-simple.html"}
22{block docclass}yui-t1{/block}
3{block tabhome} class="active"{/block}
4{block subtabs}<a href="{url 'IDF_Views::index'}" class="active">{trans 'Projects'}</a>{/block}
35{block body}
46{if $projects.count() == 0}
57<p>{trans 'No projects managed with InDefero were found.'}</p>

Archive Download the corresponding diff file

Branches:
dev
master
newdiff
svn