MENU_NORMAL_ITEM, 'title' => t('CMIS Query'), 'page callback' => 'cmis_query_view', 'access arguments' => array('access cmis'), 'file' => 'cmis_query.pages.inc', ); return $items; } /** * Implementation of hook_theme() */ function cmis_query_theme() { return array( 'cmis_query_results' => array( 'arguments' => array('rows' => NULL), 'file' => 'cmis_query.theme.inc' ), 'cmis_query_pager' => array( 'arguments' => array('query' => NULL, 'p' => NULL), 'file' => 'cmis_query.theme.inc' ) ); } /** * Render form for searching CMIS respository. */ function cmis_query_form(&$form_state) { $cmis_query = array( '#type' => 'fieldset', '#title' => t('Search the repository using CMIS SQL 1.0 queries.'), '#collapsible' => TRUE, '#collapsed' => FALSE, ); $cmis_query['cmis_query'] = array( '#type' => 'textarea', '#title' => t('Query'), '#size' => 50, '#default_value' => urldecode(arg(2)), ); $cmis_query['cmis_query_submit'] = array( '#type' => 'submit', '#value' => t('Run'), ); $form['statement'] = $cmis_query; return $form; } /** * Form submit for cmis_query_form - redirects to put query in url so we can use it on the results page */ function cmis_query_form_submit($form, &$form_state) { if ($form_state['values']['cmis_query']) { $form_state['redirect'] = 'cmis/query/'. urlencode(trim($form_state['values']['cmis_query'])); } else { $form_state['redirect'] = 'cmis/query'; form_set_error('cmis_query_form', 'Please enter a query'); } }