From cc28c1d5946153fb4ee871f3110e8aad553cabef Mon Sep 17 00:00:00 2001 From: Artem Osmakov Date: Sun, 11 Dec 2016 12:49:48 +0400 Subject: [PATCH 01/50] rename sysImportSessions to sysImportFiles --- hclient/core/utils_ui.js | 4 +- .../framecontent/import/importRecordsCSV.js | 10 ++-- .../import/importRecordsCSV_copy.js | 8 +-- hserver/controller/entityScrud.php | 2 +- hserver/controller/fileParse.php | 24 ++++----- ...mportSessions.php => dbSysImportFiles.php} | 49 +++++++++++-------- ...mportSessions.json => sysImportFiles.json} | 16 +++--- import/delimited/importCSV_lib.php | 40 +++++++++------ 8 files changed, 86 insertions(+), 67 deletions(-) rename hserver/dbaccess/{dbSysImportSessions.php => dbSysImportFiles.php} (79%) rename hserver/dbaccess/{sysImportSessions.json => sysImportFiles.json} (85%) diff --git a/hclient/core/utils_ui.js b/hclient/core/utils_ui.js index f1e89f6519..17f320b3b7 100644 --- a/hclient/core/utils_ui.js +++ b/hclient/core/utils_ui.js @@ -905,9 +905,9 @@ window.hWin.HEURIST4.ui = { request['entity'] = 'defDetailTypes'; request['dty_DetailTypeGroupID'] = configMode.filter_group; - }else if(configMode.entity=='SysImportSessions'){ + }else if(configMode.entity=='SysImportFiles'){ fieldTitle = 'imp_table'; - request['entity'] = 'sysImportSessions'; + request['entity'] = 'sysImportFiles'; request['ugr_ID'] = configMode.filter_group; } diff --git a/hclient/framecontent/import/importRecordsCSV.js b/hclient/framecontent/import/importRecordsCSV.js index a317ff8feb..ea1f0a4349 100644 --- a/hclient/framecontent/import/importRecordsCSV.js +++ b/hclient/framecontent/import/importRecordsCSV.js @@ -203,7 +203,7 @@ function hImportRecordsCSV(_imp_ID, _max_upload_size) { } }); window.hWin.HEURIST4.ui.createEntitySelector( selImportID.get(0), - {entity:'SysImportSessions', filter_group:'0,'+window.hWin.HAPI4.currentUser['ugr_ID']}, + {entity:'SysImportFiles', filter_group:'0,'+window.hWin.HAPI4.currentUser['ugr_ID']}, window.hWin.HR('select uploaded file...'), function(){ window.hWin.HEURIST4.util.setDisabled($('#btnClearAllSessions'), selImportID.find('option').length<2 ); @@ -352,7 +352,7 @@ function hImportRecordsCSV(_imp_ID, _max_upload_size) { } window.hWin.HEURIST4.util.setDisabled($('#btnClearAllSessions'), true); - window.hWin.HAPI4.EntityMgr.doRequest({a:'delete', entity:'sysImportSessions', recID:recID}, + window.hWin.HAPI4.EntityMgr.doRequest({a:'delete', entity:'SysImportFiles', recID:recID}, function(response){ if(response.status == window.hWin.HAPI4.ResponseStatus.OK){ if(is_current==true){ @@ -383,9 +383,9 @@ function hImportRecordsCSV(_imp_ID, _max_upload_size) { var request = { 'a' : 'search', - 'entity' : 'sysImportSessions', + 'entity' : 'SysImportFiles', 'details' : 'list', - 'imp_ID' : imp_ID + 'sif_ID' : imp_ID }; window.hWin.HAPI4.EntityMgr.doRequest(request, @@ -402,7 +402,7 @@ function hImportRecordsCSV(_imp_ID, _max_upload_size) { var resp = new hRecordSet( response.data ); var record = resp.getFirstRecord(); - var ses = resp.fld(record, 'imp_session'); + var ses = resp.fld(record, 'sif_Session'); //DEBUG $('#divFieldMapping2').html( ses ); imp_session = (typeof ses == "string") ? $.parseJSON(ses) : null; diff --git a/hclient/framecontent/import/importRecordsCSV_copy.js b/hclient/framecontent/import/importRecordsCSV_copy.js index 3c09a11a7a..fca31eedc1 100644 --- a/hclient/framecontent/import/importRecordsCSV_copy.js +++ b/hclient/framecontent/import/importRecordsCSV_copy.js @@ -194,7 +194,7 @@ function hImportRecordsCSV(_imp_ID, _max_upload_size) { } }); window.hWin.HEURIST4.ui.createEntitySelector( selImportID.get(0), - {entity:'SysImportSessions', filter_group:'0,'+window.hWin.HAPI4.currentUser['ugr_ID']}, + {entity:'SysImportFiles', filter_group:'0,'+window.hWin.HAPI4.currentUser['ugr_ID']}, window.hWin.HR('select uploaded file...'), function(){ window.hWin.HEURIST4.util.setDisabled($('#btnClearAllSessions'), selImportID.find('option').length<2 ); @@ -335,7 +335,7 @@ function hImportRecordsCSV(_imp_ID, _max_upload_size) { } window.hWin.HEURIST4.util.setDisabled($('#btnClearAllSessions'), true); - window.hWin.HAPI4.EntityMgr.doRequest({a:'delete', entity:'sysImportSessions', recID:recID}, + window.hWin.HAPI4.EntityMgr.doRequest({a:'delete', entity:'SysImportFiles', recID:recID}, function(response){ if(response.status == window.hWin.HAPI4.ResponseStatus.OK){ if(is_current==true){ @@ -366,9 +366,9 @@ function hImportRecordsCSV(_imp_ID, _max_upload_size) { var request = { 'a' : 'search', - 'entity' : 'sysImportSessions', + 'entity' : 'SysImportFiles', 'details' : 'list', - 'imp_ID' : imp_ID + 'sif_ID' : imp_ID }; window.hWin.HAPI4.EntityMgr.doRequest(request, diff --git a/hserver/controller/entityScrud.php b/hserver/controller/entityScrud.php index d4fda458b8..56abeda671 100644 --- a/hserver/controller/entityScrud.php +++ b/hserver/controller/entityScrud.php @@ -30,7 +30,7 @@ require_once (dirname(__FILE__).'/../dbaccess/dbDefDetailTypes.php'); require_once (dirname(__FILE__).'/../dbaccess/dbDefDetailTypeGroups.php'); require_once (dirname(__FILE__).'/../dbaccess/dbDefTerms.php'); - require_once (dirname(__FILE__).'/../dbaccess/dbSysImportSessions.php'); + require_once (dirname(__FILE__).'/../dbaccess/dbSysImportFiles.php'); require_once (dirname(__FILE__).'/../dbaccess/utils_db.php'); $response = array(); diff --git a/hserver/controller/fileParse.php b/hserver/controller/fileParse.php index 1192dbd416..094f7ed93f 100644 --- a/hserver/controller/fileParse.php +++ b/hserver/controller/fileParse.php @@ -46,10 +46,10 @@ function parse_content - parse CSV from content parameter and returns parsed arr if id and date fields are valid invokes parse_db_save otherwise returns error array and first 100 - parse_db_save - save content of file into import table, create session object and saves it to sysImportSessions table, returns session + parse_db_save - save content of file into import table, create session object and saves it to sysImportFiles table, returns session - saveSession - saves session object into sysImportSessions table (todo move to entity class SysImportSessions) - getImportSession - get session from sysImportSessions (todo move to entity class SysImportSessions) + saveSession - saves session object into sysImportFiles table (todo move to entity class SysImportFiles) + getImportSession - get session from sysImportFiles (todo move to entity class SysImportFiles) ------------------- @@ -77,7 +77,7 @@ function parse_content - parse CSV from content parameter and returns parsed arr */ require_once(dirname(__FILE__)."/../System.php"); -require_once (dirname(__FILE__).'/../dbaccess/dbSysImportSessions.php'); +require_once (dirname(__FILE__).'/../dbaccess/dbSysImportFiles.php'); require_once (dirname(__FILE__).'/../dbaccess/db_structure.php'); require_once (dirname(__FILE__).'/../dbaccess/db_structure_tree.php'); set_time_limit(0); @@ -668,7 +668,7 @@ function parse_step2($encoded_filename, $original_filename, $limit){ } // -// save content of file into import table, create session object and saves ti to sysImportSessions table, returns session +// save content of file into import table, create session object and saves ti to sysImportFiles table, returns session // function parse_db_save($preproc){ global $system; @@ -799,11 +799,11 @@ function saveSession($imp_session){ $mysqli = $system->get_mysqli(); - $imp_id = mysql__insertupdate($mysqli, "sysImportSessions", "imp", - array("imp_ID"=>@$imp_session["import_id"], - "ugr_id"=>$system->get_user_id(), - "imp_table"=>$imp_session["import_name"], - "imp_session"=>json_encode($imp_session) )); + $imp_id = mysql__insertupdate($mysqli, "sysImportFiles", "sif", + array("sif_ID"=>@$imp_session["import_id"], + "sif_UGrpID"=>$system->get_user_id(), + "sif_TempDataTable"=>$imp_session["import_name"], + "sif_Session"=>json_encode($imp_session) )); if(intval($imp_id)<1){ return "Cannot save session. SQL error:".$imp_id; @@ -824,7 +824,7 @@ function getImportSession($imp_ID){ if($imp_ID && is_numeric($imp_ID)){ $res = mysql__select_array($system->get_mysqli(), - "select imp_session, imp_table from sysImportSessions where imp_id=".$imp_ID); + "select sif_Session, sif_TempDataTable from sysImportFiles where sif_ID=".$imp_ID); $session = json_decode($res[0], true); $session["import_id"] = $imp_ID; @@ -840,7 +840,7 @@ function getImportSession($imp_ID){ } /* new way - $entity = new DbSysImportSessions( $system, array('details'=>'list','imp_ID'=>$imp_ID) ); + $entity = new DbSysImportFiles( $system, array('details'=>'list','sif_ID'=>$imp_ID) ); $res = $entity->search(); if( is_bool($res) && !$res ){ return $res; //error - can not get import session diff --git a/hserver/dbaccess/dbSysImportSessions.php b/hserver/dbaccess/dbSysImportFiles.php similarity index 79% rename from hserver/dbaccess/dbSysImportSessions.php rename to hserver/dbaccess/dbSysImportFiles.php index e4af0fffb9..fdbc8cbea5 100644 --- a/hserver/dbaccess/dbSysImportSessions.php +++ b/hserver/dbaccess/dbSysImportFiles.php @@ -1,7 +1,7 @@ system->get_mysqli(); - $query = "CREATE TABLE IF NOT EXISTS `sysImportSessions` ( - `imp_ID` int(11) unsigned NOT NULL auto_increment, - `ugr_ID` int(11) unsigned NOT NULL default 0, - `imp_table` varchar(255) NOT NULL default '', - `imp_session` text, - PRIMARY KEY (`imp_ID`))"; + + + $query = "CREATE TABLE IF NOT EXISTS `sysImportFiles` ( + `sif_ID` int(11) unsigned NOT NULL auto_increment + COMMENT 'Sequentially generated ID for delimited text or other files imported into temporary tables ready for processing', + `sif_FileType` enum('delimited') NOT NULL Default 'delimited' COMMENT 'The type of file which has been read into a temporary table for this import', + `sif_UGrpID` int(11) unsigned NOT NULL default 0 COMMENT 'The user ID of the user who imported the file', + `sif_TempDataTable` varchar(255) NOT NULL default '' COMMENT 'The name of the temporary data table created by the import', + `sif_Session` text COMMENT 'Import session data', + PRIMARY KEY (`sif_ID`))"; + + if (!$mysqli->query($query)) { + error_log($mysqli->error); $this->is_table_exists = false; } @@ -101,24 +108,24 @@ public function search(){ //compose WHERE $where = array(); - $pred = $this->searchMgr->getPredicate('imp_ID'); + $pred = $this->searchMgr->getPredicate('sif_ID'); if($pred!=null) array_push($where, $pred); - $pred = $this->searchMgr->getPredicate('ugr_ID'); + $pred = $this->searchMgr->getPredicate('sif_UGrpID'); if($pred!=null) array_push($where, $pred); //compose SELECT it depends on param 'details' ------------------------ if(@$this->data['details']=='id'){ - $this->data['details'] = 'imp_ID'; + $this->data['details'] = 'sif_ID'; }else if(@$this->data['details']=='name'){ - $this->data['details'] = 'imp_ID,imp_table'; + $this->data['details'] = 'sif_ID,sif_TempDataTable'; }else if(@$this->data['details']=='list'){ - $this->data['details'] = 'imp_ID,imp_table,imp_session'; + $this->data['details'] = 'sif_ID,sif_TempDataTable,sif_Session'; }else if(@$this->data['details']=='full'){ @@ -138,18 +145,18 @@ public function search(){ } //ID field is mandatory and MUST be first in the list - $idx = array_search('imp_ID', $this->data['details']); + $idx = array_search('sif_ID', $this->data['details']); if($idx>0){ unset($this->data['details'][$idx]); $idx = false; } if($idx===false){ - array_unshift($this->data['details'], 'imp_ID'); + array_unshift($this->data['details'], 'sif_ID'); } $is_ids_only = (count($this->data['details'])==1); //compose query - $query = 'SELECT SQL_CALC_FOUND_ROWS DISTINCT '.implode(',', $this->data['details']).' FROM sysImportSessions'; + $query = 'SELECT SQL_CALC_FOUND_ROWS DISTINCT '.implode(',', $this->data['details']).' FROM sysImportFiles'; if(count($where)>0){ $query = $query.' WHERE '.implode(' AND ',$where); @@ -159,7 +166,7 @@ public function search(){ //error_log($query); - $res = $this->searchMgr->execute($query, $is_ids_only, 'sysImportSessions'); + $res = $this->searchMgr->execute($query, $is_ids_only, 'sysImportFiles'); return $res; } @@ -201,15 +208,15 @@ public function delete(){ $rec_ID = $this->data['recID']; $rec_ID = intval(@$rec_ID); if($rec_ID>0){ - $where = " where imp_id=".$rec_ID; + $where = " where sif_ID=".$rec_ID; }else{ - $where = " where imp_id>0"; + $where = " where sif_ID>0"; } $mysqli = $this->system->get_mysqli(); $res = mysql__select_all($mysqli, - "select imp_id, imp_session from sysImportSessions".$where, 1); + "select sif_ID, sif_Session from sysImportFiles".$where, 1); if(!$res){ $this->system->addError(HEURIST_NOT_FOUND, @@ -232,7 +239,7 @@ public function delete(){ } } - if (!$mysqli->query("delete from sysImportSessions ".$where)) { + if (!$mysqli->query("delete from sysImportFiles ".$where)) { $this->system->addError(HEURIST_DB_ERROR, 'Cannot delete data from list of imported files', $mysqli->error); return false; diff --git a/hserver/dbaccess/sysImportSessions.json b/hserver/dbaccess/sysImportFiles.json similarity index 85% rename from hserver/dbaccess/sysImportSessions.json rename to hserver/dbaccess/sysImportFiles.json index e97f0fc732..a3fb4bb241 100644 --- a/hserver/dbaccess/sysImportSessions.json +++ b/hserver/dbaccess/sysImportFiles.json @@ -1,10 +1,10 @@ { - "entityName": "sysImportSessions", + "entityName": "sysImportFiles", - "tableName": "sysImportSessions", - "tablePrefix": "imp", + "tableName": "sysImportFiles", + "tablePrefix": "sif", - "helpContent": "sysImportSessions.html", + "helpContent": "sysImportFiles.html", "searchFormContent": "", @@ -20,7 +20,7 @@ "fields": [ { - "dtID": "imp_ID", + "dtID": "sif_ID", "keyField": true, "dtFields":{ "dty_Type":"integer", @@ -30,7 +30,7 @@ } }, { - "dtID": "ugr_ID", + "dtID": "sif_UGrpID", "dtFields":{ "dty_Type":"resource", "rst_DisplayName":"User:", @@ -39,7 +39,7 @@ } }, { - "dtID": "imp_table", + "dtID": "sif_TempDataTable", "titleField": true, "dtFields":{ "dty_Type":"freetext", @@ -51,7 +51,7 @@ } }, { - "dtID": "imp_session", + "dtID": "sif_Session", "dtFields":{ "dty_Type":"blocktext", "dty_Size":255, diff --git a/import/delimited/importCSV_lib.php b/import/delimited/importCSV_lib.php index cffe214fca..754ae60304 100644 --- a/import/delimited/importCSV_lib.php +++ b/import/delimited/importCSV_lib.php @@ -2530,11 +2530,11 @@ function doInsertUpdateRecord($recordId, $params, $details, $id_field, $mode_out */ function saveSession($mysqli, $imp_session){ - $imp_id = mysql__insertupdate($mysqli, "sysImportSessions", "imp", - array("imp_ID"=>@$imp_session["import_id"], - "ugr_id"=>get_user_id(), - "imp_table"=>$imp_session["import_name"], - "imp_session"=>json_encode($imp_session) )); + $imp_id = mysql__insertupdate($mysqli, "sysImportFiles", "sif", + array("sif_ID"=>@$imp_session["import_id"], + "sif_UGrpID"=>get_user_id(), + "sif_TempDataTable"=>$imp_session["import_name"], + "sif_Session"=>json_encode($imp_session) )); if(intval($imp_id)<1){ return "Cannot save session. SQL error:".$imp_id; @@ -2617,14 +2617,14 @@ function download_import_session($session_id, $idfield=null, $mode=1){ $ret = ""; $where = ""; if(is_numeric($session_id)){ - $where = " where imp_id=".$session_id; + $where = " where sif_ID=".$session_id; }else{ print "session id is not defined"; return; } $res = mysql__select_array2($mysqli, - "select imp_session from sysImportSessions".$where); + "select sif_Session from sysImportFiles".$where); //get field names and original filename $session = json_decode($res[0], true); @@ -2682,11 +2682,11 @@ function clear_import_session($session_id){ $ret = ""; $where = ""; if(is_numeric($session_id)){ - $where = " where imp_id=".$session_id; + $where = " where sif_ID=".$session_id; } $res = mysql__select_array3($mysqli, - "select imp_id, imp_session from sysImportSessions".$where); + "select sif_ID, sif_Session from sysImportFiles".$where); if(!$res){ $ret = "cannot get list of imported files"; @@ -2705,10 +2705,10 @@ function clear_import_session($session_id){ if($ret==""){ if($where==""){ - $where = " where imp_id>0"; + $where = " where sif_ID>0"; } - if (!$mysqli->query("delete from sysImportSessions ".$where)) { + if (!$mysqli->query("delete from sysImportFiles ".$where)) { $ret = "cannot delete data from list of imported files: " . $mysqli->error; }else{ $ret = "ok"; @@ -2732,7 +2732,7 @@ function get_import_session($mysqli, $import_id){ if($import_id && is_numeric($import_id)){ $res = mysql__select_array2($mysqli, - "select imp_session, imp_table from sysImportSessions where imp_id=".$import_id); + "select sif_Session, sif_TempDataTable from sysImportFiles where sif_ID=".$import_id); $session = json_decode($res[0], true); $session["import_id"] = $import_id; @@ -2754,18 +2754,30 @@ function get_list_import_sessions(){ global $mysqli; - $query = "CREATE TABLE IF NOT EXISTS `sysImportSessions` ( + /* + $query = "CREATE TABLE IF NOT EXISTS `sysImportFiles` ( `imp_ID` int(11) unsigned NOT NULL auto_increment, `ugr_ID` int(11) unsigned NOT NULL default 0, `imp_table` varchar(255) NOT NULL default '', `imp_session` text, PRIMARY KEY (`imp_ID`))"; + */ + + $query = "CREATE TABLE IF NOT EXISTS `sysImportFiles` ( + `sif_ID` int(11) unsigned NOT NULL auto_increment + COMMENT 'Sequentially generated ID for delimited text or other files imported into temporary tables ready for processing', + `sif_FileType` enum('delimited') NOT NULL Default 'delimited' COMMENT 'The type of file which has been read into a temporary table for this import', + `sif_UGrpID` int(11) unsigned NOT NULL default 0 COMMENT 'The user ID of the user who imported the file', + `sif_TempDataTable` varchar(255) NOT NULL default '' COMMENT 'The name of the temporary data table created by the import', + `sif_Session` text COMMENT 'Import session data', + PRIMARY KEY (`sif_ID`))"; + if (!$mysqli->query($query)) { return "SQL error: cannot create imported files table: " . $mysqli->error; } $ret = ''; - $query = "select imp_ID, imp_table from sysImportSessions"; //" where ugr_ID=".get_user_id(); + $query = "select sif_ID, sif_TempDataTable from sysImportFiles"; //" where sif_UGrpID=".get_user_id(); $res = $mysqli->query($query); if ($res){ while ($row = $res->fetch_row()){ From d1ddab69a06faf74d7b988db4580fca40f93077b Mon Sep 17 00:00:00 2001 From: Artem Osmakov Date: Sun, 11 Dec 2016 12:50:39 +0400 Subject: [PATCH 02/50] rename tmpUsrSession to sysSessionProgress --- common/php/dbMySqlWrappers.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/common/php/dbMySqlWrappers.php b/common/php/dbMySqlWrappers.php index bc204512e0..8d4a5fb2ee 100644 --- a/common/php/dbMySqlWrappers.php +++ b/common/php/dbMySqlWrappers.php @@ -521,7 +521,7 @@ function refValues($arr) { } // -// works with temporary table tmpUsrSession that allows trace long server side process like smarty report or csv import +// works with temporary table sysSessionProgress that allows trace long server side process like smarty report or csv import // function updateProgress($mysqli, $session_id, $is_init, $value){ @@ -534,20 +534,21 @@ function updateProgress($mysqli, $session_id, $is_init, $value){ if($is_init){ //check that session table exists - $from_res = $mysqli->query("show tables like 'tmpUsrSession'"); + $from_res = $mysqli->query("show tables like 'sysSessionProgress'"); if ($from_res && $from_res->num_rows > 0) { //remove old data //mysql_query('DELETE FtmpUsrSession where field_id<'.); }else{ //recreate - $mysqli->query('CREATE TABLE tmpUsrSession(field_id varchar(32) NOT NULL, field_data varchar(32), PRIMARY KEY (field_id))'); + $mysqli->query('CREATE TABLE sysSessionProgress(stp_ID varchar(32) NOT NULL COMMENT "User session ID generated by the server", stp_Data varchar(32) COMMENT "Stores progress data for the session identified by the session ID", PRIMARY KEY (utp_ID))'); + } } if($value==null){ - $query = "select field_data from tmpUsrSession where field_id=".$session_id; + $query = "select field_data from sysSessionProgress where stp_ID=".$session_id; $from_res = $mysqli->query($query); if ($from_res) { // && $from_res->num_rows > 0 $res = $from_res->fetch_row(); @@ -558,15 +559,15 @@ function updateProgress($mysqli, $session_id, $is_init, $value){ } }else if($value=='REMOVE'){ - $mysqli->query("DELETE FROM tmpUsrSession where field_id=".$session_id); + $mysqli->query("DELETE FROM sysSessionProgress where stp_ID=".$session_id); //error_log('DELTE '.$mysqli->error.' '.$mysqli->affected_rows); }else{ //write if($is_init){ - $query = "insert into tmpUsrSession values (".$session_id.",'".$value."')"; + $query = "insert into sysSessionProgress values (".$session_id.",'".$value."')"; $res = $mysqli->query($query); }else{ - $query = "update tmpUsrSession set field_data='".$value."' where field_id=".$session_id; + $query = "update sysSessionProgress set stp_Data='".$value."' where stp_ID=".$session_id; $res = $mysqli->query($query); } //$mysqli->commit(); From efb9d71d3d94b390cf347565da350ea51209b4dc Mon Sep 17 00:00:00 2001 From: Artem Osmakov Date: Mon, 12 Dec 2016 13:39:33 +0400 Subject: [PATCH 03/50] field sif_Session to sif_ProcessingInfo --- hclient/framecontent/import/importRecordsCSV.js | 2 +- hserver/controller/fileParse.php | 4 ++-- hserver/dbaccess/dbSysImportFiles.php | 6 +++--- import/delimited/importCSV_lib.php | 10 +++++----- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/hclient/framecontent/import/importRecordsCSV.js b/hclient/framecontent/import/importRecordsCSV.js index ea1f0a4349..490e0ef57c 100644 --- a/hclient/framecontent/import/importRecordsCSV.js +++ b/hclient/framecontent/import/importRecordsCSV.js @@ -402,7 +402,7 @@ function hImportRecordsCSV(_imp_ID, _max_upload_size) { var resp = new hRecordSet( response.data ); var record = resp.getFirstRecord(); - var ses = resp.fld(record, 'sif_Session'); + var ses = resp.fld(record, 'sif_ProcessingInfo '); //DEBUG $('#divFieldMapping2').html( ses ); imp_session = (typeof ses == "string") ? $.parseJSON(ses) : null; diff --git a/hserver/controller/fileParse.php b/hserver/controller/fileParse.php index 094f7ed93f..fb50baee84 100644 --- a/hserver/controller/fileParse.php +++ b/hserver/controller/fileParse.php @@ -803,7 +803,7 @@ function saveSession($imp_session){ array("sif_ID"=>@$imp_session["import_id"], "sif_UGrpID"=>$system->get_user_id(), "sif_TempDataTable"=>$imp_session["import_name"], - "sif_Session"=>json_encode($imp_session) )); + "sif_ProcessingInfo "=>json_encode($imp_session) )); if(intval($imp_id)<1){ return "Cannot save session. SQL error:".$imp_id; @@ -824,7 +824,7 @@ function getImportSession($imp_ID){ if($imp_ID && is_numeric($imp_ID)){ $res = mysql__select_array($system->get_mysqli(), - "select sif_Session, sif_TempDataTable from sysImportFiles where sif_ID=".$imp_ID); + "select sif_ProcessingInfo , sif_TempDataTable from sysImportFiles where sif_ID=".$imp_ID); $session = json_decode($res[0], true); $session["import_id"] = $imp_ID; diff --git a/hserver/dbaccess/dbSysImportFiles.php b/hserver/dbaccess/dbSysImportFiles.php index fdbc8cbea5..a3db026d30 100644 --- a/hserver/dbaccess/dbSysImportFiles.php +++ b/hserver/dbaccess/dbSysImportFiles.php @@ -42,7 +42,7 @@ public function init(){ `sif_FileType` enum('delimited') NOT NULL Default 'delimited' COMMENT 'The type of file which has been read into a temporary table for this import', `sif_UGrpID` int(11) unsigned NOT NULL default 0 COMMENT 'The user ID of the user who imported the file', `sif_TempDataTable` varchar(255) NOT NULL default '' COMMENT 'The name of the temporary data table created by the import', - `sif_Session` text COMMENT 'Import session data', + `sif_ProcessingInfo ` text COMMENT 'Primary record type, field matching selections, dependency list etc. created while processing the temporary data table', PRIMARY KEY (`sif_ID`))"; @@ -125,7 +125,7 @@ public function search(){ }else if(@$this->data['details']=='list'){ - $this->data['details'] = 'sif_ID,sif_TempDataTable,sif_Session'; + $this->data['details'] = 'sif_ID,sif_TempDataTable,sif_ProcessingInfo '; }else if(@$this->data['details']=='full'){ @@ -216,7 +216,7 @@ public function delete(){ $mysqli = $this->system->get_mysqli(); $res = mysql__select_all($mysqli, - "select sif_ID, sif_Session from sysImportFiles".$where, 1); + "select sif_ID, sif_ProcessingInfo from sysImportFiles".$where, 1); if(!$res){ $this->system->addError(HEURIST_NOT_FOUND, diff --git a/import/delimited/importCSV_lib.php b/import/delimited/importCSV_lib.php index 754ae60304..188616d56d 100644 --- a/import/delimited/importCSV_lib.php +++ b/import/delimited/importCSV_lib.php @@ -2534,7 +2534,7 @@ function saveSession($mysqli, $imp_session){ array("sif_ID"=>@$imp_session["import_id"], "sif_UGrpID"=>get_user_id(), "sif_TempDataTable"=>$imp_session["import_name"], - "sif_Session"=>json_encode($imp_session) )); + "sif_ProcessingInfo "=>json_encode($imp_session) )); if(intval($imp_id)<1){ return "Cannot save session. SQL error:".$imp_id; @@ -2624,7 +2624,7 @@ function download_import_session($session_id, $idfield=null, $mode=1){ } $res = mysql__select_array2($mysqli, - "select sif_Session from sysImportFiles".$where); + "select sif_ProcessingInfo from sysImportFiles".$where); //get field names and original filename $session = json_decode($res[0], true); @@ -2686,7 +2686,7 @@ function clear_import_session($session_id){ } $res = mysql__select_array3($mysqli, - "select sif_ID, sif_Session from sysImportFiles".$where); + "select sif_ID, sif_ProcessingInfo from sysImportFiles".$where); if(!$res){ $ret = "cannot get list of imported files"; @@ -2732,7 +2732,7 @@ function get_import_session($mysqli, $import_id){ if($import_id && is_numeric($import_id)){ $res = mysql__select_array2($mysqli, - "select sif_Session, sif_TempDataTable from sysImportFiles where sif_ID=".$import_id); + "select sif_ProcessingInfo , sif_TempDataTable from sysImportFiles where sif_ID=".$import_id); $session = json_decode($res[0], true); $session["import_id"] = $import_id; @@ -2769,7 +2769,7 @@ function get_list_import_sessions(){ `sif_FileType` enum('delimited') NOT NULL Default 'delimited' COMMENT 'The type of file which has been read into a temporary table for this import', `sif_UGrpID` int(11) unsigned NOT NULL default 0 COMMENT 'The user ID of the user who imported the file', `sif_TempDataTable` varchar(255) NOT NULL default '' COMMENT 'The name of the temporary data table created by the import', - `sif_Session` text COMMENT 'Import session data', + `sif_ProcessingInfo ` text COMMENT 'Primary record type, field matching selections, dependency list etc. created while processing the temporary data table', PRIMARY KEY (`sif_ID`))"; if (!$mysqli->query($query)) { From f8ea95b1ea716b06befe862560bea9cbdd715927 Mon Sep 17 00:00:00 2001 From: Artem Osmakov Date: Mon, 12 Dec 2016 13:39:56 +0400 Subject: [PATCH 04/50] Bug in rule Builder - restore "any relation" type --- hclient/widgets/search/ruleBuilder.js | 17 ++++++++++++++++- hclient/widgets/search/svs_edit.js | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/hclient/widgets/search/ruleBuilder.js b/hclient/widgets/search/ruleBuilder.js index ca1952193c..06f94fcdb3 100644 --- a/hclient/widgets/search/ruleBuilder.js +++ b/hclient/widgets/search/ruleBuilder.js @@ -675,6 +675,10 @@ $.widget( "heurist.ruleBuilder", { linktype = (fld && fld.isreverse)?3:4; //relatiom to/from } } + + if(window.hWin.HEURIST4.util.isempty(rel_term_id) || rel_term_id<1){ + rel_term_id = ''; + } return [rt_source, dt_ID, rel_term_id, rt_target, filter, linktype]; }, @@ -735,7 +739,18 @@ $.widget( "heurist.ruleBuilder", { this.select_fields.val(dt_ID); this._onSelectFieldtype(); - this.select_reltype.val(window.hWin.HEURIST4.util.isempty(rel_type)?'pointer':rel_type); + if(isNaN(linktype) || linktype<0 || linktype>4){ + linktype = 0; + } + if(window.hWin.HEURIST4.util.isempty(rel_type)){ + if(linktype==1 || linktype==2){ + rel_type = 'pointer'; + }else{ + rel_type = ''; + } + } + + this.select_reltype.val(rel_type); this.select_target_rectype.val(rt_target); this.additional_filter.val(filter); diff --git a/hclient/widgets/search/svs_edit.js b/hclient/widgets/search/svs_edit.js index 039162c38c..85efdd63f3 100644 --- a/hclient/widgets/search/svs_edit.js +++ b/hclient/widgets/search/svs_edit.js @@ -339,7 +339,7 @@ function hSvsEdit(args) { if(bValid){ - var bOk = window.hWin.HEURIST4.msg.checkLength( svs_query, "Query", null, 1 ); + var bOk = isRules || window.hWin.HEURIST4.msg.checkLength( svs_query, "Query", null, 1 ); if(!bOk) bOk = window.hWin.HEURIST4.msg.checkLength( svs_rules, "Rules", null, 1 ); if(!bOk){ message.text("Define query, rules or both."); From c7f56a6a889fe93e9e43fbcf6710433672fd6b92 Mon Sep 17 00:00:00 2001 From: Artem Osmakov Date: Mon, 12 Dec 2016 18:01:01 +0400 Subject: [PATCH 05/50] timemap: fix duplication for startDate --- hclient/core/recordset.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hclient/core/recordset.js b/hclient/core/recordset.js index 1f2a07a5c7..b593ea8da5 100644 --- a/hclient/core/recordset.js +++ b/hclient/core/recordset.js @@ -174,8 +174,8 @@ function hRecordSet(initdata) { recID = _getFieldValue(record, 'rec_ID'), recName = _getFieldValue(record, 'rec_Title'), - startDate = _getFieldValue(record, 'dtl_StartDate'), - endDate = _getFieldValue(record, 'dtl_EndDate'), + //startDate = _getFieldValue(record, 'dtl_StartDate'), + //endDate = _getFieldValue(record, 'dtl_EndDate'), description = _getFieldValue(record, 'dtl_Description'), recThumb = _getFieldValue(record, 'rec_ThumbnailURL'), recShape = _getFieldValue(record, 'rec_Shape'), //additional shapes - special field created on client side From 88d747ac9a517abd005ce173740cf8ed3a8f9b93 Mon Sep 17 00:00:00 2001 From: Artem Osmakov Date: Mon, 12 Dec 2016 18:10:09 +0400 Subject: [PATCH 06/50] verification report: ignore temp records, change report output --- admin/verification/listDatabaseErrors.php | 39 ++++++++++++----------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/admin/verification/listDatabaseErrors.php b/admin/verification/listDatabaseErrors.php index 80da2edf6b..8fa2f0c28b 100644 --- a/admin/verification/listDatabaseErrors.php +++ b/admin/verification/listDatabaseErrors.php @@ -236,7 +236,7 @@ function _callback(context){ $query = 'delete d from recDetails d left join defDetailTypes dt on dt.dty_ID = d.dtl_DetailTypeID - left join Records b on b.rec_ID = d.dtl_Value + left join Records b on b.rec_ID = d.dtl_Value and rec_FlagTemporary!=1 where dt.dty_Type = "resource" and b.rec_ID is null'; $res = mysql_query( $query ); @@ -252,7 +252,7 @@ function _callback(context){ from recDetails left join defDetailTypes on dty_ID = dtl_DetailTypeID left join Records a on a.rec_ID = dtl_RecID - left join Records b on b.rec_ID = dtl_Value + left join Records b on b.rec_ID = dtl_Value and rec_FlagTemporary!=1 where dty_Type = "resource" and a.rec_ID is not null and b.rec_ID is null'); @@ -311,7 +311,7 @@ function _callback(context){ $res = mysql_query('select dtl_RecID, dty_Name, dty_PtrTargetRectypeIDs, rec_ID, rec_Title, rty_Name from defDetailTypes left join recDetails on dty_ID = dtl_DetailTypeID - left join Records on rec_ID = dtl_Value + left join Records on rec_ID = dtl_Value and rec_FlagTemporary!=1 left join defRecTypes on rty_ID = rec_RecTypeID where dty_Type = "resource" and dty_PtrTargetRectypeIDs > 0 @@ -370,7 +370,7 @@ function _callback(context){ //find all fields with faulty dates $res = mysql_query('select dtl_ID, dtl_RecID, dtl_Value, a.rec_Title from recDetails, defDetailTypes, Records a - where (a.rec_ID = dtl_RecID) and (dty_ID = dtl_DetailTypeID) + where (a.rec_ID = dtl_RecID) and (dty_ID = dtl_DetailTypeID) and (rec_FlagTemporary!=1) and (dty_Type = "date") and (dtl_Value is not null)'); $wascorrected = 0; @@ -542,10 +542,10 @@ function _callback(context){

Records with terms not in the list of terms specified for the field

- (show results as search) + (show results as search) - - + + @@ -580,15 +580,17 @@ function _callback(context){ } ?> - - + - + 1'); @@ -699,7 +702,7 @@ function _callback(context){ left join defRecStructure on rst_RecTypeID = rec_RecTypeID left join recDetails on rec_ID = dtl_RecID and rst_DetailTypeID = dtl_DetailTypeID left join defDetailTypes on dty_ID = rst_DetailTypeID - where rst_RequirementType='required' and (dtl_Value is null or dtl_Value='') + where rec_FlagTemporary!=1 and rst_RequirementType='required' and (dtl_Value is null or dtl_Value='') and dtl_UploadedFileID is null and dtl_Geo is null and dty_Type!='separator' order by rec_ID"); @@ -775,7 +778,7 @@ function _callback(context){ left join recDetails on rec_ID = dtl_RecID left join defDetailTypes on dty_ID = dtl_DetailTypeID left join defRecStructure on rst_RecTypeID = rec_RecTypeID and rst_DetailTypeID = dtl_DetailTypeID - where rst_ID is null + where rec_FlagTemporary!=1 and rst_ID is null "); $bibs = array(); From 5024b6db3e6fb6535adbe128f1313426d12162bf Mon Sep 17 00:00:00 2001 From: Artem Osmakov Date: Mon, 12 Dec 2016 18:49:37 +0400 Subject: [PATCH 07/50] list database errors: Fix query to check wrong relation types --- admin/verification/listDatabaseErrors.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/verification/listDatabaseErrors.php b/admin/verification/listDatabaseErrors.php index 8fa2f0c28b..0f14c84b54 100644 --- a/admin/verification/listDatabaseErrors.php +++ b/admin/verification/listDatabaseErrors.php @@ -544,7 +544,7 @@ function _callback(context){ $res = mysql_query('select dtl_ID, dtl_RecID, dty_Name, dtl_Value, dty_ID, dty_JsonTermIDTree, dty_TermIDTreeNonSelectableIDs, rec_Title, rec_RecTypeID, rty_Name, trm_Label from Records, recDetails left join defTerms on dtl_Value=trm_ID, defDetailTypes, defRecTypes - where rec_ID = dtl_RecID and dty_ID = dtl_DetailTypeID and (dty_Type = "enum" or dty_Type = "relationtype") + where rec_ID = dtl_RecID and dty_ID = dtl_DetailTypeID and (dty_Type = "enum" or dty_Type = "relmarker") and dtl_Value is not null and rec_RecTypeID=rty_ID and rec_FlagTemporary!=1 order by dtl_DetailTypeID'); /* From bb15ae9d39058d5cf6da1a11cec6b4f71b0f1a9f Mon Sep 17 00:00:00 2001 From: Artem Osmakov Date: Mon, 12 Dec 2016 18:50:53 +0400 Subject: [PATCH 08/50] list database errors: replace relationtype to relmarker in queries --- admin/verification/listDatabaseErrors.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/admin/verification/listDatabaseErrors.php b/admin/verification/listDatabaseErrors.php index 0f14c84b54..3f74627a02 100644 --- a/admin/verification/listDatabaseErrors.php +++ b/admin/verification/listDatabaseErrors.php @@ -463,7 +463,7 @@ function _callback(context){ $query = 'delete d from recDetails d left join defDetailTypes dt on dt.dty_ID = d.dtl_DetailTypeID left join defTerms b on b.trm_ID = d.dtl_Value - where dt.dty_Type = "enum" or dt.dty_Type = "relationtype" + where dt.dty_Type = "enum" or dt.dty_Type = "relmarker" and b.trm_ID is null'; $res = mysql_query( $query ); if(! $res ) @@ -480,7 +480,7 @@ function _callback(context){ left join defDetailTypes on dty_ID = dtl_DetailTypeID left join Records a on a.rec_ID = dtl_RecID left join defTerms b on b.trm_ID = dtl_Value - where (dty_Type = "enum" or dty_Type = "relationtype") and dtl_Value is not null + where (dty_Type = "enum" or dty_Type = "relmarker") and dtl_Value is not null and a.rec_ID is not null and b.trm_ID is null'); $bibs = array(); @@ -552,7 +552,7 @@ function _callback(context){ from defDetailTypes left join recDetails on dty_ID = dtl_DetailTypeID left join Records on rec_ID = dtl_RecID - where dty_Type = "enum" or dty_Type = "relationtype" + where dty_Type = "enum" or dty_Type = "relmarker" order by dtl_DetailTypeID'*/ $bibs = array(); $ids = array(); From f2a0af87c7a0b252c7a63aa09365e8458281a349 Mon Sep 17 00:00:00 2001 From: Artem Osmakov Date: Tue, 13 Dec 2016 12:09:50 +0400 Subject: [PATCH 09/50] move databaseSummery into visualization folder --- hclient/framecontent/tabmenus/manageMenu.js | 2 +- hclient/framecontent/tabmenus/manageMenu.php | 2 +- .../framecontent/{ => visualize}/databaseSummary.php | 11 ++++++----- hclient/widgets/dropdownmenus/mainMenuDatabase.html | 2 +- hclient/widgets/search/svs_list.js | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) rename hclient/framecontent/{ => visualize}/databaseSummary.php (96%) diff --git a/hclient/framecontent/tabmenus/manageMenu.js b/hclient/framecontent/tabmenus/manageMenu.js index 91aa9cb39d..33ef42f534 100644 --- a/hclient/framecontent/tabmenus/manageMenu.js +++ b/hclient/framecontent/tabmenus/manageMenu.js @@ -31,7 +31,7 @@ function hmanageMenu() { // function _showDbSummary(){ - var url = window.hWin.HAPI4.basePathV4+ "hclient/framecontent/databaseSummary.php?popup=1&db=" + window.hWin.HAPI4.database; + var url = window.hWin.HAPI4.basePathV4+ "hclient/framecontent/visualize/databaseSummary.php?popup=1&db=" + window.hWin.HAPI4.database; var body = $(top.document).find('body'); var dim = {h:body.innerHeight(), w:body.innerWidth()}; diff --git a/hclient/framecontent/tabmenus/manageMenu.php b/hclient/framecontent/tabmenus/manageMenu.php index 5a67f277eb..a8709f9931 100644 --- a/hclient/framecontent/tabmenus/manageMenu.php +++ b/hclient/framecontent/tabmenus/manageMenu.php @@ -133,7 +133,7 @@ function onPageInit(success){
  • - diff --git a/hclient/framecontent/databaseSummary.php b/hclient/framecontent/visualize/databaseSummary.php similarity index 96% rename from hclient/framecontent/databaseSummary.php rename to hclient/framecontent/visualize/databaseSummary.php index 1df765a112..d2c9b36ae4 100644 --- a/hclient/framecontent/databaseSummary.php +++ b/hclient/framecontent/visualize/databaseSummary.php @@ -20,7 +20,8 @@ * See the License for the specific language governing permissions and limitations under the License. */ -require_once(dirname(__FILE__)."/initPage.php"); +if(!defined('PDIR')) define('PDIR','../../../'); +require_once(dirname(__FILE__)."/../initPage.php"); ?> - - - - - + + - - + + - - - - - - - + + + + + + + + @@ -83,7 +70,7 @@ function showData(data, selectedRecordsIds, onSelectEvent) { // Custom data parsing function getData(data) { - console.log("Custom getData() call"); + //console.log("Custom getData() call"); return data; } diff --git a/hclient/framecontent/visualize/visualize.html b/hclient/framecontent/visualize/visualize.html index 1ef8bfc372..9f6d2e2a93 100644 --- a/hclient/framecontent/visualize/visualize.html +++ b/hclient/framecontent/visualize/visualize.html @@ -28,7 +28,7 @@
  • RecordFieldTermsFieldTerm Record title
    + '> + href='../../records/edit/editRecord.html?db=&recID='> + 
    '; - info += ''; + info += '
    Field nameField typeData typeStatus
    '; + info += ''; + info += ''; + info += ''; + info += ''; // 0 = rst_DisplayName // 1 = dty_Name @@ -355,10 +358,12 @@ function(obj) { dtyStatus = rectypeStructures[rty_ID][i][3]; }; info += ""; + ""; } info += "
    Already in DB?Field name (used for this record type)Base field name (shared across record types)Field data type
    " + (rectypeStructures[rty_ID][i][5] == 1? "(imported) " : "") + rectypeStructures[rty_ID][i][0] + - "" + rectypeStructures[rty_ID][i][1] + - "" + dtlookups[rectypeStructures[rty_ID][i][2]] + - "" + dtyStatus + "
    " + (rectypeStructures[rty_ID][i][5] == 1? "exists" : "NEW") + + "" + rectypeStructures[rty_ID][i][0] + + "" + rectypeStructures[rty_ID][i][1] + + "" + dtlookups[rectypeStructures[rty_ID][i][2]] + + // unecessary detail: "" + dtyStatus + + "

    "; obj.liner_element.innerHTML += info; From 8ab99704f3b0bc3295845e41f63217e5b70fbd71 Mon Sep 17 00:00:00 2001 From: Artem Osmakov Date: Tue, 3 Jan 2017 10:34:27 +0400 Subject: [PATCH 43/50] DH: support Place function as mapping type, cosmetics --- h4styles.css | 2 +- hclient/core/recordset.js | 25 +- hclient/widgets/digital_harlem/dh_popup.php | 42 ++- .../digital_harlem/dh_search_minimal.js | 242 +++++++++++++----- hclient/widgets/digital_harlem/dh_style.css | 9 + .../widgets/digital_harlem/dh_style1935.css | 9 + 6 files changed, 250 insertions(+), 79 deletions(-) diff --git a/h4styles.css b/h4styles.css index dcc8ac56f3..deba4c2b16 100644 --- a/h4styles.css +++ b/h4styles.css @@ -661,7 +661,7 @@ div .selected_last{ left: 2px; right: 2px; height: 25px; - width: 180px; +/* width: 180px; */ } .thumbs2 .recordDiv .recTypeThumb{ diff --git a/hclient/core/recordset.js b/hclient/core/recordset.js index b593ea8da5..d2a4a531d2 100644 --- a/hclient/core/recordset.js +++ b/hclient/core/recordset.js @@ -488,9 +488,9 @@ function hRecordSet(initdata) { if(fldname=="dtl_Geo"){ g.shift() - return g.join(' '); + return g.join(' '); //return coordinates only }else{ - return g[0]; ////take first part of dtl_Geo field - "p wkt" + return g[0]; //return geotype - first part of dtl_Geo field - "p wkt" } } @@ -542,14 +542,27 @@ function hRecordSet(initdata) { /** * Returns field value by fieldname for given record */ - fld: function(record, fldname){ - return _getFieldValue(record, fldname); + fld: function(record, fldName){ + return _getFieldValue(record, fldName); }, - setFld: function(record, fldname, value){ - _setFieldValue(record, fldname, value); + setFld: function(record, fldName, value){ + _setFieldValue(record, fldName, value); }, + // assign value of field from one record to another + // + transFld: function(recordTo, recordFrom, fldName, isNoNull){ + + var value = _getFieldValue(recordFrom, fldName); + if( window.hWin.HEURIST4.util.isempty(value) && isNoNull) { + return false + }else{ + _setFieldValue(recordTo, fldName, value); + return true; + } + }, + /** * returns record by id * diff --git a/hclient/widgets/digital_harlem/dh_popup.php b/hclient/widgets/digital_harlem/dh_popup.php index e214806dd7..5d1a7d1ffe 100644 --- a/hclient/widgets/digital_harlem/dh_popup.php +++ b/hclient/widgets/digital_harlem/dh_popup.php @@ -54,16 +54,16 @@ $eventID = @$_REQUEST['eventID']; - if($eventID) { $ids = $ids.','.$eventID; $need_cnt++;} + if($eventID) { array_push($ids, $eventID); $need_cnt++;} $addrID = @$_REQUEST['addrID']; - if($addrID) { $ids = $ids.','.$addrID; $need_cnt++;} + if($addrID) { array_push($ids, $addrID); $need_cnt++;} //find record and details - $records = recordSearch_2('ids:'.$ids); + $records = recordSearch_2('ids:'.implode(',',$ids)); if(count(@$records['records'])<$need_cnt){ - echo 'Some records not found '.$ids.' '.print_r($records,true); + echo 'Some records not found '.implode(',',$ids).' '.print_r($records,true); return; } @@ -124,13 +124,39 @@ Date: '); +?> + +
    +

    +

    + +

    +

    + +

    +   +

    + +
    + +0){ + if($entities_per_address>1){ $moredetailLink = $moredetailLink.'

    '. + 'onClick="window.hWin.HEURIST4.msg.showDialog(\''.$_SERVER['SCRIPT_NAME'].'?recID='.$addrID.'&full=1\');">'. ($entities_per_address-1).' more event'.($entities_per_address>2?'s':'').' at this address

    '; } diff --git a/hclient/widgets/digital_harlem/dh_search_minimal.js b/hclient/widgets/digital_harlem/dh_search_minimal.js index b1ae40ab64..98318bba99 100644 --- a/hclient/widgets/digital_harlem/dh_search_minimal.js +++ b/hclient/widgets/digital_harlem/dh_search_minimal.js @@ -202,6 +202,7 @@ function hSearchMinimalDigitalHarlem() { var RT_ADDRESS = 12, RT_EVENT = 14, RT_PERSON = 10, + RT_PLACE_FUNCTION = 16, RT_RELATION = 1; DT_TARGET_RESOURCE = 5, DT_RELATION_TYPE = 6, @@ -212,11 +213,12 @@ function hSearchMinimalDigitalHarlem() { DT_DATE = 9, DT_STARTDATE = 10, DT_ENDDATE = 11, - DT_GEO = 28, + DT_GEO = 28, //window.hWin.HAPI4.sysinfo['dbconst']['DT_GEO_OBJECT']; //28 DT_EVENT_TYPE = 74, DT_EVENT_TIME = 75, DT_EVENT_TIME_END = 76, DT_EVENT_ORDER = 94; //Order of addresses within a serial event, eg. a march or multi-stage crime + DT_USAGE_TYPE = 89; //usage type terms for place functions //constants for relation types var TERM_MAIN_CRIME_LOCATION = 4536, //primary event location @@ -260,7 +262,7 @@ function hSearchMinimalDigitalHarlem() { var rec = recordset.getFirstRecord(); primary_rt = Number(recordset.fld(rec, 'rec_RecTypeID')); } -//console.log('primary '+primary_rt); +console.log('primary '+primary_rt); var is_Riot = ''; if(window.hWin.HAPI4.sysinfo['layout']=='DigitalHarlem1935'){ @@ -275,6 +277,8 @@ function hSearchMinimalDigitalHarlem() { var recID = recordset.fld(record, 'rec_ID'); var recTypeID = Number(recordset.fld(record, 'rec_RecTypeID')); + var record_result = null; + if(recTypeID == RT_ADDRESS){ var shtml = ''; @@ -283,6 +287,7 @@ function hSearchMinimalDigitalHarlem() { var rels = recordset.getRelationRecords(recID, null); if(rels.length<1){ // no relations + //this is just address recordset.setFld(record, 'rec_Icon', 'term4326' ); recordset.setFld(record, 'rec_RecTypeID', DH_RECORDTYPE); //special record type to distiguish @@ -290,9 +295,61 @@ function hSearchMinimalDigitalHarlem() { window.hWin.HAPI4.basePathV4 + "hclient/widgets/digital_harlem/dh_popup.php?db=" +window.hWin.HAPI4.database+"&recID="+recID+is_Riot); + var addr_geo = recordset.fld(record, DT_GEO); + if( window.hWin.HEURIST4.util.isempty(addr_geo)) { + //exclude addresses without geo + console.log('address '+recID+' has no geo'); + continue; + } + //console.log('address '+recID+' '+addr_geo); + + record_result = record; + res_records[recID] = record_result; + res_orders.push(recID); + }else{ - if(primary_rt==RT_EVENT){ + if(primary_rt==RT_PLACE_FUNCTION){ + + var events_per_address = []; + + for(i=0; iRecord linking fields A simple connection to another record, normally constrained to specific target record type(s). Use where the field represents a direct connection and is permanent eg.parent, author, component, place, period. more... -
    @@ -195,7 +194,6 @@

    Record linking fields

    A more complex connection which allows specification of relationship type and period of validity. Use where there are numerous possible connection types and/or connections have a time span eg.roles in an event, social relationships, ownership, marriage, address. more... -
    diff --git a/admin/structure/fields/selectFieldType.js b/admin/structure/fields/selectFieldType.js index ce59fb1b23..34ba3a66e9 100644 --- a/admin/structure/fields/selectFieldType.js +++ b/admin/structure/fields/selectFieldType.js @@ -140,10 +140,14 @@ $(document).ready(function() { $(container).find('[name="savebutton"]').css('color','lightgray').prop('disabled','disabled'); - $('#hint_more_info1').click(function(){ top.HEURIST.util.popupElement(window, document.getElementById('div_more_info1'), - {'title':'More info', 'close-on-blur':true}); }); - $('#hint_more_info2').click(function(){ top.HEURIST.util.popupElement(window, document.getElementById('div_more_info2'), - {'title':'More info', 'close-on-blur':true}); }); + top.HEURIST4.ui.initHelper( $('#hint_more_info1'), + 'Field data type: Record pointer', + top.HAPI4.basePathV3+'context_help/field_data_types.html #resource', + { my: "left+200 top+100", at: "center center", of:$(document.body)}, true); + top.HEURIST4.ui.initHelper( $('#hint_more_info2'), + 'Field data type: Relationship marker', + top.HAPI4.basePathV3+'context_help/field_data_types.html #relmarker', + { my: "left+200 top+100", at: "center center", of:$(document.body)}, true); $('.input-cell > .prompt').hide(); //hide help text $('.input-header-cell').css({'width':'0','min-width':'15ex','font-size':'0.8em'}); diff --git a/admin/structure/fields/selectLinkField.html b/admin/structure/fields/selectLinkField.html index a95d094fad..0765c35bd1 100644 --- a/admin/structure/fields/selectLinkField.html +++ b/admin/structure/fields/selectLinkField.html @@ -96,7 +96,6 @@ A simple connection to another record, normally constrained to specific target record type(s). Use where the field represents a direct connection and is permanent eg.parent, author, component, place, period. more...
    -
    @@ -108,7 +107,6 @@ A more complex connection which allows specification of relationship type and period of validity. Use where there are numerous possible connection types and/or connections have a time span eg.roles in an event, social relationships, ownership, marriage, address. more...
    -
    diff --git a/admin/structure/fields/selectLinkField.js b/admin/structure/fields/selectLinkField.js index ba1927cd40..b040cd6db7 100644 --- a/admin/structure/fields/selectLinkField.js +++ b/admin/structure/fields/selectLinkField.js @@ -75,24 +75,14 @@ $(document).ready(function() { function onScriptsReady(){ - $('#hint_more_info1').click(function(){ - top.HEURIST4.msg.showElementAsDialog( - {elements: document.getElementById('div_more_info1'), title:'More info', 'close-on-blur':true}); - }); - $('#hint_more_info2').click(function(){ - top.HEURIST4.msg.showElementAsDialog( - {elements: document.getElementById('div_more_info2'), title:'More info', 'close-on-blur':true}); - }); - - $('input[name="ft_type"]').change(function(){ - if(!target_ID){ - top.HEURIST4.msg.showMsgDlg('Select target record type first'); - }else{ - $('#btnSelect').removeProp('disabled'); - $('#btnSelect').css('color','black'); - } - }); - + top.HEURIST4.ui.initHelper( $('#hint_more_info1'), + 'Field data type: Record pointer', + top.HAPI4.basePathV3+'context_help/field_data_types.html #resource', + { my: "left+200 top+100", at: "center center", of:$(document.body)}, true); + top.HEURIST4.ui.initHelper( $('#hint_more_info2'), + 'Field data type: Relationship marker', + top.HAPI4.basePathV3+'context_help/field_data_types.html #relmarker', + { my: "left+200 top+100", at: "center center", of:$(document.body)}, true); $('#btnSelect').click( editDetailType ); //rectype new field to be added to @@ -108,6 +98,8 @@ $(document).ready(function() { target_ID = $(this).val(); if(!target_ID){ top.HEURIST4.util.setDisabled($('.ft_selfield'), true); + top.HEURIST4.util.setDisabled($('#btnSelect'), true); + $('#btnSelect').css('color','lightgray'); $('.ft_selfield').css('color','lightgray'); }else{ @@ -120,6 +112,9 @@ $(document).ready(function() { $('#sel_resource_fields').val(''); $('#sel_relmarker_fields').val(''); $('#t_resourse').attr('checked', true); + + top.HEURIST4.util.setDisabled($('#btnSelect'), false); + $('#btnSelect').css('color','black'); } $(window.frameElement).parents('.ui-dialog').find('.ui-dialog-title').text(sDialogTitle); } diff --git a/context_help/field_data_types.html b/context_help/field_data_types.html new file mode 100644 index 0000000000..b9795120be --- /dev/null +++ b/context_help/field_data_types.html @@ -0,0 +1,42 @@ + + + + HEURIST Context Help - Database structure: Fields data types + + + + +
    + +

    Database structure: Fields data types

    + +
    + +
    +

    Freetext

    + +

    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum

    +
    + +
    +

    Numeric

    + +

    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum

    +
    + +
    +

    Record pointer

    + +

    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum

    +
    + +
    +

    Relationship marker

    + +

    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum

    +
    +
    + + + + diff --git a/hclient/core/utils_ui.js b/hclient/core/utils_ui.js index d4a5cb80d2..f56845e274 100644 --- a/hclient/core/utils_ui.js +++ b/hclient/core/utils_ui.js @@ -1019,12 +1019,15 @@ window.hWin.HEURIST4.ui = { // // position top|button- @todo auto detect position // - initHelper: function(help_button, content_title, content_url, position){ + initHelper: function(help_button, content_title, content_url, position, nobutton){ var $help_button = $(help_button); - $help_button.button({icons: { primary: "ui-icon-circle-b-info" }, label:'Show context help', text:false}) - .on('click', function(){ + if(nobutton!==true){ + $help_button.button({icons: { primary: "ui-icon-circle-b-info" }, label:'Show context help', text:false}); + } + + $help_button.on('click', function(){ var $helper_div = $(document.body).find('#helper'); if($helper_div.length==0){ @@ -1053,18 +1056,22 @@ window.hWin.HEURIST4.ui = { //var div_height = Math.min(500, (document.body).height()-$help_button.top()); //var div_width = Math.min(600, (document.body).width() *0.8); divpos = null; - if(position=='top'){ //show div aboe button + if($.isPlainObject(position)){ + divpos = position; + //divpos['of'] = $help_button; + }else if(position=='top'){ //show div above button divpos = { my: "right bottom", at: "right top", of: $help_button } }else{ divpos = { my: "right top", at: "right bottom", of: $help_button }; } + $helper_div.load(content_url, function(){ var div_height = Math.min(500, $(document.body).height()-$help_button.position().top); var div_width = Math.min(700, $(document.body).width() *0.8); - - var title = 'Heurist context help'; + + var title = (content_title)?content_title:'Heurist context help'; var head = $helper_div.find('#content>h2'); if(head.length==1){ title = head.text(); From 9026e79ff68395cc3f546e5087b62933c05acbd6 Mon Sep 17 00:00:00 2001 From: Artem Osmakov Date: Tue, 3 Jan 2017 10:35:26 +0400 Subject: [PATCH 45/50] faceted search - hide reset button for direct input and select --- hclient/widgets/search/search_faceted.js | 41 +++++++++++++++++------- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/hclient/widgets/search/search_faceted.js b/hclient/widgets/search/search_faceted.js index f45072fd71..a3adeddcf2 100644 --- a/hclient/widgets/search/search_faceted.js +++ b/hclient/widgets/search/search_faceted.js @@ -502,6 +502,7 @@ $.widget( "heurist.search_faceted", { }; } +console.log('inpt added '+"fv_"+field['var']); var inpt = $("
    ",{id: "fv_"+field['var'] }).editing_input( //this is our widget for edit given fieldtype value ed_options @@ -518,17 +519,34 @@ $.widget( "heurist.search_faceted", { //assign event listener //var $inputs = inpt.editing_input('getInputs'); that._on( inpt.find('input'), { - keypress: - function(e){ - var code = (e.keyCode ? e.keyCode : e.which); - if (code == 13) { - window.hWin.HEURIST4.util.stopEvent(e); - e.preventDefault(); - that.doSearch(); + keypress: + function(e){ + var code = (e.keyCode ? e.keyCode : e.which); + if (code == 13) { + window.hWin.HEURIST4.util.stopEvent(e); + e.preventDefault(); + that.doSearch(); + } + }, + keyup: function(e){ + var btn_reset = inpt.find('.resetbutton'); + if($(e.target).val()==''){ + btn_reset.css('visibility','hidden'); + }else{ + btn_reset.css('visibility','visible'); + } } - }}); + }); that._on( inpt.find('select'), { - change: "doSearch"}); + change: function(e){ + var btn_reset = inpt.find('.resetbutton'); + if($(e.target).val()==''){ + btn_reset.css('visibility','hidden'); + }else{ + btn_reset.css('visibility','visible'); + } + that.doSearch(); + }});//"doSearch"}); inpt.find('input').removeClass('text').css({'width':'150px'}); inpt.find('select').removeClass('text').css({'width':'150px'}); @@ -542,11 +560,12 @@ $.widget( "heurist.search_faceted", { var btn_clear = $( "") .insertBefore( inpt.find('.input-cell .input-div') ) - .addClass("ui-icon ui-icon-arrowreturnthick-1-w") - .css({'display':'inline-block', 'font-size':'0.9em', 'vertical-align':'middle'}); + .addClass("ui-icon ui-icon-arrowreturnthick-1-w resetbutton") + .css({'display':'inline-block', 'visibility':'hidden', 'font-size':'0.9em', 'vertical-align':'middle'}) that._on( btn_clear, { click: function(){ inpt.find('input').val(''); inpt.find('select').val(''); + inpt.find('.resetbutton').css('visibility','hidden'); that.doSearch(); } }); From 60ec103ced3179fb78efb518539b8a0192c99562 Mon Sep 17 00:00:00 2001 From: Artem Osmakov Date: Tue, 3 Jan 2017 10:35:51 +0400 Subject: [PATCH 46/50] temporary: debug error log --- hserver/dbaccess/compose_sql_new.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/hserver/dbaccess/compose_sql_new.php b/hserver/dbaccess/compose_sql_new.php index 836e81e287..5777906efa 100644 --- a/hserver/dbaccess/compose_sql_new.php +++ b/hserver/dbaccess/compose_sql_new.php @@ -98,6 +98,9 @@ $wg_ids = null; $publicOnly = false; +//keep params for debug only! +$params_global; + /* [{"t":14},{"f:74":"X0"}, @@ -117,7 +120,9 @@ // function get_sql_query_clauses_NEW($db, $params, $currentUser=null){ - global $mysqli, $wg_ids, $publicOnly; + global $mysqli, $wg_ids, $publicOnly, $params_global; + + $params_global = $params; $mysqli = $db; @@ -1024,9 +1029,14 @@ function makeDateClause() { */ function getFieldValue( ){ - global $mysqli; + global $mysqli, $params_global; //@todo between , datetime, terms + if(is_array($this->value)){ + error_log('value expected string - array given'); + error_log(print_r($params_global,true)); + $this->value = reset($this->value); + } // if (strpos($this->value,"<>")===false) { From e4fe191f66fb85e9027b66bb4c3eaf37cfb5650d Mon Sep 17 00:00:00 2001 From: Artem Osmakov Date: Tue, 3 Jan 2017 10:36:25 +0400 Subject: [PATCH 47/50] Fix recsearch for rules on retrieving relationship in case parent set is empty --- hserver/dbaccess/db_recsearch.php | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/hserver/dbaccess/db_recsearch.php b/hserver/dbaccess/db_recsearch.php index e7159b942e..6aa06091c0 100644 --- a/hserver/dbaccess/db_recsearch.php +++ b/hserver/dbaccess/db_recsearch.php @@ -634,7 +634,7 @@ function recordSearch($system, $params) $is_ids_only ?$response['data']['records'] :array_keys($response['data']['records'])); } - if($is_get_relation_records && (strpos($params3['q'],"related_to")>0 || strpos($params3['q'],"relatedfrom")>0) ){ //find relation records (recType=1) + if($is_get_relation_records && (strpos($params3['q'],"related_to")>0 || strpos($params3['q'],"relatedfrom")>0) ){ //find relationship records (recType=1) //create query to search related records if (strcasecmp(@$params3['w'],'B') == 0 || strcasecmp(@$params3['w'], 'bookmark') == 0) { @@ -650,10 +650,18 @@ function recordSearch($system, $params) $fld1 = "rl_SourceID"; $fld2 = "rl_TargetID"; } + + $ids_party1 = $params3['topids']; + $ids_party2 = $is_ids_only?$response['data']['records'] :array_keys($response['data']['records']); + + if(is_array($ids_party2) && count($ids_party2)>0) + { - $where = "WHERE (TOPBIBLIO.rec_ID in (select rl_RelationID from recLinks where (rl_RelationID is not null) and $fld1 in (" - .$params3['topids'].") and $fld2 in (" - .implode(",", $is_ids_only ?$response['data']['records'] :array_keys($response['data']['records'])).")))"; +//error_log('get related '.$params3['q'].' '.implode(",",$ids_party2)); + + $where = "WHERE (TOPBIBLIO.rec_ID in (select rl_RelationID from recLinks " + ."where (rl_RelationID is not null) and $fld1 in (" + .$ids_party1.") and $fld2 in (".implode(",", $ids_party2).")))"; $params2 = $params3; unset($params2['topids']); @@ -687,6 +695,8 @@ function recordSearch($system, $params) } */ } + }//array of ids is defined + } //$is_get_relation_records }else{ @@ -769,6 +779,8 @@ function recordSearch($system, $params) $res = $mysqli->query($query); if (!$res){ + +error_log('params '.print_r($params, true)); $response = $system->addError(HEURIST_DB_ERROR, $savedSearchName.' Search query error on saved search. Query '.$query, $mysqli->error); }else if($is_count_only){ From 8d9bca636629ce23ef946fc58c187beb1a17e404 Mon Sep 17 00:00:00 2001 From: Artem Osmakov Date: Tue, 3 Jan 2017 18:47:55 +0400 Subject: [PATCH 48/50] One field data types context help for all dialogs. Remove "lorem ipsum" context help --- admin/structure/fields/editDetailType.html | 38 +--------------- admin/structure/fields/editDetailType.js | 2 + context_help/defDetailTypes.html | 25 ----------- context_help/defRecTypes.html | 29 ------------ context_help/defTerms.html | 40 ----------------- context_help/field_data_types.html | 51 +++++++++++++++------- context_help/sysUGrps.html | 29 ------------ 7 files changed, 40 insertions(+), 174 deletions(-) delete mode 100644 context_help/defDetailTypes.html delete mode 100644 context_help/defRecTypes.html delete mode 100644 context_help/defTerms.html delete mode 100644 context_help/sysUGrps.html diff --git a/admin/structure/fields/editDetailType.html b/admin/structure/fields/editDetailType.html index b3a6cb154a..bfdb26f5cd 100644 --- a/admin/structure/fields/editDetailType.html +++ b/admin/structure/fields/editDetailType.html @@ -245,46 +245,12 @@ You may wish to consider using a terms list, record pointer or relationship marker field type:

    -

    - Term list fields should be used for any form of controlled list, - typology, categorisation or coding in which the same value will be reused repeatedly - (eg. gender, condition, country, species, type of artefact, presence/absence) - but no additional information needs to be attached to each term other than a code value and label. - - Term lists can be hierarchichal and generate a dropdown list in data entry. - Consider using a record pointer field, below, if you want to record more information - about each category eg. characteristics of the country, images and description of a species. -

    - -

    - Record pointer fields allow a record to reference other records of specified type - which contain sets of related information, often components of the parent record, - eg. a ship's captain, a person's father, a period of military service, educational episode, place of birth. - - The referenced record may be an independent entity (eg. place, publisher, person, work) or group - together related information such as the attributes of a person or object, a set of attributes - which apply for a specified time period, or the attributes of some part of an object or for a - particular type of object. The type of relationship, however, is implicit in the field name - - father, mother, service, education, place or component all imply a fixed relationship to the parent entity - - but is not otherwise recorded. -

    - -

    - Relationship marker fields create a connection between two entities with an explicit relationship - type (selected from a dropdown), as well as a date range and other contextual information. - - They are particularly useful when there is a large list of potential relationships, - such as roles of actors in an event, interpersonal relationships, stratigraphic relationships and so forth. - - Relationship marker fields look like a composite field in the data entry form but, - rather than creating an attribute attached to the record, they create a separate relationship - record which can carry significant extra information about the relationship. -

    +
    diff --git a/admin/structure/fields/editDetailType.js b/admin/structure/fields/editDetailType.js index 384689113e..3c692dba85 100644 --- a/admin/structure/fields/editDetailType.js +++ b/admin/structure/fields/editDetailType.js @@ -935,6 +935,8 @@ function DetailTypeEditor() { if(hasH4()){ $("#topdiv_closebtn").hide(); } + $("#field_types_context_help").load(top.HEURIST.baseURL_V3+'context_help/field_data_types.html #content_body'); + _dialogbox = Hul.popupElement(window, $("#info_div").get(0), {height: 550, width:800, title:"Choosing appropriate field types", modal:true} ); } } diff --git a/context_help/defDetailTypes.html b/context_help/defDetailTypes.html deleted file mode 100644 index d7326d931b..0000000000 --- a/context_help/defDetailTypes.html +++ /dev/null @@ -1,25 +0,0 @@ - - - - HEURIST Context Help - Database structure: Field types - - - - -
    - -

    Database structure: Field types

    - -
    - - - -

    Field types Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum

    - -

    Data types Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum

    - -
    - - - - diff --git a/context_help/defRecTypes.html b/context_help/defRecTypes.html deleted file mode 100644 index 7a0a0f26b9..0000000000 --- a/context_help/defRecTypes.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - HEURIST Context Help - Database structure: Record types - - - - -
    - -

    Database structure: Record types

    - -
    - -

    Sub Header

    - -

    Record types Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum

    - -

    Record type Structure Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum

    - -

    Kinds of record types Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum

    - -

    Actions Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum

    - -
    - - - - diff --git a/context_help/defTerms.html b/context_help/defTerms.html deleted file mode 100644 index 0371337c83..0000000000 --- a/context_help/defTerms.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - HEURIST Context Help - Vocabulary, Terms and Relation Types - - - - -
    - -

    Database structure: Vocabulary, Terms and Relation Types

    - -
    - -

    Sub Header

    - -

    Vocabulary Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum

    - -

    Terms Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum

    - -

    Relation Types Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum

    - -
    - - -
    - -

    Import Vocabulary

    - -

    Prepare data for import as a comma or tab-separated file. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum

    - -

    Define parse parameters Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum

    - -

    Map columns to term field Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum

    - -
    - - - - diff --git a/context_help/field_data_types.html b/context_help/field_data_types.html index b9795120be..4291367ccd 100644 --- a/context_help/field_data_types.html +++ b/context_help/field_data_types.html @@ -10,30 +10,51 @@

    Database structure: Fields data types

    -
    +
    -
    -

    Freetext

    - -

    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum

    -
    - -
    -

    Numeric

    +
    -

    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum

    +

    + Term list fields should be used for any form of controlled list, + typology, categorisation or coding in which the same value will be reused repeatedly + (eg. gender, condition, country, species, type of artefact, presence/absence) + but no additional information needs to be attached to each term other than a code value and label. + + Term lists can be hierarchichal and generate a dropdown list in data entry. + Consider using a record pointer field, below, if you want to record more information + about each category eg. characteristics of the country, images and description of a species. +

    -

    Record pointer

    -

    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum

    +

    + Record pointer fields allow a record to reference other records of specified type + which contain sets of related information, often components of the parent record, + eg. a ship's captain, a person's father, a period of military service, educational episode, place of birth. + The referenced record may be an independent entity (eg. place, publisher, person, work) or group + together related information such as the attributes of a person or object, a set of attributes + which apply for a specified time period, or the attributes of some part of an object or for a + particular type of object. The type of relationship, however, is implicit in the field name - + father, mother, service, education, place or component all imply a fixed relationship to the parent entity - + but is not otherwise recorded. +

    -
    -

    Relationship marker

    -

    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum

    +

    + Relationship marker fields create a connection between two entities with an explicit relationship + type (selected from a dropdown), as well as a date range and other contextual information. + + They are particularly useful when there is a large list of potential relationships, + such as roles of actors in an event, interpersonal relationships, stratigraphic relationships and so forth. + + Relationship marker fields look like a composite field in the data entry form but, + rather than creating an attribute attached to the record, they create a separate relationship + record which can carry significant extra information about the relationship. +

    +
    +
    diff --git a/context_help/sysUGrps.html b/context_help/sysUGrps.html deleted file mode 100644 index d6281dd10c..0000000000 --- a/context_help/sysUGrps.html +++ /dev/null @@ -1,29 +0,0 @@ - - - - HEURIST Context Help - System User and Work Groups - - - - -
    - -

    System User and Work Groups

    - -
    - -

    Header

    - -

    Groups Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum

    - -

    Users Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum

    - -

    Roles Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum

    - -

    Access Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum

    - -
    - - - - From 98cf814fa96212de1b1bd76e107e61843265c9be Mon Sep 17 00:00:00 2001 From: Artem Osmakov Date: Tue, 3 Jan 2017 18:48:18 +0400 Subject: [PATCH 49/50] Visualization: Refresh graph after link addition --- .../visualize/databaseSummary.php | 13 ++--- hclient/framecontent/visualize/overlay.js | 11 +---- hclient/framecontent/visualize/visualize.js | 47 +++++++++++++++---- 3 files changed, 47 insertions(+), 24 deletions(-) diff --git a/hclient/framecontent/visualize/databaseSummary.php b/hclient/framecontent/visualize/databaseSummary.php index 96f3c9e1fe..7a3f524d3f 100644 --- a/hclient/framecontent/visualize/databaseSummary.php +++ b/hclient/framecontent/visualize/databaseSummary.php @@ -381,7 +381,7 @@ function onPageInit(success){ localStorage.setItem(name, JSON.stringify(obj)); // Update visualisation - visualizeData(); + filterData(); }); // Listen to the 'show-all' checkbox @@ -406,7 +406,7 @@ function onPageInit(success){ localStorage.setItem(name, JSON.stringify(obj)); }); - visualizeData(); + filterData(); }); @@ -447,10 +447,11 @@ function getData(data) { return {nodes: nodes, links: links} } - // Visualizes the data - function visualizeData() { + // Visualizes the data + function initVisualizeData() { // Call plugin - //DEBUG console.log("Calling plugin!"); + //DEBUG + console.log("Calling plugin!"); var data_to_vis = getData(json_data); $("#visualisation").visualize({ @@ -476,7 +477,7 @@ function visualizeData() { $('#divHint').hide(); } - visualizeData(); + initVisualizeData(); }); }); diff --git a/hclient/framecontent/visualize/overlay.js b/hclient/framecontent/visualize/overlay.js index 96a74ad2ff..36d468599a 100644 --- a/hclient/framecontent/visualize/overlay.js +++ b/hclient/framecontent/visualize/overlay.js @@ -500,15 +500,8 @@ function _addNewLinkField(rty_ID, target_ID){ width: dim.w, callback: function(context) { if(context!="" && context!=undefined) { - - settings.data.links.push( - {relation:{count:0, id: dty_ID, ids:'PtrConsntr', name:'', type:'resource'}, //relmarker - source: node_id1, - target: node_id2, - targetcount:0 - } - ); - + top.HEURIST4.msg.showMsgFlash("Link created...", 2000); + getDataFromServer(); } } }); diff --git a/hclient/framecontent/visualize/visualize.js b/hclient/framecontent/visualize/visualize.js index 6d5211a281..04355fa0fb 100644 --- a/hclient/framecontent/visualize/visualize.js +++ b/hclient/framecontent/visualize/visualize.js @@ -71,6 +71,7 @@ var svg; // The SVG where the visualisation will be executed on (function ( $ ) { // jQuery extension $.fn.visualize = function( options ) { + // Select and clear SVG. svg = d3.select("#d3svg"); svg.selectAll("*").remove(); @@ -314,21 +315,49 @@ function getDataFromServer(){ if(error) { return alert("Error loading JSON data: " + error.message); } + + settings.data = json_data; //all data + filterData(json_data); + + }); + +} + +function filterData(json_data) { + + if(!json_data) json_data = settings.data; + + var names = []; $(".show-record").each(function() { var name = $(this).attr("name"); - var record = localStorage.getItem(name); - if(record) { - // Update checked attribute - var obj = JSON.parse(record); - if("checked" in obj) { - $(this).prop("checked", obj.checked); - } + if(!$(this).is(':checked')){ //to exclude + names.push(name); } }); + // Filter nodes + var map = {}; + var size = 0; + var nodes = json_data.nodes.filter(function(d, i) { + if($.inArray(d.name, names) == -1) { + map[i] = d; + return true; + } + return false; + }); + + // Filter links + var links = []; + json_data.links.filter(function(d) { + if(map.hasOwnProperty(d.source) && map.hasOwnProperty(d.target)) { + var link = {source: map[d.source], target: map[d.target], relation: d.relation, targetcount: d.targetcount}; + links.push(link); + } + }) + + var data_visible = {nodes: nodes, links: links}; + settings.getData = function(all_data) { return data_visible; }; visualizeData(); - }); - } function visualizeData() { From ef991e13e747767836e0a3e3a73ac6c022751ea0 Mon Sep 17 00:00:00 2001 From: Artem Osmakov Date: Wed, 4 Jan 2017 09:00:06 +0400 Subject: [PATCH 50/50] Visualization: line and marker size always depend on user setting in toolbar --- hclient/framecontent/visualize/settings.js | 4 ++- hclient/framecontent/visualize/visualize.js | 28 +++++++++++---------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/hclient/framecontent/visualize/settings.js b/hclient/framecontent/visualize/settings.js index e732f3c1cb..069be25e7c 100644 --- a/hclient/framecontent/visualize/settings.js +++ b/hclient/framecontent/visualize/settings.js @@ -163,7 +163,7 @@ function handleSettingsInUI() { $(el).css('color', color); $(el).colpickHide(); - tick(); + visualizeData();//tick(); }}); //------------ LINKS ---------- @@ -210,6 +210,7 @@ function handleSettingsInUI() { //d3.selectAll("path").attr("stroke", color); //d3.selectAll("polyline.link").attr("stroke", color); $(".bottom-lines.link").attr("stroke", color); + visualizeData(); $(el).css('color', color); $(el).colpickHide(); @@ -225,6 +226,7 @@ function handleSettingsInUI() { putSetting(setting_markercolor, color); //d3.selectAll("marker").attr("fill", color); $("marker").attr("fill", color); + visualizeData(); $(el).css('color', color); $(el).colpickHide(); diff --git a/hclient/framecontent/visualize/visualize.js b/hclient/framecontent/visualize/visualize.js index 04355fa0fb..1e56f6751b 100644 --- a/hclient/framecontent/visualize/visualize.js +++ b/hclient/framecontent/visualize/visualize.js @@ -252,7 +252,7 @@ function executeFormula(count, maxSize) { return maxCount>1?(Math.log(count) / Math.log(maxCount)*maxSize):1; } else if(formula == "unweighted") { // Unweighted - return 2; + return maxSize; }else { // Linear return (maxCount>0)?((count/maxCount)* maxSize):1 ; } @@ -266,17 +266,14 @@ function getLineLength(record) { /** Calculates the line width that should be used */ function getLineWidth(count) { - //old way var maxWidth = getSetting(setting_linewidth); - //old way return 1.5 + (executeFormula(count, maxWidth) / 2); - - if(getSetting(setting_formula)=='unweighted'){ - return getSetting(setting_linewidth); - }else{ - var val = (count==0)?0:executeFormula(count, maxLinkWidth); - if(val<1) val = 1; - return val; - } + var maxWidth = getSetting(setting_linewidth); + if(maxWidth>maxLinkWidth) {maxSize = maxLinkWidth;} + else if(maxWidth<1) {maxSize = 1;} + + var val = (count==0)?0:executeFormula(count, maxWidth); + if(val<1) val = 1; + return val; } /** Calculates the marker width that should be used */ @@ -287,13 +284,18 @@ function getMarkerWidth(count) { /** Calculates the entity raadius that should be used */ function getEntityRadius(count) { + + var maxRadius = getSetting(setting_entityradius); + if(maxRadius>maxEntityRadius) {maxRadius = maxEntityRadius;} + else if(maxRadius<1) {maxRadius = 1;} + if(getSetting(setting_formula)=='unweighted'){ - return getSetting(setting_entityradius); + return maxRadius; }else{ if(count==0){ return 0; //no records - no circle }else{ - var val = circleSize + executeFormula(count, maxEntityRadius); + var val = circleSize + executeFormula(count, maxRadius); if(val