duplicate filtering and attachment indicator

integrated my take on duplicate filtering as well as some additional code to display a paperclip icon on any attached items in the new media modal.

note i also added a bit of code to force the modal to requery after attachments are made to ensure it reflects any changes to an item being "attached" made via your new button, the file gallery metabox or other external sources. this is important for the attachment indicator i have added but also if duplicate filtering is enabled to ensure the correct original/copy is shown.

hope this is of some help.