* Remove dataview to open.
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
#sidebar .modulegroup {font-weight:bold; padding-top: 8px; border-top: 1px solid #ddd;}
|
||||
#sidebar .active {background-color: #e9f2fb; color: #006af1;}
|
||||
|
||||
.side-col {width: 240px;}
|
||||
#sidebar> .cell {width: 220px;}
|
||||
|
||||
#data {overflow: scroll;}
|
||||
#data th, #data td, #schema td, #modules li > strong {overflow: hidden; text-overflow: unset; white-space: nowrap;}
|
||||
#dataContent {margin: 0px; padding: 0px;}
|
||||
#dataContent .detail {margin: 0px; padding: 0px;}
|
||||
#dataContent .detail .detail-title {padding: 16px; border-bottom: 1px solid #f4f5f7; line-height: 16px;}
|
||||
#dataContent .detail .detail-title .dataview-title {overflow: hidden; white-space: nowrap; max-width: calc(100% - 120px); display: inline-block;}
|
||||
#dataContent .detail .detail-title .create-action {display: inline-block;}
|
||||
#dataContent .detail .detail-content {margin-top: 0px;}
|
||||
#dataContent .detail .detail-content .tab-content {padding: 16px;}
|
||||
#dataContent .tabs .nav-tabs .actions {padding: 8px 15px;}
|
||||
#dataContent .tabs .nav-tabs .actions a {padding-left: 5px;}
|
||||
#dataContent .tabs table {margin-bottom: 0px;}
|
||||
#dataContent .tabs table .dataview-sql {white-space: unset;}
|
||||
|
||||
.nav-tabs {padding:16px 16px 0px 16px;}
|
||||
.nav-tabs>li>a {padding: 5px 10px;}
|
||||
.nav-tabs>li.active>a, .nav-tabs>li.active>a:focus, .nav-tabs>li.active>a:hover {color: #2e7fff!important; background-color: #e6f0ff; padding: 5px 10px;}
|
||||
.nav-tabs>li.active>a:before {background: unset;}
|
||||
.nav-tabs {border: unset;}
|
||||
|
||||
.cell> .panel> .panel-heading {padding: 5px 0px 10px;}
|
||||
.detail-title>.pull-right {position: unset;}
|
||||
.detail-title>.pull-right>a {margin: 0px 10px; font-weight: normal; font-size: 13px;}
|
||||
@@ -0,0 +1,2 @@
|
||||
.side-col {width: 200px;}
|
||||
#sidebar> .cell {width: 180px;}
|
||||
@@ -0,0 +1,6 @@
|
||||
.form-actions .btn {margin-right: 5px;}
|
||||
.td-row {display: flex;}
|
||||
.td-row>div {flex: 1;}
|
||||
.error td {color: red;}
|
||||
.datatable{width: auto;}
|
||||
.table-panel {overflow: auto;}
|
||||
@@ -0,0 +1,4 @@
|
||||
#main>.container {height: auto; min-height: 340px;}
|
||||
|
||||
#dataform .table-form>tbody>tr>th {width: 70px;}
|
||||
#dataform .table-form td.form-actions.text-center {padding-top: 20px;}
|
||||
@@ -0,0 +1,4 @@
|
||||
#main>.container {height: auto; min-height: 280px;}
|
||||
#dataform tr > th {width: 70px;}
|
||||
|
||||
#dataform #group_chosen .chosen-drop .chosen-results {max-height: 140px;}
|
||||
@@ -0,0 +1 @@
|
||||
.main-content>.center-block {border: none;}
|
||||
@@ -0,0 +1,22 @@
|
||||
.form-actions .btn {margin-right: 5px;}
|
||||
.td-row {display: flex;}
|
||||
.td-row>div {flex: 1;}
|
||||
.error td {color: red;}
|
||||
.datatable{width: auto;}
|
||||
.table-panel {overflow: auto;}
|
||||
.ellipsis-multi {overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1;}
|
||||
.query-padding {padding-left: 15px;}
|
||||
|
||||
#mainContent {padding: 0px; background: none; box-shadow: none;}
|
||||
#mainContent .panel {padding: 0px 10px 10px 10px; border: 0px;}
|
||||
#mainContent .panel-heading {padding: 20px 20px 10px 20px;}
|
||||
#dataform {padding: 0px 10px;}
|
||||
#dataform textarea.form-control {padding: 20px 10px; box-shadow: inset 0 0px 0px rgb(0 0 0 / 10%), 0 0 15px rgb(0 0 0 / 10%); border: 0px;}
|
||||
#mainContent .panel.table-panel .datatable.table tr>th, #mainContent .table-panel .datatable.table tr>td {padding: 5px 20px;}
|
||||
|
||||
#queryTable .titleResult {padding:20px 0px 10px 20px;}
|
||||
.fieldSettings {margin: -8px 10px; border: none;}
|
||||
#edit select[name^='relatedTable'] + div .picker-selections:first-child {border-right: none;}
|
||||
#edit select[name^='relatedTable'] + div.picker-focus .picker-selections {border-right: 1px solid #2e7fff;}
|
||||
|
||||
#queryFilters .radio-inline input[type=radio] {margin-top: 0px;}
|
||||
@@ -0,0 +1,35 @@
|
||||
$(function()
|
||||
{
|
||||
if(table)
|
||||
{
|
||||
$('.dataview-' + table).addClass('active');
|
||||
|
||||
var $tree = $('#modules').tree({name:'tree-group'});
|
||||
var tree = $tree.data('zui.tree');
|
||||
tree.expand($('.dataview-' + table).parents('li'));
|
||||
}
|
||||
|
||||
$(document).on('click','.query-view', function()
|
||||
{
|
||||
var url = createLink('dataview', 'query', 'id=' + table);
|
||||
var result = true;
|
||||
|
||||
if(dataview.used) result = confirm(warningDesign);
|
||||
if(result) window.location.href = url;
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Locate page.
|
||||
*
|
||||
* @param string module
|
||||
* @param string method
|
||||
* @param string params
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function locate(module, method, params)
|
||||
{
|
||||
var link = createLink(module, method, params);
|
||||
window.location.href = link;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
$(function()
|
||||
{
|
||||
var dataviewSql = JSON.parse(sessionStorage.getItem('dataviewSql'));
|
||||
var fieldSettings = sessionStorage.getItem('fieldSettings');
|
||||
var langs = sessionStorage.getItem('langs');
|
||||
|
||||
$.each(dataviewSql, function(index, value)
|
||||
{
|
||||
if(value.name == 'sql')
|
||||
{
|
||||
dataviewSql = value.value;
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
$('#sql').val(dataviewSql);
|
||||
$('#fields').val(fieldSettings);
|
||||
$('#langs').val(langs);
|
||||
});
|
||||
|
||||
function locate(method, params)
|
||||
{
|
||||
var link = createLink('dataview', method, params);
|
||||
window.location.href = link;
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
function initStorage(obj, debug = false)
|
||||
{
|
||||
var dataStorage =
|
||||
{
|
||||
clone: function(key)
|
||||
{
|
||||
if(typeof this['_' + key] != 'object') return this['_' + key]
|
||||
return JSON.parse(JSON.stringify(this['_' + key]));
|
||||
},
|
||||
addProperty: function(key, value)
|
||||
{
|
||||
this[key] =
|
||||
{
|
||||
get: function()
|
||||
{
|
||||
if(debug)
|
||||
{
|
||||
console.groupCollapsed('Get %c' + key, 'color: #3785ff');
|
||||
console.log(this['_' + key]);
|
||||
console.trace();
|
||||
console.groupEnd();
|
||||
}
|
||||
return this['_' + key];
|
||||
},
|
||||
set: function(value)
|
||||
{
|
||||
if(debug)
|
||||
{
|
||||
console.groupCollapsed('Set %c' + key, 'color: #ff6970');
|
||||
console.log('Before', this['_' + key]);
|
||||
console.log('Value', value);
|
||||
console.trace();
|
||||
console.groupEnd();
|
||||
}
|
||||
this['_' + key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
for(let key in obj)
|
||||
{
|
||||
dataStorage['_' + key] = obj[key];
|
||||
|
||||
Object.defineProperty(dataStorage, key,
|
||||
{
|
||||
get: function()
|
||||
{
|
||||
if(debug)
|
||||
{
|
||||
console.groupCollapsed('Get %c' + key, 'color: #3785ff');
|
||||
console.log(this.clone(key));
|
||||
console.trace();
|
||||
console.groupEnd();
|
||||
}
|
||||
return this.clone(key);
|
||||
},
|
||||
set: function(value)
|
||||
{
|
||||
if(debug)
|
||||
{
|
||||
console.groupCollapsed('Set %c' + key, 'color: #ff6970');
|
||||
console.log('Before', this.clone(key));
|
||||
console.log('Value', value);
|
||||
console.trace();
|
||||
console.groupEnd();
|
||||
}
|
||||
this['_' + key] = value;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return dataStorage;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
$(function()
|
||||
{
|
||||
if(rawMethod !== 'create') return;
|
||||
var createModal = new $.zui.ModalTrigger({url: createLink('dataview', 'create', 'step=create', '', true), type: 'iframe', width: 480});
|
||||
document.getElementById('saveButton').addEventListener('click', function(e)
|
||||
{
|
||||
$.ajaxSettings.async = false;
|
||||
query();
|
||||
$.ajaxSettings.async = true;
|
||||
e.preventDefault();
|
||||
if($('#dataform .error').length == $('#dataform .error.hidden').length)
|
||||
{
|
||||
var params = $('#dataform').serializeArray();
|
||||
|
||||
getFieldSettings();
|
||||
|
||||
/* Fix bug #26716. */
|
||||
var fieldSettings = DataStorage.clone('fieldSettings');
|
||||
for(let index in fieldSettings)
|
||||
{
|
||||
if(!Object.keys(DataStorage.fields).includes(index)) delete fieldSettings[index];
|
||||
}
|
||||
DataStorage.fieldSettings = fieldSettings;
|
||||
|
||||
sessionStorage.setItem('dataviewSql', JSON.stringify(params));
|
||||
sessionStorage.setItem('fieldSettings', JSON.stringify(fieldSettings));
|
||||
sessionStorage.setItem('langs', JSON.stringify(DataStorage.langs));
|
||||
|
||||
createModal.show();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function locate(method, params)
|
||||
{
|
||||
var link = createLink('dataview', method, params);
|
||||
window.location.href = link;
|
||||
}
|
||||
@@ -0,0 +1,477 @@
|
||||
var modal;
|
||||
|
||||
/**
|
||||
* Query sql.
|
||||
*
|
||||
* @param function callback
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function query(callback) {
|
||||
DataStorage.isInsert = false;
|
||||
var pivot = DataStorage.pivot;
|
||||
var filters = '';
|
||||
if(pivot)
|
||||
{
|
||||
if(!setVarFrom()) return false;
|
||||
|
||||
filters = DataStorage.pivot.filters;
|
||||
|
||||
filters.forEach(function(filter, index)
|
||||
{
|
||||
if(filter.from == 'query')
|
||||
{
|
||||
var find = $('#queryFilters').find('.filter-item-' + index + ' .form-' + filter.type);
|
||||
if(find.length != 0) filter.default = find.val();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
DataStorage.fields = {};
|
||||
DataStorage.columns = {};
|
||||
DataStorage.rows = [];
|
||||
|
||||
$('.query').addClass('disabled');
|
||||
$('#querying').removeClass('hidden');
|
||||
$.post(createLink('dataview', 'ajaxQuery'), {sql: $('#sql').val(), filters: filters, recPerPage: DataStorage.recPerPage, pageID: DataStorage.pageID}, function(resp)
|
||||
{
|
||||
resp = JSON.parse(resp);
|
||||
$('.query').removeClass('disabled');
|
||||
$('#querying').addClass('hidden');
|
||||
if(resp.result !== 'success')
|
||||
{
|
||||
var message = resp.message.errorInfo ? resp.message.errorInfo[2] : resp.message;
|
||||
$('.error').removeClass('hidden');
|
||||
$('.error td').html(message);
|
||||
drawTable([], []);
|
||||
}
|
||||
else
|
||||
{
|
||||
DataStorage.fields = resp.fields;
|
||||
DataStorage.columns = resp.columns;
|
||||
DataStorage.rows = resp.rows;
|
||||
vars = resp.vars;
|
||||
DataStorage.relatedObject = resp.relatedObject;
|
||||
|
||||
if(resp.filters.length)
|
||||
{
|
||||
pivot.filters = resp.filters;
|
||||
DataStorage.pivot = pivot;
|
||||
|
||||
resp.filters.forEach(function(filter, index)
|
||||
{
|
||||
if(filter.from != 'query') return;
|
||||
if(filter.type != 'date' && filter.type != 'datetime') return;
|
||||
|
||||
var find = $('#queryFilters').find('.filter-item-' + index + ' .form-' + filter.type);
|
||||
find.val(filter.default);
|
||||
});
|
||||
}
|
||||
|
||||
drawTable(resp.fields, resp.rows);
|
||||
getFieldSettings();
|
||||
addResult(resp);
|
||||
initPager(resp);
|
||||
if(typeof callback == 'function') callback();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Add query result.
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function addResult(resp)
|
||||
{
|
||||
$('#queryResult').remove();
|
||||
|
||||
var lineCount = resp.lineCount;
|
||||
var columnCount = resp.columnCount;
|
||||
var queryMsg = queryResult;
|
||||
|
||||
queryMsg = queryMsg.replace('%s', lineCount);
|
||||
queryMsg = queryMsg.replace('%s', columnCount);
|
||||
|
||||
$('#queryTable .table-footer').append("<span style='float:left;line-height:28px' id='queryResult'>" + queryMsg + "</span>");
|
||||
}
|
||||
|
||||
function initPager(resp)
|
||||
{
|
||||
var pageID = parseInt(resp.pageID);
|
||||
var recPerPage = parseInt(resp.recPerPage);
|
||||
var recTotal = parseInt(resp.lineCount);
|
||||
var pageTotal = parseInt(Math.ceil(recTotal / recPerPage));
|
||||
|
||||
$('.recTotal').html(recTotalTip.replace('%s', recTotal));
|
||||
$('.recPerPage').html(recPerPageTip.replace('%s', recPerPage));
|
||||
|
||||
$('.dropup li').removeClass('active');
|
||||
$('.dropup li a').each(function()
|
||||
{
|
||||
if($(this).data('size') == resp.recPerPage)
|
||||
{
|
||||
$(this).parent().addClass('active');
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
$('.page-number').html('<strong>' + pageID + '</strong>/<strong>' + pageTotal + '</strong>');
|
||||
|
||||
$('.left-page').data('page', pageID - 1);
|
||||
$('.right-page').data('page', pageID + 1);
|
||||
$('.last-page').data('page', pageTotal);
|
||||
|
||||
$('.first-page,.left-page,.last-page,.right-page').removeClass('disabled');
|
||||
if(pageID == 1) $('.first-page,.left-page').addClass('disabled');
|
||||
if(pageID == pageTotal) $('.last-page,.right-page').addClass('disabled');
|
||||
$('.table-footer').toggle(!!recTotal);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save field settings.
|
||||
*
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
function saveSettings()
|
||||
{
|
||||
var fieldSettings = DataStorage.clone('fieldSettings');
|
||||
var relatedObject = DataStorage.relatedObject;
|
||||
for(let index in DataStorage.fields)
|
||||
{
|
||||
var relatedTable = $('#relatedTable' + index).val();
|
||||
var relatedField = $('#relatedField' + index).val();
|
||||
fieldSettings[index].object = relatedTable;
|
||||
fieldSettings[index].field = relatedField;
|
||||
|
||||
if(relatedTable != relatedObject[index]) fieldSettings[index].type = 'object';
|
||||
if(relatedTable == relatedObject[index] && fieldSettings[index].type == 'object') fieldSettings[index].type = 'string';
|
||||
}
|
||||
|
||||
DataStorage.fieldSettings = fieldSettings;
|
||||
|
||||
var langs = DataStorage.clone('langs');
|
||||
$("input[name^='langs']").each(function()
|
||||
{
|
||||
var field = $(this).data('field');
|
||||
var lang = $(this).data('lang');
|
||||
var value = $(this).val();
|
||||
|
||||
if(typeof(langs[field]) == 'undefined') langs[field] = {};
|
||||
langs[field][lang] = value;
|
||||
})
|
||||
DataStorage.langs = langs;
|
||||
|
||||
$('#addModal').modal('hide');
|
||||
this.drawTable(DataStorage.fields, DataStorage.rows);
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw table content for sql result.
|
||||
*
|
||||
* @param object fields
|
||||
* @param array rows
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function drawTable(fields, rows)
|
||||
{
|
||||
$.post(createLink('dataview', 'ajaxGetFieldName'), {fields: fields, fieldSettings: DataStorage.fieldSettings}, function(resp)
|
||||
{
|
||||
resp = JSON.parse(resp);
|
||||
if(resp.result == 'success') fields = resp.fields ? resp.fields : fields;
|
||||
|
||||
$('.table-empty-tip').addClass('hidden');
|
||||
if(rows.length == 0)
|
||||
{
|
||||
$('.table-empty-tip').removeClass('hidden');
|
||||
$('table.result').empty();
|
||||
return;
|
||||
}
|
||||
var head = '<tr>';
|
||||
var langs = DataStorage.langs;
|
||||
for(let field in fields)
|
||||
{
|
||||
var fieldName = fields[field];
|
||||
if(!$.isEmptyObject(langs) && typeof(langs[field]) !== 'undefined') fieldName = langs[field][clientLang] ? langs[field][clientLang] : fieldName;
|
||||
head += '<th>' + fieldName + '</th>';
|
||||
}
|
||||
head += '</tr>';
|
||||
|
||||
var html = '<thead>' + head + '</thead>';
|
||||
|
||||
var body = '';
|
||||
for(let row of rows)
|
||||
{
|
||||
body += '<tr>';
|
||||
for(let index in row) body += '<td><div class="ellipsis-multi" title="' + row[index] + '">' + row[index] + '</div></td>';
|
||||
body += '</tr>';
|
||||
}
|
||||
|
||||
html += '<tbody>' + body + '</tbody>';
|
||||
|
||||
$('table.result').html(html);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get text width.
|
||||
*
|
||||
* @param string text
|
||||
* @access public
|
||||
* @return float
|
||||
*/
|
||||
function getTextWidth(text)
|
||||
{
|
||||
var font = "bold 12pt arial"
|
||||
var canvas = document.createElement("canvas");
|
||||
var context = canvas.getContext("2d");
|
||||
context.font = font;
|
||||
var measure = context.measureText(text);
|
||||
|
||||
return measure.width;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get field settings.
|
||||
*
|
||||
* @access public
|
||||
* @return float
|
||||
*/
|
||||
function getFieldSettings()
|
||||
{
|
||||
var fieldSettings = DataStorage.clone('fieldSettings');
|
||||
var fields = DataStorage.fields;
|
||||
var columns = DataStorage.columns;
|
||||
var relatedObject = DataStorage.relatedObject;
|
||||
var objectFields = DataStorage.objectFields;
|
||||
|
||||
var fieldSettingsNew = {};
|
||||
|
||||
for(let index in fields)
|
||||
{
|
||||
var field = fields[index];
|
||||
var defaultType = columns[index];
|
||||
var defaultObject = relatedObject[index];
|
||||
|
||||
if(typeof(objectFields) != 'undefined' && typeof(objectFields[defaultObject]) != 'undefined' && typeof(objectFields[defaultObject][index]) != 'undefined') defaultType = objectFields[defaultObject][index].type == 'object' ? 'string' : objectFields[defaultObject][index].type;
|
||||
|
||||
if(!fieldSettings[index])
|
||||
{
|
||||
fieldSettingsNew[index] = {
|
||||
name: field,
|
||||
object: defaultObject,
|
||||
field: index,
|
||||
type: defaultType
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
var object = fieldSettings[index].object;
|
||||
if(!object || object.length == 0) object = defaultObject;
|
||||
fieldSettings[index].object = object;
|
||||
|
||||
var field = fieldSettings[index].field;
|
||||
if(!field || field.length == 0)
|
||||
{
|
||||
fieldSettings[index].field = index;
|
||||
fieldSettings[index].object = defaultObject;
|
||||
fieldSettings[index].type = 'string';
|
||||
}
|
||||
|
||||
var type = fieldSettings[index].type;
|
||||
if(object == defaultObject && type != defaultType) fieldSettings[index].type = defaultType;
|
||||
|
||||
fieldSettingsNew[index] = fieldSettings[index];
|
||||
}
|
||||
}
|
||||
|
||||
DataStorage.fieldSettings = fieldSettingsNew;
|
||||
}
|
||||
|
||||
function submitForm()
|
||||
{
|
||||
if($('#fields').length == 0) $('#dataform table').before($('<input>').attr({name: 'fields', id: 'fields'}).addClass('hidden'));
|
||||
if($('#langs').length == 0) $('#dataform table').before($('<input>').attr({name: 'langs', id: 'langs'}).addClass('hidden'));
|
||||
|
||||
getFieldSettings();
|
||||
|
||||
/* Fix bug #26716. */
|
||||
var fieldSettings = DataStorage.clone('fieldSettings');
|
||||
var fields = DataStorage.fields;
|
||||
for(let index in fieldSettings)
|
||||
{
|
||||
if(!Object.keys(fields).includes(index)) delete fieldSettings[index];
|
||||
}
|
||||
DataStorage.fieldSettings = fieldSettings;
|
||||
|
||||
$('#fields').val(JSON.stringify(DataStorage.fieldSettings));
|
||||
$('#langs').val(JSON.stringify(DataStorage.langs));
|
||||
$('#dataform').submit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set related field.
|
||||
*
|
||||
* @param obj $obj
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function setRelatedField(obj)
|
||||
{
|
||||
var selectedTable = $(obj).val();
|
||||
var relatedFields = [];
|
||||
var objectFields = DataStorage.objectFields;
|
||||
for(let index in objectFields[selectedTable]) relatedFields[index] = objectFields[selectedTable][index].name;
|
||||
var relatedFieldOptions = Object.keys(relatedFields).map(function(key)
|
||||
{
|
||||
return {text: relatedFields[key], value: key};
|
||||
});
|
||||
|
||||
var $relatedField = $(obj).closest('tr').find("select[name^='relatedField']");
|
||||
var picker = $relatedField.data('zui.picker');
|
||||
|
||||
if(picker) picker.destroy();
|
||||
$relatedField.picker({list: relatedFieldOptions, autoselectfirst: true});
|
||||
}
|
||||
|
||||
/**
|
||||
* Active field.
|
||||
*
|
||||
* @param obj $obj
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function activeField(obj)
|
||||
{
|
||||
if(currentTheme == 'default')
|
||||
{
|
||||
$(obj).closest('tr').find('#' + $(obj).data('field')).css('color', '#2e7fff');
|
||||
}
|
||||
else
|
||||
{
|
||||
$(obj).closest('tr').find('#' + $(obj).data('field')).addClass('text-primary');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove field active.
|
||||
*
|
||||
* @param obj $obj
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function removeActive(obj)
|
||||
{
|
||||
if(currentTheme == 'default')
|
||||
{
|
||||
$(obj).closest('tr').find('#' + $(obj).data('field')).css('color', '#0b0f18');
|
||||
}
|
||||
else
|
||||
{
|
||||
$(obj).closest('tr').find('#' + $(obj).data('field')).removeClass('text-primary');
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function()
|
||||
{
|
||||
$('#sql').on('input', function()
|
||||
{
|
||||
$('.error').addClass('hidden');
|
||||
// fieldSettings = {};
|
||||
})
|
||||
|
||||
$('#sql').on('change', function()
|
||||
{
|
||||
DataStorage.fieldSettings = {};
|
||||
DataStorage.langs = {};
|
||||
})
|
||||
|
||||
if($('#sql').val()) setTimeout(query, 500);
|
||||
$('.query').click(function()
|
||||
{
|
||||
DataStorage.pageID = 1;
|
||||
query();
|
||||
});
|
||||
|
||||
$('.fieldSettings').click(function() {
|
||||
query(function() {
|
||||
|
||||
var formTpl = $('#fieldSettingTpl').html();
|
||||
var formHtml = $(formTpl);
|
||||
|
||||
var tbodyTpl = $('#tbodyTpl').html();
|
||||
|
||||
var fieldTypeOptions = Object.keys(lang.objects).map(function(key)
|
||||
{
|
||||
return {text: lang.objects[key], value: key};
|
||||
});
|
||||
|
||||
var fieldSettings = DataStorage.fieldSettings;
|
||||
var objectFields = DataStorage.objectFields;
|
||||
var langs = DataStorage.langs;
|
||||
var tbodyHtmls = Object.keys(fieldSettings).map(function(field)
|
||||
{
|
||||
var relatedFields = [];
|
||||
var relatedObjectFields = objectFields[fieldSettings[field].object];
|
||||
for(let index in relatedObjectFields) relatedFields[index] = relatedObjectFields[index].name;
|
||||
var relatedFieldOptions = Object.keys(relatedFields).map(function(key)
|
||||
{
|
||||
return {text: relatedFields[key], value: key};
|
||||
});
|
||||
|
||||
var html = $($.zui.formatString(tbodyTpl, {field: field, name: fieldSettings[field].name}));
|
||||
html.find('select#relatedTable' + field).picker({list: fieldTypeOptions, defaultValue: fieldSettings[field].object});
|
||||
html.find('select#relatedField' + field).picker({list: relatedFieldOptions, defaultValue: fieldSettings[field].field});
|
||||
html.find("input[name^='langs']").each(function()
|
||||
{
|
||||
var field = $(this).data('field');
|
||||
var lang = $(this).data('lang');
|
||||
|
||||
var fieldName = '';
|
||||
if(lang == clientLang)
|
||||
{
|
||||
var relatedFieldName = $(this).closest('tr').find('select#relatedField' + field + '~ div.picker').find('span.picker-selection-text').text();
|
||||
fieldName = relatedFieldName ? relatedFieldName : DataStorage.fields[field];
|
||||
}
|
||||
fieldName = !$.isEmptyObject(langs) && typeof(langs[field]) != 'undefined' && typeof(langs[field][lang]) != 'undefined' && langs[field][lang] ? langs[field][lang] : fieldName;
|
||||
$(this).val(fieldName);
|
||||
});
|
||||
return html;
|
||||
});
|
||||
|
||||
formHtml.find('tbody').append(tbodyHtmls);
|
||||
|
||||
var modal = $('#addModal');
|
||||
modal.find('.modal-body').html(formHtml);
|
||||
modal.modal({width: 500});
|
||||
})
|
||||
});
|
||||
|
||||
$('#save').click(function()
|
||||
{
|
||||
if(typeof dataview !== 'undefined' && dataview.used)
|
||||
{
|
||||
bootbox.confirm(warningDesign, function(res) { if(res) query(submitForm); });
|
||||
}
|
||||
else
|
||||
{
|
||||
query(submitForm);
|
||||
}
|
||||
});
|
||||
|
||||
$('.first-page,.left-page,.last-page,.right-page').click(function()
|
||||
{
|
||||
DataStorage.pageID = $(this).data('page');
|
||||
query();
|
||||
});
|
||||
|
||||
$('.dropup li a').click(function()
|
||||
{
|
||||
DataStorage.pageID = 1;
|
||||
DataStorage.recPerPage = $(this).data('size');
|
||||
query();
|
||||
})
|
||||
});
|
||||
@@ -0,0 +1,180 @@
|
||||
<?php
|
||||
/**
|
||||
* The browse view file of dataview module of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2022 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
|
||||
* @license ZPL (http://zpl.pub/page/zplv12.html)
|
||||
* @author Chenxuan Song <1097180981@qq.com>
|
||||
* @package dataview
|
||||
* @version $Id: browse.html.php 4129 2022-11-14 14:42:12 $
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
?>
|
||||
<?php include $app->getModuleRoot() . 'common/view/header.html.php';?>
|
||||
<?php js::set('table', $selectedTable);?>
|
||||
<?php js::set('dataview', $dataview);?>
|
||||
<?php js::set('warningDesign', $lang->dataview->error->warningDesign);?>
|
||||
<div id='mainMenu' class='clearfix'>
|
||||
<div class='btn-toolbar pull-left'><?php // common::printAdminSubMenu('dev');?></div>
|
||||
<div class="btn-toolbar pull-right">
|
||||
<?php if(common::hasPriv('dataview', 'create')) echo html::a($this->createLink('dataview', 'create'), "<i class='icon icon-plus'></i><span class='text'>" . $lang->dataview->create . "</span>", '', "class='btn btn-secondary'");?>
|
||||
</div>
|
||||
</div>
|
||||
<script>$('#mainMenu #<?php echo $tab;?>').addClass('btn-active-text')</script>
|
||||
|
||||
<div id='mainContent' class='main-row'>
|
||||
<div class='side-col' id='sidebar'>
|
||||
<div class='cell'>
|
||||
<div class="panel panel-sm with-list">
|
||||
<div class='panel-heading'>
|
||||
<?php foreach($lang->dataview->typeList as $key => $label):?>
|
||||
<?php echo html::a(inlink('browse', "type=$key"), "<span class='text'>$label</span>", '', "class='btn btn-link " . ($type == $key ? 'btn-active-text' : '') . "'");?>
|
||||
<?php endforeach;?>
|
||||
</div>
|
||||
<?php if($type == 'table') echo $originTable;?>
|
||||
<?php if($type == 'view'):?>
|
||||
<?php if(!$groupTree):?>
|
||||
<hr class="space">
|
||||
<div class="text-center text-muted">
|
||||
<?php echo $lang->dataview->noModule;?>
|
||||
</div>
|
||||
<hr class="space">
|
||||
<?php endif;?>
|
||||
<?php echo $groupTree;?>
|
||||
<div class="text-center">
|
||||
<?php common::printLink('tree', 'browsegroup', "dimensionID=0&groupID=0&type=dataview", $lang->dataview->manageGroup, '', "class='btn btn-info btn-wide'");?>
|
||||
<hr class="space-sm" />
|
||||
</div>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id='dataContent' class='main-col main-content'>
|
||||
<div class='detail'>
|
||||
<div class='detail-title'>
|
||||
<div class='dataview-title' title='<?php echo $dataTitle;?>'><?php echo $dataTitle;?></div>
|
||||
<div class='actions pull-right'>
|
||||
<?php if($selectedTable and isset($dataview)):?>
|
||||
<?php
|
||||
$designTitle = $lang->dataview->design;
|
||||
$editTitle = $lang->dataview->edit;
|
||||
$deleteTitle = $lang->dataview->delete;
|
||||
if(common::hasPriv('dataview', 'query') and $type == 'view') echo html::a('#', "<i class='icon icon-design'></i> {$lang->dataview->design}", '', "class='query-view' title='{$designTitle}'");
|
||||
if(common::hasPriv('dataview', 'edit') and $type == 'view') echo html::a($this->createLink('dataview', 'edit', "id=$selectedTable", '', true), "<i class='icon icon-edit'></i> {$lang->dataview->edit}", '', "class='iframe' title='{$editTitle}' data-width='480'");
|
||||
if(common::hasPriv('dataview', 'delete') and $type == 'view') echo html::a($this->createLink('dataview', 'delete', "id=$selectedTable"), "<i class='icon icon-trash'></i> {$lang->dataview->delete}", 'hiddenwin', "class='query-delete' title='{$deleteTitle}'");
|
||||
?>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if($selectedTable):?>
|
||||
<div class='detail-content'>
|
||||
<div class='tabs'>
|
||||
<ul class='nav nav-tabs'>
|
||||
<li class='active'><a href='#data' data-toggle='tab'><?php echo $lang->dataview->data;?></a></li>
|
||||
<li><a href='#schema' data-toggle='tab'><?php echo $lang->dataview->schema;?></a></li>
|
||||
<?php if(!empty($dataview)):?>
|
||||
<li><a href='#details' data-toggle='tab'><?php echo $lang->dataview->details;?></a></li>
|
||||
<?php endif;?>
|
||||
</ul>
|
||||
<div class='tab-content '>
|
||||
<div class='tab-pane active' id='data'>
|
||||
<?php if(!empty($fields)):?>
|
||||
<table class="table table-bordered" style="min-width: <?php echo count($fields)*100;?>px">
|
||||
<thead>
|
||||
<tr>
|
||||
<?php foreach($fields as $key => $field):?>
|
||||
<?php
|
||||
$fieldName = isset($dataview->fieldSettings->$key->name) ? $dataview->fieldSettings->$key->name : $key;
|
||||
if(!empty($dataview->langs))
|
||||
{
|
||||
$langs = json_decode($dataview->langs, true);
|
||||
if(!empty($langs)) $fieldName = $langs[$key][$clientLang] ? $langs[$key][$clientLang] : $fieldName;
|
||||
}
|
||||
?>
|
||||
<th><?php echo $fieldName;?></th>
|
||||
<?php endforeach;?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach($data as $value):?>
|
||||
<?php echo '<tr>';?>
|
||||
<?php foreach($fields as $key => $field):?>
|
||||
<td title='<?php echo isset($value->$key) ? $value->$key : 'null';?>'><?php echo isset($value->$key) ? $value->$key : 'null';?></td>
|
||||
<?php endforeach;?>
|
||||
<?php echo '</tr>';?>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
<div class='tab-pane' id='schema'>
|
||||
<?php if(!empty($fields)):?>
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class='w-id'><?php echo $lang->dev->fields['id']?></th>
|
||||
<th><?php echo $lang->dev->fields['name']?></th>
|
||||
<?php if(strpos($selectedTable, $this->config->db->prefix) !== false) echo "<th>{$lang->dev->fields['desc']}</th>"?>
|
||||
<th><?php echo $lang->dev->fields['type']?></th>
|
||||
<th><?php echo $lang->dev->fields['length']?></th>
|
||||
<th><?php echo $lang->dev->fields['null']?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php $i = 1;?>
|
||||
<?php foreach($fields as $key => $field):?>
|
||||
<tr>
|
||||
<td title='<?php echo $i;?>'><?php echo $i;?></td>
|
||||
<td title='<?php echo $key;?>'><?php echo $key;?></td>
|
||||
<?php if(strpos($selectedTable, $this->config->db->prefix) !== false) echo "<td title='{$field['name']}'>{$field['name']}</td>"?>
|
||||
<td title="<?php echo $field['type'];?>"><?php echo $field['type'];?></td>
|
||||
<td title='<?php echo isset($field['options']['max']) ? $field['options']['max'] : '';?>'><?php echo isset($field['options']['max']) ? $field['options']['max'] : '';?></td>
|
||||
<td title='<?php echo $field['null'];?>'><?php echo $field['null'];?></td>
|
||||
</tr>
|
||||
<?php $i++; endforeach?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
<?php if(!empty($dataview)):?>
|
||||
<div class='tab-pane' id='details'>
|
||||
<table class="table table-data table-fixed">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><?php echo $lang->dataview->name;?></th>
|
||||
<td title='<?php echo $dataview->name;?>'><?php echo $dataview->name;?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->dataview->code;?></th>
|
||||
<td><?php echo $dataview->code;?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->dataview->view;?></th>
|
||||
<td><?php echo empty($dataview->sql) ? '' : $dataview->view;?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->dataview->group;?></th>
|
||||
<td><?php echo zget($groups, $dataview->group);?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->dataview->sql;?></th>
|
||||
<td class='dataview-sql'><?php echo $dataview->sql;?></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php else:?>
|
||||
<div class='detail-content'>
|
||||
<div class="table-empty-tip">
|
||||
<p><span class="text-muted"><?php echo $lang->dataview->notSelect;?></span></p>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php include $this->app->getModuleRoot() . 'common/view/footer.html.php';?>
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php include $app->getModuleRoot() . 'common/view/header.html.php';?>
|
||||
<div id='mainMenu' class='clearfix'>
|
||||
<div class='btn-toolbar pull-left'>
|
||||
<div class='page-title'>
|
||||
<span title='<?php echo $title;?>' class='text'><?php echo $title;?></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id='mainContent' class='main-content'>
|
||||
<div class='center-block'>
|
||||
<form method='post' target='hiddenwin' id='dataform' class="form-ajax">
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<th><?php echo $lang->dataview->group;?></th>
|
||||
<td><?php echo html::select('group', $groups, '', "class='form-control chosen'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='thWidth'><?php echo $lang->dataview->name;?></th>
|
||||
<td class='w-400px'>
|
||||
<?php echo html::input('name', '', 'class="form-control"');?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->dataview->code;?></th>
|
||||
<td><?php echo html::input('code', '', "class='form-control'");?></td>
|
||||
</tr>
|
||||
<tr class="error hidden"><th></th><td></td></tr>
|
||||
<tr>
|
||||
<td colspan='2' class='form-actions text-center'>
|
||||
<?php echo html::submitButton() . html::hidden('sql') . html::hidden('fields') . html::hidden('langs');?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?php include $app->getModuleRoot() . 'common/view/footer.html.php';?>
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php include $app->getModuleRoot() . 'common/view/header.html.php';?>
|
||||
<?php js::set('lang', $lang->dataview);?>
|
||||
<?php js::set('dataview', $dataview);?>
|
||||
<div id='mainMenu' class='clearfix'>
|
||||
<div class='btn-toolbar pull-left'>
|
||||
<div class='page-title'>
|
||||
<span title='<?php echo $title;?>' class='text'><?php echo $title;?></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id='mainContent' class='main-content'>
|
||||
<div class='center-block'>
|
||||
<form method='post' target='hiddenwin' id='dataform' class="form-ajax">
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<th><?php echo $lang->dataview->group;?></th>
|
||||
<td><?php echo html::select('group', $groups, $dataview->group, "class='form-control chosen' data-drop_direction='down'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class='thWidth'><?php echo $lang->dataview->name;?></th>
|
||||
<td class='w-400px'>
|
||||
<?php echo html::input('name', $dataview->name, 'class="form-control"');?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="error hidden">
|
||||
<th></th>
|
||||
<td colspan='2'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class='form-actions'>
|
||||
<?php echo html::submitButton();?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?php include $app->getModuleRoot() . 'common/view/footer.html.php';?>
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php include $app->getModuleRoot() . 'common/view/header.html.php';?>
|
||||
<?php js::set('rawMethod', $app->rawMethod);?>
|
||||
<?php js::set('dataview', $data);?>
|
||||
<?php js::set('warningDesign', $lang->dataview->error->warningDesign);?>
|
||||
<?php js::set('langSettings', isset($data->langs) ? $data->langs : '')?>
|
||||
<?php js::set('objectFields', isset($objectFields) ? $objectFields : array());?>
|
||||
<?php js::set('fieldSettings', zget($data, 'fieldSettings', ''));?>
|
||||
|
||||
<script>
|
||||
<?php include '../js/datastorage.js';?>
|
||||
window.DataStorage = initStorage(
|
||||
{
|
||||
fields: {},
|
||||
columns: {},
|
||||
rows: {},
|
||||
langs: langSettings ? JSON.parse(langSettings) : {},
|
||||
relatedObject: {},
|
||||
fieldSettings: Array.isArray(fieldSettings) || typeof fieldSettings != 'object' ? {} : fieldSettings,
|
||||
objectFields: objectFields
|
||||
}, true);
|
||||
</script>
|
||||
|
||||
<div id='mainMenu' class='clearfix'>
|
||||
<div class='btn-toolbar pull-left'>
|
||||
<div class='page-title'>
|
||||
<?php echo html::a($backLink, '<i class="icon icon-angle-left"></i> <span class="text">' . $lang->goback . '</span>', '', "id='back' class='btn btn-link' title={$lang->goback}");?>
|
||||
</div>
|
||||
<div class='divider'></div>
|
||||
<div class='page-title'>
|
||||
<span title='<?php echo $title;?>'><?php echo $title;?></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="create-action pull-right">
|
||||
<?php $iframe = $app->rawMethod == 'create' ? 'iframe' : ''?>
|
||||
<?php if($app->rawMethod == 'create') echo html::a($saveLink, '<i class="icon icon-save"></i> ' . $lang->save, '', "class='btn btn-primary' id='saveButton'");?>
|
||||
<?php if($app->rawMethod != 'create') echo '<button type="button" class="btn btn-primary" id="save"><i class="icon icon-save"></i> ' . $lang->save. '</button>';?>
|
||||
</div>
|
||||
</div>
|
||||
<div id='mainContent' class='main-content'>
|
||||
<div class='center-block'>
|
||||
<style><?php include '../css/querybase.css';?></style>
|
||||
<?php include 'querybase.html.php';?>
|
||||
<script><?php include '../js/querybase.js';?></script>
|
||||
</div>
|
||||
</div>
|
||||
<?php include $app->getModuleRoot() . 'common/view/footer.html.php';?>
|
||||
@@ -0,0 +1,171 @@
|
||||
<?php js::set('lang', $lang->dataview);?>
|
||||
<?php js::set('queryResult', $lang->dataview->queryResult);?>
|
||||
<?php js::set('clientLang', $this->app->getClientLang());?>
|
||||
<?php js::set('currentTheme', $this->app->cookie->theme);?>
|
||||
<?php js::set('recTotalTip', $lang->dataview->recTotalTip);?>
|
||||
<?php js::set('recPerPageTip', $lang->dataview->recPerPageTip);?>
|
||||
<div class='panel'>
|
||||
<div class='panel-heading'>
|
||||
<div class='btn-active-text'><span class='text ptitle'><?php echo $lang->dataview->sqlQuery;?></span></div>
|
||||
</div>
|
||||
<form method='post' id='dataform' class="form-ajax">
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<th style="width: 0; padding: 0; margin: 0;"></th>
|
||||
<td>
|
||||
<?php echo html::textarea('sql', isset($data) ? $data->sql : '', "placeholder='" . $lang->dataview->sqlPlaceholder . "' class='form-control' rows=6");?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="error hidden"><th></th><td></td></tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<button type="button" class="btn query btn-primary"><?php echo $lang->dataview->query;?></button>
|
||||
<span id='querying' class='hidden query-padding'><?php echo $lang->dataview->querying;?></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
<div class="panel table-panel" id='queryTable'>
|
||||
<div class="panel-heading titleResult">
|
||||
<div class='btn-active-text'>
|
||||
<span class='text'><?php echo $lang->dataview->result;?></span>
|
||||
<button type="button" class="btn btn-link fieldSettings pull-right"><i class='icon icon-cog-outline'></i> <?php echo $lang->dataview->fieldSettings;?></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="table-empty-tip">
|
||||
<p><span class="text-muted"><?php echo $lang->dataview->noQueryData;?></span></p>
|
||||
</div>
|
||||
<div style="overflow-x: auto; padding: 0px 20px;">
|
||||
<table class="result table table-condensed table-striped table-bordered table-fixed datatable">
|
||||
</table>
|
||||
</div>
|
||||
<div class='table-footer hide'>
|
||||
<ul class="pager">
|
||||
<li><div class="pager-label recTotal"></div></li>
|
||||
<li>
|
||||
<div class="btn-group pager-size-menu dropup">
|
||||
<button type="button" class="btn dropdown-toggle recPerPage" data-toggle="dropdown" style="border-radius: 4px;"></button>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="javascript:;" data-size="5">5</a></li>
|
||||
<li><a href="javascript:;" data-size="10">10</a></li>
|
||||
<li><a href="javascript:;" data-size="15">15</a></li>
|
||||
<li><a href="javascript:;" data-size="20">20</a></li>
|
||||
<li><a href="javascript:;" data-size="25">25</a></li>
|
||||
<li><a href="javascript:;" data-size="30">30</a></li>
|
||||
<li><a href="javascript:;" data-size="35">35</a></li>
|
||||
<li><a href="javascript:;" data-size="40">40</a></li>
|
||||
<li><a href="javascript:;" data-size="45">45</a></li>
|
||||
<li><a href="javascript:;" data-size="50">50</a></li>
|
||||
<li><a href="javascript:;" data-size="100">100</a></li>
|
||||
<li><a href="javascript:;" data-size="200">200</a></li>
|
||||
<li><a href="javascript:;" data-size="500">500</a></li>
|
||||
<li><a href="javascript:;" data-size="1000">1000</a></li>
|
||||
<li><a href="javascript:;" data-size="2000">2000</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<li class='pager-item-left first-page'>
|
||||
<a class='pager-item' data-page='1' href='javascript:;'><i class='icon icon-first-page'></i></a>
|
||||
</li>
|
||||
<li class='pager-item-left left-page'>
|
||||
<a class='pager-item' data-page='1' href='javascript:;'><i class='icon icon-angle-left'></i></a>
|
||||
</li>
|
||||
<li><div class='pager-label page-number'></div></li>
|
||||
<li class='pager-item-right right-page'>
|
||||
<a class='pager-item' data-page='1' href='javascript:;'><i class='icon icon-angle-right'></i></a>
|
||||
</li>
|
||||
<li class='pager-item-right last-page'>
|
||||
<a class='pager-item' data-page='1' href='javascript:;'><i class='icon icon-last-page'></i></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="addModal">
|
||||
<div class="modal-dialog" style="width: 1200px;">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only"><?php echo $lang->common->close;?></span></button>
|
||||
<h4 class="modal-title"><?php echo $lang->dataview->fieldSettings;?></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<template id="fieldSettingTpl">
|
||||
<form id="edit" onsubmit="javascript:saveSettings();return false;">
|
||||
<table class="table table-form">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class='text-center' style='width: 128px;'><?php echo $lang->dataview->field;?></th>
|
||||
<?php if($this->app->getModuleName() !== 'dataview'):?>
|
||||
<th style='width: 128px; padding-right: 0px;'><?php echo $lang->dataview->relatedTable;?></th>
|
||||
<th style='width: 128px; padding-left: 0px;'><?php echo $lang->dataview->relatedField;?></th>
|
||||
<?php endif;?>
|
||||
<th><?php echo $lang->dataview->multilingual;?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td <?php echo $this->app->getModuleName() !== 'dataview' ? "colspan='4'" : "colspan='2'"?> class="text-center">
|
||||
<button type="submit" id="submit" class="btn btn-wide btn-primary"><?php echo $lang->dataview->save;?></button>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</form>
|
||||
</template>
|
||||
|
||||
<template id="tbodyTpl">
|
||||
<tr>
|
||||
<td><?php echo html::input("{field}", "{field}", "class='form-control text-center' readonly='readonly'");?></td>
|
||||
<?php if($this->app->getModuleName() !== 'dataview'):?>
|
||||
<td style='padding-right: 0px;' data-field='{field}'><?php echo html::select('relatedTable[{field}]', array(), '', "class='form-control chosen' onchange='setRelatedField(this)'")?></td>
|
||||
<td style='padding-left: 0px;' data-field='{field}'><?php echo html::select('relatedField[{field}]', array(), '', "class='form-control chosen'")?></td>
|
||||
<?php endif;?>
|
||||
<td>
|
||||
<div class='input-group'>
|
||||
<?php foreach($config->langs as $key => $name):?>
|
||||
<span class="input-group-addon"><?php echo $name?></span>
|
||||
<?php echo html::input("langs[{field}][$key]", '', "class='form-control' data-field='{field}' data-lang='$key' onclick='activeField(this)' onblur='removeActive(this)'");?>
|
||||
<?php endforeach;?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<script>
|
||||
$(document).ready(function()
|
||||
{
|
||||
$("select[name^=relatedTable]+div.picker, select[name^=relatedField]+div.picker").on('click', function()
|
||||
{
|
||||
var fieldID = $(this).closest('td').data('field');
|
||||
if(currentTheme == 'default')
|
||||
{
|
||||
$(this).closest('tr').find('#' + fieldID).css('color', '#2e7fff');
|
||||
}
|
||||
else
|
||||
{
|
||||
$(this).closest('tr').find('#' + fieldID).addClass('text-primary');
|
||||
}
|
||||
});
|
||||
|
||||
$("select[name^=relatedTable]+div.picker input, select[name^=relatedField]+div.picker input").on('blur', function()
|
||||
{
|
||||
var fieldID = $(this).closest('td').data('field');
|
||||
if(currentTheme == 'default')
|
||||
{
|
||||
$(this).closest('tr').find('#' + fieldID).css('color', '#0b0f18');
|
||||
}
|
||||
else
|
||||
{
|
||||
$(this).closest('tr').find('#' + fieldID).removeClass('text-primary');
|
||||
}
|
||||
});
|
||||
})
|
||||
</script>
|
||||
</template>
|
||||
Reference in New Issue
Block a user