This commit is contained in:
2020-07-08 23:19:53 +06:00
parent dfd5a1ba05
commit 0781e51bc2
10 changed files with 276 additions and 108 deletions

View File

@ -79,7 +79,7 @@ import tools.EmailUtility;
import tools.User;
@Controller
@SessionAttributes( { "user" }) //Сесионный объект
@SessionAttributes( { "user" }) //Сесионный объект!
public class DBMSRecords implements ServletContextAware {
//private static final Logger logger = LoggerFactory.getLogger(Translation.class);

View File

@ -40,7 +40,7 @@ import tools.User;
import tools.XMLTools;
@Controller
@SessionAttributes( { "user" }) //Сесионный объект
@SessionAttributes( { "user" }) //Сесионный объект!
public class DBMSTree implements ServletContextAware {
private static final Logger logger = LoggerFactory.getLogger(kz.goodssales.GoodsSales.dbms.DBMSTree.class);

View File

@ -146,9 +146,31 @@ function TCGallery(parent)
}
//Галерея изображений на странице товара (Двигается в право в лево)
function TCGallery2(parent)
class TCGallery2
{
this.addImage = function(small)
constructor(parent) {
this.parent=parent; //Элемент который будем двигать в право в лево
this.mas = new Array(); //Массим элементов с рисуночками
this.pos=0;
this.ower=true;
this.iWidth=200; //Размер картинки по умолчанию
// повторить с интервалом 2 секунды
setInterval(() => this.resize(), 1000);
}
//Подстраиваюсь под размер родительского компонента
resize()
{
let pDiv = this.parent.parentElement;
this.parent.style.width = pDiv.offsetWidth+'px';
}
//Добавляю кнопочки для переключения картинок
addImage(small)
{
this.mas.push({div: small, sell: false});
@ -157,8 +179,8 @@ function TCGallery2(parent)
{
if(!thiz.ower) return;
pos=-1;
for(i=0;i<thiz.mas.length;i++) if(small===thiz.mas[i].div) { pos=i;} //Позиция элемента в массиве
let pos=-1;
for(let i=0;i<thiz.mas.length;i++) if(small===thiz.mas[i].div) { pos=i;} //Позиция элемента в массиве
if(pos===-1) return;
if(thiz.ower && pos!== thiz.pos )
@ -171,8 +193,9 @@ function TCGallery2(parent)
small.onclick = function(thiz,small)
{ return function()
{
pos=-1;
for(i=0;i<thiz.mas.length;i++) if(small===thiz.mas[i].div) { pos=i; } else { thiz.mas[i].div.style.borderColor="#dfdfdf"; thiz.mas[i].sell=false; } //Позиция элемента в массиве
let pos=-1;
for(let i=0;i<thiz.mas.length;i++) if(small===thiz.mas[i].div) { pos=i; } else { thiz.mas[i].div.style.borderColor="#dfdfdf"; thiz.mas[i].sell=false; } //Позиция элемента в массиве
if(pos===-1) return;
if(!thiz.mas[pos].sell) //Если щёлкнули на выделеное 1й раз
@ -195,7 +218,7 @@ function TCGallery2(parent)
};
//Плавная прокрутка по горизонтали
this.moveTo = function()
moveTo()
{
if(this.parent==null) return;
var dx=(this.pos - this.parent.scrollLeft)/20.0; //Шагов для достижения нужного положения
@ -205,8 +228,4 @@ function TCGallery2(parent)
setTimeout(function(thiz){ return function(){ thiz.moveTo(); } }(this),10);
}
this.mas = new Array(); //Массим элементов с рисуночками
this.parent=parent;
this.pos=0;
this.ower=true;
}

View File

@ -358,6 +358,16 @@ class EdtRec
}
td2.appendChild( table );
}else
if(vt=="password")
{
input = document.createElement('input');
input.style.cssText="width: 100%;";
input.setAttribute("type","password");
input.setAttribute("name",nodeProp.getAttribute("n"));
input.setAttribute("value",value);
input.setAttribute("id","prop_"+this.uid+"_"+nodeProp.getAttribute("n"));
td2.appendChild( input );
}else
if(vt=="b")
{
@ -995,7 +1005,7 @@ class EdtRec
}else
{
//We request the field title by the field id (if it is filled).
if ((value!="")&&(value!=-1))
/*if ((value!="")&&(value!=-1))
{
var xml='<?xml version="1.0" encoding="utf-8"?><metadata fn="6"><type n="'+nodeProp.getAttribute("ot")+'" c="'+nodeProp.getAttribute("FieldCaption")+'" pn="'+nodeProp.getAttribute("n")+'" fn="'+nodeProp.getAttribute("fn")+'" id="'+value+'">';
xml+='<objects-list><filter><column n="'+findFirstNode(this.nodeMetadata, 'type').getAttribute('ObjectID')+'"><![CDATA['+value+']]></column></filter></objects-list>';
@ -1004,7 +1014,7 @@ class EdtRec
{
this.showProgressBar();
}
}
}*/
}
}
}

View File

@ -1,22 +1,15 @@
function TUser()
{
//Функция запрашивает информацию о текущем пользователе с сервера
this.LoadData = function()
{
var r = new TRequest(this);
var xs='<?xml version="1.0" encoding="utf-8"?><metadata fn="7"><cmd><![CDATA[0]]></cmd></metadata>';
if(r.callServer(ScriptName,xs))
{
this.showShadow(true);
}
};
this.applyReq=function(req,fn,node)
{
//alert(getXMLNodeSerialisation(node));
this.showShadow(false);
if (fn==-1)
{
alert(findFirstNode(node,'#cdata-section').nodeValue);
}else
if(fn==7)
{
var nCmd=findFirstNode(node, "cmd");
@ -43,16 +36,29 @@ function TUser()
//configGUIbyAccessLevel();
//var shadow=document.getElementById("shadow");
//if(shadow.parentNode!=null) shadow.parentNode.removeChild(shadow);
//Информируем слушатеелй о логине
for(i=0;i<this.m_ls.length;i++){
if(this.m_ls[i]!==null){
this.m_ls[i].OnLogin(true); //0 - authorized, 1 - an incorrect username or password, 2 - left.
}
}
}
}else if(findFirstNode(nCmd,'#cdata-section').nodeValue=="3") //Login
{
//if(findNode(node,'#cdata-section').nodeValue=="0") //if not logged
//{
// alert(_('Invalid_username_and_or_password'));
//}else
//{
// location.reload();
//}
if(findNode(node,'#cdata-section').nodeValue=="0") //if not logged
{
alert(_('Invalid_username_and_or_password'));
}else
{
//location.reload();
//Информируем слушатеелй о логине
for(i=0;i<this.m_ls.length;i++){
if(this.m_ls[i]!==null){
this.m_ls[i].OnLogin(true); //0 - authorized, 1 - an incorrect username or password, 2 - left.
}
}
}
}else if(findFirstNode(nCmd,'#cdata-section').nodeValue=="4") //Register
{
//if(findNode(node,'#cdata-section').nodeValue=="1") //if register
@ -164,6 +170,17 @@ function TUser()
deleteHTML(this.divsh);
}
};
//Функция запрашивает информацию о текущем пользователе с сервера
this.LoadData = function()
{
var r = new TRequest(this);
var xs='<?xml version="1.0" encoding="utf-8"?><metadata fn="7"><cmd><![CDATA[2]]></cmd></metadata>';
if(r.callServer(ScriptName,xs))
{
this.showShadow(true);
}
};
//Check whether the already authorized (+ attempt to log in through "hash").
this.isLogined=function()
{
@ -179,6 +196,18 @@ function TUser()
}
};
this.addListener=function(l)
{ if(l.OnLogin==null) alert('Object does not have the function "OnLogin()"!');
this.m_ls[this.m_ls.length]=l;
};
this.remListener=function(l)
{ for(i=0;i<this.m_ls.length;i++)
{ if(this.m_ls[i]==l)
this.m_ls[i]=null;
}
};
this.divsh=null;
this.id=null;
this.name='';
@ -186,6 +215,7 @@ function TUser()
this.patronymic='';
this.temp=false;
this.role='';
this.m_ls=new Array(); //Listeners called OnLogin function.
//Запрашиваю данные о текущем пользователе с сервера
//this.LoadData();
@ -196,7 +226,7 @@ function TUser()
* Login form (not cross-source).
* [^\x00-\x7F]+
*/
function TLogin()
/*function TLogin()
{
this.showLoginForm = function()
{
@ -311,11 +341,11 @@ function TLogin()
this.m_ls[i].OnLogin(true); //0 - authorized, 1 - an incorrect username or password, 2 - left.
}
}
/*
this.m_lo=getCdataValue(findFirstNode(node,"login")) == '0' ? true : false;
if(this.m_lo && this.win.div!==null) this.win.hide(true);
this.m_UserName=getCdataValue(findFirstNode(node,"name"));
*/
//this.m_lo=getCdataValue(findFirstNode(node,"login")) == '0' ? true : false;
//if(this.m_lo && this.win.div!==null) this.win.hide(true);
//this.m_UserName=getCdataValue(findFirstNode(node,"name"));
}else
alert("Not known function! fn=\""+fn+"\"" );
@ -347,16 +377,6 @@ function TLogin()
}
};
//Check whether the already authorized (+ attempt to log in through "hash").
this.Logined=function()
{
var xs='<?xml version="1.0" encoding="utf-8"?><metadata fn="7"><cmd><![CDATA[0]]></cmd></metadata>';
//alert('xs='+xs);
this.request.callServer(ScriptName,xs);
};
//logout current user
this.Exit=function()
{
@ -379,6 +399,16 @@ function TLogin()
}
};
//Check whether the already authorized (+ attempt to log in through "hash").
this.LoadData=function()
{
var xs='<?xml version="1.0" encoding="utf-8"?><metadata fn="7"><cmd><![CDATA[2]]></cmd></metadata>';
//alert('xs='+xs);
this.request.callServer(ScriptName,xs);
};
TLogin.LoginIsOk=0; //login in
TLogin.LoginIsError=1; //Invalid password and / or login.
TLogin.LoginIsExit=2; //Exit
@ -396,7 +426,7 @@ function TLogin()
this.m_html=false;
this.request = new TRequest(this);
}
}*/
//Display password recovery form
function showRestoreForm()

View File

@ -48,34 +48,36 @@
{
global $db_connstr;
if($t=='object')
{ if (($v=='-1')||($v=='')) $v='NULL';
if($t=='object' && gettype($v)=='string'){
$t='string'; //Если id шники uuid
}
if($t=='object'){
if (($v=='-1')||($v=='')) $v='NULL';
}else
if($t=='i1' || $t=='i2' || $t=='i4' || $t=='integer')
{ if($v=='') $v='NULL';
if($t=='i1' || $t=='i2' || $t=='i4' || $t=='integer'){
if($v=='') $v='NULL';
}else
if($t=='f8' || $t=='f4' || $t=='real' || $t=='double')
{ if($v=='')$v='NULL';
if($t=='f8' || $t=='f4' || $t=='real' || $t=='double'){
if($v=='')$v='NULL';
$v=str_replace(',','.',$v); //Разделитель целой и дробной части точка
}else
if($t=='b')
{ if($v=='') $v='NULL'; else
if($t=='b'){
if($v=='') $v='NULL'; else
if($v=='1') $v='true'; else
if($v=='0') $v='false';
}else
if($t=='string' || $t=='text' || $t=='dateTime' || $t=='time' || $t=='date' || $t=='file')
{ if($v=='')
{ $v='NULL';
}else
{
if($t=='string' || $t=='text' || $t=='dateTime' || $t=='time' || $t=='date' || $t=='file'){
if($v==''){
$v='NULL';
}else{
if(strpos($db_connstr, 'pgsql')!==false)
$v=str_replace("'","''",$v); //так как в SQL строку вставляется
else
$v=str_replace('\'','\\\'',$v); //так как в SQL строку вставляется
$v='\''.$v.'\'';
}
}else
{
}else{
$v='\''.$v.'\'';
}
return $v;
@ -83,24 +85,27 @@
function getValue($t,$v)
{
if($t=='object' && gettype($v)=='string') $t='string'; //Если id шники uuid
if($t=='object')
{ if (($v=='-1')||($v=='')) $v=null;
if($t=='object' && gettype($v)=='string'){
$t='string'; //Если id шники uuid
}
if($t=='object'){
if (($v=='-1')||($v=='')) $v=null;
}else
if($t=='i4' || $t=='integer')
{ if($v=='') $v=null;
if($t=='i4' || $t=='integer'){
if($v=='') $v=null;
}else
if($t=='f8')
{ if($v=='')$v=null;
if($t=='f8'){
if($v=='')$v=null;
$v=str_replace(',','.',$v); //Разделитель целой и дробной части точка
}else
if($t=='b')
{ if($v=='') $v=null; else
if($t=='b'){
if($v=='') $v=null; else
if($v=='1') $v=true; else
if($v=='0') $v=false;
}else
if($t=='string' || $t=='dateTime' || $t=='date')
{ if($v=='') $v=null;
if($t=='string' || $t=='dateTime' || $t=='date'){
if($v=='') $v=null;
}
return $v;
}
@ -150,14 +155,14 @@
//Функция для перевода текста без применения GetText
function __($text)
{
global $db,$lng;
global $db,$lng,$Schema;
$language_id=1;
if($lng=='kz') $language_id=2;
if($lng=='en') $language_id=3;
$result='';
$sql='select translation from main._translations where del=false and language_id='.$language_id.' and identifier=\''.$text.'\';';
$sql='select translation from '.$Schema.'_translations where del=false and language_id='.$language_id.' and identifier=\''.$text.'\';';
$res = NULL;
try
{
@ -213,6 +218,16 @@
}
set_exception_handler('special_handler'); //чтоб не пойманные исключения посылались в виде XML
//Схема базы по умолчанияю
if(!isset($Schema)) {
$Schema="";
}
//Тип идентификаторов
$idType="object";
if(!isset($idType)) {
$idType="object";
}
try
{
if(strpos($db_connstr, 'sqlite')!==false)
@ -228,16 +243,16 @@
}
//Пытаемся автоматически залогинется по GUID из COOKIE
if($_SESSION['USER_ID']==null && $_COOKIE['GUID']!=null)
/*if($_SESSION['USER_ID']==null && $_COOKIE['GUID']!=null)
{
$res = $db->query("select * from main.p__Login(null,null,null,'".$_COOKIE['GUID']."');");
$res = $db->query("select * from ".$Schema."p__Login(null,null,null,'".$_COOKIE['GUID']."');");
//$res = $db->query("select * from \"p__Login_1\"(null,null,null,'".$_COOKIE['GUID']."');");
if($res->rowCount()>0)
{
$result = $res->fetch(PDO::FETCH_ASSOC);
$_SESSION['USER_ID']=$result['id'];
}
}
}*/
$fn=filter_input(INPUT_GET, 'fn', FILTER_VALIDATE_INT, array('options'=>array('default'=>-1)));
$reqid=0; //id запроса "уникальный".
@ -283,7 +298,7 @@
$name=findFirstNode($reqNode, "type")->getAttribute("n");
$xmls='';
$sql='select xml from main._metadata where del=false and name=\''.$name.'\';';
$sql='select xml from '.$Schema.'_metadata where del=false and name=\''.$name.'\';';
$resX = $db->query($sql);
while ($rowX = $resX->fetch(PDO::FETCH_ASSOC))// $row - ассоциативный массив значений, ключи - названия столбцов
{
@ -309,7 +324,7 @@
//$allow=true;
$allow=false;
//$sql_query='select a.*,at.name from "_Access" a, "_Actions" at where a.del=false and at.id=a.action_id and at.name=\'Insert_'.$name.'\' and a.group_id in (select group_id from "_UsersGroups" where user_id='.$_SESSION['USER_ID'].');'
$sql_query='select main.p_getaccess('.getSQLValue(gettype($_SESSION['USER_ID']),$_SESSION['USER_ID']).',\'Insert_'.$name.'\') as allow;';
$sql_query='select '.$Schema.'p_getaccess('.getSQLValue(gettype($_SESSION['USER_ID']),$_SESSION['USER_ID']).',\'Insert_'.$name.'\') as allow;';
$res = $db->query($sql_query);
while ($row = $res->fetch(PDO::FETCH_ASSOC))// $row - ассоциативный массив значений, ключи - названия столбцов
@ -322,7 +337,7 @@
$allow=false;
//$sql_query='select a.*,at.name from "_Access" a, "_Actions" at where a.del=false and at.id=a.action_id and at.name=\'Update_'.$name.'\' and a.group_id in (select group_id from "_UsersGroups" where user_id='.$_SESSION['USER_ID'].');';
$sql_query='select main.p_getaccess('.getSQLValue(gettype($_SESSION['USER_ID']),$_SESSION['USER_ID']).',\'Update_'.$name.'\') as allow;';
$sql_query='select '.$Schema.'p_getaccess('.getSQLValue(gettype($_SESSION['USER_ID']),$_SESSION['USER_ID']).',\'Update_'.$name.'\') as allow;';
$res = $db->query($sql_query);
while ($row = $res->fetch(PDO::FETCH_ASSOC))// $row - ассоциативный массив значений, ключи - названия столбцов
{
@ -334,7 +349,7 @@
$allow=false;
//$sql_query='select a.*,at.name from "_Access" a, "_Actions" at where a.del=false and at.id=a.action_id and at.name=\'Delete_'.$name.'\' and a.group_id in (select group_id from "_UsersGroups" where user_id='.$_SESSION['USER_ID'].');';
$sql_query='select main.p_getaccess('.getSQLValue(gettype($_SESSION['USER_ID']),$_SESSION['USER_ID']).',\'Delete_'.$name.'\') as allow;';
$sql_query='select '.$Schema.'p_getaccess('.getSQLValue(gettype($_SESSION['USER_ID']),$_SESSION['USER_ID']).',\'Delete_'.$name.'\') as allow;';
$res = $db->query($sql_query);
while ($row = $res->fetch(PDO::FETCH_ASSOC))// $row - ассоциативный массив значений, ключи - названия столбцов
{
@ -372,7 +387,7 @@
$typename=findFirstNode($reqNode,"type")->getAttribute("n");
$xmls='';
$resX = $db->query('select xml from main._metadata where del=false and name=\''.$typename.'\';');
$resX = $db->query('select xml from '.$Schema.'_metadata where del=false and name=\''.$typename.'\';');
while ($rowX = $resX->fetch(PDO::FETCH_ASSOC))// $row - ассоциативный массив значений, ключи - названия столбцов
{
$xmls='<?xml version="1.0" encoding="UTF-8"?><metadata>'.parseGT($rowX['xml']).'</metadata>';
@ -493,7 +508,7 @@
$node_properties=findFirstNode($nodeType,"properties");
$xmls='';
$resX = $db->query('select xml from main._metadata where del=false and name=\''.$typename.'\';');
$resX = $db->query('select xml from '.$Schema.'_metadata where del=false and name=\''.$typename.'\';');
while ($rowX = $resX->fetch(PDO::FETCH_ASSOC))// $row - ассоциативный массив значений, ключи - названия столбцов
{
$xmls='<?xml version="1.0" encoding="UTF-8"?><metadata>'.parseGT($rowX['xml']).'</metadata>';
@ -617,7 +632,7 @@
$obj_id=$nodeType->getAttribute("id");
$xmls='';
$resX = $db->query('select xml from main._metadata where del=false and name=\''.$typename.'\';');
$resX = $db->query('select xml from '.$Schema.'_metadata where del=false and name=\''.$typename.'\';');
while ($rowX = $resX->fetch(PDO::FETCH_ASSOC))// $row - ассоциативный массив значений, ключи - названия столбцов
{
$xmls='<?xml version="1.0" encoding="UTF-8"?><metadata>'.parseGT($rowX['xml']).'</metadata>';
@ -672,7 +687,7 @@
$pagepos=$nTypeR->getAttribute("pp"); //текущяя страница page pos
$xmls='';
$resX = $db->query('select xml from main._metadata where del=false and name=\''.$typename.'\';');
$resX = $db->query('select xml from '.$Schema.'_metadata where del=false and name=\''.$typename.'\';');
while ($rowX = $resX->fetch(PDO::FETCH_ASSOC))// $row - ассоциативный массив значений, ключи - названия столбцов
{
$xmls='<?xml version="1.0" encoding="UTF-8"?><metadata>'.parseGT($rowX['xml']).'</metadata>';
@ -839,7 +854,7 @@
$idval=$node->getAttribute("id"); //Значение идентификатора
$xmls='';
$resX = $db->query('select xml from main._metadata where del=false and name=\''.$typename.'\';');
$resX = $db->query('select xml from '.$Schema.'_metadata where del=false and name=\''.$typename.'\';');
while ($rowX = $resX->fetch(PDO::FETCH_ASSOC))// $row - ассоциативный массив значений, ключи - названия столбцов
{
$xmls='<?xml version="1.0" encoding="UTF-8"?><metadata>'.parseGT($rowX['xml']).'</metadata>';
@ -883,7 +898,7 @@
}
$xmls='';
$resX = $db->query('select xml from main._metadata where del=false and name=\''.$typename.'\';');
$resX = $db->query('select xml from '.$Schema.'_metadata where del=false and name=\''.$typename.'\';');
while ($rowX = $resX->fetch(PDO::FETCH_ASSOC))// $row - ассоциативный массив значений, ключи - названия столбцов
{
$xmls='<?xml version="1.0" encoding="UTF-8"?><metadata>'.parseGT($rowX['xml']).'</metadata>';
@ -955,7 +970,7 @@
//if($propid==-1 || $propid=='') $propid='NULL';
$xmls='';
$resX = $db->query('select xml from main._metadata where del=false and name=\''.$typename.'\';');
$resX = $db->query('select xml from '.$Schema.'_metadata where del=false and name=\''.$typename.'\';');
while ($rowX = $resX->fetch(PDO::FETCH_ASSOC))// $row - ассоциативный массив значений, ключи - названия столбцов
{
$xmls='<?xml version="1.0" encoding="UTF-8"?><metadata>'.parseGT($rowX['xml']).'</metadata>';
@ -1051,7 +1066,7 @@
}elseif($cmd==1) //Logout
{
//filter_input(INPUT_COOKIE, 'S_HASH', FILTER_VALIDATE_INT, array('options'=>array('default'=>-1)));
$sql='delete from main._Logins where sessionid='.getSQLValue('string',$_COOKIE['GUID']).' and user_id='.getSQLValue('i4',$_SESSION['USER_ID']).';';
$sql='delete from '.$Schema.'_Logins where sessionid='.getSQLValue('string',$_COOKIE['GUID']).' and user_id='.getSQLValue('i4',$_SESSION['USER_ID']).';';
try
{ $db->exec($sql);
} catch (Exception $e)
@ -1082,7 +1097,7 @@
}else
{
$xs.=' <![CDATA[1]]><cmd><![CDATA['.$cmd.']]></cmd>'."\n";
$res = $db->query('select * from main.p__Login('.getSQLValue('i4',$_SESSION['USER_ID']).',null,null,null,null,null);');
$res = $db->query('select * from '.$Schema.'p__Login('.getSQLValue($idType,$_SESSION['USER_ID']).',null,null,null,null,null);');
if($row = $res->fetch(PDO::FETCH_ASSOC))
{
$xs.=' <name><![CDATA['.$row['name'].']]></name>'."\n";
@ -1103,7 +1118,7 @@
$name='';
$surname='';
$patronymic='';
$sql="select * from main.p__Login(".getSQLValue('i4',$_SESSION['USER_ID']).",'$login','$password',null,null,null);";
$sql="select * from ".$Schema."p__Login(".getSQLValue($idType,$_SESSION['USER_ID']).",'$login','$password',null,null,null);";
$res = $db->query($sql);
if($res->rowCount()>0)
{ $result = $res->fetch(PDO::FETCH_ASSOC);
@ -1139,7 +1154,7 @@
//Выбираем информацию о текущем пользователе
$name='';
$sql="select Coalesce(surname,'') || ' ' || Coalesce(name,'') || ' ' || Coalesce(patronymic,'') as name from main._users where id=".$_SESSION['USER_ID'].";";
$sql="select Coalesce(surname,'') || ' ' || Coalesce(name,'') || ' ' || Coalesce(patronymic,'') as name from ".$Schema."_users where id=".$_SESSION['USER_ID'].";";
$res = $db->query($sql);
if($res->rowCount()>0)
{ $result = $res->fetch(PDO::FETCH_ASSOC);
@ -1152,7 +1167,7 @@
$ext=$nTypeR->getAttribute("ext");
$xmls='';
$resX = $db->query('select xml from main._metadata where del=false and name=\''.$typename.'\';');
$resX = $db->query('select xml from '.$Schema.'_metadata where del=false and name=\''.$typename.'\';');
while ($rowX = $resX->fetch(PDO::FETCH_ASSOC))// $row - ассоциативный массив значений, ключи - названия столбцов
{
$xmls='<?xml version="1.0" encoding="UTF-8"?><metadata>'.parseGT($rowX['xml']).'</metadata>';
@ -1409,7 +1424,7 @@
$idval = $_REQUEST['i']; //Идентификатор поля в базе
$xmls='';
$resX = $db->query('select xml from main._metadata where del=false and name=\''.$typename.'\';');
$resX = $db->query('select xml from '.$Schema.'_metadata where del=false and name=\''.$typename.'\';');
while ($rowX = $resX->fetch(PDO::FETCH_ASSOC))// $row - ассоциативный массив значений, ключи - названия столбцов
{
$xmls='<?xml version="1.0" encoding="UTF-8"?><metadata>'.parseGT($rowX['xml']).'</metadata>';
@ -1437,7 +1452,7 @@
if($fnode->getAttribute("vt")=="blob") //Отправить файл клиенту из базы данных
{
$stmt = $db->prepare("SELECT \"$field\",length(\"$field\"),substring(\"$name\", position('_' IN \"$name\")+1) as name FROM main.\"$typename\" WHERE id='$idval'");
$stmt = $db->prepare("SELECT \"$field\",length(\"$field\"),substring(\"$name\", position('_' IN \"$name\")+1) as name FROM $Schema\"$typename\" WHERE id='$idval'");
$stmt->execute();
$stmt->bindColumn(1, $blob, PDO::PARAM_LOB);
$stmt->bindColumn(2, $size, PDO::PARAM_INT);

View File

@ -332,7 +332,7 @@ class SRec
id=nodeProp.getAttribute("id");
value=findFirstNode(nodeProp, '#cdata-section').nodeValue;
prop.value=id;
propvis=document.getElementById('filter_'+this.uid+'_'+prop_id+'_visible');
let propvis=document.getElementById('filter_'+this.uid+'_'+prop_id+'_visible');
propvis.value=value;
propvis.select();
}else
@ -345,7 +345,8 @@ class SRec
{
if (nodeProp.nodeName=="record")
{
if (i%2==0) bgColor='white'; else bgColor='#e0e0e0';
let bgColor='#e0e0e0';
if (i%2==0) bgColor='white';
id=nodeProp.getAttribute("id");
value=getCdataValue(nodeProp);
value=value.replace(/"/g, "&quot;"); value=value.replace(/'/g, "\\'");
@ -370,8 +371,8 @@ class SRec
//Set the value for the object filter with a text field search
setFilterVal(id,caption,prop_id)
{
prop=document.getElementById('filter_'+this.uid+'_'+prop_id);
propvis=document.getElementById('filter_'+this.uid+'_'+prop_id+'_visible');
let prop=document.getElementById('filter_'+this.uid+'_'+prop_id);
let propvis=document.getElementById('filter_'+this.uid+'_'+prop_id+'_visible');
if ((prop!=null)&&(propvis!=null))
{
prop.value=id;
@ -944,7 +945,7 @@ class SRec
let nodeFilter=findNodeOnPath(nodeType,"objects-list/filter");
if(nodeFilter!=null) //Create HTML elements by XML filter.
{
columnNode=nodeFilter.firstChild;
let columnNode=nodeFilter.firstChild;
while (columnNode != null)
{
if (columnNode.nodeName==="column")

View File

@ -1,5 +1,41 @@
//Copyright (C) Ivanov I.M. irigm@mail.ru
//Расширить плитку чтобы она занимала всю штртну области
function resizeDivTile(parent,minWidth)
{
if(typeof parent == 'string') parent=document.getElementById(parent);
if(parent==null) return;
var margin=2; //С права и слева по одному пикселю то получается два
var dx=Math.floor(parent.offsetWidth/(minWidth+margin));
//console.log("parent.offsetWidth="+parent.offsetWidth+" minWidth="+minWidth+" margin="+margin+" dx="+dx);
var addW=0;
for(var i=0;i<minWidth+margin+2;i++)
{
if(dx>=parent.offsetWidth/(minWidth+margin+i))
{
addW=i-1;
console.log("addW="+addW+" parent.offsetWidth/(minWidth+margin+i)="+(parent.offsetWidth/(minWidth+margin+i)));
break;
}
}
for(var i = 0; i < parent.children.length; i++) {
//console.log(parent.children[i].tagName);
if(parent.children[i].tagName.toUpperCase()=='DIV')
{
parent.children[i].style.width = (minWidth+addW)+"px";
}
}
//console.log("minWidth+addW="+(minWidth+addW));
//Центрирую, путем добавления пространства с права
parent.style.paddingLeft = Math.floor((parent.offsetWidth-(dx*(minWidth+margin+addW)))/2) + "px";
//console.log("parent.style.paddingLeft="+parent.style.paddingLeft+" calc="+(Math.floor((parent.offsetWidth-(dx*(minWidth+margin+addW)))/2)));
}
//Получить уникальный идентификатор из глобальной переменной
var UID=0;
function getUID()

View File

@ -0,0 +1,57 @@
<?php
@session_start();
//if(isset($_SESSION['REMOTE_ADDR']) && $_SESSION['REMOTE_ADDR'] != $_SERVER['REMOTE_ADDR']) unset($_SESSION["USER_ID"]); //Делаемся не авторизованным если зашли с другого ip адреса
if (isset($_REQUEST['id'])) $id = $_REQUEST['id']; else $id = '';
$width = 115; //Ширина изображения
$height = 40; //Высота изображения
$font_size = 14; //Размер шрифта
$let_amount = 5; //Количество символов, которые нужно набрать
$fon_let_amount = 40; //Количество символов, которые находятся на фоне
$path_fonts = getcwd().'/fonts/'; //Путь к шрифтам
//$letters = array('a','b','c','d','e','f','g','h','j','k','m','n','p','q','r','s','t','u','v','w','x','y','z','2','3','4','5','6','7','9');
$letters = array('0','1','2','3','4','5','6','7','8','9');
$colors = array('10','30','50','70','90','110','130','150','170','190','210');
$src = imagecreatetruecolor($width,$height);
$fon = imagecolorallocate($src,255,255,255);
imagefill($src,0,0,$fon);
$fonts = array();
$dir=opendir($path_fonts);
while($fontName = readdir($dir))
{
if($fontName != "." && $fontName != ".." && pathinfo($fontName, PATHINFO_EXTENSION)=='ttf')
{
$fonts[] = $fontName;
}
}
closedir($dir);
for($i=0;$i<$fon_let_amount;$i++)
{
$color = imagecolorallocatealpha($src,rand(0,255),rand(0,255),rand(0,255),100);
$font = $path_fonts.$fonts[rand(0,sizeof($fonts)-1)];
$letter = $letters[rand(0,sizeof($letters)-1)];
$size = rand($font_size-2,$font_size+2);
imagettftext($src,$size,rand(0,45),rand($width*0.1,$width-$width*0.1),rand($height*0.2,$height),$color,$font,$letter);
}
for($i=0;$i<$let_amount;$i++)
{
$color = imagecolorallocatealpha($src,$colors[rand(0,sizeof($colors)-1)],$colors[rand(0,sizeof($colors)-1)],$colors[rand(0,sizeof($colors)-1)],rand(20,40));
$font = $path_fonts.$fonts[rand(0,sizeof($fonts)-1)];
$letter = $letters[rand(0,sizeof($letters)-1)];
$size = rand($font_size*2.1-2,$font_size*2.1+2);
$x = ($i+0.9)*$font_size + rand(4,7);
$y = (($height*2.3)/3) + rand(0,5);
$cod[] = $letter;
imagettftext($src,$size,rand(0,15),$x,$y,$color,$font,$letter);
}
$_SESSION['secpic'.$id] = implode('',$cod);
header ("Content-type: image/gif");
imagegif($src);
?>

Binary file not shown.