diff --git a/metadata/dbms/DBMSRecords.java b/metadata/dbms/DBMSRecords.java index caebcbd..c9df006 100644 --- a/metadata/dbms/DBMSRecords.java +++ b/metadata/dbms/DBMSRecords.java @@ -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); diff --git a/metadata/dbms/DBMSTree.java b/metadata/dbms/DBMSTree.java index 29e57c2..74ff483 100644 --- a/metadata/dbms/DBMSTree.java +++ b/metadata/dbms/DBMSTree.java @@ -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); diff --git a/metadata/dbms/TCGallery.js b/metadata/dbms/TCGallery.js index 8fac1d7..916ac10 100644 --- a/metadata/dbms/TCGallery.js +++ b/metadata/dbms/TCGallery.js @@ -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}); @@ -156,9 +178,9 @@ function TCGallery2(parent) { return function() { if(!thiz.ower) return; - - pos=-1; - for(i=0;i'); @@ -135,7 +135,7 @@ class EdtRec this.setPropCdata(nodeType.getAttribute("ObjectID"),record_id); let str=''; - str+=' '; + str+='
'; str+=' '; str+=' '; str+=' '; @@ -262,7 +262,7 @@ class EdtRec { rpos++; tr = document.createElement('tr'); - if (rpos%2==0) bgColor='#EEEEEE'; else bgColor='#FFFFFF'; + if (rpos%2==0) bgColor=g_rowColor1; else bgColor=g_rowColor2; tr.setAttribute("bgColor",bgColor); if(nodeProp.getAttribute("visible")=='0') tr.style.display='none'; var td1 = document.createElement('td'); @@ -338,7 +338,8 @@ class EdtRec var tObj=findNode(nodeProp, "type"); if(tObj!=null) { - var button = document.createElement('input'); + let button = document.createElement('input'); + button.className='button-secondary'; button.setAttribute("type","button"); button.setAttribute("value","..."); button.style.cssText="width:30px;font-size:9pt;margin:0px;padding:0px;"; @@ -351,8 +352,18 @@ class EdtRec } td2.appendChild( table ); - - }else + + }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") { var select = document.createElement('select'); @@ -442,6 +453,7 @@ class EdtRec newCell1.appendChild( input ); button = document.createElement('input'); + button.className='button-secondary'; button.setAttribute("type","button"); button.setAttribute("value","+"); button.setAttribute("title",_("Increase_by_1")); @@ -451,6 +463,7 @@ class EdtRec newCell2.appendChild( button ); button = document.createElement('input'); + button.className='button-secondary'; button.setAttribute("type","button"); button.setAttribute("value","-"); button.setAttribute("title",_("Decrease_by_1")); @@ -503,6 +516,7 @@ class EdtRec //cmbInp.addEventListener(IndexChangeEvent.CHANGE,onComboObjectChangeHandler); var button = document.createElement('input'); + button.className='button-secondary'; button.setAttribute("type","button"); button.setAttribute("value","..."); button.style.cssText="width:30px;font-size:9pt;margin:0px;padding:0px;height:100%;"; @@ -571,6 +585,7 @@ class EdtRec hidden.value=value; newCell1.appendChild(hidden); var button = document.createElement('input'); + button.className='button-secondary'; button.setAttribute("type","button"); button.setAttribute("value","..."); button.style.cssText="width:30px;font-size:9pt;margin:0px;padding:0px;"; @@ -638,7 +653,8 @@ class EdtRec newCell1.appendChild(input); //Button to send the file to the server - var btnSel = document.createElement('input'); + let btnSel = document.createElement('input'); + button.className='button-secondary'; btnSel.setAttribute("type","button"); btnSel.setAttribute("value","..."); btnSel.setAttribute("title",_('Upload')); @@ -646,7 +662,8 @@ class EdtRec btnSel.style.cssText="width:30px;font-size:9pt;margin:0px;padding:0px;"; newCell2.appendChild(btnSel); - var button2 = document.createElement('input'); + let button2 = document.createElement('input'); + button.className='button-secondary'; button2.setAttribute("type","button"); button2.setAttribute("value","X"); button2.setAttribute("title",_('Delete')); @@ -749,13 +766,14 @@ class EdtRec //Button apply tr = document.createElement('tr'); var td = document.createElement('td'); - td.style.cssText="padding: 5px; vertical-align: bottom; background-color: #f5f5f5;"; + td.style.cssText="padding: 5px; vertical-align: bottom;"; td.setAttribute("colspan", "2"); if (this.record_id==-1) td.innerHTML=''; tr.appendChild(td); //var td = document.createElement('td'); td.setAttribute("align","right"); button = document.createElement('input'); + button.className='button-secondary'; button.setAttribute("type","button"); button.style.cssText="margin:0px;margin-right:1px;"; button.setAttribute("value",_('Apply')); @@ -768,6 +786,7 @@ class EdtRec button = document.createElement('input'); //Button cancel button.setAttribute("type","button"); + button.className='button-secondary'; button.style.cssText="margin:0px;"; button.setAttribute("value",_('Cancel')); //button.onclick=function f_exit(this) { alert(this.win.div); } @@ -867,7 +886,7 @@ class EdtRec selObj(typeName,propname) { var win=new TWin(); - win.TWin(pageX-10,pageY-10); + win.BuildGUI(pageX-10,pageY-10); var str=''; str+='
'; @@ -988,7 +1007,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+=''; @@ -997,7 +1016,7 @@ class EdtRec { this.showProgressBar(); } - } + }*/ } } } @@ -1132,7 +1151,7 @@ class EdtRec htmlString+='
'; var win=new TWin(); - win.TWin(pageX-280,pageY-7); + win.BuildGUI(pageX-280,pageY-7); win.setContent(htmlString); win.setCaption(document.createTextNode(_("Selection"))); win.setParent(this.win); diff --git a/metadata/dbms/form/b_g.png b/metadata/dbms/form/b_g.png new file mode 100644 index 0000000..8424649 Binary files /dev/null and b/metadata/dbms/form/b_g.png differ diff --git a/metadata/dbms/form/b_x.png b/metadata/dbms/form/b_x.png new file mode 100644 index 0000000..19b4379 Binary files /dev/null and b/metadata/dbms/form/b_x.png differ diff --git a/metadata/dbms/login.js b/metadata/dbms/login.js index 6f6c253..3d66c53 100644 --- a/metadata/dbms/login.js +++ b/metadata/dbms/login.js @@ -1,22 +1,15 @@ function TUser() { - //Функция запрашивает информацию о текущем пользователе с сервера - this.LoadData = function() - { - var r = new TRequest(this); - var xs=''; - 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'; + + //alert('xs='+xs); + + this.request.callServer(ScriptName,xs); + }; TLogin.LoginIsOk=0; //login in TLogin.LoginIsError=1; //Invalid password and / or login. @@ -396,13 +426,13 @@ function TLogin() this.m_html=false; this.request = new TRequest(this); -} +}*/ //Display password recovery form function showRestoreForm() { var win=new TWin(true); - win.TWin(10,10); + win.BuildGUI(10,10); win.setCaption(_("Password_recovery")); str='
\n\ diff --git a/metadata/dbms/records.php b/metadata/dbms/records.php index 0b5fdc3..2ed014b 100644 --- a/metadata/dbms/records.php +++ b/metadata/dbms/records.php @@ -46,36 +46,38 @@ function getSQLValue($t,$v) { - global $db_connstr; + global $db_connection; - 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(strpos($db_connstr, 'pgsql')!==false) + if($t=='string' || $t=='text' || $t=='dateTime' || $t=='time' || $t=='date' || $t=='file'){ + if($v==''){ + $v='NULL'; + }else{ + if(strpos($db_connection, '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,14 +218,24 @@ } set_exception_handler('special_handler'); //чтоб не пойманные исключения посылались в виде XML + //Схема базы по умолчанияю + if(!isset($Schema)) { + $Schema=""; + } + //Тип идентификаторов + $idType="object"; + if(!isset($idType)) { + $idType="object"; + } + try { - if(strpos($db_connstr, 'sqlite')!==false) + if(strpos($db_connection, 'sqlite')!==false) { - $db = new PDO($db_connstr); + $db = new PDO($db_connection); }else { - $db = new PDO($db_connstr, $db_login, $db_password); + $db = new PDO($db_connection, $db_login, $db_password); } $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch (Exception $e) @@ -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=''.parseGT($rowX['xml']).''; @@ -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=''.parseGT($rowX['xml']).''; @@ -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=''.parseGT($rowX['xml']).''; @@ -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=''.parseGT($rowX['xml']).''; @@ -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=''.parseGT($rowX['xml']).''; @@ -877,13 +892,13 @@ } catch (Exception $e) { sendError($e->getMessage()); } - if(strpos($db_connstr, 'sqlite')===false) //Для SQLite не работает rowCount() + if(strpos($db_connection, 'sqlite')===false) //Для SQLite не работает rowCount() { if($res->rowCount()!=1) sendError("Количество записей не равно одному!"); } $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=''.parseGT($rowX['xml']).''; @@ -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=''.parseGT($rowX['xml']).''; @@ -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('object',$_SESSION['USER_ID']).';'; try { $db->exec($sql); } catch (Exception $e) @@ -1082,7 +1097,7 @@ }else { $xs.=' '."\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.=' '."\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=''.parseGT($rowX['xml']).''; @@ -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=''.parseGT($rowX['xml']).''; @@ -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); diff --git a/metadata/dbms/showrecord.js b/metadata/dbms/showrecord.js index 0f5d649..d08b1e4 100644 --- a/metadata/dbms/showrecord.js +++ b/metadata/dbms/showrecord.js @@ -17,7 +17,7 @@ class SRec { this.win=null; this.rwin=null; - + this.f_State='0'; //"0" - editing, "1" - selecting a single entry, "2" - selecting a multiple record this.f_PropName=""; //If the mode f_State is 1 then f_PropName saves the name of the field for which the data is intended this.f_TypeName=""; //the name of the displayed object (type-> n attribute) @@ -33,17 +33,17 @@ class SRec this.masChBox=new Array(); //Checkboxes this.xmldoc=null; //accepted XML document (for CDATA creation) this.pagepos=0; //current data page - + this.pBarCnt=0; //Progress bar this.pBarDiv=null; //Progress bar - + this.name=""; - + this.uid=getUID(); this.request = new TRequest(this); SRec_mas[this.uid]=this; } - + applyReq(req,fn,node,xmldoc) { //alert(getXMLNodeSerialisation(node)); @@ -126,7 +126,7 @@ class SRec { //Apply the parameters to the current XML filter if there are filter settings in the parent window! if(xml===null || typeof(xml) == "undefined") return; - + if(typeof(xml) == "string"){ if(xml!="") { @@ -146,7 +146,7 @@ class SRec let str='\
\ '; + str+=' '; str+=' '; str+=' '; str+=' '; @@ -1249,10 +1289,10 @@ class TWin for(var i=0;i diff --git a/metadata/include/fonts/cour.ttf b/metadata/include/fonts/cour.ttf new file mode 100644 index 0000000..2c99e08 Binary files /dev/null and b/metadata/include/fonts/cour.ttf differ
\ - \ +
\ \
\
\ @@ -173,32 +173,32 @@ class SRec if(htmlElement==null || typeof(htmlElement) == "undefined") { this.win=new TWin(); - this.win.TWin(pageX-10,pageY-10); + this.win.BuildGUI(pageX-10,pageY-10); this.win.setHeight(400); //this.win.setLeftTop() - + this.win.setContent(str); this.win.obj=this; - + this.win.addResizeListener(function(obj){return function(){obj.updateSize();}}(this)); - - }else{ + + }else{ htmlElement.innerHTML=str; } document.getElementById('SRec_Add_'+this.uid).onclick=function(thiz){return function(){thiz.insertRecord();};}(this); document.getElementById('SRec_Del_'+this.uid).onclick=function(thiz){return function(){thiz.deleteRecord();};}(this); - document.getElementById('SRec_Exc_'+this.uid).onclick=function(thiz){return function(){thiz.showreport('xls');};}(this); - document.getElementById('SRec_Rfr_'+this.uid).onclick=function(thiz){return function(){thiz.appendFilter(); thiz.sendFilter(-1,0);};}(this); + document.getElementById('SRec_Exc_'+this.uid).onclick=function(thiz){return function(){thiz.showreport('xls');};}(this); + document.getElementById('SRec_Rfr_'+this.uid).onclick=function(thiz){return function(){thiz.appendFilter(); thiz.sendFilter(-1,0);};}(this); } - + //Update dimensions of the elements (the main table in absolute coordinates). updateSize() { let dv1=document.getElementById("tblSContainer_"+this.uid); let dv2=document.getElementById("tblContainer_"+this.uid); if(dv1!=null && dv2!=null) - { + { dv1.style.width = dv2.offsetWidth+"px"; dv1.style.height = dv2.offsetHeight+"px"; } @@ -235,7 +235,7 @@ class SRec setDataSelect(node) { //alert("setDataSelect = " + getXMLNodeSerialisation(node)); - + let nodeType,prop_id,prop,option,nodeProp,id,value,cdataNode; nodeType=findFirstNode(node, 'type'); prop_id=nodeType.getAttribute("pn");//Field name @@ -246,9 +246,9 @@ class SRec let nodeFilter=findNodeOnPath(this.nodeMetadata,"type/objects-list/filter"); let nodeCur=findNodeOnAttribute(nodeFilter, 'column', 'n', prop_id); if(nodeCur!=null) selector=nodeCur.getAttribute("selector"); - - //alert("nodeCur = " + getXMLNodeSerialisation(nodeCur)); - + + //alert("nodeCur = " + getXMLNodeSerialisation(nodeCur)); + /*nodeCur=nodeFilter.firstChild while(nodeCur!=null) { @@ -262,7 +262,7 @@ class SRec if(selector==="combo") //if the drop-down list { prop.innerHTML = ""; - + //Select the value for this list let val=null; let nodeFilter=findNodeOnPath(this.nodeMetadata,"type/objects-list/filter"); @@ -271,7 +271,7 @@ class SRec { if((nodeCol.nodeName==="column")&&(nodeCol.getAttribute("n")==prop_id)) { - val=getCdataValue(nodeCol); + val=getCdataValue(nodeCol); break; } nodeCol=nodeCol.nextSibling; @@ -332,20 +332,21 @@ 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 if(count>1) //The item selection window is displayed. { - let htmlString=''; + let htmlString='
'; nodeProp=nodeType.firstChild i=0; while (nodeProp!=null) { 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, """); value=value.replace(/'/g, "\\'"); @@ -357,7 +358,7 @@ class SRec htmlString+='
'; let win=new TWin(); - win.TWin(pageX-10,pageY-10); + win.BuildGUI(pageX-10,pageY-10); win.setHeight(400); win.setContent(htmlString); win.setCaption(document.createTextNode(_('Selection'))); @@ -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; @@ -406,7 +407,7 @@ class SRec //The function to collect data from HTML fields in XML appendFilter() - { + { let nodeType=findFirstNode(this.nodeMetadata, "type"); let nodeFilter=findNodeOnPath(nodeType,"objects-list/filter"); if (nodeFilter!=null) @@ -419,15 +420,15 @@ class SRec let value = ''; let input = document.getElementById('filter_'+this.uid+'_'+columnNode.getAttribute("n")); if(input!=null) value=input.value; - + //'2016-02-27 00:00:00' if(columnNode.getAttribute("vt")=="dateTime" || columnNode.getAttribute("vt")=="date") //If field is "dateTime" then transmit in UnixTime format in second { if(value!=""){ let date = new Date(value.replace(/-/g, "/")); - value=date.getTime()/1000;// - date.getTimezoneOffset()*60; + value=date.getTime()/1000;// - date.getTimezoneOffset()*60; if(isNaN(value)) value=''; - } + } } getCdata(columnNode).nodeValue=value; //TODO do check for data type } @@ -462,12 +463,12 @@ class SRec { xs+=''; xs+=''; - xs+='\n'; + xs+='\n'; }else { xs+=''; xs+=''; - xs+='\n'; + xs+='\n'; } } nextNode=nextNode.nextSibling; @@ -476,7 +477,7 @@ class SRec xs+=''; //alert(xs); - + if(this.request.callServer(ScriptName,xs)) { this.showProgressBar(); @@ -487,7 +488,7 @@ class SRec setMetadata(node) { this.nodeMetadata=node; - this.setXMLSettings(this.f_Settings); //Appending settings to nodeMetadata + this.setXMLSettings(this.f_Settings); //Appending settings to nodeMetadata //Create GUI filter let td,tr,td1,td2; @@ -508,7 +509,7 @@ class SRec this.nodeMetadataObjList=findNode(nodeType, "objects-list"); if(this.win!=null) this.win.setWidth(this.nodeMetadataObjList.getAttribute("width")); nodeFilter=findNodeOnPath(nodeType,"objects-list/filter"); - + //let id=-1; //After loading the metadata, we request the data by sending an XML filter. @@ -542,7 +543,7 @@ class SRec td1.appendChild(table); nRow=table.insertRow(0); } - + if(row>1) { td1 = nRow.insertCell(-1); @@ -584,8 +585,8 @@ class SRec input.setAttribute("name",columnNode.getAttribute("n")); if(columnNode.getAttribute("size")!=null) input.setAttribute("maxlength",columnNode.getAttribute("size"),0); - - input.setAttribute("value",isNaN(value) || value=='' ? '' : (new Date(value*1000)).toString()); + + input.setAttribute("value",isNaN(value) || value=='' ? '' : (new Date(value*1000)).toString()); input.setAttribute("id",'filter_'+this.uid+'_'+columnNode.getAttribute("n")); newCell1.appendChild( input ); @@ -735,6 +736,7 @@ class SRec newCell1.appendChild( input ); let button = document.createElement('input'); + button.className='button-secondary'; button.setAttribute("type","button"); button.setAttribute("value","+"); button.style.cssText="height:100%;width:22px;margin:0px;padding:0px;"; @@ -742,6 +744,7 @@ class SRec button.onclick=function(inp){return function(){ inp.value=getIntVal(inp.value)+1; }}(input); button = document.createElement('input'); + button.className='button-secondary'; button.setAttribute("type","button"); button.setAttribute("value","-"); button.style.cssText="height:100%;width:22px;margin:0px;padding:0px;"; @@ -787,11 +790,12 @@ class SRec //select.setAttribute("name",columnNode.getAttribute("n")) select.setAttribute("value",value); select.setAttribute("id",'filter_'+this.uid+'_'+columnNode.getAttribute("n")); - select.onchange = function(thiz,node){ return function(){ thiz.onComboObjectChangeHandler(node);}; }(this,columnNode); - + select.onchange = function(thiz,node){ return function(){ thiz.onComboObjectChangeHandler(node);}; }(this,columnNode); + newCell1.appendChild(select); let button = document.createElement('input'); + button.className='button-secondary'; button.setAttribute("type","button"); button.setAttribute("value","..."); button.style.cssText="display:block; box-sizing: border-box; margin: 0px; padding: 0px;width:100%; height:100%; font-size: 9pt;"; @@ -806,8 +810,8 @@ class SRec nTypeF.setAttribute("c",fc); nTypeF.setAttribute("pn",columnNode.getAttribute("n")); nTypeF.setAttribute("fn",columnNode.getAttribute("n")); - - let strXMLF = getXMLNodeSerialisation(nTypeF); + + let strXMLF = getXMLNodeSerialisation(nTypeF); let nColF=nodeFilter.firstChild; while(nColF != null) { @@ -815,7 +819,7 @@ class SRec { let valF=getCdataValue(nColF); strXMLF=strXMLF.replace('${'+nColF.getAttribute('n')+'}', valF); - } + } nColF = nColF.nextSibling; } strXMLF=''+strXMLF+''; @@ -825,7 +829,7 @@ class SRec this.showProgressBar(); } }else - { + { if(this.request.callServer(ScriptName,'',true)) { this.showProgressBar(); @@ -860,6 +864,7 @@ class SRec newCell1.appendChild(hidden); let button = document.createElement('input'); + button.className='button-secondary'; button.setAttribute("type","button"); button.setAttribute("value","..."); button.style.cssText="width:30px; height:100%;margin: 0px; padding: 0px;"; @@ -894,6 +899,7 @@ class SRec td.setAttribute("align","right"); let button = document.createElement('input'); + button.className='button-secondary'; button.setAttribute("type","button"); button.setAttribute("value",_("Filtering")); button.setAttribute("id","btnfilter_"+this.uid); @@ -927,15 +933,15 @@ class SRec if (this.win!=null && this.win.getTop()!=40) this.win.setCenter(); - + //Building the columns of the data table this.buildHead(); - + //this.sendFilter(id,0); this.sendFilter(-1,0); } - /** The event occurs when you change the list of the referenced to "vt = Object" and if there is a dependency, then the field is updated. + /** The event occurs when you change the list of the referenced to "vt = Object" and if there is a dependency, then the field is updated. */ onComboObjectChangeHandler(node) { @@ -944,7 +950,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") @@ -974,7 +980,7 @@ class SRec } nColF = nColF.nextSibling; } - + strXMLF=''+strXMLF+''; if(this.request.callServer(ScriptName,strXMLF,true)) { @@ -987,7 +993,7 @@ class SRec } } } - + //We ask the server for a list of values almost like a drop-down list. //typeName - The name of the object (TODO if the current is the variable f TypeName) //name - the name of the column for selecting the values (must match the name of any filter in typeName) @@ -1009,7 +1015,7 @@ class SRec this.sendFilter(-1,0); } } - + //Building a table header for the data buildHead() { @@ -1018,7 +1024,7 @@ class SRec let thetable = document.getElementById('thetable'+this.uid); delChild(thetable.tHead); let tr=document.createElement('tr'); - tr.style.cssText='background-color: #dadada;'; + tr.style.cssText='background-color: var(--header-color);'; let th=document.createElement('th'); th.appendChild( document.createTextNode('№')); th.style.cssText='width: 1%;'; @@ -1027,8 +1033,8 @@ class SRec th.appendChild( document.createTextNode('Del')); th.title = _('Invert_selection'); th.style.cssText='width: 1%; cursor: pointer; text-decoration: underline;'; - th.onmouseover=function(){ this.style.backgroundColor='#C2D7FC'; }; - th.onmouseout=function(){ this.style.backgroundColor='#dadada'; }; + th.onmouseover=function(){ this.style.backgroundColor=g_rowColor2; }; + th.onmouseout=function(){ this.style.backgroundColor='var(--header-color)'; }; th.onclick=function(thiz){return function(){ for(let i=0;i=0) //Color from Result { bgColorT=findNodeOnNum(nodeRecord,"#cdata-section",nColor).nodeValue; @@ -1171,7 +1177,7 @@ class SRec tr.appendChild(td); //CheckBuck to delete records - td = document.createElement('td'); + td = document.createElement('td'); td.style.cssText="text-align: center;"; if(!(this.f_pD!="1" || nodeRecord.getAttribute("a").indexOf("d")==-1)) { @@ -1260,7 +1266,7 @@ class SRec } return null; } - + //Name the column number getColNumOnName(name) { @@ -1362,7 +1368,7 @@ class SRec let tr=document.getElementById(id+'_'+this.uid); if (tr==null) - { + { this.insertRows(node,false); //If not then insert }else { @@ -1379,7 +1385,7 @@ class SRec while(tr.childNodes[jj+2].childNodes[0]) tr.childNodes[jj+2].removeChild(tr.childNodes[jj+2].childNodes[0]); tr.childNodes[jj+2].appendChild(document.createTextNode(cdataNode.nodeValue)); - + jj++; } ii++; @@ -1428,16 +1434,16 @@ class SRec showreport(ext) { if(this.rwin!=null) this.rwin.Close(); - + this.rwin=new TWin(); - this.rwin.TWin(pageX-10,pageY-10); + this.rwin.BuildGUI(pageX-10,pageY-10); this.rwin.setParent(this.win); this.rwin.setSize(280,130); this.rwin.setCaption(_('Report')); this.rwin.setContent('
'+_('Preparing_of_report')+'
'); - + this.appendFilter(); - //Call data from server + //Call data from server let nodeType=findFirstNode(this.nodeMetadata, "type"); let typename=nodeType.getAttribute("n"); let nodeFilter=findNodeOnPath(nodeType,"objects-list/filter"); @@ -1453,11 +1459,11 @@ class SRec { xs+=''; xs+=''; - xs+='\n'; + xs+='\n'; } nextNode=nextNode.nextSibling; } - xs+=' \n'; + xs+=' \n'; xs+=' \n'; xs+=''; if(this.request.callServer(ScriptName,xs)) @@ -1468,7 +1474,7 @@ class SRec chp(page) { - //The current filter values are sent to the script to form a page change + //The current filter values are sent to the script to form a page change document.forms.filter.xml_page.value=page; document.forms.filter.submit(); } @@ -1510,13 +1516,13 @@ class SRec if (confirm(_("Are_you_sure_you_want_to_delete_the_entries")+'?')) { for(let i=0;i',true)) { this.showProgressBar(); - } + } } } } @@ -1526,8 +1532,8 @@ class SRec //Update HTML data after update record ApplyDelRec(node) { - nodeType=findFirstNode(node, "type"); - typeName=nodeType.getAttribute("n"); + let nodeType=findFirstNode(node, "type"); + let typeName=nodeType.getAttribute("n"); id=nodeType.getAttribute("id"); deleteHTML(id+'_'+this.uid); //Rebuild sequential numbering of rows (first column) @@ -1539,7 +1545,7 @@ class SRec theTable.rows[i].cells[0].appendChild(document.createTextNode(i)); } } - + callData(typeName,settings) { this.f_TypeName=typeName; @@ -1556,12 +1562,12 @@ class SRec //Convert XML to array function nodeToTable(node) { - let result=new Array(); - + let result=new Array(); + let nType=findFirstNode(node, "type"); //Read name fields let nList=findFirstNode(node, "objects-list"); - let cols=new Array(); + let cols=new Array(); let pos=0; let nCols=nList.firstChild; while(nCols != null) @@ -1582,7 +1588,7 @@ function nodeToTable(node) { result[pos]['id']=nRecord.getAttribute("id"); let i=0; //column number - + cdataNode = nRecord.firstChild; while (cdataNode!=null) { @@ -1600,4 +1606,4 @@ function nodeToTable(node) } return result; -} \ No newline at end of file +} diff --git a/metadata/dbms/tabs.js b/metadata/dbms/tabs.js index 7eff280..9faa1f5 100644 --- a/metadata/dbms/tabs.js +++ b/metadata/dbms/tabs.js @@ -1,7 +1,13 @@ class tcTab { - constructor(caption){ + constructor(config){ + + this.bColor=""; + + + if(typeof config.float == 'undefined'){ config.float='left'; } + this.id=0; this.par=null; this.sel=false; @@ -10,12 +16,12 @@ class tcTab //Сам таб на который нажимаем (ушко) 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.style.cssText='position: relative; top: 1px; cursor: pointer; float: '+config.float+'; 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 = g_backColor1; + this.div.innerHTML=config.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.onmouseover=function(obj){return function(){ if(!obj.sel) obj.div.style.background = g_rowColor1; }}(this); + this.div.onmouseout=function(obj){return function(){ if(!obj.sel) obj.div.style.background = g_backColor1; }}(this); this.div.onclick=function(obj){return function(){ obj.setSel(); if(obj.href!='') goToURL(obj.href); }}(this) } @@ -44,12 +50,12 @@ class tcTab setSel() { for(let i=0;i'; - str+='