]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
removed the sections from the menu to provide more flexibility in tab ordering
authorcash <cash.costello@gmail.com>
Tue, 4 Oct 2011 01:30:30 +0000 (21:30 -0400)
committercash <cash.costello@gmail.com>
Tue, 4 Oct 2011 01:30:30 +0000 (21:30 -0400)
mod/embed/README.txt
mod/embed/views/default/embed/css.php
mod/embed/views/default/embed/layout.php
mod/embed/views/default/js/embed/embed.php
mod/embed/views/default/navigation/menu/embed.php
mod/file/start.php
mod/file/views/default/embed/file_upload/content.php

index c7ce2e5281e99e5397c542c34c42f8ad9414f46d..cecee08c029f87db765bafe17ec790f259eb0199 100644 (file)
@@ -13,8 +13,9 @@ CONTENTS:
        their personal network content or third party resources in any text area.
 
        The Embed plugin adds a menu item to the longtext menu. Clicking on this
-       link pops up a lightbox. The lightbox has two types of tabs: one for
-       selecting content to embed and one for uploading new content.
+       link pops up a lightbox. The lightbox supports lists of content for insertion
+       and uploading new content.
+
 
 2. Adding a Tab
        The Embed plugin uses the menu system to manage its tabs. Use
@@ -23,7 +24,7 @@ CONTENTS:
        $item = ElggMenuItem::factory(array(
                'name' => 'file',
                'text' => elgg_echo('file'),
-               'section' => 'select',
+               'priority' => 10,
                'data' => array(
                        'options' => array(
                                'type' => 'object',
@@ -36,32 +37,33 @@ CONTENTS:
        Parameters:
                name: The unique name of the tab.
                text: The text shown on the tab
-               section: 'select' for embed selection or 'upload' for uploading new content
-               data: an array of parameters for creating the tab and its content. See
-                       the two sections below for data key values for the two tab types.
-
-       Select tab data parameters:
-               options: array of options passed to elgg_list_entities()
-
-       Upload tab data parameters:
-               view: the view used to render the tab content
+               priority: Placement of the tab.
+               data: An array of parameters for creating the tab and its content.
+                       When listing content using the embed list view, pass the options for the
+                       elgg_list_entities() function as 'options'.
+                       When using a custom view for listing content or for uploading new
+                       content, pass the view name as 'view'.
 
        See the file plugin for examples of registering both tab types.
 
 
-3. Populating a Select Tab
+3. Populating a Content Select Tab
        Nothing should be required other than setting the options parameter array
        when registering the tab. See the view embed/item to see how an entity is
        rendered.
 
+       If creating a custom list, the <li> elements must have a class of .embed-item.
+       The HTML content that is inserted must use the class .elgg-image.
+
+
 4. Populating an Upload Tab
        The view that is registered must be defined. It must include a form for
-       uploading the content. The form must be wrapped in a div with the class
-       .embed-upload. Somewhere in the view must be a hidden input field with the
-       name embed_hidden with its value be the name of the tab to forward the user
-       to when uploading is complete.
+       uploading the content. The form must .elgg-form-embed. Somewhere in the view
+       must be a hidden input field with the name embed_hidden with its value be
+       the name of the tab to forward the user to when uploading is complete.
 
        See the view embed/file_upload/content for an example
+
        
 5. Other WYSIWYG Editors and Embed
        Embed ships with support for the default input/longtext textarea.
index 324ed1038cdf9fac8c5713423a4ba6fd002a9fdc..034c0fcfe5f55e86839ee777af62fd250bc89cf4 100644 (file)
@@ -8,7 +8,7 @@
 .embed-wrapper {
        width: 730px;
        min-height: 400px;
-       margin: 15px;
+       margin: 20px 15px;
 }
 .embed-wrapper h2 {
        color: #333333;
index 73c26810da1cd91e524ef15b64871ed99eda7aef..c1e43f13cdd68e8868a1c759ea6e3d2c91528e61 100644 (file)
@@ -8,20 +8,17 @@ $title =  elgg_view_title(elgg_echo('embed:media'));
 $menu = elgg_view_menu('embed');
 
 $selected = elgg_get_config('embed_tab');
-switch ($selected->getData('tab_type')) {
-       case 'select':
-               $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');
-               }
-               break;
-       case 'upload':
-               $tab = elgg_view($selected->getData('view'), $vars);
-               break;
+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
index 840d8f89cc4714b0ebda7b2ac7cce219b685f0bd..bb80919a98aae7de67d675ecb992e8b2c1146dcb 100644 (file)
@@ -18,7 +18,7 @@ elgg.embed.init = function() {
 
        $('.embed-section').live('click', elgg.embed.forward);
 
-       $('.embed-upload .elgg-form').live('submit', elgg.embed.submit);
+       $('.elgg-form-embed').live('submit', elgg.embed.submit);
 }
 
 /**
index 36cedc47e52b83dcd614b56a52c0bd5ce2913a85..1a6a18f05b4eb1dad3a8beddfd88837f9a1b2c1d 100644 (file)
@@ -2,20 +2,17 @@
 /**
  * Embed tabs
  *
- * @uses $vars['menu']['select']
- * @uses $vars['menu']['upload']
+ * @uses $vars['menu']['default']
  */
 
 $tabs = array();
-foreach (array('select', 'upload') as $type) {
-       foreach ($vars['menu'][$type] as $menu_item) {
-               $tabs[] = array(
-                       'title' => $menu_item->getText(),
-                       'url' => 'embed/tab/' . $menu_item->getName(),
-                       'url_class' => 'embed-section',
-                       'selected' => $menu_item->getSelected(),
-               );
-       }
+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));
index 16ce0e2337a79b8b52d8c6967a614f5bd187406b..843ae07941e98d862c5983b862df8b8167118db7 100644 (file)
@@ -61,9 +61,8 @@ function file_init() {
        $item = ElggMenuItem::factory(array(
                'name' => 'file',
                'text' => elgg_echo('file'),
-               'section' => 'select',
+               'priority' => 10,
                'data' => array(
-                       'tab_type' => 'select',
                        'options' => array(
                                'type' => 'object',
                                'subtype' => 'file',
@@ -75,9 +74,8 @@ function file_init() {
        $item = ElggMenuItem::factory(array(
                'name' => 'file_upload',
                'text' => elgg_echo('file:upload'),
-               'section' => 'upload',
+               'priority' => 100,
                'data' => array(
-                       'tab_type' => 'upload',
                        'view' => 'embed/file_upload/content',
                ),
        ));
index a530b3194ea998ded29ada3c9350a73da1582bf8..4d3db0d97f85c5198d11344e56bbf589e1991358 100644 (file)
@@ -5,13 +5,9 @@
 
 $form_vars = array(
        'enctype' => 'multipart/form-data',
-       'class' => 'elgg-form',
+       'class' => 'elgg-form-embed',
 );
-$upload_content = elgg_view_form('file/upload', $form_vars);
-
-echo "<div class='embed-upload'>";
-echo $upload_content;
-echo "</div>";
+echo elgg_view_form('file/upload', $form_vars);
 
 // the tab we want to be forwarded to after upload is complete
 echo elgg_view('input/hidden', array(