diff options
Diffstat (limited to 'views/default/object')
-rw-r--r-- | views/default/object/admin_notice.php | 20 | ||||
-rw-r--r-- | views/default/object/album.php | 22 | ||||
-rw-r--r-- | views/default/object/album/full.php | 59 | ||||
-rw-r--r-- | views/default/object/album/gallery.php | 36 | ||||
-rw-r--r-- | views/default/object/album/list.php | 42 | ||||
-rw-r--r-- | views/default/object/default.php | 49 | ||||
-rw-r--r-- | views/default/object/elements/full.php | 37 | ||||
-rw-r--r-- | views/default/object/elements/summary.php | 59 | ||||
-rw-r--r-- | views/default/object/image.php | 211 | ||||
-rw-r--r-- | views/default/object/image/full.php | 62 | ||||
-rw-r--r-- | views/default/object/image/navigation.php | 34 | ||||
-rw-r--r-- | views/default/object/image/summary.php | 41 | ||||
-rw-r--r-- | views/default/object/plugin.php | 20 | ||||
-rw-r--r-- | views/default/object/plugin/elements/dependencies.php | 49 | ||||
-rw-r--r-- | views/default/object/plugin/full.php | 308 | ||||
-rw-r--r-- | views/default/object/plugin/invalid.php | 42 | ||||
-rw-r--r-- | views/default/object/widget.php | 75 | ||||
-rw-r--r-- | views/default/object/widget/elements/controls.php | 14 | ||||
-rw-r--r-- | views/default/object/widget/elements/settings.php | 25 |
19 files changed, 698 insertions, 507 deletions
diff --git a/views/default/object/admin_notice.php b/views/default/object/admin_notice.php new file mode 100644 index 000000000..11524567e --- /dev/null +++ b/views/default/object/admin_notice.php @@ -0,0 +1,20 @@ +<?php +/** + * A persistent admin notice to be displayed on all admin pages until cleared. + */ + +if (isset($vars['entity']) && elgg_instanceof($vars['entity'], 'object', 'admin_notice')) { + $notice = $vars['entity']; + $message = $notice->description; + + $delete = elgg_view('output/url', array( + 'href' => "action/admin/delete_admin_notice?guid=$notice->guid", + 'text' => '<span class="elgg-icon elgg-icon-delete"></span>', + 'is_action' => true, + 'class' => 'elgg-admin-notice', + 'is_trusted' => true, + )); + + echo "<p>$delete$message</p>"; +} + diff --git a/views/default/object/album.php b/views/default/object/album.php deleted file mode 100644 index bfcfd96d2..000000000 --- a/views/default/object/album.php +++ /dev/null @@ -1,22 +0,0 @@ -<?php -/** - * Album view - * - * @uses $vars['entity'] TidypicsAlbum - * - * @author Cash Costello - * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 - */ - -$album = elgg_extract('entity', $vars); -$full_view = elgg_extract('full_view', $vars, false); - -if ($full_view) { - echo elgg_view('object/album/full', $vars); -} else { - if (elgg_in_context('widgets')) { - echo elgg_view('object/album/list', $vars); - } else { - echo elgg_view('object/album/gallery', $vars); - } -} diff --git a/views/default/object/album/full.php b/views/default/object/album/full.php deleted file mode 100644 index 7b273c66e..000000000 --- a/views/default/object/album/full.php +++ /dev/null @@ -1,59 +0,0 @@ -<?php -/** - * Full view of an album - * - * @uses $vars['entity'] TidypicsAlbum - * - * @author Cash Costello - * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 - */ - -$album = elgg_extract('entity', $vars); -$owner = $album->getOwnerEntity(); - -$owner_icon = elgg_view_entity_icon($owner, 'tiny'); - -$metadata = elgg_view_menu('entity', array( - 'entity' => $album, - 'handler' => 'photos', - 'sort_by' => 'priority', - 'class' => 'elgg-menu-hz', -)); - -$owner_link = elgg_view('output/url', array( - 'href' => "photos/owner/$owner->username", - 'text' => $owner->name, - 'is_trusted' => true, -)); -$author_text = elgg_echo('byline', array($owner_link)); -$date = elgg_view_friendly_time($album->time_created); -$categories = elgg_view('output/categories', $vars); - -$subtitle = "$author_text $date $categories"; - -$params = array( - 'entity' => $album, - 'title' => false, - 'metadata' => $metadata, - 'subtitle' => $subtitle, - 'tags' => elgg_view('output/tags', array('tags' => $album->tags)), -); -$params = $params + $vars; -$summary = elgg_view('object/elements/summary', $params); - -$body = ''; -if ($album->description) { - $body = elgg_view('output/longtext', array( - 'value' => $album->description, - 'class' => 'mbm', - )); -} - -$body .= $album->viewImages(); - -echo elgg_view('object/elements/full', array( - 'entity' => $album, - 'icon' => $owner_icon, - 'summary' => $summary, - 'body' => $body, -)); diff --git a/views/default/object/album/gallery.php b/views/default/object/album/gallery.php deleted file mode 100644 index d6fb598e4..000000000 --- a/views/default/object/album/gallery.php +++ /dev/null @@ -1,36 +0,0 @@ -<?php -/** - * Display an album in a gallery - * - * @uses $vars['entity'] TidypicsAlbum - * - * @author Cash Costello - * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 - */ - -$album = elgg_extract('entity', $vars); - - -$album_cover = elgg_view_entity_icon($album, 'small'); - -$header = elgg_view('output/url', array( - 'text' => $album->getTitle(), - 'href' => $album->getURL(), - 'is_trusted' => true, - 'class' => 'tidypics-heading', -)); - -$footer = ""; -if ($album->getContainerEntity()) { - $footer .= elgg_view('output/url', array( - 'text' => $album->getContainerEntity()->name, - 'href' => $album->getContainerEntity()->getURL(), - 'is_trusted' => true, - )); -} -$footer .= '<div class="elgg-subtext">' . elgg_echo('album:num', array($album->getSize())) . '</div>'; - -$params = array( - 'footer' => $footer, -); -echo elgg_view_module('tidypics-album', $header, $album_cover, $params); diff --git a/views/default/object/album/list.php b/views/default/object/album/list.php deleted file mode 100644 index e576c92f1..000000000 --- a/views/default/object/album/list.php +++ /dev/null @@ -1,42 +0,0 @@ -<?php -/** - * Display an album as an item in a list - * - * @uses $vars['entity'] TidypicsAlbum - * - * @author Cash Costello - * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 - */ - -$album = elgg_extract('entity', $vars); -$owner = $album->getOwnerEntity(); - -$owner_link = elgg_view('output/url', array( - 'href' => "photos/owner/$owner->username", - 'text' => $owner->name, - 'is_trusted' => true, -)); -$author_text = elgg_echo('byline', array($owner_link)); -$date = elgg_view_friendly_time($album->time_created); -$categories = elgg_view('output/categories', $vars); - -$subtitle = "$author_text $date $categories"; - -$title = elgg_view('output/url', array( - 'text' => $album->getTitle(), - 'href' => $album->getURL(), -)); - -$params = array( - 'entity' => $album, - 'title' => $title, - 'metadata' => null, - 'subtitle' => $subtitle, - 'tags' => elgg_view('output/tags', array('tags' => $album->tags)), -); -$params = $params + $vars; -$summary = elgg_view('object/elements/summary', $params); - -$icon = elgg_view_entity_icon($album, 'tiny'); - -echo $header = elgg_view_image_block($icon, $summary); diff --git a/views/default/object/default.php b/views/default/object/default.php new file mode 100644 index 000000000..110648304 --- /dev/null +++ b/views/default/object/default.php @@ -0,0 +1,49 @@ +<?php +/** + * ElggObject default view. + * + * @warning This view may be used for other ElggEntity objects + * + * @package Elgg + * @subpackage Core + */ + +$icon = elgg_view_entity_icon($vars['entity'], 'small'); + +$title = $vars['entity']->title; +if (!$title) { + $title = $vars['entity']->name; +} +if (!$title) { + $title = get_class($vars['entity']); +} + +if (elgg_instanceof($vars['entity'], 'object')) { + $metadata = elgg_view('navigation/menu/metadata', $vars); +} + +$owner_link = ''; +$owner = $vars['entity']->getOwnerEntity(); +if ($owner) { + $owner_link = elgg_view('output/url', array( + 'href' => $owner->getURL(), + 'text' => $owner->name, + 'is_trusted' => true, + )); +} + +$date = elgg_view_friendly_time($vars['entity']->time_created); + +$subtitle = "$owner_link $date"; + +$params = array( + 'entity' => $vars['entity'], + 'title' => $title, + 'metadata' => $metadata, + 'subtitle' => $subtitle, + 'tags' => $vars['entity']->tags, +); +$params = $params + $vars; +$body = elgg_view('object/elements/summary', $params); + +echo elgg_view_image_block($icon, $body, $vars); diff --git a/views/default/object/elements/full.php b/views/default/object/elements/full.php new file mode 100644 index 000000000..9b89f9706 --- /dev/null +++ b/views/default/object/elements/full.php @@ -0,0 +1,37 @@ +<?php +/** + * Object full rendering + * + * Sample output: + * <div class="elgg-content"> + * <div class="elgg-image-block"> + * </div> + * <div class="elgg-output"> + * </div> + * </div> + * + * @uses $vars['entity'] ElggEntity + * @uses $vars['icon'] HTML for the content icon + * @uses $vars['summary'] HTML for the content summary + * @uses $vars['body'] HTML for the content body + * @uses $vars['class'] Optional additional class for the content wrapper + */ + +$icon = elgg_extract('icon', $vars); +$summary = elgg_extract('summary', $vars); +$body = elgg_extract('body', $vars); +$class = elgg_extract('class', $vars); +if ($class) { + $class = "elgg-content $class"; +} else { + $class = "elgg-content"; +} + +$header = elgg_view_image_block($icon, $summary); + +echo <<<HTML +<div class="$class"> +$header +$body +</div> +HTML; diff --git a/views/default/object/elements/summary.php b/views/default/object/elements/summary.php new file mode 100644 index 000000000..c0f3ad340 --- /dev/null +++ b/views/default/object/elements/summary.php @@ -0,0 +1,59 @@ +<?php +/** + * Object summary + * + * Sample output + * <ul class="elgg-menu elgg-menu-entity"><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-content">Excerpt text</div> + * + * @uses $vars['entity'] ElggEntity + * @uses $vars['title'] Title link (optional) false = no title, '' = default + * @uses $vars['metadata'] HTML for entity menu and metadata (optional) + * @uses $vars['subtitle'] HTML for the subtitle (optional) + * @uses $vars['tags'] HTML for the tags (default is tags on entity, pass false for no tags) + * @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(), + 'is_trusted' => true, + ); + $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 === '') { + $tags = elgg_view('output/tags', array('tags' => $entity->tags)); +} + +if ($metadata) { + echo $metadata; +} +if ($title_link) { + echo "<h3>$title_link</h3>"; +} +echo "<div class=\"elgg-subtext\">$subtitle</div>"; +echo $tags; + +echo elgg_view('object/summary/extend', $vars); + +if ($content) { + echo "<div class=\"elgg-content\">$content</div>"; +} diff --git a/views/default/object/image.php b/views/default/object/image.php deleted file mode 100644 index fc8ea827e..000000000 --- a/views/default/object/image.php +++ /dev/null @@ -1,211 +0,0 @@ -<?php -/** - * Image view - * - * @uses $vars['entity'] TidypicsImage - * - * @author Cash Costello - * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 - */ - - -$full_view = elgg_extract('full_view', $vars, false); - -if ($full_view) { - echo elgg_view('object/image/full', $vars); -} else { - echo elgg_view('object/image/summary', $vars); -} - -return true; - -global $CONFIG; -include_once dirname(dirname(dirname(dirname(__FILE__)))) . "/lib/exif.php"; - -$image = $vars['entity']; -$image_guid = $image->getGUID(); -$tags = $image->tags; -$title = $image->getTitle(); -$desc = $image->description; -$owner = $image->getOwnerEntity(); -$friendlytime = friendly_time($image->time_created); - - -/******************************************************************** - * - * search view of an image - * - ********************************************************************/ -if (get_context() == "search") { - - // gallery view is a matrix view showing just the image - size: small - if (get_input('search_viewtype') == "gallery") { -?> -<div class="tidypics_album_images"> - <a href="<?php echo $image->getURL();?>"><img src="<?php echo $vars['url'];?>mod/tidypics/thumbnail.php?file_guid=<?php echo $image_guid;?>&size=small" alt="thumbnail"/></a> -</div> -<?php - } else { - // list view displays a thumbnail icon of the image, its title, and the number of comments - $info = '<p><a href="' .$image->getURL(). '">'.$title.'</a></p>'; - $info .= "<p class=\"owner_timestamp\"><a href=\"{$vars['url']}pg/profile/{$owner->username}\">{$owner->name}</a> {$friendlytime}"; - $numcomments = elgg_count_comments($image); - if ($numcomments) { - $info .= ", <a href=\"{$image->getURL()}\">" . sprintf(elgg_echo("comments")) . " (" . $numcomments . ")</a>"; - } - $info .= "</p>"; - $icon = "<a href=\"{$image->getURL()}\">" . '<img src="' . $vars['url'] . 'mod/tidypics/thumbnail.php?file_guid=' . $image_guid . '&size=thumb" alt="' . $title . '" /></a>'; - - echo elgg_view_listing($icon, $info); - } - -/*************************************************************** - * - * front page view - * - ****************************************************************/ -} else if (get_context() == "front" || get_context() == "widget") { - // the front page view is a clickable thumbnail of the image -?> -<a href="<?php echo $image->getURL(); ?>"> - <img src="<?php echo $vars['url'];?>mod/tidypics/thumbnail.php?file_guid=<?php echo $image_guid;?>&size=thumb" class="tidypics_album_cover" alt="<?php echo $title; ?>" title="<?php echo $title; ?>" /> -</a> - <?php -} else { - -/******************************************************************** - * - * listing of photos in an album - * - *********************************************************************/ - if (!$vars['full']) { - - // plugins can override the image link to add lightbox code here - $image_html = false; - $image_html = trigger_plugin_hook('tp_thumbnail_link', 'album', array('image' => $image), $image_html); - - if ($image_html) { - echo $image_html; - } else { - // default link to image if no one overrides -?> -<div class="tidypics_album_images"> - <a href="<?php echo $image->getURL();?>"><img src="<?php echo $vars['url'];?>pg/photos/thumbnail/<?php echo $image_guid;?>/small/" alt="<?php echo $image->title; ?>"/></a> -</div> -<?php - } - } else { - -/******************************************************************** - * - * tidypics individual image display - * - *********************************************************************/ - - - $viewer = get_loggedin_user(); - - - // Build back and next links - $back = ''; - $next = ''; - $album = get_entity($image->container_guid); - $back_guid = $album->getPreviousImageGuid($image->guid); - $next_guid = $album->getNextImageGuid($image->guid); - - if ($back_guid != 0) { - $text = elgg_echo('image:back'); - $back = "<a href=\"{$vars['url']}pg/photos/view/$back_guid\">« $text</a>"; - } - - if ($next_guid != 0) { - $text = elgg_echo('image:next'); - $next = "<a href=\"{$vars['url']}pg/photos/view/$next_guid\">$text »</a>"; - } - -?> -<div class="contentWrapper"> - <div id="tidypics_wrapper"> - - <div id="tidypics_breadcrumbs"> - <?php echo elgg_view('tidypics/breadcrumbs', array('album' => $album,) ); ?> <br /> -<?php - if (get_plugin_setting('view_count', 'tidypics') != "disabled") { - - $image->addView($viewer->guid); - $views = $image->getViews($viewer->guid); - if (is_array($views)) { - echo sprintf(elgg_echo("tidypics:views"), $views['total']); - if ($owner->guid == $viewer->guid) { - echo ' ' . sprintf(elgg_echo("tidypics:viewsbyowner"), $views['unique']); - } else { - if ($views['mine']) { - echo ' ' . sprintf(elgg_echo("tidypics:viewsbyothers"), $views['mine']); - } - } - } - } -?> - </div> - - <div id="tidypics_desc"> - <?php echo autop($desc); ?> - </div> - <div id="tidypics_image_nav"> - <ul> - <li><?php echo $back; ?></li> - <li><?php echo $next; ?></li> - </ul> - </div> - <div id="tidypics_image_wrapper"> - <?php - // this code controls whether the photo is a hyperlink or not and what it links to - if (get_plugin_setting('download_link', 'tidypics') != "disabled") { - // admin allows downloads so default to inline download link - $image_html = "<a href=\"{$vars['url']}pg/photos/download/{$image_guid}/inline/\" title=\"{$title}\" >"; - $image_html .= "<img id=\"tidypics_image\" src=\"{$vars['url']}pg/photos/thumbnail/{$image_guid}/large/\" alt=\"{$title}\" />"; - $image_html .= "</a>"; - } else { - $image_html = "<img id=\"tidypics_image\" src=\"{$vars['url']}pg/photos/thumbnail/{$image_guid}/large/\" alt=\"{$title}\" />"; - } - // does any plugin want to override the link - $image_html = trigger_plugin_hook('tp_thumbnail_link', 'image', array('image' => $image), $image_html); - echo $image_html; - ?> - <div class="clearfloat"></div> - </div> - <?php - if (get_plugin_setting('exif', 'tidypics') == "enabled") { - echo elgg_view('tidypics/exif', array('guid'=> $image_guid)); - } -?> - <div class="tidypics_info"> -<?php - if (!is_null($tags)) { -?> - <div class="object_tag_string"><?php echo elgg_view('output/tags',array('value' => $tags));?></div> -<?php - } - if (get_plugin_setting('photo_ratings', 'tidypics') == "enabled") { -?> - <div id="rate_container"> - <?php echo elgg_view('rate/rate', array('entity'=> $vars['entity'])); ?> - </div> -<?php - } - - echo elgg_echo('image:by');?> <b><a href="<?php echo $vars['url']; ?>pg/profile/<?php echo $owner->username; ?>"><?php echo $owner->name; ?></a></b> <?php echo $friendlytime; -?> - </div> - </div> <!-- tidypics wrapper--> -<?php - - echo elgg_view_comments($image); - - echo '<div class="clearfloat"></div>'; - - echo '</div>'; // content wrapper - - } // end of individual image display - -} diff --git a/views/default/object/image/full.php b/views/default/object/image/full.php deleted file mode 100644 index 74436f500..000000000 --- a/views/default/object/image/full.php +++ /dev/null @@ -1,62 +0,0 @@ -<?php -/** - * Full view of an image - * - * @uses $vars['entity'] TidypicsImage - * - * @author Cash Costello - * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 - */ - -$image = $photo = $vars['entity']; - -$img = elgg_view_entity_icon($image, 'large', array( - 'href' => $image->getIconURL('master'), - 'img_class' => 'tidypics-photo', - 'link_class' => 'tidypics-lightbox elgg-lightbox-photo', -)); - -$owner_link = elgg_view('output/url', array( - 'href' => "photos/owner/" . $photo->getOwnerEntity()->username, - 'text' => $photo->getOwnerEntity()->name, -)); -$author_text = elgg_echo('byline', array($owner_link)); - -$owner_icon = elgg_view_entity_icon($photo->getOwnerEntity(), 'tiny'); - -$metadata = elgg_view_menu('entity', array( - 'entity' => $vars['entity'], - 'handler' => 'photos', - 'sort_by' => 'priority', - 'class' => 'elgg-menu-hz', -)); - -$subtitle = "$author_text $date $categories $comments_link"; - -$params = array( - 'entity' => $photo, - 'title' => false, - 'metadata' => $metadata, - 'subtitle' => $subtitle, - 'tags' => $tags, -); -$list_body = elgg_view('object/elements/summary', $params); - -$params = array('class' => 'mbl'); -$summary = elgg_view_image_block($owner_icon, $list_body, $params); - -echo $summary; - -echo '<div class="tidypics-photo-wrapper center">'; -echo elgg_view('object/image/navigation', $vars); -echo $img; -echo '</div>'; - -if ($photo->description) { - echo elgg_view('output/longtext', array( - 'value' => $photo->description, - 'class' => 'mbl', - )); -} - -echo elgg_view_comments($photo); diff --git a/views/default/object/image/navigation.php b/views/default/object/image/navigation.php deleted file mode 100644 index 155b76364..000000000 --- a/views/default/object/image/navigation.php +++ /dev/null @@ -1,34 +0,0 @@ -<?php -/** - * Photo navigation - * - * @uses $vars['entity'] - */ - -$photo = $vars['entity']; - -$album = $photo->getContainerEntity(); -$previous_photo = $album->getPreviousImage($photo->getGUID()); -$next_photo = $album->getNextImage($photo->getGUID()); -$size = $album->getSize(); -$index = $album->getIndex($photo->getGUID()); - -echo '<ul class="elgg-menu elgg-menu-hz tidypics-album-nav">'; -echo '<li>'; -echo elgg_view('output/url', array( - 'text' => elgg_view_icon('arrow-left'), - 'href' => $previous_photo->getURL(), -)); -echo '</li>'; - -echo '<li>'; -echo '<span>' . elgg_echo('image:index', array($index, $size)) . '</span>'; -echo '</li>'; - -echo '<li>'; -echo elgg_view('output/url', array( - 'text' => elgg_view_icon('arrow-right'), - 'href' => $next_photo->getURL(), -)); -echo '</li>'; -echo '</ul>'; diff --git a/views/default/object/image/summary.php b/views/default/object/image/summary.php deleted file mode 100644 index 0fa03cbe8..000000000 --- a/views/default/object/image/summary.php +++ /dev/null @@ -1,41 +0,0 @@ -<?php -/** - * Summary of an image for lists/galleries - * - * @uses $vars['entity'] TidypicsImage - * - * @author Cash Costello - * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 - */ - -$image = elgg_extract('entity', $vars); - - -$header = elgg_view('output/url', array( - 'text' => $image->getTitle(), - 'href' => $image->getURL(), - 'is_trusted' => true, - 'class' => 'tidypics-heading', -)); - -$body = elgg_view_entity_icon($image, 'small', array( - 'href' => $image->getURL(), - 'img_class' => 'tidypics-photo', - 'encode_text' => false, - 'is_trusted' => true, - 'link_class' => 'tidypics-lightbox elgg-lightbox-photo', -)); - -/* -$footer = elgg_view('output/url', array( - 'text' => $image->getContainerEntity()->name, - 'href' => $image->getContainerEntity()->getURL(), - 'is_trusted' => true, -)); -$footer .= '<div class="elgg-subtext">' . elgg_echo('album:num', array($album->getSize())) . '</div>'; -*/ - -$params = array( - 'footer' => $footer, -); -echo elgg_view_module('tidypics-image', $header, $body, $params); diff --git a/views/default/object/plugin.php b/views/default/object/plugin.php new file mode 100644 index 000000000..5c7138e96 --- /dev/null +++ b/views/default/object/plugin.php @@ -0,0 +1,20 @@ +<?php +/** + * Used to show plugin user settings. + * + * @package Elgg.Core + * @subpackage Plugins + * + */ + +if (!elgg_in_context('admin')) { + forward('/', 403); +} + +$plugin = $vars['entity']; + +if (!$plugin->isValid()) { + echo elgg_view('object/plugin/invalid', $vars); +} else { + echo elgg_view('object/plugin/full', $vars); +} diff --git a/views/default/object/plugin/elements/dependencies.php b/views/default/object/plugin/elements/dependencies.php new file mode 100644 index 000000000..d8daedd33 --- /dev/null +++ b/views/default/object/plugin/elements/dependencies.php @@ -0,0 +1,49 @@ +<?php +/** + * Shows a table of plugin dependecies for ElggPlugin in $vars['plugin']. + * + * This uses a table because it's a table of data. + * + * @package Elgg.Core + * @subpackage Admin.Plugins + */ + +$plugin = elgg_extract('plugin', $vars, false); +$deps = $plugin->getPackage()->checkDependencies(true); + +$columns = array('type', 'name', 'expected_value', 'local_value', 'comment'); + +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>'; + +$row = 'odd'; +foreach ($deps as $dep) { + $fields = elgg_get_plugin_dependency_strings($dep); + $type = $dep['type']; + + 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"; + } + + echo "<tr class=\"$row\">"; + + foreach ($columns as $column) { + echo "<td class=\"pas $class\">{$fields[$column]}</td>"; + } + + echo '</tr>'; + + $row = ($row == 'odd') ? 'even' : 'odd'; +} + +echo '</table>';
\ 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..2de65b555 --- /dev/null +++ b/views/default/object/plugin/full.php @@ -0,0 +1,308 @@ +<?php +/** + * Displays a plugin on the admin screen. + * + * 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(); + +$can_activate = $plugin->canActivate(); +$max_priority = elgg_get_max_plugin_priority(); +$actions_base = '/action/admin/plugins/'; +$css_id = preg_replace('/[^a-z0-9-]/i', '-', $plugin->getID()); + +// build reordering links +$links = ''; +$classes = array('elgg-plugin'); + +if ($reordering) { + $classes[] = '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 .= "<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 + )); + + $links .= "<li>" . elgg_view('output/url', array( + 'href' => $up_url, + 'text' => elgg_echo('up'), + 'is_action' => true, + 'is_trusted' => 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, + '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, + 'is_trusted' => true, + )) . "</li>"; + } +} else { + $classes[] = 'elgg-state-undraggable'; +} + + +// activate / deactivate links + +// always let them deactivate +$options = array( + 'is_action' => true, + 'is_trusted' => true, +); +if ($active) { + $classes[] = 'elgg-state-active'; + $action = 'deactivate'; + $options['text'] = elgg_echo('admin:plugins:deactivate'); + $options['class'] = "elgg-button elgg-button-cancel"; + + if (!$can_activate) { + $classes[] = 'elgg-state-active'; + $options['class'] = 'elgg-button elgg-state-warning'; + } +} else if ($can_activate) { + $classes[] = 'elgg-state-inactive'; + $action = 'activate'; + $options['text'] = elgg_echo('admin:plugins:activate'); + $options['class'] = "elgg-button elgg-button-submit"; +} else { + $classes[] = '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 and make category classes +$categories = $plugin->getManifest()->getCategories(); +$categories_html = ''; +if ($categories) { + $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); + $friendly_category = htmlspecialchars(ElggPluginManifest::getFriendlyCategory($category)); + $categories_html .= "<li class=\"elgg-plugin-category prm\"><a href=\"$url\">$friendly_category</a></li>"; + } +} + +$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 .= "<li class=\"elgg-plugin-screenshot prm ptm\"><a class=\"elgg-lightbox\" href=\"$screenshot_full\">" + . "<img src=\"$screenshot_src\" alt=\"$alt\"></a></li>"; + } +} + +// metadata +$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->getManifest()->getAuthor())); +$version = htmlspecialchars($plugin->getManifest()->getVersion()); +$website = elgg_view('output/url', array( + 'href' => $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())); + +// show links to text files +$files = $plugin->getAvailableTextFiles(); + +$docs = ''; +if ($files) { + $docs = '<ul>'; + foreach ($files as $file => $path) { + $url = 'admin_plugin_text_file/' . $plugin->getID() . "/$file"; + $link = elgg_view('output/url', array( + 'text' => $file, + 'href' => $url, + 'is_trusted' => true, + )); + $docs .= "<li>$link</li>"; + + } + $docs .= '</ul>'; +} + +?> + +<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; ?> + </ul> + <?php endif; ?> + <div class="clearfloat float-alt mtm"> + <?php echo $action_button; ?> + </div> + </div> + <div class="elgg-body"> +<?php +$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='elgg-plugin-settings' href='$link'>[" . elgg_echo('settings') . "]</a>"; +} +?> + <div class="elgg-head"> + <h3><?php echo $plugin->getManifest()->getName() . " $version $settings_link"; ?></h3> + </div> + <?php + 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>"; + } + } + + if (!$can_activate) { + 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>"; + } + } + ?> + + <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-$css_id", + 'text' => elgg_echo("admin:plugins:label:moreinfo"), + 'rel' => 'toggle', + )); + ?> + </div> + </div> + </div> + <div class="elgg-plugin-more hidden" id="elgg-plugin-manifest-<?php echo $css_id; ?>"> + + <?php + if ($screenshots_html) { + ?> + <div><ul><?php echo $screenshots_html; ?></ul></div> + <?php + } + + if ($categories_html) { + ?> + <div><?php echo elgg_echo('admin:plugins:label:categories') . ": <ul class=\"elgg-plugin-categories\">$categories_html</ul>"; ?></div> + <?php + } + + ?> + <div><?php echo elgg_echo('admin:plugins:label:copyright') . ": " . $copyright; ?></div> + <div><?php echo elgg_echo('admin:plugins:label:licence') . ": " . $license; ?></div> + <div><?php echo elgg_echo('admin:plugins:label:location') . ": " . htmlspecialchars($plugin->getPath()) ?></div> + + <div><?php echo elgg_echo('admin:plugins:label:dependencies'); ?>: + <?php + echo elgg_view('object/plugin/elements/dependencies', array('plugin' => $plugin)); + ?> + </div> + </div> +</div> diff --git a/views/default/object/plugin/invalid.php b/views/default/object/plugin/invalid.php new file mode 100644 index 000000000..828bceaba --- /dev/null +++ b/views/default/object/plugin/invalid.php @@ -0,0 +1,42 @@ +<?php +/** + * Displays an invalid plugin on the admin screen. + * + * An invalid plugin is a plugin whose isValid() method returns false. + * This usually means there are required files missing, unreadable or in the + * wrong format. + * + * @package Elgg.Core + * @subpackage Plugins + */ + +$plugin = $vars['entity']; + +$id = $plugin->getID(); +$path = htmlspecialchars($plugin->getPath()); +$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 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-$css_id", + 'text' => elgg_echo("admin:plugins:label:moreinfo"), + 'rel' => 'toggle', + )); + ?> + </div> + + <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> + </div> + </div> +</div>
\ No newline at end of file diff --git a/views/default/object/widget.php b/views/default/object/widget.php new file mode 100644 index 000000000..0c7994f2b --- /dev/null +++ b/views/default/object/widget.php @@ -0,0 +1,75 @@ +<?php +/** + * Widget object + * + * @uses $vars['entity'] ElggWidget + * @uses $vars['show_access'] Show the access control in edit area? (true) + */ + +$widget = $vars['entity']; +if (!elgg_instanceof($widget, 'object', 'widget')) { + return true; +} + +$show_access = elgg_extract('show_access', $vars, true); + +// @todo catch for disabled plugins +$widget_types = elgg_get_widget_types('all'); + +$handler = $widget->handler; + +$title = $widget->getTitle(); + +$edit_area = ''; +$can_edit = $widget->canEdit(); +if ($can_edit) { + $edit_area = elgg_view('object/widget/elements/settings', array( + 'widget' => $widget, + 'show_access' => $show_access, + )); +} +$controls = elgg_view('object/widget/elements/controls', array( + 'widget' => $widget, + 'show_edit' => $edit_area != '', +)); + +// don't show content for default widgets +if (elgg_in_context('default_widgets')) { + $content = ''; +} else { + if (elgg_view_exists("widgets/$handler/content")) { + $content = elgg_view("widgets/$handler/content", $vars); + } else { + elgg_deprecated_notice("widgets use content as the display view", 1.8); + $content = elgg_view("widgets/$handler/view", $vars); + } +} + +$widget_id = "elgg-widget-$widget->guid"; +$widget_instance = "elgg-widget-instance-$handler"; +$widget_class = "elgg-module elgg-module-widget"; +if ($can_edit) { + $widget_class .= " elgg-state-draggable $widget_instance"; +} else { + $widget_class .= " elgg-state-fixed $widget_instance"; +} + +$widget_header = <<<HEADER + <div class="elgg-widget-handle clearfix"><h3>$title</h3> + $controls + </div> +HEADER; + +$widget_body = <<<BODY + $edit_area + <div class="elgg-widget-content" id="elgg-widget-content-$widget->guid"> + $content + </div> +BODY; + +echo elgg_view('page/components/module', array( + 'class' => $widget_class, + 'id' => $widget_id, + 'body' => $widget_body, + 'header' => $widget_header, +)); diff --git a/views/default/object/widget/elements/controls.php b/views/default/object/widget/elements/controls.php new file mode 100644 index 000000000..57a935f62 --- /dev/null +++ b/views/default/object/widget/elements/controls.php @@ -0,0 +1,14 @@ +<?php +/** + * Elgg widget controls + * + * @uses $vars['widget'] + * @uses $vars['show_edit'] Whether to show the edit button (true) + */ + +echo elgg_view_menu('widget', array( + 'entity' => elgg_extract('widget', $vars), + 'show_edit' => elgg_extract('show_edit', $vars, true), + 'sort_by' => 'priority', + 'class' => 'elgg-menu-hz', +)); diff --git a/views/default/object/widget/elements/settings.php b/views/default/object/widget/elements/settings.php new file mode 100644 index 000000000..25cda58c9 --- /dev/null +++ b/views/default/object/widget/elements/settings.php @@ -0,0 +1,25 @@ +<?php +/** + * Elgg widget edit settings + * + * @uses $vars['widget'] + */ + +$widget = elgg_extract('widget', $vars); + +// not using elgg_view_form() so that we can detect if the form is empty +$form_body = elgg_view('forms/widgets/save', $vars); +if (!$form_body) { + return true; +} + +$form = elgg_view('input/form', array( + 'action' => 'action/widgets/save', + 'body' => $form_body, + 'class' => 'elgg-form-widgets-save', +)); +?> + +<div class="elgg-widget-edit" id="widget-edit-<?php echo $widget->guid; ?>"> + <?php echo $form; ?> +</div> |