<?php
/**
 * @version   	   1.11.1
 * @package        Joomla
 * @subpackage     EDocman
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2011-2025 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */
// no direct access
defined( '_JEXEC' ) or die ;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Router\Route;
use Joomla\Filesystem\File;
use Joomla\Filesystem\Path;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\String\StringHelper;


$session		= Factory::getApplication()->getSession();
if(!$config->onetime_collect)
{
	$session->set('name','');
	$session->set('email','');
}
$name			= $session->get('name','');
$email			= $session->get('email','');
$btnClass		= $bootstrapHelper->getClassMapping('btn');
$show_category	= Factory::getApplication()->getInput()->getInt('show_category',0);
if(!EdocmanHelper::isJoomla4())
{
	if ($config->show_detail_in_popup)
	{
		$popup = 'class="edocman-modal" rel="{handler: \'iframe\', size: {x: 800, y: 500}}"';
	}
	else
	{
		$popup = '';
	}
}
$user  = Factory::getApplication()->getIdentity() ;
$userId = $user->id ;

if ($config->collect_downloader_information && !$userId && ($name == '' || $email == ''))
{
	$showDownloadForm = true;
}
else
{
	$showDownloadForm = false;
}
?>
<script type="text/javascript">
	var spanClass = '<?php echo $spanClass; ?>';
	<?php
	if(EdocmanHelper::isJoomla4())
	{
		?>
		rowFluidClass = '<?php echo $bootstrapHelper->getClassMapping('span12'); ?>';
		<?php
	}
	else
	{
		?>
		rowFluidClass = '<?php echo $bootstrapHelper->getClassMapping('row-fluid'); ?>';
		<?php
	}
	?>
</script>
<?php
if(count($items))
{
	require_once JPATH_ROOT.'/components/com_edocman/helper/file.class.php' ;
	?>
	<table class="table-condensed table-document" id="table-document">
		<?php
		if($config->show_tablelayoutheader == 0){
			$invisible_class = "sr-only";
		}
		else
		{
			$invisible_class = "";
		}
		?>
		<thead>
			<tr>
				<?php
				if($config->show_tablelayoutthumbnail)
				{
					?>
					<th class="edocman-document-thumb-col <?php echo $invisible_class?>">
					</th>
					<?php
				}
				else {
					?>
					<th class="edocman-document-icon-col <?php echo $invisible_class?>">
					</th>
					<?php
				}
					?>
				<th class="edocman-document-title-col <?php echo $invisible_class?>">
					<?php echo Text::_('EDOCMAN_TITLE'); ?>
				</th>
				<?php
				if($show_category == 1)
				{
					?>
					<th class="edocman-document-category-col <?php echo $invisible_class?>">
						<?php echo Text::_('EDOCMAN_CATEGORY'); ?>
					</th>
					<?php
				}
				if($config->show_tablelayoutdescription)
				{
					?>
					<th class="edocman-document-desc-col <?php echo $invisible_class?>">
						<?php echo Text::_('EDOCMAN_DESCRIPTION'); ?>
					</th>
					<?php
				}
				?>
				<th class="edocman-table-download-col alignright <?php echo $invisible_class?>">
					<?php echo Text::_('EDOCMAN_DOWNLOAD'); ?>
				</th>
			</tr>
		</thead>
		<?php
		
		?>
		<tbody>
		<?php
		$total = 0 ;
		$activeItemid = $Itemid;
		for ($i = 0 , $n = count($items) ; $i < $n; $i++)
		{
			$catId                  = $categoryId;
			$category               = EdocmanHelper::getCategory($catId);
			$item                   = $items[$i] ;
			$Itemid                 = EDocmanHelperRoute::getDocumentMenuId($item->id, $catId, $activeItemid);
			if ($config->show_detail_in_popup)
			{
				$url                = Route::_('index.php?option=com_edocman&view=document&id='.$item->id.'&catid='.$catId.'&tmpl=component&Itemid='.$Itemid);
			}
			else
			{
				$url                = Route::_('index.php?option=com_edocman&view=document&id='.$item->id.'&catid='.$catId.'&Itemid='.$Itemid);
			}
			$canEdit	            = $user->authorise('core.edit',			'com_edocman.document.'.$item->id);
			$canEditOwn	            = $user->authorise('core.edit.own',		'com_edocman.document.'.$item->id) && $item->created_user_id == $userId;
			//$canDownload          = $user->authorise('edocman.download', 'com_edocman.document.'.$item->id) ;
			//$canDownload			= ($item->created_user_id == $userId && $item->created_user_id > 0) || ( ($item->user_ids == "" || $item->user_ids == 0) && ($canDownload || $canEdit)) || ($item->user_ids != '' && $item->user_ids != '0' && in_array($userId, explode(',', $item->user_ids))) ;
			$canDelete	    = $user->authorise('core.delete',		'com_edocman.document.'.$item->id);
			if(!$canDelete){
				$canDelete	= $user->authorise('edocman.deleteown',	'com_edocman.document.'.$item->id) && $item->created_user_id == $userId;
			}
			$canDownload			= EdocmanHelper::canDownload($item->id);
			$hide_download_button   = $config->hide_download_button;
			$hide_download          = $category->hide_download;
			if((int)$hide_download == 1)
			{
				$hide_download_button = 1;
			}
			elseif((int)$hide_download == 2)
			{
				$hide_download_button = 0;
			}
			if ($hide_download_button != 1)
			{
				$downloadUrl        = Route::_('index.php?option=com_edocman&task=document.download&id='.$item->id.'&Itemid='.$Itemid) ;
				if($item->document_url != "")
				{
					$downloadUrl = $item->document_url;
				}
			}
			else
			{
				$downloadUrl        = Route::_('index.php?option=com_edocman&task=document.viewdoc&id='.$item->id.'&Itemid='.$Itemid) ;
			}
			$show_view_button = $config->show_view_button;
			$show_view = $category->show_view;

			if((int)$show_view == 1)
			{
				$show_view_button = 1;
			}
			elseif((int)$show_view == 2)
			{
				$show_view_button = 0;
			}
			if ($config->category_table_show_filetype || $config->category_table_show_filesize)
			{
				$item->data         = new EDocman_File($item->id,$item->filename, $config->documents_path) ;
			}
			$fileName               = $item->filename;
			if($fileName != "")
			{
				$fileExt            = strtolower(EdocmanHelper::getExt($fileName));
			}
			else
			{
				$fileExt            = strtolower(EdocmanHelper::getExt($item->document_url));
			}

			$accept_license         = 0;
			$show_accept_license		= 0;
			if($config->accept_license && ($item->license_id > 0 || EdocmanHelper::getDefaultLicense() > 0))
			{
				if($config->accept_license_one_time)
				{
					$alreadyAcceptLicense	= $session->get('alreadyAcceptLicense',0);
					if($alreadyAcceptLicense == 0)
					{
						$show_accept_license = 1;
					}
					else
					{
						$show_accept_license = 0;
					}
				}
				else
				{
					$show_accept_license = 1; 
				}
			}

			if($show_accept_license == 1 || $item->download_password != "")
			{
				$accept_license = 1;
			}
			if ($item->image != '' && is_file(Path::clean(JPATH_ROOT.'/media/com_edocman/document/thumbs/'.$item->image)))
			{
				$imgSrc     = Uri::base().'media/com_edocman/document/thumbs/'.$item->image ;
			}
			else
			{
				$imgSrc     = '';
			}
			?>
			<tr>
				<?php
				if($config->show_tablelayoutthumbnail)
				{
					?>
					<td class="edocman-document-thumb-td" data-label="">
						<?php
						if($imgSrc != "")
						{
							?>
							<img src="<?php echo $imgSrc; ?>" alt="<?php echo $item->title; ?>"
								 class="edocman-thumb-left img-polaroid"/>
							<?php
						}
						?>
					</td>
					<?php
				}
				else
				{
					?>
					<td class="edocman-document-icon-td" data-label="">
						<?php EDocmanHelperHtml::showFileIcon($item->data);?>
					</td>
					<?php
				}
				?>
				<td class="edocman-document-title-td" data-label="">
					<div class="edocman-document-title-td-header">
						<?php
						if ($config->use_download_link_instead_of_detail_link && $canDownload && ($accept_license == 0))
						{
							if ($showDownloadForm)
							{
								
								?>
									<a data-toggle="modal" data-document-title="<?php echo $item->title; ?>" title="<?php echo Text::_('EDOCMAN_DOWNLOAD_DOCUMENT');?>"  id="<?php echo $item->id; ?>" class="edocmancollectdownloadbtn edocman-document-title-link" href="<?php echo Uri::root(true); ?>/index.php?option=com_edocman&view=document&layout=modal&view=document&layout=modal&tmpl=component&id=<?php echo $item->id;?>&direct=1" aria-label="<?php echo Text::_('EDOCMAN_DOWNLOAD_DOCUMENT');?>">
								
									<?php echo $item->title; ?>
								</a>
							<?php
							}
							else
							{
							?>
								<a href="<?php echo $downloadUrl; ?>" aria-label="<?php echo $item->title; ?>" <?php echo $popup; ?>><?php echo $item->title; ?></a>
							<?php
							}
						}
						else
						{
						?>
							<a href="<?php echo $url; ?>" aria-label="<?php echo $item->title; ?>" <?php echo $popup; ?>><?php echo $item->title; ?></a>
						<?php
						}
						if($item->indicators != '' || !empty($item->new_indicator) || !empty($item->update_indicator) || $item->published == 0)
						{
							$indicators = explode(',', $item->indicators);
						?>
							<div class="indicators-container">
							<?php
								if (!empty($item->new_indicator))
								{
								?>
									<span class="indicator new">
											<?php echo Text::_('EDOCMAN_NEW');?>
									</span>
								<?php
								}
								if(in_array('featured', $indicators))
								{
								?>
									<span class="indicator featured">
											<?php echo Text::_('EDOCMAN_FEATURED');?>
									</span>
								<?php
								}
								if(in_array('hot', $indicators))
								{
								?>
									<span  class="indicator hot">
										<?php echo Text::_('EDOCMAN_HOT');?>
									</span>
								<?php
								}
								if($item->published == 0)
								{
									?>
									<span  class="indicator published">
										<?php echo Text::_('JUNPUBLISHED');?>
									</span>
									<?php
								}
								?>
							</div>
						<?php
						}
						?>
					</div>
					<?php
					$pass_lock = true;
					if($config->lock_function) //lock function is turned on
					{	
						if(($item->locked_by != $user->id) && ($item->is_locked == 1))
						{
							$pass_lock = false;
						}
					}
					if (($canEdit || $canEditOwn) && ($pass_lock))
					{
						$return = EdocmanHelper::currentUrl();
						$edit_url = Route::_('index.php?option=com_edocman&task=document.edit&id='.$item->id.'&return='.$return.'&Itemid='.$Itemid) ;
						?>
							<a class="documents_table_edit" href="<?php echo $edit_url; ?>" aria-label="<?php echo Text::_('EDOCMAN_EDIT_DOCUMENT'); ?>" title="<?php echo Text::_('EDOCMAN_EDIT_DOCUMENT'); ?>">
								<i class="edocman-icon-pencil"></i>  
							</a>
						<?php
					}
					if ($canDelete)
					{
					?>
						<a class="documents_table_delete" href="javascript:deleteConfirm(<?php echo $item->id; ?>);" aria-label="<?php echo Text::_('EDOCMAN_DELETE_DOCUMENT'); ?>" title="<?php echo Text::_('EDOCMAN_DELETE_DOCUMENT'); ?>">
							<i class="edocman-icon-trash"></i>
						</a>
					<?php
					}
					?>
					<div class="clearfix"></div>
					<?php
					if(($config->show_number_downloaded) && ($item->downloads > 0))
					{
						?>
						<div class="downloadinformation">
							<i class="edicon edicon-download2"></i>&nbsp;<?php echo $item->downloads?> <?php echo Text::_('EDOCMAN_DOWNLOADS');?>
						</div>
						<?php
					}
					if($config->category_table_show_filesize == 1 && trim($item->data->size) != "")
					{
						$tempArr[] = $item->data->size;
						?>
						<div class="sizeinformation">
							<i class="edicon edicon-database"></i>&nbsp;<?php echo $item->data->size; ?>
						</div>
						<?php
					}
					if ($config->show_publish_date)
					{
						?>
						<div class="dateinformation">
							<i class="edicon edicon-calendar"></i>&nbsp;<?php echo HTMLHelper::_('date', $item->created_time, $config->date_format, true); ?>
						</div>
						<?php
					}
					if ($config->show_modify_date)
					{
						?>
						<div class="dateinformation">
							<i class="edicon edicon-calendar"></i>&nbsp;<?php echo HTMLHelper::_('date', $item->modified_time, $config->date_format, true); ?>
						</div>
						<?php
					}
					if($config->show_number_downloads)
					{
						?>
						<div class="downloadinformation">
							<i class="edicon edicon-download"></i>&nbsp;
							<?php
							echo $item->downloads;
							echo " ".Text::_('EDOCMAN_TIMES');
							?>
						</div>
						<?php
					}

					if ($config->enable_rating)
					{
						?>
						<div class="ratinginformation">
							&nbsp;
							<?php
							EdocmanHelper::showDocumentRating($item->id, 1);
							?>
						</div>
						<?php
					}
					?>
				</td>
				<?php
				if($show_category == 1)
				{
				?>
					<td class="edocman-document-category-td hidden-phone" data-label="">
						<?php
						$category_url = EDocmanHelperRoute::getCategoryRoute($item->category->id);
						?>
						<a href="<?php echo Route::_($category_url)?>" title="<?php echo $item->category->title;?>" aria-label="<?php echo $item->category->title; ?>">
						<?php
						echo $item->category->title;
						?>
						</a>
					</td>
				<?php
				}
				if($config->show_tablelayoutdescription)
				{
					?>
					<td class="edocman-document-desc-col">
						<?php
						if (!$item->short_description)
						{
							$item->short_description = $item->description;
						}
						$description = $item->short_description;
						$description = strip_tags($description);
						if ((int)$config->number_words > 0)
						{
							$descriptionArr = explode(" ", $description);
							if (count($descriptionArr) > (int)$config->number_words)
							{
								for ($d = 0; $d < (int)$config->number_words - 1; $d++)
								{
									echo $descriptionArr[$d] . " ";
								}
								echo "..";
							}
							else
							{
								echo $description;
							}
						}
						else
						{
							echo $description;
						}
						?>
					</td>
				<?php
				}
				?>
				<td class="edocman-table-download-col" style="text-align:right;" data-label="">
				<?php
					if(EDocmanHelper::massDownloadShowing($canDownload, $config, $item))
					{
						if(EDocmanHelper::isAlreadyInMassList($item->id))
						{
							$disabled = "disabled";
							$onClick  = "";
							$extraClass = " btndisabled";
						}
						else
						{
							$disabled = "";
							$onClick  = "javascript:addMassDownload('".Uri::root()."','".$item->id."');";
							$extraClass = "";
						}
						?>

						<a href="javascript:void(0);" id="btnMassDownload_<?php echo $item->id; ?>"  class="edocman-download-link mass-download-btn <?php echo $extraClass;?> <?php echo $disable_download_button;?>" aria-label="<?php echo $item->title; ?>" <?php echo $disabled;?>  data-id="<?php echo $item->id; ?>" data-name="<?php echo $item->title; ?>" data-type="<?php echo $ext;?>" data-size="<?php $item->data->size; ?>" title="<?php echo Text::_('EDOCMAN_ADD_TO_MASS_DOWNLOAD_LIST'); ?>">

							<span class="edocman_download_label">
								<i class="edicon edicon-box-add"></i>
							</span>
						</a>
						<?php
					} 
					if ($canDownload && $show_view_button == 1 && $item->canView && $config->show_view_button_table)
					{
						$playextension	= EdocmanHelper::returnPlayExtension();
						$showModal		= EdocmanHelper::viewable($item);
						$ext			= strtolower(EDocmanHelper::getExt($item)) ;
						if((in_array($ext,$playextension) || $item->view_url != "") && $showModal && !EDocmanHelper::isDropBoxTurnedOn() && !EDocmanHelper::isAmazonS3TurnedOn())
						{
							$viewUrl = Uri::root()."index.php?option=com_edocman&view=play&id=".$item->id."&tmpl=component";
							$audio_player = EdocmanHelper::generateAudioPlayer($item, $showModal);
							
							if($config->view_option == 0)
							{
							?>
								<a href="<?php echo $viewUrl; ?>" class="edocman-download-link edocmanplayerbtn" data-toggle="modal" <?php echo $audio_player;?> aria-label="<?php echo Text::_('EDOCMAN_CLICK_TO_VIEW_CONTENT_DOCUMENT'); ?>" title="<?php echo Text::_('EDOCMAN_CLICK_TO_VIEW_CONTENT_DOCUMENT'); ?>" rel="nofollow" >
									<span class="edocman_download_label">
										<i class="edicon edicon-eye"></i>
										<?php echo Text::_('EDOCMAN_VIEW'); ?>
									</span>
								</a>
							<?php
							}
							else
							{
							?>
								<a href="<?php echo $viewUrl; ?>" class="edocman-download-link" target="_blank" data-toggle="modal" <?php echo $audio_player;?> aria-label="<?php echo Text::_('EDOCMAN_CLICK_TO_VIEW_CONTENT_DOCUMENT'); ?>" title="<?php echo Text::_('EDOCMAN_CLICK_TO_VIEW_CONTENT_DOCUMENT'); ?>" rel="nofollow" >
									<span class="edocman_download_label">
										<i class="edicon edicon-eye"></i>
										<?php echo Text::_('EDOCMAN_VIEW'); ?>
									</span>
								</a>
							<?php
							}
						}
						else
						{

							//$viewUrl = Route::_('index.php?option=com_edocman&task=document.viewdoc&id=' . $item->id . '&Itemid=' . $Itemid);

							if($item->view_url != "")
							{
								$viewUrl = $item->view_url;
							}
							else
							{
								if (in_array($ext, ['pdf']) && $config->use_googleviewer == 0 && $config->pdf_view_option == 0 && $config->pdf_view_type == 0)
								{
									$viewUrl		= Route::_('index.php?option=com_edocman&task=document.viewdoc&tmpl=component&id=' . $item->id );

									$extraViewClass = 'pdfviewer';
									$target         = '';
								}
								else
								{
									$viewUrl = Route::_('index.php?option=com_edocman&task=document.viewdoc&id=' . $item->id . '&Itemid=' . $Itemid);

									$extraViewClass = '';
									$target         = 'target="_blank"';
								}
							}
							?>
							<a class="edocman-download-link <?php echo $extraViewClass; ?>" <?php echo $target;?> href="<?php echo $viewUrl; ?>"
							   target="_blank" aria-label="<?php echo Text::_('EDOCMAN_CLICK_TO_VIEW_CONTENT_DOCUMENT'); ?>" title="<?php echo Text::_('EDOCMAN_CLICK_TO_VIEW_CONTENT_DOCUMENT'); ?>" rel="nofollow" >
							    <span class="edocman_download_label">
									<i class="edicon edicon-eye"></i>
									<?php echo Text::_('EDOCMAN_VIEW'); ?>
								</span>
							</a>
							<?php
						}
						//echo "&nbsp;";
					}

					if($item->document_url != "")
					{
						if($config->external_download_link == 1)
						{
							$target = "_blank";
						}
						else
						{
							$target = "_self";
						}
					}
					else
					{
						$target = "_self";
					}
					if ($canDownload && $hide_download_button != 1 && $accept_license == 0)
					{
						if ($showDownloadForm)
						{
							
							?>
								<a data-toggle="modal" data-document-title="<?php echo $item->title; ?>" class="edocmancollectdownloadbtn edocman-download-link" href="<?php echo Uri::root(true); ?>/index.php?option=com_edocman&view=document&layout=modal&view=document&layout=modal&tmpl=component&id=<?php echo $item->id;?>&direct=1" id="<?php echo $item->id; ?>" target="<?php echo $target;?>" title="<?php echo Text::_('EDOCMAN_CLICK_HERE_TO_DOWNLOAD_DOCUMENT');?>" aria-label="<?php echo Text::_('EDOCMAN_CLICK_HERE_TO_DOWNLOAD_DOCUMENT'); ?>">
							
									<span class="edocman_download_label">
										<i class="edicon edicon-cloud-download"></i>
										<?php
										$fileName = $item->filename;
										$fileExt  = strtolower(EdocmanHelper::getExt($fileName));
										echo Text::_('EDOCMAN_DOWNLOAD'); ?>
										<?php
										$tempArr = [];
										?>
									</span>
								</a>
							<?php
						}
						else
						{
						?>
							<a href="<?php echo $downloadUrl; ?>" class="edocman-download-link" target="<?php echo $target;?>" title="<?php echo Text::_('EDOCMAN_DOWNLOAD_DOCUMENT');?>" aria-label="<?php echo Text::_('EDOCMAN_DOWNLOAD_DOCUMENT');?>">
								<span class="edocman_download_label">
									<?php
									if($item->document_url != "")
									{
										?>
											<i class="edicon edicon-link"></i>
										<?php echo Text::_('EDOCMAN_OPEN_DOCUMENT');
									}
									else
									{
										?>
											<i class="edicon edicon-cloud-download"></i>
										<?php
										echo Text::_('EDOCMAN_DOWNLOAD');
									}
									?>
								</span>
							</a>
						<?php
						}
					}
					elseif($config->login_to_download && (int)$userId == 0 && $hide_download_button != 1 && $accept_license == 0)
					{
						if($config->edocman_login == 1)
						{
							EdocmanHelper::generateJoomlaLogin('edocman-download-link edocman-download-btn');
						}
						else
						{
							
							$return = base64_encode(Uri::getInstance()->toString());
							?>
							<a data-toggle="modal" class="logintodownload edocman-download-link edocman-download-btn" href="<?php echo Uri::root();?>index.php?option=com_edocman&view=document&layout=login&id=<?php echo $item->id;?>&tmpl=component&return=<?php echo $return;?>" aria-label="<?php echo Text::_('EDOCMAN_LOGIN_TO_DOWNLOAD'); ?>" title="<?php echo Text::_('EDOCMAN_LOGIN_TO_DOWNLOAD');?>">
							
								<span class="edocman_download_label">
									<?php
									echo Text::_('EDOCMAN_LOGIN_TO_DOWNLOAD'); ?>
								</span>
							</a>
						<?php
						}
					}
					elseif($canDownload && $hide_download_button != 1 && ($accept_license == 1))
					{
						?>
							<a href="<?php echo $url; ?>" class="edocman-download-link edocman-download-btn" title="<?php echo Text::_('EDOCMAN_DOWNLOAD_DOCUMENT');?>" aria-label="<?php echo Text::_('EDOCMAN_DOWNLOAD_DOCUMENT');?>">
								<span class="edocman_download_label">
									<?php
									if($item->document_url != "")
									{
										echo '<i class="edicon edicon-link"></i> ';
										echo Text::_('EDOCMAN_OPEN_DOCUMENT');
									}
									else
									{
										echo '<i class="edicon edicon-cloud-download"></i> ';
										echo Text::_('EDOCMAN_DOWNLOAD');
									}
									?>
								</span>
							</a>
						<?php
					}
					?>
				</td>
			</tr>
			<?php
		}
		?>
		</tbody>
	</table>
<?php
}
else
{
	if($config->show_no_document_available_text)
	{
		echo Text::_('EDOCMAN_NO_AVAILABLE_DOCUMENTS');
	}
}
?>

<?php
if ($showDownloadForm && !EdocmanHelper::isJoomla4())
{
	echo EDocmanHelperHtml::loadCommonLayout('common/modal.php', array('bootstrapHelper' => $bootstrapHelper,'config' => $config));
}
if((!$canDownload && $hide_download_button != 1 && $config->login_to_download && (int)$userId == 0) && !EdocmanHelper::isJoomla4())
{
	echo EDocmanHelperHtml::loadCommonLayout('common/login.php', array('bootstrapHelper' => $bootstrapHelper));
}

echo EDocmanHelperHtml::loadCommonLayout('common/player.php', array());
echo EDocmanHelperHtml::loadCommonLayout('common/download.php', array());

if($config->login_to_download && (int)$userId == 0)
{
	echo EDocmanHelperHtml::loadCommonLayout('common/modallogin.php', array());
	?>
	<script src="<?php echo Uri::base(); ?>components/com_edocman/assets/js/login.js" type="text/javascript"></script>
	<?php
}
?>
<script src="<?php echo Uri::base(); ?>components/com_edocman/assets/js/player.js" type="text/javascript"></script>
<script src="<?php echo Uri::base(); ?>components/com_edocman/assets/js/download.js" type="text/javascript"></script>

<script type="text/javascript">
function addMassDownload(live_site,id)
{
	jQuery('#btnMassDownload_' + id).addClass('btndisabled');
	var data = {
		'task'	:	'document.store_mass_download',
		'document_id' : id
	};
	jQuery.ajax({
		type: 'POST',
		url: live_site + 'index.php?option=com_edocman',
		data: data,
		dataType: 'html',
		success: function(response)
		{
			//alert(response.result);
			//do nothing
			jQuery('#massDownloadDiv').html(response);
		}
	});
}
</script>
