array('create images'), 'title' => 'Imagex upload', 'page callback' => 'imagex_upload_image', 'type' => MENU_CALLBACK); $items['imagex/get'] = array( 'title' => 'Imagex thumbs', 'access arguments' => array('create images'), 'type' => MENU_CALLBACK, 'page callback' => 'imagex_js' ); $items['imagex'] = array( 'title' => 'Upload images', 'access arguments' => array('create images'), 'type' => MENU_CALLBACK, 'page callback' => 'imagex_upload_page' ); return $items; } function imagex_form_alter(&$form, &$form_state, $form_id){ // Lets add a small message to the top of the node/add/image form to point to the // multiple add image page if($form_id == 'image_node_form'){ $form['imagex'] = array( '#weight' => -100, // make sure it is at the top '#value' => '
' ); } } /*********************************************************************************** * CALLBACKS ***********************************************************************************/ /** * Callback for the imagex/imagex page which simply displays the applet for uploading * of images * * @return String (Contains HTML for displaying of the applet) */ function imagex_upload_page(){ // If we're lookin' at this page, then chuffin heck, we need t'JavaScript & CSS drupal_add_js(drupal_get_path('module','imagex').'/imagex.js'); drupal_add_css(drupal_get_path('module','imagex').'/imagex.css'); return ''.t('The following images have been uploaded by you in the last hour.') . $matrix .'
'.imagex_get_thumbs_html(60))); exit(); } /*********************************************************************************** * HELPER FUNCTIONS ***********************************************************************************/ /** * Following gets an HTML formatted list of images that the current user has uploaded, * and not edited. It can also optionally show only images uploaded in the last x minutes * * @return String (Formatted HTML) */ function imagex_get_thumbs_html($minutes = NULL){ global $user; if(is_null($minutes)){ $result = db_query("SELECT nid FROM {node} WHERE uid = %d AND created=changed AND type='image'",$user->uid); }else{ $result = db_query("SELECT nid FROM {node} WHERE uid = %d AND created=changed AND type='image' AND created>%d",$user->uid , time()-($minutes*60)); } $html = ''; while($node = db_fetch_object($result)){ $node = node_load($node->nid); $html .= '