aboutsummaryrefslogtreecommitdiff
path: root/mod/embed/views/default
diff options
context:
space:
mode:
Diffstat (limited to 'mod/embed/views/default')
-rw-r--r--mod/embed/views/default/embed/addcontentjs.php4
-rw-r--r--mod/embed/views/default/embed/embed.php104
-rw-r--r--mod/embed/views/default/embed/item/list.php49
-rw-r--r--mod/embed/views/default/embed/js.php528
-rw-r--r--mod/embed/views/default/embed/layouts/gallery.php1
-rw-r--r--mod/embed/views/default/embed/layouts/list.php60
-rw-r--r--mod/embed/views/default/embed/link.php5
-rw-r--r--mod/embed/views/default/embed/media.php28
-rw-r--r--mod/embed/views/default/embed/upload.php37
9 files changed, 522 insertions, 294 deletions
diff --git a/mod/embed/views/default/embed/addcontentjs.php b/mod/embed/views/default/embed/addcontentjs.php
index ee3678b89..f5533c22e 100644
--- a/mod/embed/views/default/embed/addcontentjs.php
+++ b/mod/embed/views/default/embed/addcontentjs.php
@@ -1,4 +1,2 @@
-
var entity;
- $('textarea[name='+entityname+']').val($('textarea[name='+entityname+']').val() + ' ' + content);
-
+ $('textarea[name=' + textAreaName + ']').val($('textarea[name=' + textAreaName + ']').val() + ' ' + content); \ No newline at end of file
diff --git a/mod/embed/views/default/embed/embed.php b/mod/embed/views/default/embed/embed.php
new file mode 100644
index 000000000..7815c1222
--- /dev/null
+++ b/mod/embed/views/default/embed/embed.php
@@ -0,0 +1,104 @@
+<?php
+/**
+ * Embed landing page
+ *
+ * @uses string $vars['sections'] Array of section_id => Section Display Name
+ * @uses string $vars['active_section'] Currently selected section_id
+ */
+
+$sections = (isset($vars['sections'])) ? $vars['sections'] : array();
+$active_section = (isset($vars['active_section'])) ? $vars['active_section'] : array_shift(array_keys($sections));
+
+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:embed'));
+
+ // 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;
+ }
+
+ $tabs_html = elgg_view('navigation/tabs', array('tabs' => $tabs));
+ $content .= $tabs_html;
+
+ $pagination_vars = array(
+
+ );
+
+ $content .= elgg_view('navigation/pagination', $pagination_vars);
+
+ if (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
+ );
+
+ // 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))) {
+ $params['items'] = $embed_info['items'];
+ $params['count'] = $embed_info['count'];
+ // pagination here.
+ $content .= elgg_view('navigation/pagination', $params);
+ $content .= elgg_view("embed/layouts/{$section_info['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() {
+
+ // insert embed codes
+ $('.embed_section').click(function() {
+ var section = $(this).attr('id');
+ var url = '<?php echo $vars['url']; ?>pg/embed/embed?active_section=' + section;
+ $('#facebox .body .content').load(url);
+
+ return false;
+ });
+
+ // handle 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/list.php b/mod/embed/views/default/embed/item/list.php
new file mode 100644
index 000000000..259419df4
--- /dev/null
+++ b/mod/embed/views/default/embed/item/list.php
@@ -0,0 +1,49 @@
+<?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;
+
+// @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()}\" />" . 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('tiny')}\" />";
+$info = htmlentities($title, ENT_QUOTES, 'UTF-8');
+
+// @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
index 71120e68f..c98fe63da 100644
--- a/mod/embed/views/default/embed/js.php
+++ b/mod/embed/views/default/embed/js.php
@@ -1,11 +1,21 @@
+<?php
+/**
+ * JS interface for inserting content into the active editor.
+ */
- function elggUpdateContent(content, entityname) {
- content = ' ' + content + ' ';
- <?php
- echo elgg_view('embed/addcontentjs');
- ?>
- $.facebox.close();
- }
+?>
+function elggEmbedInsertContent(content, textAreaName) {
+ content = ' ' + 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.
+ echo elgg_view('embed/addcontentjs');
+ ?>
+ $.facebox.close();
+}
/*
@@ -21,9 +31,9 @@
* Copyright 2007, 2008 Chris Wanstrath [ chris@ozmm.org ]
*
* Usage:
- *
+ *
* jQuery(document).ready(function() {
- * jQuery('a[rel*=facebox]').facebox()
+ * jQuery('a[rel*=facebox]').facebox()
* })
*
* <a href="#terms" rel="facebox">Terms</a>
@@ -37,12 +47,12 @@
*
*
* 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($) {
+ *
+ * jQuery.facebox(function($) {
* $.get('blah.html', function(data) { $.facebox(data) })
* })
*
@@ -50,7 +60,7 @@
* 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' })
*
@@ -71,305 +81,305 @@
*
*/
(function($) {
- $.facebox = function(data, klass) {
- $.facebox.loading()
+$.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)
- }
+ 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)
-
+$.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
- }
- })
-
- /*
+ $('#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
+
+// 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);
- });
+ 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)
+$.fn.facebox = function(settings) {
+ init(settings)
- function clickHandler() {
- $.facebox.loading(true)
+ 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]
+ // 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
- }
+ fillFaceboxFromHref(this.href, klass)
+ return false
+ }
- return this.click(clickHandler)
- }
+ 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
+// 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() */
+ $(document).trigger('init.facebox')
+ /* makeCompatible() */
- var imageTypes = $.facebox.settings.imageTypes.join('|')
- $.facebox.settings.imageTypesRegexp = new RegExp('\.' + imageTypes + '$', 'i')
+ var imageTypes = $.facebox.settings.imageTypes.join('|')
+ $.facebox.settings.imageTypesRegexp = new RegExp('\.' + imageTypes + '$', 'i')
- if (settings) $.extend($.facebox.settings, settings)
- $('body').append($.facebox.settings.faceboxHtml)
+ 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
+ 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').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)
- }
+ $('#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;
+ windowHeight = self.innerHeight;
} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
- windowHeight = document.documentElement.clientHeight;
+ windowHeight = document.documentElement.clientHeight;
} else if (document.body) { // other Explorers
- windowHeight = document.body.clientHeight;
- }
+ 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
- }
+ 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
+// 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
- }
+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
- }
-
- /*
+// 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()
- })
- })
-
-
-
-
+$(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)
- })
-
-
+ //alert("resized");
+
+ $('#facebox').css({
+ top: getPageScroll()[1] + (getPageHeight() / 10),
+ left: ((getPageWidth() / 2) - 365)
+ })
+
+
});
diff --git a/mod/embed/views/default/embed/layouts/gallery.php b/mod/embed/views/default/embed/layouts/gallery.php
new file mode 100644
index 000000000..b3d9bbc7f
--- /dev/null
+++ b/mod/embed/views/default/embed/layouts/gallery.php
@@ -0,0 +1 @@
+<?php
diff --git a/mod/embed/views/default/embed/layouts/list.php b/mod/embed/views/default/embed/layouts/list.php
new file mode 100644
index 000000000..d62d35417
--- /dev/null
+++ b/mod/embed/views/default/embed/layouts/list.php
@@ -0,0 +1,60 @@
+<?php
+/**
+ * Embed - List items
+ *
+ * @todo Yes this is a lot of logic for a view. The Javascript is faily complicated
+ * and pulling entity views out was making it worse.
+ * Once plugin deps are working, we'll remove the logic for that.
+ *
+ * @uses array $vars['items'] Array of ElggEntities
+ * @uses string $vars['section'] The section_id.
+ *
+ */
+
+$items = isset($vars['items']) ? $vars['items'] : array();
+$section = $vars['section'];
+
+// 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($section);
+} else {
+ $ecml_valid_keyword = FALSE;
+}
+
+// check if we have an override for this section type.
+$view = "embed/$section/item/list";
+if (!elgg_view_exists($view)) {
+ $view = "embed/item/list";
+}
+
+$content = '';
+foreach ($items as $item) {
+ // sanity checking
+ if (!elgg_instanceof($item)) {
+ continue;
+ }
+
+ $params = array(
+ 'section' => $section,
+ 'item' => $item,
+ 'ecml_enabled' => $ecml_enabled,
+ 'ecml_keyword' => ($ecml_valid_keyword) ? $section : 'entity'
+ );
+
+ $content .= elgg_view($view, $params);
+}
+
+echo $content;
+
+?>
+
+<script type="text/javascript">
+$(document).ready(function() {
+ $('.embed_data').click(function() {
+ var embed_code = $(this).data('embed_code');
+ elggEmbedInsertContent(embed_code);
+ });
+});
+</script> \ No newline at end of file
diff --git a/mod/embed/views/default/embed/link.php b/mod/embed/views/default/embed/link.php
index 14b33d4c2..bd500dfaf 100644
--- a/mod/embed/views/default/embed/link.php
+++ b/mod/embed/views/default/embed/link.php
@@ -1 +1,6 @@
+<?php
+/**
+ * Displays an "Embed media" link in longtext inputs.
+ */
+?>
<a class="longtext_control small link" href="<?php echo $vars['url'] . 'pg/embed/media'; ?>?internalname=<?php echo $vars['internalname']; ?>" rel="facebox"><?php echo elgg_echo('media:insert'); ?></a> \ No newline at end of file
diff --git a/mod/embed/views/default/embed/media.php b/mod/embed/views/default/embed/media.php
index ff0505466..381774618 100644
--- a/mod/embed/views/default/embed/media.php
+++ b/mod/embed/views/default/embed/media.php
@@ -11,43 +11,43 @@
'limit' => $vars['limit'],
'count' => $vars['count']
));
-
+
echo elgg_view('embed/simpletype',array(
'internalname' => $vars['internalname'],
'simpletypes' => $vars['simpletypes'],
'simpletype' => $vars['simpletype'],
));
-
+
$context = get_context();
$entities = $vars['entities'];
if (is_array($entities) && !empty($entities)) {
-
+
echo "<p class='embed_instructions'>" . elgg_echo('embed:instructions') . "</p>";
-
+
foreach($entities as $entity) {
if ($entity instanceof ElggEntity) {
- $mime = $entity->mimetype;
-
+ $mime = $entity->mimetype;
+
$enttype = $entity->getType();
$entsubtype = $entity->getSubtype();
-
+
if (elgg_view_exists($enttype . '/' . $entsubtype . '/embed')) {
$content = elgg_view($enttype . '/' . $entsubtype . '/embed', array('entity' => $entity, 'full' => true));
} else {
$content = elgg_view($enttype . '/default/embed', array('entity' => $entity, 'full' => true));
}
-
+
$content = str_replace("\n","", $content);
$content = str_replace("\r","", $content);
//$content = htmlentities($content,null,'utf-8');
$content = htmlentities($content, ENT_COMPAT, "UTF-8");
-
+
$link = "javascript:elggUpdateContent('{$content}','{$vars['internalname']}');";
if ($entity instanceof ElggObject) { $title = $entity->title; $mime = $entity->mimetype; } else { $title = $entity->name; $mime = ''; }
-
+
set_context('search');
-
+
if (elgg_view_exists("{$enttype}/{$entsubtype}/embedlist")) {
$entview = elgg_view("{$enttype}/{$entsubtype}/embedlist",array('entity' => $entity));
} else {
@@ -55,9 +55,9 @@
}
$entview = str_replace($entity->getURL(),$link,$entview);
echo $entview;
-
- set_context($context);
-
+
+ set_context($context);
+
}
}
}
diff --git a/mod/embed/views/default/embed/upload.php b/mod/embed/views/default/embed/upload.php
index d995b4b2b..5f249c0c7 100644
--- a/mod/embed/views/default/embed/upload.php
+++ b/mod/embed/views/default/embed/upload.php
@@ -1,5 +1,6 @@
<h2 class="media_modal_title">Embed / Upload Media</h2>
<?php
+$internalname = get_input('internalname');
echo elgg_view('embed/tabs',array('tab' => 'upload', 'internalname'=>get_input('internalname')));
@@ -7,7 +8,7 @@ if (!elgg_view_exists('file/upload')) {
echo "<p>" . elgg_echo('embed:file:required') . "</p>";
} else {
$action = 'file/upload';
-
+
?>
<form id="media_upload" action="<?php echo $vars['url']; ?>action/file/upload" method="post" enctype="multipart/form-data">
<p>
@@ -15,7 +16,7 @@ if (!elgg_view_exists('file/upload')) {
<?php
echo elgg_view('input/securitytoken');
echo elgg_view("input/file",array('internalname' => 'upload', 'js' => 'id="upload"'));
-
+
?>
</label></p>
<p>
@@ -26,7 +27,7 @@ if (!elgg_view_exists('file/upload')) {
"internalname" => "title",
"value" => $title,
));
-
+
?>
</label>
</p>
@@ -34,7 +35,7 @@ if (!elgg_view_exists('file/upload')) {
<label for="filedescription"><?php echo elgg_echo("description"); ?><br />
<textarea class="input_textarea" name="description" id="filedescription"></textarea>
</label></p>
-
+
<p>
<label><?php echo elgg_echo("tags"); ?><br />
<?php
@@ -60,26 +61,26 @@ if (!elgg_view_exists('file/upload')) {
echo "<input type=\"hidden\" name=\"container_guid\" value=\"{$vars['container_guid']}\" />";
if (isset($vars['entity']))
echo "<input type=\"hidden\" name=\"file_guid\" value=\"{$vars['entity']->getGUID()}\" />";
-
+
?>
<input type="submit" value="<?php echo elgg_echo("save"); ?>" />
</p>
</form>
-<script type="text/javascript">
- // bind 'myForm' and provide a simple callback function
- $('#media_upload').submit(function() {
- var options = {
- success: function() {
- $('.popup .content').load('<?php echo $vars['url'] . 'pg/embed/media'; ?>?internalname=<?php echo $vars['internalname']; ?>');
- }
- };
- $(this).ajaxSubmit(options);
- return false;
- });
-</script>
+<script type="text/javascript">
+ // bind 'myForm' and provide a simple callback function
+ $('#media_upload').submit(function() {
+ var options = {
+ success: function() {
+ $('.popup .content').load('<?php echo $vars['url'] . 'pg/embed/media'; ?>?internalname=<?php echo $internalname; ?>');
+ }
+ };
+ $(this).ajaxSubmit(options);
+ return false;
+ });
+</script>
<?php
-
+
}
?>