4 * Implementation of hook_node_info().
6 function mkdru_node_info() {
9 'name' => t("Z39.50/SRU metasearch interface"),
11 'description' => t("Metasearch interface for Z39.50/SRU and other targets via a Pazpar2/Service Proxy backend"),
18 * Implementation of hook_perm().
20 function mkdru_perm() {
21 return array('create metasearch interface', 'edit any metasearch interface', 'edit own metasearch interface');
25 * Implementation of hook_access().
27 function mkdru_access($op, $node, $account) {
29 if ($op == 'create') {
30 // Only users with permission to do so may create this node type.
31 return user_access('create metasearch interface', $account);
34 // Users who create a node may edit or delete it later, assuming they have the
35 // necessary permissions.
36 if ($op == 'update' || $op == 'delete') {
37 if (user_access('edit own metasearch interface', $account) && ($account->uid == $node->uid)) {
39 } else if (user_access('edit any metasearch interface', $account)) {
46 * Implementation of hook_form().
48 function mkdru_form(&$node, $form_state) {
49 $type = node_get_types('type', $node);
51 $form['title'] = array(
52 '#type' => 'textfield',
53 '#title' => check_plain($type->title_label),
55 '#default_value' => $node->title,
63 * Implementation of hook_theme().
65 function mkdru_theme() {
67 'mkdru_page' => array(
68 'template' => 'mkdru-page',
69 'arguments' => array(),
71 'mkdru_page_js' => array(
72 'arguments' => array(),
74 // 'mkdru_block_facet' => array(
75 // 'template' => 'mkdru-block-facet',
76 // 'arguments' => array('divId' => NULL),
82 * Theme function to include Javascript search client and deps
84 function theme_mkdru_page_js() {
85 $path = drupal_get_path('module', 'mkdru');
86 drupal_add_js('pazpar2/js/pz2.js', 'module', 'footer');
87 drupal_add_js($path . '/mkdru.theme.js', 'module', 'footer');
88 drupal_add_js($path . '/mkdru.client.js', 'module', 'footer');
92 * Implementation of hook_view()
94 function mkdru_view($node, $teaser = FALSE, $page = FALSE) {
95 $node->content['mkdru_page_js'] = array(
96 '#value' => theme('mkdru_page_js'),
99 $node->content['mkdru_page'] = array(
100 '#value' => theme('mkdru_page'),
107 * Implementation of hook_block()
109 function mkdru_block($op='list', $delta='sources', $edit=array()) {
112 $blocks['mkdru_sources']['info'] = t('mkdru - source facets');
113 $blocks['mkdru_sources']['cache'] = BLOCK_NO_CACHE;
114 $blocks['mkdru_subjects']['info'] = t('mkdru - subject facets');
115 $blocks['mkdru_subjects']['cache'] = BLOCK_NO_CACHE;
116 $blocks['mkdru_authors']['info'] = t('mkdru - author facets');
117 $blocks['mkdru_authors']['cache'] = BLOCK_NO_CACHE;
122 // TODO: make the facet themable, I have no clue why this won't work
123 // case 'mkdru_sources':
124 // $block['subject'] = t('Source');
125 // $block['content'] = theme('mkdru_block_facet', 'mkdru-sources');
127 // case 'mkdru_subjects':
128 // $block['subject'] = t('Subject');
129 // $block['content'] = theme('mkdru_block_facet', 'mkdru-subjects');
131 // case 'mkdru_authors':
132 // $block['subject'] = t('Author');
133 // $block['content'] = theme('mkdru_block_facet', 'mkdru-authors');
135 case 'mkdru_sources':
136 $block['subject'] = t('Source');
137 $block['content'] = '<div id="mkdru-sources"> </div>';
139 case 'mkdru_subjects':
140 $block['subject'] = t('Subject');
141 $block['content'] = '<div id="mkdru-subjects"> </div>';
143 case 'mkdru_authors':
144 $block['subject'] = t('Author');
145 $block['content'] = '<div id="mkdru-authors"> </div>';