Only in www/sites/all/modules/relations: .git Only in www/sites/all/modules/relations: .relations.module.swp diff -r orig/relations/relations.module www/sites/all/modules/relations/relations.module 7c7 < define('RELATIONS_REPOSITORY', 'relations'); --- > define('RELATIONS_REPOSITORY', 'local'); 9a10,12 > // Set according to the taxonomy ID on this site that should be used for relations > define('RELATIONS_VOCABULARY_ID', 2); > 259,260c262,265 < foreach ($_SESSION['relations']['delete'] as $nid => $title) { < relations_api_delete($node->nid, $nid); --- > foreach ($_SESSION['relations']['delete'] as $predicate => $related_titles ) { > foreach ($related_titles as $nid => $title) { > relations_api_delete($node->nid, $predicate, $nid); > } 264,265c269,272 < foreach ($_SESSION['relations']['create'] as $nid => $title) { < relations_api_create($node->nid, $nid); --- > foreach ($_SESSION['relations']['create'] as $predicate => $related_titles ) { > foreach ($related_titles as $nid => $title) { > relations_api_create($node->nid, $predicate, $nid); > } 320c327,330 < return array_combine(array_keys(relations_get_predicates()), array_fill(0, count(relations_get_predicates()), '')); --- > // return array_combine(array_keys(relations_get_predicates()), array_fill(0, count(relations_get_predicates()), '')); > $relation_keys = array_keys(relations_get_predicates()); > // double-up as key and value for select drop down > return array_combine($relation_keys, $relation_keys); 322c332,333 < return array( --- > > $pred_options = array( 324a336,342 > > $pred_vid = RELATIONS_VOCABULARY_ID; > $terms = taxonomy_get_tree($pred_vid); > foreach ($terms as $term) { > $pred_options[$term->name] = (object) array('title' => $term->name, 'uri' => 'http://bteaching.com/?q=rdf/schema/term#'.$term->name, 'bidirectional' => FALSE); > } > return $pred_options; 337a356 > 353c372 < $nodes = array(); --- > $relations = array(); 361c380 < $nodes[$node->nid] = $node; --- > $relations[$p][$node->nid] = $node; 366c385 < return $nodes; --- > return $relations; 369c388 < function relations_api_create($node1, $node2, array $options = array()) { --- > function relations_api_create($node1, $predicate, $node2, array $options = array()) { 374c393,394 < if (($existing = relations_api_lookup($nid1, $options)) && isset($existing[$nid2])) { --- > // but you should be able to have two statements with different predicates > if (($existing = relations_api_lookup($nid1, $options)) && isset($existing[$predicate][$nid2])) { 380c400,411 < return rdf_insert($url1, relations_get_predicate(), $url2, relations_rdf_options()); --- > > if (! isset($predicate) || ($predicate == '') ) { > $predicate = relations_get_predicate(); > } > > # HACK to test if this is the problem > # TODO do this when building the lists of predicates, NOT here > $predicate = preg_replace('/\s+/','-',$predicate); > $predicate = 'term:'.$predicate; > > $retval = rdf_insert($url1, $predicate, $url2, relations_rdf_options()); > return $retval; 383c414 < function relations_api_delete($node1, $node2, array $options = array()) { --- > function relations_api_delete($node1, $node2, $predicate, array $options = array()) { diff -r orig/relations/relations.pages.inc www/sites/all/modules/relations/relations.pages.inc 7a8 > 35a37 > $my_predicates = relations_get_predicates('keys'); 60a63,68 > 'predicate' => array( > '#type' => 'select', > '#default_value' => relations_get_predicate(), > '#options' => relations_get_predicates('keys'), > ), > 84a93 > 123a133 > 147c157 < relations_api_create($nid, $node2->nid); --- > relations_api_create($nid, $predicate, $node2->nid); 181a192 > 184c195 < --- > $predicate = $_POST['relations_table']['predicate']; 188c199 < $_SESSION['relations']['create'][$nid2] = $node->title; --- > $_SESSION['relations']['create'][$predicate][$nid2] = $node2->title; 197c208 < $_SESSION['relations']['create'][$nid2] = $node->title; --- > $_SESSION['relations']['create'][$predicate][$nid2] = $node2->title; 203c214 < $_SESSION['relations']['create'][$node2->nid] = $title; --- > $_SESSION['relations']['create'][$predicate][] = array($node2->nid => $title); 210c221,225 < die(drupal_to_js(array('status' => TRUE, 'data' => theme('status_messages') . drupal_render($form)))); --- > > // Modified based on example in http://drupal.org/node/331941 > $output = theme('status_messages') . drupal_render($form['relations']['relations_table']); > drupal_json(array('status' => TRUE, 'data' => $output )); > // die(drupal_to_js(array('status' => TRUE, 'data' => theme('status_messages') . drupal_render($form)))); 213c228 < function relations_node_session_delete($node2) { --- > function relations_node_session_delete($node2, $predicate) { 215,216c230,231 < if (isset($_SESSION['relations']['create'][$node2->nid])) { < unset($_SESSION['relations']['create'][$node2->nid]); --- > if (isset($_SESSION['relations']['create'][$predicate][$node2->nid])) { > unset($_SESSION['relations']['create'][$predicate][$node2->nid]); 219c234 < $_SESSION['relations']['delete'][$node2->nid] = $node2->title; --- > $_SESSION['relations']['delete'][$predicate][$node2->nid] = $node2->title; 226c241,244 < die(drupal_to_js(array('status' => TRUE, 'data' => theme('status_messages') . drupal_render($form)))); --- > > $output = theme('status_messages') . drupal_render($form['relations']['relations_table']); > drupal_json(array('status' => TRUE, 'data' => $output )); > // die(drupal_to_js(array('status' => TRUE, 'data' => theme('status_messages') . drupal_render($form)))); 245c263 < $head = array(t('Title'), t('Type'), t('Author'), array('data' => t('Operations'), 'colspan' => 1)); --- > $head = array(t('Title'), t('Type'), t('Author'), t('Relationship'), array('data' => t('Operations'), 'colspan' => 1)); 258c276 < foreach (relations_api_lookup($node->nid, $options) as $related) { --- > foreach ( relations_api_lookup($node->nid, $options) as $predicate => $related_nodes ) { 261,263c279,282 < if (!empty($_SESSION['relations']['delete']) && isset($_SESSION['relations']['delete'][$related->nid])) { < continue; < } --- > foreach ( $related_nodes as $r_nid => $related_node ) { > if (!empty($_SESSION['relations']['delete']) && isset($_SESSION['relations']['delete'][$r_nid])) { > continue; > } 265,271c284,292 < $can_delete = user_access('delete node relations') && (node_access('update', $node) || node_access('update', $related)); < $rows[] = array( < l($related->title, 'node/' . $related->nid), < isset($node_types[$related->type]) ? t($node_types[$related->type]) : $related->type, < theme('username', $related), < !$can_delete ? '' : theme_relations_delete_link($node->nid, $related->nid, $is_embedded), < ); --- > $can_delete = user_access('delete node relations') && (node_access('update', $node) || node_access('update', $related_node)); > $rows[] = array( > l($related_node->title, 'node/' . $r_nid), > isset($node_types[$related_node->type]) ? t($node_types[$related_node->type]) : $related_node->type, > theme('username', $related_node), > $predicate, > !$can_delete ? '' : theme_relations_delete_link($node->nid, $r_nid, $is_embedded), > ); > } 274d294 < 277,284c297,307 < foreach ($_SESSION['relations']['create'] as $nid => $title) { < if (($related = node_load($nid))) { < $rows[] = array( < l($related->title, 'node/' . $related->nid, array('attributes' => array('target' => '_blank'))), < isset($node_types[$related->type]) ? $node_types[$related->type] : $related->type, < theme('username', $related), < theme_relations_delete_link(NULL, $related->nid, $is_embedded), < ); --- > foreach ($_SESSION['relations']['create'] as $predicate => $related_titles) { > foreach ($related_titles as $r_nid => $r_title ) { > if (($related = node_load($r_nid))) { > $rows[] = array( > l($r_title, 'node/' . $r_nid, array('attributes' => array('target' => '_blank'))), > isset($node_types[$related->type]) ? $node_types[$related->type] : $related->type, > theme('username', $related), > $predicate, > theme_relations_delete_link(NULL, $r_nid, $is_embedded), > ); > } 294c317,318 < drupal_render($form['pick']), --- > '', > drupal_render($form['predicate']), 325,330c349,361 < function theme_relations_node_list($nodes) { < if (!empty($nodes)) { < $output = '
'; < $output .= ''; < $output .= '
'; 336a366 >