Skip to content

Commit

Permalink
Merge pull request #9 from HeuristNetwork/fixes
Browse files Browse the repository at this point in the history
Artem Fixes to 22 Nov 16
  • Loading branch information
ijohnson222 authored Nov 25, 2016
2 parents e4ae546 + 120732b commit 88e8a19
Show file tree
Hide file tree
Showing 43 changed files with 1,142 additions and 309 deletions.
17 changes: 10 additions & 7 deletions admin/structure/fields/editRecStructure.js
Original file line number Diff line number Diff line change
Expand Up @@ -450,9 +450,9 @@ function EditRecStructure() {
'</div></div>'+

// Required/recommended optional
'<div class="input-row"><div class="input-header-cell">Requirement:</div>'+
'<div class="input-row"><div class="input-header-cell" style="vertical-align:top;">Requirement:</div>'+
'<div class="input-cell" title="Determines whether the field must be filled in, should generally be filled in, or is optional">'+
'<select id="ed'+rst_ID+'_rst_RequirementType" onchange="onReqtypeChange(event)" style="display:inline; margin-right:0px">'+
'<select id="ed'+rst_ID+'_rst_RequirementType" onchange="onReqtypeChange(event)" style="display:inline; margin-right:0px;vertical-align: top;">'+
'<option value="required">required</option>'+
'<option value="recommended">recommended</option>'+
'<option value="optional">optional</option>'+
Expand All @@ -474,17 +474,20 @@ function EditRecStructure() {
'<input type="radio" id="incValue_'+rst_ID+'_2" name="incValue_'+rst_ID+'" value="1" title="'+incrementTip+'" onchange="onIncrementModeChange('+rst_ID+')">'+
'<label style="min-width: 120px;width: 120px;" for="incValue_'+rst_ID+'_2" title="'+incrementTip+'">Increament value by 1</label>'+
'</span>'
:'<span style="padding-left:50px">'+
:'<div style="padding-left:50px;display:inline-block">'+
'<label class="input-header-cell" for="ed'+rst_ID+'_rst_DefaultValue">Default&nbsp;Value:</label>'+
'<div id="termsDefault_'+rst_ID+'" style="display:inline-block;"><input id="ed'+rst_ID+'_rst_DefaultValue" title="Select or enter the default value to be inserted automatically into new records"/></div>'+
'</span>')+
'<div id="termsDefault_'+rst_ID+'" style="display:inline-block;"><input id="ed'+rst_ID+'_rst_DefaultValue" title="Select or enter the default value to be inserted automatically into new records"/>'+
((fieldType=='date')?'<br><span class="prompt">yesterday, today, tomorrow, now, specific date</span>':'')+
'</div>'+
'</div>')+

// Minimum values
'<span id="ed'+rst_ID+'_spanMinValue" style="display:none;"><label class="input-header-cell">Minimum&nbsp;values:</label>'+
'<input id="ed'+rst_ID+
'_rst_MinValues" title="Minimum number of values which are required in data entry" style="width:20px" size="2" '+
'onblur="onRepeatValueChange(event)" onkeypress="Hul.validate(event)"/></span></div></div>'+

'onblur="onRepeatValueChange(event)" onkeypress="Hul.validate(event)"/></span>'+
'</div></div>'+

// Repeatability
'<div class="input-row" id="divRepeatability'+rst_ID+'">'+
'<div class="input-header-cell">Repeatability :</div>'+
Expand Down
2 changes: 1 addition & 1 deletion admin/verification/findBrokenImages.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
mysql_connection_overwrite(DATABASE);
mysql_query('set character set binary');

$res = mysql_query('select * from recUploadedFiles where ulf_ID>11710 order by ulf_ID'); // where ulf_ID>12000 11710 12060
$res = mysql_query('select * from recUploadedFiles order by ulf_ID'); // where ulf_ID>12000 11710 12060

$current_file;
$cnt_jpg = 0;
Expand Down
7 changes: 4 additions & 3 deletions common/css/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ input[type="radio"] {vertical-align: text-top;}

.detailType {width:90px;display: table-cell;color: #999999;vertical-align: top;padding: 0 10px 0 0;text-align: right;text-transform: none;}
.detail {display: table-cell;padding-right: 15px;text-transform: none;color: #333;}
.detail a, .detail{text-wrap:normal; word-wrap:break-word; white-space:normal; word-break:break-all}
.detail a, .detail{text-wrap:normal; word-wrap:break-word; white-space:normal; word-break:break-word}
.detailRow {display: table;padding: 5px 0 5px 0;font-size: 11px;overflow: visible;}
.detailRowHeader {padding: 5px 0 5px 0;width:100%;border-top: 1px solid #7D9AAA;font-size: 11px;overflow: visible;text-align: left;color:#7D9AAA; text-transform: uppercase;}
.detailRowHeader span.link{text-transform: none; font-size: 9px;}
Expand All @@ -688,9 +688,10 @@ input[type="radio"] {vertical-align: text-top;}
.fullSize {width:100%; padding:5px;text-align:center}

div.thumbnail {
text-align: center;
/*text-align: center;*/
margin-left:90px;
}
div.thumbnail .fullSize img {width:auto; max-width:100%; cursor: url(../images/zoom-out.png),pointer;}
div.thumbnail .fullSize img {margin:0; width:auto; max-width:100%; cursor: url(../images/zoom-out.png),pointer;}
div.thumbnail img{width:80px;border: 2px solid #FFF;-moz-box-shadow:0 2px 4px #BBB;-webkit-box-shadow:0 2px 4px #BBB;box-shadow:0 2px 4px #BBB;}
img {border:0 none;vertical-align:middle;}
#recID {float:right}
Expand Down
11 changes: 8 additions & 3 deletions common/php/Temporal.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,14 @@ function removeLeadingYearZeroes($value, $is_greg_or_julian=true, $is_strict_iso
$need_day = false;
}

$timestamp = strtotime($value);
$datestamp = date('Y-m-d H:i:s', $timestamp);
$date = date_parse($datestamp);
try{
$t2 = new DateTime($value);
$datestamp = $t2->format('Y-m-d H:i:s');
$date = date_parse($datestamp);
} catch (Exception $e){
$date = null;
//print $value.' => NOT SUPPORTED<br>';
}
}

if($date){
Expand Down
1 change: 1 addition & 0 deletions export/delimited/exportDelimitedForRectype.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
}
</script>

<script type="text/javascript" src="../../external/jquery/jquery.js"></script>
<script src="exportDelimitedForRectype.js"></script>

<link href="../../common/css/global.css" type="text/css" rel="stylesheet">
Expand Down
125 changes: 118 additions & 7 deletions export/delimited/exportDelimitedForRectype.js
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ function getRecordsByH4(){
var request = top.HEURIST4.current_query_request;
if(!request.w) request.w = 'all';
if(!request.a) request.a = '1';

//request.detail = [] array of fields to download

var len = g_exportMapNames.length,
Expand All @@ -430,17 +431,83 @@ function getRecordsByH4(){
request.detail = details;

top.HAPI4.SearchMgr.doSearchWithCallback( request, function( recordset, original_recordset ){

if(recordset){
//alert("got: "+recordset.length());
_showRecordDataH4(recordset)
_getPointerIDs(recordset)
}

});

}

function _showRecordDataH4(recordset) {
//
//detect all pointer fields and gather ids
//
function _getPointerIDs(recordset) {

if(recordset.length()>0){

var refFields = [];
var j, k = g_exportMap.length;
for (j = 0; j < k; ++j) {
var hDty = g_detailTypes[g_exportMap[j]];
var baseType = hDty.getVariety();
if (baseType == HVariety.REFERENCE){
refFields.push(hDty.getID());
}
}

if(refFields.length>0){ //there are pointer fields
var len = recordset.length();
var recs = recordset.getRecords();
var rec_order = recordset.getOrder();

var i, recID, refRecIDs = [];
k = refFields.length;

for (i = 0; i < len; ++i) {
recID = rec_order[i];
if(recID && recs[recID] && recs[recID]['d']){
for (j = 0; j < k; ++j) {
var dtID = refFields[j];
var val = recs[recID]['d'][dtID];

if(top.HEURIST4.util.isArrayNotEmpty(val)){
//refRecIDs = refRecIDs.concat(val);
//jQuery.merge( refRecIDs, val );
//refRecIDs = jQuery.unique( refRecIDs );
for (m = 0; m < val.length; m++) {
if(refRecIDs.indexOf(val[m])<0 )
refRecIDs.push(val[m]);
}
}else if(val) {
if(refRecIDs.indexOf(val)<0 )
refRecIDs.push(val);
}
}
}
}
if(refRecIDs.length>0){

var request = {w:'all',a:1,q:'ids:'+refRecIDs.join(','),detail:'header'};

top.HAPI4.SearchMgr.doSearchWithCallback( request, function( reference_recordset, original_recordset ){
if(recordset){
//alert("got: "+reference_recordset.length());
_showRecordDataH4(recordset, reference_recordset)
}

});

return;
}
}
}
_showRecordDataH4(recordset);

}

function _showRecordDataH4(recordset, reference_recordset) {

g_delimiterSelect = document.getElementById('delimiterSelect');
var strDelim = g_delimiterSelect.value;
Expand Down Expand Up @@ -475,31 +542,47 @@ function _showRecordDataH4(recordset) {
var k = g_exportMapNames.length,
line = "";
for (var j = 0; j < k; j++) {

if (g_dtIDsCheckbox.checked && j>0) {
var hDty = g_detailTypes[g_exportMap[j-1]];
line += hDty.getID() + strDelim;
}
if(j>0){
var hDty = g_detailTypes[g_exportMap[j-1]];
var baseType = hDty.getVariety();
if (baseType == HVariety.REFERENCE){
line += g_exportMapNames[j] + ' ID ' + strDelim;
}
}

line += (g_exportMapNames[j]+strDelim);
}
lines = line.slice(0,-1) + strRowTerm;
}



// Generate rows of data
var len = recordset.length();

var recs = recordset.getRecords();
var rec_order = recordset.getOrder();
var recID;

for (var i = 0; i < len; ++i) {
var recID, i, j;
var k = g_exportMap.length;

for (i = 0; i < len; ++i) {
recID = rec_order[i];
if(recID && recs[recID]){

var line = recID + strDelim;
var record = recs[recID];
if(!record['d']){
console.log('no detials for recid '+recID+' line:'+i);
continue;
}

var k = g_exportMap.length;
for (var j = 0; j < k; ++j) {
for (j = 0; j < k; ++j) {
var hDty = g_detailTypes[g_exportMap[j]];

if (g_dtIDsCheckbox.checked) {
Expand All @@ -521,6 +604,33 @@ function _showRecordDataH4(recordset) {
if(term) val[m] = term[0];
}
}
}else if (baseType == HVariety.REFERENCE){
//take record title
if(reference_recordset && reference_recordset.length()>0){

var val_ids = [];

if(top.HEURIST4.util.isArrayNotEmpty(val)){
for (var m = 0; m < val.length; ++m) {
var refrec = reference_recordset.getById(Number(val[m]));
if(refrec){
val_ids.push(val[m]);
val[m] = reference_recordset.fld(refrec, 'rec_Title');
}
}
}else{
var refrec = reference_recordset.getById(Number(val));
if(refrec){
val_ids.push(val);
val = reference_recordset.fld(refrec, 'rec_Title');
}
}

if(top.HEURIST4.util.isArrayNotEmpty(val_ids)){
field = val_ids.join('|');
}
line += ((!top.HEURIST4.util.isempty(field))?field:'') + strDelim;
}
}

if(top.HEURIST4.util.isArrayNotEmpty(val)){
Expand All @@ -538,4 +648,5 @@ function _showRecordDataH4(recordset) {
}
}//for
recDisplay.value = lines;

}
24 changes: 16 additions & 8 deletions export/xml/hml.php
Original file line number Diff line number Diff line change
Expand Up @@ -767,15 +767,23 @@ function outputDateDetail($attrs, $value) {
if (preg_match('/^\\s*-?(\\d+)\\s*$/', $value, $matches)) { // year only
makeTag('year', null, $matches[1]);
} else {
$date = strtotime($value);
if ($date) {
makeTag('year', null, date('Y', $date));
makeTag('month', null, date('n', $date));
makeTag('day', null, date('j', $date));

try{
$t2 = new DateTime($value);
$datestamp = $t2->format('Y-m-d H:i:s');
} catch (Exception $e){
$t2 = null;
//print $value.' => NOT SUPPORTED<br>';
}

if ($t2) {
makeTag('year', null, $t2->format('Y')); // date('Y', $date));
makeTag('month', null, $t2->format('n')); // date('n', $date));
makeTag('day', null, $t2->format('j')); // date('j', $date));
if (preg_match("![ T]!", $value)) { // looks like there's a time
makeTag('hour', null, date('H', $date));
makeTag('minutes', null, date('i', $date));
makeTag('seconds', null, date('s', $date));
makeTag('hour', null, $t2->format('H')); // date('H', $date));
makeTag('minutes', null, $t2->format('i')); // date('i', $date));
makeTag('seconds', null, $t2->format('s')); // date('s', $date));
}
} else {
// cases that strtotime doesn't catch
Expand Down
44 changes: 43 additions & 1 deletion h4styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -1071,8 +1071,50 @@ background: #8ea9b9
padding-left:35px;
}

.ui-icon-filter { background-image: url(hclient/assets/filter_icon.png) !important; }
.ui-icon-filter {
background-image: url(hclient/assets/filter_icon24.png) !important;
width: 24;
height: 24;
margin-top: -0.8em !important;
margin-left: -0.3em;
}

.ui-icon-filter-form { background-image: url(hclient/assets/filter_form_icon.png) !important; }

.ui-iconalign { display: inline-block; vertical-align: text-bottom; padding-right:1em }

/* for popup on map for renderRecordData.php */
#recID {
float: right;
}
.detailType {
width: 80px;
display: table-cell;
color: #999999;
vertical-align: top;
padding: 0 10px 0 0;
text-align: right;
text-transform: none;
}
.detail a, .detail {
text-wrap: normal;
word-wrap: break-word;
white-space: nowrap;
word-break: break-word;
min-width: 300px;
max-width: 300px;
/*
overflow: hidden;
text-overflow: ellipsis;
*/
}
.detail {
display: table-cell;
padding-right: 5px;
text-transform: none;
color: #333;
}
.thumbnail{
margin-left: 80px;
}
/*end for map popup*/
Binary file added hclient/assets/filter_icon24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions hclient/core/hapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,11 @@ function hAPI(_db, _oninit) { //, _currentUser
_callserver('usr_info', request, callback);
}

,user_log: function(activity, suplementary){
var request = {a:'usr_log', activity:activity, suplementary:suplementary};
_callserver('usr_info', request);
}

/**
* Save user personal info/register new user
* @param request - object - user info
Expand Down
Loading

0 comments on commit 88e8a19

Please sign in to comment.