发布v2.5.7版本
This commit is contained in:
@@ -81,6 +81,7 @@ class inputChajian extends Chajian
|
||||
$type = $a['fieldstype'];
|
||||
$placeholder = arrvalue($a, 'placeholder');
|
||||
$isbt = arrvalue($a, 'isbt');
|
||||
$zdsm = arrvalue($a, 'zdsm');
|
||||
$data = $a['data'];
|
||||
$val = $a['dev'];
|
||||
if(isset($a['value']))$val=$a['value'];
|
||||
@@ -221,7 +222,7 @@ class inputChajian extends Chajian
|
||||
if($type=='checkbox'){
|
||||
$chk = '';
|
||||
if($val=='1'||$val=='true')$chk='checked';
|
||||
$str = '<input name="'.$fname.'" '.$chk.' '.$attr.''.$styles.' type="checkbox" value="1"> ';
|
||||
$str = '<label><input name="'.$fname.'" '.$chk.' '.$attr.''.$styles.' type="checkbox" value="1">'.$placeholder.'</label> ';
|
||||
}
|
||||
if($type=='uploadimg'){
|
||||
$str1= '<a href="javascript:;" onclick="c.uploadfileis(\''.$fname.'\',1)">库中选</a> ';
|
||||
@@ -248,6 +249,7 @@ class inputChajian extends Chajian
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!isempt($zdsm))$str.='<br><font color="#888888">'.$zdsm.'</font>';
|
||||
if($iszb>0)return $str;
|
||||
if($isasm==1){
|
||||
$lx = 'span';if($ism==1)$lx='div';
|
||||
|
||||
@@ -5,8 +5,9 @@
|
||||
class langChajian extends Chajian{
|
||||
|
||||
//支持的语言包
|
||||
private $langArray = array('zh-CN','en-US','zh-TW','jp');
|
||||
private $locallang = 'zh-CN'; //默认的语言包
|
||||
public $langArray = array('zh-CN','zh-FT','en-US');
|
||||
public $langArraycn = array('简体中文','繁体中文','英文');
|
||||
public $locallang = 'zh-CN'; //默认的语言包
|
||||
|
||||
/**
|
||||
* 初始化语言包
|
||||
@@ -17,14 +18,120 @@ class langChajian extends Chajian{
|
||||
$lang = $this->rock->get('locallang', $moren);
|
||||
if(!in_array($lang, $this->langArray))$lang = $moren;
|
||||
if(!defined('LANG'))define('LANG', $lang);
|
||||
$langs = str_replace('-','_', $lang);
|
||||
$langr = str_replace('-','_', $moren);
|
||||
|
||||
$obj = c('lang_'.$langs.'');
|
||||
$objmr = c('lang_'.$langr.'');
|
||||
$data[$moren] = method_exists($objmr, 'getLang') ? $objmr->getLang() : array();
|
||||
$data[$lang] = method_exists($obj, 'getLang') ? $obj->getLang() : $data[$moren];
|
||||
$GLOBALS['langdata'] = $data;
|
||||
$xuhao= 0;
|
||||
foreach($this->langArray as $k=>$v){
|
||||
if($v==$lang)$xuhao = $k;
|
||||
}
|
||||
$GLOBALS['langdata'] = array(
|
||||
'lang' => $lang,
|
||||
'xuhao' => $xuhao
|
||||
);
|
||||
}
|
||||
|
||||
public function getLocal()
|
||||
{
|
||||
return array(
|
||||
'arr' => $this->langArray,
|
||||
'arrcn' => $this->langArraycn,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成语言包文件
|
||||
*/
|
||||
public function createlocal()
|
||||
{
|
||||
$bar = glob('include/langlocal/langtxt/*.txt');
|
||||
$path= 'include/langlocal/langphp/lang.php';
|
||||
$pats= 'include/langlocal/langphp/langjs.php';
|
||||
$sss = $ssb = '';
|
||||
if(is_array($bar))foreach($bar as $k=>$fil1){
|
||||
$str = $this->getcontarr($fil1);
|
||||
if($str){
|
||||
$isph = 1;
|
||||
$isjs = 0;
|
||||
if(contain($fil1,'_onlyjs')){
|
||||
$isph = 0;
|
||||
$isjs = 1;
|
||||
}
|
||||
if(contain($fil1,'_onlyphp')){
|
||||
$isph = 0;
|
||||
}
|
||||
if($isph==1){
|
||||
if($sss)$sss.=',';
|
||||
$sss.=''.$str.'';
|
||||
}
|
||||
if($isjs==1){
|
||||
if($ssb)$ssb.=',';
|
||||
$ssb.=''.$str.'';
|
||||
}
|
||||
if($isph==0 && $isjs==0){
|
||||
$fname = str_replace('_onlyphp.txt','.php',str_replace('include/langlocal/langtxt/','',$fil1));
|
||||
$spath = 'include/langlocal/langphp/'.$fname.'';
|
||||
$this->rock->createtxt($spath, '<?php'.chr(10).'return array('.$str.');');
|
||||
}
|
||||
}
|
||||
}
|
||||
$str = '<?php'.chr(10).'return array('.$sss.');';
|
||||
$this->rock->createtxt($path, $str);
|
||||
|
||||
|
||||
$str = '<?php'.chr(10).'return array('.$ssb.');';
|
||||
$this->rock->createtxt($pats, $str);
|
||||
|
||||
$nrs = require($pats);
|
||||
$nrs = 'var rocklang = \'\',rocklangxu=0,langdata = '.json_encode($nrs).';';
|
||||
$ss1 = '';
|
||||
foreach($this->langArray as $k=>$v){
|
||||
$ss1.='if(rocklang==\''.$v.'\')rocklangxu='.$k.';';
|
||||
}
|
||||
$nrs.="
|
||||
function lang(ky){
|
||||
if(!rocklang){rocklang = $('html').attr('lang');if(!rocklang)rocklang='".$this->locallang."';".$ss1."}
|
||||
var d = langdata[ky];
|
||||
if(!d)return ky;
|
||||
var str = d[rocklangxu];
|
||||
if(!str)str = ky;
|
||||
return str;
|
||||
}";
|
||||
$this->rock->createtxt('js/lang.js', $nrs);
|
||||
unlink($pats);
|
||||
return returnsuccess();
|
||||
}
|
||||
|
||||
public function getcontarr($file,$lx=0)
|
||||
{
|
||||
if(!file_exists($file))return '';
|
||||
$cont = file_get_contents($file);
|
||||
$arra = explode("\n", $cont);
|
||||
$str = '';
|
||||
$ssb = '';
|
||||
foreach($arra as $k=>$strb){
|
||||
if(!$strb)continue;
|
||||
$strb = str_replace(array('^M',"\n","\r"),'', $strb);
|
||||
$arrx = explode('|', $strb);
|
||||
if($k>0){
|
||||
$str.=',';
|
||||
$ssb.=',';
|
||||
}
|
||||
$keys= $arrx[0];
|
||||
$v001= '';
|
||||
if(contain($keys,'::')){
|
||||
$arr1 = explode('::', $keys);
|
||||
$keys = $arr1[0];
|
||||
$v001 = $arr1[1];
|
||||
}
|
||||
$str.='\''.$keys.'\'=>array(\''.$v001.'\'';
|
||||
$ssb.='"'.$keys.'":["'.$v001.'"';
|
||||
$len = count($arrx);
|
||||
foreach($arrx as $k1=>$v1)if($k1>0){
|
||||
$str.=',\''.$v1.'\'';
|
||||
$ssb.=',"'.$v1.'"';
|
||||
}
|
||||
$str.=')';
|
||||
$ssb.=']';
|
||||
}
|
||||
if($lx==0)return $str;
|
||||
if($lx==1)return $ssb;
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* 语言包(英文),需要自行翻译
|
||||
*/
|
||||
class lang_en_USChajian extends Chajian{
|
||||
|
||||
|
||||
public function getLang()
|
||||
{
|
||||
$da = array(
|
||||
|
||||
);
|
||||
return $da;
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* 语言包
|
||||
*/
|
||||
class lang_zh_CNChajian extends Chajian{
|
||||
|
||||
|
||||
public function getLang()
|
||||
{
|
||||
$da = array(
|
||||
|
||||
);
|
||||
return $da;
|
||||
}
|
||||
}
|
||||
@@ -682,4 +682,21 @@ final class rockClass
|
||||
if(substr($path,0,4)!='http')$path = ''.$url.''.$path.'';
|
||||
return $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据value获取name
|
||||
*/
|
||||
public function valtoname($arr, $val, $fid1='',$fid2='')
|
||||
{
|
||||
if($fid1=='')$fid1='value';
|
||||
if($fid2=='')$fid2='name';
|
||||
$nval = $val;
|
||||
foreach($arr as $k=>$rs){
|
||||
if($rs[$fid1]==$val){
|
||||
$nval = $rs[$fid2];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $nval;
|
||||
}
|
||||
}
|
||||
2
include/langlocal/langphp/lang.php
Normal file
2
include/langlocal/langphp/lang.php
Normal file
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
return array('新增'=>array('','','add'),'更多'=>array('','','more'),'我的申请'=>array('','我的申請','My Apply'),'刷新'=>array('','','Refresh'),'刷新统计中'=>array('','刷新統計中','RefreshTotaling'),'编辑'=>array('','編輯','edit'),'删除'=>array('','刪除','delete'),'菜单'=>array('','菜單','menu'),'评论'=>array('','評論','pinglun'),'编号'=>array('','編号','num'),'状态'=>array('','狀態','state'),'申请人'=>array('','申請人','Apply'),'申请人部门'=>array('','申請人部門','color'),'单号'=>array('','單号','level'),'搜索'=>array('','','Search'),'关键字'=>array('','關鍵字','keyword'),'提交人'=>array('','','Turn'),'包含'=>array('','','contain'),'等于'=>array('','等瘀','equal to'),'小于'=>array('','小瘀','less than'),'大于'=>array('','大瘀','greater than'),'请选择'=>array('','請選擇','Please select'),'不包含'=>array('','','not contain'),'已审核'=>array('','乙審核',''),'待处理'=>array('','待處理',''),'不同意'=>array('','不同逸',''),'已作废'=>array('','乙作廢',''),'退回'=>array('','','back'),'流程'=>array('','','Flow'),'授权查看'=>array('','授權查看',''),'经我处理'=>array('','經我處理',''));
|
||||
2
include/langlocal/langphp/langbase.php
Normal file
2
include/langlocal/langphp/langbase.php
Normal file
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
return array('notcolumns'=>array('列表页没设置好,数据无法显示,没有可切换选择卡,去看帮助设置','列表頁沒設置好,數據無法顯示,沒友可切换選擇卡,去看幫助設置',''));
|
||||
2
include/langlocal/langphp/langmenu.php
Normal file
2
include/langlocal/langphp/langmenu.php
Normal file
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
return array('个人办公'=>array('','個人辦公',''),'任务资源'=>array('','任務資塬',''),'学校'=>array('','學校',''));
|
||||
31
include/langlocal/langtxt/lang.txt
Normal file
31
include/langlocal/langtxt/lang.txt
Normal file
@@ -0,0 +1,31 @@
|
||||
新增||add
|
||||
更多||more
|
||||
我的申请|我的申請|My Apply
|
||||
刷新||Refresh
|
||||
刷新统计中|刷新統計中|RefreshTotaling
|
||||
编辑|編輯|edit
|
||||
删除|刪除|delete
|
||||
菜单|菜單|menu
|
||||
评论|評論|pinglun
|
||||
编号|編号|num
|
||||
状态|狀態|state
|
||||
申请人|申請人|Apply
|
||||
申请人部门|申請人部門|color
|
||||
单号|單号|level
|
||||
搜索||Search
|
||||
关键字|關鍵字|keyword
|
||||
提交人||Turn
|
||||
包含||contain
|
||||
等于|等瘀|equal to
|
||||
小于|小瘀|less than
|
||||
大于|大瘀|greater than
|
||||
请选择|請選擇|Please select
|
||||
不包含||not contain
|
||||
已审核|乙審核|
|
||||
待处理|待處理|
|
||||
不同意|不同逸|
|
||||
已作废|乙作廢|
|
||||
退回||back
|
||||
流程||Flow
|
||||
授权查看|授權查看|
|
||||
经我处理|經我處理|
|
||||
2
include/langlocal/langtxt/lang_onlyjs.txt
Normal file
2
include/langlocal/langtxt/lang_onlyjs.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
编辑|編輯|edit
|
||||
删除|刪除|delete
|
||||
1
include/langlocal/langtxt/langbase_onlyphp.txt
Normal file
1
include/langlocal/langtxt/langbase_onlyphp.txt
Normal file
@@ -0,0 +1 @@
|
||||
notcolumns::列表页没设置好,数据无法显示,没有可切换选择卡,去看帮助设置|列表頁沒設置好,數據無法顯示,沒友可切换選擇卡,去看幫助設置|
|
||||
3
include/langlocal/langtxt/langmenu_onlyphp.txt
Normal file
3
include/langlocal/langtxt/langmenu_onlyphp.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
个人办公|個人辦公|
|
||||
任务资源|任務資塬|
|
||||
学校|學校|
|
||||
@@ -273,19 +273,23 @@ function getparams($key, $dev='')
|
||||
/**
|
||||
* 多语言返回
|
||||
*/
|
||||
function lang($key)
|
||||
function lang($str,$lx='')
|
||||
{
|
||||
$data = arrvalue($GLOBALS,'langdata');
|
||||
$val = '';
|
||||
if(!$data)return $val;
|
||||
if(strpos($key,'.')>0){
|
||||
$skad = explode('.', $key);
|
||||
$key1 = $skad[0];
|
||||
$key2 = $skad[1];
|
||||
$sdat = arrvalue($data[LANG], $key1);
|
||||
if($sdat)$val = arrvalue($sdat, $key2);
|
||||
if(!$str)return $str;
|
||||
$da = arrvalue($GLOBALS,'langdata');
|
||||
if(!$da)return $str;
|
||||
$xuhao = $da['xuhao'];
|
||||
$key = 'data'.$lx.'';
|
||||
if(!isset($da[$key])){
|
||||
$path = ''.ROOT_PATH.'/include/langlocal/langphp/lang'.$lx.'.php';
|
||||
$data = array();
|
||||
if(file_exists($path))$data = require($path);
|
||||
$GLOBALS['langdata'][$key] = $data;
|
||||
}else{
|
||||
$val = arrvalue($data[LANG], $key);
|
||||
$data = $da[$key];
|
||||
}
|
||||
return $val;
|
||||
if(!isset($data[$str]))return $str;
|
||||
$nstr = arrvalue($data[$str], $xuhao);
|
||||
if(!$nstr)$nstr = $str;
|
||||
return $nstr;
|
||||
}
|
||||
Reference in New Issue
Block a user