public function save($commit = true) { if (!$this->isValid()) { throw new Exception(__('Cannot save the model from an invalid form.')); } IDF_Form_MembersConf::updateMemberships($this->project, $this->cleaned_data); $this->project->membershipsUpdated(); $this->project->name = $this->cleaned_data['name']; $this->project->update(); }
public function save($commit = true) { if (!$this->isValid()) { throw new Exception(__('Cannot save the model from an invalid form.')); } IDF_Form_MembersConf::updateMemberships($this->project, $this->cleaned_data); $this->project->membershipsUpdated(); $this->project->name = $this->cleaned_data['name']; $this->project->shortdesc = $this->cleaned_data['shortdesc']; $this->project->update(); $keys = array('mtn_master_branch'); foreach ($keys as $key) { if (!empty($this->cleaned_data[$key])) { $this->project->getConf()->setVal($key, $this->cleaned_data[$key]); } } }
public function adminMembers($request, $match) { $prj = $request->project; $title = sprintf(__('%s Project Members'), (string) $prj); $params = array('project' => $prj, 'user' => $request->user); if ($request->method == 'POST') { $form = new IDF_Form_MembersConf($request->POST, $params); if ($form->isValid()) { $form->save(); $request->user->setMessage(__('The project membership has been saved.')); $url = Pluf_HTTP_URL_urlForView('IDF_Views_Project::adminMembers', array($prj->shortname)); return new Pluf_HTTP_Response_Redirect($url); } } else { $form = new IDF_Form_MembersConf($prj->getMembershipData('string'), $params); } return Pluf_Shortcuts_RenderToResponse('idf/admin/members.html', array('page_title' => $title, 'form' => $form), $request); }
public function clean_authorized_users() { return IDF_Form_MembersConf::checkBadLogins($this->cleaned_data['authorized_users']); }
public function save($commit = true) { if (!$this->isValid()) { throw new Exception(__('Cannot save the model from an invalid form.')); } $project = new IDF_Project(); $project->name = $this->cleaned_data['name']; $project->shortname = $this->cleaned_data['shortname']; $project->private = $this->cleaned_data['private_project']; $project->description = __('Click on the Project Management tab to set the description of your project.'); $project->create(); $conf = new IDF_Conf(); $conf->setProject($project); $keys = array('scm', 'svn_remote_url', 'svn_username', 'svn_password'); foreach ($keys as $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, $this->cleaned_data); $project->membershipsUpdated(); return $project; }
public function save($commit = true) { if (!$this->isValid()) { throw new Exception(__('Cannot save the model from an invalid form.')); } $project = new IDF_Project(); $project->name = $this->cleaned_data['name']; $project->shortname = $this->cleaned_data['shortname']; $project->shortdesc = $this->cleaned_data['shortdesc']; if ($this->cleaned_data['template'] != '--') { // Find the template project $sql = new Pluf_SQL('shortname=%s', array($this->cleaned_data['template'])); $tmpl = Pluf::factory('IDF_Project')->getOne(array('filter' => $sql->gen())); $project->private = $tmpl->private; $project->description = $tmpl->description; } else { $project->private = $this->cleaned_data['private_project']; $project->description = __('Click on the Project Management tab to set the description of your project.'); } $project->create(); $conf = new IDF_Conf(); $conf->setProject($project); $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] : ''; $conf->setVal($key, $this->cleaned_data[$key]); } if ($this->cleaned_data['template'] != '--') { $tmplconf = new IDF_Conf(); $tmplconf->setProject($tmpl); // We need to get all the configuration variables we want from // the old project and put them into the new project. $props = array('labels_download_predefined' => IDF_Form_UploadConf::init_predefined, 'labels_download_one_max' => IDF_Form_UploadConf::init_one_max, 'labels_wiki_predefined' => IDF_Form_WikiConf::init_predefined, 'labels_wiki_one_max' => IDF_Form_WikiConf::init_one_max, 'labels_issue_template' => IDF_Form_IssueTrackingConf::init_template, 'labels_issue_open' => IDF_Form_IssueTrackingConf::init_open, 'labels_issue_closed' => IDF_Form_IssueTrackingConf::init_closed, 'labels_issue_predefined' => IDF_Form_IssueTrackingConf::init_predefined, 'labels_issue_one_max' => IDF_Form_IssueTrackingConf::init_one_max, 'webhook_url' => '', 'downloads_access_rights' => 'all', 'review_access_rights' => 'all', 'wiki_access_rights' => 'all', 'source_access_rights' => 'all', 'issues_access_rights' => 'all', 'downloads_notification_email' => '', 'review_notification_email' => '', 'wiki_notification_email' => '', 'source_notification_email' => '', 'issues_notification_email' => ''); foreach ($props as $prop => $def) { $conf->setVal($prop, $tmplconf->getVal($prop, $def)); } } $project->created(); if ($this->cleaned_data['template'] == '--') { IDF_Form_MembersConf::updateMemberships($project, $this->cleaned_data); } else { // Get the membership of the template $tmpl IDF_Form_MembersConf::updateMemberships($project, $tmpl->getMembershipData('string')); } $project->membershipsUpdated(); return $project; }