Added : New Category System inc SQL updates
Added : Amplify Added : bootstrap and jQuery UI Added : Amlpify on front-end Added : Category iCons Updated : Admin Area Template
100
upload/admin_area/ajax/categories.php
Normal file
|
@ -0,0 +1,100 @@
|
|||
<?php
|
||||
|
||||
include("../../includes/admin_config.php");
|
||||
//Ajax categories...
|
||||
|
||||
$mode = post('mode');
|
||||
|
||||
switch($mode)
|
||||
{
|
||||
case "add_category":
|
||||
{
|
||||
$cid = $cbvid->add_category($_POST);
|
||||
//$cid = 18;
|
||||
if(error())
|
||||
{
|
||||
echo json_encode(array('err'=>error()));
|
||||
}else{
|
||||
$category = $cbvid->get_category($cid);
|
||||
assign('category',$category);
|
||||
|
||||
$category_template = Fetch('blocks/category.html');
|
||||
|
||||
echo json_encode(array('success'=>'yes','data'=>$category_template,'cid'=>$cid));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case "delete_category":
|
||||
{
|
||||
$cid = mysql_clean(post('cid'));
|
||||
|
||||
$cbvid->delete_category($cid);
|
||||
|
||||
if(error())
|
||||
{
|
||||
echo json_encode(array('err'=>error()));
|
||||
}else
|
||||
echo json_encodE(array('success'=>'yes'));
|
||||
}
|
||||
break;
|
||||
|
||||
case "make_default":
|
||||
{
|
||||
$cid = mysql_clean(post('cid'));
|
||||
$cbvid->make_default_category($cid);
|
||||
$name = post('name');
|
||||
if(error())
|
||||
{
|
||||
echo json_encode(array('err'=>error()));
|
||||
}else
|
||||
echo json_encodE(array('success'=>'yes',"msg"=>array("<strong>$name</strong> has been set as default")));
|
||||
}
|
||||
break;
|
||||
|
||||
case "edit_category":
|
||||
{
|
||||
$cid = mysql_clean(post('cid'));
|
||||
$category = $cbvid->get_category($cid);
|
||||
if($category)
|
||||
{
|
||||
assign('c',$category);
|
||||
$template = Fetch('blocks/edit-category.html');
|
||||
echo json_encode(array('success'=>'yes','template'=>$template,
|
||||
'title'=> loading_pointer(array('place'=>'save-category')).' '.$category['category_name']
|
||||
));
|
||||
|
||||
}else{
|
||||
echo json_encode(array('err'=>array('Unable to fetch category details')));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case "save_category":
|
||||
{
|
||||
$cbvid->update_category($_POST);
|
||||
if(error())
|
||||
{
|
||||
echo json_encode(array('err'=>error('single')));
|
||||
}else
|
||||
{
|
||||
echo json_encode(array('success'=>'yes','msg'=>array('Category has been updated successfully')));
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "update_order":
|
||||
{
|
||||
$cid = mysql_clean(post('cid'));
|
||||
$order = mysql_clean(post('order'));
|
||||
|
||||
$cbvid->update_cat_order($cid,$order);
|
||||
|
||||
if(error())
|
||||
echo json_encode (array('err'=>erro()));
|
||||
else
|
||||
echo json_encode(array('success'=>'yes'));
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -41,7 +41,7 @@ if(isset($_GET['delete_category'])){
|
|||
}
|
||||
|
||||
|
||||
$cats = $cbvid->get_categories();
|
||||
$cats = getCategoryList(array('type'=>'v'));
|
||||
$pid = $cbvid->get_category_field($_GET['category'],'parent_id');
|
||||
|
||||
if($pid)
|
||||
|
@ -62,12 +62,13 @@ if(isset($_POST['update_order']))
|
|||
}
|
||||
}
|
||||
|
||||
$cats = $cbvid->get_categories();
|
||||
$cats = getCategoryList(array('type'=>'v'));
|
||||
|
||||
|
||||
}
|
||||
|
||||
//Assing Category Values
|
||||
assign('category',$cats);
|
||||
assign('categories',$cats);
|
||||
assign('parent_cats',$parent_cats);
|
||||
assign('total',$cbvid->total_categories());
|
||||
|
||||
|
|
BIN
upload/admin_area/styles/cbv3/images/admin-gradients.png
Normal file
After Width: | Height: | Size: 968 B |
BIN
upload/admin_area/styles/cbv3/images/header-top-bg.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
upload/admin_area/styles/cbv3/images/logo-text.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
upload/admin_area/styles/cbv3/images/logo.png
Normal file
After Width: | Height: | Size: 5.6 KiB |
|
@ -1,16 +1,33 @@
|
|||
<script>
|
||||
var ajaxURL = baseurl+'/admin_area/ajax';
|
||||
|
||||
amplify.request.define( "update-sidebar", "ajax", {
|
||||
url: ajaxURL+"/widgets.php",
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
decoder: function( data, status, xhr, success, error ) {
|
||||
if ( status === "success" ) {
|
||||
success( data );
|
||||
} else {
|
||||
error( data );
|
||||
//Update sidebar
|
||||
amplify.request.define( "update-sidebar", "ajax", {
|
||||
url: ajaxURL+"/widgets.php",
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
decoder: function( data, status, xhr, success, error ) {
|
||||
if ( status === "success" ) {
|
||||
success( data );
|
||||
} else {
|
||||
error( data );
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
//Category Ajax Requests..
|
||||
amplify.request.define("categories","ajax",{
|
||||
url : ajaxURL+"/categories.php",
|
||||
type : "POST",
|
||||
dataType : "json",
|
||||
decode:function(data,status,xhr,success,error)
|
||||
{
|
||||
if(status==='success'){
|
||||
success(data);
|
||||
}else{
|
||||
error(data);
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
</script>
|
40
upload/admin_area/styles/cbv3/layout/blocks/category.html
Normal file
|
@ -0,0 +1,40 @@
|
|||
<div class="data-row category-{$category.category_id}" id="category-{$category.category_id}">
|
||||
<ul>
|
||||
<li class="index"><input type="checkbox" /></li>
|
||||
<li class="index">{$category.category_id}</li>
|
||||
<li class="option"><input type="text" style="width: 20px" value="{$category.category_order}" onchange="update_order('{$category.category_id}',$(this).val(),'category')"/></li>
|
||||
{$category_id = $category.category_id}
|
||||
<li class="text">{$prefix}{$category.category_name} {loading_pointer place="category-$category_id"}</li>
|
||||
<li class="action">
|
||||
<div class="btn-group">
|
||||
<button class="btn btn-mini">Options</button>
|
||||
<button class="btn btn-mini dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></button>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="javascript:void(0)" onclick="edit_category('{$category.category_id}')">Edit</a>
|
||||
<li><a href="javascript:void(0)" onclick="make_default('{$category.category_id}','{$category.category_name}')">Make Default</a></li>
|
||||
<li class="divider"></li>
|
||||
<li><a data-toggle="modal" data-target="#delete-category-{$category.category_id}" >
|
||||
<i class="icon-trash "></i> Delete Category</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
|
||||
<!-- Delete Confirmation Box -->
|
||||
<div id="delete-category-{$category.category_id}" title="Confirm Delete" class="modal hide fade">
|
||||
<div class="modal-header">
|
||||
<button class="close" data-dismiss="modal">×</button>
|
||||
<h3>Confirm Delete</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>You are about to delete <strong>{$category.category_name}</strong>, All items under this category will be moved to Default Category </p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a href="javascript:void(0)" class="btn" data-dismiss="modal">Cancel</a>
|
||||
<a href="javascript:void(0)" class="btn btn-primary"
|
||||
data-dismiss="modal"
|
||||
onclick="delete_category('{$category.category_id}')">Confirm</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
125
upload/admin_area/styles/cbv3/layout/blocks/edit-category.html
Normal file
|
@ -0,0 +1,125 @@
|
|||
|
||||
<fieldset>
|
||||
<input name="cid" value="{$c.category_id}" type="hidden" />
|
||||
<input name="cur_name" value="{$c.category_name}" type="hidden" />
|
||||
<!-- Category Title -->
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="name">Category Name</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="input-xlarge" id="name" name="name" value="{$c.category_name}">
|
||||
</div>
|
||||
</div>
|
||||
<!-- Category Description -->
|
||||
<div class="control-group">
|
||||
<label class="desc" for="input01">Description</label>
|
||||
<div class="controls">
|
||||
<textarea class="input-xlarge" id="desc" name="desc" value="">{$c.category_desc}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Category Description -->
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="parent_cat">Parent</label>
|
||||
<div class="controls">
|
||||
{cbCategories output="dropdown" name="parent_cat" id="parent_cat" blank_option=TRUE echo=TRUE type="video" selected=$c.parent_id}
|
||||
</div>
|
||||
</div>
|
||||
<!-- Make Category default -->
|
||||
<div class="control-group">
|
||||
<label class="control-label">Make Default</label>
|
||||
<div class="controls">
|
||||
<label class="radio inline ">
|
||||
<input type="radio" name="default" id="make-default-yes" value="yes" {if $c.isdefault=='yes'} checked="checked"{/if} >
|
||||
Yes
|
||||
</label>
|
||||
<label class="radio inline ">
|
||||
<input type="radio" name="default" id="make-default-no" value="no" {if $c.isdefault!='yes'} checked="checked"{/if} >
|
||||
No
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Choosing Category iCon -->
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="parent_cat">Category icon</label>
|
||||
<div class="controls">
|
||||
<input type="hidden" value="{$c.category_icon}" name="icon" id="icon" />
|
||||
{$icons=get_category_icons()}
|
||||
|
||||
|
||||
|
||||
<div class="thumbnail" style="display: inline-block; vertical-align: middle">
|
||||
<img src="{$cbvid->get_icon($c)}" alt="" id="cat-icon-img">
|
||||
</div>
|
||||
<button class="btn" onclick="$(this).next().toggle(); return false"> Change Icon </button>
|
||||
|
||||
<div style="margin-top: 10px; display: none">
|
||||
{if $icons}
|
||||
<ul class="thumbnails">
|
||||
{foreach $icons as $name => $icon}
|
||||
<li style="display: inline-block; ">
|
||||
<a href="javscript:void(0);" ref="{$name}"
|
||||
data-url="{$icon.url}"
|
||||
class="thumbnail" style="min-width: 24px; min-height: 24px"
|
||||
data-dismiss="modal" onclick="$('#icon').val($(this).attr('ref'));
|
||||
$('#cat-icon-img').attr('src',$(this).attr('data-url'))">
|
||||
<img src="{$icon.url}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Category Thumb -->
|
||||
<div class="control-group">
|
||||
<label class="control-label">Category Thumb</label>
|
||||
|
||||
|
||||
<div class="controls">
|
||||
|
||||
<div class="span2" style="width: 160px; margin-left: 0px;">
|
||||
<div id="file-thumb-{$c.category_id}" class="thumbnail">
|
||||
<img src="{$cbvid->get_category_thumb($c)}"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix" style="margin-bottom: 10px"></div>
|
||||
<span class="btn btn-mini fileinput-button" style="width: 140px; text-align: center">
|
||||
<span>Select thumb</span>
|
||||
<input id="fileupload-{$c.category_id}" type="file" name="files[]" multiple data-url="{$baseurl}/admin_area/uploader/server/php/index.php" data-sequential-uploads="true">
|
||||
</span>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix" style="margin-bottom: 10px"></div>
|
||||
<script>
|
||||
|
||||
|
||||
|
||||
$('#fileupload-{$c.category_id}').change(function(e){
|
||||
|
||||
var result = $('#file-thumb-{$c.category_id}');
|
||||
e = e.originalEvent;
|
||||
e.preventDefault();
|
||||
window.loadImage(
|
||||
(e.dataTransfer || e.target).files[0],
|
||||
function (img) {
|
||||
result.children().replaceWith(img);
|
||||
},
|
||||
{
|
||||
maxWidth: result.children().outerWidth(),
|
||||
canvas: true
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
</fieldset>
|
||||
|
|
@ -4,39 +4,32 @@
|
|||
|
||||
<!-- Including Commong header -->
|
||||
{include file="$style_dir/header.html" }
|
||||
{include file="$style_dir/msg.html" }
|
||||
|
||||
<div style="">
|
||||
|
||||
{if $smarty.cookies.admin_menu=='hide'}
|
||||
{assign var='left_menu_class' value='left_menu_0'}
|
||||
{assign var='contentcolumn_class' value='contentcolumn0'}
|
||||
{else}
|
||||
{assign var='left_menu_class' value='left_menu'}
|
||||
{assign var='contentcolumn_class' value='contentcolumn'}
|
||||
{/if}
|
||||
|
||||
<div class="clearfix"></div>
|
||||
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row-fluid">
|
||||
<div class="span200">
|
||||
{include file="$style_dir/left_menu.html" }
|
||||
</div>
|
||||
<div class="span9">
|
||||
|
||||
<!-- The Content -->
|
||||
<div class="content-container">
|
||||
<div class="content">
|
||||
{include file="$style_dir/msg.html" }
|
||||
|
||||
{if $Cbucket->show_page}
|
||||
{foreach from=$template_files item=file}
|
||||
{include_template_file file=$file}
|
||||
{/foreach}
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="left-column">
|
||||
{include file="$style_dir/left_menu.html" }
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="clearfix"></div>
|
||||
{include file="$style_dir/footer.html" }
|
||||
</body>
|
||||
|
|
|
@ -1,179 +1,183 @@
|
|||
<span class="page_title">Video Categories</span>
|
||||
<h3>Categories Manager</h3>
|
||||
|
||||
|
||||
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td width="200" align="left" valign="middle" class="left_head" style="text-indent:10px">Manage Video Categories</td>
|
||||
<td class="head"> </td>
|
||||
<td width="100" class="right_head"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
{if $edit_category != "show"}
|
||||
<form action="category.php" method="post" enctype="multipart/form-data" name="add_category" id="Add Category">
|
||||
|
||||
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="block">
|
||||
<tr>
|
||||
<td class="td_body"> </td>
|
||||
<td align="right" class="td_body">* are required fields</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" class="td_body">Category Name*</td>
|
||||
<td class="td_body"><label>
|
||||
<input name="name" type="text" id="name" value="{'name'|post_form_val}" size="45" />
|
||||
</label></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" class="td_body">Category Description*</td>
|
||||
<td class="td_body"><textarea name="desc" id="desc" cols="33" rows="5">{'desc'|post_form_val}</textarea></td>
|
||||
</tr>
|
||||
{assign var=useSubs value=func->config(use_subs)}
|
||||
{if $useSubs == 1}
|
||||
<tr>
|
||||
<td valign="top" class="td_body">Parent Category</td>
|
||||
<td class="td_body">
|
||||
{cbCategories output="dropdown" name="parent_cat" id="parent_cat" blank_option=TRUE echo=TRUE type="video"}
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
<tr>
|
||||
<td valign="top" class="td_body">Make Default Category</td>
|
||||
<td class="td_body"><p>
|
||||
<label>
|
||||
<input type="radio" name="default" value="yes" id="default_0" />
|
||||
Yes</label>
|
||||
<label>
|
||||
<input name="default" type="radio" id="default_1" value="no" checked="checked" />
|
||||
No</label>
|
||||
<br />
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="td_body">Category Thumb</td>
|
||||
<td align="left" class="td_body"><label for="cat_thumb"></label>
|
||||
<input type="file" name="cat_thumb" id="cat_thumb" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="td_body"> </td>
|
||||
<td align="right" class="td_body"><input type="submit" name="add_cateogry" id="button" value="Add Category" onclick="return validate_category_form(add_category)" class="button"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
{/if}
|
||||
{if $edit_category == "show"}
|
||||
<form action="" method="post" enctype="multipart/form-data" name="edit_category" id="Edit Category">
|
||||
<input name="cid" value="{$cat_details.category_id}" type="hidden" />
|
||||
<input name="cur_name" value="{$cat_details.category_name}" type="hidden" />
|
||||
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="block">
|
||||
|
||||
<tr>
|
||||
<td class="td_body"> </td>
|
||||
<td align="right" class="td_body">* are required fields</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" class="td_body">Category Name*</td>
|
||||
<td class="td_body"><label>
|
||||
<input name="name" type="text" id="name" value="{$cat_details.category_name}" size="45" />
|
||||
</label></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" class="td_body">Category Description*</td>
|
||||
<td class="td_body"><textarea name="desc" id="desc" cols="33" rows="5">{$cat_details.category_desc}</textarea></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" class="td_body">Parent Category</td>
|
||||
<td class="td_body">
|
||||
{cbCategories output="dropdown" selected=$cat_details.parent_id name="parent_cat" id="parent_cat" blank_option=TRUE type="video" echo=TRUE}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" class="td_body">Make Default Category</td>
|
||||
<td class="td_body"><p>
|
||||
<label>
|
||||
<input type="radio" name="default" value="yes" id="default_0" {if $cat_details.isdefault=='yes'} checked="checked"{/if} />
|
||||
Yes</label>
|
||||
<label>
|
||||
<input name="default" type="radio" id="default_1" value="no" {if $cat_details.isdefault=='no'} checked="checked"{/if} />
|
||||
No</label>
|
||||
<br />
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="td_body">Category Thumb</td>
|
||||
<td class="td_body"><label>
|
||||
<input type="file" name="cat_thumb" id="cat_thumb" />
|
||||
</label></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right" class="tr_head"><label>
|
||||
<input type="submit" name="update_category" id="button" value="Update Category" onclick="return validate_category_form(edit_category)" class="button"/>
|
||||
</label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
{/if}
|
||||
|
||||
|
||||
<div style="margin:10px 0px 10px 0px">
|
||||
<span class="page_title">Category List</span>
|
||||
</div>
|
||||
|
||||
{if $total != 0}
|
||||
<form name="category" action="?update_order" method="post">
|
||||
<table width="100%" border="0" align="left" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td width="225" class="left_head" style="text-indent:10px">Category Name</td>
|
||||
<td width="75" align="left" class="head">Order</td>
|
||||
<td width="225" align="left" class="head">Parent Category</td>
|
||||
<td width="250" class="head">Description</td>
|
||||
<td width="100" class="head">Default</td>
|
||||
<td width="150" class="head">Action</td>
|
||||
<td width="20" align="left" class="right_head"> </td>
|
||||
</tr>
|
||||
{assign var = bgcolor value = ""}
|
||||
{section name=list loop=$category}
|
||||
<script type="text/javascript">
|
||||
cat_div = "#thumbs_{$category[list].category_id}";
|
||||
{literal}
|
||||
$(function() { {/literal}
|
||||
$("#thumbs_{$category[list].category_id}").tooltip({literal}{showURL: false,delay: 0});
|
||||
});
|
||||
{/literal}
|
||||
</script>
|
||||
<tr bgcolor="{$bgcolor}" class="item_listing">
|
||||
<td style="text-indent:10px">{$category[list].category_name} - <a id="thumbs_{$category[list].category_id}" title="<img src='{$cbvid->get_category_thumb($category[list])}' />" href="javascript:void(0)">View Thumb</a></td>
|
||||
<td >
|
||||
<input name="category_order_{$category[list].category_id}" type="text" id="order" style="border:1px solid #999; padding:2px; width:30px" value="{$category[list].category_order}" size="5" maxlength="5" /></td>
|
||||
{if $category[list].parent_id == "0"}
|
||||
{assign var=p_name value="None"}
|
||||
{else}
|
||||
{assign var=p_name value=$cbvid->get_category_field($category[list].parent_id,'category_name')}
|
||||
{/if}
|
||||
<td>{$p_name}</td>
|
||||
<td>{if $category[list].category_desc}{$category[list].category_desc}{else}<em>N/A</em>{/if}</td>
|
||||
<td>{$category[list].isdefault}</td>
|
||||
<td>
|
||||
<li><a href="?category={$category[list].category_id}">Edit</a></li>
|
||||
<li><a href="javascript:Confirm_Delete('?delete_category={$category[list].category_id}')">Delete</a></li>
|
||||
{if $category[list].isdefault!="yes"}<li><a href="?make_default={$category[list].category_id}">Make Default</a></li>{/if}
|
||||
</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
{if $bgcolor == ""}
|
||||
{assign var = bgcolor value = "#EEEEEE"}
|
||||
{else}
|
||||
{assign var = bgcolor value = ""}
|
||||
{/if}
|
||||
<div style="width: 400px" class="pull-left">
|
||||
<div style="padding-right: 15px">
|
||||
<form class="form-vertical form-basic" enctype="multipart/form-data" id="add-category" method="post">
|
||||
<fieldset>
|
||||
<!-- Category Title -->
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="name">Category Name</label>
|
||||
<div class="controls">
|
||||
<input type="text" class="input-xlarge" id="name" name="name">
|
||||
</div>
|
||||
</div>
|
||||
<!-- Category Description -->
|
||||
<div class="control-group">
|
||||
<label class="desc" for="input01">Description</label>
|
||||
<div class="controls">
|
||||
<textarea class="input-xlarge" id="desc" name="desc"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Category Description -->
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="parent_cat">Parent</label>
|
||||
<div class="controls">
|
||||
{cbCategories output="dropdown" name="parent_cat" id="parent_cat" blank_option=TRUE echo=TRUE type="video"}
|
||||
</div>
|
||||
</div>
|
||||
<!-- Make Category default -->
|
||||
<div class="control-group">
|
||||
<label class="control-label">Make Default</label>
|
||||
<div class="controls">
|
||||
<label class="radio inline ">
|
||||
<input type="radio" name="default" id="make-default-yes" value="yes" checked="">
|
||||
Yes
|
||||
</label>
|
||||
<label class="radio inline ">
|
||||
<input type="radio" name="default" id="make-default-no" value="no">
|
||||
No
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Choosing Category iCon -->
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="parent_cat">Category icon</label>
|
||||
<div class="controls">
|
||||
<input type="hidden" value="" name="icon" id="icon"/>
|
||||
{$icons=get_category_icons()}
|
||||
|
||||
|
||||
|
||||
<div class="thumbnail" style="display: inline-block; vertical-align: middle">
|
||||
<img src="{$baseurl}/images/category-icons/default.png" alt="" id="cat-icon-img">
|
||||
</div>
|
||||
<button class="btn" data-toggle="modal" data-target="#cat-icons-modal" > Change Icon </button>
|
||||
|
||||
|
||||
<div class="modal hide fade" id="cat-icons-modal" >
|
||||
<div class="modal-header">
|
||||
<button class="close" data-dismiss="modal">×</button>
|
||||
<h3>Choose icon</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
{/section}
|
||||
|
||||
</table>
|
||||
{if $icons}
|
||||
<ul class="thumbnails">
|
||||
{foreach $icons as $name => $icon}
|
||||
<li style="display: inline-block; ">
|
||||
<a href="javscript:void(0);" ref="{$name}"
|
||||
data-url="{$icon.url}"
|
||||
class="thumbnail" style="min-width: 24px; min-height: 24px"
|
||||
data-dismiss="modal" onclick="$('#icon').val($(this).attr('ref'));
|
||||
$('#cat-icon-img').attr('src',$(this).attr('data-url'))">
|
||||
<img src="{$icon.url}" alt="">
|
||||
</a>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Category Thumb -->
|
||||
<div class="control-group">
|
||||
<label class="control-label">Category Thumb</label>
|
||||
|
||||
|
||||
<div><input type="submit" value="Update" name="update_order" class="button" style="margin-top:10px"/></div>
|
||||
</form>
|
||||
<div class="controls">
|
||||
|
||||
{else}
|
||||
No Category Has Been Created Yet
|
||||
{/if}
|
||||
<div class="span2" style="width: 160px; margin-left: 0px;">
|
||||
<div id="file-thumb" class="thumbnail">
|
||||
<img src="{$cbvid->default_thumb()}"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix" style="margin-bottom: 10px"></div>
|
||||
<span class="btn btn-mini fileinput-button" style="width: 140px; text-align: center">
|
||||
<span>Select thumb</span>
|
||||
<input id="fileupload" type="file" name="files[]" multiple data-url="{$baseurl}/admin_area/uploader/server/php/index.php" data-sequential-uploads="true">
|
||||
</span>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix" style="margin-bottom: 10px"></div>
|
||||
<script>
|
||||
|
||||
|
||||
|
||||
$('#fileupload').change(function(e){
|
||||
|
||||
var result = $('#file-thumb');
|
||||
e = e.originalEvent;
|
||||
e.preventDefault();
|
||||
window.loadImage(
|
||||
(e.dataTransfer || e.target).files[0],
|
||||
function (img) {
|
||||
result.children().replaceWith(img);
|
||||
},
|
||||
{
|
||||
maxWidth: result.children().outerWidth(),
|
||||
canvas: true
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<div class="form-actions">
|
||||
<button type="button" class="btn btn-primary" onclick="add_category();"><i class="icon-plus icon-white"></i> Add Category</button>
|
||||
{loading_pointer place='add-category'}
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div style="width: 530px" class="pull-left">
|
||||
<div>
|
||||
|
||||
<div class="well well-compact" id="categories-list">
|
||||
<div class="data-row">
|
||||
<ul>
|
||||
<li class="index"><input type="checkbox"/></li>
|
||||
<li class="index">ID</li>
|
||||
<li class="option">Order</li>
|
||||
<li class="text">Title</li>
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
|
||||
{list_admin_categories($categories)}
|
||||
</div>
|
||||
|
||||
<div class="modal hide fade" id="edit-category-modal">
|
||||
<div class="modal-header">
|
||||
<button class="close" data-dismiss="modal">×</button>
|
||||
<h3>Modal header</h3>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
<form class="form-basic form-vertical" enctype="multipart/form-data" id="edit-category" method="post">
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<div class="pull-left update-message " align="left"></div>
|
||||
<div class="pull-right">
|
||||
<a href="javascript:void(0)" class="btn" data-dismiss="modal">Close</a>
|
||||
|
||||
<a href="javascript:void(0)" class="btn btn-primary" onclick="save_category();" id="save-category-button">Save changes</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
|
@ -1,7 +1,20 @@
|
|||
<div style="height:10px"></div>
|
||||
<div class="footer_grey_bar">
|
||||
<img src="{$imageurl}/dot.gif" class="cbicon" /> Thanks for using ClipBucket | © Copyright 2007 – {$smarty.now|date_format:"%Y"}
|
||||
<div style="float:right" align="right">
|
||||
<em>{$Cbucket->cbinfo.version}</em>| <a href="http://forums.clip-bucket.com/">Forums</a> | <a href="http://clip-bucket.com/arslan-hassan">Arslan Hassan</a> | <a href="http://docs.clip-bucket.com/">Docs</a> | <a href="http://www.opensource.org/licenses/attribution.php">Attribution Assurance License</a></div>
|
||||
|
||||
</div>
|
||||
<footer>
|
||||
<ul>
|
||||
<li class="logo">
|
||||
<img src="{$imageurl}/logo.png"/>
|
||||
</li>
|
||||
<li class="version">You are using ClipBucket <strong>{$Cbucket->cbinfo.version}</strong></li>
|
||||
|
||||
<li class="links pull-right">
|
||||
<span>Help & Support</span>
|
||||
<span>Documentation</span>
|
||||
<span>Discussion Forums</span>
|
||||
<span>Client area</span>
|
||||
</li>
|
||||
<li class="team pull-right">
|
||||
Designed using Twitter Bootstrap and Galphicons<br>
|
||||
By Arslan Hassan & Fawaz Tahir
|
||||
</li>
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
</footer>
|
|
@ -1,4 +1,32 @@
|
|||
|
||||
|
||||
/**
|
||||
*Function used to display an error message popup box
|
||||
*/
|
||||
function displayError(err)
|
||||
{
|
||||
$('#error .modal-body p').html('');
|
||||
|
||||
$.each(err,function(index,data){
|
||||
$('#error .modal-body p').append(data+'<br />');
|
||||
})
|
||||
$('#error').modal('show');
|
||||
}
|
||||
|
||||
/**
|
||||
*Function used to display an error message popup box
|
||||
*/
|
||||
function displayMsg(msg)
|
||||
{
|
||||
$('#msg .modal-body p').html('');
|
||||
|
||||
$.each(msg,function(index,data){
|
||||
$('#msg .modal-body p').append(data+'<br />');
|
||||
})
|
||||
$('#msg').modal('show');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* toggles the sidebar for widgets
|
||||
* @param object
|
||||
|
@ -128,4 +156,171 @@ function deleteWidget($widgetId,$sidebarId){
|
|||
saveSidebar($sidebarId);
|
||||
$('#'+$widgetId+'-'+$sidebarId+'-modal').modal('hide').remove();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add Category..
|
||||
*/
|
||||
function add_category()
|
||||
{
|
||||
var formData = $('#add-category').serialize();
|
||||
formData += '&mode=add_category';
|
||||
|
||||
loading('add-category');
|
||||
amplify.request("categories",formData,
|
||||
function(data){
|
||||
if(data.err)
|
||||
{
|
||||
displayError(data.err);
|
||||
}else if(data.data)
|
||||
{
|
||||
$('#categories-list').append(data.data);
|
||||
$('#category-'+data.cid).hide().fadeIn('slow');
|
||||
loading('add-category','hide');
|
||||
scrollTo('#category-'+data.cid);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Scroll to an elemet
|
||||
*/
|
||||
function scrollTo($element){
|
||||
$('html, body').animate({
|
||||
scrollTop: $($element).offset().top
|
||||
}, 'fast');
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete category
|
||||
* @param cid STRING
|
||||
*/
|
||||
function delete_category(cid)
|
||||
{
|
||||
amplify.request("categories",{cid : cid,'mode' : 'delete_category'},
|
||||
function(data){
|
||||
if(data.err)
|
||||
{
|
||||
displayError(data.err);
|
||||
}else
|
||||
{
|
||||
$('#category-'+cid).fadeOut();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Make Default
|
||||
* @param cid STRING
|
||||
*/
|
||||
function make_default(cid,category_name)
|
||||
{
|
||||
amplify.request("categories",{cid : cid,'mode' : 'make_default','name':category_name},
|
||||
function(data){
|
||||
if(data.err)
|
||||
{
|
||||
displayError(data.err);
|
||||
}else
|
||||
{
|
||||
displayMsg(data.msg)
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* function used to hide or show loading pointer
|
||||
*
|
||||
*/
|
||||
function loading_pointer(ID,toDo)
|
||||
{
|
||||
var pointer = $('#'+ID+'-loader');
|
||||
|
||||
if(toDo=='hide')
|
||||
{
|
||||
pointer.hide();
|
||||
}
|
||||
else{
|
||||
pointer.show();
|
||||
}
|
||||
}
|
||||
function loading(ID,ToDo)
|
||||
{
|
||||
return loading_pointer(ID,ToDo)
|
||||
}
|
||||
|
||||
/**
|
||||
* edit category...
|
||||
*/
|
||||
function edit_category(id)
|
||||
{
|
||||
|
||||
amplify.request("categories",{'mode' : 'edit_category',cid:id},
|
||||
function(data){
|
||||
if(data.success)
|
||||
{
|
||||
$('#edit-category-modal .form-basic').html(data.template);
|
||||
$('#edit-category-modal h3').html(data.title);
|
||||
$('#edit-category-modal .update-message').html('');
|
||||
$('#edit-category-modal').modal('show');
|
||||
}else
|
||||
if(data.err)
|
||||
displayError(data.err);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change Category
|
||||
* @param id INT
|
||||
*/
|
||||
function save_category(id)
|
||||
{
|
||||
$('#save-category-button').addClass('disable');
|
||||
loading('save-category');
|
||||
|
||||
var formData = $('#edit-category').serialize();
|
||||
formData += '&mode=save_category';
|
||||
|
||||
amplify.request("categories",formData,
|
||||
function(data){
|
||||
if(data.err)
|
||||
$('#edit-category-modal .update-message').html('<div class="alert alert-danger">'+data.err+'</div>')
|
||||
else
|
||||
$('#edit-category-modal .update-message').html('<div class="alert alert-success">'+data.msg+'</div>')
|
||||
loading('save-category','hide');
|
||||
$('#save-category-button').removeClass('disable');
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update Order
|
||||
*
|
||||
* @param id INT
|
||||
* @param order INT
|
||||
* @param type STRING
|
||||
*/
|
||||
function update_order(id,order,type)
|
||||
{
|
||||
if(type=='category')
|
||||
var amplify_type = 'categories';
|
||||
|
||||
loading(type+'-'+id);
|
||||
|
||||
amplify.request(amplify_type,{"mode":"update_order","cid":id,'order':order},
|
||||
function(data){
|
||||
if(data.err)
|
||||
displayError(data.err);
|
||||
loading(type+'-'+id,"hide");
|
||||
}
|
||||
);
|
||||
}
|
|
@ -130,6 +130,15 @@ $(document).ready(function(){
|
|||
<link rel="stylesheet" href="{$theme}/default.css" type="text/css" media="all" />
|
||||
|
||||
|
||||
<!-- Including File Uploader -->
|
||||
<script src="{$baseurl}/admin_area/uploader/js/vendor/jquery.ui.widget.js"></script>
|
||||
<script src="{$baseurl}/admin_area/uploader/js/jquery.iframe-transport.js"></script>
|
||||
<script src="{$baseurl}/admin_area/uploader/js/jquery.fileupload.js"></script>
|
||||
<script src="{$baseurl}/admin_area/uploader/js/load-image.min.js"></script>
|
||||
<script src="{$baseurl}/admin_area/uploader/js/jquery.fileupload-fp.js"></script>
|
||||
<script src="{$baseurl}/admin_area/uploader/js/jquery.fileupload-ui.js"></script>
|
||||
<!-- The localization script -->
|
||||
<link rel="stylesheet" href="{$baseurl}/admin_area/uploader/css/jquery.fileupload-ui.css" type="text/css" media="all" />
|
||||
|
||||
<!-- Including JS HTML file -->
|
||||
{include file="$layout_dir/javascript.html"}
|
||||
|
|
|
@ -1,23 +1,52 @@
|
|||
<div class="header_grey_bar">
|
||||
<img src="{$imageurl}/dot.gif" class="cbicon" />{$title}
|
||||
<div class="welcome" style="float:right">
|
||||
Hello {$userquery->username} <a href="logout.php"><img src="{$imageurl}/dot.gif" border="0" class="logout_button" /></a>
|
||||
</div>
|
||||
</div>
|
||||
<header>
|
||||
<!-- Error Modal Box -->
|
||||
<div class="modal hide" id="error">
|
||||
<div class="modal-header">
|
||||
<button class="close" data-dismiss="modal">×</button>
|
||||
<h3>Error</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
<p class="alert alert-error"></p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a href="javascript:void(0)" class="btn btn-danger" data-dismiss="modal">Dismiss</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="header_menu clearfix">
|
||||
<ul>
|
||||
<li><a href="{$baseurl}/admin_area">{$userquery->permission.user_level_name} Home</a></li>
|
||||
<li><a href="{$baseurl}">Website Home</a></li>
|
||||
</ul>
|
||||
<div class="dp_opts"><a href="javascript:void(0)" onclick="$('#dp_opts').slideToggle()">Display Options</a></div>
|
||||
</div>
|
||||
<div class="header_menu_after">
|
||||
<div id="dp_opts">
|
||||
<form id="display_opts" name="display_opts" method="post" action="">
|
||||
Results Per Page :
|
||||
<input name="admin_pages" type="text" style="width:50px" value="{$Cbucket->configs.admin_pages}"/>
|
||||
<input type="submit" name="update_dp_options" id="button" value="Update" class="button"/>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="header-top">
|
||||
<div class="logo">
|
||||
<div class="logo-text">Hello World</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="header-bottom">
|
||||
<ul>
|
||||
<li>Admin Home</li>
|
||||
<li>Website Home</li>
|
||||
</ul>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- Msg Modal Box -->
|
||||
<div class="modal hide" id="msg">
|
||||
<div class="modal-header">
|
||||
<button class="close" data-dismiss="modal">×</button>
|
||||
<h3>Success</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
<p class="alert alert-success"></p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a href="javascript:void(0)" class="btn btn-info" data-dismiss="modal">Dismiss</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</header>
|
|
@ -83,7 +83,10 @@
|
|||
//Init the modal
|
||||
$('.modal').modal({
|
||||
show : false
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
//Hiding Pointers
|
||||
//$('.loading_pointer').hide();
|
||||
})
|
||||
</script>
|
|
@ -193,7 +193,7 @@ $(document).ready(function(){
|
|||
<td>Default Time Zone</td>
|
||||
<td>
|
||||
<select name="default_time_zone" id="default_time_zone">
|
||||
{assign var='tzs' value=func->get_time_zones()}
|
||||
{assign var='tzs' value=get_time_zones()}
|
||||
{foreach from=$tzs item=name key=tz}
|
||||
<option value="{$tz}" {if $row.default_time_zone==$tz} selected="selected"{/if}>{$name}</option>
|
||||
{/foreach}
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
.sidebar-nav{
|
||||
padding: 9px 0px;
|
||||
margin-left: -5px;
|
||||
}
|
||||
|
||||
.row-fluid .span150, .span150{width: 150px}
|
||||
|
@ -45,14 +46,22 @@
|
|||
.icon-settings {background-position: -336px -0px;}
|
||||
.icon-plugins {background-position: -360px -0px;}
|
||||
|
||||
|
||||
.icon-v3 {
|
||||
background-image: url("../images/v3icons.png");
|
||||
}
|
||||
|
||||
|
||||
.icon-v3-white {
|
||||
background-image: url("../images/v3icons-white.png");
|
||||
}
|
||||
|
||||
.left-column{ margin-top: 10px; position: relative;
|
||||
width: 200px;margin-left: -100%;z-index:2; float: left}
|
||||
.left-column .nav-list{ margin-left: 5px}
|
||||
|
||||
.content-container{margin-top: 10px; width: 100%; float: left;z-index:1;}
|
||||
.content{margin-left: 220px; padding-right: 10px}
|
||||
|
||||
/* Side Bars */
|
||||
.admin-sidebars{ width: 270px; padding: 10px; margin: 10px}
|
||||
|
@ -76,4 +85,53 @@
|
|||
.drop-widget-area{background-color: #f9f9f9;
|
||||
padding:5px; border:1px dashed #ccc}
|
||||
|
||||
.widgets-list{padding: 5px 0px;}
|
||||
.widgets-list{padding: 5px 0px;}
|
||||
|
||||
/* Header */
|
||||
.header-top{height: 63px; background-color: #1b1b1b }
|
||||
.header-top .logo{background-image: url(../images/header-top-bg.png); height: 62px; min-width: 388px;
|
||||
background-repeat: no-repeat; font-size: 28px; color: #fff; padding-left:90px; line-height: 58px}
|
||||
|
||||
@media screen and (-webkit-min-device-pixel-ratio:0){
|
||||
.header-top .logo-text{
|
||||
background: url(../images/logo-text.png);
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent; background-position: 0px 17px
|
||||
}
|
||||
}
|
||||
|
||||
.header-bottom{background-color: #363636}
|
||||
.header-bottom ul{margin: 0px; padding: 0px;}
|
||||
.header-bottom ul li{float: left; display: inline-block; border-right: 1px solid #222;
|
||||
border-left: 1px solid #4b4b4b; padding: 5px 10px; color: #fff; font-size: 11px; font-weight: bold}
|
||||
|
||||
footer{background-color:#161616; padding: 0px 0px}
|
||||
footer ul{padding: 0px; margin: 0px;}
|
||||
footer ul li{padding: 0px; margin: 0px; list-style: none;border-right: 1px solid #2c2c2c;
|
||||
border-left: 1px solid #060606; padding: 15px 20px; float: left; height: 30px; color:#fff; vertical-align: middle; }
|
||||
footer ul li.version{font-size: 13px; margin-top: 5px; border-right: none}
|
||||
footer ul li.links{ width: 270px; border-right: none}
|
||||
footer ul li span{float: left; width: 120px; margin-right: 10px; font-size: 11px}
|
||||
footer ul li.team{font-size:11px; text-align: center; border-left: none}
|
||||
|
||||
|
||||
/* Forms */
|
||||
.form-basic{margin-top: 15px}
|
||||
.form-basic label{font-size: 12px; color: #666; font-weight: bold}
|
||||
|
||||
/* Data rows */
|
||||
.data-row{ border-bottom:1px solid #e5e5e5; border-top:1px solid #fff; padding: 10px 0px }
|
||||
.data-row:first-child{border-top:0px;}
|
||||
.data-row:last-child{border-bottom: 0px}
|
||||
.data-row > ul{padding: 0px; margin: 0px}
|
||||
.data-row > ul > li{padding: 0px; margin: 0px; list-style: none; float: left; padding-right: 10px;
|
||||
font-weight: bold; font-size: 12px; color: #626262}
|
||||
.data-row > ul > li.index{width: 35px;}
|
||||
.data-row > ul > li.option{width: 40px}
|
||||
.data-row > ul > li.text{width: 250px}
|
||||
.data-row > ul > li.action{width:70px; float: right; padding-right: 0px}
|
||||
.data-row input{margin-bottom: 0px; padding: 0px 4px}
|
||||
|
||||
.well-compact{padding: 10px}
|
||||
|
||||
.loading_pointer{ vertical-align: middle; display: none}
|
84
upload/admin_area/uploader/css/jquery.fileupload-ui.css
Normal file
|
@ -0,0 +1,84 @@
|
|||
@charset 'UTF-8';
|
||||
/*
|
||||
* jQuery File Upload UI Plugin CSS 6.3
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2010, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
.fileinput-button {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
float: left;
|
||||
margin-right: 4px;
|
||||
}
|
||||
.fileinput-button input {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
margin: 0;
|
||||
border: solid transparent;
|
||||
border-width: 0 0 100px 200px;
|
||||
opacity: 0;
|
||||
filter: alpha(opacity=0);
|
||||
-moz-transform: translate(-300px, 0) scale(4);
|
||||
direction: ltr;
|
||||
cursor: pointer;
|
||||
}
|
||||
.fileupload-buttonbar .btn,
|
||||
.fileupload-buttonbar .toggle {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.files .progress {
|
||||
width: 200px;
|
||||
}
|
||||
.progress-animated .bar {
|
||||
background: url(../img/progressbar.gif) !important;
|
||||
filter: none;
|
||||
}
|
||||
.fileupload-loading {
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
width: 128px;
|
||||
height: 128px;
|
||||
background: url(../img/loading.gif) center no-repeat;
|
||||
display: none;
|
||||
}
|
||||
.fileupload-processing .fileupload-loading {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* Fix for IE 6: */
|
||||
*html .fileinput-button {
|
||||
line-height: 22px;
|
||||
margin: 1px -3px 0 0;
|
||||
}
|
||||
|
||||
/* Fix for IE 7: */
|
||||
*+html .fileinput-button {
|
||||
margin: 1px 0 0 0;
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.files .btn span {
|
||||
display: none;
|
||||
}
|
||||
.files .preview * {
|
||||
width: 40px;
|
||||
}
|
||||
.files .name * {
|
||||
width: 80px;
|
||||
display: inline-block;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
.files .progress {
|
||||
width: 20px;
|
||||
}
|
||||
.files .delete {
|
||||
width: 60px;
|
||||
}
|
||||
}
|
15
upload/admin_area/uploader/css/style.css
Normal file
|
@ -0,0 +1,15 @@
|
|||
@charset 'UTF-8';
|
||||
/*
|
||||
* jQuery File Upload Plugin CSS Example 1.0
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2012, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
body{
|
||||
padding-top: 60px;
|
||||
}
|
BIN
upload/admin_area/uploader/img/loading.gif
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
upload/admin_area/uploader/img/progressbar.gif
Normal file
After Width: | Height: | Size: 3.2 KiB |
|
@ -0,0 +1,117 @@
|
|||
/*
|
||||
* jQuery postMessage Transport Plugin 1.1
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2011, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/*jslint unparam: true, nomen: true */
|
||||
/*global define, window, document */
|
||||
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define(['jquery'], factory);
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(window.jQuery);
|
||||
}
|
||||
}(function ($) {
|
||||
'use strict';
|
||||
|
||||
var counter = 0,
|
||||
names = [
|
||||
'accepts',
|
||||
'cache',
|
||||
'contents',
|
||||
'contentType',
|
||||
'crossDomain',
|
||||
'data',
|
||||
'dataType',
|
||||
'headers',
|
||||
'ifModified',
|
||||
'mimeType',
|
||||
'password',
|
||||
'processData',
|
||||
'timeout',
|
||||
'traditional',
|
||||
'type',
|
||||
'url',
|
||||
'username'
|
||||
],
|
||||
convert = function (p) {
|
||||
return p;
|
||||
};
|
||||
|
||||
$.ajaxSetup({
|
||||
converters: {
|
||||
'postmessage text': convert,
|
||||
'postmessage json': convert,
|
||||
'postmessage html': convert
|
||||
}
|
||||
});
|
||||
|
||||
$.ajaxTransport('postmessage', function (options) {
|
||||
if (options.postMessage && window.postMessage) {
|
||||
var iframe,
|
||||
loc = $('<a>').prop('href', options.postMessage)[0],
|
||||
target = loc.protocol + '//' + loc.host,
|
||||
xhrUpload = options.xhr().upload;
|
||||
return {
|
||||
send: function (_, completeCallback) {
|
||||
var message = {
|
||||
id: 'postmessage-transport-' + (counter += 1)
|
||||
},
|
||||
eventName = 'message.' + message.id;
|
||||
iframe = $(
|
||||
'<iframe style="display:none;" src="' +
|
||||
options.postMessage + '" name="' +
|
||||
message.id + '"></iframe>'
|
||||
).bind('load', function () {
|
||||
$.each(names, function (i, name) {
|
||||
message[name] = options[name];
|
||||
});
|
||||
message.dataType = message.dataType.replace('postmessage ', '');
|
||||
$(window).bind(eventName, function (e) {
|
||||
e = e.originalEvent;
|
||||
var data = e.data,
|
||||
ev;
|
||||
if (e.origin === target && data.id === message.id) {
|
||||
if (data.type === 'progress') {
|
||||
ev = document.createEvent('Event');
|
||||
ev.initEvent(data.type, false, true);
|
||||
$.extend(ev, data);
|
||||
xhrUpload.dispatchEvent(ev);
|
||||
} else {
|
||||
completeCallback(
|
||||
data.status,
|
||||
data.statusText,
|
||||
{postmessage: data.result},
|
||||
data.headers
|
||||
);
|
||||
iframe.remove();
|
||||
$(window).unbind(eventName);
|
||||
}
|
||||
}
|
||||
});
|
||||
iframe[0].contentWindow.postMessage(
|
||||
message,
|
||||
target
|
||||
);
|
||||
}).appendTo(document.body);
|
||||
},
|
||||
abort: function () {
|
||||
if (iframe) {
|
||||
iframe.remove();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
}));
|
85
upload/admin_area/uploader/js/cors/jquery.xdr-transport.js
Normal file
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* jQuery XDomainRequest Transport Plugin 1.1.2
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2011, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*
|
||||
* Based on Julian Aubourg's ajaxHooks xdr.js:
|
||||
* https://github.com/jaubourg/ajaxHooks/
|
||||
*/
|
||||
|
||||
/*jslint unparam: true */
|
||||
/*global define, window, XDomainRequest */
|
||||
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define(['jquery'], factory);
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(window.jQuery);
|
||||
}
|
||||
}(function ($) {
|
||||
'use strict';
|
||||
if (window.XDomainRequest && !$.support.cors) {
|
||||
$.ajaxTransport(function (s) {
|
||||
if (s.crossDomain && s.async) {
|
||||
if (s.timeout) {
|
||||
s.xdrTimeout = s.timeout;
|
||||
delete s.timeout;
|
||||
}
|
||||
var xdr;
|
||||
return {
|
||||
send: function (headers, completeCallback) {
|
||||
function callback(status, statusText, responses, responseHeaders) {
|
||||
xdr.onload = xdr.onerror = xdr.ontimeout = $.noop;
|
||||
xdr = null;
|
||||
completeCallback(status, statusText, responses, responseHeaders);
|
||||
}
|
||||
xdr = new XDomainRequest();
|
||||
// XDomainRequest only supports GET and POST:
|
||||
if (s.type === 'DELETE') {
|
||||
s.url = s.url + (/\?/.test(s.url) ? '&' : '?') +
|
||||
'_method=DELETE';
|
||||
s.type = 'POST';
|
||||
} else if (s.type === 'PUT') {
|
||||
s.url = s.url + (/\?/.test(s.url) ? '&' : '?') +
|
||||
'_method=PUT';
|
||||
s.type = 'POST';
|
||||
}
|
||||
xdr.open(s.type, s.url);
|
||||
xdr.onload = function () {
|
||||
callback(
|
||||
200,
|
||||
'OK',
|
||||
{text: xdr.responseText},
|
||||
'Content-Type: ' + xdr.contentType
|
||||
);
|
||||
};
|
||||
xdr.onerror = function () {
|
||||
callback(404, 'Not Found');
|
||||
};
|
||||
if (s.xdrTimeout) {
|
||||
xdr.ontimeout = function () {
|
||||
callback(0, 'timeout');
|
||||
};
|
||||
xdr.timeout = s.xdrTimeout;
|
||||
}
|
||||
xdr.send((s.hasContent && s.data) || null);
|
||||
},
|
||||
abort: function () {
|
||||
if (xdr) {
|
||||
xdr.onerror = $.noop();
|
||||
xdr.abort();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
}));
|
219
upload/admin_area/uploader/js/jquery.fileupload-fp.js
vendored
Normal file
|
@ -0,0 +1,219 @@
|
|||
/*
|
||||
* jQuery File Upload File Processing Plugin 1.0
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2012, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/*jslint nomen: true, unparam: true, regexp: true */
|
||||
/*global define, window, document */
|
||||
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define([
|
||||
'jquery',
|
||||
'load-image',
|
||||
'canvas-to-blob',
|
||||
'./jquery.fileupload'
|
||||
], factory);
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(
|
||||
window.jQuery,
|
||||
window.loadImage
|
||||
);
|
||||
}
|
||||
}(function ($, loadImage) {
|
||||
'use strict';
|
||||
|
||||
// The File Upload IP version extends the basic fileupload widget
|
||||
// with file processing functionality:
|
||||
$.widget('blueimpFP.fileupload', $.blueimp.fileupload, {
|
||||
|
||||
options: {
|
||||
// The list of file processing actions:
|
||||
process: [
|
||||
/*
|
||||
{
|
||||
action: 'load',
|
||||
fileTypes: /^image\/(gif|jpeg|png)$/,
|
||||
maxFileSize: 20000000 // 20MB
|
||||
},
|
||||
{
|
||||
action: 'resize',
|
||||
maxWidth: 1920,
|
||||
maxHeight: 1200,
|
||||
minWidth: 800,
|
||||
minHeight: 600
|
||||
},
|
||||
{
|
||||
action: 'save'
|
||||
}
|
||||
*/
|
||||
],
|
||||
|
||||
// The add callback is invoked as soon as files are added to the
|
||||
// fileupload widget (via file input selection, drag & drop or add
|
||||
// API call). See the basic file upload widget for more information:
|
||||
add: function (e, data) {
|
||||
$(this).fileupload('process', data).done(function () {
|
||||
data.submit();
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
processActions: {
|
||||
// Loads the image given via data.files and data.index
|
||||
// as canvas element.
|
||||
// Accepts the options fileTypes (regular expression)
|
||||
// and maxFileSize (integer) to limit the files to load:
|
||||
load: function (data, options) {
|
||||
var that = this,
|
||||
file = data.files[data.index],
|
||||
dfd = $.Deferred();
|
||||
if (window.HTMLCanvasElement &&
|
||||
window.HTMLCanvasElement.prototype.toBlob &&
|
||||
($.type(options.maxFileSize) !== 'number' ||
|
||||
file.size < options.maxFileSize) &&
|
||||
(!options.fileTypes ||
|
||||
options.fileTypes.test(file.type))) {
|
||||
loadImage(
|
||||
file,
|
||||
function (canvas) {
|
||||
data.canvas = canvas;
|
||||
dfd.resolveWith(that, [data]);
|
||||
},
|
||||
{canvas: true}
|
||||
);
|
||||
} else {
|
||||
dfd.rejectWith(that, [data]);
|
||||
}
|
||||
return dfd.promise();
|
||||
},
|
||||
// Resizes the image given as data.canvas and updates
|
||||
// data.canvas with the resized image.
|
||||
// Accepts the options maxWidth, maxHeight, minWidth and
|
||||
// minHeight to scale the given image:
|
||||
resize: function (data, options) {
|
||||
if (data.canvas) {
|
||||
var canvas = loadImage.scale(data.canvas, options);
|
||||
if (canvas.width !== data.canvas.width ||
|
||||
canvas.height !== data.canvas.height) {
|
||||
data.canvas = canvas;
|
||||
data.processed = true;
|
||||
}
|
||||
}
|
||||
return data;
|
||||
},
|
||||
// Saves the processed image given as data.canvas
|
||||
// inplace at data.index of data.files:
|
||||
save: function (data, options) {
|
||||
// Do nothing if no processing has happened:
|
||||
if (!data.canvas || !data.processed) {
|
||||
return data;
|
||||
}
|
||||
var that = this,
|
||||
file = data.files[data.index],
|
||||
name = file.name,
|
||||
dfd = $.Deferred(),
|
||||
callback = function (blob) {
|
||||
if (!blob.name) {
|
||||
if (file.type === blob.type) {
|
||||
blob.name = file.name;
|
||||
} else if (file.name) {
|
||||
blob.name = file.name.replace(
|
||||
/\..+$/,
|
||||
'.' + blob.type.substr(6)
|
||||
);
|
||||
}
|
||||
}
|
||||
// Store the created blob at the position
|
||||
// of the original file in the files list:
|
||||
data.files[data.index] = blob;
|
||||
dfd.resolveWith(that, [data]);
|
||||
};
|
||||
// Use canvas.mozGetAsFile directly, to retain the filename, as
|
||||
// Gecko doesn't support the filename option for FormData.append:
|
||||
if (data.canvas.mozGetAsFile) {
|
||||
callback(data.canvas.mozGetAsFile(
|
||||
(/^image\/(jpeg|png)$/.test(file.type) && name) ||
|
||||
((name && name.replace(/\..+$/, '')) ||
|
||||
'blob') + '.png',
|
||||
file.type
|
||||
));
|
||||
} else {
|
||||
data.canvas.toBlob(callback, file.type);
|
||||
}
|
||||
return dfd.promise();
|
||||
}
|
||||
},
|
||||
|
||||
// Resizes the file at the given index and stores the created blob at
|
||||
// the original position of the files list, returns a Promise object:
|
||||
_processFile: function (files, index, options) {
|
||||
var that = this,
|
||||
dfd = $.Deferred().resolveWith(that, [{
|
||||
files: files,
|
||||
index: index
|
||||
}]),
|
||||
chain = dfd.promise();
|
||||
that._processing += 1;
|
||||
$.each(options.process, function (i, settings) {
|
||||
chain = chain.pipe(function (data) {
|
||||
return that.processActions[settings.action]
|
||||
.call(this, data, settings);
|
||||
});
|
||||
});
|
||||
chain.always(function () {
|
||||
that._processing -= 1;
|
||||
if (that._processing === 0) {
|
||||
that.element
|
||||
.removeClass('fileupload-processing');
|
||||
}
|
||||
});
|
||||
if (that._processing === 1) {
|
||||
that.element.addClass('fileupload-processing');
|
||||
}
|
||||
return chain;
|
||||
},
|
||||
|
||||
// Processes the files given as files property of the data parameter,
|
||||
// returns a Promise object that allows to bind a done handler, which
|
||||
// will be invoked after processing all files (inplace) is done:
|
||||
process: function (data) {
|
||||
var that = this,
|
||||
options = $.extend({}, this.options, data);
|
||||
if (options.process && options.process.length &&
|
||||
this._isXHRUpload(options)) {
|
||||
$.each(data.files, function (index, file) {
|
||||
that._processingQueue = that._processingQueue.pipe(
|
||||
function () {
|
||||
var dfd = $.Deferred();
|
||||
that._processFile(data.files, index, options)
|
||||
.always(function () {
|
||||
dfd.resolveWith(that);
|
||||
});
|
||||
return dfd.promise();
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
return this._processingQueue;
|
||||
},
|
||||
|
||||
_create: function () {
|
||||
$.blueimp.fileupload.prototype._create.call(this);
|
||||
this._processing = 0;
|
||||
this._processingQueue = $.Deferred().resolveWith(this)
|
||||
.promise();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}));
|
691
upload/admin_area/uploader/js/jquery.fileupload-ui.js
vendored
Normal file
|
@ -0,0 +1,691 @@
|
|||
/*
|
||||
* jQuery File Upload User Interface Plugin 6.8.2
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2010, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/*jslint nomen: true, unparam: true, regexp: true */
|
||||
/*global define, window, document, URL, webkitURL, FileReader */
|
||||
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define([
|
||||
'jquery',
|
||||
'tmpl',
|
||||
'load-image',
|
||||
'./jquery.fileupload-fp'
|
||||
], factory);
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(
|
||||
window.jQuery,
|
||||
window.tmpl,
|
||||
window.loadImage
|
||||
);
|
||||
}
|
||||
}(function ($, tmpl, loadImage) {
|
||||
'use strict';
|
||||
|
||||
// The UI version extends the FP (file processing) version or the basic
|
||||
// file upload widget and adds complete user interface interaction:
|
||||
var parentWidget = ($.blueimpFP || $.blueimp).fileupload;
|
||||
$.widget('blueimpUI.fileupload', parentWidget, {
|
||||
|
||||
options: {
|
||||
// By default, files added to the widget are uploaded as soon
|
||||
// as the user clicks on the start buttons. To enable automatic
|
||||
// uploads, set the following option to true:
|
||||
autoUpload: false,
|
||||
// The following option limits the number of files that are
|
||||
// allowed to be uploaded using this widget:
|
||||
maxNumberOfFiles: undefined,
|
||||
// The maximum allowed file size:
|
||||
maxFileSize: undefined,
|
||||
// The minimum allowed file size:
|
||||
minFileSize: undefined,
|
||||
// The regular expression for allowed file types, matches
|
||||
// against either file type or file name:
|
||||
acceptFileTypes: /.+$/i,
|
||||
// The regular expression to define for which files a preview
|
||||
// image is shown, matched against the file type:
|
||||
previewSourceFileTypes: /^image\/(gif|jpeg|png)$/,
|
||||
// The maximum file size of images that are to be displayed as preview:
|
||||
previewSourceMaxFileSize: 5000000, // 5MB
|
||||
// The maximum width of the preview images:
|
||||
previewMaxWidth: 80,
|
||||
// The maximum height of the preview images:
|
||||
previewMaxHeight: 80,
|
||||
// By default, preview images are displayed as canvas elements
|
||||
// if supported by the browser. Set the following option to false
|
||||
// to always display preview images as img elements:
|
||||
previewAsCanvas: true,
|
||||
// The ID of the upload template:
|
||||
uploadTemplateId: 'template-upload',
|
||||
// The ID of the download template:
|
||||
downloadTemplateId: 'template-download',
|
||||
// The container for the list of files. If undefined, it is set to
|
||||
// an element with class "files" inside of the widget element:
|
||||
filesContainer: undefined,
|
||||
// By default, files are appended to the files container.
|
||||
// Set the following option to true, to prepend files instead:
|
||||
prependFiles: false,
|
||||
// The expected data type of the upload response, sets the dataType
|
||||
// option of the $.ajax upload requests:
|
||||
dataType: 'json',
|
||||
|
||||
// The add callback is invoked as soon as files are added to the fileupload
|
||||
// widget (via file input selection, drag & drop or add API call).
|
||||
// See the basic file upload widget for more information:
|
||||
add: function (e, data) {
|
||||
var that = $(this).data('fileupload'),
|
||||
options = that.options,
|
||||
files = data.files;
|
||||
$(this).fileupload('process', data).done(function () {
|
||||
that._adjustMaxNumberOfFiles(-files.length);
|
||||
data.isAdjusted = true;
|
||||
data.files.valid = data.isValidated = that._validate(files);
|
||||
data.context = that._renderUpload(files).data('data', data);
|
||||
options.filesContainer[
|
||||
options.prependFiles ? 'prepend' : 'append'
|
||||
](data.context);
|
||||
that._renderPreviews(files, data.context);
|
||||
that._forceReflow(data.context);
|
||||
that._transition(data.context).done(
|
||||
function () {
|
||||
if ((that._trigger('added', e, data) !== false) &&
|
||||
(options.autoUpload || data.autoUpload) &&
|
||||
data.autoUpload !== false && data.isValidated) {
|
||||
data.submit();
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
},
|
||||
// Callback for the start of each file upload request:
|
||||
send: function (e, data) {
|
||||
var that = $(this).data('fileupload');
|
||||
if (!data.isValidated) {
|
||||
if (!data.isAdjusted) {
|
||||
that._adjustMaxNumberOfFiles(-data.files.length);
|
||||
}
|
||||
if (!that._validate(data.files)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (data.context && data.dataType &&
|
||||
data.dataType.substr(0, 6) === 'iframe') {
|
||||
// Iframe Transport does not support progress events.
|
||||
// In lack of an indeterminate progress bar, we set
|
||||
// the progress to 100%, showing the full animated bar:
|
||||
data.context
|
||||
.find('.progress').addClass(
|
||||
!$.support.transition && 'progress-animated'
|
||||
)
|
||||
.find('.bar').css(
|
||||
'width',
|
||||
parseInt(100, 10) + '%'
|
||||
);
|
||||
}
|
||||
return that._trigger('sent', e, data);
|
||||
},
|
||||
// Callback for successful uploads:
|
||||
done: function (e, data) {
|
||||
var that = $(this).data('fileupload'),
|
||||
template;
|
||||
if (data.context) {
|
||||
data.context.each(function (index) {
|
||||
var file = ($.isArray(data.result) &&
|
||||
data.result[index]) || {error: 'emptyResult'};
|
||||
if (file.error) {
|
||||
that._adjustMaxNumberOfFiles(1);
|
||||
}
|
||||
that._transition($(this)).done(
|
||||
function () {
|
||||
var node = $(this);
|
||||
template = that._renderDownload([file])
|
||||
.css('height', node.height())
|
||||
.replaceAll(node);
|
||||
that._forceReflow(template);
|
||||
that._transition(template).done(
|
||||
function () {
|
||||
data.context = $(this);
|
||||
that._trigger('completed', e, data);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
});
|
||||
} else {
|
||||
template = that._renderDownload(data.result)
|
||||
.appendTo(that.options.filesContainer);
|
||||
that._forceReflow(template);
|
||||
that._transition(template).done(
|
||||
function () {
|
||||
data.context = $(this);
|
||||
that._trigger('completed', e, data);
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
// Callback for failed (abort or error) uploads:
|
||||
fail: function (e, data) {
|
||||
var that = $(this).data('fileupload'),
|
||||
template;
|
||||
that._adjustMaxNumberOfFiles(data.files.length);
|
||||
if (data.context) {
|
||||
data.context.each(function (index) {
|
||||
if (data.errorThrown !== 'abort') {
|
||||
var file = data.files[index];
|
||||
file.error = file.error || data.errorThrown ||
|
||||
true;
|
||||
that._transition($(this)).done(
|
||||
function () {
|
||||
var node = $(this);
|
||||
template = that._renderDownload([file])
|
||||
.replaceAll(node);
|
||||
that._forceReflow(template);
|
||||
that._transition(template).done(
|
||||
function () {
|
||||
data.context = $(this);
|
||||
that._trigger('failed', e, data);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
that._transition($(this)).done(
|
||||
function () {
|
||||
$(this).remove();
|
||||
that._trigger('failed', e, data);
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
} else if (data.errorThrown !== 'abort') {
|
||||
that._adjustMaxNumberOfFiles(-data.files.length);
|
||||
data.context = that._renderUpload(data.files)
|
||||
.appendTo(that.options.filesContainer)
|
||||
.data('data', data);
|
||||
that._forceReflow(data.context);
|
||||
that._transition(data.context).done(
|
||||
function () {
|
||||
data.context = $(this);
|
||||
that._trigger('failed', e, data);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
that._trigger('failed', e, data);
|
||||
}
|
||||
},
|
||||
// Callback for upload progress events:
|
||||
progress: function (e, data) {
|
||||
if (data.context) {
|
||||
data.context.find('.bar').css(
|
||||
'width',
|
||||
parseInt(data.loaded / data.total * 100, 10) + '%'
|
||||
);
|
||||
}
|
||||
},
|
||||
// Callback for global upload progress events:
|
||||
progressall: function (e, data) {
|
||||
var $this = $(this);
|
||||
$this.find('.fileupload-progress')
|
||||
.find('.bar').css(
|
||||
'width',
|
||||
parseInt(data.loaded / data.total * 100, 10) + '%'
|
||||
).end()
|
||||
.find('.progress-extended').each(function () {
|
||||
$(this).html(
|
||||
$this.data('fileupload')
|
||||
._renderExtendedProgress(data)
|
||||
);
|
||||
});
|
||||
},
|
||||
// Callback for uploads start, equivalent to the global ajaxStart event:
|
||||
start: function (e) {
|
||||
var that = $(this).data('fileupload');
|
||||
that._transition($(this).find('.fileupload-progress')).done(
|
||||
function () {
|
||||
that._trigger('started', e);
|
||||
}
|
||||
);
|
||||
},
|
||||
// Callback for uploads stop, equivalent to the global ajaxStop event:
|
||||
stop: function (e) {
|
||||
var that = $(this).data('fileupload');
|
||||
that._transition($(this).find('.fileupload-progress')).done(
|
||||
function () {
|
||||
$(this).find('.bar').css('width', '0%');
|
||||
$(this).find('.progress-extended').html(' ');
|
||||
that._trigger('stopped', e);
|
||||
}
|
||||
);
|
||||
},
|
||||
// Callback for file deletion:
|
||||
destroy: function (e, data) {
|
||||
var that = $(this).data('fileupload');
|
||||
if (data.url) {
|
||||
$.ajax(data);
|
||||
that._adjustMaxNumberOfFiles(1);
|
||||
}
|
||||
that._transition(data.context).done(
|
||||
function () {
|
||||
$(this).remove();
|
||||
that._trigger('destroyed', e, data);
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
// Link handler, that allows to download files
|
||||
// by drag & drop of the links to the desktop:
|
||||
_enableDragToDesktop: function () {
|
||||
var link = $(this),
|
||||
url = link.prop('href'),
|
||||
name = link.prop('download'),
|
||||
type = 'application/octet-stream';
|
||||
link.bind('dragstart', function (e) {
|
||||
try {
|
||||
e.originalEvent.dataTransfer.setData(
|
||||
'DownloadURL',
|
||||
[type, name, url].join(':')
|
||||
);
|
||||
} catch (err) {}
|
||||
});
|
||||
},
|
||||
|
||||
_adjustMaxNumberOfFiles: function (operand) {
|
||||
if (typeof this.options.maxNumberOfFiles === 'number') {
|
||||
this.options.maxNumberOfFiles += operand;
|
||||
if (this.options.maxNumberOfFiles < 1) {
|
||||
this._disableFileInputButton();
|
||||
} else {
|
||||
this._enableFileInputButton();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_formatFileSize: function (bytes) {
|
||||
if (typeof bytes !== 'number') {
|
||||
return '';
|
||||
}
|
||||
if (bytes >= 1000000000) {
|
||||
return (bytes / 1000000000).toFixed(2) + ' GB';
|
||||
}
|
||||
if (bytes >= 1000000) {
|
||||
return (bytes / 1000000).toFixed(2) + ' MB';
|
||||
}
|
||||
return (bytes / 1000).toFixed(2) + ' KB';
|
||||
},
|
||||
|
||||
_formatBitrate: function (bits) {
|
||||
if (typeof bits !== 'number') {
|
||||
return '';
|
||||
}
|
||||
if (bits >= 1000000000) {
|
||||
return (bits / 1000000000).toFixed(2) + ' Gbit/s';
|
||||
}
|
||||
if (bits >= 1000000) {
|
||||
return (bits / 1000000).toFixed(2) + ' Mbit/s';
|
||||
}
|
||||
if (bits >= 1000) {
|
||||
return (bits / 1000).toFixed(2) + ' kbit/s';
|
||||
}
|
||||
return bits + ' bit/s';
|
||||
},
|
||||
|
||||
_formatTime: function (seconds) {
|
||||
var date = new Date(seconds * 1000),
|
||||
days = parseInt(seconds / 86400, 10);
|
||||
days = days ? days + 'd ' : '';
|
||||
return days +
|
||||
('0' + date.getUTCHours()).slice(-2) + ':' +
|
||||
('0' + date.getUTCMinutes()).slice(-2) + ':' +
|
||||
('0' + date.getUTCSeconds()).slice(-2);
|
||||
},
|
||||
|
||||
_formatPercentage: function (floatValue) {
|
||||
return (floatValue * 100).toFixed(2) + ' %';
|
||||
},
|
||||
|
||||
_renderExtendedProgress: function (data) {
|
||||
return this._formatBitrate(data.bitrate) + ' | ' +
|
||||
this._formatTime(
|
||||
(data.total - data.loaded) * 8 / data.bitrate
|
||||
) + ' | ' +
|
||||
this._formatPercentage(
|
||||
data.loaded / data.total
|
||||
) + ' | ' +
|
||||
this._formatFileSize(data.loaded) + ' / ' +
|
||||
this._formatFileSize(data.total);
|
||||
},
|
||||
|
||||
_hasError: function (file) {
|
||||
if (file.error) {
|
||||
return file.error;
|
||||
}
|
||||
// The number of added files is subtracted from
|
||||
// maxNumberOfFiles before validation, so we check if
|
||||
// maxNumberOfFiles is below 0 (instead of below 1):
|
||||
if (this.options.maxNumberOfFiles < 0) {
|
||||
return 'maxNumberOfFiles';
|
||||
}
|
||||
// Files are accepted if either the file type or the file name
|
||||
// matches against the acceptFileTypes regular expression, as
|
||||
// only browsers with support for the File API report the type:
|
||||
if (!(this.options.acceptFileTypes.test(file.type) ||
|
||||
this.options.acceptFileTypes.test(file.name))) {
|
||||
return 'acceptFileTypes';
|
||||
}
|
||||
if (this.options.maxFileSize &&
|
||||
file.size > this.options.maxFileSize) {
|
||||
return 'maxFileSize';
|
||||
}
|
||||
if (typeof file.size === 'number' &&
|
||||
file.size < this.options.minFileSize) {
|
||||
return 'minFileSize';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
_validate: function (files) {
|
||||
var that = this,
|
||||
valid = !!files.length;
|
||||
$.each(files, function (index, file) {
|
||||
file.error = that._hasError(file);
|
||||
if (file.error) {
|
||||
valid = false;
|
||||
}
|
||||
});
|
||||
return valid;
|
||||
},
|
||||
|
||||
_renderTemplate: function (func, files) {
|
||||
if (!func) {
|
||||
return $();
|
||||
}
|
||||
var result = func({
|
||||
files: files,
|
||||
formatFileSize: this._formatFileSize,
|
||||
options: this.options
|
||||
});
|
||||
if (result instanceof $) {
|
||||
return result;
|
||||
}
|
||||
return $(this.options.templatesContainer).html(result).children();
|
||||
},
|
||||
|
||||
_renderPreview: function (file, node) {
|
||||
var that = this,
|
||||
options = this.options,
|
||||
dfd = $.Deferred();
|
||||
return ((loadImage && loadImage(
|
||||
file,
|
||||
function (img) {
|
||||
node.append(img);
|
||||
that._forceReflow(node);
|
||||
that._transition(node).done(function () {
|
||||
dfd.resolveWith(node);
|
||||
});
|
||||
if (!$.contains(document.body, node[0])) {
|
||||
// If the element is not part of the DOM,
|
||||
// transition events are not triggered,
|
||||
// so we have to resolve manually:
|
||||
dfd.resolveWith(node);
|
||||
}
|
||||
},
|
||||
{
|
||||
maxWidth: options.previewMaxWidth,
|
||||
maxHeight: options.previewMaxHeight,
|
||||
canvas: options.previewAsCanvas
|
||||
}
|
||||
)) || dfd.resolveWith(node)) && dfd;
|
||||
},
|
||||
|
||||
_renderPreviews: function (files, nodes) {
|
||||
var that = this,
|
||||
options = this.options;
|
||||
nodes.find('.preview span').each(function (index, element) {
|
||||
var file = files[index];
|
||||
if (options.previewSourceFileTypes.test(file.type) &&
|
||||
($.type(options.previewSourceMaxFileSize) !== 'number' ||
|
||||
file.size < options.previewSourceMaxFileSize)) {
|
||||
that._processingQueue = that._processingQueue.pipe(function () {
|
||||
var dfd = $.Deferred();
|
||||
that._renderPreview(file, $(element)).done(
|
||||
function () {
|
||||
dfd.resolveWith(that);
|
||||
}
|
||||
);
|
||||
return dfd.promise();
|
||||
});
|
||||
}
|
||||
});
|
||||
return this._processingQueue;
|
||||
},
|
||||
|
||||
_renderUpload: function (files) {
|
||||
return this._renderTemplate(
|
||||
this.options.uploadTemplate,
|
||||
files
|
||||
);
|
||||
},
|
||||
|
||||
_renderDownload: function (files) {
|
||||
return this._renderTemplate(
|
||||
this.options.downloadTemplate,
|
||||
files
|
||||
).find('a[download]').each(this._enableDragToDesktop).end();
|
||||
},
|
||||
|
||||
_startHandler: function (e) {
|
||||
e.preventDefault();
|
||||
var button = $(this),
|
||||
template = button.closest('.template-upload'),
|
||||
data = template.data('data');
|
||||
if (data && data.submit && !data.jqXHR && data.submit()) {
|
||||
button.prop('disabled', true);
|
||||
}
|
||||
},
|
||||
|
||||
_cancelHandler: function (e) {
|
||||
e.preventDefault();
|
||||
var template = $(this).closest('.template-upload'),
|
||||
data = template.data('data') || {};
|
||||
if (!data.jqXHR) {
|
||||
data.errorThrown = 'abort';
|
||||
e.data.fileupload._trigger('fail', e, data);
|
||||
} else {
|
||||
data.jqXHR.abort();
|
||||
}
|
||||
},
|
||||
|
||||
_deleteHandler: function (e) {
|
||||
e.preventDefault();
|
||||
var button = $(this);
|
||||
e.data.fileupload._trigger('destroy', e, {
|
||||
context: button.closest('.template-download'),
|
||||
url: button.attr('data-url'),
|
||||
type: button.attr('data-type') || 'DELETE',
|
||||
dataType: e.data.fileupload.options.dataType
|
||||
});
|
||||
},
|
||||
|
||||
_forceReflow: function (node) {
|
||||
this._reflow = $.support.transition &&
|
||||
node.length && node[0].offsetWidth;
|
||||
},
|
||||
|
||||
_transition: function (node) {
|
||||
var dfd = $.Deferred();
|
||||
if ($.support.transition && node.hasClass('fade')) {
|
||||
node.bind(
|
||||
$.support.transition.end,
|
||||
function (e) {
|
||||
// Make sure we don't respond to other transitions events
|
||||
// in the container element, e.g. from button elements:
|
||||
if (e.target === node[0]) {
|
||||
node.unbind($.support.transition.end);
|
||||
dfd.resolveWith(node);
|
||||
}
|
||||
}
|
||||
).toggleClass('in');
|
||||
} else {
|
||||
node.toggleClass('in');
|
||||
dfd.resolveWith(node);
|
||||
}
|
||||
return dfd;
|
||||
},
|
||||
|
||||
_initButtonBarEventHandlers: function () {
|
||||
var fileUploadButtonBar = this.element.find('.fileupload-buttonbar'),
|
||||
filesList = this.options.filesContainer,
|
||||
ns = this.options.namespace;
|
||||
fileUploadButtonBar.find('.start')
|
||||
.bind('click.' + ns, function (e) {
|
||||
e.preventDefault();
|
||||
filesList.find('.start button').click();
|
||||
});
|
||||
fileUploadButtonBar.find('.cancel')
|
||||
.bind('click.' + ns, function (e) {
|
||||
e.preventDefault();
|
||||
filesList.find('.cancel button').click();
|
||||
});
|
||||
fileUploadButtonBar.find('.delete')
|
||||
.bind('click.' + ns, function (e) {
|
||||
e.preventDefault();
|
||||
filesList.find('.delete input:checked')
|
||||
.siblings('button').click();
|
||||
fileUploadButtonBar.find('.toggle')
|
||||
.prop('checked', false);
|
||||
});
|
||||
fileUploadButtonBar.find('.toggle')
|
||||
.bind('change.' + ns, function (e) {
|
||||
filesList.find('.delete input').prop(
|
||||
'checked',
|
||||
$(this).is(':checked')
|
||||
);
|
||||
});
|
||||
},
|
||||
|
||||
_destroyButtonBarEventHandlers: function () {
|
||||
this.element.find('.fileupload-buttonbar button')
|
||||
.unbind('click.' + this.options.namespace);
|
||||
this.element.find('.fileupload-buttonbar .toggle')
|
||||
.unbind('change.' + this.options.namespace);
|
||||
},
|
||||
|
||||
_initEventHandlers: function () {
|
||||
parentWidget.prototype._initEventHandlers.call(this);
|
||||
var eventData = {fileupload: this};
|
||||
this.options.filesContainer
|
||||
.delegate(
|
||||
'.start button',
|
||||
'click.' + this.options.namespace,
|
||||
eventData,
|
||||
this._startHandler
|
||||
)
|
||||
.delegate(
|
||||
'.cancel button',
|
||||
'click.' + this.options.namespace,
|
||||
eventData,
|
||||
this._cancelHandler
|
||||
)
|
||||
.delegate(
|
||||
'.delete button',
|
||||
'click.' + this.options.namespace,
|
||||
eventData,
|
||||
this._deleteHandler
|
||||
);
|
||||
this._initButtonBarEventHandlers();
|
||||
},
|
||||
|
||||
_destroyEventHandlers: function () {
|
||||
var options = this.options;
|
||||
this._destroyButtonBarEventHandlers();
|
||||
options.filesContainer
|
||||
.undelegate('.start button', 'click.' + options.namespace)
|
||||
.undelegate('.cancel button', 'click.' + options.namespace)
|
||||
.undelegate('.delete button', 'click.' + options.namespace);
|
||||
parentWidget.prototype._destroyEventHandlers.call(this);
|
||||
},
|
||||
|
||||
_enableFileInputButton: function () {
|
||||
this.element.find('.fileinput-button input')
|
||||
.prop('disabled', false)
|
||||
.parent().removeClass('disabled');
|
||||
},
|
||||
|
||||
_disableFileInputButton: function () {
|
||||
this.element.find('.fileinput-button input')
|
||||
.prop('disabled', true)
|
||||
.parent().addClass('disabled');
|
||||
},
|
||||
|
||||
_initTemplates: function () {
|
||||
var options = this.options;
|
||||
options.templatesContainer = document.createElement(
|
||||
options.filesContainer.prop('nodeName')
|
||||
);
|
||||
if (tmpl) {
|
||||
if (options.uploadTemplateId) {
|
||||
options.uploadTemplate = tmpl(options.uploadTemplateId);
|
||||
}
|
||||
if (options.downloadTemplateId) {
|
||||
options.downloadTemplate = tmpl(options.downloadTemplateId);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_initFilesContainer: function () {
|
||||
var options = this.options;
|
||||
if (options.filesContainer === undefined) {
|
||||
options.filesContainer = this.element.find('.files');
|
||||
} else if (!(options.filesContainer instanceof $)) {
|
||||
options.filesContainer = $(options.filesContainer);
|
||||
}
|
||||
},
|
||||
|
||||
_initSpecialOptions: function () {
|
||||
parentWidget.prototype._initSpecialOptions.call(this);
|
||||
this._initFilesContainer();
|
||||
this._initTemplates();
|
||||
},
|
||||
|
||||
_create: function () {
|
||||
parentWidget.prototype._create.call(this);
|
||||
this._refreshOptionsList.push(
|
||||
'filesContainer',
|
||||
'uploadTemplateId',
|
||||
'downloadTemplateId'
|
||||
);
|
||||
if (!$.blueimpFP) {
|
||||
this._processingQueue = $.Deferred().resolveWith(this).promise();
|
||||
this.process = function () {
|
||||
return this._processingQueue;
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
enable: function () {
|
||||
parentWidget.prototype.enable.call(this);
|
||||
this.element.find('input, button').prop('disabled', false);
|
||||
this._enableFileInputButton();
|
||||
},
|
||||
|
||||
disable: function () {
|
||||
this.element.find('input, button').prop('disabled', true);
|
||||
this._disableFileInputButton();
|
||||
parentWidget.prototype.disable.call(this);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}));
|
949
upload/admin_area/uploader/js/jquery.fileupload.js
vendored
Normal file
|
@ -0,0 +1,949 @@
|
|||
/*
|
||||
* jQuery File Upload Plugin 5.11.2
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2010, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/*jslint nomen: true, unparam: true, regexp: true */
|
||||
/*global define, window, document, Blob, FormData, location */
|
||||
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define([
|
||||
'jquery',
|
||||
'jquery.ui.widget'
|
||||
], factory);
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(window.jQuery);
|
||||
}
|
||||
}(function ($) {
|
||||
'use strict';
|
||||
|
||||
// The FileReader API is not actually used, but works as feature detection,
|
||||
// as e.g. Safari supports XHR file uploads via the FormData API,
|
||||
// but not non-multipart XHR file uploads:
|
||||
$.support.xhrFileUpload = !!(window.XMLHttpRequestUpload && window.FileReader);
|
||||
$.support.xhrFormDataFileUpload = !!window.FormData;
|
||||
|
||||
// The fileupload widget listens for change events on file input fields defined
|
||||
// via fileInput setting and paste or drop events of the given dropZone.
|
||||
// In addition to the default jQuery Widget methods, the fileupload widget
|
||||
// exposes the "add" and "send" methods, to add or directly send files using
|
||||
// the fileupload API.
|
||||
// By default, files added via file input selection, paste, drag & drop or
|
||||
// "add" method are uploaded immediately, but it is possible to override
|
||||
// the "add" callback option to queue file uploads.
|
||||
$.widget('blueimp.fileupload', {
|
||||
|
||||
options: {
|
||||
// The namespace used for event handler binding on the dropZone and
|
||||
// fileInput collections.
|
||||
// If not set, the name of the widget ("fileupload") is used.
|
||||
namespace: undefined,
|
||||
// The drop target collection, by the default the complete document.
|
||||
// Set to null or an empty collection to disable drag & drop support:
|
||||
dropZone: $(document),
|
||||
// The file input field collection, that is listened for change events.
|
||||
// If undefined, it is set to the file input fields inside
|
||||
// of the widget element on plugin initialization.
|
||||
// Set to null or an empty collection to disable the change listener.
|
||||
fileInput: undefined,
|
||||
// By default, the file input field is replaced with a clone after
|
||||
// each input field change event. This is required for iframe transport
|
||||
// queues and allows change events to be fired for the same file
|
||||
// selection, but can be disabled by setting the following option to false:
|
||||
replaceFileInput: true,
|
||||
// The parameter name for the file form data (the request argument name).
|
||||
// If undefined or empty, the name property of the file input field is
|
||||
// used, or "files[]" if the file input name property is also empty,
|
||||
// can be a string or an array of strings:
|
||||
paramName: undefined,
|
||||
// By default, each file of a selection is uploaded using an individual
|
||||
// request for XHR type uploads. Set to false to upload file
|
||||
// selections in one request each:
|
||||
singleFileUploads: true,
|
||||
// To limit the number of files uploaded with one XHR request,
|
||||
// set the following option to an integer greater than 0:
|
||||
limitMultiFileUploads: undefined,
|
||||
// Set the following option to true to issue all file upload requests
|
||||
// in a sequential order:
|
||||
sequentialUploads: false,
|
||||
// To limit the number of concurrent uploads,
|
||||
// set the following option to an integer greater than 0:
|
||||
limitConcurrentUploads: undefined,
|
||||
// Set the following option to true to force iframe transport uploads:
|
||||
forceIframeTransport: false,
|
||||
// Set the following option to the location of a redirect url on the
|
||||
// origin server, for cross-domain iframe transport uploads:
|
||||
redirect: undefined,
|
||||
// The parameter name for the redirect url, sent as part of the form
|
||||
// data and set to 'redirect' if this option is empty:
|
||||
redirectParamName: undefined,
|
||||
// Set the following option to the location of a postMessage window,
|
||||
// to enable postMessage transport uploads:
|
||||
postMessage: undefined,
|
||||
// By default, XHR file uploads are sent as multipart/form-data.
|
||||
// The iframe transport is always using multipart/form-data.
|
||||
// Set to false to enable non-multipart XHR uploads:
|
||||
multipart: true,
|
||||
// To upload large files in smaller chunks, set the following option
|
||||
// to a preferred maximum chunk size. If set to 0, null or undefined,
|
||||
// or the browser does not support the required Blob API, files will
|
||||
// be uploaded as a whole.
|
||||
maxChunkSize: undefined,
|
||||
// When a non-multipart upload or a chunked multipart upload has been
|
||||
// aborted, this option can be used to resume the upload by setting
|
||||
// it to the size of the already uploaded bytes. This option is most
|
||||
// useful when modifying the options object inside of the "add" or
|
||||
// "send" callbacks, as the options are cloned for each file upload.
|
||||
uploadedBytes: undefined,
|
||||
// By default, failed (abort or error) file uploads are removed from the
|
||||
// global progress calculation. Set the following option to false to
|
||||
// prevent recalculating the global progress data:
|
||||
recalculateProgress: true,
|
||||
// Interval in milliseconds to calculate and trigger progress events:
|
||||
progressInterval: 100,
|
||||
// Interval in milliseconds to calculate progress bitrate:
|
||||
bitrateInterval: 500,
|
||||
|
||||
// Additional form data to be sent along with the file uploads can be set
|
||||
// using this option, which accepts an array of objects with name and
|
||||
// value properties, a function returning such an array, a FormData
|
||||
// object (for XHR file uploads), or a simple object.
|
||||
// The form of the first fileInput is given as parameter to the function:
|
||||
formData: function (form) {
|
||||
return form.serializeArray();
|
||||
},
|
||||
|
||||
// The add callback is invoked as soon as files are added to the fileupload
|
||||
// widget (via file input selection, drag & drop, paste or add API call).
|
||||
// If the singleFileUploads option is enabled, this callback will be
|
||||
// called once for each file in the selection for XHR file uplaods, else
|
||||
// once for each file selection.
|
||||
// The upload starts when the submit method is invoked on the data parameter.
|
||||
// The data object contains a files property holding the added files
|
||||
// and allows to override plugin options as well as define ajax settings.
|
||||
// Listeners for this callback can also be bound the following way:
|
||||
// .bind('fileuploadadd', func);
|
||||
// data.submit() returns a Promise object and allows to attach additional
|
||||
// handlers using jQuery's Deferred callbacks:
|
||||
// data.submit().done(func).fail(func).always(func);
|
||||
add: function (e, data) {
|
||||
data.submit();
|
||||
},
|
||||
|
||||
// Other callbacks:
|
||||
// Callback for the submit event of each file upload:
|
||||
// submit: function (e, data) {}, // .bind('fileuploadsubmit', func);
|
||||
// Callback for the start of each file upload request:
|
||||
// send: function (e, data) {}, // .bind('fileuploadsend', func);
|
||||
// Callback for successful uploads:
|
||||
// done: function (e, data) {}, // .bind('fileuploaddone', func);
|
||||
// Callback for failed (abort or error) uploads:
|
||||
// fail: function (e, data) {}, // .bind('fileuploadfail', func);
|
||||
// Callback for completed (success, abort or error) requests:
|
||||
// always: function (e, data) {}, // .bind('fileuploadalways', func);
|
||||
// Callback for upload progress events:
|
||||
// progress: function (e, data) {}, // .bind('fileuploadprogress', func);
|
||||
// Callback for global upload progress events:
|
||||
// progressall: function (e, data) {}, // .bind('fileuploadprogressall', func);
|
||||
// Callback for uploads start, equivalent to the global ajaxStart event:
|
||||
// start: function (e) {}, // .bind('fileuploadstart', func);
|
||||
// Callback for uploads stop, equivalent to the global ajaxStop event:
|
||||
// stop: function (e) {}, // .bind('fileuploadstop', func);
|
||||
// Callback for change events of the fileInput collection:
|
||||
// change: function (e, data) {}, // .bind('fileuploadchange', func);
|
||||
// Callback for paste events to the dropZone collection:
|
||||
// paste: function (e, data) {}, // .bind('fileuploadpaste', func);
|
||||
// Callback for drop events of the dropZone collection:
|
||||
// drop: function (e, data) {}, // .bind('fileuploaddrop', func);
|
||||
// Callback for dragover events of the dropZone collection:
|
||||
// dragover: function (e) {}, // .bind('fileuploaddragover', func);
|
||||
|
||||
// The plugin options are used as settings object for the ajax calls.
|
||||
// The following are jQuery ajax settings required for the file uploads:
|
||||
processData: false,
|
||||
contentType: false,
|
||||
cache: false
|
||||
},
|
||||
|
||||
// A list of options that require a refresh after assigning a new value:
|
||||
_refreshOptionsList: [
|
||||
'namespace',
|
||||
'dropZone',
|
||||
'fileInput',
|
||||
'multipart',
|
||||
'forceIframeTransport'
|
||||
],
|
||||
|
||||
_BitrateTimer: function () {
|
||||
this.timestamp = +(new Date());
|
||||
this.loaded = 0;
|
||||
this.bitrate = 0;
|
||||
this.getBitrate = function (now, loaded, interval) {
|
||||
var timeDiff = now - this.timestamp;
|
||||
if (!this.bitrate || !interval || timeDiff > interval) {
|
||||
this.bitrate = (loaded - this.loaded) * (1000 / timeDiff) * 8;
|
||||
this.loaded = loaded;
|
||||
this.timestamp = now;
|
||||
}
|
||||
return this.bitrate;
|
||||
};
|
||||
},
|
||||
|
||||
_isXHRUpload: function (options) {
|
||||
return !options.forceIframeTransport &&
|
||||
((!options.multipart && $.support.xhrFileUpload) ||
|
||||
$.support.xhrFormDataFileUpload);
|
||||
},
|
||||
|
||||
_getFormData: function (options) {
|
||||
var formData;
|
||||
if (typeof options.formData === 'function') {
|
||||
return options.formData(options.form);
|
||||
}
|
||||
if ($.isArray(options.formData)) {
|
||||
return options.formData;
|
||||
}
|
||||
if (options.formData) {
|
||||
formData = [];
|
||||
$.each(options.formData, function (name, value) {
|
||||
formData.push({name: name, value: value});
|
||||
});
|
||||
return formData;
|
||||
}
|
||||
return [];
|
||||
},
|
||||
|
||||
_getTotal: function (files) {
|
||||
var total = 0;
|
||||
$.each(files, function (index, file) {
|
||||
total += file.size || 1;
|
||||
});
|
||||
return total;
|
||||
},
|
||||
|
||||
_onProgress: function (e, data) {
|
||||
if (e.lengthComputable) {
|
||||
var now = +(new Date()),
|
||||
total,
|
||||
loaded;
|
||||
if (data._time && data.progressInterval &&
|
||||
(now - data._time < data.progressInterval) &&
|
||||
e.loaded !== e.total) {
|
||||
return;
|
||||
}
|
||||
data._time = now;
|
||||
total = data.total || this._getTotal(data.files);
|
||||
loaded = parseInt(
|
||||
e.loaded / e.total * (data.chunkSize || total),
|
||||
10
|
||||
) + (data.uploadedBytes || 0);
|
||||
this._loaded += loaded - (data.loaded || data.uploadedBytes || 0);
|
||||
data.lengthComputable = true;
|
||||
data.loaded = loaded;
|
||||
data.total = total;
|
||||
data.bitrate = data._bitrateTimer.getBitrate(
|
||||
now,
|
||||
loaded,
|
||||
data.bitrateInterval
|
||||
);
|
||||
// Trigger a custom progress event with a total data property set
|
||||
// to the file size(s) of the current upload and a loaded data
|
||||
// property calculated accordingly:
|
||||
this._trigger('progress', e, data);
|
||||
// Trigger a global progress event for all current file uploads,
|
||||
// including ajax calls queued for sequential file uploads:
|
||||
this._trigger('progressall', e, {
|
||||
lengthComputable: true,
|
||||
loaded: this._loaded,
|
||||
total: this._total,
|
||||
bitrate: this._bitrateTimer.getBitrate(
|
||||
now,
|
||||
this._loaded,
|
||||
data.bitrateInterval
|
||||
)
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
_initProgressListener: function (options) {
|
||||
var that = this,
|
||||
xhr = options.xhr ? options.xhr() : $.ajaxSettings.xhr();
|
||||
// Accesss to the native XHR object is required to add event listeners
|
||||
// for the upload progress event:
|
||||
if (xhr.upload) {
|
||||
$(xhr.upload).bind('progress', function (e) {
|
||||
var oe = e.originalEvent;
|
||||
// Make sure the progress event properties get copied over:
|
||||
e.lengthComputable = oe.lengthComputable;
|
||||
e.loaded = oe.loaded;
|
||||
e.total = oe.total;
|
||||
that._onProgress(e, options);
|
||||
});
|
||||
options.xhr = function () {
|
||||
return xhr;
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
_initXHRData: function (options) {
|
||||
var formData,
|
||||
file = options.files[0],
|
||||
// Ignore non-multipart setting if not supported:
|
||||
multipart = options.multipart || !$.support.xhrFileUpload,
|
||||
paramName = options.paramName[0];
|
||||
if (!multipart || options.blob) {
|
||||
// For non-multipart uploads and chunked uploads,
|
||||
// file meta data is not part of the request body,
|
||||
// so we transmit this data as part of the HTTP headers.
|
||||
// For cross domain requests, these headers must be allowed
|
||||
// via Access-Control-Allow-Headers or removed using
|
||||
// the beforeSend callback:
|
||||
options.headers = $.extend(options.headers, {
|
||||
'X-File-Name': file.name,
|
||||
'X-File-Type': file.type,
|
||||
'X-File-Size': file.size
|
||||
});
|
||||
if (!options.blob) {
|
||||
// Non-chunked non-multipart upload:
|
||||
options.contentType = file.type;
|
||||
options.data = file;
|
||||
} else if (!multipart) {
|
||||
// Chunked non-multipart upload:
|
||||
options.contentType = 'application/octet-stream';
|
||||
options.data = options.blob;
|
||||
}
|
||||
}
|
||||
if (multipart && $.support.xhrFormDataFileUpload) {
|
||||
if (options.postMessage) {
|
||||
// window.postMessage does not allow sending FormData
|
||||
// objects, so we just add the File/Blob objects to
|
||||
// the formData array and let the postMessage window
|
||||
// create the FormData object out of this array:
|
||||
formData = this._getFormData(options);
|
||||
if (options.blob) {
|
||||
formData.push({
|
||||
name: paramName,
|
||||
value: options.blob
|
||||
});
|
||||
} else {
|
||||
$.each(options.files, function (index, file) {
|
||||
formData.push({
|
||||
name: options.paramName[index] || paramName,
|
||||
value: file
|
||||
});
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if (options.formData instanceof FormData) {
|
||||
formData = options.formData;
|
||||
} else {
|
||||
formData = new FormData();
|
||||
$.each(this._getFormData(options), function (index, field) {
|
||||
formData.append(field.name, field.value);
|
||||
});
|
||||
}
|
||||
if (options.blob) {
|
||||
formData.append(paramName, options.blob, file.name);
|
||||
} else {
|
||||
$.each(options.files, function (index, file) {
|
||||
// File objects are also Blob instances.
|
||||
// This check allows the tests to run with
|
||||
// dummy objects:
|
||||
if (file instanceof Blob) {
|
||||
formData.append(
|
||||
options.paramName[index] || paramName,
|
||||
file,
|
||||
file.name
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
options.data = formData;
|
||||
}
|
||||
// Blob reference is not needed anymore, free memory:
|
||||
options.blob = null;
|
||||
},
|
||||
|
||||
_initIframeSettings: function (options) {
|
||||
// Setting the dataType to iframe enables the iframe transport:
|
||||
options.dataType = 'iframe ' + (options.dataType || '');
|
||||
// The iframe transport accepts a serialized array as form data:
|
||||
options.formData = this._getFormData(options);
|
||||
// Add redirect url to form data on cross-domain uploads:
|
||||
if (options.redirect && $('<a></a>').prop('href', options.url)
|
||||
.prop('host') !== location.host) {
|
||||
options.formData.push({
|
||||
name: options.redirectParamName || 'redirect',
|
||||
value: options.redirect
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
_initDataSettings: function (options) {
|
||||
if (this._isXHRUpload(options)) {
|
||||
if (!this._chunkedUpload(options, true)) {
|
||||
if (!options.data) {
|
||||
this._initXHRData(options);
|
||||
}
|
||||
this._initProgressListener(options);
|
||||
}
|
||||
if (options.postMessage) {
|
||||
// Setting the dataType to postmessage enables the
|
||||
// postMessage transport:
|
||||
options.dataType = 'postmessage ' + (options.dataType || '');
|
||||
}
|
||||
} else {
|
||||
this._initIframeSettings(options, 'iframe');
|
||||
}
|
||||
},
|
||||
|
||||
_getParamName: function (options) {
|
||||
var fileInput = $(options.fileInput),
|
||||
paramName = options.paramName;
|
||||
if (!paramName) {
|
||||
paramName = [];
|
||||
fileInput.each(function () {
|
||||
var input = $(this),
|
||||
name = input.prop('name') || 'files[]',
|
||||
i = (input.prop('files') || [1]).length;
|
||||
while (i) {
|
||||
paramName.push(name);
|
||||
i -= 1;
|
||||
}
|
||||
});
|
||||
if (!paramName.length) {
|
||||
paramName = [fileInput.prop('name') || 'files[]'];
|
||||
}
|
||||
} else if (!$.isArray(paramName)) {
|
||||
paramName = [paramName];
|
||||
}
|
||||
return paramName;
|
||||
},
|
||||
|
||||
_initFormSettings: function (options) {
|
||||
// Retrieve missing options from the input field and the
|
||||
// associated form, if available:
|
||||
if (!options.form || !options.form.length) {
|
||||
options.form = $(options.fileInput.prop('form'));
|
||||
}
|
||||
options.paramName = this._getParamName(options);
|
||||
if (!options.url) {
|
||||
options.url = options.form.prop('action') || location.href;
|
||||
}
|
||||
// The HTTP request method must be "POST" or "PUT":
|
||||
options.type = (options.type || options.form.prop('method') || '')
|
||||
.toUpperCase();
|
||||
if (options.type !== 'POST' && options.type !== 'PUT') {
|
||||
options.type = 'POST';
|
||||
}
|
||||
},
|
||||
|
||||
_getAJAXSettings: function (data) {
|
||||
var options = $.extend({}, this.options, data);
|
||||
this._initFormSettings(options);
|
||||
this._initDataSettings(options);
|
||||
return options;
|
||||
},
|
||||
|
||||
// Maps jqXHR callbacks to the equivalent
|
||||
// methods of the given Promise object:
|
||||
_enhancePromise: function (promise) {
|
||||
promise.success = promise.done;
|
||||
promise.error = promise.fail;
|
||||
promise.complete = promise.always;
|
||||
return promise;
|
||||
},
|
||||
|
||||
// Creates and returns a Promise object enhanced with
|
||||
// the jqXHR methods abort, success, error and complete:
|
||||
_getXHRPromise: function (resolveOrReject, context, args) {
|
||||
var dfd = $.Deferred(),
|
||||
promise = dfd.promise();
|
||||
context = context || this.options.context || promise;
|
||||
if (resolveOrReject === true) {
|
||||
dfd.resolveWith(context, args);
|
||||
} else if (resolveOrReject === false) {
|
||||
dfd.rejectWith(context, args);
|
||||
}
|
||||
promise.abort = dfd.promise;
|
||||
return this._enhancePromise(promise);
|
||||
},
|
||||
|
||||
// Uploads a file in multiple, sequential requests
|
||||
// by splitting the file up in multiple blob chunks.
|
||||
// If the second parameter is true, only tests if the file
|
||||
// should be uploaded in chunks, but does not invoke any
|
||||
// upload requests:
|
||||
_chunkedUpload: function (options, testOnly) {
|
||||
var that = this,
|
||||
file = options.files[0],
|
||||
fs = file.size,
|
||||
ub = options.uploadedBytes = options.uploadedBytes || 0,
|
||||
mcs = options.maxChunkSize || fs,
|
||||
// Use the Blob methods with the slice implementation
|
||||
// according to the W3C Blob API specification:
|
||||
slice = file.webkitSlice || file.mozSlice || file.slice,
|
||||
upload,
|
||||
n,
|
||||
jqXHR,
|
||||
pipe;
|
||||
if (!(this._isXHRUpload(options) && slice && (ub || mcs < fs)) ||
|
||||
options.data) {
|
||||
return false;
|
||||
}
|
||||
if (testOnly) {
|
||||
return true;
|
||||
}
|
||||
if (ub >= fs) {
|
||||
file.error = 'uploadedBytes';
|
||||
return this._getXHRPromise(
|
||||
false,
|
||||
options.context,
|
||||
[null, 'error', file.error]
|
||||
);
|
||||
}
|
||||
// n is the number of blobs to upload,
|
||||
// calculated via filesize, uploaded bytes and max chunk size:
|
||||
n = Math.ceil((fs - ub) / mcs);
|
||||
// The chunk upload method accepting the chunk number as parameter:
|
||||
upload = function (i) {
|
||||
if (!i) {
|
||||
return that._getXHRPromise(true, options.context);
|
||||
}
|
||||
// Upload the blobs in sequential order:
|
||||
return upload(i -= 1).pipe(function () {
|
||||
// Clone the options object for each chunk upload:
|
||||
var o = $.extend({}, options);
|
||||
o.blob = slice.call(
|
||||
file,
|
||||
ub + i * mcs,
|
||||
ub + (i + 1) * mcs
|
||||
);
|
||||
// Store the current chunk size, as the blob itself
|
||||
// will be dereferenced after data processing:
|
||||
o.chunkSize = o.blob.size;
|
||||
// Process the upload data (the blob and potential form data):
|
||||
that._initXHRData(o);
|
||||
// Add progress listeners for this chunk upload:
|
||||
that._initProgressListener(o);
|
||||
jqXHR = ($.ajax(o) || that._getXHRPromise(false, o.context))
|
||||
.done(function () {
|
||||
// Create a progress event if upload is done and
|
||||
// no progress event has been invoked for this chunk:
|
||||
if (!o.loaded) {
|
||||
that._onProgress($.Event('progress', {
|
||||
lengthComputable: true,
|
||||
loaded: o.chunkSize,
|
||||
total: o.chunkSize
|
||||
}), o);
|
||||
}
|
||||
options.uploadedBytes = o.uploadedBytes +=
|
||||
o.chunkSize;
|
||||
});
|
||||
return jqXHR;
|
||||
});
|
||||
};
|
||||
// Return the piped Promise object, enhanced with an abort method,
|
||||
// which is delegated to the jqXHR object of the current upload,
|
||||
// and jqXHR callbacks mapped to the equivalent Promise methods:
|
||||
pipe = upload(n);
|
||||
pipe.abort = function () {
|
||||
return jqXHR.abort();
|
||||
};
|
||||
return this._enhancePromise(pipe);
|
||||
},
|
||||
|
||||
_beforeSend: function (e, data) {
|
||||
if (this._active === 0) {
|
||||
// the start callback is triggered when an upload starts
|
||||
// and no other uploads are currently running,
|
||||
// equivalent to the global ajaxStart event:
|
||||
this._trigger('start');
|
||||
// Set timer for global bitrate progress calculation:
|
||||
this._bitrateTimer = new this._BitrateTimer();
|
||||
}
|
||||
this._active += 1;
|
||||
// Initialize the global progress values:
|
||||
this._loaded += data.uploadedBytes || 0;
|
||||
this._total += this._getTotal(data.files);
|
||||
},
|
||||
|
||||
_onDone: function (result, textStatus, jqXHR, options) {
|
||||
if (!this._isXHRUpload(options)) {
|
||||
// Create a progress event for each iframe load:
|
||||
this._onProgress($.Event('progress', {
|
||||
lengthComputable: true,
|
||||
loaded: 1,
|
||||
total: 1
|
||||
}), options);
|
||||
}
|
||||
options.result = result;
|
||||
options.textStatus = textStatus;
|
||||
options.jqXHR = jqXHR;
|
||||
this._trigger('done', null, options);
|
||||
},
|
||||
|
||||
_onFail: function (jqXHR, textStatus, errorThrown, options) {
|
||||
options.jqXHR = jqXHR;
|
||||
options.textStatus = textStatus;
|
||||
options.errorThrown = errorThrown;
|
||||
this._trigger('fail', null, options);
|
||||
if (options.recalculateProgress) {
|
||||
// Remove the failed (error or abort) file upload from
|
||||
// the global progress calculation:
|
||||
this._loaded -= options.loaded || options.uploadedBytes || 0;
|
||||
this._total -= options.total || this._getTotal(options.files);
|
||||
}
|
||||
},
|
||||
|
||||
_onAlways: function (jqXHRorResult, textStatus, jqXHRorError, options) {
|
||||
this._active -= 1;
|
||||
options.textStatus = textStatus;
|
||||
if (jqXHRorError && jqXHRorError.always) {
|
||||
options.jqXHR = jqXHRorError;
|
||||
options.result = jqXHRorResult;
|
||||
} else {
|
||||
options.jqXHR = jqXHRorResult;
|
||||
options.errorThrown = jqXHRorError;
|
||||
}
|
||||
this._trigger('always', null, options);
|
||||
if (this._active === 0) {
|
||||
// The stop callback is triggered when all uploads have
|
||||
// been completed, equivalent to the global ajaxStop event:
|
||||
this._trigger('stop');
|
||||
// Reset the global progress values:
|
||||
this._loaded = this._total = 0;
|
||||
this._bitrateTimer = null;
|
||||
}
|
||||
},
|
||||
|
||||
_onSend: function (e, data) {
|
||||
var that = this,
|
||||
jqXHR,
|
||||
slot,
|
||||
pipe,
|
||||
options = that._getAJAXSettings(data),
|
||||
send = function (resolve, args) {
|
||||
that._sending += 1;
|
||||
// Set timer for bitrate progress calculation:
|
||||
options._bitrateTimer = new that._BitrateTimer();
|
||||
jqXHR = jqXHR || (
|
||||
(resolve !== false &&
|
||||
that._trigger('send', e, options) !== false &&
|
||||
(that._chunkedUpload(options) || $.ajax(options))) ||
|
||||
that._getXHRPromise(false, options.context, args)
|
||||
).done(function (result, textStatus, jqXHR) {
|
||||
that._onDone(result, textStatus, jqXHR, options);
|
||||
}).fail(function (jqXHR, textStatus, errorThrown) {
|
||||
that._onFail(jqXHR, textStatus, errorThrown, options);
|
||||
}).always(function (jqXHRorResult, textStatus, jqXHRorError) {
|
||||
that._sending -= 1;
|
||||
that._onAlways(
|
||||
jqXHRorResult,
|
||||
textStatus,
|
||||
jqXHRorError,
|
||||
options
|
||||
);
|
||||
if (options.limitConcurrentUploads &&
|
||||
options.limitConcurrentUploads > that._sending) {
|
||||
// Start the next queued upload,
|
||||
// that has not been aborted:
|
||||
var nextSlot = that._slots.shift();
|
||||
while (nextSlot) {
|
||||
if (!nextSlot.isRejected()) {
|
||||
nextSlot.resolve();
|
||||
break;
|
||||
}
|
||||
nextSlot = that._slots.shift();
|
||||
}
|
||||
}
|
||||
});
|
||||
return jqXHR;
|
||||
};
|
||||
this._beforeSend(e, options);
|
||||
if (this.options.sequentialUploads ||
|
||||
(this.options.limitConcurrentUploads &&
|
||||
this.options.limitConcurrentUploads <= this._sending)) {
|
||||
if (this.options.limitConcurrentUploads > 1) {
|
||||
slot = $.Deferred();
|
||||
this._slots.push(slot);
|
||||
pipe = slot.pipe(send);
|
||||
} else {
|
||||
pipe = (this._sequence = this._sequence.pipe(send, send));
|
||||
}
|
||||
// Return the piped Promise object, enhanced with an abort method,
|
||||
// which is delegated to the jqXHR object of the current upload,
|
||||
// and jqXHR callbacks mapped to the equivalent Promise methods:
|
||||
pipe.abort = function () {
|
||||
var args = [undefined, 'abort', 'abort'];
|
||||
if (!jqXHR) {
|
||||
if (slot) {
|
||||
slot.rejectWith(args);
|
||||
}
|
||||
return send(false, args);
|
||||
}
|
||||
return jqXHR.abort();
|
||||
};
|
||||
return this._enhancePromise(pipe);
|
||||
}
|
||||
return send();
|
||||
},
|
||||
|
||||
_onAdd: function (e, data) {
|
||||
var that = this,
|
||||
result = true,
|
||||
options = $.extend({}, this.options, data),
|
||||
limit = options.limitMultiFileUploads,
|
||||
paramName = this._getParamName(options),
|
||||
paramNameSet,
|
||||
paramNameSlice,
|
||||
fileSet,
|
||||
i;
|
||||
if (!(options.singleFileUploads || limit) ||
|
||||
!this._isXHRUpload(options)) {
|
||||
fileSet = [data.files];
|
||||
paramNameSet = [paramName];
|
||||
} else if (!options.singleFileUploads && limit) {
|
||||
fileSet = [];
|
||||
paramNameSet = [];
|
||||
for (i = 0; i < data.files.length; i += limit) {
|
||||
fileSet.push(data.files.slice(i, i + limit));
|
||||
paramNameSlice = paramName.slice(i, i + limit);
|
||||
if (!paramNameSlice.length) {
|
||||
paramNameSlice = paramName;
|
||||
}
|
||||
paramNameSet.push(paramNameSlice);
|
||||
}
|
||||
} else {
|
||||
paramNameSet = paramName;
|
||||
}
|
||||
data.originalFiles = data.files;
|
||||
$.each(fileSet || data.files, function (index, element) {
|
||||
var newData = $.extend({}, data);
|
||||
newData.files = fileSet ? element : [element];
|
||||
newData.paramName = paramNameSet[index];
|
||||
newData.submit = function () {
|
||||
newData.jqXHR = this.jqXHR =
|
||||
(that._trigger('submit', e, this) !== false) &&
|
||||
that._onSend(e, this);
|
||||
return this.jqXHR;
|
||||
};
|
||||
return (result = that._trigger('add', e, newData));
|
||||
});
|
||||
return result;
|
||||
},
|
||||
|
||||
// File Normalization for Gecko 1.9.1 (Firefox 3.5) support:
|
||||
_normalizeFile: function (index, file) {
|
||||
if (file.name === undefined && file.size === undefined) {
|
||||
file.name = file.fileName;
|
||||
file.size = file.fileSize;
|
||||
}
|
||||
},
|
||||
|
||||
_replaceFileInput: function (input) {
|
||||
var inputClone = input.clone(true);
|
||||
$('<form></form>').append(inputClone)[0].reset();
|
||||
// Detaching allows to insert the fileInput on another form
|
||||
// without loosing the file input value:
|
||||
input.after(inputClone).detach();
|
||||
// Avoid memory leaks with the detached file input:
|
||||
$.cleanData(input.unbind('remove'));
|
||||
// Replace the original file input element in the fileInput
|
||||
// collection with the clone, which has been copied including
|
||||
// event handlers:
|
||||
this.options.fileInput = this.options.fileInput.map(function (i, el) {
|
||||
if (el === input[0]) {
|
||||
return inputClone[0];
|
||||
}
|
||||
return el;
|
||||
});
|
||||
// If the widget has been initialized on the file input itself,
|
||||
// override this.element with the file input clone:
|
||||
if (input[0] === this.element[0]) {
|
||||
this.element = inputClone;
|
||||
}
|
||||
},
|
||||
|
||||
_onChange: function (e) {
|
||||
var that = e.data.fileupload,
|
||||
data = {
|
||||
files: $.each($.makeArray(e.target.files), that._normalizeFile),
|
||||
fileInput: $(e.target),
|
||||
form: $(e.target.form)
|
||||
};
|
||||
if (!data.files.length) {
|
||||
// If the files property is not available, the browser does not
|
||||
// support the File API and we add a pseudo File object with
|
||||
// the input value as name with path information removed:
|
||||
data.files = [{name: e.target.value.replace(/^.*\\/, '')}];
|
||||
}
|
||||
if (that.options.replaceFileInput) {
|
||||
that._replaceFileInput(data.fileInput);
|
||||
}
|
||||
if (that._trigger('change', e, data) === false ||
|
||||
that._onAdd(e, data) === false) {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
_onPaste: function (e) {
|
||||
var that = e.data.fileupload,
|
||||
cbd = e.originalEvent.clipboardData,
|
||||
items = (cbd && cbd.items) || [],
|
||||
data = {files: []};
|
||||
$.each(items, function (index, item) {
|
||||
var file = item.getAsFile && item.getAsFile();
|
||||
if (file) {
|
||||
data.files.push(file);
|
||||
}
|
||||
});
|
||||
if (that._trigger('paste', e, data) === false ||
|
||||
that._onAdd(e, data) === false) {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
_onDrop: function (e) {
|
||||
var that = e.data.fileupload,
|
||||
dataTransfer = e.dataTransfer = e.originalEvent.dataTransfer,
|
||||
data = {
|
||||
files: $.each(
|
||||
$.makeArray(dataTransfer && dataTransfer.files),
|
||||
that._normalizeFile
|
||||
)
|
||||
};
|
||||
if (that._trigger('drop', e, data) === false ||
|
||||
that._onAdd(e, data) === false) {
|
||||
return false;
|
||||
}
|
||||
e.preventDefault();
|
||||
},
|
||||
|
||||
_onDragOver: function (e) {
|
||||
var that = e.data.fileupload,
|
||||
dataTransfer = e.dataTransfer = e.originalEvent.dataTransfer;
|
||||
if (that._trigger('dragover', e) === false) {
|
||||
return false;
|
||||
}
|
||||
if (dataTransfer) {
|
||||
dataTransfer.dropEffect = dataTransfer.effectAllowed = 'copy';
|
||||
}
|
||||
e.preventDefault();
|
||||
},
|
||||
|
||||
_initEventHandlers: function () {
|
||||
var ns = this.options.namespace;
|
||||
if (this._isXHRUpload(this.options)) {
|
||||
this.options.dropZone
|
||||
.bind('dragover.' + ns, {fileupload: this}, this._onDragOver)
|
||||
.bind('drop.' + ns, {fileupload: this}, this._onDrop)
|
||||
.bind('paste.' + ns, {fileupload: this}, this._onPaste);
|
||||
}
|
||||
this.options.fileInput
|
||||
.bind('change.' + ns, {fileupload: this}, this._onChange);
|
||||
},
|
||||
|
||||
_destroyEventHandlers: function () {
|
||||
var ns = this.options.namespace;
|
||||
this.options.dropZone
|
||||
.unbind('dragover.' + ns, this._onDragOver)
|
||||
.unbind('drop.' + ns, this._onDrop)
|
||||
.unbind('paste.' + ns, this._onPaste);
|
||||
this.options.fileInput
|
||||
.unbind('change.' + ns, this._onChange);
|
||||
},
|
||||
|
||||
_setOption: function (key, value) {
|
||||
var refresh = $.inArray(key, this._refreshOptionsList) !== -1;
|
||||
if (refresh) {
|
||||
this._destroyEventHandlers();
|
||||
}
|
||||
$.Widget.prototype._setOption.call(this, key, value);
|
||||
if (refresh) {
|
||||
this._initSpecialOptions();
|
||||
this._initEventHandlers();
|
||||
}
|
||||
},
|
||||
|
||||
_initSpecialOptions: function () {
|
||||
var options = this.options;
|
||||
if (options.fileInput === undefined) {
|
||||
options.fileInput = this.element.is('input:file') ?
|
||||
this.element : this.element.find('input:file');
|
||||
} else if (!(options.fileInput instanceof $)) {
|
||||
options.fileInput = $(options.fileInput);
|
||||
}
|
||||
if (!(options.dropZone instanceof $)) {
|
||||
options.dropZone = $(options.dropZone);
|
||||
}
|
||||
},
|
||||
|
||||
_create: function () {
|
||||
var options = this.options;
|
||||
// Initialize options set via HTML5 data-attributes:
|
||||
$.extend(options, $(this.element[0].cloneNode(false)).data());
|
||||
options.namespace = options.namespace || this.widgetName;
|
||||
this._initSpecialOptions();
|
||||
this._slots = [];
|
||||
this._sequence = this._getXHRPromise(true);
|
||||
this._sending = this._active = this._loaded = this._total = 0;
|
||||
this._initEventHandlers();
|
||||
},
|
||||
|
||||
destroy: function () {
|
||||
this._destroyEventHandlers();
|
||||
$.Widget.prototype.destroy.call(this);
|
||||
},
|
||||
|
||||
enable: function () {
|
||||
$.Widget.prototype.enable.call(this);
|
||||
this._initEventHandlers();
|
||||
},
|
||||
|
||||
disable: function () {
|
||||
this._destroyEventHandlers();
|
||||
$.Widget.prototype.disable.call(this);
|
||||
},
|
||||
|
||||
// This method is exposed to the widget API and allows adding files
|
||||
// using the fileupload API. The data parameter accepts an object which
|
||||
// must have a files property and can contain additional options:
|
||||
// .fileupload('add', {files: filesList});
|
||||
add: function (data) {
|
||||
if (!data || this.options.disabled) {
|
||||
return;
|
||||
}
|
||||
data.files = $.each($.makeArray(data.files), this._normalizeFile);
|
||||
this._onAdd(null, data);
|
||||
},
|
||||
|
||||
// This method is exposed to the widget API and allows sending files
|
||||
// using the fileupload API. The data parameter accepts an object which
|
||||
// must have a files property and can contain additional options:
|
||||
// .fileupload('send', {files: filesList});
|
||||
// The method returns a Promise object for the file upload call.
|
||||
send: function (data) {
|
||||
if (data && !this.options.disabled) {
|
||||
data.files = $.each($.makeArray(data.files), this._normalizeFile);
|
||||
if (data.files.length) {
|
||||
return this._onSend(null, data);
|
||||
}
|
||||
}
|
||||
return this._getXHRPromise(false, data && data.context);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}));
|
171
upload/admin_area/uploader/js/jquery.iframe-transport.js
Normal file
|
@ -0,0 +1,171 @@
|
|||
/*
|
||||
* jQuery Iframe Transport Plugin 1.4
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2011, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/*jslint unparam: true, nomen: true */
|
||||
/*global define, window, document */
|
||||
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define(['jquery'], factory);
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(window.jQuery);
|
||||
}
|
||||
}(function ($) {
|
||||
'use strict';
|
||||
|
||||
// Helper variable to create unique names for the transport iframes:
|
||||
var counter = 0;
|
||||
|
||||
// The iframe transport accepts three additional options:
|
||||
// options.fileInput: a jQuery collection of file input fields
|
||||
// options.paramName: the parameter name for the file form data,
|
||||
// overrides the name property of the file input field(s),
|
||||
// can be a string or an array of strings.
|
||||
// options.formData: an array of objects with name and value properties,
|
||||
// equivalent to the return data of .serializeArray(), e.g.:
|
||||
// [{name: 'a', value: 1}, {name: 'b', value: 2}]
|
||||
$.ajaxTransport('iframe', function (options) {
|
||||
if (options.async && (options.type === 'POST' || options.type === 'GET')) {
|
||||
var form,
|
||||
iframe;
|
||||
return {
|
||||
send: function (_, completeCallback) {
|
||||
form = $('<form style="display:none;"></form>');
|
||||
// javascript:false as initial iframe src
|
||||
// prevents warning popups on HTTPS in IE6.
|
||||
// IE versions below IE8 cannot set the name property of
|
||||
// elements that have already been added to the DOM,
|
||||
// so we set the name along with the iframe HTML markup:
|
||||
iframe = $(
|
||||
'<iframe src="javascript:false;" name="iframe-transport-' +
|
||||
(counter += 1) + '"></iframe>'
|
||||
).bind('load', function () {
|
||||
var fileInputClones,
|
||||
paramNames = $.isArray(options.paramName) ?
|
||||
options.paramName : [options.paramName];
|
||||
iframe
|
||||
.unbind('load')
|
||||
.bind('load', function () {
|
||||
var response;
|
||||
// Wrap in a try/catch block to catch exceptions thrown
|
||||
// when trying to access cross-domain iframe contents:
|
||||
try {
|
||||
response = iframe.contents();
|
||||
// Google Chrome and Firefox do not throw an
|
||||
// exception when calling iframe.contents() on
|
||||
// cross-domain requests, so we unify the response:
|
||||
if (!response.length || !response[0].firstChild) {
|
||||
throw new Error();
|
||||
}
|
||||
} catch (e) {
|
||||
response = undefined;
|
||||
}
|
||||
// The complete callback returns the
|
||||
// iframe content document as response object:
|
||||
completeCallback(
|
||||
200,
|
||||
'success',
|
||||
{'iframe': response}
|
||||
);
|
||||
// Fix for IE endless progress bar activity bug
|
||||
// (happens on form submits to iframe targets):
|
||||
$('<iframe src="javascript:false;"></iframe>')
|
||||
.appendTo(form);
|
||||
form.remove();
|
||||
});
|
||||
form
|
||||
.prop('target', iframe.prop('name'))
|
||||
.prop('action', options.url)
|
||||
.prop('method', options.type);
|
||||
if (options.formData) {
|
||||
$.each(options.formData, function (index, field) {
|
||||
$('<input type="hidden"/>')
|
||||
.prop('name', field.name)
|
||||
.val(field.value)
|
||||
.appendTo(form);
|
||||
});
|
||||
}
|
||||
if (options.fileInput && options.fileInput.length &&
|
||||
options.type === 'POST') {
|
||||
fileInputClones = options.fileInput.clone();
|
||||
// Insert a clone for each file input field:
|
||||
options.fileInput.after(function (index) {
|
||||
return fileInputClones[index];
|
||||
});
|
||||
if (options.paramName) {
|
||||
options.fileInput.each(function (index) {
|
||||
$(this).prop(
|
||||
'name',
|
||||
paramNames[index] || options.paramName
|
||||
);
|
||||
});
|
||||
}
|
||||
// Appending the file input fields to the hidden form
|
||||
// removes them from their original location:
|
||||
form
|
||||
.append(options.fileInput)
|
||||
.prop('enctype', 'multipart/form-data')
|
||||
// enctype must be set as encoding for IE:
|
||||
.prop('encoding', 'multipart/form-data');
|
||||
}
|
||||
form.submit();
|
||||
// Insert the file input fields at their original location
|
||||
// by replacing the clones with the originals:
|
||||
if (fileInputClones && fileInputClones.length) {
|
||||
options.fileInput.each(function (index, input) {
|
||||
var clone = $(fileInputClones[index]);
|
||||
$(input).prop('name', clone.prop('name'));
|
||||
clone.replaceWith(input);
|
||||
});
|
||||
}
|
||||
});
|
||||
form.append(iframe).appendTo(document.body);
|
||||
},
|
||||
abort: function () {
|
||||
if (iframe) {
|
||||
// javascript:false as iframe src aborts the request
|
||||
// and prevents warning popups on HTTPS in IE6.
|
||||
// concat is used to avoid the "Script URL" JSLint error:
|
||||
iframe
|
||||
.unbind('load')
|
||||
.prop('src', 'javascript'.concat(':false;'));
|
||||
}
|
||||
if (form) {
|
||||
form.remove();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// The iframe transport returns the iframe content document as response.
|
||||
// The following adds converters from iframe to text, json, html, and script:
|
||||
$.ajaxSetup({
|
||||
converters: {
|
||||
'iframe text': function (iframe) {
|
||||
return $(iframe[0].body).text();
|
||||
},
|
||||
'iframe json': function (iframe) {
|
||||
return $.parseJSON($(iframe[0].body).text());
|
||||
},
|
||||
'iframe html': function (iframe) {
|
||||
return $(iframe[0].body).html();
|
||||
},
|
||||
'iframe script': function (iframe) {
|
||||
return $.globalEval($(iframe[0].body).text());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}));
|
1
upload/admin_area/uploader/js/load-image.min.js
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
(function(a){"use strict";var b=function(a,c,d){var e=document.createElement("img"),f,g;return e.onerror=c,e.onload=function(){g&&b.revokeObjectURL(g),c(b.scale(e,d))},window.Blob&&a instanceof Blob||window.File&&a instanceof File?f=g=b.createObjectURL(a):f=a,f?(e.src=f,e):b.readFile(a,function(a){e.src=a})},c=window.createObjectURL&&window||window.URL&&URL||window.webkitURL&&webkitURL;b.scale=function(a,b){b=b||{};var c=document.createElement("canvas"),d=a.width,e=a.height,f=Math.max((b.minWidth||d)/d,(b.minHeight||e)/e);return f>1&&(d=parseInt(d*f,10),e=parseInt(e*f,10)),f=Math.min((b.maxWidth||d)/d,(b.maxHeight||e)/e),f<1&&(d=parseInt(d*f,10),e=parseInt(e*f,10)),a.getContext||b.canvas&&c.getContext?(c.width=d,c.height=e,c.getContext("2d").drawImage(a,0,0,d,e),c):(a.width=d,a.height=e,a)},b.createObjectURL=function(a){return c?c.createObjectURL(a):!1},b.revokeObjectURL=function(a){return c?c.revokeObjectURL(a):!1},b.readFile=function(a,b){if(window.FileReader&&FileReader.prototype.readAsDataURL){var c=new FileReader;return c.onload=function(a){b(a.target.result)},c.readAsDataURL(a),c}return!1},typeof define!="undefined"&&define.amd?define(function(){return b}):a.loadImage=b})(this);
|
29
upload/admin_area/uploader/js/locale.js
Normal file
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* jQuery File Upload Plugin Localization Example 6.5.1
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2012, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/*global window */
|
||||
|
||||
window.locale = {
|
||||
"fileupload": {
|
||||
"errors": {
|
||||
"maxFileSize": "File is too big",
|
||||
"minFileSize": "File is too small",
|
||||
"acceptFileTypes": "Filetype not allowed",
|
||||
"maxNumberOfFiles": "Max number of files exceeded",
|
||||
"uploadedBytes": "Uploaded bytes exceed file size",
|
||||
"emptyResult": "Empty file upload result"
|
||||
},
|
||||
"error": "Error",
|
||||
"start": "Start",
|
||||
"cancel": "Cancel",
|
||||
"destroy": "Delete"
|
||||
}
|
||||
};
|
78
upload/admin_area/uploader/js/main.js
Normal file
|
@ -0,0 +1,78 @@
|
|||
/*
|
||||
* jQuery File Upload Plugin JS Example 6.7
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2010, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
/*jslint nomen: true, unparam: true, regexp: true */
|
||||
/*global $, window, document */
|
||||
|
||||
$(function () {
|
||||
'use strict';
|
||||
|
||||
// Initialize the jQuery File Upload widget:
|
||||
$('#fileupload').fileupload();
|
||||
|
||||
// Enable iframe cross-domain access via redirect option:
|
||||
$('#fileupload').fileupload(
|
||||
'option',
|
||||
'redirect',
|
||||
window.location.href.replace(
|
||||
/\/[^\/]*$/,
|
||||
'/cors/result.html?%s'
|
||||
)
|
||||
);
|
||||
|
||||
if (window.location.hostname === 'blueimp.github.com') {
|
||||
// Demo settings:
|
||||
$('#fileupload').fileupload('option', {
|
||||
url: '//jquery-file-upload.appspot.com/',
|
||||
maxFileSize: 5000000,
|
||||
acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
|
||||
process: [
|
||||
{
|
||||
action: 'load',
|
||||
fileTypes: /^image\/(gif|jpeg|png)$/,
|
||||
maxFileSize: 20000000 // 20MB
|
||||
},
|
||||
{
|
||||
action: 'resize',
|
||||
maxWidth: 1440,
|
||||
maxHeight: 900
|
||||
},
|
||||
{
|
||||
action: 'save'
|
||||
}
|
||||
]
|
||||
});
|
||||
// Upload server status check for browsers with CORS support:
|
||||
if ($.support.cors) {
|
||||
$.ajax({
|
||||
url: '//jquery-file-upload.appspot.com/',
|
||||
type: 'HEAD'
|
||||
}).fail(function () {
|
||||
$('<span class="alert alert-error"/>')
|
||||
.text('Upload server currently unavailable - ' +
|
||||
new Date())
|
||||
.appendTo('#fileupload');
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// Load existing files:
|
||||
$('#fileupload').each(function () {
|
||||
var that = this;
|
||||
$.getJSON(this.action, function (result) {
|
||||
if (result && result.length) {
|
||||
$(that).fileupload('option', 'done')
|
||||
.call(that, null, {result: result});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
});
|
282
upload/admin_area/uploader/js/vendor/jquery.ui.widget.js
vendored
Normal file
|
@ -0,0 +1,282 @@
|
|||
/*
|
||||
* jQuery UI Widget 1.8.18+amd
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://docs.jquery.com/UI/Widget
|
||||
*/
|
||||
|
||||
(function (factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
// Register as an anonymous AMD module:
|
||||
define(["jquery"], factory);
|
||||
} else {
|
||||
// Browser globals:
|
||||
factory(jQuery);
|
||||
}
|
||||
}(function( $, undefined ) {
|
||||
|
||||
// jQuery 1.4+
|
||||
if ( $.cleanData ) {
|
||||
var _cleanData = $.cleanData;
|
||||
$.cleanData = function( elems ) {
|
||||
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
|
||||
try {
|
||||
$( elem ).triggerHandler( "remove" );
|
||||
// http://bugs.jquery.com/ticket/8235
|
||||
} catch( e ) {}
|
||||
}
|
||||
_cleanData( elems );
|
||||
};
|
||||
} else {
|
||||
var _remove = $.fn.remove;
|
||||
$.fn.remove = function( selector, keepData ) {
|
||||
return this.each(function() {
|
||||
if ( !keepData ) {
|
||||
if ( !selector || $.filter( selector, [ this ] ).length ) {
|
||||
$( "*", this ).add( [ this ] ).each(function() {
|
||||
try {
|
||||
$( this ).triggerHandler( "remove" );
|
||||
// http://bugs.jquery.com/ticket/8235
|
||||
} catch( e ) {}
|
||||
});
|
||||
}
|
||||
}
|
||||
return _remove.call( $(this), selector, keepData );
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
$.widget = function( name, base, prototype ) {
|
||||
var namespace = name.split( "." )[ 0 ],
|
||||
fullName;
|
||||
name = name.split( "." )[ 1 ];
|
||||
fullName = namespace + "-" + name;
|
||||
|
||||
if ( !prototype ) {
|
||||
prototype = base;
|
||||
base = $.Widget;
|
||||
}
|
||||
|
||||
// create selector for plugin
|
||||
$.expr[ ":" ][ fullName ] = function( elem ) {
|
||||
return !!$.data( elem, name );
|
||||
};
|
||||
|
||||
$[ namespace ] = $[ namespace ] || {};
|
||||
$[ namespace ][ name ] = function( options, element ) {
|
||||
// allow instantiation without initializing for simple inheritance
|
||||
if ( arguments.length ) {
|
||||
this._createWidget( options, element );
|
||||
}
|
||||
};
|
||||
|
||||
var basePrototype = new base();
|
||||
// we need to make the options hash a property directly on the new instance
|
||||
// otherwise we'll modify the options hash on the prototype that we're
|
||||
// inheriting from
|
||||
// $.each( basePrototype, function( key, val ) {
|
||||
// if ( $.isPlainObject(val) ) {
|
||||
// basePrototype[ key ] = $.extend( {}, val );
|
||||
// }
|
||||
// });
|
||||
basePrototype.options = $.extend( true, {}, basePrototype.options );
|
||||
$[ namespace ][ name ].prototype = $.extend( true, basePrototype, {
|
||||
namespace: namespace,
|
||||
widgetName: name,
|
||||
widgetEventPrefix: $[ namespace ][ name ].prototype.widgetEventPrefix || name,
|
||||
widgetBaseClass: fullName
|
||||
}, prototype );
|
||||
|
||||
$.widget.bridge( name, $[ namespace ][ name ] );
|
||||
};
|
||||
|
||||
$.widget.bridge = function( name, object ) {
|
||||
$.fn[ name ] = function( options ) {
|
||||
var isMethodCall = typeof options === "string",
|
||||
args = Array.prototype.slice.call( arguments, 1 ),
|
||||
returnValue = this;
|
||||
|
||||
// allow multiple hashes to be passed on init
|
||||
options = !isMethodCall && args.length ?
|
||||
$.extend.apply( null, [ true, options ].concat(args) ) :
|
||||
options;
|
||||
|
||||
// prevent calls to internal methods
|
||||
if ( isMethodCall && options.charAt( 0 ) === "_" ) {
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
if ( isMethodCall ) {
|
||||
this.each(function() {
|
||||
var instance = $.data( this, name ),
|
||||
methodValue = instance && $.isFunction( instance[options] ) ?
|
||||
instance[ options ].apply( instance, args ) :
|
||||
instance;
|
||||
// TODO: add this back in 1.9 and use $.error() (see #5972)
|
||||
// if ( !instance ) {
|
||||
// throw "cannot call methods on " + name + " prior to initialization; " +
|
||||
// "attempted to call method '" + options + "'";
|
||||
// }
|
||||
// if ( !$.isFunction( instance[options] ) ) {
|
||||
// throw "no such method '" + options + "' for " + name + " widget instance";
|
||||
// }
|
||||
// var methodValue = instance[ options ].apply( instance, args );
|
||||
if ( methodValue !== instance && methodValue !== undefined ) {
|
||||
returnValue = methodValue;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.each(function() {
|
||||
var instance = $.data( this, name );
|
||||
if ( instance ) {
|
||||
instance.option( options || {} )._init();
|
||||
} else {
|
||||
$.data( this, name, new object( options, this ) );
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
};
|
||||
};
|
||||
|
||||
$.Widget = function( options, element ) {
|
||||
// allow instantiation without initializing for simple inheritance
|
||||
if ( arguments.length ) {
|
||||
this._createWidget( options, element );
|
||||
}
|
||||
};
|
||||
|
||||
$.Widget.prototype = {
|
||||
widgetName: "widget",
|
||||
widgetEventPrefix: "",
|
||||
options: {
|
||||
disabled: false
|
||||
},
|
||||
_createWidget: function( options, element ) {
|
||||
// $.widget.bridge stores the plugin instance, but we do it anyway
|
||||
// so that it's stored even before the _create function runs
|
||||
$.data( element, this.widgetName, this );
|
||||
this.element = $( element );
|
||||
this.options = $.extend( true, {},
|
||||
this.options,
|
||||
this._getCreateOptions(),
|
||||
options );
|
||||
|
||||
var self = this;
|
||||
this.element.bind( "remove." + this.widgetName, function() {
|
||||
self.destroy();
|
||||
});
|
||||
|
||||
this._create();
|
||||
this._trigger( "create" );
|
||||
this._init();
|
||||
},
|
||||
_getCreateOptions: function() {
|
||||
return $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ];
|
||||
},
|
||||
_create: function() {},
|
||||
_init: function() {},
|
||||
|
||||
destroy: function() {
|
||||
this.element
|
||||
.unbind( "." + this.widgetName )
|
||||
.removeData( this.widgetName );
|
||||
this.widget()
|
||||
.unbind( "." + this.widgetName )
|
||||
.removeAttr( "aria-disabled" )
|
||||
.removeClass(
|
||||
this.widgetBaseClass + "-disabled " +
|
||||
"ui-state-disabled" );
|
||||
},
|
||||
|
||||
widget: function() {
|
||||
return this.element;
|
||||
},
|
||||
|
||||
option: function( key, value ) {
|
||||
var options = key;
|
||||
|
||||
if ( arguments.length === 0 ) {
|
||||
// don't return a reference to the internal hash
|
||||
return $.extend( {}, this.options );
|
||||
}
|
||||
|
||||
if (typeof key === "string" ) {
|
||||
if ( value === undefined ) {
|
||||
return this.options[ key ];
|
||||
}
|
||||
options = {};
|
||||
options[ key ] = value;
|
||||
}
|
||||
|
||||
this._setOptions( options );
|
||||
|
||||
return this;
|
||||
},
|
||||
_setOptions: function( options ) {
|
||||
var self = this;
|
||||
$.each( options, function( key, value ) {
|
||||
self._setOption( key, value );
|
||||
});
|
||||
|
||||
return this;
|
||||
},
|
||||
_setOption: function( key, value ) {
|
||||
this.options[ key ] = value;
|
||||
|
||||
if ( key === "disabled" ) {
|
||||
this.widget()
|
||||
[ value ? "addClass" : "removeClass"](
|
||||
this.widgetBaseClass + "-disabled" + " " +
|
||||
"ui-state-disabled" )
|
||||
.attr( "aria-disabled", value );
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
enable: function() {
|
||||
return this._setOption( "disabled", false );
|
||||
},
|
||||
disable: function() {
|
||||
return this._setOption( "disabled", true );
|
||||
},
|
||||
|
||||
_trigger: function( type, event, data ) {
|
||||
var prop, orig,
|
||||
callback = this.options[ type ];
|
||||
|
||||
data = data || {};
|
||||
event = $.Event( event );
|
||||
event.type = ( type === this.widgetEventPrefix ?
|
||||
type :
|
||||
this.widgetEventPrefix + type ).toLowerCase();
|
||||
// the original event may come from any element
|
||||
// so we need to reset the target on the new event
|
||||
event.target = this.element[ 0 ];
|
||||
|
||||
// copy original event properties over to the new event
|
||||
orig = event.originalEvent;
|
||||
if ( orig ) {
|
||||
for ( prop in orig ) {
|
||||
if ( !( prop in event ) ) {
|
||||
event[ prop ] = orig[ prop ];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.element.trigger( event, data );
|
||||
|
||||
return !( $.isFunction(callback) &&
|
||||
callback.call( this.element[0], event, data ) === false ||
|
||||
event.isDefaultPrevented() );
|
||||
}
|
||||
};
|
||||
|
||||
}));
|
4
upload/admin_area/uploader/server/php/files/.htaccess
Normal file
|
@ -0,0 +1,4 @@
|
|||
ForceType application/octet-stream
|
||||
<FilesMatch "(?i)\.(gif|jpe?g|png)$">
|
||||
ForceType none
|
||||
</FilesMatch>
|
BIN
upload/admin_area/uploader/server/php/files/IMAG0060.jpg
Normal file
After Width: | Height: | Size: 630 KiB |
BIN
upload/admin_area/uploader/server/php/files/Jellyfish.jpg
Normal file
After Width: | Height: | Size: 758 KiB |
BIN
upload/admin_area/uploader/server/php/files/Penguins.jpg
Normal file
After Width: | Height: | Size: 760 KiB |
BIN
upload/admin_area/uploader/server/php/files/Tulips (1).jpg
Normal file
After Width: | Height: | Size: 606 KiB |
BIN
upload/admin_area/uploader/server/php/files/Tulips.jpg
Normal file
After Width: | Height: | Size: 606 KiB |
After Width: | Height: | Size: 3.4 MiB |
46
upload/admin_area/uploader/server/php/index.php
Normal file
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
/*
|
||||
* jQuery File Upload Plugin PHP Example 5.7
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2010, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
error_reporting(E_ALL | E_STRICT);
|
||||
|
||||
require('upload.class.php');
|
||||
|
||||
$upload_handler = new UploadHandler();
|
||||
|
||||
header('Pragma: no-cache');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Content-Disposition: inline; filename="files.json"');
|
||||
header('X-Content-Type-Options: nosniff');
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
header('Access-Control-Allow-Methods: OPTIONS, HEAD, GET, POST, PUT, DELETE');
|
||||
header('Access-Control-Allow-Headers: X-File-Name, X-File-Type, X-File-Size');
|
||||
|
||||
switch ($_SERVER['REQUEST_METHOD']) {
|
||||
case 'OPTIONS':
|
||||
break;
|
||||
case 'HEAD':
|
||||
case 'GET':
|
||||
$upload_handler->get();
|
||||
break;
|
||||
case 'POST':
|
||||
if (isset($_REQUEST['_method']) && $_REQUEST['_method'] === 'DELETE') {
|
||||
$upload_handler->delete();
|
||||
} else {
|
||||
$upload_handler->post();
|
||||
}
|
||||
break;
|
||||
case 'DELETE':
|
||||
$upload_handler->delete();
|
||||
break;
|
||||
default:
|
||||
header('HTTP/1.1 405 Method Not Allowed');
|
||||
}
|
435
upload/admin_area/uploader/server/php/upload.class.php
Normal file
|
@ -0,0 +1,435 @@
|
|||
<?php
|
||||
/*
|
||||
* jQuery File Upload Plugin PHP Class 5.11
|
||||
* https://github.com/blueimp/jQuery-File-Upload
|
||||
*
|
||||
* Copyright 2010, Sebastian Tschan
|
||||
* https://blueimp.net
|
||||
*
|
||||
* Licensed under the MIT license:
|
||||
* http://www.opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
class UploadHandler
|
||||
{
|
||||
protected $options;
|
||||
|
||||
function __construct($options=null) {
|
||||
$this->options = array(
|
||||
'script_url' => $this->getFullUrl().'/',
|
||||
'upload_dir' => dirname($_SERVER['SCRIPT_FILENAME']).'/files/',
|
||||
'upload_url' => $this->getFullUrl().'/files/',
|
||||
'param_name' => 'files',
|
||||
// Set the following option to 'POST', if your server does not support
|
||||
// DELETE requests. This is a parameter sent to the client:
|
||||
'delete_type' => 'DELETE',
|
||||
// The php.ini settings upload_max_filesize and post_max_size
|
||||
// take precedence over the following max_file_size setting:
|
||||
'max_file_size' => null,
|
||||
'min_file_size' => 1,
|
||||
'accept_file_types' => '/.+$/i',
|
||||
// The maximum number of files for the upload directory:
|
||||
'max_number_of_files' => null,
|
||||
// Image resolution restrictions:
|
||||
'max_width' => null,
|
||||
'max_height' => null,
|
||||
'min_width' => 1,
|
||||
'min_height' => 1,
|
||||
// Set the following option to false to enable resumable uploads:
|
||||
'discard_aborted_uploads' => true,
|
||||
// Set to true to rotate images based on EXIF meta data, if available:
|
||||
'orient_image' => false,
|
||||
'image_versions' => array(
|
||||
// Uncomment the following version to restrict the size of
|
||||
// uploaded images. You can also add additional versions with
|
||||
// their own upload directories:
|
||||
/*
|
||||
'large' => array(
|
||||
'upload_dir' => dirname($_SERVER['SCRIPT_FILENAME']).'/files/',
|
||||
'upload_url' => $this->getFullUrl().'/files/',
|
||||
'max_width' => 1920,
|
||||
'max_height' => 1200,
|
||||
'jpeg_quality' => 95
|
||||
),
|
||||
*/
|
||||
'thumbnail' => array(
|
||||
'upload_dir' => dirname($_SERVER['SCRIPT_FILENAME']).'/thumbnails/',
|
||||
'upload_url' => $this->getFullUrl().'/thumbnails/',
|
||||
'max_width' => 80,
|
||||
'max_height' => 80
|
||||
)
|
||||
)
|
||||
);
|
||||
if ($options) {
|
||||
$this->options = array_replace_recursive($this->options, $options);
|
||||
}
|
||||
}
|
||||
|
||||
protected function getFullUrl() {
|
||||
return
|
||||
(isset($_SERVER['HTTPS']) ? 'https://' : 'http://').
|
||||
(isset($_SERVER['REMOTE_USER']) ? $_SERVER['REMOTE_USER'].'@' : '').
|
||||
(isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ($_SERVER['SERVER_NAME'].
|
||||
(isset($_SERVER['HTTPS']) && $_SERVER['SERVER_PORT'] === 443 ||
|
||||
$_SERVER['SERVER_PORT'] === 80 ? '' : ':'.$_SERVER['SERVER_PORT']))).
|
||||
substr($_SERVER['SCRIPT_NAME'],0, strrpos($_SERVER['SCRIPT_NAME'], '/'));
|
||||
}
|
||||
|
||||
protected function set_file_delete_url($file) {
|
||||
$file->delete_url = $this->options['script_url']
|
||||
.'?file='.rawurlencode($file->name);
|
||||
$file->delete_type = $this->options['delete_type'];
|
||||
if ($file->delete_type !== 'DELETE') {
|
||||
$file->delete_url .= '&_method=DELETE';
|
||||
}
|
||||
}
|
||||
|
||||
protected function get_file_object($file_name) {
|
||||
$file_path = $this->options['upload_dir'].$file_name;
|
||||
if (is_file($file_path) && $file_name[0] !== '.') {
|
||||
$file = new stdClass();
|
||||
$file->name = $file_name;
|
||||
$file->size = filesize($file_path);
|
||||
$file->url = $this->options['upload_url'].rawurlencode($file->name);
|
||||
foreach($this->options['image_versions'] as $version => $options) {
|
||||
if (is_file($options['upload_dir'].$file_name)) {
|
||||
$file->{$version.'_url'} = $options['upload_url']
|
||||
.rawurlencode($file->name);
|
||||
}
|
||||
}
|
||||
$this->set_file_delete_url($file);
|
||||
return $file;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected function get_file_objects() {
|
||||
return array_values(array_filter(array_map(
|
||||
array($this, 'get_file_object'),
|
||||
scandir($this->options['upload_dir'])
|
||||
)));
|
||||
}
|
||||
|
||||
protected function create_scaled_image($file_name, $options) {
|
||||
$file_path = $this->options['upload_dir'].$file_name;
|
||||
$new_file_path = $options['upload_dir'].$file_name;
|
||||
list($img_width, $img_height) = @getimagesize($file_path);
|
||||
if (!$img_width || !$img_height) {
|
||||
return false;
|
||||
}
|
||||
$scale = min(
|
||||
$options['max_width'] / $img_width,
|
||||
$options['max_height'] / $img_height
|
||||
);
|
||||
if ($scale >= 1) {
|
||||
if ($file_path !== $new_file_path) {
|
||||
return copy($file_path, $new_file_path);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
$new_width = $img_width * $scale;
|
||||
$new_height = $img_height * $scale;
|
||||
$new_img = @imagecreatetruecolor($new_width, $new_height);
|
||||
switch (strtolower(substr(strrchr($file_name, '.'), 1))) {
|
||||
case 'jpg':
|
||||
case 'jpeg':
|
||||
$src_img = @imagecreatefromjpeg($file_path);
|
||||
$write_image = 'imagejpeg';
|
||||
$image_quality = isset($options['jpeg_quality']) ?
|
||||
$options['jpeg_quality'] : 75;
|
||||
break;
|
||||
case 'gif':
|
||||
@imagecolortransparent($new_img, @imagecolorallocate($new_img, 0, 0, 0));
|
||||
$src_img = @imagecreatefromgif($file_path);
|
||||
$write_image = 'imagegif';
|
||||
$image_quality = null;
|
||||
break;
|
||||
case 'png':
|
||||
@imagecolortransparent($new_img, @imagecolorallocate($new_img, 0, 0, 0));
|
||||
@imagealphablending($new_img, false);
|
||||
@imagesavealpha($new_img, true);
|
||||
$src_img = @imagecreatefrompng($file_path);
|
||||
$write_image = 'imagepng';
|
||||
$image_quality = isset($options['png_quality']) ?
|
||||
$options['png_quality'] : 9;
|
||||
break;
|
||||
default:
|
||||
$src_img = null;
|
||||
}
|
||||
$success = $src_img && @imagecopyresampled(
|
||||
$new_img,
|
||||
$src_img,
|
||||
0, 0, 0, 0,
|
||||
$new_width,
|
||||
$new_height,
|
||||
$img_width,
|
||||
$img_height
|
||||
) && $write_image($new_img, $new_file_path, $image_quality);
|
||||
// Free up memory (imagedestroy does not delete files):
|
||||
@imagedestroy($src_img);
|
||||
@imagedestroy($new_img);
|
||||
return $success;
|
||||
}
|
||||
|
||||
protected function validate($uploaded_file, $file, $error, $index) {
|
||||
if ($error) {
|
||||
$file->error = $error;
|
||||
return false;
|
||||
}
|
||||
if (!$file->name) {
|
||||
$file->error = 'missingFileName';
|
||||
return false;
|
||||
}
|
||||
if (!preg_match($this->options['accept_file_types'], $file->name)) {
|
||||
$file->error = 'acceptFileTypes';
|
||||
return false;
|
||||
}
|
||||
if ($uploaded_file && is_uploaded_file($uploaded_file)) {
|
||||
$file_size = filesize($uploaded_file);
|
||||
} else {
|
||||
$file_size = $_SERVER['CONTENT_LENGTH'];
|
||||
}
|
||||
if ($this->options['max_file_size'] && (
|
||||
$file_size > $this->options['max_file_size'] ||
|
||||
$file->size > $this->options['max_file_size'])
|
||||
) {
|
||||
$file->error = 'maxFileSize';
|
||||
return false;
|
||||
}
|
||||
if ($this->options['min_file_size'] &&
|
||||
$file_size < $this->options['min_file_size']) {
|
||||
$file->error = 'minFileSize';
|
||||
return false;
|
||||
}
|
||||
if (is_int($this->options['max_number_of_files']) && (
|
||||
count($this->get_file_objects()) >= $this->options['max_number_of_files'])
|
||||
) {
|
||||
$file->error = 'maxNumberOfFiles';
|
||||
return false;
|
||||
}
|
||||
list($img_width, $img_height) = @getimagesize($uploaded_file);
|
||||
if (is_int($img_width)) {
|
||||
if ($this->options['max_width'] && $img_width > $this->options['max_width'] ||
|
||||
$this->options['max_height'] && $img_height > $this->options['max_height']) {
|
||||
$file->error = 'maxResolution';
|
||||
return false;
|
||||
}
|
||||
if ($this->options['min_width'] && $img_width < $this->options['min_width'] ||
|
||||
$this->options['min_height'] && $img_height < $this->options['min_height']) {
|
||||
$file->error = 'minResolution';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function upcount_name_callback($matches) {
|
||||
$index = isset($matches[1]) ? intval($matches[1]) + 1 : 1;
|
||||
$ext = isset($matches[2]) ? $matches[2] : '';
|
||||
return ' ('.$index.')'.$ext;
|
||||
}
|
||||
|
||||
protected function upcount_name($name) {
|
||||
return preg_replace_callback(
|
||||
'/(?:(?: \(([\d]+)\))?(\.[^.]+))?$/',
|
||||
array($this, 'upcount_name_callback'),
|
||||
$name,
|
||||
1
|
||||
);
|
||||
}
|
||||
|
||||
protected function trim_file_name($name, $type, $index) {
|
||||
// Remove path information and dots around the filename, to prevent uploading
|
||||
// into different directories or replacing hidden system files.
|
||||
// Also remove control characters and spaces (\x00..\x20) around the filename:
|
||||
$file_name = trim(basename(stripslashes($name)), ".\x00..\x20");
|
||||
// Add missing file extension for known image types:
|
||||
if (strpos($file_name, '.') === false &&
|
||||
preg_match('/^image\/(gif|jpe?g|png)/', $type, $matches)) {
|
||||
$file_name .= '.'.$matches[1];
|
||||
}
|
||||
if ($this->options['discard_aborted_uploads']) {
|
||||
while(is_file($this->options['upload_dir'].$file_name)) {
|
||||
$file_name = $this->upcount_name($file_name);
|
||||
}
|
||||
}
|
||||
return $file_name;
|
||||
}
|
||||
|
||||
protected function handle_form_data($file, $index) {
|
||||
// Handle form data, e.g. $_REQUEST['description'][$index]
|
||||
}
|
||||
|
||||
protected function orient_image($file_path) {
|
||||
$exif = @exif_read_data($file_path);
|
||||
if ($exif === false) {
|
||||
return false;
|
||||
}
|
||||
$orientation = intval(@$exif['Orientation']);
|
||||
if (!in_array($orientation, array(3, 6, 8))) {
|
||||
return false;
|
||||
}
|
||||
$image = @imagecreatefromjpeg($file_path);
|
||||
switch ($orientation) {
|
||||
case 3:
|
||||
$image = @imagerotate($image, 180, 0);
|
||||
break;
|
||||
case 6:
|
||||
$image = @imagerotate($image, 270, 0);
|
||||
break;
|
||||
case 8:
|
||||
$image = @imagerotate($image, 90, 0);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
$success = imagejpeg($image, $file_path);
|
||||
// Free up memory (imagedestroy does not delete files):
|
||||
@imagedestroy($image);
|
||||
return $success;
|
||||
}
|
||||
|
||||
protected function handle_file_upload($uploaded_file, $name, $size, $type, $error, $index) {
|
||||
$file = new stdClass();
|
||||
$file->name = $this->trim_file_name($name, $type, $index);
|
||||
$file->size = intval($size);
|
||||
$file->type = $type;
|
||||
if ($this->validate($uploaded_file, $file, $error, $index)) {
|
||||
$this->handle_form_data($file, $index);
|
||||
$file_path = $this->options['upload_dir'].$file->name;
|
||||
$append_file = !$this->options['discard_aborted_uploads'] &&
|
||||
is_file($file_path) && $file->size > filesize($file_path);
|
||||
clearstatcache();
|
||||
if ($uploaded_file && is_uploaded_file($uploaded_file)) {
|
||||
// multipart/formdata uploads (POST method uploads)
|
||||
if ($append_file) {
|
||||
file_put_contents(
|
||||
$file_path,
|
||||
fopen($uploaded_file, 'r'),
|
||||
FILE_APPEND
|
||||
);
|
||||
} else {
|
||||
move_uploaded_file($uploaded_file, $file_path);
|
||||
}
|
||||
} else {
|
||||
// Non-multipart uploads (PUT method support)
|
||||
file_put_contents(
|
||||
$file_path,
|
||||
fopen('php://input', 'r'),
|
||||
$append_file ? FILE_APPEND : 0
|
||||
);
|
||||
}
|
||||
$file_size = filesize($file_path);
|
||||
if ($file_size === $file->size) {
|
||||
if ($this->options['orient_image']) {
|
||||
$this->orient_image($file_path);
|
||||
}
|
||||
$file->url = $this->options['upload_url'].rawurlencode($file->name);
|
||||
foreach($this->options['image_versions'] as $version => $options) {
|
||||
if ($this->create_scaled_image($file->name, $options)) {
|
||||
if ($this->options['upload_dir'] !== $options['upload_dir']) {
|
||||
$file->{$version.'_url'} = $options['upload_url']
|
||||
.rawurlencode($file->name);
|
||||
} else {
|
||||
clearstatcache();
|
||||
$file_size = filesize($file_path);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if ($this->options['discard_aborted_uploads']) {
|
||||
unlink($file_path);
|
||||
$file->error = 'abort';
|
||||
}
|
||||
$file->size = $file_size;
|
||||
$this->set_file_delete_url($file);
|
||||
}
|
||||
return $file;
|
||||
}
|
||||
|
||||
public function get() {
|
||||
$file_name = isset($_REQUEST['file']) ?
|
||||
basename(stripslashes($_REQUEST['file'])) : null;
|
||||
if ($file_name) {
|
||||
$info = $this->get_file_object($file_name);
|
||||
} else {
|
||||
$info = $this->get_file_objects();
|
||||
}
|
||||
header('Content-type: application/json');
|
||||
echo json_encode($info);
|
||||
}
|
||||
|
||||
public function post() {
|
||||
if (isset($_REQUEST['_method']) && $_REQUEST['_method'] === 'DELETE') {
|
||||
return $this->delete();
|
||||
}
|
||||
$upload = isset($_FILES[$this->options['param_name']]) ?
|
||||
$_FILES[$this->options['param_name']] : null;
|
||||
$info = array();
|
||||
if ($upload && is_array($upload['tmp_name'])) {
|
||||
// param_name is an array identifier like "files[]",
|
||||
// $_FILES is a multi-dimensional array:
|
||||
foreach ($upload['tmp_name'] as $index => $value) {
|
||||
$info[] = $this->handle_file_upload(
|
||||
$upload['tmp_name'][$index],
|
||||
isset($_SERVER['HTTP_X_FILE_NAME']) ?
|
||||
$_SERVER['HTTP_X_FILE_NAME'] : $upload['name'][$index],
|
||||
isset($_SERVER['HTTP_X_FILE_SIZE']) ?
|
||||
$_SERVER['HTTP_X_FILE_SIZE'] : $upload['size'][$index],
|
||||
isset($_SERVER['HTTP_X_FILE_TYPE']) ?
|
||||
$_SERVER['HTTP_X_FILE_TYPE'] : $upload['type'][$index],
|
||||
$upload['error'][$index],
|
||||
$index
|
||||
);
|
||||
}
|
||||
} elseif ($upload || isset($_SERVER['HTTP_X_FILE_NAME'])) {
|
||||
// param_name is a single object identifier like "file",
|
||||
// $_FILES is a one-dimensional array:
|
||||
$info[] = $this->handle_file_upload(
|
||||
isset($upload['tmp_name']) ? $upload['tmp_name'] : null,
|
||||
isset($_SERVER['HTTP_X_FILE_NAME']) ?
|
||||
$_SERVER['HTTP_X_FILE_NAME'] : (isset($upload['name']) ?
|
||||
$upload['name'] : null),
|
||||
isset($_SERVER['HTTP_X_FILE_SIZE']) ?
|
||||
$_SERVER['HTTP_X_FILE_SIZE'] : (isset($upload['size']) ?
|
||||
$upload['size'] : null),
|
||||
isset($_SERVER['HTTP_X_FILE_TYPE']) ?
|
||||
$_SERVER['HTTP_X_FILE_TYPE'] : (isset($upload['type']) ?
|
||||
$upload['type'] : null),
|
||||
isset($upload['error']) ? $upload['error'] : null
|
||||
);
|
||||
}
|
||||
header('Vary: Accept');
|
||||
$json = json_encode($info);
|
||||
$redirect = isset($_REQUEST['redirect']) ?
|
||||
stripslashes($_REQUEST['redirect']) : null;
|
||||
if ($redirect) {
|
||||
header('Location: '.sprintf($redirect, rawurlencode($json)));
|
||||
return;
|
||||
}
|
||||
if (isset($_SERVER['HTTP_ACCEPT']) &&
|
||||
(strpos($_SERVER['HTTP_ACCEPT'], 'application/json') !== false)) {
|
||||
header('Content-type: application/json');
|
||||
} else {
|
||||
header('Content-type: text/plain');
|
||||
}
|
||||
echo $json;
|
||||
}
|
||||
|
||||
public function delete() {
|
||||
$file_name = isset($_REQUEST['file']) ?
|
||||
basename(stripslashes($_REQUEST['file'])) : null;
|
||||
$file_path = $this->options['upload_dir'].$file_name;
|
||||
$success = is_file($file_path) && $file_name[0] !== '.' && unlink($file_path);
|
||||
if ($success) {
|
||||
foreach($this->options['image_versions'] as $version => $options) {
|
||||
$file = $options['upload_dir'].$file_name;
|
||||
if (is_file($file)) {
|
||||
unlink($file);
|
||||
}
|
||||
}
|
||||
}
|
||||
header('Content-type: application/json');
|
||||
echo json_encode($success);
|
||||
}
|
||||
|
||||
}
|
|
@ -1101,6 +1101,8 @@ CREATE TABLE IF NOT EXISTS `{tbl_prefix}mass_emails` (
|
|||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
|
||||
|
||||
|
||||
-- Alterations for 3.0
|
||||
|
||||
ALTER TABLE `{tbl_prefix}video` ADD `slug_id` INT( 255 ) NOT NULL AFTER `videokey`;
|
||||
CREATE TABLE IF NOT EXISTS `{tbl_prefix}slugs` (
|
||||
`slug_id` int(255) NOT NULL AUTO_INCREMENT,
|
||||
|
@ -1110,3 +1112,8 @@ CREATE TABLE IF NOT EXISTS `{tbl_prefix}slugs` (
|
|||
`slug` mediumtext CHARACTER SET utf8 NOT NULL,
|
||||
PRIMARY KEY (`slug_id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
|
||||
|
||||
ALTER TABLE `{tbl_prefix}video_categories` ADD `category_icon` VARCHAR( 100 ) NOT NULL AFTER `category_name`;
|
||||
ALTER TABLE `{tbl_prefix}user_categories` ADD `category_icon` VARCHAR( 100 ) NOT NULL AFTER `category_name`;
|
||||
ALTER TABLE `{tbl_prefix}group_categories` ADD `category_icon` VARCHAR( 100 ) NOT NULL AFTER `category_name`;
|
||||
ALTER TABLE `{tbl_prefix}collection_categories` ADD `category_icon` VARCHAR( 100 ) NOT NULL AFTER `category_name`;
|
|
@ -7,4 +7,9 @@ CREATE TABLE IF NOT EXISTS `{tbl_prefix}slugs` (
|
|||
`in_use` enum('yes','no') NOT NULL DEFAULT 'yes',
|
||||
`slug` mediumtext CHARACTER SET utf8 NOT NULL,
|
||||
PRIMARY KEY (`slug_id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
|
||||
|
||||
ALTER TABLE `{tbl_prefix}video_categories` ADD `category_icon` VARCHAR( 100 ) NOT NULL AFTER `category_name`;
|
||||
ALTER TABLE `{tbl_prefix}user_categories` ADD `category_icon` VARCHAR( 100 ) NOT NULL AFTER `category_name`;
|
||||
ALTER TABLE `{tbl_prefix}group_categories` ADD `category_icon` VARCHAR( 100 ) NOT NULL AFTER `category_name`;
|
||||
ALTER TABLE `{tbl_prefix}collection_categories` ADD `category_icon` VARCHAR( 100 ) NOT NULL AFTER `category_name`;
|
BIN
upload/images/category-icons/airplane.png
Normal file
After Width: | Height: | Size: 548 B |
BIN
upload/images/category-icons/alarm.png
Normal file
After Width: | Height: | Size: 735 B |
BIN
upload/images/category-icons/baseball.png
Normal file
After Width: | Height: | Size: 633 B |
BIN
upload/images/category-icons/bowling.png
Normal file
After Width: | Height: | Size: 545 B |
BIN
upload/images/category-icons/car.png
Normal file
After Width: | Height: | Size: 521 B |
BIN
upload/images/category-icons/celebration.png
Normal file
After Width: | Height: | Size: 608 B |
BIN
upload/images/category-icons/cloud.png
Normal file
After Width: | Height: | Size: 402 B |
BIN
upload/images/category-icons/comedy.png
Normal file
After Width: | Height: | Size: 752 B |
BIN
upload/images/category-icons/comments.png
Normal file
After Width: | Height: | Size: 476 B |
BIN
upload/images/category-icons/cup.png
Normal file
After Width: | Height: | Size: 608 B |
BIN
upload/images/category-icons/default.png
Normal file
After Width: | Height: | Size: 220 B |
BIN
upload/images/category-icons/direction.png
Normal file
After Width: | Height: | Size: 630 B |
BIN
upload/images/category-icons/drink.png
Normal file
After Width: | Height: | Size: 701 B |
BIN
upload/images/category-icons/film.png
Normal file
After Width: | Height: | Size: 405 B |
BIN
upload/images/category-icons/flower.png
Normal file
After Width: | Height: | Size: 568 B |
BIN
upload/images/category-icons/iphone.png
Normal file
After Width: | Height: | Size: 276 B |
BIN
upload/images/category-icons/islam.png
Normal file
After Width: | Height: | Size: 630 B |
BIN
upload/images/category-icons/microphone.png
Normal file
After Width: | Height: | Size: 565 B |
BIN
upload/images/category-icons/music.png
Normal file
After Width: | Height: | Size: 590 B |
BIN
upload/images/category-icons/piano.png
Normal file
After Width: | Height: | Size: 565 B |
BIN
upload/images/category-icons/picture.png
Normal file
After Width: | Height: | Size: 541 B |
BIN
upload/images/category-icons/rugby.png
Normal file
After Width: | Height: | Size: 626 B |
BIN
upload/images/category-icons/signal.png
Normal file
After Width: | Height: | Size: 527 B |
BIN
upload/images/category-icons/skull.png
Normal file
After Width: | Height: | Size: 625 B |
BIN
upload/images/category-icons/table-tennis.png
Normal file
After Width: | Height: | Size: 680 B |
BIN
upload/images/category-icons/web-browser.png
Normal file
After Width: | Height: | Size: 493 B |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 3.9 KiB |
|
@ -10,7 +10,8 @@
|
|||
Config.Inc.php
|
||||
*/
|
||||
include('common.php');
|
||||
|
||||
include('functions_admin.php');
|
||||
|
||||
//Including Massuploader Class,
|
||||
require_once('classes/mass_upload.class.php');
|
||||
require_once('classes/ads.class.php');
|
||||
|
|
|
@ -76,8 +76,8 @@ abstract class CBCategory
|
|||
$desc = ($array['desc']);
|
||||
$default = mysql_clean($array['default']);
|
||||
|
||||
$flds = array("category_name","category_desc","date_added");
|
||||
$values = array($name,$desc,now());
|
||||
$flds = array("category_name","category_desc","date_added","category_icon");
|
||||
$values = array($name,$desc,now(),$array['icon']);
|
||||
|
||||
if(!empty($this->use_sub_cats))
|
||||
{
|
||||
|
@ -94,6 +94,14 @@ abstract class CBCategory
|
|||
{
|
||||
e(lang("add_cat_no_name_err"));
|
||||
}else{
|
||||
|
||||
//Get Last order ID
|
||||
$last = $this->get_last_order_number();
|
||||
$order_id = $last + 1;
|
||||
|
||||
$flds[] = 'category_order';
|
||||
$values[] = $order_id;
|
||||
|
||||
$cid = $db->insert(tbl($this->cat_tbl),$flds,$values);
|
||||
|
||||
$cid = $db->insert_id();
|
||||
|
@ -104,6 +112,8 @@ abstract class CBCategory
|
|||
//Uploading thumb
|
||||
if(!empty($_FILES['cat_thumb']['tmp_name']))
|
||||
$this->add_category_thumb($cid,$_FILES['cat_thumb']);
|
||||
|
||||
return $cid;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -140,10 +150,9 @@ abstract class CBCategory
|
|||
{
|
||||
global $db;
|
||||
$params['use_sub_cats'] = $params['use_sub_cats'] ? $params['use_sub_cats'] : "yes";
|
||||
if($this->use_sub_cats && config('use_subs') == 1 && $params['use_sub_cats'] == "yes" &&
|
||||
($params['type'] == "videos" || $params['type'] == "video" || $params['type'] == "v"))
|
||||
|
||||
if($this->use_sub_cats && $params['use_sub_cats'] == "yes" )
|
||||
{
|
||||
$cond = " parent_id = 0";
|
||||
$subCategories = TRUE;
|
||||
} else
|
||||
$cond = NULL;
|
||||
|
@ -164,9 +173,10 @@ abstract class CBCategory
|
|||
if($subCategories === TRUE && $this->is_parent($cat['category_id']))
|
||||
$finalArray[$cat['category_id']]['children'] = $this->getCbSubCategories($cat['category_id'],$params);
|
||||
}
|
||||
|
||||
return $finalArray;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function getCbSubCategories($category_id,$params)
|
||||
{
|
||||
|
@ -354,32 +364,33 @@ abstract class CBCategory
|
|||
|
||||
function cbCategories($params=NULL)
|
||||
{
|
||||
$p = $params;
|
||||
$p['type'] = $p['type'] ? $p['type'] : 'video';
|
||||
$p['echo'] = $p['echo'] ? $p['echo'] : FALSE;
|
||||
$p['with_all'] = $p['with_all'] ? $p['with_all'] : FALSE;
|
||||
$p = $params;
|
||||
$p['type'] = $p['type'] ? $p['type'] : 'video';
|
||||
$p['echo'] = $p['echo'] ? $p['echo'] : FALSE;
|
||||
$p['with_all'] = $p['with_all'] ? $p['with_all'] : FALSE;
|
||||
|
||||
{
|
||||
$categories = $this->getCbCategories($p);
|
||||
|
||||
if($categories)
|
||||
{
|
||||
if($p['echo'] == TRUE)
|
||||
{
|
||||
$html = $this->displayOutput($categories,$p);
|
||||
if($p['assign'])
|
||||
assign($p['assign'],$html);
|
||||
else
|
||||
echo $html;
|
||||
} else {
|
||||
if($p['assign'])
|
||||
assign($p['assign'],$categories);
|
||||
else
|
||||
return $categories;
|
||||
}
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
{
|
||||
$categories = $this->getCbCategories($p);
|
||||
|
||||
if($categories)
|
||||
{
|
||||
if($p['echo'] == TRUE)
|
||||
{
|
||||
$html = $this->displayOutput($categories,$p);
|
||||
if($p['assign'])
|
||||
assign($p['assign'],$html);
|
||||
else
|
||||
echo $html;
|
||||
} else {
|
||||
|
||||
if($p['assign'])
|
||||
assign($p['assign'],$categories);
|
||||
else
|
||||
return $categories;
|
||||
}
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -563,8 +574,8 @@ abstract class CBCategory
|
|||
$default = mysql_clean($array['default']);
|
||||
$pcat = mysql_clean($array['parent_cat']);
|
||||
|
||||
$flds = array("category_name","category_desc");
|
||||
$values = array($name,$desc);
|
||||
$flds = array("category_name","category_desc","category_icon");
|
||||
$values = array($name,$desc,$array['icon']);
|
||||
|
||||
$cur_name = mysql_clean($array['cur_name']);
|
||||
$cid = mysql_clean($array['cid']);
|
||||
|
@ -684,7 +695,67 @@ abstract class CBCategory
|
|||
{
|
||||
return $this->get_cat_thumb($i);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function used to get category iCOn, if there is no iCon default will
|
||||
* be returned
|
||||
*
|
||||
* @param ARRAY $category
|
||||
* @return STRING $iconurl
|
||||
*/
|
||||
function get_icon($c)
|
||||
{
|
||||
//Check if there is a folder
|
||||
//template for category icons
|
||||
if(file_exists(FRONT_TEMPLATEDIR.'/category-icons'))
|
||||
{
|
||||
$dir = FRONT_TEMPLATEDIR.'/category-icons';
|
||||
$dir_url = FRONT_TEMPLATEURL.'/category-icons';
|
||||
}else
|
||||
{
|
||||
$dir = BASEDIR.'/images/category-icons';
|
||||
$dir_url = BASEURL.'/images/category-icons';
|
||||
}
|
||||
|
||||
$icon_relative_path = $dir.'/'.$c['category_icon'];
|
||||
if(file_exists($icon_relative_path) && $c['category_icon'])
|
||||
{
|
||||
return $dir_url.'/'.$c['category_icon'];
|
||||
}else
|
||||
{
|
||||
return $this->default_category_icon();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* return default caetegory icon
|
||||
*
|
||||
* @return STRING categoryIconUrl
|
||||
*/
|
||||
function default_category_icon()
|
||||
{
|
||||
|
||||
//template for category icons
|
||||
if(file_exists(FRONT_TEMPLATEDIR.'/category-icons'))
|
||||
{
|
||||
$dir = FRONT_TEMPLATEDIR.'/category-icons';
|
||||
$dir_url = FRONT_TEMPLATEURL.'/category-icons';
|
||||
}else
|
||||
{
|
||||
$dir = BASEDIR.'/images/category-icons';
|
||||
$dir_url = BASEURL.'/images/category-icons';
|
||||
}
|
||||
|
||||
$icon_relative_path = $dir.'/default.png';
|
||||
if(file_exists($icon_relative_path))
|
||||
{
|
||||
return $dir_url.'/default.png';
|
||||
}else
|
||||
{
|
||||
return ffalse;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* function used to return default thumb
|
||||
*/
|
||||
|
@ -731,7 +802,7 @@ abstract class CBCategory
|
|||
function is_parent($cid)
|
||||
{
|
||||
global $db;
|
||||
$result = $db->count(tbl($this->cat_tbl),"category_id"," parent_id = $cid");
|
||||
$result = $db->count(tbl($this->cat_tbl),"category_id"," parent_id = '$cid' ");
|
||||
|
||||
if($result > 0)
|
||||
return true;
|
||||
|
@ -859,6 +930,18 @@ abstract class CBCategory
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get Last Order
|
||||
*
|
||||
* @return INT OrderId
|
||||
*/
|
||||
function get_last_order_number()
|
||||
{
|
||||
global $db;
|
||||
$result = $db->select(tbl($this->cat_tbl),'category_order',NULL,1,' category_order DESC');
|
||||
|
||||
return $result[0]['category_order'];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -11,7 +11,12 @@ class CBTemplate {
|
|||
|
||||
if (!isset($Smarty)) {
|
||||
|
||||
$Smarty = new SmartyBC;
|
||||
$Smarty = new SmartyBC();
|
||||
|
||||
$Smarty->compile_check = true;
|
||||
$Smarty->debugging = false;
|
||||
$Smarty->template_dir = BASEDIR."/styles";
|
||||
$Smarty->compile_dir = BASEDIR."/cache";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -387,7 +387,8 @@ if(!@$in_bg_cron)
|
|||
//Number of activity feeds to display on channel page
|
||||
define("USER_ACTIVITY_FEEDS_LIMIT",15);
|
||||
|
||||
|
||||
define('FRONT_TEMPLATEDIR',BASEDIR.'/'.TEMPLATEFOLDER.'/'.$Cbucket->template);
|
||||
define('FRONT_TEMPLATEURL',BASEURL.'/'.TEMPLATEFOLDER.'/'.$Cbucket->template);
|
||||
|
||||
|
||||
|
||||
|
@ -603,6 +604,7 @@ $Smarty->register_function('embedCodes','photo_embed_codes');
|
|||
$Smarty->register_function('DownloadButtonP','photo_download_button');
|
||||
$Smarty->register_function('loadPhotoUploadForm','loadPhotoUploadForm');
|
||||
$Smarty->register_function('cbCategories','getSmartyCategoryList');
|
||||
$Smarty->register_function('get_categories','getSmartyCategoryList');
|
||||
$Smarty->register_function('getComments','getSmartyComments');
|
||||
$Smarty->register_function('fb_embed_video','fb_embed_video');
|
||||
$Smarty->register_function('cbMenu','cbMenu');
|
||||
|
@ -637,6 +639,8 @@ $Smarty->register_modifier('getHeight','getHeight');
|
|||
$Smarty->register_modifier('json_decode','jd');
|
||||
$Smarty->register_modifier('getGroupPrivacy','getGroupPrivacy');
|
||||
|
||||
$Smarty->register_function('loading_pointer','loading_pointer');
|
||||
|
||||
assign('updateEmbedCode','updateEmbed');
|
||||
/*
|
||||
* Registering Video Remove Functions
|
||||
|
|
32
upload/includes/functions_admin.php
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
// Funtions ued in for admin area only
|
||||
|
||||
function list_admin_categories($categories)
|
||||
{
|
||||
foreach($categories as $category)
|
||||
{
|
||||
if(!$category['parent_id'])
|
||||
list_category($category);
|
||||
}
|
||||
}
|
||||
|
||||
function list_category($category,$prefix=NULL)
|
||||
{
|
||||
if($category)
|
||||
{
|
||||
assign('prefix',$prefix);
|
||||
assign('category',$category);
|
||||
Template('blocks/category.html');
|
||||
|
||||
if($category['children'])
|
||||
{
|
||||
$prefix = $prefix.' – ';
|
||||
foreach($category['children'] as $child)
|
||||
{
|
||||
list_category($child,$prefix);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -104,6 +104,19 @@
|
|||
function include_template_file($params)
|
||||
{
|
||||
$file = $params['file'];
|
||||
|
||||
//Assign Vars
|
||||
if($params)
|
||||
{
|
||||
foreach($params as $name => $value)
|
||||
{
|
||||
if($name!='file')
|
||||
{
|
||||
assign($name,$value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(file_exists(LAYOUT.'/'.$file))
|
||||
{
|
||||
|
@ -965,4 +978,78 @@
|
|||
|
||||
return $array;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get list of icons in category-icons folder
|
||||
*/
|
||||
function get_category_icons()
|
||||
{
|
||||
//Check if there is a folder
|
||||
//template for category icons
|
||||
if(file_exists(FRONT_TEMPLATEDIR.'/category-icons'))
|
||||
{
|
||||
$dir = FRONT_TEMPLATEDIR.'/category-icons';
|
||||
$dir_url = FRONT_TEMPLATEURL.'/category-icons';
|
||||
}else
|
||||
{
|
||||
$dir = BASEDIR.'/images/category-icons';
|
||||
$dir_url = BASEURL.'/images/category-icons';
|
||||
}
|
||||
|
||||
|
||||
//Blank list of images
|
||||
$images = array();
|
||||
|
||||
if(file_exists($dir))
|
||||
{
|
||||
//Only get PNGs
|
||||
$imgList = glob($dir.'/*.png');
|
||||
|
||||
if($imgList)
|
||||
{
|
||||
foreach($imgList as $img)
|
||||
{
|
||||
list($width, $height, $type, $attr) = getimagesize($img);
|
||||
if($width && $height)
|
||||
$images[] = $img;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$final_images = array();
|
||||
if($images)
|
||||
{
|
||||
foreach($images as $image)
|
||||
{
|
||||
$imagearr = explode('/',$image);
|
||||
$imageName = $imagearr[count($imagearr) - 1];
|
||||
|
||||
$final_images[$imageName] = array('url'=>$dir_url.'/'.$imageName,
|
||||
'path' => $dir.'/'.$imageName);
|
||||
}
|
||||
}
|
||||
|
||||
return $final_images;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loading Pointer
|
||||
*
|
||||
* Displays a loading image with the given ID
|
||||
* we need this pointer on many places to let user know if the
|
||||
* process is finised or not to improve UI
|
||||
*
|
||||
* @param ID String
|
||||
* @return Image wraped in img tag with ID and hidden by default
|
||||
*/
|
||||
function loading_pointer($params)
|
||||
{
|
||||
$id = $params['place'] ? $params['place'] : $params['id'];
|
||||
|
||||
$img = TEMPLATEURL.'/images/loaders/1.gif';
|
||||
|
||||
return '<img src="'.$img.'" id="'.$id.'-loader" class="loading_pointer '.$params['class'].'">';
|
||||
|
||||
}
|
||||
?>
|
|
@ -86,6 +86,8 @@ function SetTime($sec, $padHours = true) {
|
|||
}
|
||||
|
||||
|
||||
function duration($time,$pad=true){ return SetTime($time,$pad); }
|
||||
|
||||
|
||||
/**
|
||||
* Get thumbnails of a video
|
||||
|
|
|
@ -181,7 +181,7 @@ var loading = loading_img+" Loading...";
|
|||
return false;
|
||||
}
|
||||
var ajaxCall = $.ajax({
|
||||
url: download_page,
|
||||
url: download_page_youtube,
|
||||
type: "POST",
|
||||
data: ({file:file,file_name:file_name,"youtube":"yes"}),
|
||||
dataType : 'json',
|
||||
|
|
10
upload/styles/cbv3/amplify/amplify.core.min.js
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
/*!
|
||||
* Amplify Core 1.1.0
|
||||
*
|
||||
* Copyright 2011 appendTo LLC. (http://appendto.com/team)
|
||||
* Dual licensed under the MIT or GPL licenses.
|
||||
* http://appendto.com/open-source-licenses
|
||||
*
|
||||
* http://amplifyjs.com
|
||||
*/
|
||||
(function(a,b){var c=[].slice,d={},e=a.amplify={publish:function(a){var b=c.call(arguments,1),e,f,g,h=0,i;if(!d[a])return!0;e=d[a].slice();for(g=e.length;h<g;h++){f=e[h],i=f.callback.apply(f.context,b);if(i===!1)break}return i!==!1},subscribe:function(a,b,c,e){arguments.length===3&&typeof c=="number"&&(e=c,c=b,b=null),arguments.length===2&&(c=b,b=null),e=e||10;var f=0,g=a.split(/\s/),h=g.length,i;for(;f<h;f++){a=g[f],i=!1,d[a]||(d[a]=[]);var j=d[a].length-1,k={callback:c,context:b,priority:e};for(;j>=0;j--)if(d[a][j].priority<=e){d[a].splice(j+1,0,k),i=!0;break}i||d[a].unshift(k)}return c},unsubscribe:function(a,b){if(!!d[a]){var c=d[a].length,e=0;for(;e<c;e++)if(d[a][e].callback===b){d[a].splice(e,1);break}}}}})(this)
|
10
upload/styles/cbv3/amplify/amplify.request.min.js
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
/*!
|
||||
* Amplify Request 1.1.0
|
||||
*
|
||||
* Copyright 2011 appendTo LLC. (http://appendto.com/team)
|
||||
* Dual licensed under the MIT or GPL licenses.
|
||||
* http://appendto.com/open-source-licenses
|
||||
*
|
||||
* http://amplifyjs.com
|
||||
*/
|
||||
(function(a,b){function e(a){var b=!1;setTimeout(function(){b=!0},1);return function(){var c=this,d=arguments;b?a.apply(c,d):setTimeout(function(){a.apply(c,d)},1)}}function d(a){return{}.toString.call(a)==="[object Function]"}function c(){}a.request=function(b,f,g){var h=b||{};typeof h=="string"&&(d(f)&&(g=f,f={}),h={resourceId:b,data:f||{},success:g});var i={abort:c},j=a.request.resources[h.resourceId],k=h.success||c,l=h.error||c;h.success=e(function(b,c){c=c||"success",a.publish("request.success",h,b,c),a.publish("request.complete",h,b,c),k(b,c)}),h.error=e(function(b,c){c=c||"error",a.publish("request.error",h,b,c),a.publish("request.complete",h,b,c),l(b,c)});if(!j){if(!h.resourceId)throw"amplify.request: no resourceId provided";throw"amplify.request: unknown resourceId: "+h.resourceId}if(!a.publish("request.before",h))h.error(null,"abort");else{a.request.resources[h.resourceId](h,i);return i}},a.request.types={},a.request.resources={},a.request.define=function(b,c,d){if(typeof c=="string"){if(!(c in a.request.types))throw"amplify.request.define: unknown type: "+c;d.resourceId=b,a.request.resources[b]=a.request.types[c](d)}else a.request.resources[b]=c}})(amplify),function(a,b,c){var d=["status","statusText","responseText","responseXML","readyState"],e=/\{([^\}]+)\}/g;a.request.types.ajax=function(e){e=b.extend({type:"GET"},e);return function(f,g){function n(a,e){b.each(d,function(a,b){try{m[b]=h[b]}catch(c){}}),/OK$/.test(m.statusText)&&(m.statusText="success"),a===c&&(a=null),l&&(e="abort"),/timeout|error|abort/.test(e)?m.error(a,e):m.success(a,e),n=b.noop}var h,i=e.url,j=g.abort,k=b.extend(!0,{},e,{data:f.data}),l=!1,m={readyState:0,setRequestHeader:function(a,b){return h.setRequestHeader(a,b)},getAllResponseHeaders:function(){return h.getAllResponseHeaders()},getResponseHeader:function(a){return h.getResponseHeader(a)},overrideMimeType:function(a){return h.overrideMideType(a)},abort:function(){l=!0;try{h.abort()}catch(a){}n(null,"abort")},success:function(a,b){f.success(a,b)},error:function(a,b){f.error(a,b)}};a.publish("request.ajax.preprocess",e,f,k,m),b.extend(k,{success:function(a,b){n(a,b)},error:function(a,b){n(null,b)},beforeSend:function(b,c){h=b,k=c;var d=e.beforeSend?e.beforeSend.call(this,m,k):!0;return d&&a.publish("request.before.ajax",e,f,k,m)}}),b.ajax(k),g.abort=function(){m.abort(),j.call(this)}}},a.subscribe("request.ajax.preprocess",function(a,c,d){var f=[],g=d.data;typeof g!="string"&&(g=b.extend(!0,{},a.data,g),d.url=d.url.replace(e,function(a,b){if(b in g){f.push(b);return g[b]}}),b.each(f,function(a,b){delete g[b]}),d.data=g)}),a.subscribe("request.ajax.preprocess",function(a,c,d){var e=d.data,f=a.dataMap;!!f&&typeof e!="string"&&(b.isFunction(f)?d.data=f(e):(b.each(a.dataMap,function(a,b){a in e&&(e[b]=e[a],delete e[a])}),d.data=e))});var f=a.request.cache={_key:function(a,b,c){function g(){return c.charCodeAt(e++)<<24|c.charCodeAt(e++)<<16|c.charCodeAt(e++)<<8|c.charCodeAt(e++)<<0}c=b+c;var d=c.length,e=0,f=g();while(e<d)f^=g();return"request-"+a+"-"+f},_default:function(){var a={};return function(b,c,d,e){var g=f._key(c.resourceId,d.url,d.data),h=b.cache;if(g in a){e.success(a[g]);return!1}var i=e.success;e.success=function(b){a[g]=b,typeof h=="number"&&setTimeout(function(){delete a[g]},h),i.apply(this,arguments)}}}()};a.store&&(b.each(a.store.types,function(b){f[b]=function(c,d,e,g){var h=f._key(d.resourceId,e.url,e.data),i=a.store[b](h);if(i){e.success(i);return!1}var j=g.success;g.success=function(d){a.store[b](h,d,{expires:c.cache.expires}),j.apply(this,arguments)}}}),f.persist=f[a.store.type]),a.subscribe("request.before.ajax",function(a){var b=a.cache;if(b){b=b.type||b;return f[b in f?b:"_default"].apply(this,arguments)}}),a.request.decoders={jsend:function(a,b,c,d,e){a.status==="success"?d(a.data):a.status==="fail"?e(a.data,"fail"):a.status==="error"&&(delete a.status,e(a,"error"))}},a.subscribe("request.before.ajax",function(c,d,e,f){function k(a,b){h(a,b)}function j(a,b){g(a,b)}var g=f.success,h=f.error,i=b.isFunction(c.decoder)?c.decoder:c.decoder in a.request.decoders?a.request.decoders[c.decoder]:a.request.decoders._default;!i||(f.success=function(a,b){i(a,b,f,j,k)},f.error=function(a,b){i(a,b,f,j,k)})})}(amplify,jQuery)
|
10
upload/styles/cbv3/amplify/amplify.store.min.js
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
/*!
|
||||
* Amplify Store - Persistent Client-Side Storage 1.1.0
|
||||
*
|
||||
* Copyright 2011 appendTo LLC. (http://appendto.com/team)
|
||||
* Dual licensed under the MIT or GPL licenses.
|
||||
* http://appendto.com/open-source-licenses
|
||||
*
|
||||
* http://amplifyjs.com
|
||||
*/
|
||||
(function(a,b){function e(a,e){c.addType(a,function(f,g,h){var i,j,k,l,m=g,n=(new Date).getTime();if(!f){m={},l=[],k=0;try{f=e.length;while(f=e.key(k++))d.test(f)&&(j=JSON.parse(e.getItem(f)),j.expires&&j.expires<=n?l.push(f):m[f.replace(d,"")]=j.data);while(f=l.pop())e.removeItem(f)}catch(o){}return m}f="__amplify__"+f;if(g===b){i=e.getItem(f),j=i?JSON.parse(i):{expires:-1};if(j.expires&&j.expires<=n)e.removeItem(f);else return j.data}else if(g===null)e.removeItem(f);else{j=JSON.stringify({data:g,expires:h.expires?n+h.expires:null});try{e.setItem(f,j)}catch(o){c[a]();try{e.setItem(f,j)}catch(o){throw c.error()}}}return m})}var c=a.store=function(a,b,d,e){var e=c.type;d&&d.type&&d.type in c.types&&(e=d.type);return c.types[e](a,b,d||{})};c.types={},c.type=null,c.addType=function(a,b){c.type||(c.type=a),c.types[a]=b,c[a]=function(b,d,e){e=e||{},e.type=a;return c(b,d,e)}},c.error=function(){return"amplify.store quota exceeded"};var d=/^__amplify__/;for(var f in{localStorage:1,sessionStorage:1})try{window[f].getItem&&e(f,window[f])}catch(g){}if(window.globalStorage)try{e("globalStorage",window.globalStorage[window.location.hostname]),c.type==="sessionStorage"&&(c.type="globalStorage")}catch(g){}(function(){if(!c.types.localStorage){var a=document.createElement("div"),d="amplify";a.style.display="none",document.getElementsByTagName("head")[0].appendChild(a);try{a.addBehavior("#default#userdata"),a.load(d)}catch(e){a.parentNode.removeChild(a);return}c.addType("userData",function(e,f,g){a.load(d);var h,i,j,k,l,m=f,n=(new Date).getTime();if(!e){m={},l=[],k=0;while(h=a.XMLDocument.documentElement.attributes[k++])i=JSON.parse(h.value),i.expires&&i.expires<=n?l.push(h.name):m[h.name]=i.data;while(e=l.pop())a.removeAttribute(e);a.save(d);return m}e=e.replace(/[^-._0-9A-Za-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u37f-\u1fff\u200c-\u200d\u203f\u2040\u2070-\u218f]/g,"-");if(f===b){h=a.getAttribute(e),i=h?JSON.parse(h):{expires:-1};if(i.expires&&i.expires<=n)a.removeAttribute(e);else return i.data}else f===null?a.removeAttribute(e):(j=a.getAttribute(e),i=JSON.stringify({data:f,expires:g.expires?n+g.expires:null}),a.setAttribute(e,i));try{a.save(d)}catch(o){j===null?a.removeAttribute(e):a.setAttribute(e,j),c.userData();try{a.setAttribute(e,i),a.save(d)}catch(o){j===null?a.removeAttribute(e):a.setAttribute(e,j);throw c.error()}}return m})}})(),function(){function e(a){return a===b?b:JSON.parse(JSON.stringify(a))}var a={},d={};c.addType("memory",function(c,f,g){if(!c)return e(a);if(f===b)return e(a[c]);d[c]&&(clearTimeout(d[c]),delete d[c]);if(f===null){delete a[c];return null}a[c]=f,g.expires&&(d[c]=setTimeout(function(){delete a[c],delete d[c]},g.expires));return f})}()})(this.amplify=this.amplify||{})
|
BIN
upload/styles/cbv3/images/duration-bg.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
upload/styles/cbv3/images/gradients/categories-child.png
Normal file
After Width: | Height: | Size: 1,002 B |
BIN
upload/styles/cbv3/images/iconset.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
38
upload/styles/cbv3/layout/blocks/categories.html
Normal file
|
@ -0,0 +1,38 @@
|
|||
{* Getting a list of categories *}
|
||||
|
||||
<div class="categories-nav">
|
||||
{$categories=getCategoryList(['type'=>$type])}
|
||||
|
||||
<ul>
|
||||
{foreach $categories as $category}
|
||||
{if !$category.parent_id}
|
||||
|
||||
{$catLink = category_link($category,$type)}
|
||||
<li class="gradient relative"><img src="{$cbvid->get_icon($category)}"/>
|
||||
<a href="{$catLink}">{$category.category_name}</a>
|
||||
|
||||
{if $category.children}
|
||||
<i class="icon-toggle icon-set absolute right"></i>
|
||||
|
||||
<ol>
|
||||
{foreach $category.children as $child}
|
||||
{$catLink = category_link($child,$type)}
|
||||
<li><a href="{$catLink}">{$child.category_name}</a>
|
||||
{if $child.children}
|
||||
<ul>
|
||||
{foreach $child.children as $sub_child}
|
||||
{$catLink = category_link($sub_child,$type)}
|
||||
<li>
|
||||
– <a href="{$catLink}">{$sub_child.category_name}</a>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{/if}
|
||||
</li>
|
||||
{/foreach}
|
||||
</ol>
|
||||
{/if}</li>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div>
|
22
upload/styles/cbv3/layout/blocks/video.html
Normal file
|
@ -0,0 +1,22 @@
|
|||
<!-- Video BLock {$video.videoid} -->
|
||||
{$videolink=videoLink($video)}
|
||||
<div class="{$video.videoid}-video {$video.videoid} video-box">
|
||||
<div class="video-thumb relative">
|
||||
<a href="{$videolink}"><img src="{getThumb vdetails=$video}" /></a>
|
||||
<span class="duration">{$video.duration|duration}</span>
|
||||
</div>
|
||||
<div class="video-info-cont relative">
|
||||
<div class="title"><a href="{$videolink}">{$video.title}</a></div>
|
||||
<div class="video-info absolute bottom">
|
||||
<span class="user pull-left">{$video.username}</span>
|
||||
<span class="user pull-right">{$video.date_added|niceTime}</span>
|
||||
<div class="clearfix"></div>
|
||||
|
||||
<span class="user pull-left">{$video.views|number_format} views</span>
|
||||
<span class="user pull-right">{$video|cbv3_rating:perc}</span>
|
||||
<div class="clearfix"></div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -28,6 +28,15 @@
|
|||
<!-- ClipBucket default.css -->
|
||||
<link rel="stylesheet" type="text/css" href="{$theme_url}/default.css" />
|
||||
|
||||
<!-- ie 9 Gradient Fix -->
|
||||
<!--[if gte IE 9]>
|
||||
<style type="text/css">
|
||||
.gradient {
|
||||
filter: none;
|
||||
}
|
||||
</style>
|
||||
<![endif]-->
|
||||
|
||||
<!-- Including ClipBucket Global_header -->
|
||||
{include_header file='global_header'}
|
||||
|
||||
|
@ -35,11 +44,17 @@
|
|||
NOTE : JQUERY v1.7 or higher is required -->
|
||||
<script type="text/javascript" src="{$template_url}/bootstrap/js/bootstrap.min.js"></script>
|
||||
|
||||
<!-- Amplify -->
|
||||
<script type="text/javascript" src="{$template_url}/amplify/amplify.core.min.js"></script>
|
||||
<script type="text/javascript" src="{$template_url}/amplify/amplify.request.min.js"></script>
|
||||
<script type="text/javascript" src="{$template_url}/amplify/amplify.store.min.js"></script>
|
||||
|
||||
<!-- Including Functions -->
|
||||
<script type="text/javascript" src="{$layout_url}/functions.js"></script>
|
||||
|
||||
<!-- Including Javascript written in HTML document -->
|
||||
{include file="$layout_dir/javascript.html"}
|
||||
|
||||
</head>
|
||||
|
||||
<!-- Global Header Ends Here -->
|
|
@ -1,3 +1,37 @@
|
|||
<!-- Defining Amplify Requests -->
|
||||
<script>
|
||||
var ajaxURL = baseurl+'/ajax';
|
||||
|
||||
//Update sidebar
|
||||
amplify.request.define( "videos", "ajax", {
|
||||
url: ajaxURL+"/videos.php",
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
decoder: function( data, status, xhr, success, error ) {
|
||||
if ( status === "success" ) {
|
||||
success( data );
|
||||
} else {
|
||||
error( data );
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//Getting list of video sample
|
||||
|
||||
amplify.request("categories",{ "mode":"get_videos" }//params,
|
||||
,function(data){
|
||||
////Returns Json Data
|
||||
//Thats it
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<!-- Working With the Javascript -->
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
|
||||
|
@ -55,5 +89,21 @@
|
|||
})
|
||||
})
|
||||
{/if}
|
||||
//Hiding Children Categories
|
||||
$('.categories-nav > ul > li > ol').hide();
|
||||
//Adding Toggle
|
||||
$('.categories-nav > ul > li .icon-toggle').click(function(){
|
||||
$('.categories-nav > ul > li > ol').toggle();
|
||||
|
||||
if($('.categories-nav > ul > li > ol').css('display')=='none')
|
||||
{
|
||||
$(this).removeClass('toggle-invert');
|
||||
$(this).parent().removeClass('active');
|
||||
}else
|
||||
{
|
||||
$(this).addClass('toggle-invert');
|
||||
$(this).parent().addClass('active');
|
||||
}
|
||||
})
|
||||
});
|
||||
</script>
|
20
upload/styles/cbv3/layout/videos.html
Normal file
|
@ -0,0 +1,20 @@
|
|||
{assign var=type value='v'}
|
||||
|
||||
|
||||
<!-- Including Categories List -->
|
||||
<div class="sidebar-categories">
|
||||
{include_template_file file="blocks/categories.html" type=$type}
|
||||
</div>
|
||||
|
||||
<!-- CB Videos Listings -->
|
||||
<div class="videos-container">
|
||||
{foreach $videos as $video}
|
||||
{include_template_file file="blocks/video.html" video=$video}
|
||||
{/foreach}
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$('.video-box:nth-child(4n+4)').css('margin-right','0px');
|
||||
})
|
||||
</script>
|
|
@ -14,4 +14,27 @@ function displayUserBoxAdmin($widget)
|
|||
return Fetch('/layout/widgets/user-box-admin.html',FRONT_TEMPLATEDIR);
|
||||
}
|
||||
|
||||
function cbv3_rating($video,$type='perc')
|
||||
{
|
||||
if($type=='perc')
|
||||
{
|
||||
$rating = $video['rating'];
|
||||
|
||||
if($rating>5)
|
||||
{
|
||||
$rating_output = '<span class="rating-text rating-green">';
|
||||
}elseif($rating<5 && $rating)
|
||||
{
|
||||
$rating_output = '<span class="rating-text rating-red">';
|
||||
}else
|
||||
{
|
||||
$rating_output = '<span class="rating-text">';
|
||||
}
|
||||
|
||||
$rating_output .= round($rating*10+0.49,0);
|
||||
$rating_output .= '%</span>';
|
||||
|
||||
return $rating_output;
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -97,6 +97,8 @@ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00000000', e
|
|||
.icon-down {background-position: -312px -144px;}
|
||||
|
||||
|
||||
|
||||
|
||||
/* V3 ClipBucket Custom icons */
|
||||
.icon-stats {background-position: -0px -0px;}
|
||||
.icon-globe {background-position: -24px -0px;}
|
||||
|
@ -105,6 +107,9 @@ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00000000', e
|
|||
.icon-groups {background-position: -96px -0px;}
|
||||
.icon-add-user {background-position: -120px -0px;}
|
||||
.icon-remove-user {background-position: -144px -0px;}
|
||||
.icon-toggle {background-position: -0px -0px; width: 17px; height: 17px}
|
||||
/* For inverting Toggle */
|
||||
.toggle-invert{background-position: -24px 0px}
|
||||
|
||||
.icon-v3 {
|
||||
background-image: url("../images/v3icons.png");
|
||||
|
@ -112,6 +117,11 @@ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00000000', e
|
|||
.icon-v3-white {
|
||||
background-image: url("../images/v3icons-white.png");
|
||||
}
|
||||
.icon-set{
|
||||
background-image:url("../images/iconset.png");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* V3 Progress Bars */
|
||||
|
@ -142,4 +152,56 @@ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ff3019', end
|
|||
.login-modal-right{width: 250px; margin-left: 15px; padding-top: 10px}
|
||||
|
||||
.modal-username,.modal-password{width: 240px}
|
||||
.terms-text{font-size: 10px; color: #666}
|
||||
.terms-text{font-size: 10px; color: #666}
|
||||
|
||||
/* Categories */
|
||||
.categories-nav{width:255px }
|
||||
.categories-nav ul{margin: 0px; padding: 0px}
|
||||
.categories-nav ul li{margin: 0px; padding: 0px; list-style: none; font-size: 13px;
|
||||
padding:8px 0px 8px 15px;
|
||||
border-bottom: 1px solid #d8d8d8; border-top: 1px solid #fff}
|
||||
|
||||
.categories-nav ul > li{background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIxMDAlIiB5Mj0iMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzAwMDAwMCIgc3RvcC1vcGFjaXR5PSIwIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjEwMCUiIHN0b3AtY29sb3I9IiMwMDAwMDAiIHN0b3Atb3BhY2l0eT0iMC4wNiIvPgogIDwvbGluZWFyR3JhZGllbnQ+CiAgPHJlY3QgeD0iMCIgeT0iMCIgd2lkdGg9IjEiIGhlaWdodD0iMSIgZmlsbD0idXJsKCNncmFkLXVjZ2ctZ2VuZXJhdGVkKSIgLz4KPC9zdmc+);
|
||||
background: -moz-linear-gradient(left, rgba(0,0,0,0) 0%, rgba(0,0,0,0.06) 100%);
|
||||
background: -webkit-gradient(linear, left top, right top, color-stop(0%,rgba(0,0,0,0)), color-stop(100%,rgba(0,0,0,0.06)));
|
||||
background: -webkit-linear-gradient(left, rgba(0,0,0,0) 0%,rgba(0,0,0,0.06) 100%);
|
||||
background: -o-linear-gradient(left, rgba(0,0,0,0) 0%,rgba(0,0,0,0.06) 100%);
|
||||
background: -ms-linear-gradient(left, rgba(0,0,0,0) 0%,rgba(0,0,0,0.06) 100%);
|
||||
background: linear-gradient(left, rgba(0,0,0,0) 0%,rgba(0,0,0,0.06) 100%);
|
||||
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00000000', endColorstr='#0f000000',GradientType=1 );
|
||||
border-left: 5px solid #fff;
|
||||
}
|
||||
|
||||
.categories-nav ul > li.active{border-left: 5px solid #06c}
|
||||
|
||||
.categories-nav ul > li ol{background-image: url(../images/gradients/categories-child.png); background-repeat: repeat-x; margin: 8px 0px -8px -15px;
|
||||
background-position: 0px 1px; border-top: 1px solid #d8d8d8; padding: 7px 0px 8px 0px;}
|
||||
.categories-nav ul > li ol li{background-color:#fafafa}
|
||||
.categories-nav ul > li ol > li{padding-left: 35px; border-bottom: 0px;}
|
||||
.categories-nav ul > li ol ul{background: none;}
|
||||
.categories-nav ul > li ol ul li{background:none; border: none; font-size: 11px; padding: 3px 0px }
|
||||
.categories-nav ul > li .icon-toggle{right: 10px; cursor: pointer}
|
||||
.categories-nav ul > li a{color: #000; }
|
||||
|
||||
.sidebar-categories{float: left; width: 255px; margin-right: 25px}
|
||||
.videos-container{float:left; width: 820px}
|
||||
|
||||
/* Videos CSS */
|
||||
.video-box{width: 190px; float: left; margin-right: 20px; }
|
||||
.video-box .video-thumb img{width: 100%; height: 120px;}
|
||||
.video-info-cont{height: 80px; margin-bottom: 20px}
|
||||
.video-info-cont .title a{font-size: 12px; color: #333; text-decoration: none; font-weight: bold;
|
||||
}
|
||||
.video-info-cont .title {line-height:14px; margin: 4px 0px 3px}
|
||||
|
||||
.video-info{font-size: 12px; color: #666; width: 100%}
|
||||
|
||||
.rating-text{font-size: 12px;}
|
||||
.rating-green{color: #006600}
|
||||
.rating-red{color: #ed0000}
|
||||
|
||||
.video-box .video-thumb .duration{position: absolute; right: 5px; bottom: 5px;
|
||||
width: 35px; height: 15px; line-height: 15px;
|
||||
background-image: url("../images/duration-bg.png");
|
||||
background-repeat: no-repeat;
|
||||
color: #fff; font-size: 10px; text-align: center; font-weight: bold; text-shadow: 1px 1px 0px #000}
|