Forums | Mahara Community

Developers /
View Feedback & 'commentfiles'


anonymous profile picture
Deleted user
Posts: 59

18 May 2011, 7:06 AM

Hi everyone!

At the moment, when feedback is left on a view and a file attached to that feedback, it is put in the users  folder called 'commentfiles'.

I think this is an awesome feature for assessment records and an assessment process as a whole. However, the commentfiles are all bunched together from every view.

Does anyone know if it is possible to put the feedback attachments in a folder for that particular view instead? Then there would be more organised feedback. 

I can hack around with code, but would certainly appreciate some guidance and/or direction!

Cheers!

anonymous profile picture
Deleted user
Posts: 808

19 May 2011, 4:47 PM

Hi Tom, the place to hack around with the code is in the function add_feedback_form_submit in htdocs/artefact/comment/lib.php, that's where the attachments are saved.  That $folderid variable is the current folder, but you'll need to get/create a subfolder of that with the view name or id.

Something similar is done with subfolders when copying views, so have a look at default_parent_for_copy() which gets a subfolder (creating it if necessary I think).

anonymous profile picture
Deleted user
Posts: 59

06 June 2011, 5:42 PM

We had a hack around with the code in htdocs/artefact/comment/lib.php and changed:

          safe_require('artefact', 'file');
 
          $ownerlang = empty($data->owner) ? get_config('lang') : get_user_language($data->owner);
!         $folderid = ArtefactTypeFolder::get_folder_id(
              get_string_from_language($ownerlang, 'feedbackattachdirname', 'artefact.comment'),
              get_string_from_language($ownerlang, 'feedbackattachdirdesc', 'artefact.comment'),
              null, true, $data->owner, $data->group, $data->institution
          );
 
          $attachment = (object) array(
              'owner'         => $data->owner,
              'group'         => $data->group,

 

to:

 safe_require('artefact', 'file');
 
          $ownerlang = empty($data->owner) ? get_config('lang') : get_user_language($data->owner);
!         $foldercommentid = ArtefactTypeFolder::get_folder_id(
              get_string_from_language($ownerlang, 'feedbackattachdirname', 'artefact.comment'),
              get_string_from_language($ownerlang, 'feedbackattachdirdesc', 'artefact.comment'),
              null, true, $data->owner, $data->group, $data->institution
          );
 
+         $folderid = ArtefactTypeFolder::get_folder_id(
+             $view->get('title'),
+             get_string_from_language($ownerlang, 'feedbackattachdirdesc', 'artefact.comment'),
+             intval($foldercommentid), true, $data->owner, $data->group, $data->institution
+         );
+
          $attachment = (object) array(
              'owner'         => $data->owner,
              'group'         => $data->group,

         

It has the desired effect, but will also create another subfolder when the view title is changed... which is not exactly what I planned originally

Comments are welcome, please! :P

anonymous profile picture
Deleted user
Posts: 808

06 June 2011, 10:49 PM

If you want to avoid creating new subfolders when the view title changes, use the view id in the subfolder title, and put the view title into the subfolder description.

4 results