Skip to content

Hướng dẫn nâng cấp module download lên phiên bản 4.0.23

Hồ Ngọc Triển edited this page Oct 8, 2015 · 28 revisions

1) Cập nhật các file mới

2) Nâng cấp dữ liệu bằng cách chạy đoạn SQL sau:

INSERT INTO `nv4_vi_download_config` (`config_name`, `config_value`) VALUES ('indexfile', 'viewcat_main_bottom');

INSERT INTO `nv4_vi_download_config` (`config_name`, `config_value`) VALUES ('viewlist_type', 'list');

INSERT INTO `nv4_vi_download_config` (`config_name`, `config_value`) VALUES ('per_page_home', '20'), ('per_page_child', '20');

ALTER TABLE `nv4_vi_download_categories` ADD `viewcat` VARCHAR( 100 ) NOT NULL DEFAULT 'viewcat_main_bottom' AFTER `groups_download`) ;

ALTER TABLE `nv4_vi_download_categories` ADD `numlink` SMALLINT(4) UNSIGNED NOT NULL DEFAULT '3' AFTER `viewcat`);

INSERT INTO `nv4_vi_download_config` (`config_name`, `config_value`) VALUES ('tags_alias', '0');

3. Thay đổi giao diện

1, Xóa themes/ten-theme/modules/download/main_page.tpl

2, Copy các file sau vào giao diện của bạn, với đường dẫn tương ứng.

themes/default/modules/download/viewcat_list.tpl
themes/default/modules/download/viewcat_main.tpl
themes/default/modules/download/viewcat_table.tpl

Tìm và xóa file themes/default/modules/download/viewcat_page.tpl

3, Mở themes/ten-theme/modules/download/viewfile.tpl

Tìm

	<!-- BEGIN: introtext -->
	<div class="introtext">
		{ROW.description}
	</div>
	<!-- END: introtext -->

Thay bằng

			<!-- BEGIN: introtext -->
			<div class="introtext m-bottom">
				{ROW.description}
			</div>
			<p class="text-center"><button id="expand" class="btn btn-primary btn-xs">{LANG.expand}</button></p>
			<script>
				if( $.trim( $(".introtext").html() ).length <= 100 )
				{
					$('#expand').hide();
				}

				$('#expand').click(function() {
					if( $(this).hasClass('expand') ){
						$(this).removeClass('expand');
						$(this).html('{LANG.expand}');
					}
					else{
						$(this).addClass('expand');
						$(this).html('{LANG.collapse}');
					}
					$('.introtext').toggleClass("expand");
				});
			</script>
			<!-- END: introtext -->

Tìm

	<script type="text/javascript">
		var sr = 0;
		var file_your_rating = '{LANG.file_your_rating}';
		var rating_point = '{LANG.rating_point}';
		var id = '{ROW.id}';
	</script>

Thay bằng

	<script type="text/javascript">
		var sr = 0;
		var file_your_rating = '{LANG.file_your_rating}';
		var rating_point = '{LANG.rating_point}';
		var id = '{ROW.id}';

		$(document).ready(function() {
		    $("#pop").on("click", function() {
		       $('#imagepreview').attr('src', $('#imageresource').attr('src'));
		       $('#imagemodal').modal('show');
		    });

			$('.hover-star').rating({
				focus : function(value, link) {
					var tip = $('#hover-test');
					if (sr != 2) {
						tip[0].data = tip[0].data || tip.html();
						tip.html(file_your_rating + ': ' + link.title || 'value: ' + value);
						sr = 1;
					}
				},
				blur : function(value, link) {
					var tip = $('#hover-test');
					if (sr != 2) {
						$('#hover-test').html(tip[0].data || '');
						sr = 1;
					}
				},
				callback : function(value, link) {
					if (sr == 1) {
						sr = 2;
						$('.hover-star').rating('disable');
						nv_sendrating(id, value);
					}
				}
			});

			$('.hover-star').rating('select', rating_point);
		});
	</script>

4, Mở themes/ten-theme/modules/download/viewcat_page.tpl

Tìm

<!-- BEGIN: listsubcat -->
<div class="panel panel-default">
	<div class="panel-heading">
		<h4 class="panel-title"><a href="{listsubcat.link}">{listsubcat.title}</a></h4>
	</div>
	<!-- BEGIN: itemcat -->
	<div class="panel-body">
		<!-- BEGIN: image -->
		<div class="col-xs-12 col-md-4">
			<a href="{itemcat.more_link}"> <img src="{itemcat.imagesrc}" alt="{itemcat.title}" class="img-thumbnail" /> </a>
		</div>
		<!-- END: image -->
		<h4><a href="{itemcat.more_link}">{itemcat.title}</a></h4>
		<small>
			<em class="fa fa-eye">&nbsp;</em> {LANG.viewcat_view_hits} {itemcat.view_hits}
			<span class="count-down"><em class="fa fa-download">&nbsp;</em> {LANG.viewcat_download_hits} {itemcat.download_hits}</span>
		</small>
		<p>
			{itemcat.introtext}
		</p>
		<p class="pull-right">
			<a href="{itemcat.more_link}">{LANG.readmore}...</a>
		</p>
	</div>
	<!-- BEGIN: related -->
	<ul class="list-group">
		<!-- BEGIN: loop -->
		<li class="list-group-item">
			<a href="{loop.more_link}">{loop.title}</a>
			<div class="text-right"><em class="fa fa-download">&nbsp;</em> {LANG.viewcat_download_hits} {loop.download_hits}</div>
		</li>
		<!-- END: loop -->
	</ul>
	<!-- END: related -->
	<!-- END: itemcat -->
</div>
<!-- END: listsubca -->

Thay bằng

	<!-- BEGIN: viewcat_main -->{SUBCAT}<!-- END: viewcat_main -->

	<!-- BEGIN: viewcat_list -->
	<div class="text-center">{SUBCAT_DATA.title}</div>
	{SUBCAT}
	<!-- END: viewcat_list -->

5, Mở themes/ten-theme/css/download.css

Tìm

.block_download .introtext {
	font: normal 13px arial, verdana, sans-serif;
	padding: 10px 5px 5px 10px;
	text-align: justify
}

Thay bằng

.block_download .introtext {
	font: normal 13px arial, verdana, sans-serif;
	padding: 10px 5px 5px 10px;
	text-align: justify;
    max-height: 105px;
    overflow: hidden;
    -webkit-transition: all .5s ease-in-out;
    -moz-transition: all .5s ease-in-out;
    transition: all .5s ease-in-out;
}

.block_download div.expand {
    max-height: 900px;
}

Thêm cuối file

.viewcat_list .list-title{
	margin: 5px
}

.viewcat_list .list-content{
	border-top: 1px dotted #DDDDDD;
	margin: 0 5px 0 5px;
	padding: 5px 0 5px 0;
}

.viewcat_list .pagination{
	margin-top: 0
}

/* div table */
.divTable {
	width: 100%;
	display: table;
	border-collapse: collapse;
	border-spacing: 0;
}
.divTable .divTitle {
	display: table-caption;
	text-align: center;
	font-weight: bold;
	font-size: larger;
}
.divTable .divHeading {
	display: table-row;
	font-weight: bold;
	border-bottom-width: 2px;
}
.divTable .divHeading .Cell {
	border-bottom-width: 2px;
}
.divTable .Row {
	display: table-row;
}
.divTable .Row:nth-of-type(odd) {
    background-color: #f9f9f9;
}
.divTable .Row:hover {
	background-color: #f5f5f5;
	cursor: default
}
.divTable .Cell {
	display: table-cell;
	border: 1px solid #ddd;
	border-width: thin;
	padding: 8px;
}

6, Mở themes/ten-theme/js/download.js

Tìm và xóa

// Viewfile
$(document).ready(function() {
    $("#pop").on("click", function() {
       $('#imagepreview').attr('src', $('#imageresource').attr('src'));
       $('#imagemodal').modal('show');
    });

	$('.hover-star').rating({
		focus : function(value, link) {
			var tip = $('#hover-test');
			if (sr != 2) {
				tip[0].data = tip[0].data || tip.html();
				tip.html(file_your_rating + ': ' + link.title || 'value: ' + value);
				sr = 1;
			}
		},
		blur : function(value, link) {
			var tip = $('#hover-test');
			if (sr != 2) {
				$('#hover-test').html(tip[0].data || '');
				sr = 1;
			}
		},
		callback : function(value, link) {
			if (sr == 1) {
				sr = 2;
				$('.hover-star').rating('disable');
				nv_sendrating(id, value);
			}
		}
	});

	$('.hover-star').rating('select', rating_point);
});

7, Nếu tồn tại themes/ten-theme/modules/download/theme.php

Tìm

function theme_main_download( $array_cats, $list_cats, $download_config )

Thay bằng

function theme_viewcat_main( $viewcat, $array_cats )

Tìm

	$xtpl = new XTemplate( 'main_page.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file . '/' );

Thay bằng

	$xtpl = new XTemplate( $viewcat . '.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file . '/' );

Tìm và xóa hàm theme_viewcat_download()

Thêm vào cuối file

/**
 * theme_viewcat_list()
 *
 * @param mixed $array_files
 * @param mixed $page
 * @param mixed $cat_data
 * @return
 */
function theme_viewcat_list( $array_files, $page = '', $cat_data = array(), $subcat = true )
{
	global $global_config, $lang_module, $lang_global, $module_info, $module_name, $module_file, $my_head, $download_config;

	$viewcat = $download_config['viewlist_type'] == 'list' ? 'viewcat_list' : 'viewcat_table';

	$xtpl = new XTemplate(  $viewcat. '.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file . '/' );
	$xtpl->assign( 'LANG', $lang_module );
	$xtpl->assign( 'GLANG', $lang_global );
	$xtpl->assign( 'CAT', $cat_data );

	if( !empty( $array_files ) )
	{
		foreach( $array_files as $file )
		{
			$file['title0'] = nv_clean60( $file['title'], 30 );
			$xtpl->assign( 'FILE', $file );
			$xtpl->parse( 'main.loop' );
		}
	}

	if( !empty( $cat_data ) and $subcat )
	{
		$xtpl->parse( 'main.cat_data' );
	}

	if( !empty( $page ) )
	{
		$xtpl->assign( 'PAGE', $page );
		$xtpl->parse( 'main.page' );
	}

	$xtpl->parse( 'main' );
	return $xtpl->text( 'main' );
}

Thêm hiển thị icon upload và tổng số tập tin ở mỗi chủ đề

I. Cập nhật file thay đổi

II. Thay đổi giao diện

1, Nếu tồn tại themes/ten-theme/modules/download/theme.php

Trong hàm theme_viewcat_main, tìm

global $global_config,

Thêm vào sau

 $site_mods, 

Tìm

$xtpl->assign( 'catbox', $cat );

Thêm lên trên

if( $download_config['is_addfile_allow'] )
{
	$cat['uploadurl'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=' . $site_mods[$module_name]['alias']['upload'] . '/' . $cat['catid'];
}

Tìm

$xtpl->parse( 'main.catbox.itemcat' );

Thêm lên trên

if( $download_config['is_addfile_allow'] )
{
	$xtpl->parse( 'main.catbox.is_addfile_allow' );
}

Trong hàm theme_viewcat_list, tìm

global $global_config,

Thêm vào sau

 $site_mods, 

Tìm

$viewcat = $download_config['viewlist_type'] == 'list' ? 'viewcat_list' : 'viewcat_table';

Thêm bên dưới

if( $download_config['is_addfile_allow'] )
{
	$cat_data['uploadurl'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=' . $site_mods[$module_name]['alias']['upload'] . '/' . $cat_data['id'];
}

Tìm

if( !empty( $cat_data ) )
{
	$xtpl->parse( 'main.cat_data' );
}

Thêm dưới

if( $download_config['is_addfile_allow'] )
{
	$xtpl->parse( 'main.is_addfile_allow' );
}

Thay toàn bộ nội dung hàm nv_theme_alert, bằng

function nv_theme_alert( $message_title, $message_content, $type = 'info', $url_back = '', $time_back = 5, $lang_back = true )
{
	global $module_file, $module_info, $lang_module, $page_title;

	$xtpl = new XTemplate( 'alert.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file );
	$xtpl->assign( 'LANG', $lang_module );
	$xtpl->assign( 'CONTENT', $message_content );

	if( $type == 'success' )
	{
		$xtpl->parse( 'main.success' );
	}
	elseif( $type == 'warning' )
	{
		$xtpl->parse( 'main.warning' );
	}
	elseif( $type == 'danger' )
	{
		$xtpl->parse( 'main.danger' );
	}
	else
	{
		$xtpl->parse( 'main.info' );
	}

	if( !empty( $message_title ) )
	{
		$page_title = $message_title;
		$xtpl->assign( 'TITLE', $message_title );
		$xtpl->parse( 'main.title' );
	}
	else
	{
		$page_title = $module_info['custom_title'];
	}

	if( !empty( $url_back ) )
	{
		$xtpl->assign( 'TIME', $time_back );
		$xtpl->assign( 'URL', $url_back );
		$xtpl->parse( 'main.url_back' );
		if( $lang_back )
		{
			$xtpl->parse( 'main.url_back_button' );
		}
	}

	$xtpl->parse( 'main' );
	$contents = $xtpl->text( 'main' );

	include (NV_ROOTDIR . "/includes/header.php");
	echo nv_site_theme( $contents );
	include (NV_ROOTDIR . "/includes/footer.php");
	exit( );
}

2, Mở themes/ten-theme/modules/download/viewcat_list.tpl

Tìm

<!-- BEGIN: cat_data -->
<div class="panel-heading">{CAT.title} <span class="text-danger">({CAT.numfile} {LANG.file})</span></div>
<!-- END: cat_data -->

Thay bằng

<div class="panel-heading">
	<!-- BEGIN: cat_data -->
	{CAT.title} <span class="text-danger">({CAT.numfile} {LANG.file})</span>
	<!-- END: cat_data -->
	<!-- BEGIN: is_addfile_allow -->
	<small><strong class="pull-right"><a title="{LANG.upload_to}" href="{CAT.uploadurl}"><em class="fa fa-upload fa-lg">&nbsp;</em>{LANG.upload_to}</a></strong></small>
	<!-- END: is_addfile_allow -->
</div>

3, Mở themes/ten-theme/modules/download/viewcat_main_bottom.tpl

Tìm

<a title="{catbox.title}" href="{catbox.link}">{catbox.title}</a>

Thay bằng

<a title="{catbox.title}" href="{catbox.link}">{catbox.title}</a> <span class="text-danger">({catbox.numfile} {LANG.file})</span>

Tìm

<!-- END: subcatbox -->

Thêm bên dưới

<!-- BEGIN: is_addfile_allow -->
<em class="pull-right"><small><a title="{LANG.upload_to}" href="{catbox.uploadurl}"><em class="fa fa-upload fa-lg">&nbsp;</em>{LANG.upload_to}</a></small></em>
<!-- END: is_addfile_allow -->
<!-- BEGIN: more -->
<em class="pull-right"><small><a title="{LANG.categories_viewall}" href="{MORE}"><em class="fa fa-search fa-lg">&nbsp;</em>{LANG.categories_viewall}&nbsp;&nbsp;&nbsp;</a></small></em>
<!-- END: more -->

4, Mở themes/ten-theme/modules/download/viewcat_table.tpl

Tìm

<!-- BEGIN: cat_data -->
<strong class="show m-bottom">{CAT.title}</strong>
<!-- END: cat_data -->

Thay bằng

<div class="clearfix">
	<!-- BEGIN: cat_data -->
	<strong class="show m-bottom pull-left">{CAT.title} <span class="text-danger">({CAT.numfile} {LANG.file})</span></strong>
	<!-- END: cat_data -->
	<!-- BEGIN: is_addfile_allow -->
	<small><strong class="pull-right"><a title="{LANG.upload_to}" href="{CAT.uploadurl}"><em class="fa fa-upload fa-lg">&nbsp;</em>{LANG.upload_to}</a></strong></small>
	<!-- END: is_addfile_allow -->
</div>

Câp nhật các thay đổi về cấu hình

Thay đổi CSDL

UPDATE `nv4_vi_download_config` SET `config_value` ='adobe,archives,audio,documents,flash,images,real,video' WHERE `config_name` = 'upload_filetype';

DELETE FROM `nv4_vi_download_config` WHERE `config_name` = 'upload_dir';

DELETE FROM `nv4_vi_download_config` WHERE `config_name` = 'temp_dir';

UPDATE `nv4_vi_download_config` SET `config_value` = '0' WHERE `config_name` ='is_zip';

Sửa lỗi kiểm tra sai số ký tự captcha

Cập nhật file mới

Thay đổi giao diện

1, Nếu tồn tại themes/ten-theme/modules/dơwnload/theme.php

Tìm và xóa

	$my_head .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . NV_ASSETS_DIR . "/js/jquery/jquery.validate.min.js\"></script>\n";
	$my_head .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . NV_ASSETS_DIR . "/js/language/jquery.validator-" . NV_LANG_INTERFACE . ".js\"></script>\n";
	$my_head .= "<script type=\"text/javascript\">\n";
	$my_head .= "$(document).ready(function(){
    $('#uploadForm').validate({
        rules: {
        upload_title: {
        required: true,
        rangelength: [3, 255]
    },
    upload_author_name: {
        rangelength: [3, 100]
    },
    upload_author_email: {
        email: true
    },
    upload_author_url: {
        url: true
    },
    upload_fileupload: {
        accept: '" . implode( "|", $download_config['upload_filetype'] ) . "'
    },
    upload_filesize: {
        number: true
    },
    upload_fileimage: {
        accept: 'jpg|gif|png'
    },
    upload_introtext: {
        maxlength: 500
    },
    upload_description: {
        maxlength: 5000
    },
    upload_user_name: {
        required: true,
        rangelength: [3, 60]
    },
    upload_seccode: {
        required: true,
        minlength: 6
    }
    }
    });
    });";
	$my_head .= " </script>\n";

Tìm

$xtpl->assign( 'DOWNLOAD', NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name );

Thêm lên trên

	$xtpl->assign( 'NV_BASE_SITEURL', NV_BASE_SITEURL );
	$xtpl->assign( 'NV_ASSETS_DIR', NV_ASSETS_DIR );
	$xtpl->assign( 'NV_LANG_INTERFACE', NV_LANG_INTERFACE );

Tìm

	if( !empty( $cat_data ) )
	{
		if( $download_config['is_addfile_allow'] )
		{
			$cat_data['uploadurl'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=' . $site_mods[$module_name]['alias']['upload'] . '/' . $cat_data['id'];
		}
	}

Thay bằng


	if( $download_config['is_addfile_allow'] )
	{
		if( !empty( $cat_data ) )
		{
			$cat_data['uploadurl'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=' . $site_mods[$module_name]['alias']['upload'] . '/' . $cat_data['id'];
		}
		else
		{
			$cat_data['uploadurl'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=' . $site_mods[$module_name]['alias']['upload'];
		}

2, Mở file themes/ten-theme/modules/dơwnload/upload.tpl

Tìm

<!-- BEGIN: main -->

Thêm bên dưới

<script type="text/javascript" src="{NV_BASE_SITEURL}{NV_ASSETS_DIR}/js/jquery/jquery.validate.min.js"></script>
<script type="text/javascript" src="{NV_BASE_SITEURL}{NV_ASSETS_DIR}/js/language/jquery.validator-{NV_LANG_INTERFACE}.js"></script>
<script>var uploadForm = true;</script>

Tìm

role="form"

Thêm vào sau

 data-upload_filetype="{UPLOAD.upload_filetype}"

3, Mở file themes/ten-theme/js/download.js

Thêm vào cuối

$(document).ready(function(){
	if( typeof uploadForm !== 'undefined' )
	{
		$('#uploadForm').validate({
		    rules: {
		    	upload_title: {
			    required: true,
			    rangelength: [3, 255]
			},
			upload_author_name: {
			    rangelength: [3, 100]
			},

			upload_author_email: {
			    email: true
			},

			upload_author_url: {
			    url: true
			},

			upload_fileupload: {
			    accept: $(this).data('upload_filetype')
			},

			upload_filesize: {
			    number: true
			},

			upload_fileimage: {
			    accept: 'jpg|gif|png'
			},

			upload_introtext: {
			    maxlength: 500
			},

			upload_description: {
			    maxlength: 5000
			},

			upload_user_name: {
			    required: true,
			    rangelength: [3, 60]
			},

			upload_seccode: {
			    required: true,
			    minlength: $('#upload_seccode_iavim').attr('maxlength')
			}
		}
		});
	}
});

Cập nhật quản lý chủ đề

Cập nhật các file thay đổi

Thay đổi CSDL

ALTER TABLE `nv4_vi_download_categories` ADD `numsubcat` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' AFTER `groups_download`, ADD `subcatid`VARCHAR(255) NOT NULL DEFAULT '' AFTER `numsubcat`;

ALTER TABLE `nv4_vi_download_categories` ADD `sort` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0' AFTER `numlink`, ADD `lev` SMALLINT(5)UNSIGNED NOT NULL DEFAULT '0' AFTER `sort`;

Sau khi thực thi các câu lệnh SQL bên trên, vào khu vực quản lý chủ đề (module dơwnload), sửa một chủ đề bất kỳ và lưu lại để cập nhật lại CSDL.

Thay đổi giao diện

1, Mở themes/ten-theme/modules/download/upload.tpl

Tìm

<!-- BEGIN: main -->

Thêm xuống dưới

<link rel="stylesheet" href="{NV_BASE_SITEURL}{NV_ASSETS_DIR}/js/select2/select2.min.css">
<script type="text/javascript" src="{NV_BASE_SITEURL}{NV_ASSETS_DIR}/js/select2/select2.min.js"></script>

Tìm

var uploadForm = true;

Thêm dưới

$('#upload_catid').select2();

Tìm

{LISTCATS.name}

Thay bằng

{LISTCATS.space}{LISTCATS.title}

2, Nếu tồn tại themes/ten-theme/modules/download/theme.php

Tìm trong hàm theme_upload

	foreach( $list_cats as $cat )
	{
		$cat['selected'] = $array['catid'] == $cat['id'] ? " selected=\"selected\"" : "";
		$xtpl->assign( 'LISTCATS', $cat );
		$xtpl->parse( 'main.catid' );
	}

Thay bằng

	if( !empty( $list_cats ) )
	{
		foreach( $list_cats as $catid => $value )
		{
			$value['space'] = '';
			if( $value['lev'] > 0 )
			{
				for( $i = 1; $i <= $value['lev']; $i++ )
				{
					$value['space'] .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
				}
			}
			$value['selected'] = $catid == $array['catid'] ? ' selected="selected"' : '';
			$xtpl->assign( 'LISTCATS', $value );
			$xtpl->parse( 'main.catid' );
		}
	}

Cập nhật trang tìm kiếm

Cập nhật file thay đổi

Cập nhật giao diện

1, Mở themes/ten-theme/modules/download/block_search.tpl

Tìm

<form action="{FORMACTION}" method="post">

Thay bằng

<form action="{BASE_URL_SITE}index.php" method="get">
	<input type="hidden" name="{NV_LANG_VARIABLE}" value="{NV_LANG_DATA}" />
	<input type="hidden" name="{NV_NAME_VARIABLE}" value="{MODULE_NAME}" />
	<input type="hidden" name="{NV_OP_VARIABLE}" value="{OP_NAME}" />

Tìm

value=""

Thay bằng

value="0"

Tìm và xóa

name="submit"

2, Tạo file themes/ten-theme/modules/download/search.tpl với nội dung

<!-- BEGIN: main -->

<!-- BEGIN: is_search -->
	<!-- BEGIN: data -->
	<div class="alert alert-info text-center">
		{LANG.search_result_count}
	</div>
	{SEARCH}
	<!-- END: data -->

	<!-- BEGIN: empty -->
	<div class="alert alert-info text-center">{LANG.search_noresult}</div>
	<!-- END: empty -->
<!-- END: is_search -->

<!-- BEGIN: not_search -->
	<div class="alert alert-info text-center">{LANG.search_input}</div>
<!-- END: not_search -->

<!-- END: main -->

3, Nếu tồn tại themes/ten-theme/modules/download/theme.php

Tìm

function theme_viewcat_list( $array_files, $page = '', $cat_data = array(), $subcat = true )

Thay bằng

function theme_viewcat_list( $array_files, $page = '', $cat_data = array(), $subcat = true, $upload = true )

Tìm trong hàm theme_viewcat_list

if( $download_config['is_addfile_allow'] )

Thay bằng

if( $download_config['is_addfile_allow'] and $upload )

Thêm vào cuối file

/**
 * theme_search()
 *
 * @param mixed $array
 * @param mixed $generate_page
 * @param mixed $is_search
 * @return
 */
function theme_search( $array, $generate_page, $is_search )
{
	global $module_info, $module_name, $module_file, $lang_module, $lang_global;
	$xtpl = new XTemplate( 'search.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file . '/' );
	$xtpl->assign( 'LANG', $lang_module );
	if( $is_search )
	{
		if( !empty( $array ) )
		{
			$xtpl->assign( 'SEARCH', theme_viewcat_list( $array, $generate_page, array(), false, false ) );
			$xtpl->parse( 'main.is_search.data' );
		}
		else
		{
			$xtpl->parse( 'main.is_search.empty' );
		}
		$xtpl->parse( 'main.is_search' );
	}
	else
	{
		$xtpl->parse( 'main.not_search' );
	}
	$xtpl->parse( 'main' );
	return $xtpl->text( 'main' );
}

Cập nhật đuờng dẫn upload file (Nếu quản trị thì dẫn vào ACP)

Cập nhật file thay đổi

Thay đổi giao diện

1, Nếu tôn tại themes/admin_default/modules/download/theme.php

Tìm trong hàm theme_viewcat_main

if( $download_config['is_addfile_allow'] )

Thay bằng

if( defined( 'NV_IS_ADMIN' ) or $download_config['is_addfile_allow'] )

Tìm trong hàm theme_viewcat_main

$cat['uploadurl'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=' . $site_mods[$module_name]['alias']['upload'] . '/' . $cat['catid'];

Thay bằng

				if( defined( 'NV_IS_ADMIN' ) )
				{
					$cat['uploadurl'] = NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=add&amp;catid=' . $cat['catid'];
				}
				else
				{
					$cat['uploadurl'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=' . $site_mods[$module_name]['alias']['upload'] . '/' . $cat['catid'];
				}

Tìm trong hàm theme_viewcat_list

if( $download_config['is_addfile_allow'] )

Thay bằng

if( defined( 'NV_IS_ADMIN' ) or ( $download_config['is_addfile_allow'] and $upload ) )

Tìm trong hàm theme_viewcat_list

if( !empty( $cat_data ) )

Thay bằng

		if( defined( 'NV_IS_ADMIN' ) )
		{
			$cat_data['uploadurl'] = NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=add&amp;catid=' . $cat_data['id'];
		}
		elseif( !empty( $cat_data ) )

Tìm trong hàm theme_viewcat_list

if( $download_config['is_addfile_allow'] and $upload )

Thay bằng

if( ( defined( 'NV_IS_ADMIN' ) or $download_config['is_addfile_allow'] ) and $upload )