aboutsummaryrefslogtreecommitdiff
path: root/views/default/object
diff options
context:
space:
mode:
Diffstat (limited to 'views/default/object')
-rw-r--r--views/default/object/default.php2
-rw-r--r--views/default/object/elements/summary.php53
-rw-r--r--views/default/object/plugin/advanced.php197
-rw-r--r--views/default/object/plugin/elements/dependencies.php8
-rw-r--r--views/default/object/plugin/simple.php10
5 files changed, 175 insertions, 95 deletions
diff --git a/views/default/object/default.php b/views/default/object/default.php
index 2cf9805f0..27bb1890e 100644
--- a/views/default/object/default.php
+++ b/views/default/object/default.php
@@ -42,6 +42,6 @@ $params = array(
'subtitle' => $subtitle,
'tags' => $vars['entity']->tags,
);
-$body = elgg_view('page/components/summary', $params);
+$body = elgg_view('object/elements/summary', $params);
echo elgg_view_image_block($icon, $body);
diff --git a/views/default/object/elements/summary.php b/views/default/object/elements/summary.php
new file mode 100644
index 000000000..d3a6ea862
--- /dev/null
+++ b/views/default/object/elements/summary.php
@@ -0,0 +1,53 @@
+<?php
+/**
+ * Object summary
+ *
+ * Sample output
+ * <ul class="elgg-menu elgg-menu-metadata"><li>Public</li><li>Like this</li></ul>
+ * <h3><a href="">Title</a></h3>
+ * <p class="elgg-subtext">Posted 3 hours ago by George</p>
+ * <p class="elgg-tags"><a href="">one</a>, <a href="">two</a></p>
+ * <div class="elgg-list-content">Excerpt text</div>
+ *
+ * @uses $vars['entity'] ElggEntity
+ * @uses $vars['title'] Title link (optional) false = no title, '' = default
+ * @uses $vars['metadata'] HTML for entity metadata and actions (optional)
+ * @uses $vars['subtitle'] HTML for the subtitle (optional)
+ * @uses $vars['tags'] HTML for the tags (optional)
+ * @uses $vars['content'] HTML for the entity content (optional)
+ */
+
+$entity = $vars['entity'];
+
+$title_link = elgg_extract('title', $vars, '');
+if ($title_link === '') {
+ if (isset($entity->title)) {
+ $text = $entity->title;
+ } else {
+ $text = $entity->name;
+ }
+ $params = array(
+ 'text' => $text,
+ 'href' => $entity->getURL(),
+ );
+ $title_link = elgg_view('output/url', $params);
+}
+
+$metadata = elgg_extract('metadata', $vars, '');
+$subtitle = elgg_extract('subtitle', $vars, '');
+$content = elgg_extract('content', $vars, '');
+
+$tags = elgg_extract('tags', $vars, '');
+if ($tags !== false) {
+ $tags = elgg_view('output/tags', array('tags' => $entity->tags));
+}
+
+if ($metadata) {
+ echo $metadata;
+}
+echo "<h3>$title_link</h3>";
+echo "<div class=\"elgg-subtext\">$subtitle</div>";
+echo $tags;
+if ($content) {
+ echo "<div class=\"elgg-list-content\">$content</div>";
+}
diff --git a/views/default/object/plugin/advanced.php b/views/default/object/plugin/advanced.php
index a346d4ff1..51fb69d17 100644
--- a/views/default/object/plugin/advanced.php
+++ b/views/default/object/plugin/advanced.php
@@ -5,108 +5,127 @@
* This file renders a plugin for the admin screen, including active/deactive,
* manifest details & display plugin settings.
*
+ * @uses $vars['entity']
+ * @uses $vars['display_reordering'] Do we display the priority reordering links?
+ *
* @package Elgg.Core
* @subpackage Plugins
*/
$plugin = $vars['entity'];
+$reordering = elgg_extract('display_reordering', $vars, false);
$priority = $plugin->getPriority();
$active = $plugin->isActive();
-$name = $plugin->manifest->getName();
+$name = $plugin->getManifest()->getName();
$can_activate = $plugin->canActivate();
$max_priority = elgg_get_max_plugin_priority();
$actions_base = '/action/admin/plugins/';
$ts = time();
$token = generate_action_token($ts);
-$active_class = ($active && $can_activate) ? 'elgg-state-active' : 'elgg-state-inactive';
// build reordering links
$links = '';
-// top and up link only if not at top
-if ($priority > 1) {
- $top_url = elgg_http_add_url_query_elements($actions_base . 'set_priority', array(
- 'plugin_guid' => $plugin->guid,
- 'priority' => 'first',
- 'is_action' => true
- ));
+if ($reordering) {
+ $draggable = 'elgg-state-draggable';
- $links .= "<li>" . elgg_view('output/url', array(
- 'href' => $top_url,
- 'text' => elgg_echo('top'),
- 'is_action' => true
- )) . "</li>";
+ // top and up link only if not at top
+ if ($priority > 1) {
+ $top_url = elgg_http_add_url_query_elements($actions_base . 'set_priority', array(
+ 'plugin_guid' => $plugin->guid,
+ 'priority' => 'first',
+ 'is_action' => true
+ ));
- $up_url = elgg_http_add_url_query_elements($actions_base . 'set_priority', array(
- 'plugin_guid' => $plugin->guid,
- 'priority' => '-1',
- 'is_action' => true
- ));
+ $links .= "<li>" . elgg_view('output/url', array(
+ 'href' => $top_url,
+ 'text' => elgg_echo('top'),
+ 'is_action' => true
+ )) . "</li>";
- $links .= "<li>" . elgg_view('output/url', array(
- 'href' => $up_url,
- 'text' => elgg_echo('up'),
- 'is_action' => true
- )) . "</li>";
-}
+ $up_url = elgg_http_add_url_query_elements($actions_base . 'set_priority', array(
+ 'plugin_guid' => $plugin->guid,
+ 'priority' => '-1',
+ 'is_action' => true
+ ));
-// down and bottom links only if not at bottom
-if ($priority < $max_priority) {
- $down_url = elgg_http_add_url_query_elements($actions_base . 'set_priority', array(
- 'plugin_guid' => $plugin->guid,
- 'priority' => '+1',
- 'is_action' => true
- ));
+ $links .= "<li>" . elgg_view('output/url', array(
+ 'href' => $up_url,
+ 'text' => elgg_echo('up'),
+ 'is_action' => true
+ )) . "</li>";
+ }
+
+ // down and bottom links only if not at bottom
+ if ($priority < $max_priority) {
+ $down_url = elgg_http_add_url_query_elements($actions_base . 'set_priority', array(
+ 'plugin_guid' => $plugin->guid,
+ 'priority' => '+1',
+ 'is_action' => true
+ ));
- $links .= "<li>" . elgg_view('output/url', array(
- 'href' => $down_url,
- 'text' => elgg_echo('down'),
- 'is_action' => true
- )) . "</li>";
+ $links .= "<li>" . elgg_view('output/url', array(
+ 'href' => $down_url,
+ 'text' => elgg_echo('down'),
+ 'is_action' => true
+ )) . "</li>";
- $bottom_url = elgg_http_add_url_query_elements($actions_base . 'set_priority', array(
- 'plugin_guid' => $plugin->guid,
- 'priority' => 'last',
- 'is_action' => true
- ));
+ $bottom_url = elgg_http_add_url_query_elements($actions_base . 'set_priority', array(
+ 'plugin_guid' => $plugin->guid,
+ 'priority' => 'last',
+ 'is_action' => true
+ ));
- $links .= "<li>" . elgg_view('output/url', array(
- 'href' => $bottom_url,
- 'text' => elgg_echo('bottom'),
- 'is_action' => true
- )) . "</li>";
+ $links .= "<li>" . elgg_view('output/url', array(
+ 'href' => $bottom_url,
+ 'text' => elgg_echo('bottom'),
+ 'is_action' => true
+ )) . "</li>";
+ }
+} else {
+ $draggable = 'elgg-state-undraggable';
}
+
// activate / deactivate links
-if ($can_activate) {
- if ($active) {
- $action = 'deactivate';
- $class = 'elgg-button-cancel';
- } else {
- $action = 'activate';
- $class = 'elgg-button-submit';
+
+// always let them deactivate
+$options = array(
+ 'is_action' => true
+);
+if ($active) {
+ $active_class = 'elgg-state-active';
+ $action = 'deactivate';
+ $options['text'] = elgg_echo('deactivate');
+ $options['class'] = "elgg-button elgg-button-cancel";
+
+ if (!$can_activate) {
+ $active_class = 'elgg-state-active';
+ $options['class'] = 'elgg-button elgg-state-warning';
}
+} else if ($can_activate) {
+ $active_class = 'elgg-state-inactive';
+ $action = 'activate';
+ $options['text'] = elgg_echo('activate');
+ $options['class'] = "elgg-button elgg-button-submit";
+} else {
+ $active_class = 'elgg-state-inactive';
+ $action = '';
+ $options['text'] = elgg_echo('admin:plugins:cannot_activate');
+ $options['class'] = "elgg-button elgg-button-disabled";
+ $options['disabled'] = 'disabled';
+}
+if ($action) {
$url = elgg_http_add_url_query_elements($actions_base . $action, array(
- 'plugin_guids[]' => $plugin->guid,
- 'is_action' => true
+ 'plugin_guids[]' => $plugin->guid
));
- $action_button = elgg_view('output/url', array(
- 'href' => $url,
- 'text' => elgg_echo($action),
- 'is_action' => true,
- 'class' => "elgg-button $class"
- ));
-} else {
- $action_button = elgg_view('output/url', array(
- 'text' => elgg_echo('admin:plugins:cannot_activate'),
- 'disabled' => 'disabled',
- 'class' => "elgg-button elgg-button-action elgg-state-disabled"
- ));
+ $options['href'] = $url;
}
+$action_button = elgg_view('output/url', $options);
// Display categories
$categories_html = '';
@@ -123,7 +142,7 @@ if ($categories) {
}
$screenshots_html = '';
-$screenshots = $plugin->manifest->getScreenshots();
+$screenshots = $plugin->getManifest()->getScreenshots();
if ($screenshots) {
$base_url = elgg_get_plugins_path() . $plugin->getID() . '/';
foreach ($screenshots as $screenshot) {
@@ -138,17 +157,17 @@ if ($screenshots) {
}
// metadata
-$description = elgg_view('output/longtext', array('value' => $plugin->manifest->getDescription()));
+$description = elgg_view('output/longtext', array('value' => $plugin->getManifest()->getDescription()));
$author = '<span>' . elgg_echo('admin:plugins:label:author') . '</span>: '
- . elgg_view('output/text', array('value' => $plugin->manifest->getAuthor()));
-$version = htmlspecialchars($plugin->manifest->getVersion());
+ . elgg_view('output/text', array('value' => $plugin->getManifest()->getAuthor()));
+$version = htmlspecialchars($plugin->getManifest()->getVersion());
$website = elgg_view('output/url', array(
- 'href' => $plugin->manifest->getWebsite(),
- 'text' => $plugin->manifest->getWebsite()
+ 'href' => $plugin->getManifest()->getWebsite(),
+ 'text' => $plugin->getManifest()->getWebsite()
));
-$copyright = elgg_view('output/text', array('value' => $plugin->manifest->getCopyright()));
-$license = elgg_view('output/text', array('value' => $plugin->manifest->getLicense()));
+$copyright = elgg_view('output/text', array('value' => $plugin->getManifest()->getCopyright()));
+$license = elgg_view('output/text', array('value' => $plugin->getManifest()->getLicense()));
// show links to text files
$files = $plugin->getAvailableTextFiles();
@@ -170,30 +189,33 @@ if ($files) {
?>
-<div class="elgg-state-draggable elgg-plugin <?php echo $active_class ?>" id="elgg-plugin-<?php echo $plugin->guid; ?>">
+<div class="<?php echo $draggable; ?> elgg-plugin <?php echo $active_class ?>" id="elgg-plugin-<?php echo $plugin->guid; ?>">
<div class="elgg-image-block">
<div class="elgg-image-alt">
+ <?php if ($links) : ?>
<ul class="elgg-menu elgg-menu-metadata">
- <?php echo "$links"; ?>
+ <?php echo $links; ?>
</ul>
+ <?php endif; ?>
<div class="clearfloat right mtm">
<?php echo $action_button; ?>
</div>
</div>
<div class="elgg-body">
<?php
-$settings_view = 'settings/' . $plugin->getID() . '/edit';
-if (elgg_view_exists($settings_view)) {
+$settings_view_old = 'settings/' . $plugin->getID() . '/edit';
+$settings_view_new = 'plugins/' . $plugin->getID() . '/settings';
+if (elgg_view_exists($settings_view_old) || elgg_view_exists($settings_view_new)) {
$link = elgg_get_site_url() . "admin/plugin_settings/" . $plugin->getID();
$settings_link = "<a class='plugin_settings small link' href='$link'>[" . elgg_echo('settings') . "]</a>";
}
?>
<div class="elgg-head">
- <h3><?php echo $plugin->manifest->getName(). " $version $settings_link"; ?></h3>
+ <h3><?php echo $plugin->getManifest()->getName(). " $version $settings_link"; ?></h3>
</div>
<?php
- if ($plugin->manifest->getApiVersion() < 1.8) {
- $reqs = $plugin->manifest->getRequires();
+ if ($plugin->getManifest()->getApiVersion() < 1.8) {
+ $reqs = $plugin->getManifest()->getRequires();
if (!$reqs) {
$message = elgg_echo('admin:plugins:warning:elgg_version_unknown');
echo "<p class=\"elgg-state-error\">$message</p>";
@@ -201,8 +223,13 @@ if (elgg_view_exists($settings_view)) {
}
if (!$can_activate) {
- $message = elgg_echo('admin:plugins:warning:unmet_dependencies');
- echo "<p class=\"elgg-state-error\">$message</p>";
+ if ($active) {
+ $message = elgg_echo('admin:plugins:warning:unmet_dependencies_active');
+ echo "<p class=\"elgg-state-warning\">$message</p>";
+ } else {
+ $message = elgg_echo('admin:plugins:warning:unmet_dependencies');
+ echo "<p class=\"elgg-state-error\">$message</p>";
+ }
}
?>
diff --git a/views/default/object/plugin/elements/dependencies.php b/views/default/object/plugin/elements/dependencies.php
index 11a441a4a..5f4aa4392 100644
--- a/views/default/object/plugin/elements/dependencies.php
+++ b/views/default/object/plugin/elements/dependencies.php
@@ -9,7 +9,7 @@
*/
$plugin = elgg_extract('plugin', $vars, false);
-$deps = $plugin->package->checkDependencies(true);
+$deps = $plugin->getPackage()->checkDependencies(true);
$columns = array('type', 'name', 'expected_value', 'local_value', 'comment');
@@ -20,7 +20,7 @@ foreach ($columns as $column) {
echo "<th class=\"pas\">$column</th>";
}
-echo '<tr/>';
+echo '</tr>';
$row = 'odd';
foreach ($deps as $dep) {
@@ -28,9 +28,9 @@ foreach ($deps as $dep) {
$type = $dep['type'];
if ($dep['status']) {
- $class = "elgg-state-success elgg-dependency-$type";
+ $class = "elgg-state-success elgg-dependency elgg-dependency-$type";
} else {
- $class = "elgg-state-error elgg-dependency-$type";
+ $class = "elgg-state-error elgg-dependency elgg-dependency-$type";
}
echo "<tr class=\"$row\">";
diff --git a/views/default/object/plugin/simple.php b/views/default/object/plugin/simple.php
index d57d81934..5f5b08f10 100644
--- a/views/default/object/plugin/simple.php
+++ b/views/default/object/plugin/simple.php
@@ -5,11 +5,11 @@ $plugin_guid = $plugin->guid;
$plugin_id = $plugin->getID();
$active = $plugin->isActive();
$can_activate = $plugin->canActivate();
-$name = $plugin->manifest->getName();
-$author = $plugin->manifest->getAuthor();
-$version = $plugin->manifest->getVersion();
-$website = $plugin->manifest->getWebsite();
-$description = $plugin->manifest->getDescription();
+$name = $plugin->getManifest()->getName();
+$author = $plugin->getManifest()->getAuthor();
+$version = $plugin->getManifest()->getVersion();
+$website = $plugin->getManifest()->getWebsite();
+$description = $plugin->getManifest()->getDescription();
if ($active) {
$active_class = 'elgg-state-active';