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/css.php270
-rw-r--r--mod/embed/views/default/embed/embed.php86
-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.php63
-rw-r--r--mod/embed/views/default/embed/layout.php30
-rw-r--r--mod/embed/views/default/embed/layouts/gallery.php10
-rw-r--r--mod/embed/views/default/embed/layouts/list.php10
-rw-r--r--mod/embed/views/default/embed/list.php58
-rw-r--r--mod/embed/views/default/embed/tabs.php40
-rw-r--r--mod/embed/views/default/embed/upload/content.php41
-rw-r--r--mod/embed/views/default/group/default/embed.php5
-rw-r--r--mod/embed/views/default/js/embed/embed.php47
-rw-r--r--mod/embed/views/default/js/embed/inline.php26
-rw-r--r--mod/embed/views/default/navigation/menu/embed.php18
-rw-r--r--mod/embed/views/default/object/default/embed.php6
-rw-r--r--mod/embed/views/default/object/file/embed.php16
-rw-r--r--mod/embed/views/default/object/file/embedlist.php11
-rw-r--r--mod/embed/views/default/site/default/embed.php5
-rw-r--r--mod/embed/views/default/user/default/embed.php5
20 files changed, 170 insertions, 670 deletions
diff --git a/mod/embed/views/default/embed/css.php b/mod/embed/views/default/embed/css.php
index 150dc8733..034c0fcfe 100644
--- a/mod/embed/views/default/embed/css.php
+++ b/mod/embed/views/default/embed/css.php
@@ -8,7 +8,7 @@
.embed-wrapper {
width: 730px;
min-height: 400px;
- margin: 5px;
+ margin: 20px 15px;
}
.embed-wrapper h2 {
color: #333333;
@@ -28,270 +28,10 @@
.embed-wrapper p {
color: #333;
}
-.embed-wrapper .elgg-image-block:hover {
- background-color: #eee;
-}
-<?php
-return true;
-?>
-/***************
- Form
-******************/
-/* input field classes */
-.embed-wrapper .elgg-input-text,
-.embed-wrapper .elgg-input-tags {
- font: 120% Arial, Helvetica, sans-serif;
- padding: 5px;
- border: 1px solid #ccc;
- color:#666;
- background-color: white;
-
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
-
- -webkit-box-shadow: none;
- -moz-box-shadow: none;
- box-shadow: none;
-}
-.embed-wrapper .elgg-input-text:focus,
-.embed-wrapper .elgg-input-tags:focus {
- border: solid 1px #4690d6;
- background: #e4ecf5;
- color:#333;
-}
-.embed-wrapper .elgg-input-file {
- background-color: white;
-}
-
-.embed-wrapper label {
- color:#333;
-}
-
-
-
-
-#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;
- width: 730px;
- min-height:400px;
-
- -webkit-border-radius: 8px;
- -moz-border-radius: 8px;
- 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:-4px 0 0 0;
- padding:0;
-}
-#facebox .footer img.close_image {
- background: url(<?php echo elgg_get_site_url(); ?>mod/embed/images/close_button.gif) no-repeat left top;
-}
-#facebox .footer img.close_image:hover {
- background: url(<?php echo elgg_get_site_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: #000;
- 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;
-}
-
-
-/* embeded content links */
-.embeded_file.link {
- display: inline;
- margin-right: 5px;
- padding-left: 14px;
- background-repeat: no-repeat;
-
- -webkit-background-size: 12px 16px;
- -moz-background-size: 12px 16px;
- background-size: 12px 16px;
-}
-
-/* entity listings */
-.embed_data .elgg-image img {
- cursor: pointer;
-}
-.embed_data .elgg-image-block {
- border-bottom:none;
-}
-.embed_modal_videolist .elgg-image img {
- width:75px;
- height:auto;
-}
-.embed_modal_document .embed_data .elgg-body {
- margin-top:0;
- margin-left:7px;
-}
-.embed_modal_tidypics .embed_data .elgg-body {
- margin-top:11px;
+.embed-item {
+ padding-left: 5px;
+ padding-right: 5px;
}
-.embed_modal_file .embed_data .elgg-body {
- margin-top:0px;
- margin-left:9px;
-}
-.embed_data .elgg-body {
- width:auto;
- margin-top:15px;
- margin-left:15px;
-}
-.embed_data .elgg-image-block {
- cursor:pointer;
-}
-
-/* input field classes */
-#facebox .content .elgg-input-text,
-#facebox .content .elgg-input-tags {
- font: 120% Arial, Helvetica, sans-serif;
- padding: 5px;
- border: 1px solid #ccc;
- color:#666;
- background-color: white;
-
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- border-radius: 5px;
-
- -webkit-box-shadow: none;
- -moz-box-shadow: none;
- box-shadow: none;
-}
-#facebox .content .elgg-input-text:focus,
-#facebox .content .elgg-input-tags:focus {
- border: solid 1px #4690d6;
- background: #e4ecf5;
- color:#333;
-}
-#facebox .content .elgg-input-file {
- background-color: white;
-}
-#facebox .content p {
- color:#333;
-}
-#facebox .content p.entity-title {
- color:#666;
-}
-#facebox .content .elgg-image-block:hover {
+.embed-item:hover {
background-color: #eee;
}
-#facebox .content label {
- color:#333;
-}
-
-
-/* ***************************************
- ELGG TABBED PAGE NAVIGATION
-*************************************** */
-#facebox .body .elgg-tabs {
- margin-bottom:5px;
- padding: 0;
- border-bottom: 2px solid #ccc;
- display:table;
- width:100%;
-}
-#facebox .body .elgg-tabs ul {
- list-style: none;
- padding: 0;
- margin: 0;
-}
-#facebox .body .elgg-tabs li {
- float: left;
- border: 2px solid #ccc;
- border-bottom-width: 0;
- background: #eee;
- margin: 0 0 0 10px;
-
- -webkit-border-radius:5px 5px 0 0;
- -moz-border-radius: 5px 5px 0 0;
- border-raidus: 5px 5px 0 0;
-}
-#facebox .body .elgg-tabs a {
- text-decoration: none;
- display: block;
- padding:3px 10px 0 10px;
- text-align: center;
- height:21px;
- color:#999;
-}
-#facebox .body .elgg-tabs a:hover {
- background: #dedede;
- color:#666;
-}
-#facebox .body .elgg-tabs .selected {
- border-color: #ccc;
- background: white;
-}
-#facebox .body .elgg-tabs .selected a {
- position: relative;
- top: 2px;
- background: white;
-}
-
-
-
-/* Pagination (override core elgg css defaults) */
-#facebox .body .pagination {
- float:right;
-}
-#facebox .body .pagination .pagination-number {
- border:1px solid #999;
- color:#666;
-}
-#facebox .body .pagination .pagination-number:hover {
- background-color:#aaa;
- color:black;
-}
-#facebox .body .pagination .pagination-previous,
-#facebox .body .pagination .pagination-next {
- border:1px solid #999;
- color:#666;
-}
-#facebox .body .pagination .pagination-previous:hover,
-#facebox .body .pagination .pagination-next:hover {
- background-color:#aaa;
- color:black;
-}
-#facebox .body .pagination .pagination-currentpage {
- background-color:#666;
- border:1px solid #666;
- 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 2d8de1ca4..000000000
--- a/mod/embed/views/default/embed/embed.php
+++ /dev/null
@@ -1,86 +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_extract('sections', $vars, array());
-$active_section = elgg_extract('active_section', $vars, array_shift(array_keys($sections)), false);
-$upload_sections = elgg_extract('upload_sections', $vars, array());
-$internal_id = elgg_extract('internal_id', $vars);
-
-if (!$sections) {
- $content = elgg_echo('embed:no_sections');
-} else {
- $content = elgg_view_title(elgg_echo('embed:media'));
- $content .= elgg_view('embed/tabs', $vars);
-
- $offset = (int)max(0, get_input('offset', 0));
- $limit = (int)get_input('limit', 5);
-
- // 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(
- 'offset' => $offset,
- 'limit' => $limit,
- 'section' => $active_section,
- 'upload_sections' => $upload_sections,
- 'internal_id' => $internal_id
- );
-
- // 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;
- } else {
- // see if anyone has any items to display for the active section
- $result = array('items' => array(), 'count' => 0);
- $embed_info = elgg_trigger_plugin_hook('embed_get_items', $active_section, $params, $result);
-
- // do we use default view or has someone defined "embed/$active_section/item/$layout"
- $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 {
-
- elgg_push_context('widgets');
- $content .= elgg_view_entity_list($embed_info['items'], array(
- 'full_view' => false,
- 'count' => $embed_info['count'],
- 'pagination' => true,
- 'position' => 'before',
- 'offset' => $offset,
- 'limit' => $limit,
- ));
- elgg_pop_context();
-
- $js = elgg_view('js/embed/inline', array(
- 'items' => $embed_info['items'],
- ));
- }
- }
- } else {
- $content .= elgg_echo('embed:invalid_section');
- }
-}
-
-echo '<div class="embed-wrapper">' . $content . '</div>';
-
-if (isset($js)) {
- echo '<script type="text/javascript">';
- echo $js;
- echo '</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 daee8ee94..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_get_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 JS 1.8: no
-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 89a2ffb63..000000000
--- a/mod/embed/views/default/embed/item/list.php
+++ /dev/null
@@ -1,63 +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']) && $vars['ecml_enabled'] && isset($vars['ecml_keyword'])) ? $vars['ecml_keyword'] : NULL;
-$icon_size = $vars['icon_size'];
-$owner = $item->getOwnerEntity();
-
-// @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_get_excerpt($title);
-
-$author_text = elgg_echo('byline', array($owner->name));
-$date = elgg_view_friendly_time($item->time_created);
-
-$subtitle = "$author_text $date";
-
-// @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' => $icon,
- 'encode_text' => FALSE
- ));
-}
-
-$item_icon = elgg_view_entity_icon($item, $icon_size);
-
-$params = array(
- 'title' => $title,
- 'entity' => $item,
- 'subtitle' => $subtitle,
- 'tags' => FALSE,
-);
-$list_body = elgg_view('object/elements/summary', $params);
-
-// @todo JS 1.8: is this approach better than inline js?
-echo "<div class=\"embed_data\" id=\"embed_{$item->getGUID()}\">" . elgg_view_image_block($item_icon, $list_body) . '</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/layout.php b/mod/embed/views/default/embed/layout.php
new file mode 100644
index 000000000..c1e43f13c
--- /dev/null
+++ b/mod/embed/views/default/embed/layout.php
@@ -0,0 +1,30 @@
+<?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');
+ }
+}
+
+echo <<<HTML
+<div class="embed-wrapper">
+ $title
+ $menu
+ $tab
+</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 70b6d33a5..000000000
--- a/mod/embed/views/default/embed/layouts/gallery.php
+++ /dev/null
@@ -1,10 +0,0 @@
-<?php
-/**
- * Embed - Gallery items
- *
- * @uses string $vars['content'] Pre-formatted content.
- *
- */
-$active_section = elgg_extract('section', $vars, array());
-
-echo "<div class='embed_modal_$active_section'>" . elgg_extract('content', $vars, '') . "</div>";
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 5d62e572b..000000000
--- a/mod/embed/views/default/embed/layouts/list.php
+++ /dev/null
@@ -1,10 +0,0 @@
-<?php
-/**
- * Embed - List items
- *
- * @uses string $vars['content'] Pre-formatted content.
- *
- */
-$active_section = elgg_extract('section', $vars, array());
-
-echo "<div class='embed_modal_$active_section'>" . elgg_extract('content', $vars, '') . "</div>"; \ No newline at end of file
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/tabs.php b/mod/embed/views/default/embed/tabs.php
deleted file mode 100644
index 3f377fee5..000000000
--- a/mod/embed/views/default/embed/tabs.php
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-/**
- * Embed tabs
- *
- * @uses $vars['sections']
- * @uses $vars['upload_sections']
- * @uses $vars['actibe_section']
- */
-
-$sections = elgg_extract('sections', $vars, array());
-$active_section = elgg_extract('active_section', $vars, array_shift(array_keys($sections)));
-$upload_sections = elgg_extract('upload_sections', $vars, array());
-
-$tabs = array();
-foreach ($sections as $section_id => $section_info) {
- $tab = array(
- 'title' => $section_info['name'],
- 'url' => '#',
- 'url_class' => 'embed-section',
- 'url_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_id' => 'upload',
- 'selected' => ($active_section == 'upload')
- );
-}
-
-echo elgg_view('navigation/tabs', array('tabs' => $tabs));
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 8bedf5ad1..000000000
--- a/mod/embed/views/default/embed/upload/content.php
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-/**
- * Special upload form
- */
-$upload_sections = elgg_extract('upload_sections', $vars, array());
-$active_section = get_input('active_upload_section', array_shift(array_keys($upload_sections)));
-$active_section = preg_replace('[\W]', '', $active_section);
-
-$options = array();
-
-if ($upload_sections) {
- foreach ($upload_sections as $id => $info) {
- $options[$id] = $info['name'];
- }
-
- $input = elgg_view('input/dropdown', array(
- 'name' => 'download_section',
- 'options_values' => $options,
- 'id' => 'embed_upload',
- 'value' => $active_section
- ));
-
- // hack this in for now as we clean up this mess
- $form_vars = array(
- 'enctype' => 'multipart/form-data',
- 'class' => 'elgg-form',
- );
- $upload_content = elgg_view_form('file/upload', $form_vars);
-/*
- if (!$upload_content = elgg_view($upload_sections[$active_section]['view'])) {
- $upload_content = elgg_echo('embed:no_upload_content');
- }
-*/
- echo "<div class='mbm'>" . elgg_echo('embed:upload_type') . "$input</div>";
- echo "<div class='embed-upload'>";
- echo $upload_content;
- echo "</div>";
-
-} 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 bf51f0a7d..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']->name . '</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
index ea92ba1fd..3126e12f7 100644
--- a/mod/embed/views/default/js/embed/embed.php
+++ b/mod/embed/views/default/js/embed/embed.php
@@ -3,7 +3,7 @@ elgg.provide('elgg.embed');
elgg.embed.init = function() {
// inserts the embed content into the textarea
- $(".embed-wrapper .elgg-item").live('click', elgg.embed.insert);
+ $(".embed-item").live('click', elgg.embed.insert);
// caches the current textarea id
$(".embed-control").live('click', function() {
@@ -14,29 +14,36 @@ elgg.embed.init = function() {
});
// special pagination helper for lightbox
- $('.embed-wrapper .elgg-pagination a').live('click', elgg.embed.pagination);
+ $('.embed-wrapper .elgg-pagination a').live('click', elgg.embed.forward);
- $('.embed-section').live('click', elgg.embed.loadTab);
+ $('.embed-section').live('click', elgg.embed.forward);
- $('.embed-upload .elgg-form').live('submit', elgg.embed.submit);
+ $('.elgg-form-embed').live('submit', elgg.embed.submit);
}
/**
* Inserts data attached to an embed list item in textarea
*
- * @todo generalize lightbox closing and wysiwyg refreshing
+ * @todo generalize lightbox closing
*
* @param {Object} event
* @return void
*/
elgg.embed.insert = function(event) {
-
var textAreaId = elgg.embed.textAreaId;
+ var textArea = $('#' + textAreaId);
- var content = $(this).data('embed_code');
- $('#' + textAreaId).val($('#' + textAreaId).val() + ' ' + content + ' ');
+ // generalize this based on a css class attached to what should be inserted
+ var content = ' ' + $(this).find(".embed-insert").parent().html() + ' ';
+
+ 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');
+?>
- <?php echo elgg_view('embed/custom_insert_js'); ?>
$.fancybox.close();
@@ -67,9 +74,8 @@ elgg.embed.submit = function(event) {
elgg.system_message(response.system_messages.success);
}
if (response.status >= 0) {
- // @todo - really this should forward to what the registered defined
- // For example, forward to images tab if an image was uploaded
- var url = elgg.config.wwwroot + 'embed/embed?active_section=file';
+ var forward = $('input[name=embed_forward]').val();
+ var url = elgg.normalize_url('embed/tab/' + forward);
$('.embed-wrapper').parent().load(url);
}
}
@@ -82,27 +88,14 @@ elgg.embed.submit = function(event) {
}
/**
- * Loads the next chunk of content within the lightbox
+ * Loads content within the lightbox
*
* @param {Object} event
* @return void
*/
-elgg.embed.pagination = function(event) {
+elgg.embed.forward = function(event) {
$('.embed-wrapper').parent().load($(this).attr('href'));
event.preventDefault();
}
-/**
- * Loads an embed tab
- *
- * @param {Object} event
- * @return void
- */
-elgg.embed.loadTab = function(event) {
- var section = $(this).attr('id');
- var url = elgg.config.wwwroot + 'embed/embed?active_section=' + section;
- $('.embed-wrapper').parent().load(url);
- event.preventDefault();
-}
-
elgg.register_hook_handler('init', 'system', elgg.embed.init);
diff --git a/mod/embed/views/default/js/embed/inline.php b/mod/embed/views/default/js/embed/inline.php
deleted file mode 100644
index 0672a68f8..000000000
--- a/mod/embed/views/default/js/embed/inline.php
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-/**
- * Inline embed JavaScript for attaching the insert data to list items
- *
- * @uses $vars['items']
- */
-
-foreach ($vars['items'] as $item) {
-
- // 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_get_excerpt($title);
-
- $icon = "<img src=\"{$item->getIcon($icon_size)}\" />" . htmlspecialchars($title, ENT_QUOTES, 'UTF-8', false);
-
- $embed_code = elgg_view('output/url', array(
- 'href' => $item->getURL(),
- 'title' => $title,
- 'text' => $icon,
- 'encode_text' => false,
- ));
- $embed_code = json_encode($embed_code);
-
- echo "$('#elgg-object-{$item->getGUID()}').data('embed_code', $embed_code);";
-} \ No newline at end of file
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..1a6a18f05
--- /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(),
+ 'url_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 aca2ceea1..000000000
--- a/mod/embed/views/default/object/default/embed.php
+++ /dev/null
@@ -1,6 +0,0 @@
-<?php
-
-if ($vars['entity'] instanceof ElggObject) {
- $title = htmlspecialchars($vars['entity']->title, ENT_QUOTES);
- echo "<a href=\"{$vars['entity']->getURL()}\">$title</a>";
-}
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 5a3163e4c..000000000
--- a/mod/embed/views/default/object/file/embedlist.php
+++ /dev/null
@@ -1,11 +0,0 @@
-<?php
- $file = $vars['entity'];
- $friendlytime = elgg_view_friendly_time($vars['entity']->time_created);
-
- $info = "<p class='entity-title'> <a href=\"{$file->getURL()}\">{$file->title}</a></p>";
- $info .= "<p class='elgg-subtitle'>{$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; ?>">
- <?php echo elgg_view_image_block($icon, $info); ?>
-</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