diff options
-rw-r--r-- | mod/embed/embed.php | 35 | ||||
-rw-r--r-- | mod/embed/views/default/embed/link.php | 2 | ||||
-rw-r--r-- | mod/embed/views/default/embed/media.php | 66 | ||||
-rw-r--r-- | mod/embed/views/default/embed/pagination.php | 132 | ||||
-rw-r--r-- | mod/embed/views/default/embed/simpletype.php | 35 | ||||
-rw-r--r-- | mod/embed/views/default/embed/tabs.php | 22 | ||||
-rw-r--r-- | mod/embed/views/default/embed/upload.php | 86 |
7 files changed, 1 insertions, 377 deletions
diff --git a/mod/embed/embed.php b/mod/embed/embed.php deleted file mode 100644 index 09b3ac29b..000000000 --- a/mod/embed/embed.php +++ /dev/null @@ -1,35 +0,0 @@ -<?php -// This page can only be run from within the Elgg framework -if (!is_callable('elgg_view')) exit; - -// Get the name of the form field we need to inject into -$internalname = get_input('internalname'); - -if (!isloggedin()) exit; - -global $SESSION; - -$offset = (int) get_input('offset',0); -$simpletype = get_input('simpletype'); -$entity_types = array('object' => array('file')); - -if (empty($simpletype)) { - $count = elgg_get_entities(array('type' => 'object', 'subtype' => 'file', 'owner_guid' => $SESSION['user']->guid, 'count' => TRUE)); - $entities = elgg_get_entities(array('type' => 'object', 'subtype' => 'file', 'owner_guid' => $SESSION['user']->guid, 'limit' => 6, 'offset' => $offset)); -} else { - $count = elgg_get_entities_from_metadata(array('metadata_name' => 'simpletype', 'metadata_value' => $simpletype, 'types' => 'object', 'subtypes' => 'file', 'owner_guid' => $SESSION['user']->guid, 'limit' => 6, 'offset' => $offset, 'count' => TRUE)); - $entities = elgg_get_entities_from_metadata(array('metadata_name' => 'simpletype', 'metadata_value' => $simpletype, 'types' => 'object', 'subtypes' => 'file', 'owner_guid' => $SESSION['user']->guid, 'limit' => 6, 'offset' => $offset)); -} - -$types = get_tags(0, 10, 'simpletype', 'object', 'file', $SESSION['user']->guid); - -// Echo the embed view -echo elgg_view('embed/media', array( - 'entities' => $entities, - 'internalname' => $internalname, - 'offset' => $offset, - 'count' => $count, - 'simpletype' => $simpletype, - 'limit' => 6, - 'simpletypes' => $types, - )); diff --git a/mod/embed/views/default/embed/link.php b/mod/embed/views/default/embed/link.php index bd500dfaf..8776893ec 100644 --- a/mod/embed/views/default/embed/link.php +++ b/mod/embed/views/default/embed/link.php @@ -3,4 +3,4 @@ * 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 +<a class="longtext_control small link" href="<?php echo $vars['url'] . 'pg/embed'; ?>?internalname=<?php echo $vars['internalname']; ?>" rel="facebox"><?php echo elgg_echo('media:insert'); ?></a> diff --git a/mod/embed/views/default/embed/media.php b/mod/embed/views/default/embed/media.php deleted file mode 100644 index 381774618..000000000 --- a/mod/embed/views/default/embed/media.php +++ /dev/null @@ -1,66 +0,0 @@ -<h2 class="media_modal_title">Embed / Upload Media</h2> -<?php - - echo elgg_view('embed/tabs',array('tab' => 'media', 'internalname' => $vars['internalname'])); -?> - <div id="media_embed"> -<?php - echo elgg_view('embed/pagination',array( - 'offset' => $vars['offset'], - 'baseurl' => $vars['url'] . 'pg/embed/media?internalname=' . $vars['internalname'] . "&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='embed_instructions'>" . 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/pagination.php b/mod/embed/views/default/embed/pagination.php deleted file mode 100644 index ded9f21e1..000000000 --- a/mod/embed/views/default/embed/pagination.php +++ /dev/null @@ -1,132 +0,0 @@ -<?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; - } - - $baseurl = $vars['baseurl']; - - $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\">« ". 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($baseurl, 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") . " »</a>"; - - } - -?> -</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 deleted file mode 100644 index 790284fd8..000000000 --- a/mod/embed/views/default/embed/simpletype.php +++ /dev/null @@ -1,35 +0,0 @@ -<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 deleted file mode 100644 index a83bc9b55..000000000 --- a/mod/embed/views/default/embed/tabs.php +++ /dev/null @@ -1,22 +0,0 @@ -<?php - - $embedselected = ''; - $uploadselected = ''; - if ($vars['tab'] == 'media') { - $embedselected = 'class="embed_tab_selected"'; - } else { - $uploadselected = 'class="embed_tab_selected"'; - } - -?> - -<div id="embed_media_tabs" class="clearfloat"> - <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>
\ No newline at end of file diff --git a/mod/embed/views/default/embed/upload.php b/mod/embed/views/default/embed/upload.php deleted file mode 100644 index 5f249c0c7..000000000 --- a/mod/embed/views/default/embed/upload.php +++ /dev/null @@ -1,86 +0,0 @@ -<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'))); - -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> - <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"> - // 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 - -} - -?> |