<?php
if (!defined('IN_CONTEXT')) die('access violation error!');
?>
<link rel="stylesheet" href="../script/jquery.cluetip.css" type="text/css" />
<script type="text/javascript" src="../script/jquery.cluetip.min.js"></script>
<script type="text/javascript" language="javascript">
<!--
$(document).ready(function(){
	$('#answer').cluetip({splitTitle: '|',width: '300px',height:'68px'});
	$('#answer1').cluetip({splitTitle: '|',width: '105px',height:'33px'});
	$('#answer2').cluetip({splitTitle: '|',width: '300px',height:'90px'});
	$('#answer3').cluetip({splitTitle: '|',width: '400px',height:'90px'});
	$('#answer4').cluetip({splitTitle: '|',width: '250px',height:'33px'});
});
function on_success(response) {
    var o_result = _eval_json(response);
    if (!o_result) {
        return on_failure(response);
    }
    
    var stat = document.getElementById("adminsinfofrm_stat");
    if (o_result.result == "ERROR") {
        document.forms["sinfoform"].reset();
        
        stat.innerHTML = o_result.errmsg;
        return false;
    } else if (o_result.result == "OK") {
	    stat.innerHTML = "<?php _e('Site information saved!'); ?>";
//	    window.parent.tb_remove();
	    reloadPage();
    } else {
        return on_failure(response);
    }
}

function on_failure(response) {
    document.forms["sinfoform"].reset();
    
    document.getElementById("adminsinfofrm_stat").innerHTML = "<?php _e('Request failed!'); ?>";
    return false;
}
//-->
</script>
<?php echo Notice::get('mod_site/msg');?>
<ul style="margin-left:1px;">
	<li style="margin-top:14px;"><?php include_once(P_TPL.'/common/language_switch.php'); if(SessionHolder::get('_LOCALE', DEFAULT_LOCALE) != 'en'){ ?></li><li style="margin-top:0;_margin-top:16px;">
	<img id="answer" class="title" src="<?php echo P_TPL_WEB; ?>/images/answer1.gif" alt="help" title="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;此处语言切换后可以使您在中文后台即时编辑、修改英文版网站内容，而不需切换到英文后台，方便快捷！"/>
	<?php } ?></li>
</ul>
<div class="status_bar">
	<span id="adminsinfofrm_stat" class="status" style="display:none;"></span>
</div>
<?php
$sinfo_form = new Form('index.php', 'sinfoform', 'check_sinfo_info');
$sinfo_form->setEncType('multipart/form-data');
$sinfo_form->p_open('mod_site', 'save_info');
?>
<div style="overflow:auto;width:100%;">
<table id="sinfoform_table" class="form_table" width="100%" border="0" cellspacing="1" cellpadding="2" style="line-height:24px;">
    <tfoot>
        <tr>
        	<td></td>
            <td>
            <?php
            echo Html::input('submit', 'submit', __('Save'), 'style="width:60px;"');
			echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
            echo Html::input('reset', 'reset', __('Reset'), 'style="width:60px;" onclick="if(!confirm(\'Do you want to reset ?\')){return false;}"');
            echo Html::input('hidden', 'si[id]', $curr_siteinfo->id);
            echo Html::input('hidden', 'si[s_locale]', $lang_sw);
            ?>
            </td>
        </tr>
    </tfoot>
    <tbody>
        <tr>
            <td class="label"><?php _e('Site Name'); ?></td>
            <td class="entry">
            <?php
            echo Html::input('text', 'si[site_name]', $curr_siteinfo->site_name);
            
            // 25/03/2010 Jane Add >>
            if(SessionHolder::get('_LOCALE', DEFAULT_LOCALE) != 'en') 
            {
            ?>
            <img id="answer1" class="title" src="<?php echo P_TPL_WEB; ?>/images/answer1.gif" alt="help" title="网站名称。"/>
            <?php
            // 25/03/2010 Jane Add <<
            }?>
            </td>
        </tr>
        <tr>
            <td class="label" title="<?php _e('Keyword Title');?>"><?php _e('Keyword'); ?></td>
            <td class="entry">
            <?php
            echo Html::input('text', 'si[keywords]', $curr_siteinfo->keywords, 
                'size="48"');
            
            // 25/03/2010 Jane Add >>
            if(SessionHolder::get('_LOCALE', DEFAULT_LOCALE) != 'en') 
            {
            ?>
            <img id="answer2" class="title" src="<?php echo P_TPL_WEB; ?>/images/answer1.gif" alt="help" title="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;请输入希望访问者了解的产品、服务或者公司等内容名称的用语,可以方便搜索引擎收录并有利于网站优化。例:域名注册,上海域名,上海电脑等。"/>
            <?php
            // 25/03/2010 Jane Add <<
            }?>
            </td>
        </tr>
        <tr>
            <td class="label" title="<?php _e('Description Title');?>"><?php _e('Description'); ?></td>
            <td class="entry">
            <?php
            echo Html::textarea('si[description]', $curr_siteinfo->description, 
                'cols="48" rows="6"');
            
            // 25/03/2010 Jane Add >>
            if(SessionHolder::get('_LOCALE', DEFAULT_LOCALE) != 'en') 
            {
            ?>
            <img id="answer3" class="title" style="position:relative;bottom:50px;" src="<?php echo P_TPL_WEB; ?>/images/answer1.gif" alt="help" title="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;是对网站概况的介绍，这些信息可能会出现在搜索结果中。例:美橙互联,全国十大域名注册提供商,国家cnnic认证星级机构,提供专业的全系列域名注册服务,域名在线查询,即时开通,送50个子域名解析,支持URL转发,免费泛域名解析,7x24小时。"/>
            <?php
            // 25/03/2010 Jane Add <<
            }?>
            </td>
        </tr>
        
        <tr>
            <td class="label"><?php _e('Records per page'); ?></td>
            <td class="entry">
            <?php
            echo Html::input('text', 'sparam[PAGE_SIZE]', PAGE_SIZE, '', 
            	$sinfo_form, 'RequiredTextbox', __('Please input record number displayed on one page!'));
            ?>
            </td>
        </tr>
        <tr>
        	<td class="label"><?php _e('Default LANG'); ?></td>
        	<td class="entry">
            <?php
            //get type of language
            $o_lang = new Language();
        	$langs =& $o_lang->findAll();
        	$arr = array();
        	$i = $j = 0;
        	foreach($langs as $lang)
        	{
        		$arr[] = $lang->name;
        		if($lang->locale == SessionHolder::get('_LOCALE'))
        		{
        			$j = $i;
        		}
        		$i++;
        	}
            echo Html::select('sparam[USE_LANGUAGE]', $arr, $j);
            ?>
            </td>
        </tr>
		<tr>
            <td class="label"><?php _e('Login Security Code'); ?></td>
            <td class="entry">
            <?php
            echo Html::input('checkbox', 'sparam[SITE_LOGIN_VCODE]', '1', 
                Toolkit::switchText(SITE_LOGIN_VCODE, 
                    array('0' => '', '1' => 'checked="checked"')));
            
            // 25/03/2010 Jane Add >>
            if(SessionHolder::get('_LOCALE', DEFAULT_LOCALE) != 'en') 
            {
            ?>
            <img id="answer4" class="title" src="<?php echo P_TPL_WEB; ?>/images/answer1.gif" alt="help" title="可以有效防止网站恶意注册和登陆。"/>
            <?php
            // 25/03/2010 Jane Add <<
            }?>
            </td>
        </tr>
        <tr>
            <td class="label"><?php _e('Site offline'); ?></td>
            <td class="entry">
            <?php
            echo Html::input('checkbox', 'sparam[SITE_OFFLINE]', '1', 
                Toolkit::switchText(SITE_OFFLINE, 
                    array('0' => '', '1' => 'checked="checked"')));
            ?>
            </td>
        </tr>
        <tr>
            <td class="label"><?php _e('Site offline msg'); ?></td>
            <td class="entry">
            <?php
            echo Html::textarea('sparam[SITE_OFFLINE_MSG]', SITE_OFFLINE_MSG, 
                'cols="48" rows="6"');
            ?>
            </td>
        </tr>
        
        <tr>
            <td class="label"><?php _e('Company Introduction'); ?></td>
            <td class="entry">
			<?php
			//if(strpos($_SERVER['PHP_SELF'],'/admin/index.php') != 0){
				$pos = strpos($_SERVER['PHP_SELF'],'/admin/index.php');
				$path = substr($_SERVER['PHP_SELF'],0,$pos);
				if(strpos($curr_co->content,$path.'/') == 0) {
					$curr_co->content = str_replace('/admin/fckeditor',$path.'/admin/fckeditor',$curr_co->content);
				}
			//}
			?>
            <?php
            echo Html::textarea('co[content]', $curr_co->content)."\n";
            $o_fck = new RichTextbox('co[content]');
            $o_fck->toolbar_set = 'Default';
            $o_fck->width = 640;
            $o_fck->height = 360;
            echo $o_fck->create(FCK_REPLACE_TEXTAREA);
            echo Html::input('hidden', 'co[id]', $curr_co->id);
            ?>
            </td>
        </tr>
        <tr>
            <td class="label"><?php _e('Contact Us'); ?></td>
            <td class="entry">
            <?php
			if(strpos($curr_cus->content,$path.'/') == 0) {
					$curr_cus->content = str_replace('/admin/fckeditor',$path.'/admin/fckeditor',$curr_cus->content);
				}
            echo Html::textarea('cus[content]', $curr_cus->content)."\n";
            $o_fck = new RichTextbox('cus[content]');
            $o_fck->toolbar_set = 'Default';
            $o_fck->width = 640;
            $o_fck->height = 240;
            echo $o_fck->create(FCK_REPLACE_TEXTAREA);
            echo Html::input('hidden', 'cus[id]', $curr_cus->id);
            ?>
            </td>
        </tr>
        <tr>
        <?php
        	echo Html::input('hidden', 'logo[id]', $curr_logo->id);
            echo Html::input('hidden', 'param[logo_img]', $p_logo['img_src']);
            echo Html::input('hidden', 'banner[id]', $curr_banner->id);
			echo Html::input('hidden', 'param[banner_img]', $p_banner['img_src']);
            echo Html::input('hidden', 'foot[id]', $curr_foot->id);
        ?>
            <td class="label"><?php _e('Logo'); ?></td>
            <td class="entry">
			<?php if($p_logo['img_src']){?>
			<img src="../<?php echo $p_logo['img_src']?>" ><br />
			<?php }?>
            <?php
            echo Html::input('file', 'logo_file', '', 
                '', $mod_form);
            ?>
			<BR />
			<?php _e('Supported file format'); ?>:<?php echo PIC_ALLOW_EXT;?>
			<BR />
			<?php _e('Upload size limit'); ?>:<?php echo ini_get('upload_max_filesize');?>
            </td>
        </tr>
		 <tr>
            <td class="label"><?php _e('Size'); ?></td>
            <td class="entry">
            <?php
            echo Html::input('text', 'param[logo_width]', $p_logo['img_width'], 
                'size=2', $mod_form);
            ?>
            &times;
            <?php
            echo Html::input('text', 'param[logo_height]', $p_logo['img_height'], 
                'size=2', $mod_form);
            ?>
            </td>
        </tr>
		 
		<tr>
            <td class="label"><?php _e('Banner'); ?></td>
            <td class="entry">
			<?php //if($p_banner['img_src']){?>
				<?php if(@strpos($p_banner['flv_src'],'swf')){?>
			
			<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="<?php echo $p_banner['img_width'];?>" height="<?php echo $p_banner['img_height'];?>">
			<param name="movie" value="../<?php echo $p_banner['flv_src'];?>" />
			<param name="quality" value="high" />
			<embed src="../<?php echo $p_banner['flv_src'];?>" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="1004" height="256"></embed>
			</object>
			<br/>
				<?php }else{?>
					<img src="../<?php echo $p_banner['img_src'];?>"/>
				<?php }?>
				<br/>
			<?php //}?>
            <?php
            echo Html::input('file', 'banner_file', '', 
                '', $mod_form);
            ?>
			<BR />
			<?php _e('Supported file format'); ?>:<?php echo PIC_ALLOW_EXT.'|swf';?>
			<BR />
			<?php _e('Upload size limit'); ?>:<?php echo ini_get('upload_max_filesize');?>
            </td>
        </tr>
		<tr>
            <td class="label"><?php _e('Size'); ?></td>
            <td class="entry">
            <?php
            echo Html::input('text', 'param[banner_width]', $p_banner['img_width'], 
                'size=2', $mod_form);
            ?>
            &times;
            <?php
            echo Html::input('text', 'param[banner_height]', $p_banner['img_height'], 
                'size=2', $mod_form);
            ?>
            </td>
            </td>
        </tr>
		
		<tr>
            <td class="label"><?php _e('Foot Information');?></td>
            <td class="entry">
			<?php
            echo Html::textarea('param[html]', $p_foot['html'], 'rows="8" cols="76"')
            ?>
            </td>
        </tr>
		
		<tr>
            <td class="label"><?php _e('Background music'); ?></td>
            <td class="entry">
            <?php
            echo Html::input('file', 'music_file', '', '', $mod_form);
            ?>
            <?php 
            $o_bgmusic = new BackgroundMusic();
            $bgmusic_items = $o_bgmusic->findAll();
            $once_play_checked = ($bgmusic_items[0]->play == 1) ? 'checked="checked"' : '';
            $loop_play_checked = ($bgmusic_items[0]->play == 2) ? 'checked="checked"' : '';
            $stop_play_checked = ($bgmusic_items[0]->play == 3) ? 'checked="checked"' : '';
            if(empty($once_play_checked) && empty($loop_play_checked) && empty($stop_play_checked))
            {
            	$once_play_checked = 'checked="checked"';
            }
            ?>
            <input type="radio" value="1" id="play_type" name="radio[play_type]" <?php echo $once_play_checked;?>><?php _e('once play');?>&nbsp;<input type="radio" value="2" id="play_type" name="radio[play_type]" <?php echo $loop_play_checked;?>><?php _e('loop play');?>
            &nbsp;<input type="radio" value="3" id="play_type" name="radio[play_type]" <?php echo $stop_play_checked;?>><?php _e('play sotp');?>
			<br />
			<?php _e('Supported file format'); ?>:<?php echo MUSIC_ALLOW_EXT;?>
			<br />
			<?php _e('Upload size limit'); ?>:<?php echo ini_get('upload_max_filesize');?>
			<br />
			<?php _e('Current music file');?>:<?php echo $bgmusic_items[0]->music_name;?>
            </td>
        </tr>
    </tbody>
</table>
</div>
<?php
$sinfo_form->close();
$sinfo_form->writeValidateJs();

//include_once(P_TPL.'/view/mod_param/admin_list.php');// load mod_param' page
?>
