From 00ea6e1ddd446c61c6ccd956989b4b9a1cd60119 Mon Sep 17 00:00:00 2001 From: ewinslow Date: Tue, 22 Feb 2011 00:12:17 +0000 Subject: Refs #2950: Cleanup of plugin-related view structure git-svn-id: http://code.elgg.org/elgg/trunk@8394 36083f99-b078-4883-b0ff-0f9b5a30f544 --- views/default/object/plugin/advanced.php | 223 +++++++++++++++++++++++++++++++ 1 file changed, 223 insertions(+) create mode 100644 views/default/object/plugin/advanced.php (limited to 'views/default/object/plugin/advanced.php') diff --git a/views/default/object/plugin/advanced.php b/views/default/object/plugin/advanced.php new file mode 100644 index 000000000..f6a760af4 --- /dev/null +++ b/views/default/object/plugin/advanced.php @@ -0,0 +1,223 @@ +getPriority(); +$active = $plugin->isActive(); + +$name = $plugin->manifest->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 + )); + + $links .= "
  • " . elgg_view('output/url', array( + 'href' => $top_url, + 'text' => elgg_echo('top'), + '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 .= "
  • " . elgg_view('output/url', array( + 'href' => $up_url, + 'text' => elgg_echo('up'), + '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 .= "
  • " . elgg_view('output/url', array( + 'href' => $down_url, + 'text' => elgg_echo('down'), + '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 .= "
  • " . elgg_view('output/url', array( + 'href' => $bottom_url, + 'text' => elgg_echo('bottom'), + 'is_action' => true + )) . "
  • "; +} + +// activate / deactivate links +if ($can_activate) { + if ($active) { + $action = 'deactivate'; + $class = 'elgg-button-cancel'; + } else { + $action = 'activate'; + $class = 'elgg-button-submit'; + } + + $url = elgg_http_add_url_query_elements($actions_base . $action, array( + 'plugin_guids[]' => $plugin->guid, + 'is_action' => true + )); + + $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-action elgg-state-disabled" + )); +} + +// Display categories +$categories_html = ''; +if ($categories) { + $categories_arr = array(); + $base_url = elgg_get_site_url() . "pg/admin/plugins?category="; + + foreach ($categories as $category) { + $url = $base_url . urlencode($category); + $categories_arr[] = "" . htmlspecialchars($category) . ''; + } + + $categories_html = implode(', ', $categories_arr); +} + +$screenshots_html = ''; +$screenshots = $plugin->manifest->getScreenshots(); +if ($screenshots) { + $base_url = elgg_get_plugins_path() . $plugin->getID() . '/'; + foreach ($screenshots as $screenshot) { + $desc = elgg_echo($screenshot['description']); + $alt = htmlentities($desc, ENT_QUOTES, 'UTF-8'); + $screenshot_full = "{$vars['url']}pg/admin_plugin_screenshot/{$plugin->getID()}/full/{$screenshot['path']}"; + $screenshot_src = "{$vars['url']}pg/admin_plugin_screenshot/{$plugin->getID()}/thumbnail/{$screenshot['path']}"; + + $screenshots_html .= "
  • " + . "\"$alt\"
  • "; + } +} + +// metadata +$description = elgg_view('output/longtext', array('value' => $plugin->manifest->getDescription())); +$author = '' . elgg_echo('admin:plugins:label:author') . ': ' + . elgg_view('output/text', array('value' => $plugin->manifest->getAuthor())); +$version = htmlspecialchars($plugin->manifest->getVersion()); +$website = elgg_view('output/url', array( + 'href' => $plugin->manifest->getWebsite(), + 'text' => $plugin->manifest->getWebsite() +)); + +$copyright = elgg_view('output/text', array('value' => $plugin->manifest->getCopyright())); +$license = elgg_view('output/text', array('value' => $plugin->manifest->getLicense())); + +?> + +
    +
    +
    + +
    + +
    +
    +
    +getID() . '/edit'; +if (elgg_view_exists($settings_view)) { + $link = elgg_get_site_url() . "pg/admin/plugin_settings/" . $plugin->getID(); + $settings_link = "[" . elgg_echo('settings') . "]"; +} +?> +
    +

    manifest->getName(). " $version $settings_link"; ?>

    +
    + manifest->getApiVersion() < 1.8) { + $reqs = $plugin->manifest->getRequires(); + if (!$reqs) { + $message = elgg_echo('admin:plugins:warning:elgg_version_unknown'); + echo "

    $message

    "; + } + } + + if (!$can_activate) { + $message = elgg_echo('admin:plugins:warning:unmet_dependencies'); + echo "

    $message

    "; + } + ?> + +
    +

    + +
    +
    +
    + +
    \ No newline at end of file -- cgit v1.2.3