From 4e6c2eaaf23416125f39233372cd9dbf9ff2a97a Mon Sep 17 00:00:00 2001 From: cash Date: Thu, 27 Oct 2011 21:21:12 -0400 Subject: Refs #3917 removed more code from simple plugin interface --- views/default/object/plugin.php | 4 +- views/default/object/plugin/advanced.php | 284 ------------------------------- views/default/object/plugin/full.php | 284 +++++++++++++++++++++++++++++++ views/default/object/plugin/simple.php | 77 --------- 4 files changed, 285 insertions(+), 364 deletions(-) delete mode 100644 views/default/object/plugin/advanced.php create mode 100644 views/default/object/plugin/full.php delete mode 100644 views/default/object/plugin/simple.php (limited to 'views') diff --git a/views/default/object/plugin.php b/views/default/object/plugin.php index 2facca97a..2f64cfcc9 100644 --- a/views/default/object/plugin.php +++ b/views/default/object/plugin.php @@ -11,8 +11,6 @@ $plugin = $vars['entity']; if (!$plugin->isValid()) { echo elgg_view('object/plugin/invalid', $vars); -} elseif ($vars['full_view']) { - echo elgg_view('object/plugin/advanced', $vars); } else { - echo elgg_view('object/plugin/simple', $vars); + echo elgg_view('object/plugin/full', $vars); } diff --git a/views/default/object/plugin/advanced.php b/views/default/object/plugin/advanced.php deleted file mode 100644 index db4e4dbcc..000000000 --- a/views/default/object/plugin/advanced.php +++ /dev/null @@ -1,284 +0,0 @@ -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); - -// build reordering links -$links = ''; - -if ($reordering) { - $draggable = 'elgg-state-draggable'; - - // 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, - 'is_trusted' => 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, - 'is_trusted' => 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, - 'is_trusted' => 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, - 'is_trusted' => true, - )) . "
  • "; - } -} else { - $draggable = 'elgg-state-undraggable'; -} - - -// activate / deactivate links - -// always let them deactivate -$options = array( - 'is_action' => true, - 'is_trusted' => true, -); -if ($active) { - $active_class = 'elgg-state-active'; - $action = 'deactivate'; - $options['text'] = elgg_echo('admin:plugins: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('admin:plugins: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 - )); - - $options['href'] = $url; -} -$action_button = elgg_view('output/url', $options); - -// Display categories -$categories_html = ''; -if ($categories) { - $categories_arr = array(); - $base_url = elgg_get_site_url() . "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->getManifest()->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']}admin_plugin_screenshot/{$plugin->getID()}/full/{$screenshot['path']}"; - $screenshot_src = "{$vars['url']}admin_plugin_screenshot/{$plugin->getID()}/thumbnail/{$screenshot['path']}"; - - $screenshots_html .= "
  • " - . "\"$alt\"
  • "; - } -} - -// metadata -$description = elgg_view('output/longtext', array('value' => $plugin->getManifest()->getDescription())); -$author = '' . elgg_echo('admin:plugins:label:author') . ': ' - . elgg_view('output/text', array('value' => $plugin->getManifest()->getAuthor())); -$version = htmlspecialchars($plugin->getManifest()->getVersion()); -$website = elgg_view('output/url', array( - 'href' => $plugin->getManifest()->getWebsite(), - 'text' => $plugin->getManifest()->getWebsite(), - 'is_trusted' => true, -)); - -$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(); - -$docs = ''; -if ($files) { - $docs = ''; -} - -?> - -
    -
    -
    - - - -
    - -
    -
    -
    -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 = "[" . elgg_echo('settings') . "]"; -} -?> -
    -

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

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

    $message

    "; - } - } - - if (!$can_activate) { - if ($active) { - $message = elgg_echo('admin:plugins:warning:unmet_dependencies_active'); - echo "

    $message

    "; - } else { - $message = elgg_echo('admin:plugins:warning:unmet_dependencies'); - echo "

    $message

    "; - } - } - ?> - -
    -

    - - -
    - "#elgg-plugin-manifest-{$plugin->getID()}", - 'text' => elgg_echo("admin:plugins:label:moreinfo"), - 'rel' => 'toggle', - )); - ?> -
    -
    -
    - -
    \ No newline at end of file diff --git a/views/default/object/plugin/full.php b/views/default/object/plugin/full.php new file mode 100644 index 000000000..db4e4dbcc --- /dev/null +++ b/views/default/object/plugin/full.php @@ -0,0 +1,284 @@ +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); + +// build reordering links +$links = ''; + +if ($reordering) { + $draggable = 'elgg-state-draggable'; + + // 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, + 'is_trusted' => 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, + 'is_trusted' => 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, + 'is_trusted' => 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, + 'is_trusted' => true, + )) . "
  • "; + } +} else { + $draggable = 'elgg-state-undraggable'; +} + + +// activate / deactivate links + +// always let them deactivate +$options = array( + 'is_action' => true, + 'is_trusted' => true, +); +if ($active) { + $active_class = 'elgg-state-active'; + $action = 'deactivate'; + $options['text'] = elgg_echo('admin:plugins: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('admin:plugins: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 + )); + + $options['href'] = $url; +} +$action_button = elgg_view('output/url', $options); + +// Display categories +$categories_html = ''; +if ($categories) { + $categories_arr = array(); + $base_url = elgg_get_site_url() . "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->getManifest()->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']}admin_plugin_screenshot/{$plugin->getID()}/full/{$screenshot['path']}"; + $screenshot_src = "{$vars['url']}admin_plugin_screenshot/{$plugin->getID()}/thumbnail/{$screenshot['path']}"; + + $screenshots_html .= "
  • " + . "\"$alt\"
  • "; + } +} + +// metadata +$description = elgg_view('output/longtext', array('value' => $plugin->getManifest()->getDescription())); +$author = '' . elgg_echo('admin:plugins:label:author') . ': ' + . elgg_view('output/text', array('value' => $plugin->getManifest()->getAuthor())); +$version = htmlspecialchars($plugin->getManifest()->getVersion()); +$website = elgg_view('output/url', array( + 'href' => $plugin->getManifest()->getWebsite(), + 'text' => $plugin->getManifest()->getWebsite(), + 'is_trusted' => true, +)); + +$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(); + +$docs = ''; +if ($files) { + $docs = ''; +} + +?> + +
    +
    +
    + + + +
    + +
    +
    +
    +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 = "[" . elgg_echo('settings') . "]"; +} +?> +
    +

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

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

    $message

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

    $message

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

    $message

    "; + } + } + ?> + +
    +

    + + +
    + "#elgg-plugin-manifest-{$plugin->getID()}", + 'text' => elgg_echo("admin:plugins:label:moreinfo"), + 'rel' => 'toggle', + )); + ?> +
    +
    +
    + +
    \ 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 4d392e71a..000000000 --- a/views/default/object/plugin/simple.php +++ /dev/null @@ -1,77 +0,0 @@ -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 .= '

    ' . elgg_echo('admin:plugins:simple:cannot_activate') . '

    '; -} - -$description = elgg_view('output/longtext', array('value' => $description)); - -$plugin_footer = '"; - -echo <<<___END -
    -
    - - -
    -
    - $description - $plugin_footer -
    -
    -___END; -- cgit v1.2.3