aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mod/guidbrowser/index.php18
-rw-r--r--mod/guidbrowser/start.php3
-rw-r--r--mod/guidbrowser/views/default/guidbrowser/entity_full.php31
3 files changed, 45 insertions, 7 deletions
diff --git a/mod/guidbrowser/index.php b/mod/guidbrowser/index.php
index 5b0a8c09d..d842367a5 100644
--- a/mod/guidbrowser/index.php
+++ b/mod/guidbrowser/index.php
@@ -24,20 +24,26 @@
$key = get_input('key');
$value = get_input('value');
- echo "ACTION $callaction";
+ $relationship = get_input('relationship');
+ $guid2 = get_input('guid2');
switch ($callaction)
{
- case 'metadata' : echo "META";
+ case 'metadata' :
if (!create_metadata($eguid, $key, $value))
- echo "Could not create metadata with $guid:$key:$value";
+ echo "Could not create metadata with $eguid:$key:$value";
break;
- case 'annotations' : echo "ANNO";
+ case 'annotations' :
if (!create_annotation($eguid, $key, $value))
- echo "Could not create metadata with $guid:$key:$value";
- break;
+ echo "Could not create metadata with $eguid:$key:$value";
+ break;
+
+ case 'relationship' :
+ if (!add_entity_relationship($eguid, $relationship, $guid2))
+ echo "Could not create relationship between $eguid:$relationship:$guid2";
+ break;
}
// Get the current page's owner
diff --git a/mod/guidbrowser/start.php b/mod/guidbrowser/start.php
index ef68ed9a3..602fa5741 100644
--- a/mod/guidbrowser/start.php
+++ b/mod/guidbrowser/start.php
@@ -30,7 +30,8 @@
array(
'entity' => $entity,
'metadata' => get_metadata_for_entity($entity->guid),
- 'annotations' => get_annotations($entity->guid)
+ 'annotations' => get_annotations($entity->guid),
+ 'relationships' => get_entity_relationships($entity->guid)
)
)
)
diff --git a/mod/guidbrowser/views/default/guidbrowser/entity_full.php b/mod/guidbrowser/views/default/guidbrowser/entity_full.php
index 13bdb7280..817443d23 100644
--- a/mod/guidbrowser/views/default/guidbrowser/entity_full.php
+++ b/mod/guidbrowser/views/default/guidbrowser/entity_full.php
@@ -12,6 +12,7 @@
$entity = $vars['entity'];
$metadata = $vars['metadata'];
$annotations = $vars['annotations'];
+ $relationships = $vars['relationships'];
?>
<div>
@@ -90,4 +91,34 @@
<input name="submit" type="submit" value="submit" />
</form>
</div>
+</div>
+
+<div id="relationship">
+<h2>Relationships</h2>
+ <?php
+ foreach ($relationships as $r)
+ {
+?>
+ <div>
+ <table>
+ <tr>
+ <td><b><?php echo $r->relationship; ?></b></td>
+ <td><?php echo $r->guid_two; ?></td>
+ </tr>
+ </table>
+ </div>
+<?php
+ }
+ ?>
+
+ <div>
+ <form method="post">
+ <input name="eguid" type="hidden" value="<?php echo $entity->guid; ?>" />
+ <input name="owner_id" type="hidden" value="<?php echo page_owner(); ?>" />
+ <input name="callaction" type="hidden" value="relationship" />
+ Relationship : <input name="relationship" type="text" />
+ Guid : <input name="guid2" type="text" />
+ <input name="submit" type="submit" value="submit" />
+ </form>
+ </div>
</div> \ No newline at end of file