Merge branch 'master' of https://git.dirt.kz/igor/Metadata_PHP
This commit is contained in:
@ -1,12 +1,6 @@
|
|||||||
//Copyright (C) 2008 Ivanov I.M. irigm@mail.ru +77051809750
|
//Copyright (C) 2008 Ivanov I.M. irigm@mail.ru +77051809750
|
||||||
//For find non english chars: [^\x00-\x7F]+
|
//For find non english chars: [^\x00-\x7F]+
|
||||||
|
|
||||||
//Порядок работы:
|
|
||||||
//Запрашиваю GUI XML если он не передан через параметры функции.
|
|
||||||
//Как GUI XML пришел запрашиваю данные полей с сервера (если это нужно) и с разу же пытаюсь построить GUI по XML.
|
|
||||||
//Как данные полей придут запрашиваю данные для выпадающих списков (как как они могут зависеть от данных).
|
|
||||||
|
|
||||||
|
|
||||||
//Заглушки
|
//Заглушки
|
||||||
function setPropVal(uid,id,c,p){
|
function setPropVal(uid,id,c,p){
|
||||||
ERec_mas[uid].setPropVal(id,c,p);
|
ERec_mas[uid].setPropVal(id,c,p);
|
||||||
|
|||||||
@ -1,7 +1,25 @@
|
|||||||
|
|
||||||
function tcTab(caption)
|
class tcTab
|
||||||
{
|
{
|
||||||
this.setConText=function(txt)
|
constructor(caption){
|
||||||
|
this.id=0;
|
||||||
|
this.par=null;
|
||||||
|
this.sel=false;
|
||||||
|
this.con=null; //Элемент с содержимым
|
||||||
|
this.href='';
|
||||||
|
|
||||||
|
//Сам таб на который нажимаем (ушко)
|
||||||
|
this.div=document.createElement('div')
|
||||||
|
this.div.style.cssText='position: relative; top: 1px; cursor: pointer; float: left; border: 1px solid #b3b3b3; border-radius: 5px 5px 0px 0px; padding: 1px; padding-right: 4px; padding-left: 4px; margin-left: 2px; margin-right: 2px;'
|
||||||
|
this.div.style.background = '#dfdfdf';
|
||||||
|
this.div.innerHTML=caption;
|
||||||
|
|
||||||
|
this.div.onmouseover=function(obj){return function(){ if(!obj.sel) obj.div.style.background = '#f0f0f0';}}(this);
|
||||||
|
this.div.onmouseout=function(obj){return function(){ if(!obj.sel) obj.div.style.background = '#dfdfdf' }}(this);
|
||||||
|
this.div.onclick=function(obj){return function(){ obj.setSel(); if(obj.href!='') goToURL(obj.href); }}(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
setConText(txt)
|
||||||
{ if(this.con!=null) this.con.parent.removeChild(this.con)
|
{ if(this.con!=null) this.con.parent.removeChild(this.con)
|
||||||
this.con=document.createElement('div')
|
this.con=document.createElement('div')
|
||||||
this.con.style.cssText='width: 100%; height: 100%;'
|
this.con.style.cssText='width: 100%; height: 100%;'
|
||||||
@ -11,23 +29,21 @@ function tcTab(caption)
|
|||||||
return this.con
|
return this.con
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setConObj=function(val)
|
setConObj(val)
|
||||||
{
|
{
|
||||||
if(this.con!=null) this.con.parent.removeChild(this.con)
|
if(this.con!=null) this.con.parent.removeChild(this.con)
|
||||||
if (typeof val === 'string' || val instanceof String)
|
if (typeof val === 'string' || val instanceof String)
|
||||||
val=document.getElementById(val);
|
val=document.getElementById(val);
|
||||||
if(val===null || typeof(val)=='undefined') return;
|
if(val===null || typeof(val)=='undefined') return;
|
||||||
|
|
||||||
this.con=val;
|
this.con=val;
|
||||||
if(!this.sel) this.con.style.display='none';
|
if(!this.sel) this.con.style.display='none';
|
||||||
this.par.ctt.appendChild(this.con);
|
this.par.ctt.appendChild(this.con);
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setSel=function()
|
setSel()
|
||||||
{
|
{
|
||||||
for(var i=0;i<this.par.tbs.length;i++)
|
for(let i=0;i<this.par.tbs.length;i++)
|
||||||
{ this.par.tbs[i].div.style.background = '#dfdfdf'
|
{ this.par.tbs[i].div.style.background = '#dfdfdf'
|
||||||
this.par.tbs[i].div.style.borderBottom = "1px solid #b3b3b3"
|
this.par.tbs[i].div.style.borderBottom = "1px solid #b3b3b3"
|
||||||
this.par.tbs[i].sel=false
|
this.par.tbs[i].sel=false
|
||||||
@ -39,46 +55,59 @@ function tcTab(caption)
|
|||||||
this.con.style.display='block';
|
this.con.style.display='block';
|
||||||
this.sel=true
|
this.sel=true
|
||||||
}
|
}
|
||||||
|
|
||||||
this.id=0;
|
|
||||||
this.par=null;
|
|
||||||
this.sel=false;
|
|
||||||
this.con=null; //Элемент с содержимым
|
|
||||||
this.href='';
|
|
||||||
|
|
||||||
//Сам таб на который нажимаем (ушко)
|
|
||||||
this.div=document.createElement('div')
|
|
||||||
this.div.style.cssText='position: relative; top: 1px; cursor: pointer; float: left; border: 1px solid #b3b3b3; border-radius: 5px 5px 0px 0px; padding: 1px; padding-right: 4px; padding-left: 4px; margin-left: 2px; margin-right: 2px;'
|
|
||||||
this.div.style.background = '#dfdfdf';
|
|
||||||
this.div.innerHTML=caption
|
|
||||||
|
|
||||||
this.div.onmouseover=function(obj){return function(){ if(!obj.sel) obj.div.style.background = '#f0f0f0';}}(this);
|
|
||||||
this.div.onmouseout=function(obj){return function(){ if(!obj.sel) obj.div.style.background = '#dfdfdf' }}(this);
|
|
||||||
this.div.onclick=function(obj){return function(){ obj.setSel(); if(obj.href!='') goToURL(obj.href); }}(this)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Создать закладки
|
/** Создать закладки
|
||||||
* id - контейнер либо идентификатор контейнера в который вставляем табы
|
* id - контейнер либо идентификатор контейнера в который вставляем табы
|
||||||
*/
|
*/
|
||||||
function tcTabs(id)
|
class tcTabs
|
||||||
{
|
{
|
||||||
this.addTab=function(caption)
|
constructor(id){
|
||||||
|
this.tbs=new Array();
|
||||||
|
if(typeof id == 'string') this.bd=document.getElementById(id); else this.bd=id;
|
||||||
|
|
||||||
|
this.wra=document.createElement('div');
|
||||||
|
this.wra.style.cssText="display: table; width :100%; height: 100%; padding: 0px; margin: 0px; border-collapse: collapse; border: 0px solid #000000;";
|
||||||
|
|
||||||
|
var tr=null;
|
||||||
|
tr=document.createElement('div');
|
||||||
|
tr.style.cssText='display: table-row; height: 1%; padding: 0px; margin: 0px; border: 0px solid #0000ff;'
|
||||||
|
|
||||||
|
this.btt=document.createElement('div');
|
||||||
|
this.btt.style.cssText='display: table-cell; width :100%; height: 1%; padding: 0px; margin: 0px; border: 0px solid #0000ff;'
|
||||||
|
tr.appendChild(this.btt);
|
||||||
|
this.wra.appendChild(tr);
|
||||||
|
|
||||||
|
tr=document.createElement('div');
|
||||||
|
tr.style.cssText='display: table-row; width :100%; height: 100%; padding: 0px; margin: 0px; border: 0px solid #0000ff;'
|
||||||
|
|
||||||
|
//Content
|
||||||
|
this.ctt=document.createElement('div');
|
||||||
|
this.ctt.style.cssText='display:table-cell; width :100%; height: 100%; padding: 0px; margin: 0px; border; border: 1px solid #b3b3b3; overflow:hidden;'
|
||||||
|
|
||||||
|
tr.appendChild(this.ctt);
|
||||||
|
this.wra.appendChild(tr);
|
||||||
|
|
||||||
|
this.bd.appendChild(this.wra);
|
||||||
|
}
|
||||||
|
|
||||||
|
addTab(caption)
|
||||||
{
|
{
|
||||||
var tab=new tcTab(caption)
|
var tab=new tcTab(caption)
|
||||||
tab.par=this
|
tab.par=this
|
||||||
this.btt.appendChild(tab.div);
|
this.btt.appendChild(tab.div);
|
||||||
|
|
||||||
this.tbs[this.tbs.length]=tab;
|
this.tbs[this.tbs.length]=tab;
|
||||||
return tab;
|
return tab;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.delTab=function(tab)
|
delTab(tab)
|
||||||
{
|
{
|
||||||
if (typeof tab === 'string' || tab instanceof String)
|
if (typeof tab === 'string' || tab instanceof String)
|
||||||
{
|
{
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
for(var i=0;i<this.tbs.length;i++)
|
for(let i=0;i<this.tbs.length;i++)
|
||||||
{
|
{
|
||||||
if(this.tbs[i]==tab)
|
if(this.tbs[i]==tab)
|
||||||
{
|
{
|
||||||
@ -87,31 +116,4 @@ function tcTabs(id)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
this.tbs=new Array();
|
|
||||||
if(typeof id == 'string') this.bd=document.getElementById(id); else this.bd=id;
|
|
||||||
|
|
||||||
this.wra=document.createElement('div');
|
|
||||||
this.wra.style.cssText="display: table; width :100%; height: 100%; padding: 0px; margin: 0px; border-collapse: collapse; border: 0px solid #000000;";
|
|
||||||
|
|
||||||
var tr=null;
|
|
||||||
tr=document.createElement('div');
|
|
||||||
tr.style.cssText='display: table-row; height: 1%; padding: 0px; margin: 0px; border: 0px solid #0000ff;'
|
|
||||||
|
|
||||||
this.btt=document.createElement('div');
|
|
||||||
this.btt.style.cssText='display: table-cell; width :100%; height: 1%; padding: 0px; margin: 0px; border: 0px solid #0000ff;'
|
|
||||||
tr.appendChild(this.btt);
|
|
||||||
this.wra.appendChild(tr);
|
|
||||||
|
|
||||||
tr=document.createElement('div');
|
|
||||||
tr.style.cssText='display: table-row; width :100%; height: 100%; padding: 0px; margin: 0px; border: 0px solid #0000ff;'
|
|
||||||
|
|
||||||
//Content
|
|
||||||
this.ctt=document.createElement('div');
|
|
||||||
this.ctt.style.cssText='display:table-cell; width :100%; height: 100%; padding: 0px; margin: 0px; border; border: 1px solid #b3b3b3; overflow:hidden;'
|
|
||||||
|
|
||||||
tr.appendChild(this.ctt);
|
|
||||||
this.wra.appendChild(tr);
|
|
||||||
|
|
||||||
this.bd.appendChild(this.wra);
|
|
||||||
}
|
|
||||||
|
|||||||
@ -57,7 +57,6 @@ function MMove(e)
|
|||||||
if(!e) e = window.event;
|
if(!e) e = window.event;
|
||||||
pageX=e.pageX || e.x;
|
pageX=e.pageX || e.x;
|
||||||
pageY=e.pageY || e.y;
|
pageY=e.pageY || e.y;
|
||||||
|
|
||||||
var obj=document.getElementById("pBarIco");
|
var obj=document.getElementById("pBarIco");
|
||||||
if(obj!=null)
|
if(obj!=null)
|
||||||
{
|
{
|
||||||
@ -786,6 +785,7 @@ function getCdataValue(node,n)
|
|||||||
if(r==null) return '';
|
if(r==null) return '';
|
||||||
return r.nodeValue;
|
return r.nodeValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Задать данные CDATA с созданием секции если её нет
|
//Задать данные CDATA с созданием секции если её нет
|
||||||
function setCdataValue(node,n,value)
|
function setCdataValue(node,n,value)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -11,6 +11,24 @@ function delPHPExt($fName)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getURLText($url,$data)
|
||||||
|
{
|
||||||
|
$ch = curl_init();
|
||||||
|
curl_setopt($ch, CURLOPT_URL, trim($url));
|
||||||
|
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
||||||
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
|
||||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
|
||||||
|
curl_setopt($ch, CURLOPT_HEADER,0); //Change this to a 1 to return headers
|
||||||
|
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; ru-RU; rv:1.7.12) Gecko/20050919 Firefox/1.0.7');
|
||||||
|
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||||
|
$data = trim(curl_exec($ch));
|
||||||
|
curl_close($ch);
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
// array imageResize (string $src, string $dest, integer $width, integer $height);
|
// array imageResize (string $src, string $dest, integer $width, integer $height);
|
||||||
// $src - имя исходного файла
|
// $src - имя исходного файла
|
||||||
// $dest - имя генерируемого файла
|
// $dest - имя генерируемого файла
|
||||||
@ -230,6 +248,23 @@ function afterFirst(&$str,$ch)
|
|||||||
return substr($str, strpos($str, $ch)+strlen($ch));
|
return substr($str, strpos($str, $ch)+strlen($ch));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Вернёт подстроку если символа нет то всю строку
|
||||||
|
// @param string $str
|
||||||
|
// @param string $chr
|
||||||
|
function cutStr(&$str,$chr)
|
||||||
|
{
|
||||||
|
$pos = strpos($str, $chr);
|
||||||
|
if($pos===false)
|
||||||
|
{
|
||||||
|
return $str;
|
||||||
|
}else
|
||||||
|
{
|
||||||
|
$buf = substr($str, 0, $pos);
|
||||||
|
$str = substr($str, $pos + strlen($chr));
|
||||||
|
return $buf;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Вырезаеи всё после заданого разделителя удаляя разделитель если разделителя нет возвращает всю строку
|
//Вырезаеи всё после заданого разделителя удаляя разделитель если разделителя нет возвращает всю строку
|
||||||
//$fstr - Разделитель
|
//$fstr - Разделитель
|
||||||
//$num - На каком разделителе остановиться
|
//$num - На каком разделителе остановиться
|
||||||
|
|||||||
Reference in New Issue
Block a user