init web ems all

This commit is contained in:
agtuser
2024-09-27 17:13:36 +08:00
parent 81c97acbe9
commit 5cc56f8078
4263 changed files with 798779 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
<select id="ColumnOperator{{ search_index }}" name="criteriaColumnOperators[{{ search_index }}]">
{{ type_operators|raw }}
</select>

View File

@@ -0,0 +1,23 @@
<table class="data"{{ search_type == 'zoom' ? ' id="tableFieldsId"' }}>
{% include 'table/search/table_header.twig' with {
'geom_column_flag': geom_column_flag
} only %}
<tbody>
{% if search_type == 'zoom' %}
{% include 'table/search/rows_zoom.twig' with {
'self': self,
'column_names': column_names,
'criteria_column_names': criteria_column_names,
'criteria_column_types': criteria_column_types
} only %}
{% else %}
{% include 'table/search/rows_normal.twig' with {
'self': self,
'geom_column_flag': geom_column_flag,
'column_names': column_names,
'column_types': column_types,
'column_collations': column_collations
} only %}
{% endif %}
</tbody>
</table>

View File

@@ -0,0 +1,4 @@
<form method="post" action="{{ script_name }}" name="insertForm" id="{{ form_id }}" class="ajax lock-page">
{{ Url_getHiddenInputs(db, table) }}
<input type="hidden" name="goto" value="{{ goto }}" />
<input type="hidden" name="back" value="{{ script_name }}" />

View File

@@ -0,0 +1,19 @@
{# Displays 'Function' column if it is present #}
<td>
{% set geom_types = Util_getGISDatatypes() %}
{% if column_types[column_index] in geom_types %}
<select class="geom_func" name="geom_func[{{ column_index }}]">
{# get the relevant list of GIS functions #}
{% set funcs = Util_getGISFunctions(column_types[column_index], true, true) %}
{% for func_name, func in funcs %}
{% set name = func['display'] is defined ? func['display'] : func_name %}
<option value="{{ name }}">
{{ name }}
</option>
{% endfor %}
</select>
{% else %}
&nbsp;
{% endif %}
</td>

View File

@@ -0,0 +1,96 @@
{# Get inputbox based on different column types (Foreign key, geometrical, enum) #}
{% if foreigners and Relation_searchColumnInForeigners(foreigners, column_name) %}
{% if foreign_data['disp_row'] is iterable %}
<select name="criteriaValues[{{ column_index }}]"
id="{{ column_id }}{{ column_index }}">
{{ Relation_foreignDropdown(
foreign_data['disp_row'],
foreign_data['foreign_field'],
foreign_data['foreign_display'],
'',
foreign_max_limit
) }}
</select>
{% elseif foreign_data['foreign_link'] == true %}
<input type="text"
id="{{ column_id }}{{ column_index }}"
name="criteriaValues[{{ column_index }}]"
id="field_{{ column_name_hash }}[{{ column_index }}]"
class="textfield"
{% if criteria_values[column_index] is defined %}
value="{{ criteria_values[column_index] }}"
{% endif %} />
<a class="ajax browse_foreign" href="browse_foreigners.php" data-post="
{{- Url_getCommon({'db': db, 'table': table}, '', false) -}}
&amp;field={{ column_name|url_encode }}&amp;fieldkey=
{{- column_index }}&amp;fromsearch=1">
{{ titles['Browse']|replace({"'": "\\'"})|raw }}
</a>
{% endif %}
{% elseif column_type in Util_getGISDatatypes() %}
<input type="text"
name="criteriaValues[{{ column_index }}]"
size="40"
class="textfield"
id="field_{{ column_index }}" />
{% if in_fbs %}
{% set edit_str = Util_getIcon('b_edit', 'Edit/Insert'|trans) %}
<span class="open_search_gis_editor">
{{ Util_linkOrButton('gis_data_editor.php', [], edit_str, [], '_blank') }}
</span>
{% endif %}
{% elseif column_type starts with 'enum'
or (column_type starts with 'set' and in_zoom_search_edit) %}
{% set in_zoom_search_edit = false %}
{% set value = column_type|e|slice(5, -1)|replace({'&#039;': ''})|split(', ') %}
{% set cnt_value = value|length %}
{#
Enum in edit mode --> dropdown
Enum in search mode --> multiselect
Set in edit mode --> multiselect
Set in search mode --> input (skipped here, so the 'else' section would handle it)
#}
{% if (column_type starts with 'enum' and not in_zoom_search_edit)
or (column_type starts with 'set' and in_zoom_search_edit) %}
<select name="criteriaValues[{{ column_index }}]"
id="{{ column_id }}{{ column_index }}">
{% else %}
<select name="criteriaValues[{{ column_index }}]"
id="{{ column_id }}{{ column_index }}"
multiple="multiple"
size="{{ min(3, cnt_value) }}">
{% endif %}
{# Add select options #}
<option value=""></option>
{% for i in 0..cnt_value - 1 %}
{% if criteria_values[column_index] is defined
and criteria_values[column_index] is iterable
and value[i] in criteria_values[column_index] %}
<option value="{{ value[i]|raw }}" selected>
{{ value[i]|raw }}
</option>
{% else %}
<option value="{{ value[i]|raw }}">
{{ value[i]|raw }}
</option>
{% endif %}
{% endfor %}
</select>
{% else %}
{% set the_class = 'textfield' %}
{% if column_type == 'date' %}
{% set the_class = the_class ~ ' datefield' %}
{% elseif column_type == 'datetime' or column_type starts with 'timestamp' %}
{% set the_class = the_class ~ ' datetimefield' %}
{% elseif column_type starts with 'bit' %}
{% set the_class = the_class ~ ' bit' %}
{% endif %}
<input type="text"
name="criteriaValues[{{ column_index }}]"
size="40"
class="{{ the_class }}"
id="{{ column_id }}{{ column_index }}"
{% if criteria_values[column_index] is defined %}
value="{{ criteria_values[column_index] }}"
{%- endif %} />
{% endif %}

View File

@@ -0,0 +1,67 @@
{{ Util_getDivForSliderEffect('searchoptions', 'Options'|trans) }}
{# Displays columns select list for selecting distinct columns in the search #}
<fieldset id="fieldset_select_fields">
<legend>
{% trans 'Select columns (at least one):' %}
</legend>
<select name="columnsToDisplay[]"
size="{{ min(column_names|length, 10) }}"
multiple="multiple">
{% for each_field in column_names %}
<option value="{{ each_field }}"
selected="selected">
{{ each_field }}
</option>
{% endfor %}
</select>
<input type="checkbox" name="distinct" value="DISTINCT" id="oDistinct" />
<label for="oDistinct">DISTINCT</label>
</fieldset>
{# Displays input box for custom 'Where' clause to be used in the search #}
<fieldset id="fieldset_search_conditions">
<legend>
<em>{% trans 'Or' %}</em>
{% trans 'Add search conditions (body of the "where" clause):' %}
</legend>
{{ Util_showMySQLDocu('Functions') }}
<input type="text" name="customWhereClause" class="textfield" size="64" />
</fieldset>
{# Displays option of changing default number of rows displayed per page #}
<fieldset id="fieldset_limit_rows">
<legend>{% trans 'Number of rows per page' %}</legend>
<input type="number"
name="session_max_rows"
required="required"
min="1"
value="{{ max_rows }}"
class="textfield" />
</fieldset>
{# Displays option for ordering search results by a column value (Asc or Desc) #}
<fieldset id="fieldset_display_order">
<legend>{% trans 'Display order:' %}</legend>
<select name="orderByColumn"><option value="--nil--"></option>
{% for each_field in column_names %}
<option value="{{ each_field }}">
{{ each_field }}
</option>
{% endfor %}
</select>
{{ Util_getRadioFields(
'order',
{
'ASC': 'Ascending'|trans,
'DESC': 'Descending'|trans
},
'ASC',
false,
true,
'formelement'
) }}
</fieldset>
<div class="clearfloat"></div>

View File

@@ -0,0 +1,43 @@
<table class="data">
{# Select options for data label #}
<tr>
<td>
<label for="dataLabel">
{% trans 'Use this column to label each point' %}
</label>
</td>
<td>
<select name="dataLabel" id="dataLabel" >
<option value = "">
{% trans 'None' %}
</option>
{% for i in 0..column_names|length - 1 %}
{% if data_label is defined and data_label == column_names[i]|e %}
<option value="{{ column_names[i] }}" selected="selected">
{{ column_names[i] }}
</option>
{% else %}
<option value="{{ column_names[i] }}" >
{{ column_names[i] }}
</option>
{% endif %}
{% endfor %}
</select>
</td>
</tr>
{# Inputbox for changing default maximum rows to plot #}
<tr>
<td>
<label for="maxRowPlotLimit">
{% trans 'Maximum rows to plot' %}
</label>
</td>
<td>
<input type="number"
name="maxPlotLimit"
id="maxRowPlotLimit"
required="required"
value="{{ max_plot_limit }}" />
</td>
</tr>
</table>

View File

@@ -0,0 +1,39 @@
<form method="post"
action="tbl_find_replace.php"
name="previewForm"
id="previewForm">
{{ Url_getHiddenInputs(db, table) }}
<input type="hidden" name="replace" value="true" />
<input type="hidden" name="columnIndex" value="{{ column_index }}" />
<input type="hidden" name="findString" value="{{ find }}" />
<input type="hidden" name="replaceWith" value="{{ replace_with }}" />
<input type="hidden" name="useRegex" value="{{ use_regex }}" />
<fieldset id="fieldset_find_replace_preview">
<legend>{% trans 'Find and replace - preview' %}</legend>
<table id="previewTable">
<thead>
<tr>
<th>{% trans 'Count' %}</th>
<th>{% trans 'Original string' %}</th>
<th>{% trans 'Replaced string' %}</th>
</tr>
</thead>
<tbody>
{% if result is iterable %}
{% for row in result %}
<tr>
<td class="right">{{ row[2] }}</td>{# count #}
<td>{{ row[0] }}</td>{# original #}
<td>{{ row[1] }}</td>{# replaced #}
</tr>
{% endfor %}
{% endif %}
</tbody>
</table>
</fieldset>
<fieldset class="tblFooters">
<input type="submit" name="replace" value="{% trans 'Replace' %}" />
</fieldset>
</form>

View File

@@ -0,0 +1,39 @@
{% for column_index in 0..column_names|length - 1 %}
<tr class="noclick">
{# If 'Function' column is present trying to change comment #}
{% if geom_column_flag %}
{% include 'table/search/geom_func.twig' with {
'column_index': column_index,
'column_types': column_types
} only %}
{% endif %}
{# Displays column's name, type, collation and value #}
<th>
{{ column_names[column_index] }}
</th>
{% set properties = self.getColumnProperties(column_index, column_index) %}
<td dir="ltr">
{{ properties['type'] }}
</td>
<td>
{{ properties['collation'] }}
</td>
<td>
{{ properties['func']|raw }}
</td>
{# here, the data-type attribute is needed for a date/time picker #}
<td data-type="{{ properties['type'] }}">
{{ properties['value']|raw }}
{# Displays hidden fields #}
<input type="hidden"
name="criteriaColumnNames[{{ column_index }}]"
value="{{ column_names[column_index] }}" />
<input type="hidden"
name="criteriaColumnTypes[{{ column_index }}]"
value="{{ column_types[column_index] }}" />
<input type="hidden"
name="criteriaColumnCollations[{{ column_index }}]"
value="{{ column_collations[column_index] }}" />
</td>
</tr>
{% endfor %}

View File

@@ -0,0 +1,74 @@
{# Get already set search criteria (if any) #}
{% set type = [] %}
{% set collation = [] %}
{% set func = [] %}
{% set value = [] %}
{% for i in 0..3 %}
{# After X-Axis and Y-Axis column rows, display additional criteria option #}
{% if i == 2 %}
<tr>
<td>
{% trans 'Additional search criteria' %}
</td>
</tr>
{% endif %}
<tr class="noclick">
<th>
<select name="criteriaColumnNames[]" id="tableid_{{ i }}" >
<option value="pma_null">
{% trans 'None' %}
</option>
{% for j in 0..column_names|length - 1 %}
{% if criteria_column_names[i] is defined
and criteria_column_names[i] == column_names[j] %}
<option value="{{ column_names[j] }}" selected="selected">
{{ column_names[j] }}
</option>
{% else %}
<option value="{{ column_names[j] }}">
{{ column_names[j] }}
</option>
{% endif %}
{% endfor %}
</select>
</th>
{% if criteria_column_names is defined
and criteria_column_names[i] != 'pma_null' %}
{% set key = array_search(criteria_column_names[i], column_names) %}
{% set properties = self.getColumnProperties(i, key) %}
{% set type = type|merge({i: properties['type']}) %}
{% set collation = collation|merge({i: properties['collation']}) %}
{% set func = func|merge({i: properties['func']}) %}
{% set value = value|merge({i: properties['value']}) %}
{% endif %}
{# Column type #}
<td dir="ltr">
{{ type[i] is defined ? type[i] }}
</td>
{# Column Collation #}
<td>
{{ collation[i] is defined ? collation[i] }}
</td>
{# Select options for column operators #}
<td>
{{ func[i] is defined ? func[i]|raw }}
</td>
{# Inputbox for search criteria value #}
<td>
</td>
<td>
{{ value[i] is defined ? value[i]|raw }}
{# Displays hidden fields #}
<input type="hidden"
name="criteriaColumnTypes[{{ i }}]"
id="types_{{ i }}"
{%- if criteria_column_types[i] is defined %}
value="{{ criteria_column_types[i] }}"
{%- endif %} />
<input type="hidden"
name="criteriaColumnCollations[{{ i }}]"
id="collations_{{ i }}" />
</td>
</tr>
{% endfor %}

View File

@@ -0,0 +1,25 @@
{% trans 'Find:' %}
<input type="text" value="" name="find" required />
{% trans 'Replace with:' %}
<input type="text" value="" name="replaceWith" />
{% trans 'Column:' %}
<select name="columnIndex">
{% for i in 0..column_names|length - 1 %}
{% set type = preg_replace('@\\(.*@s', '', column_types[i]) %}
{% if sql_types.getTypeClass(type) == 'CHAR' %}
{% set column = column_names[i] %}
<option value="{{ i }}">
{{ column }}
</option>
{% endif %}
{% endfor %}
</select>
{% include 'checkbox.twig' with {
'html_field_id': 'useRegex',
'html_field_name': 'useRegex',
'label': 'Use regular expression'|trans,
'checked': false,
'onclick': false
} only %}

View File

@@ -0,0 +1,102 @@
{% if search_type == 'zoom' %}
{% include 'table/search/form_tag.twig' with {
'script_name': 'tbl_zoom_select.php',
'form_id': 'zoom_search_form',
'db': db,
'table': table,
'goto': goto
} only %}
<fieldset id="fieldset_zoom_search">
<fieldset id="inputSection">
<legend>
{% trans 'Do a "query by example" (wildcard: "%") for two different columns' %}
</legend>
{% include 'table/search/fields_table.twig' with {
'self': self,
'search_type': search_type,
'geom_column_flag': geom_column_flag,
'column_names': column_names,
'column_types': column_types,
'column_collations': column_collations,
'criteria_column_names': criteria_column_names,
'criteria_column_types': criteria_column_types
} only %}
{% include 'table/search/options_zoom.twig' with {
'data_label': data_label,
'column_names': column_names,
'max_plot_limit': max_plot_limit
} only %}
</fieldset>
</fieldset>
{% elseif search_type == 'normal' %}
{% include 'table/search/form_tag.twig' with {
'script_name': 'tbl_select.php',
'form_id': 'tbl_search_form',
'db': db,
'table': table,
'goto': goto
} only %}
<fieldset id="fieldset_table_search">
<fieldset id="fieldset_table_qbe">
<legend>
{% trans 'Do a "query by example" (wildcard: "%")' %}
</legend>
<div class="responsivetable jsresponsive">
{% include 'table/search/fields_table.twig' with {
'self': self,
'search_type': search_type,
'geom_column_flag': geom_column_flag,
'column_names': column_names,
'column_types': column_types,
'column_collations': column_collations,
'criteria_column_names': criteria_column_names,
'criteria_column_types': criteria_column_types
} only %}
</div>
<div id="gis_editor"></div>
<div id="popup_background"></div>
</fieldset>
{% include 'table/search/options.twig' with {
'column_names': column_names,
'max_rows': max_rows
} only %}
</fieldset>
{% elseif search_type == 'replace' %}
{% include 'table/search/form_tag.twig' with {
'script_name': 'tbl_find_replace.php',
'form_id': 'find_replace_form',
'db': db,
'table': table,
'goto': goto
} only %}
<fieldset id="fieldset_find_replace">
<fieldset id="fieldset_find">
<legend>
{% trans 'Find and replace' %}
</legend>
{% include 'table/search/search_and_replace.twig' with {
'column_names': column_names,
'column_types': column_types,
'sql_types': sql_types
} only %}
</fieldset>
</fieldset>
{% else %}
{% include 'table/search/form_tag.twig' with {
'script_name': '',
'form_id': '',
'db': db,
'table': table,
'goto': goto
} only %}
{% endif %}
{# Displays selection form's footer elements #}
<fieldset class="tblFooters">
<input type="submit"
name="{{ search_type == 'zoom' ? 'zoom_submit' : 'submit' }}"
{{ search_type == 'zoom' ? 'id="inputFormSubmitId"' }}
value="{% trans 'Go' %}" />
</fieldset>
</form>
<div id="sqlqueryresultsouter"></div>

View File

@@ -0,0 +1,12 @@
<thead>
<tr>
{% if geom_column_flag %}
<th>{% trans 'Function' %}</th>
{% endif %}
<th>{% trans 'Column' %}</th>
<th>{% trans 'Type' %}</th>
<th>{% trans 'Collation' %}</th>
<th>{% trans 'Operator' %}</th>
<th>{% trans 'Value' %}</th>
</tr>
</thead>

View File

@@ -0,0 +1,85 @@
<form method="post" action="tbl_zoom_select.php" name="displayResultForm" id="zoom_display_form" class="ajax">
{{ Url_getHiddenInputs(db, table) }}
<input type="hidden" name="goto" value="{{ goto }}" />
<input type="hidden" name="back" value="tbl_zoom_select.php" />
<fieldset id="displaySection">
<legend>{% trans 'Browse/Edit the points' %}</legend>
{# JSON encode the data(query result) #}
<center>
{% if zoom_submit and data is not empty %}
<div id="resizer">
<center>
<a id="help_dialog" href="#">
{% trans 'How to use' %}
</a>
</center>
<div id="querydata" class="hide">
{{ data_json }}
</div>
<div id="querychart"></div>
<button class="button-reset">
{% trans 'Reset zoom' %}
</button>
</div>
{% endif %}
</center>
{# Displays rows in point edit form #}
<div id="dataDisplay" class="hide">
<table>
<thead>
<tr>
<th>{% trans 'Column' %}</th>
<th>{% trans 'Null' %}</th>
<th>{% trans 'Value' %}</th>
</tr>
</thead>
<tbody>
{% for column_index in 0..column_names|length - 1 %}
{% set field_popup = column_names[column_index] %}
{% set foreign_data = Relation_getForeignData(
foreigners,
field_popup,
false,
'',
''
) %}
<tr class="noclick">
<th>{{ column_names[column_index] }}</th>
{# Null checkbox if column can be null #}
<th>
{% if column_null_flags[column_index] == 'YES' %}
<input type="checkbox" class="checkbox_null"
name="criteriaColumnNullFlags[{{ column_index }}]"
id="edit_fields_null_id_{{ column_index }}" />
{% endif %}
</th>
{# Column's Input box #}
<th>
{% include 'table/search/input_box.twig' with {
'str': '',
'column_type': column_types[column_index],
'column_id': column_types[column_index] ? 'edit_fieldID_' : 'fieldID_',
'in_zoom_search_edit': true,
'foreigners': foreigners,
'column_name': field_popup,
'column_name_hash': md5(field_popup),
'foreign_data': foreign_data,
'table': table,
'column_index': column_index,
'foreign_max_limit': foreign_max_limit,
'criteria_values': '',
'db': db,
'titles': titles,
'in_fbs': false
} only %}
</th>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<input type="hidden" id="queryID" name="sql_query" />
</form>