I've developed a resource module that works in most respects except for appearing in a popup. I've looked hard at the code for the 'page' module and I cannot see where I have differed except that the URL for page appends "&inpopup=1" whereas my code doesn't and I'm not clear where I would include that.
I had thought that the line:
$PAGE->set_url('/mod/presentationupload/view.php', array('id' => $cm->id, 'inpopup'=>1));
would do this but no. If anyone can offer a place to look I'd be greatful.