Browse Source

Added the capability for plug-ins to "listen" to add/remove attachment events.

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@1651 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 13 years ago
parent
commit
b699dc4ca6
1 changed files with 4 additions and 0 deletions
  1. 4 0
      modules/itop-attachments/model.attachments.php

+ 4 - 0
modules/itop-attachments/model.attachments.php

@@ -389,6 +389,7 @@ EOF
 	{
 		$('#attachment_'+att_id).attr('name', 'removed_attachments[]');
 		$('#display_attachment_'+att_id).hide();
+		$('#attachment_plugin').trigger('remove_attachment', [att_id]);
 		return false; // Do not submit the form !
 	}
 	function ajaxFileUpload()
@@ -433,6 +434,8 @@ EOF
 							{
 								$('#display_attachment_'+data.att_id).hover( function() { $(this).children(':button').toggleClass('btn_hidden'); } );
 							}
+							$('#attachment_plugin').trigger('add_attachment', [data.att_id, data.msg]);
+							
 							//alert(data.msg);
 						}
 					}
@@ -465,6 +468,7 @@ EOF
 			$oPage->p(Dict::S('Attachments:AddAttachment').'<input type="file" name="file" id="file" onChange="ajaxFileUpload();"><span style="display:none;" id="attachment_loading">&nbsp;<img src="../images/indicator.gif"></span> '.$sMaxUpload);
 			//$oPage->p('<input type="button" onClick="ajaxFileUpload();" value=" Upload !">');
 			$oPage->p('<span style="display:none;" id="attachment_loading">Loading, please wait...</span>');
+			$oPage->p('<input type="hidden" id="attachment_plugin"/>');
 			$oPage->add('</fieldset>');
 			if ($this->m_bDeleteEnabled)
 			{