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.php222
-rw-r--r--mod/embed/views/default/embed/js.php379
-rw-r--r--mod/embed/views/default/embed/link.php1
-rw-r--r--mod/embed/views/default/embed/media.php66
-rw-r--r--mod/embed/views/default/embed/metatags.php5
-rw-r--r--mod/embed/views/default/embed/pagination.php131
-rw-r--r--mod/embed/views/default/embed/simpletype.php39
-rw-r--r--mod/embed/views/default/embed/tabs.php23
-rw-r--r--mod/embed/views/default/embed/upload.php88
-rw-r--r--mod/embed/views/default/group/default/embed.php9
-rw-r--r--mod/embed/views/default/object/default/embed.php9
-rw-r--r--mod/embed/views/default/object/file/embed.php17
-rw-r--r--mod/embed/views/default/object/file/embedlist.php20
-rw-r--r--mod/embed/views/default/site/default/embed.php9
-rw-r--r--mod/embed/views/default/user/default/embed.php9
16 files changed, 1031 insertions, 0 deletions
diff --git a/mod/embed/views/default/embed/addcontentjs.php b/mod/embed/views/default/embed/addcontentjs.php
new file mode 100644
index 000000000..ee3678b89
--- /dev/null
+++ b/mod/embed/views/default/embed/addcontentjs.php
@@ -0,0 +1,4 @@
+
+ var entity;
+ $('textarea[name='+entityname+']').val($('textarea[name='+entityname+']').val() + ' ' + content);
+
diff --git a/mod/embed/views/default/embed/css.php b/mod/embed/views/default/embed/css.php
new file mode 100644
index 000000000..31d474a61
--- /dev/null
+++ b/mod/embed/views/default/embed/css.php
@@ -0,0 +1,222 @@
+<?php
+
+ /**
+ * 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;
+ background: white;
+ width: 730px;
+ -webkit-border-radius: 12px;
+ -moz-border-radius: 12px;
+}
+#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 .footer a {
+ -moz-outline: none;
+ outline: none;
+}
+#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');
+}
+
+
+/* EMBED MEDIA TABS */
+#embed_media_tabs {
+ margin:10px 0 0 10px;
+ padding:0;
+}
+#embed_media_tabs ul {
+ list-style: none;
+ padding-left: 0;
+}
+#embed_media_tabs ul li {
+ float: left;
+ margin:0;
+ background:white;
+}
+#embed_media_tabs ul li a {
+ font-weight: bold;
+ font-size:1.35em;
+ text-align: center;
+ text-decoration: none;
+ color:#b6b6b6;
+ background: white;
+ display: block;
+ padding: 0 10px 0 10px;
+ margin:0 10px 0 10px;
+ height:25px;
+ width:auto;
+ border-top:2px solid #dedede;
+ border-left:2px solid #dedede;
+ border-right:2px solid #dedede;
+ -moz-border-radius-topleft: 8px;
+ -moz-border-radius-topright: 8px;
+ -webkit-border-top-left-radius: 8px;
+ -webkit-border-top-right-radius: 8px;
+}
+/* IE6 fix */
+* html #embed_media_tabs ul li a { display: inline; }
+
+#embed_media_tabs ul li a:hover {
+ background:#b6b6b6;
+ color:white;
+ border-top:2px solid #b6b6b6;
+ border-left:2px solid #b6b6b6;
+ border-right:2px solid #b6b6b6;
+}
+#embed_media_tabs ul li a.embed_tab_selected {
+ border-top:2px solid #dedede;
+ border-left:2px solid #dedede;
+ border-right:2px solid #dedede;
+ -webkit-border-top-left-radius: 8px;
+ -webkit-border-top-right-radius: 8px;
+ -moz-border-radius-topleft: 8px;
+ -moz-border-radius-topright: 8px;
+ background: #dedede;
+ color:#666666;
+ position: relative;
+ /* top: 2px; - only needed if selected tab needs to sit over a border */
+}
+
+#mediaUpload,
+#mediaEmbed {
+ margin:0 5px 10px 5px;
+ padding:10px;
+ border:2px solid #dedede;
+ -webkit-border-radius: 8px;
+ -moz-border-radius: 8px;
+ background: #dedede;
+}
+#mediaEmbed .search_listing {
+ margin:0 0 5px 0;
+ background: white;
+}
+
+h1.mediaModalTitle {
+ /* color:#0054A7; */
+ font-size:1.35em;
+ line-height:1.2em;
+ margin:0 0 0 8px;
+ padding:5px;
+}
+
+#mediaEmbed .pagination,
+#mediaUpload .pagination {
+ float:right;
+ padding:5px;
+ background:white;
+ -webkit-border-radius: 5px;
+ -moz-border-radius: 5px;
+}
+#mediaUpload label {
+ font-size:120%;
+}
+#mediaEmbed p.embedInstructions {
+ margin:10px 0 5px 0;
+}
+a.embed_media {
+ margin:0;
+ float:right;
+ display:block;
+ text-align: right;
+ font-size:1.0em;
+ font-weight: normal;
+}
+label a.embed_media {
+ font-size:0.8em;
+}
+
+
+
+
+/* ***************************************
+ PAGINATION
+*************************************** */
+#mediaEmbed .pagination .pagination_number {
+ border:1px solid #999999;
+ color:#666666;
+}
+#mediaEmbed .pagination .pagination_number:hover {
+ background:#aaaaaa;
+ color:black;
+}
+
+#mediaEmbed .pagination .pagination_previous,
+#mediaEmbed .pagination .pagination_next {
+ border:1px solid #999999;
+ color:#666666;
+}
+#mediaEmbed .pagination .pagination_previous:hover,
+#mediaEmbed .pagination .pagination_next:hover {
+ background:#aaaaaa;
+ color:black;
+}
+#mediaEmbed .pagination .pagination_currentpage {
+ background:#666666;
+ border:1px solid #666666;
+ color:white;
+}
+
+
+
+
+
+
+
+
+
+
diff --git a/mod/embed/views/default/embed/js.php b/mod/embed/views/default/embed/js.php
new file mode 100644
index 000000000..fa809ce23
--- /dev/null
+++ b/mod/embed/views/default/embed/js.php
@@ -0,0 +1,379 @@
+
+ function elggUpdateContent(content, entityname) {
+ content = ' ' + content + ' ';
+ <?php
+ echo elgg_view('embed/addcontentjs');
+ ?>
+ $.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']; ?>mod/embed/images/loading.gif',
+ closeImage : '<?php echo $vars['url']; ?>mod/embed/images/button_spacer.gif',
+ imageTypes : [ 'png', 'jpg', 'jpeg', 'gif' ],
+ faceboxHtml : '\
+ <div id="facebox" style="display:none;"> \
+ <div class="popup"> \
+ <div class="body"> \
+ <div class="footer"> \
+ <a href="#" class="close"> \
+ <img src="<?php echo $vars['url']; ?>mod/embed/images/button_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');
+ }, 1000);
+
+ //$('#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/link.php b/mod/embed/views/default/embed/link.php
new file mode 100644
index 000000000..f8db0bd85
--- /dev/null
+++ b/mod/embed/views/default/embed/link.php
@@ -0,0 +1 @@
+<a class="embed_media" href="<?php echo $vars['url'] . 'pg/embed/media'; ?>?internalname=<?php echo $vars['internalname']; ?>" rel="facebox"><?php echo elgg_echo('media:insert'); ?></a><br /> \ No newline at end of file
diff --git a/mod/embed/views/default/embed/media.php b/mod/embed/views/default/embed/media.php
new file mode 100644
index 000000000..48bf65fdf
--- /dev/null
+++ b/mod/embed/views/default/embed/media.php
@@ -0,0 +1,66 @@
+<h1 class="mediaModalTitle">Embed / Upload Media</h1>
+<?php
+
+ echo elgg_view('embed/tabs',array('tab' => 'media', 'internalname' => $vars['internalname']));
+?>
+ <div id='mediaEmbed'>
+<?php
+ echo elgg_view('embed/pagination',array(
+ 'offset' => $vars['offset'],
+ 'baseurl' => $vars['url'] . 'pg/embed/media?internalname=' . $vars['internalname'] . "&amp;simpletype=" . $vars['simpletype'],
+ '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=\"embedInstructions\">" . elgg_echo('embed:instructions') . "</p>";
+
+ foreach($entities as $entity) {
+ if ($entity instanceof ElggEntity) {
+
+ $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 {
+ $entview = elgg_view_entity($entity);
+ }
+ $entview = str_replace($entity->getURL(),$link,$entview);
+ echo $entview;
+
+ set_context($context);
+
+ }
+ }
+ }
+
+?>
+</div> \ No newline at end of file
diff --git a/mod/embed/views/default/embed/metatags.php b/mod/embed/views/default/embed/metatags.php
new file mode 100644
index 000000000..3c7ab87a9
--- /dev/null
+++ b/mod/embed/views/default/embed/metatags.php
@@ -0,0 +1,5 @@
+ <script type="text/javascript">
+ jQuery(document).ready(function($) {
+ $('a[rel*=facebox]').facebox()
+ });
+ </script>
diff --git a/mod/embed/views/default/embed/pagination.php b/mod/embed/views/default/embed/pagination.php
new file mode 100644
index 000000000..d087fc12c
--- /dev/null
+++ b/mod/embed/views/default/embed/pagination.php
@@ -0,0 +1,131 @@
+<?php
+
+ /**
+ * Elgg pagination
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008-2010
+ * @link http://elgg.org/
+ *
+ */
+
+ if (!isset($vars['offset'])) {
+ $offset = 0;
+ } else {
+ $offset = $vars['offset'];
+ }
+ if ((!isset($vars['limit'])) || (!$vars['limit'])) {
+ $limit = 10;
+ } else {
+ $limit = (int)$vars['limit'];
+ }
+ if (!isset($vars['count'])) {
+ $count = 0;
+ } else {
+ $count = $vars['count'];
+ }
+ if (!isset($vars['word'])) {
+ $word = "offset";
+ } else {
+ $word = $vars['word'];
+ }
+ if (isset($vars['nonefound'])) {
+ $nonefound = $vars['nonefound'];
+ } else {
+ $nonefound = true;
+ }
+
+ $totalpages = ceil($count / $limit);
+ $currentpage = ceil($offset / $limit) + 1;
+
+ //only display if there is content to paginate through or if we already have an offset
+ if (($count > $limit || $offset > 0) && get_context() != 'widget') {
+
+?>
+
+<div class="pagination">
+<?php
+
+ if ($offset > 0) {
+ $prevoffset = $offset - $limit;
+ if ($prevoffset < 0) {
+ $prevoffset = 0;
+ }
+
+ $prevurl = elgg_http_add_url_query_elements($baseurl, array($word => $prevoffset));
+
+ echo "<a onclick=\"javascript:$('.popup .content').load('{$prevurl}'); return false\" href=\"#\" class=\"pagination_previous\">&laquo; ". elgg_echo("previous") ."</a> ";
+
+ }
+
+ if ($offset > 0 || $offset < ($count - $limit)) {
+
+ $currentpage = round($offset / $limit) + 1;
+ $allpages = ceil($count / $limit);
+
+ $i = 1;
+ $pagesarray = array();
+ while ($i <= $allpages && $i <= 4) {
+ $pagesarray[] = $i;
+ $i++;
+ }
+ $i = $currentpage - 2;
+ while ($i <= $allpages && $i <= ($currentpage + 2)) {
+ if ($i > 0 && !in_array($i,$pagesarray))
+ $pagesarray[] = $i;
+ $i++;
+ }
+ $i = $allpages - 3;
+ while ($i <= $allpages) {
+ if ($i > 0 && !in_array($i,$pagesarray))
+ $pagesarray[] = $i;
+ $i++;
+ }
+
+ sort($pagesarray);
+
+ $prev = 0;
+ foreach($pagesarray as $i) {
+
+ if (($i - $prev) > 1) {
+
+ echo "<span class=\"pagination_more\">...</span>";
+
+ }
+
+ $curoffset = (($i - 1) * $limit);
+ $counturl = elgg_http_add_url_query_elements($base_url, array($word => $curoffset));
+
+ if ($curoffset != $offset) {
+ echo " <a onclick=\"javascript:$('.popup .content').load('{$counturl}'); return false\" href=\"#\" class=\"pagination_number\">{$i}</a> ";
+ } else {
+ echo "<span class=\"pagination_currentpage\"> {$i} </span>";
+ }
+ $prev = $i;
+
+ }
+
+ }
+
+ if ($offset < ($count - $limit)) {
+
+ $nextoffset = $offset + $limit;
+ if ($nextoffset >= $count) {
+ $nextoffset--;
+ }
+
+ $nexturl = elgg_http_add_url_query_elements($baseurl, array($word => $nextoffset));
+
+ echo " <a onclick=\"javascript:$('.popup .content').load('{$nexturl}'); return false\" href=\"#\" class=\"pagination_next\">" . elgg_echo("next") . " &raquo;</a>";
+
+ }
+
+?>
+<br class="clearfloat" />
+</div>
+<?php
+ } // end of pagination check if statement
+?>
diff --git a/mod/embed/views/default/embed/simpletype.php b/mod/embed/views/default/embed/simpletype.php
new file mode 100644
index 000000000..f92678f52
--- /dev/null
+++ b/mod/embed/views/default/embed/simpletype.php
@@ -0,0 +1,39 @@
+ <select name="simpletype" id="embed_simpletype_select">
+
+<?php
+
+ $all = new stdClass;
+ $all->tag = "all";
+ $vars['simpletypes'][] = $all;
+ $vars['simpletypes'] = array_reverse($vars['simpletypes']);
+
+ if (isset($vars['simpletypes']) && is_array($vars['simpletypes']))
+ foreach($vars['simpletypes'] as $type) {
+
+ if ($vars['simpletype'] == $type->tag || (empty($vars['simpletype']) && $type->tag == 'all')) {
+ $selected = 'selected = "selected"';
+ } else $selected = '';
+ $tag = $type->tag;
+ if ($tag != "all") {
+ $label = elgg_echo("file:type:" . $tag);
+ } else {
+ $tag = '';
+ $label = elgg_echo('all');
+ }
+
+?>
+ <option <?php echo $selected; ?> value="<?php echo $tag; ?>"><?php echo $label; ?></option>
+<?php
+
+ }
+
+?>
+
+ </select>
+ <script type="text/javascript">
+ $('#embed_simpletype_select').change(function(){
+ var simpletype = $('#embed_simpletype_select').val();
+ var url = '<?php echo $vars['url']; ?>pg/embed/media?simpletype=' + simpletype + '&internalname=<?php echo $vars['internalname']; ?>';
+ $('.popup .content').load(url);
+ });
+ </script>
diff --git a/mod/embed/views/default/embed/tabs.php b/mod/embed/views/default/embed/tabs.php
new file mode 100644
index 000000000..8b2f5bde4
--- /dev/null
+++ b/mod/embed/views/default/embed/tabs.php
@@ -0,0 +1,23 @@
+<?php
+
+ $embedselected = '';
+ $uploadselected = '';
+ if ($vars['tab'] == 'media') {
+ $embedselected = 'class="embed_tab_selected"';
+ } else {
+ $uploadselected = 'class="embed_tab_selected"';
+ }
+
+?>
+
+<div id="embed_media_tabs">
+ <ul>
+ <li>
+ <a href="#" <?php echo $embedselected; ?> onclick="javascript:$('.popup .content').load('<?php echo $vars['url'] . 'pg/embed/media'; ?>?internalname=<?php echo $vars['internalname']; ?>'); return false"><?php echo elgg_echo('embed:media'); ?></a>
+ </li>
+ <li>
+ <a href="#" <?php echo $uploadselected; ?> onclick="javascript:$('.popup .content').load('<?php echo $vars['url'] . 'pg/embed/upload'; ?>?internalname=<?php echo $vars['internalname']; ?>'); return false"><?php echo elgg_echo('upload:media'); ?></a>
+ </li>
+ </ul>
+</div>
+<div class="clearfloat"></div> \ No newline at end of file
diff --git a/mod/embed/views/default/embed/upload.php b/mod/embed/views/default/embed/upload.php
new file mode 100644
index 000000000..a727501dd
--- /dev/null
+++ b/mod/embed/views/default/embed/upload.php
@@ -0,0 +1,88 @@
+<h1 class="mediaModalTitle">Embed / Upload Media</h1>
+<?php
+
+ echo elgg_view('embed/tabs',array('tab' => 'upload', 'internalname'=>get_input('internalname')));
+
+ if (!elgg_view_exists('file/upload')) {
+ echo "<p>" . elgg_echo('embed:file:required') . "</p>";
+ } else {
+ $action = 'file/upload';
+
+?>
+ <form id="mediaUpload" action="<?php echo $vars['url']; ?>action/file/upload" method="post" enctype="multipart/form-data">
+ <p>
+ <label for="upload"><?php echo elgg_echo("file:file"); ?><br />
+ <?php
+ echo elgg_view('input/securitytoken');
+ echo elgg_view("input/file",array('internalname' => 'upload', 'js' => 'id="upload"'));
+
+ ?>
+ </label></p>
+ <p>
+ <label><?php echo elgg_echo("title"); ?><br />
+ <?php
+
+ echo elgg_view("input/text", array(
+ "internalname" => "title",
+ "value" => $title,
+ ));
+
+ ?>
+ </label>
+ </p>
+ <p>
+ <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
+ echo elgg_view("input/tags", array(
+ "internalname" => "tags",
+ "value" => $tags,
+ ));
+
+ ?>
+ </label>
+ </p>
+ <p>
+ <label>
+ <?php echo elgg_echo('access'); ?><br />
+ <?php echo elgg_view('input/access', array('internalname' => 'access_id','value' => ACCESS_DEFAULT)); ?>
+ </label>
+ </p>
+
+ <p>
+ <?php
+
+ if (isset($vars['container_guid']))
+ 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">
+ // wait for the DOM to be loaded
+ //$(document).ready(function() {
+ // bind 'myForm' and provide a simple callback function
+ $('#mediaUpload').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>
+
+<?php
+
+ }
+
+?>
diff --git a/mod/embed/views/default/group/default/embed.php b/mod/embed/views/default/group/default/embed.php
new file mode 100644
index 000000000..c5bf905a0
--- /dev/null
+++ b/mod/embed/views/default/group/default/embed.php
@@ -0,0 +1,9 @@
+<?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/object/default/embed.php b/mod/embed/views/default/object/default/embed.php
new file mode 100644
index 000000000..c97dbd48a
--- /dev/null
+++ b/mod/embed/views/default/object/default/embed.php
@@ -0,0 +1,9 @@
+<?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
new file mode 100644
index 000000000..01f3904ac
--- /dev/null
+++ b/mod/embed/views/default/object/file/embed.php
@@ -0,0 +1,17 @@
+<?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
new file mode 100644
index 000000000..71e84f265
--- /dev/null
+++ b/mod/embed/views/default/object/file/embedlist.php
@@ -0,0 +1,20 @@
+<?php
+
+ $file = $vars['entity'];
+ $friendlytime = friendly_time($vars['entity']->time_created);
+
+ $info = "<p> <a href=\"{$file->getURL()}\">{$file->title}</a></p>";
+ $info .= "<p class=\"owner_timestamp\">{$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="embedFile<?php echo $file->guid; ?>">
+ <div class="search_listing">
+ <div class="search_listing_icon">
+ <?php echo $icon; ?>
+ </div>
+ <div class="search_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
new file mode 100644
index 000000000..2d0c52214
--- /dev/null
+++ b/mod/embed/views/default/site/default/embed.php
@@ -0,0 +1,9 @@
+<?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
new file mode 100644
index 000000000..1c3dae072
--- /dev/null
+++ b/mod/embed/views/default/user/default/embed.php
@@ -0,0 +1,9 @@
+<?php
+
+ if ($vars['entity'] instanceof ElggUser) {
+
+ echo '<a href="'. $vars['entity']->getURL() .'">' . $vars['entity']->name . '</a>';
+
+ }
+
+?> \ No newline at end of file