aboutsummaryrefslogtreecommitdiff
path: root/views/default/object/plugin
diff options
context:
space:
mode:
Diffstat (limited to 'views/default/object/plugin')
-rw-r--r--views/default/object/plugin/elements/dependencies.php6
-rw-r--r--views/default/object/plugin/full.php (renamed from views/default/object/plugin/advanced.php)200
-rw-r--r--views/default/object/plugin/invalid.php14
-rw-r--r--views/default/object/plugin/simple.php76
4 files changed, 133 insertions, 163 deletions
diff --git a/views/default/object/plugin/elements/dependencies.php b/views/default/object/plugin/elements/dependencies.php
index f4d1ccc5a..d8daedd33 100644
--- a/views/default/object/plugin/elements/dependencies.php
+++ b/views/default/object/plugin/elements/dependencies.php
@@ -13,14 +13,14 @@ $deps = $plugin->getPackage()->checkDependencies(true);
$columns = array('type', 'name', 'expected_value', 'local_value', 'comment');
-echo '<table class="elgg-plugins-dependencies styled"><tr>';
+echo '<table class="elgg-plugin-dependencies styled"><tr>';
foreach ($columns as $column) {
$column = elgg_echo("admin:plugins:dependencies:$column");
echo "<th class=\"pas\">$column</th>";
}
-echo '<tr/>';
+echo '</tr>';
$row = 'odd';
foreach ($deps as $dep) {
@@ -29,6 +29,8 @@ foreach ($deps as $dep) {
if ($dep['status']) {
$class = "elgg-state-success elgg-dependency elgg-dependency-$type";
+ } elseif ($dep['type'] == 'suggests') {
+ $class = "elgg-state-warning elgg-dependency elgg-dependency-$type";
} else {
$class = "elgg-state-error elgg-dependency elgg-dependency-$type";
}
diff --git a/views/default/object/plugin/advanced.php b/views/default/object/plugin/full.php
index 56e680ad5..2de65b555 100644
--- a/views/default/object/plugin/advanced.php
+++ b/views/default/object/plugin/full.php
@@ -5,102 +5,116 @@
* 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->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);
+$css_id = preg_replace('/[^a-z0-9-]/i', '-', $plugin->getID());
// build reordering links
$links = '';
+$classes = array('elgg-plugin');
-// 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
- ));
-
- $links .= "<li>" . elgg_view('output/url', array(
- 'href' => $top_url,
- 'text' => elgg_echo('top'),
- 'is_action' => true
- )) . "</li>";
+if ($reordering) {
+ $classes[] = 'elgg-state-draggable';
- $up_url = elgg_http_add_url_query_elements($actions_base . 'set_priority', array(
- 'plugin_guid' => $plugin->guid,
- 'priority' => '-1',
- 'is_action' => true
- ));
+ // 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
+ ));
- $links .= "<li>" . elgg_view('output/url', array(
- 'href' => $up_url,
- 'text' => elgg_echo('up'),
- 'is_action' => true
- )) . "</li>";
-}
+ $links .= "<li>" . elgg_view('output/url', array(
+ 'href' => $top_url,
+ 'text' => elgg_echo('top'),
+ 'is_action' => true,
+ 'is_trusted' => 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,
+ 'is_trusted' => true,
+ )) . "</li>";
+ }
- $links .= "<li>" . elgg_view('output/url', array(
- 'href' => $down_url,
- 'text' => elgg_echo('down'),
- '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
+ ));
- $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' => $down_url,
+ 'text' => elgg_echo('down'),
+ 'is_action' => true,
+ 'is_trusted' => true,
+ )) . "</li>";
+
+ $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,
+ 'is_trusted' => true,
+ )) . "</li>";
+ }
+} else {
+ $classes[] = 'elgg-state-undraggable';
}
+
// activate / deactivate links
// always let them deactivate
$options = array(
- 'is_action' => true
+ 'is_action' => true,
+ 'is_trusted' => true,
);
if ($active) {
- $active_class = 'elgg-state-active';
+ $classes[] = 'elgg-state-active';
$action = 'deactivate';
- $options['text'] = elgg_echo('deactivate');
+ $options['text'] = elgg_echo('admin:plugins:deactivate');
$options['class'] = "elgg-button elgg-button-cancel";
if (!$can_activate) {
- $active_class = 'elgg-state-active';
+ $classes[] = 'elgg-state-active';
$options['class'] = 'elgg-button elgg-state-warning';
}
} else if ($can_activate) {
- $active_class = 'elgg-state-inactive';
+ $classes[] = 'elgg-state-inactive';
$action = 'activate';
- $options['text'] = elgg_echo('activate');
+ $options['text'] = elgg_echo('admin:plugins:activate');
$options['class'] = "elgg-button elgg-button-submit";
} else {
- $active_class = 'elgg-state-inactive';
+ $classes[] = 'elgg-state-inactive';
$action = '';
$options['text'] = elgg_echo('admin:plugins:cannot_activate');
$options['class'] = "elgg-button elgg-button-disabled";
@@ -116,18 +130,20 @@ if ($action) {
}
$action_button = elgg_view('output/url', $options);
-// Display categories
+// Display categories and make category classes
+$categories = $plugin->getManifest()->getCategories();
$categories_html = '';
if ($categories) {
- $categories_arr = array();
$base_url = elgg_get_site_url() . "admin/plugins?category=";
foreach ($categories as $category) {
+ $css_class = preg_replace('/[^a-z0-9-]/i', '-', $category);
+ $classes[] = "elgg-plugin-category-$css_class";
+
$url = $base_url . urlencode($category);
- $categories_arr[] = "<a href=\"$url\">" . htmlspecialchars($category) . '</a>';
+ $friendly_category = htmlspecialchars(ElggPluginManifest::getFriendlyCategory($category));
+ $categories_html .= "<li class=\"elgg-plugin-category prm\"><a href=\"$url\">$friendly_category</a></li>";
}
-
- $categories_html = implode(', ', $categories_arr);
}
$screenshots_html = '';
@@ -140,7 +156,7 @@ if ($screenshots) {
$screenshot_full = "{$vars['url']}admin_plugin_screenshot/{$plugin->getID()}/full/{$screenshot['path']}";
$screenshot_src = "{$vars['url']}admin_plugin_screenshot/{$plugin->getID()}/thumbnail/{$screenshot['path']}";
- $screenshots_html .= "<li class=\"elgg-plugin-screenshot prm ptm\"><a href=\"$screenshot_full\">"
+ $screenshots_html .= "<li class=\"elgg-plugin-screenshot prm ptm\"><a class=\"elgg-lightbox\" href=\"$screenshot_full\">"
. "<img src=\"$screenshot_src\" alt=\"$alt\"></a></li>";
}
}
@@ -152,9 +168,30 @@ $author = '<span>' . elgg_echo('admin:plugins:label:author') . '</span>: '
$version = htmlspecialchars($plugin->getManifest()->getVersion());
$website = elgg_view('output/url', array(
'href' => $plugin->getManifest()->getWebsite(),
- 'text' => $plugin->getManifest()->getWebsite()
+ 'text' => $plugin->getManifest()->getWebsite(),
+ 'is_trusted' => true,
));
+$resources = array(
+ 'repository' => $plugin->getManifest()->getRepositoryURL(),
+ 'bugtracker' => $plugin->getManifest()->getBugTrackerURL(),
+ 'donate' => $plugin->getManifest()->getDonationsPageURL(),
+);
+
+$resources_html = "<ul class=\"elgg-plugin-resources\">";
+foreach ($resources as $id => $href) {
+ if ($href) {
+ $resources_html .= "<li class=\"prm\">";
+ $resources_html .= elgg_view('output/url', array(
+ 'href' => $href,
+ 'text' => elgg_echo("admin:plugins:label:$id"),
+ 'is_trusted' => true,
+ ));
+ $resources_html .= "</li>";
+ }
+}
+$resources_html .= "</ul>";
+
$copyright = elgg_view('output/text', array('value' => $plugin->getManifest()->getCopyright()));
$license = elgg_view('output/text', array('value' => $plugin->getManifest()->getLicense()));
@@ -168,7 +205,8 @@ if ($files) {
$url = 'admin_plugin_text_file/' . $plugin->getID() . "/$file";
$link = elgg_view('output/url', array(
'text' => $file,
- 'href' => $url
+ 'href' => $url,
+ 'is_trusted' => true,
));
$docs .= "<li>$link</li>";
@@ -178,13 +216,15 @@ if ($files) {
?>
-<div class="elgg-state-draggable elgg-plugin <?php echo $active_class ?>" id="elgg-plugin-<?php echo $plugin->guid; ?>">
+<div class="<?php echo implode(' ', $classes); ?>" id="<?php echo $css_id; ?>">
<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>
- <div class="clearfloat right mtm">
+ <?php endif; ?>
+ <div class="clearfloat float-alt mtm">
<?php echo $action_button; ?>
</div>
</div>
@@ -194,11 +234,11 @@ $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>";
+ $settings_link = "<a class='elgg-plugin-settings' href='$link'>[" . elgg_echo('settings') . "]</a>";
}
?>
<div class="elgg-head">
- <h3><?php echo $plugin->getManifest()->getName(). " $version $settings_link"; ?></h3>
+ <h3><?php echo $plugin->getManifest()->getName() . " $version $settings_link"; ?></h3>
</div>
<?php
if ($plugin->getManifest()->getApiVersion() < 1.8) {
@@ -220,22 +260,26 @@ if (elgg_view_exists($settings_view_old) || elgg_view_exists($settings_view_new)
}
?>
- <div class="plugin_description"><?php echo $description; ?></div>
- <p class="plugin_author"><?php echo $author . ' - ' . $website; ?></p>
- <?php echo $docs; ?>
+ <div><?php echo $description; ?></div>
+ <p><?php echo $author . ' - ' . $website; ?></p>
+
+ <?php
+ echo $resources_html;
+ echo $docs;
+ ?>
<div class="pts">
<?php
echo elgg_view('output/url', array(
- 'href' => "#elgg-plugin-manifest-{$plugin->getID()}",
+ 'href' => "#elgg-plugin-manifest-$css_id",
'text' => elgg_echo("admin:plugins:label:moreinfo"),
- 'class' => 'elgg-toggler',
+ 'rel' => 'toggle',
));
?>
</div>
</div>
</div>
- <div class="hidden manifest_file" id="elgg-plugin-manifest-<?php echo $plugin->getID(); ?>">
+ <div class="elgg-plugin-more hidden" id="elgg-plugin-manifest-<?php echo $css_id; ?>">
<?php
if ($screenshots_html) {
@@ -246,7 +290,7 @@ if (elgg_view_exists($settings_view_old) || elgg_view_exists($settings_view_new)
if ($categories_html) {
?>
- <div><?php echo elgg_echo('admin:plugins:label:categories') . ": " . $categories_html; ?></div>
+ <div><?php echo elgg_echo('admin:plugins:label:categories') . ": <ul class=\"elgg-plugin-categories\">$categories_html</ul>"; ?></div>
<?php
}
@@ -261,4 +305,4 @@ if (elgg_view_exists($settings_view_old) || elgg_view_exists($settings_view_new)
?>
</div>
</div>
-</div> \ No newline at end of file
+</div>
diff --git a/views/default/object/plugin/invalid.php b/views/default/object/plugin/invalid.php
index 9e239b7ca..828bceaba 100644
--- a/views/default/object/plugin/invalid.php
+++ b/views/default/object/plugin/invalid.php
@@ -14,29 +14,29 @@ $plugin = $vars['entity'];
$id = $plugin->getID();
$path = htmlspecialchars($plugin->getPath());
-$message = elgg_echo('admin:plugins:warning:invalid', array($id));
-$error = $plugin->getError();
+$message = elgg_echo('admin:plugins:warning:invalid', array($plugin->getError()));
+$css_id = preg_replace('/[^a-z0-9-]/i', '-', $plugin->getID());
?>
<div class="elgg-state-draggable elgg-plugin elgg-state-inactive elgg-state-error" id="elgg-plugin-<?php echo $plugin->guid; ?>">
<div class="elgg-head"><h3><?php echo $id; ?></h3></div>
<div class="elgg-body">
- <p><?php echo $message; ?></p>
+ <p class="elgg-state-error"><?php echo $message; ?></p>
+ <p><?php echo elgg_echo('admin:plugins:warning:invalid:check_docs'); ?></p>
<div class="pts">
<?php
echo elgg_view('output/url', array(
- 'href' => "#elgg-plugin-manifest-{$plugin->getID()}",
+ 'href' => "#elgg-plugin-manifest-$css_id",
'text' => elgg_echo("admin:plugins:label:moreinfo"),
- 'class' => 'elgg-toggler',
+ 'rel' => 'toggle',
));
?>
</div>
- <div class="hidden manifest_file" id="elgg-plugin-manifest-<?php echo $plugin->getID(); ?>">
+ <div class="hidden elgg-plugin-more" id="elgg-plugin-manifest-<?php echo $css_id; ?>">
<p><?php echo elgg_echo('admin:plugins:label:location') . ": " . $path; ?></p>
- <p><?php echo $error; ?></p>
</div>
</div>
</div> \ No newline at end of file
diff --git a/views/default/object/plugin/simple.php b/views/default/object/plugin/simple.php
deleted file mode 100644
index 5f5b08f10..000000000
--- a/views/default/object/plugin/simple.php
+++ /dev/null
@@ -1,76 +0,0 @@
-<?php
-$plugin = $vars['entity'];
-
-$plugin_guid = $plugin->guid;
-$plugin_id = $plugin->getID();
-$active = $plugin->isActive();
-$can_activate = $plugin->canActivate();
-$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';
- $checked = 'checked="checked"';
-} else {
- $active_class = 'elgg-state-inactive';
- $checked = '';
-}
-
-if ($can_activate) {
- $disabled = '';
-} else {
- $disabled = 'disabled="disabled"';
- $description .= '<p>' . elgg_echo('admin:plugins:simple:cannot_activate') . '</p>';
-}
-
-$description = elgg_view('output/longtext', array('value' => $description));
-
-$plugin_footer = '<ul class="elgg-menu elgg-menu-footer">';
-
-if ($author) {
- $plugin_footer .= '<li>' . elgg_echo('admin:plugins:author', array($author)) . '</li>';
-}
-
-if ($version) {
- $plugin_footer .= '<li>' . elgg_echo('admin:plugins:version', array($version)) . '</li>';
-}
-
-if ($website) {
- $plugin_footer .= "<li><a href=\"$website\">" . elgg_echo('admin:plugins:plugin_website') . '</a></li>';
-}
-
-// show links to text files
-$files = $plugin->getAvailableTextFiles();
-
-foreach ($files as $file => $path) {
- $url = 'admin_plugin_text_file/' . $plugin->getID() . "/$file";
- $link = elgg_view('output/url', array(
- 'text' => $file,
- 'href' => $url
- ));
- $plugin_footer .= "<li>$link</li>";
-
-}
-
-if (elgg_view_exists("settings/$plugin_id/edit")) {
- $settings_href = elgg_get_site_url() . "admin/plugin_settings/$plugin_id";
- $plugin_footer .= "<li><a class='plugin_settings link' href='$settings_href'>" . elgg_echo('settings') . "</a></li>";
-}
-
-$plugin_footer .= "</ul>";
-
-echo <<<___END
- <div class="elgg-plugin $active_class elgg-grid">
- <div class="elgg-col elgg-col-1of5">
- <input type="checkbox" id="$plugin_guid" $checked $disabled name="active_plugin_guids[]" value="$plugin_guid"/>
- <label for="$plugin_guid">$name</label>
- </div>
- <div class="elgg-col elgg-col-4of5">
- $description
- $plugin_footer
- </div>
- </div>
-___END;