diff --git a/src/IDF/Form/IssueCreate.php b/src/IDF/Form/IssueCreate.php index 9cacac6..56f9ceb 100644 --- a/src/IDF/Form/IssueCreate.php +++ b/src/IDF/Form/IssueCreate.php @@ -276,6 +276,7 @@ class IDF_Form_IssueCreate extends Pluf_Form $comment->create(); // If we have a file, create the IDF_IssueFile and attach // it to the comment. + $created_files = array(); for ($i=1;$i<4;$i++) { if ($this->cleaned_data['attachment'.$i]) { $file = new IDF_IssueFile(); @@ -283,8 +284,36 @@ class IDF_Form_IssueCreate extends Pluf_Form $file->submitter = $this->user; $file->comment = $comment; $file->create(); + $created_files[] = $file; } } + /** + * [signal] + * + * IDF_Issue::create + * + * [sender] + * + * IDF_Form_IssueCreate + * + * [description] + * + * This signal allows an application to perform a set of tasks + * just after the creation of an issue. The comment contains + * the description of the issue. + * + * [parameters] + * + * array('issue' => $issue, + * 'comment' => $comment, + * 'files' => $attached_files); + * + */ + $params = array('issue' => $issue, + 'comment' => $comment, + 'files' => $created_files); + Pluf_Signal::send('IDF_Issue::create', 'IDF_Form_IssueCreate', + $params); return $issue; } diff --git a/src/IDF/Form/IssueUpdate.php b/src/IDF/Form/IssueUpdate.php index 3422551..2d5245f 100644 --- a/src/IDF/Form/IssueUpdate.php +++ b/src/IDF/Form/IssueUpdate.php @@ -305,6 +305,7 @@ class IDF_Form_IssueUpdate extends IDF_Form_IssueCreate $this->issue->submitter != $this->user->id) { $this->issue->setAssoc($this->user); // interested user. } + $attached_files = array(); for ($i=1;$i<4;$i++) { if ($this->cleaned_data['attachment'.$i]) { $file = new IDF_IssueFile(); @@ -312,8 +313,36 @@ class IDF_Form_IssueUpdate extends IDF_Form_IssueCreate $file->submitter = $this->user; $file->comment = $comment; $file->create(); + $attached_files[] = $file; } } + /** + * [signal] + * + * IDF_Issue::update + * + * [sender] + * + * IDF_Form_IssueUpdate + * + * [description] + * + * This signal allows an application to perform a set of tasks + * just after the update of an issue. + * + * [parameters] + * + * array('issue' => $issue, + * 'comment' => $comment, + * 'files' => $attached_files); + * + */ + $params = array('issue' => $this->issue, + 'comment' => $comment, + 'files' => $attached_files); + Pluf_Signal::send('IDF_Issue::update', 'IDF_Form_IssueUpdate', + $params); + return $this->issue; } } diff --git a/src/IDF/Form/ReviewCreate.php b/src/IDF/Form/ReviewCreate.php index 2b914e4..e709695 100644 --- a/src/IDF/Form/ReviewCreate.php +++ b/src/IDF/Form/ReviewCreate.php @@ -205,6 +205,30 @@ class IDF_Form_ReviewCreate extends Pluf_Form $patch->patch = $this->cleaned_data['patch']; $patch->create(); $patch->notify($this->project->getConf()); + /** + * [signal] + * + * IDF_Review::create + * + * [sender] + * + * IDF_Form_ReviewCreate + * + * [description] + * + * This signal allows an application to perform a set of tasks + * just after the creation of a review and the notification. + * + * [parameters] + * + * array('review' => $review, + * 'patch' => $patch); + * + */ + $params = array('review' => $review, + 'patch' => $patch); + Pluf_Signal::send('IDF_Review::create', 'IDF_Form_ReviewCreate', + $params); return $review; } diff --git a/src/IDF/Form/UpdateUpload.php b/src/IDF/Form/UpdateUpload.php index f25c81f..258890b 100644 --- a/src/IDF/Form/UpdateUpload.php +++ b/src/IDF/Form/UpdateUpload.php @@ -146,6 +146,28 @@ class IDF_Form_UpdateUpload extends Pluf_Form $this->upload->modif_dtime = gmdate('Y-m-d H:i:s'); $this->upload->update(); $this->upload->batchAssoc('IDF_Tag', $tags); + /** + * [signal] + * + * IDF_Upload::update + * + * [sender] + * + * IDF_Form_UpdateUpload + * + * [description] + * + * This signal allows an application to perform a set of tasks + * just after the update of an uploaded file. + * + * [parameters] + * + * array('upload' => $upload); + * + */ + $params = array('upload' => $this->upload); + Pluf_Signal::send('IDF_Upload::update', + 'IDF_Form_UpdateUpload', $params); return $this->upload; } } diff --git a/src/IDF/Form/Upload.php b/src/IDF/Form/Upload.php index 7379e2a..241fd08 100644 --- a/src/IDF/Form/Upload.php +++ b/src/IDF/Form/Upload.php @@ -176,6 +176,28 @@ class IDF_Form_Upload extends Pluf_Form } // Send the notification $upload->notify($this->project->getConf()); + /** + * [signal] + * + * IDF_Upload::create + * + * [sender] + * + * IDF_Form_Upload + * + * [description] + * + * This signal allows an application to perform a set of tasks + * just after the upload of a file and after the notification run. + * + * [parameters] + * + * array('upload' => $upload); + * + */ + $params = array('upload' => $upload); + Pluf_Signal::send('IDF_Upload::create', 'IDF_Form_Upload', + $params); return $upload; } } diff --git a/src/IDF/Views/Download.php b/src/IDF/Views/Download.php index 8af4249..972f286 100644 --- a/src/IDF/Views/Download.php +++ b/src/IDF/Views/Download.php @@ -152,6 +152,29 @@ class IDF_Views_Download if ($request->method == 'POST') { $fname = $upload->file; @unlink(Pluf::f('upload_path').'/'.$prj->shortname.'/files/'.$fname); + /** + * [signal] + * + * IDF_Upload::delete + * + * [sender] + * + * IDF_Form_UpdateUpload + * + * [description] + * + * This signal allows an application to perform a set of tasks + * just before the deletion of the corresponding object in the + * database but just after the deletion from the storage. + * + * [parameters] + * + * array('upload' => $upload); + * + */ + $params = array('upload' => $upload); + 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',