aboutsummaryrefslogtreecommitdiff
path: root/mod/embed/views
diff options
context:
space:
mode:
Diffstat (limited to 'mod/embed/views')
-rw-r--r--mod/embed/views/default/embed/addcontentjs.php4
-rw-r--r--mod/embed/views/default/embed/css.php151
-rw-r--r--mod/embed/views/default/embed/embed.php156
-rw-r--r--mod/embed/views/default/embed/item.php39
-rw-r--r--mod/embed/views/default/embed/item/gallery.php54
-rw-r--r--mod/embed/views/default/embed/item/list.php51
-rw-r--r--mod/embed/views/default/embed/js.php402
-rw-r--r--mod/embed/views/default/embed/layout.php40
-rw-r--r--mod/embed/views/default/embed/layouts/gallery.php12
-rw-r--r--mod/embed/views/default/embed/layouts/list.php12
-rw-r--r--mod/embed/views/default/embed/link.php6
-rw-r--r--mod/embed/views/default/embed/list.php58
-rw-r--r--mod/embed/views/default/embed/metatags.php5
-rw-r--r--mod/embed/views/default/embed/upload/content.php48
-rw-r--r--mod/embed/views/default/group/default/embed.php5
-rw-r--r--mod/embed/views/default/js/embed/embed.php147
-rw-r--r--mod/embed/views/default/navigation/menu/embed.php18
-rw-r--r--mod/embed/views/default/object/default/embed.php5
-rw-r--r--mod/embed/views/default/object/file/embed.php16
-rw-r--r--mod/embed/views/default/object/file/embedlist.php18
-rw-r--r--mod/embed/views/default/site/default/embed.php5
-rw-r--r--mod/embed/views/default/user/default/embed.php5
22 files changed, 324 insertions, 933 deletions
diff --git a/mod/embed/views/default/embed/addcontentjs.php b/mod/embed/views/default/embed/addcontentjs.php
index c32d90871..ffed211f5 100644
--- a/mod/embed/views/default/embed/addcontentjs.php
+++ b/mod/embed/views/default/embed/addcontentjs.php
@@ -1,5 +1,7 @@
<?php
/**
* Blank for compatibility.
+ * @deprecated 1.8
*/
-?> \ No newline at end of file
+
+elgg_deprecated_notice("The view 'embed/addcontentjs' has been deprecated.", 1.8);
diff --git a/mod/embed/views/default/embed/css.php b/mod/embed/views/default/embed/css.php
index 4bc57ea23..034c0fcfe 100644
--- a/mod/embed/views/default/embed/css.php
+++ b/mod/embed/views/default/embed/css.php
@@ -3,148 +3,35 @@
* Elgg embed CSS - standard across all themes
*
* @package embed
- * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
- * @author Curverider <info@elgg.com>
- * @copyright Curverider Ltd 2008-2010
- * @link http://elgg.org/
*/
?>
-
-#facebox {
- position: absolute;
- top: 0;
- left: 0;
- z-index: 10000;
- text-align: left;
-}
-#facebox .popup {
- position: relative;
-}
-#facebox .body {
- padding: 10px 15px 20px 15px;
- background-color: white;
+.embed-wrapper {
width: 730px;
- min-height:400px;
- -webkit-border-radius: 8px;
- -moz-border-radius: 8px;
-}
-#facebox .loading {
- text-align: center;
- padding: 100px 10px 100px 10px;
-}
-#facebox .image {
- text-align: center;
-}
-#facebox .footer {
- float: right;
- width:22px;
- height:22px;
- margin:0;
- padding:0;
-}
-#facebox .footer img.close_image {
- background: url(<?php echo $vars['url']; ?>mod/embed/images/close_button.gif) no-repeat left top;
-}
-#facebox .footer img.close_image:hover {
- background: url(<?php echo $vars['url']; ?>mod/embed/images/close_button.gif) no-repeat left -31px;
-}
-#facebox_overlay {
- position: fixed;
- top: 0px;
- left: 0px;
- height:100%;
- width:100%;
-}
-.facebox_hide {
- z-index:-100;
-}
-.facebox_overlayBG {
- background-color: #000000;
- z-index: 9999;
-}
-* html #facebox_overlay { /* ie6 hack */
- position: absolute;
- height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px');
-}
-
-#facebox .body .content h2 {
- color:#333333;
+ min-height: 400px;
+ margin: 20px 15px;
}
-
-
-/* embeded content links */
-.embeded_file.link {
- display: inline;
- margin-right: 5px;
- background-repeat:no-repeat;
- -webkit-background-size: 12px 16px;
- -moz-background-size: 12px 16px;
- padding-left:14px;
+.embed-wrapper h2 {
+ color: #333333;
+ margin-bottom: 10px;
}
-
-/* entity listings */
-.embed_data .entity_listing_icon img {
+.embed-wrapper .elgg-item {
cursor: pointer;
}
-.embed_data .entity_listing {
- border-bottom:none;
-}
-.embed_data:last-child {
- border-bottom:1px dotted #CCCCCC;
-}
-.embed_modal_videolist .entity_listing_icon img {
- width:75px;
- height:auto;
-}
-.embed_modal_document .embed_data .entity_listing_info {
- margin-top:0;
- margin-left:7px;
-}
-.embed_modal_tidypics .embed_data .entity_listing_info {
- margin-top:11px;
-}
-.embed_data .entity_listing_info {
- width:auto;
- margin-top:15px;
- margin-left:15px;
- float:left;
-}
-.embed_data .entity_listing {
- cursor:pointer;
-}
-
-/* navigation overrides */
-.elgg_horizontal_tabbed_nav .selected a.embed_section,
-.elgg_horizontal_tabbed_nav a.embed_section:hover {
- color:#333333;
+/* ***************************************
+ EMBED TABBED PAGE NAVIGATION
+*************************************** */
+.embed-wrapper .elgg-tabs a:hover {
+ color: #666;
}
-
-/* Pagination (override core elgg css defaults) */
-#facebox .body .pagination {
- float:right;
-}
-#facebox .body .pagination .pagination_number {
- border:1px solid #999999;
- color:#666666;
-}
-#facebox .body .pagination .pagination_number:hover {
- background-color:#aaaaaa;
- color:black;
+.embed-wrapper p {
+ color: #333;
}
-#facebox .body .pagination .pagination_previous,
-#facebox .body .pagination .pagination_next {
- border:1px solid #999999;
- color:#666666;
+.embed-item {
+ padding-left: 5px;
+ padding-right: 5px;
}
-#facebox .body .pagination .pagination_previous:hover,
-#facebox .body .pagination .pagination_next:hover {
- background-color:#aaaaaa;
- color:black;
+.embed-item:hover {
+ background-color: #eee;
}
-#facebox .body .pagination .pagination_currentpage {
- background-color:#666666;
- border:1px solid #666666;
- color:white;
-} \ No newline at end of file
diff --git a/mod/embed/views/default/embed/embed.php b/mod/embed/views/default/embed/embed.php
deleted file mode 100644
index b57c3b289..000000000
--- a/mod/embed/views/default/embed/embed.php
+++ /dev/null
@@ -1,156 +0,0 @@
-<?php
-/**
- * Embed landing page
- *
- * @todo Yes this is a lot of logic for a view. A good bit of it can be moved
- * to the page handler
- *
- * @uses string $vars['sections'] Array of section_id => Section Display Name
- * @uses string $vars['active_section'] Currently selected section_id
- */
-
-$sections = elgg_get_array_value('sections', $vars, array());
-$active_section = elgg_get_array_value('active_section', $vars, array_shift(array_keys($sections)));
-$upload_sections = elgg_get_array_value('upload_sections', $vars, array());
-$internal_name = elgg_get_array_value('internal_name', $vars);
-
-if (!$sections) {
- $content = elgg_echo('embed:no_sections');
-} else {
- $offset = max(0, get_input('offset', 0));
- $limit = get_input('limit', 10);
-
- $content = elgg_view_title(elgg_echo('embed:media'));
- //$content .= elgg_echo('embed:instructions');
-
- // prepare tabbed menu
- $tabs = array();
- foreach ($sections as $section_id => $section_info) {
- $tab = array(
- 'title' => $section_info['name'],
- 'url' => '#',
- 'url_class' => 'embed_section',
- // abusing the js attribute.
- 'url_js' => "id=\"$section_id\""
- );
-
- if ($section_id == $active_section) {
- $tab['selected'] = TRUE;
- }
- $tabs[] = $tab;
- }
-
- // make sure upload is always the last tab
- if ($upload_sections) {
- $tabs[] = array(
- 'title' => elgg_echo('embed:upload'),
- 'url' => '#',
- 'url_class' => 'embed_section',
- 'url_js' => 'id="upload"',
- 'selected' => ($active_section == 'upload')
- );
- }
-
- $tabs_html = elgg_view('navigation/tabs', array('tabs' => $tabs));
- $content .= $tabs_html;
-
- // build the items and layout.
- if ($active_section == 'upload' || array_key_exists($active_section, $sections)) {
- $section_info = $sections[$active_section];
- $layout = isset($section_info['layout']) ? $section_info['layout'] : 'list';
-
- $params = array(
- //'type' => $type,
- //'subtype' => $subtype,
- 'offset' => $offset,
- 'limit' => $limit,
- 'section' => $active_section,
- 'upload_sections' => $upload_sections
- );
-
- // allow full override for this section
- // check for standard hook
- if ($section_content = elgg_view("embed/$active_section/content", $params)) {
- // handles its own pagination
- $content .= $section_content;
- } elseif ($embed_info = trigger_plugin_hook('embed_get_items', $active_section, $params, array('items' => array(), 'count' => 0))) {
- // check if we have an override for this section type.
- $view = "embed/$active_section/item/$layout";
-
- if (!elgg_view_exists($view)) {
- $view = "embed/item/$layout";
- }
-
- if (!isset($embed_info['items']) || !is_array($embed_info['items']) || !count($embed_info['items'])) {
- $content .= elgg_echo('embed:no_section_content');
- } else {
- // pull out some common tests
- // embed requires ECML, but until we have plugin deps working
- // we need to explicitly check and use a fallback.
- if ($ecml_enabled = is_plugin_enabled('ecml')){
- $ecml_valid_keyword = ecml_is_valid_keyword($active_section);
- } else {
- $ecml_valid_keyword = FALSE;
- }
-
- $items_content = '';
- foreach ($embed_info['items'] as $item) {
- $item_params = array(
- 'section' => $active_section,
- 'item' => $item,
- 'ecml_enabled' => $ecml_enabled,
- 'ecml_keyword' => ($ecml_valid_keyword) ? $active_section : 'entity',
- 'icon_size' => elgg_get_array_value('icon_size', $section_info, 'tiny'),
- );
-
- $items_content .= elgg_view($view, $item_params);
- }
-
- $params['content'] = $items_content;
- $params['count'] = $embed_info['count'];
-
- $content .= elgg_view('navigation/pagination', $params);
- $content .= elgg_view("embed/layouts/$layout", $params);
- }
- } else {
- $content .= elgg_echo('embed:no_section_content');
- }
- } else {
- $content .= elgg_echo('embed:invalid_section');
- }
-}
-
-echo $content;
-?>
-
-<script type="text/javascript">
-$(document).ready(function() {
- var internal_name = '<?php echo addslashes($internal_name); ?>';
-
- // insert embed codes
- $('.embed_data').click(function() {
- var embed_code = $(this).data('embed_code')
- elggEmbedInsertContent(embed_code, internal_name);
- });
-
- // tabs
- $('.embed_section').click(function() {
- var section = $(this).attr('id');
- var url = '<?php echo $vars['url']; ?>pg/embed/embed?active_section=' + section + '&internal_name=' + internal_name;
- $('#facebox .body .content').load(url);
-
- return false;
- });
-
- // pagination
- function elggPaginationClick() {
- $('#facebox .body .content').load($(this).attr('href'));
- return false;
- }
-
- $('.pagination_number').click(elggPaginationClick);
- $('.pagination_next').click(elggPaginationClick);
- $('.pagination_previous').click(elggPaginationClick);
-});
-
-</script>
diff --git a/mod/embed/views/default/embed/item.php b/mod/embed/views/default/embed/item.php
new file mode 100644
index 000000000..3060de879
--- /dev/null
+++ b/mod/embed/views/default/embed/item.php
@@ -0,0 +1,39 @@
+<?php
+/**
+ * Embeddable content list item view
+ *
+ * @uses $vars['entity'] ElggEntity object
+ */
+
+$entity = $vars['entity'];
+
+$title = $entity->title;
+if (!$title) {
+ $title = $entity->name;
+}
+
+// different entity types have different title attribute names.
+$title = isset($entity->name) ? $entity->name : $entity->title;
+// don't let it be too long
+$title = elgg_get_excerpt($title);
+
+$owner = $entity->getOwnerEntity();
+if ($owner) {
+ $author_text = elgg_echo('byline', array($owner->name));
+ $date = elgg_view_friendly_time($entity->time_created);
+ $subtitle = "$author_text $date";
+} else {
+ $subtitle = '';
+}
+
+$params = array(
+ 'title' => $title,
+ 'entity' => $entity,
+ 'subtitle' => $subtitle,
+ 'tags' => FALSE,
+);
+$body = elgg_view('object/elements/summary', $params);
+
+$image = elgg_view_entity_icon($entity, 'small', array('link_class' => 'embed-insert'));
+
+echo elgg_view_image_block($image, $body);
diff --git a/mod/embed/views/default/embed/item/gallery.php b/mod/embed/views/default/embed/item/gallery.php
deleted file mode 100644
index 09cab3cef..000000000
--- a/mod/embed/views/default/embed/item/gallery.php
+++ /dev/null
@@ -1,54 +0,0 @@
-<?php
-/**
- * Default item view for embed items in gallery display.
- *
- * Why don't we recycle the view/type/subtype views?
- * Because we need to have special JavaScript that fires when you click on
- * the icon / title.
- *
- * @todo Yes this is copy and pasted. Pete needs to theme. I'll DRY it up later.
- *
- * @uses object $vars['item'] The item to display
- * @return string A formatted item
- */
-
-$item = $vars['item'];
-$section = $vars['section'];
-$target = $vars['target'];
-$ecml_keyword = (isset($vars['ecml_enabled']) && isset($vars['ecml_keyword'])) ? $vars['ecml_keyword'] : NULL;
-$icon_size = $vars['icon_size'];
-
-// @todo add entity checking.
-
-// different entity types have different title attribute names.
-$title = isset($item->name) ? $item->name : $item->title;
-// don't let it be too long
-$title = elgg_make_excerpt($title);
-
-// @todo you can disable plugins that are required by other plugins
-// (embed requires ecml) so fallback to a hard-coded check to see if ecml is enabled.
-// #grumble
-if ($ecml_keyword) {
- $embed_code = "[$ecml_keyword guid={$item->getGUID()}]";
-} else {
- // fallback to inserting a hard link to the object with its icon
- $icon = "<img src=\"{$item->getIcon($icon_size)}\" />" . htmlentities($title, ENT_QUOTES, 'UTF-8');
-
- $embed_code = elgg_view('output/url', array(
- 'href' => $item->getURL(),
- 'title' => $title,
- 'text' => $title,
- 'encode_text' => FALSE
- ));
-}
-
-$icon = "<img src=\"{$item->getIcon($icon_size)}\" />";
-$info = htmlentities($title, ENT_QUOTES, 'UTF-8');
-
-$listing = elgg_view('entities/gallery_listing', array('icon' => $icon, 'info' => $info));
-
-// @todo is this approach better than inline js?
-echo "<div class=\"embed_data\" id=\"embed_{$item->getGUID()}\">$listing</div>";
-echo "<script type=\"text/javascript\">
- $('#embed_{$item->getGUID()}').data('embed_code', " . json_encode($embed_code) . ");
-</script>"; \ No newline at end of file
diff --git a/mod/embed/views/default/embed/item/list.php b/mod/embed/views/default/embed/item/list.php
deleted file mode 100644
index 258e01aed..000000000
--- a/mod/embed/views/default/embed/item/list.php
+++ /dev/null
@@ -1,51 +0,0 @@
-<?php
-/**
- * Default item view for embed items in list display.
- *
- * Why don't we recycle the view/type/subtype views?
- * Because we need to have special JavaScript that fires when you click on
- * the icon / title.
- *
- * @uses object $vars['item'] The item to display
- * @return string A formatted item
- */
-
-$item = $vars['item'];
-$section = $vars['section'];
-$target = $vars['target'];
-$ecml_keyword = (isset($vars['ecml_enabled']) && isset($vars['ecml_keyword'])) ? $vars['ecml_keyword'] : NULL;
-$icon_size = $vars['icon_size'];
-
-// @todo add entity checking.
-
-// different entity types have different title attribute names.
-$title = isset($item->name) ? $item->name : $item->title;
-// don't let it be too long
-$title = elgg_make_excerpt($title);
-
-// @todo you can disable plugins that are required by other plugins
-// (embed requires ecml) so fallback to a hard-coded check to see if ecml is enabled.
-// #grumble
-if ($ecml_keyword) {
- $embed_code = "[$ecml_keyword guid={$item->getGUID()}]";
-} else {
- // fallback to inserting a hard link to the object with its icon
- $icon = "<img src=\"{$item->getIcon($icon_size)}\" />" . htmlentities($title, ENT_QUOTES, 'UTF-8');
-
- $embed_code = elgg_view('output/url', array(
- 'href' => $item->getURL(),
- 'title' => $title,
- 'text' => $title,
- 'encode_text' => FALSE
- ));
-}
-
-$icon = "<img src=\"{$item->getIcon($icon_size)}\" />";
-$info = "<p class='entity_title'>" . htmlentities($title, ENT_QUOTES, 'UTF-8') . "</p>";
-$info .= "<p class='entity_subtext'>" . friendly_time($vars['item']->time_created) . "</p>";
-
-// @todo is this approach better than inline js?
-echo "<div class=\"embed_data\" id=\"embed_{$item->getGUID()}\">" . elgg_view_listing($icon, $info) . '</div>';
-echo "<script type=\"text/javascript\">
- $('#embed_{$item->getGUID()}').data('embed_code', " . json_encode($embed_code) . ");
-</script>"; \ No newline at end of file
diff --git a/mod/embed/views/default/embed/js.php b/mod/embed/views/default/embed/js.php
deleted file mode 100644
index c8fe3bc53..000000000
--- a/mod/embed/views/default/embed/js.php
+++ /dev/null
@@ -1,402 +0,0 @@
-<?php
-/**
- * JS interface for inserting content into the active editor.
- */
-
-?>
-function elggEmbedInsertContent(content, textAreaName) {
- content = ' ' + content + ' ';
-
- // default input.
- // if this doesn't match anything it won't add anything.
- $('textarea[name=' + textAreaName + ']').val($('textarea[name=' + textAreaName + ']').val() + ' ' + content);
-
- <?php
- // This view includes the guts of the function to do the inserting.
- // Anything that overrides input/longtext with its own editor
- // needs to supply its own function here that inserts
- // content into textAreaName.
- // See TinyMCE as an example.
-
- // for compatibility
- // the old on that was overriden.
- echo elgg_view('embed/addcontentjs');
-
- // the one you should extend.
- echo elgg_view('embed/custom_insert_js');
- ?>
-
-
- $.facebox.close();
-}
-
-
-/*
- * Facebox (for jQuery)
- * version: 1.2 (05/05/2008)
- * @requires jQuery v1.2 or later
- *
- * Examples at http://famspam.com/facebox/
- *
- * Licensed under the MIT:
- * http://www.opensource.org/licenses/mit-license.php
- *
- * Copyright 2007, 2008 Chris Wanstrath [ chris@ozmm.org ]
- *
- * Usage:
- *
- * jQuery(document).ready(function() {
- * jQuery('a[rel*=facebox]').facebox()
- * })
- *
- * <a href="#terms" rel="facebox">Terms</a>
- * Loads the #terms div in the box
- *
- * <a href="terms.html" rel="facebox">Terms</a>
- * Loads the terms.html page in the box
- *
- * <a href="terms.png" rel="facebox">Terms</a>
- * Loads the terms.png image in the box
- *
- *
- * You can also use it programmatically:
- *
- * jQuery.facebox('some html')
- *
- * The above will open a facebox with "some html" as the content.
- *
- * jQuery.facebox(function($) {
- * $.get('blah.html', function(data) { $.facebox(data) })
- * })
- *
- * The above will show a loading screen before the passed function is called,
- * allowing for a better ajaxy experience.
- *
- * The facebox function can also display an ajax page or image:
- *
- * jQuery.facebox({ ajax: 'remote.html' })
- * jQuery.facebox({ image: 'dude.jpg' })
- *
- * Want to close the facebox? Trigger the 'close.facebox' document event:
- *
- * jQuery(document).trigger('close.facebox')
- *
- * Facebox also has a bunch of other hooks:
- *
- * loading.facebox
- * beforeReveal.facebox
- * reveal.facebox (aliased as 'afterReveal.facebox')
- * init.facebox
- *
- * Simply bind a function to any of these hooks:
- *
- * $(document).bind('reveal.facebox', function() { ...stuff to do after the facebox and contents are revealed... })
- *
- */
-(function($) {
-$.facebox = function(data, klass) {
- $.facebox.loading()
-
- if (data.ajax) fillFaceboxFromAjax(data.ajax)
- else if (data.image) fillFaceboxFromImage(data.image)
- else if (data.div) fillFaceboxFromHref(data.div)
- else if ($.isFunction(data)) data.call($)
- else $.facebox.reveal(data, klass)
-}
-
-/*
- * Public, $.facebox methods
- */
-
-$.extend($.facebox, {
- settings: {
- opacity : 0.7,
- overlay : true,
- loadingImage : '<?php echo $vars['url']; ?>_graphics/ajax_loader_bw.gif',
- closeImage : '<?php echo $vars['url']; ?>_graphics/spacer.gif',
- imageTypes : [ 'png', 'jpg', 'jpeg', 'gif' ],
- faceboxHtml : '\
- <div id="facebox" class="hidden"> \
- <div class="popup"> \
- <div class="body"> \
- <div class="footer"> \
- <a href="#" class="close"> \
- <img src="<?php echo $vars['url']; ?>_graphics/spacer.gif" title="close" class="close_image" width="22" height="22" border="0" /> \
- </a> \
- </div> \
- <div class="content"> \
- </div> \
- </div> \
- </div> \
- </div>'
- },
-
- loading: function() {
- init()
- if ($('#facebox .loading').length == 1) return true
- showOverlay()
-
- $('#facebox .content').empty()
- $('#facebox .body').children().hide().end().
- append('<div class="loading"><br /><br /><img src="'+$.facebox.settings.loadingImage+'"/><br /><br /></div>')
-
- $('#facebox').css({
- top: getPageScroll()[1] + (getPageHeight() / 10),
- // Curverider addition (pagewidth/2 - modalwidth/2)
- left: ((getPageWidth() / 2) - ($('#facebox').width() / 2))
- }).show()
-
- $(document).bind('keydown.facebox', function(e) {
- if (e.keyCode == 27) $.facebox.close()
- return true
- })
- $(document).trigger('loading.facebox')
- },
-
- reveal: function(data, klass) {
- $(document).trigger('beforeReveal.facebox')
- if (klass) $('#facebox .content').addClass(klass)
- $('#facebox .content').append(data)
-
- setTimeout(function() {
- $('#facebox .loading').remove();
- $('#facebox .body').children().fadeIn('slow');
- $('#facebox').css('left', $(window).width() / 2 - ($('#facebox').width() / 2));
- $(document).trigger('reveal.facebox').trigger('afterReveal.facebox');
- }, 100);
-
- //$('#facebox .loading').remove()
- //$('#facebox .body').children().fadeIn('slow')
- //$('#facebox').css('left', $(window).width() / 2 - ($('#facebox').width() / 2))
- //$(document).trigger('reveal.facebox').trigger('afterReveal.facebox')
-
- },
-
- close: function() {
- $(document).trigger('close.facebox')
- return false
- }
-})
-
-/*
- * Public, $.fn methods
- */
-
-// Curverider addition
-/*
- $.fn.wait = function(time, type) {
- time = time || 3000;
- type = type || "fx";
- return this.queue(type, function() {
- var self = this;
- setTimeout(function() {
- //$(self).queue();
- $('#facebox .loading').remove();
- }, time);
- });
- };
-*/
-
-$.fn.facebox = function(settings) {
- init(settings)
-
- function clickHandler() {
- $.facebox.loading(true)
-
- // support for rel="facebox.inline_popup" syntax, to add a class
- // also supports deprecated "facebox[.inline_popup]" syntax
- var klass = this.rel.match(/facebox\[?\.(\w+)\]?/)
- if (klass) klass = klass[1]
-
- fillFaceboxFromHref(this.href, klass)
- return false
- }
-
- return this.click(clickHandler)
-}
-
-/*
- * Private methods
- */
-
-// called one time to setup facebox on this page
-function init(settings) {
- if ($.facebox.settings.inited) return true
- else $.facebox.settings.inited = true
-
- $(document).trigger('init.facebox')
- /* makeCompatible() */
-
- var imageTypes = $.facebox.settings.imageTypes.join('|')
- $.facebox.settings.imageTypesRegexp = new RegExp('\.' + imageTypes + '$', 'i')
-
- if (settings) $.extend($.facebox.settings, settings)
- $('body').append($.facebox.settings.faceboxHtml)
-
- var preload = [ new Image(), new Image() ]
- preload[0].src = $.facebox.settings.closeImage
- preload[1].src = $.facebox.settings.loadingImage
- preload.push(new Image())
-
-/*
- $('#facebox').find('.b:first, .bl, .br, .tl, .tr').each(function() {
- preload.push(new Image())
- preload.slice(-1).src = $(this).css('background-image').replace(/url\((.+)\)/, '$1')
- })
-*/
-
- $('#facebox .close').click($.facebox.close)
- $('#facebox .close_image').attr('src', $.facebox.settings.closeImage)
-}
-
-// getPageScroll() by quirksmode.com
-function getPageScroll() {
- var xScroll, yScroll;
- if (self.pageYOffset) {
- yScroll = self.pageYOffset;
- xScroll = self.pageXOffset;
- } else if (document.documentElement && document.documentElement.scrollTop) { // Explorer 6 Strict
- yScroll = document.documentElement.scrollTop;
- xScroll = document.documentElement.scrollLeft;
- } else if (document.body) {// all other Explorers
- yScroll = document.body.scrollTop;
- xScroll = document.body.scrollLeft;
- }
- return new Array(xScroll,yScroll)
-}
-
- // Adapted from getPageSize() by quirksmode.com
- function getPageHeight() {
- var windowHeight
- if (self.innerHeight) { // all except Explorer
- windowHeight = self.innerHeight;
- } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
- windowHeight = document.documentElement.clientHeight;
- } else if (document.body) { // other Explorers
- windowHeight = document.body.clientHeight;
- }
- return windowHeight
- }
-
- // Curverider addition
- function getPageWidth() {
- var windowWidth;
- if( typeof( window.innerWidth ) == 'number' ) {
- windowWidth = window.innerWidth; //Non-IE
- } else if( document.documentElement && ( document.documentElement.clientWidth ) ) {
- windowWidth = document.documentElement.clientWidth; //IE 6+ in 'standards compliant mode'
- } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
- windowWidth = document.body.clientWidth; //IE 4 compatible
- }
- return windowWidth
- }
-
-
-
-// Backwards compatibility
-/*
-function makeCompatible() {
- var $s = $.facebox.settings
-
- $s.loadingImage = $s.loading_image || $s.loadingImage
- $s.closeImage = $s.close_image || $s.closeImage
- $s.imageTypes = $s.image_types || $s.imageTypes
- $s.faceboxHtml = $s.facebox_html || $s.faceboxHtml
-}
-*/
-
-// Figures out what you want to display and displays it
-// formats are:
-// div: #id
-// image: blah.extension
-// ajax: anything else
-function fillFaceboxFromHref(href, klass) {
- // div
- if (href.match(/#/)) {
- var url = window.location.href.split('#')[0]
- var target = href.replace(url,'')
- $.facebox.reveal($(target).clone().show(), klass)
-
- // image
- } else if (href.match($.facebox.settings.imageTypesRegexp)) {
- fillFaceboxFromImage(href, klass)
- // ajax
- } else {
- fillFaceboxFromAjax(href, klass)
- }
-}
-
-function fillFaceboxFromImage(href, klass) {
- var image = new Image()
- image.onload = function() {
- $.facebox.reveal('<div class="image"><img src="' + image.src + '" /></div>', klass)
- }
- image.src = href
-}
-
-function fillFaceboxFromAjax(href, klass) {
- $.get(href, function(data) { $.facebox.reveal(data, klass) })
-}
-
-function skipOverlay() {
- return $.facebox.settings.overlay == false || $.facebox.settings.opacity === null
-}
-
-function showOverlay() {
- if (skipOverlay()) return
-
- if ($('facebox_overlay').length == 0)
- $("body").append('<div id="facebox_overlay" class="facebox_hide"></div>')
-
- $('#facebox_overlay').hide().addClass("facebox_overlayBG")
- .css('opacity', $.facebox.settings.opacity)
- /* .click(function() { $(document).trigger('close.facebox') }) */
- .fadeIn(400)
- return false
-}
-
-function hideOverlay() {
- if (skipOverlay()) return
-
- $('#facebox_overlay').fadeOut(400, function(){
- $("#facebox_overlay").removeClass("facebox_overlayBG")
- $("#facebox_overlay").addClass("facebox_hide")
- $("#facebox_overlay").remove()
- })
-
- return false
-}
-
-/*
- * Bindings
- */
-
-$(document).bind('close.facebox', function() {
- $(document).unbind('keydown.facebox')
- $('#facebox').fadeOut(function() {
- $('#facebox .content').removeClass().addClass('content')
- hideOverlay()
- $('#facebox .loading').remove()
- })
-})
-
-
-
-
- // Curverider addition
- $(window).resize(function(){
- //alert("resized");
-
- $('#facebox').css({
- top: getPageScroll()[1] + (getPageHeight() / 10),
- left: ((getPageWidth() / 2) - 365)
- })
-
-
- });
-
-
-
-
-
-})(jQuery);
diff --git a/mod/embed/views/default/embed/layout.php b/mod/embed/views/default/embed/layout.php
new file mode 100644
index 000000000..1ca263037
--- /dev/null
+++ b/mod/embed/views/default/embed/layout.php
@@ -0,0 +1,40 @@
+<?php
+/**
+ * Layout of embed panel loaded in lightbox
+ */
+
+$title = elgg_view_title(elgg_echo('embed:media'));
+
+$menu = elgg_view_menu('embed');
+
+$selected = elgg_get_config('embed_tab');
+if ($selected->getData('view')) {
+ $tab = elgg_view($selected->getData('view'), $vars);
+} else {
+ $tab = elgg_list_entities(
+ embed_get_list_options($selected->getData('options')),
+ 'elgg_get_entities',
+ 'embed_list_items'
+ );
+ if (!$tab) {
+ $tab = elgg_echo('embed:no_section_content');
+ }
+}
+
+$tab .= elgg_view('graphics/ajax_loader', array(
+ 'class' => 'embed-throbber mtl',
+));
+
+$container_info = elgg_view('input/hidden', array(
+ 'name' => 'embed_container_guid',
+ 'value' => elgg_get_page_owner_guid(),
+));
+
+echo <<<HTML
+<div class="embed-wrapper">
+ $title
+ $menu
+ $tab
+ $container_info
+</div>
+HTML;
diff --git a/mod/embed/views/default/embed/layouts/gallery.php b/mod/embed/views/default/embed/layouts/gallery.php
deleted file mode 100644
index b24fcec24..000000000
--- a/mod/embed/views/default/embed/layouts/gallery.php
+++ /dev/null
@@ -1,12 +0,0 @@
-<?php
-/**
- * Embed - Gallery items
- *
- * @uses string $vars['content'] Pre-formatted content.
- *
- */
-$active_section = elgg_get_array_value('section', $vars, array());
-
-$content = "<div class='embed_modal_".$active_section."'>" . elgg_get_array_value('content', $vars, '') . "</div>";
-
-echo $content; \ No newline at end of file
diff --git a/mod/embed/views/default/embed/layouts/list.php b/mod/embed/views/default/embed/layouts/list.php
deleted file mode 100644
index 76e7e88ea..000000000
--- a/mod/embed/views/default/embed/layouts/list.php
+++ /dev/null
@@ -1,12 +0,0 @@
-<?php
-/**
- * Embed - List items
- *
- * @uses string $vars['content'] Pre-formatted content.
- *
- */
-$active_section = elgg_get_array_value('section', $vars, array());
-
-$content = "<div class='embed_modal_" . $active_section . "'>" . elgg_get_array_value('content', $vars, '') . "</div>";
-
-echo $content; \ No newline at end of file
diff --git a/mod/embed/views/default/embed/link.php b/mod/embed/views/default/embed/link.php
deleted file mode 100644
index 6740b8e1a..000000000
--- a/mod/embed/views/default/embed/link.php
+++ /dev/null
@@ -1,6 +0,0 @@
-<?php
-/**
- * Displays an "Embed media" link in longtext inputs.
- */
-?>
-<a class="longtext_control small link" href="<?php echo $vars['url'] . 'pg/embed'; ?>?internal_name=<?php echo $vars['internalname']; ?>" rel="facebox"><?php echo elgg_echo('media:insert'); ?></a>
diff --git a/mod/embed/views/default/embed/list.php b/mod/embed/views/default/embed/list.php
new file mode 100644
index 000000000..c13639cff
--- /dev/null
+++ b/mod/embed/views/default/embed/list.php
@@ -0,0 +1,58 @@
+<?php
+/**
+ * View a list of embeddable items
+ *
+ * @package Elgg
+ *
+ * @uses $vars['items'] Array of ElggEntity objects
+ * @uses $vars['offset'] Index of the first list item in complete list
+ * @uses $vars['limit'] Number of items per page
+ * @uses $vars['count'] Number of items in the complete list
+ *
+ * @uses $vars['list_class'] Additional CSS class for the <ul> element
+ * @uses $vars['item_class'] Additional CSS class for the <li> elements
+ */
+
+$items = $vars['items'];
+$offset = $vars['offset'];
+$limit = $vars['limit'];
+$count = $vars['count'];
+
+$offset_key = elgg_extract('offset_key', $vars, 'offset');
+
+$list_class = 'elgg-list';
+if (isset($vars['list_class'])) {
+ $list_class = "$list_class {$vars['list_class']}";
+}
+
+$item_class = 'elgg-item';
+if (isset($vars['item_class'])) {
+ $item_class = "$item_class {$vars['item_class']}";
+}
+
+$html = "";
+$nav = "";
+
+if ($count) {
+ $nav .= elgg_view('navigation/pagination', array(
+ 'offset' => $offset,
+ 'count' => $count,
+ 'limit' => $limit,
+ 'offset_key' => $offset_key,
+ ));
+}
+
+if (is_array($items) && count($items) > 0) {
+ $html .= "<ul class=\"$list_class\">";
+ foreach ($items as $item) {
+ $id = "elgg-{$item->getType()}-{$item->getGUID()}";
+ $html .= "<li id=\"$id\" class=\"$item_class\">";
+ $html .= elgg_view('embed/item', array('entity' => $item));
+ $html .= '</li>';
+ }
+ $html .= '</ul>';
+}
+
+$html .= $nav;
+
+echo $html;
diff --git a/mod/embed/views/default/embed/metatags.php b/mod/embed/views/default/embed/metatags.php
deleted file mode 100644
index 3c7ab87a9..000000000
--- a/mod/embed/views/default/embed/metatags.php
+++ /dev/null
@@ -1,5 +0,0 @@
- <script type="text/javascript">
- jQuery(document).ready(function($) {
- $('a[rel*=facebox]').facebox()
- });
- </script>
diff --git a/mod/embed/views/default/embed/upload/content.php b/mod/embed/views/default/embed/upload/content.php
deleted file mode 100644
index 199eb7ede..000000000
--- a/mod/embed/views/default/embed/upload/content.php
+++ /dev/null
@@ -1,48 +0,0 @@
-<?php
-/**
- * Special upload form
- */
-$upload_sections = elgg_get_array_value('upload_sections', $vars, array());
-$active_section = get_input('active_upload_section', array_shift(array_keys($upload_sections)));
-
-$options = array();
-
-if ($upload_sections) {
- foreach ($upload_sections as $id => $info) {
- $options[$id] = $info['name'];
- }
-
- $input = elgg_view('input/pulldown', array(
- 'name' => 'download_section',
- 'options_values' => $options,
- 'internalid' => 'embed_upload',
- 'value' => $active_section
- ));
-
- echo "<div class='embed_modal_upload'>";
- echo "<p>" . elgg_echo('embed:upload_type') . "$input</p>";
-
- if (!$upload_content = elgg_view($upload_sections[$active_section]['view'])) {
- $upload_content = elgg_echo('embed:no_upload_content');
- }
-
- echo $upload_content . "</div>";
-
-?>
- <script type="text/javascript">
- $(document).ready(function() {
-
- // change for pulldown
- $('#embed_upload').change(function() {
- var upload_section = $(this).val();
- var url = '<?php echo $vars['url']; ?>pg/embed/embed?active_section=upload&active_upload_section=' + upload_section;
- $('#facebox .body .content').load(url);
- });
-
- });
- </script>
-<?php
-
-} else {
- echo elgg_echo('embed:no_upload_sections');
-}
diff --git a/mod/embed/views/default/group/default/embed.php b/mod/embed/views/default/group/default/embed.php
deleted file mode 100644
index 34a0d0c61..000000000
--- a/mod/embed/views/default/group/default/embed.php
+++ /dev/null
@@ -1,5 +0,0 @@
-<?php
- if ($vars['entity'] instanceof ElggGroup) {
- echo '<a href="'. $vars['entity']->getURL() .'">' . $vars['entity']->title . '</a>';
- }
-?> \ No newline at end of file
diff --git a/mod/embed/views/default/js/embed/embed.php b/mod/embed/views/default/js/embed/embed.php
new file mode 100644
index 000000000..e84427f24
--- /dev/null
+++ b/mod/embed/views/default/js/embed/embed.php
@@ -0,0 +1,147 @@
+//<script>
+elgg.provide('elgg.embed');
+
+elgg.embed.init = function() {
+
+ // inserts the embed content into the textarea
+ $(".embed-item").live('click', elgg.embed.insert);
+
+ // caches the current textarea id
+ $(".embed-control").live('click', function() {
+ var classes = $(this).attr('class');
+ var embedClass = classes.split(/[, ]+/).pop();
+ var textAreaId = embedClass.substr(embedClass.indexOf('embed-control-') + "embed-control-".length);
+ elgg.embed.textAreaId = textAreaId;
+ });
+
+ // special pagination helper for lightbox
+ $('.embed-wrapper .elgg-pagination a').live('click', elgg.embed.forward);
+
+ $('.embed-section').live('click', elgg.embed.forward);
+
+ $('.elgg-form-embed').live('submit', elgg.embed.submit);
+};
+
+/**
+ * Inserts data attached to an embed list item in textarea
+ *
+ * @todo generalize lightbox closing
+ *
+ * @param {Object} event
+ * @return void
+ */
+elgg.embed.insert = function(event) {
+ var textAreaId = elgg.embed.textAreaId;
+ var textArea = $('#' + textAreaId);
+
+ // generalize this based on a css class attached to what should be inserted
+ var content = ' ' + $(this).find(".embed-insert").parent().html() + ' ';
+
+ // this is a temporary work-around for #3971
+ if (content.indexOf('thumbnail.php') != -1) {
+ content = content.replace('size=small', 'size=medium');
+ }
+
+ textArea.val(textArea.val() + content);
+ textArea.focus();
+
+<?php
+// See the TinyMCE plugin for an example of this view
+echo elgg_view('embed/custom_insert_js');
+?>
+
+ $.fancybox.close();
+
+ event.preventDefault();
+};
+
+/**
+ * Submit an upload form through Ajax
+ *
+ * Requires the jQuery Form Plugin. Because files cannot be uploaded with
+ * XMLHttpRequest, the plugin uses an invisible iframe. This results in the
+ * the X-Requested-With header not being set. To work around this, we are
+ * sending the header as a POST variable and Elgg's code checks for it in
+ * elgg_is_xhr().
+ *
+ * @param {Object} event
+ * @return bool
+ */
+elgg.embed.submit = function(event) {
+ $('.embed-wrapper .elgg-form-file-upload').hide();
+ $('.embed-throbber').show();
+
+ $(this).ajaxSubmit({
+ dataType : 'json',
+ data : { 'X-Requested-With' : 'XMLHttpRequest'},
+ success : function(response) {
+ if (response) {
+ if (response.system_messages) {
+ elgg.register_error(response.system_messages.error);
+ elgg.system_message(response.system_messages.success);
+ }
+ if (response.status >= 0) {
+ var forward = $('input[name=embed_forward]').val();
+ var url = elgg.normalize_url('embed/tab/' + forward);
+ url = elgg.embed.addContainerGUID(url);
+ $('.embed-wrapper').parent().load(url);
+ } else {
+ // incorrect response, presumably an error has been displayed
+ $('.embed-throbber').hide();
+ $('.embed-wrapper .elgg-form-file-upload').show();
+ }
+ }
+
+ // ie 7 and 8 have a null response because of the use of an iFrame
+ // so just show the list after upload.
+ // http://jquery.malsup.com/form/#file-upload claims you can wrap JSON
+ // in a textarea, but a quick test didn't work, and that is fairly
+ // intrusive to the rest of the ajax system.
+ else if (response === undefined && $.browser.msie) {
+ var forward = $('input[name=embed_forward]').val();
+ var url = elgg.normalize_url('embed/tab/' + forward);
+ url = elgg.embed.addContainerGUID(url);
+ $('.embed-wrapper').parent().load(url);
+ }
+ },
+ error : function(xhr, status) {
+ // @todo nothing for now
+ }
+ });
+
+ // this was bubbling up the DOM causing a submission
+ event.preventDefault();
+ event.stopPropagation();
+};
+
+/**
+ * Loads content within the lightbox
+ *
+ * @param {Object} event
+ * @return void
+ */
+elgg.embed.forward = function(event) {
+ // make sure container guid is passed
+ var url = $(this).attr('href');
+ url = elgg.embed.addContainerGUID(url);
+
+ $('.embed-wrapper').parent().load(url);
+ event.preventDefault();
+};
+
+/**
+ * Adds the container guid to a URL
+ *
+ * @param {string} url
+ * @return string
+ */
+elgg.embed.addContainerGUID = function(url) {
+ if (url.indexOf('container_guid=') == -1) {
+ var guid = $('input[name=embed_container_guid]').val();
+ return url + '?container_guid=' + guid;
+ } else {
+ return url;
+ }
+};
+
+elgg.register_hook_handler('init', 'system', elgg.embed.init);
diff --git a/mod/embed/views/default/navigation/menu/embed.php b/mod/embed/views/default/navigation/menu/embed.php
new file mode 100644
index 000000000..bca673f59
--- /dev/null
+++ b/mod/embed/views/default/navigation/menu/embed.php
@@ -0,0 +1,18 @@
+<?php
+/**
+ * Embed tabs
+ *
+ * @uses $vars['menu']['default']
+ */
+
+$tabs = array();
+foreach ($vars['menu']['default'] as $menu_item) {
+ $tabs[] = array(
+ 'title' => $menu_item->getText(),
+ 'url' => 'embed/tab/' . $menu_item->getName(),
+ 'link_class' => 'embed-section',
+ 'selected' => $menu_item->getSelected(),
+ );
+}
+
+echo elgg_view('navigation/tabs', array('tabs' => $tabs));
diff --git a/mod/embed/views/default/object/default/embed.php b/mod/embed/views/default/object/default/embed.php
deleted file mode 100644
index 6f698a157..000000000
--- a/mod/embed/views/default/object/default/embed.php
+++ /dev/null
@@ -1,5 +0,0 @@
-<?php
- if ($vars['entity'] instanceof ElggObject) {
- echo '<a href="'. $vars['entity']->getURL() .'">' . $vars['entity']->title . '</a>';
- }
-?> \ No newline at end of file
diff --git a/mod/embed/views/default/object/file/embed.php b/mod/embed/views/default/object/file/embed.php
deleted file mode 100644
index b93c46e5e..000000000
--- a/mod/embed/views/default/object/file/embed.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
- $mime = $vars['entity']->mimetype;
-
- if (elgg_view_exists('file/specialcontent/' . $mime)) {
- $content = elgg_view('file/specialcontent/' . $mime, $vars);
- } else if (elgg_view_exists("file/specialcontent/" . substr($mime,0,strpos($mime,'/')) . "/default")) {
- $content = elgg_view("file/specialcontent/" . substr($mime,0,strpos($mime,'/')) . "/default", $vars);
- }
-
- if (empty($content) || substr_count(strtolower($content),'<embed') || substr_count(strtolower($content),'<object') || substr_count(strtolower($content),'<script')) {
- echo elgg_view('object/default/embed',$vars);
- } else {
- echo $content;
- }
-
-?> \ No newline at end of file
diff --git a/mod/embed/views/default/object/file/embedlist.php b/mod/embed/views/default/object/file/embedlist.php
deleted file mode 100644
index 345e69b4b..000000000
--- a/mod/embed/views/default/object/file/embedlist.php
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
- $file = $vars['entity'];
- $friendlytime = friendly_time($vars['entity']->time_created);
-
- $info = "<p class='entity_title'> <a href=\"{$file->getURL()}\">{$file->title}</a></p>";
- $info .= "<p class='entity_subtext'>{$friendlytime}";
- $icon = "<a href=\"{$file->getURL()}\">" . elgg_view("file/icon", array("mimetype" => $file->mimetype, 'thumbnail' => $file->thumbnail, 'file_guid' => $file->guid, 'size' => 'small')) . "</a>";
-?>
-<div id="embed_entity_<?php echo $file->guid; ?>">
- <div class="entity_listing clearfloat">
- <div class="entity_listing_icon">
- <?php echo $icon; ?>
- </div>
- <div class="entity_listing_info">
- <?php echo $info; ?>
- </div>
- </div>
-</div>
diff --git a/mod/embed/views/default/site/default/embed.php b/mod/embed/views/default/site/default/embed.php
deleted file mode 100644
index 2e8920a9a..000000000
--- a/mod/embed/views/default/site/default/embed.php
+++ /dev/null
@@ -1,5 +0,0 @@
-<?php
- if ($vars['entity'] instanceof ElggSite) {
- echo '<a href="'. $vars['entity']->getURL() .'">' . $vars['entity']->name . '</a>';
- }
-?> \ No newline at end of file
diff --git a/mod/embed/views/default/user/default/embed.php b/mod/embed/views/default/user/default/embed.php
deleted file mode 100644
index df538c94c..000000000
--- a/mod/embed/views/default/user/default/embed.php
+++ /dev/null
@@ -1,5 +0,0 @@
-<?php
- if ($vars['entity'] instanceof ElggUser) {
- echo '<a href="'. $vars['entity']->getURL() .'">' . $vars['entity']->name . '</a>';
- }
-?> \ No newline at end of file