Skip to content

Commit

Permalink
update to 4.8.3
Browse files Browse the repository at this point in the history
Changes into the search model. New filter inside list. New dato for
relations. New locator for components_relation. New table inside
PostgreSQL: relations. Lot of fixes and updates.
  • Loading branch information
renderpci committed Mar 3, 2018
1 parent ade64d0 commit 13c997c
Show file tree
Hide file tree
Showing 547 changed files with 31,121 additions and 12,890 deletions.
37 changes: 27 additions & 10 deletions .htaccess
Original file line number Diff line number Diff line change
@@ -1,10 +1,27 @@
#/dedalo4/.htaccess
#<IfModule mod_rewrite.c>
# RewriteEngine on
# RewriteRule ^$ lib/dedalo/ [L]
# RewriteRule ((?s).*) lib/dedalo/$1 [L]
#</IfModule>
php_value max_input_vars 5000
php_value suhosin.get.max_vars 5000
php_value suhosin.post.max_vars 5000
php_value suhosin.request.max_vars 5000
# Protect files and directories from prying eyes.
<FilesMatch "\.(inc|test|temp|sh|backup|.*backup|TXT|txt|tpl|config|composer\.(json|lock))$|^#.*#$|\.php(~|\.sw[op]|\.bak|\.orig\.save)$">
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order allow,deny
</IfModule>
</FilesMatch>

<FilesMatch ".(eot|ttf|otf|woff|woff2)">
Header set Access-Control-Allow-Origin "*"
</FilesMatch>

# Don't show directory listings for URLs which map to a directory.
Options -Indexes

# Set the default handler.
DirectoryIndex index.php index.html index.htm

# Various header fixes.
<IfModule mod_headers.c>
# Disable content sniffing, since it's an attack vector.
Header always set X-Content-Type-Options nosniff
# Disable Proxy header, since it's an attack vector.
RequestHeader unset Proxy
</IfModule>
24 changes: 12 additions & 12 deletions inc/class.Navigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ static function crearBoton($nombre, $enlace, $estilo='botonTabla') {

global $administracion_abrev_title, $proyectos_title, $usuarios_title , $municipios_title, $actividad_title ;

if(isset($_GET['t'])) $t = $_GET['t'];
if(isset($_GET['t'])) $t = safe_xss($_GET['t']);
global $comarcas_title ;
global $provincias_title ;
global $comunidades_title ;
Expand Down Expand Up @@ -115,13 +115,13 @@ static function crearBoton($nombre, $enlace, $estilo='botonTabla') {
#if( $nombre == $ayuda_title && $localizacion2 == $ayuda_title ) $estilo='botonTablaZactual' ;
#if( $nombre == $estadisticas_title && $localizacion2 == $estadisticas_title ) $estilo='botonTablaZactual' ;

$html .= '\n<table border="0" cellpadding="0" cellspacing="0" class="'.$estilo.'">' ;
$html .= '<table border="0" cellpadding="0" cellspacing="0" class="'.$estilo.'">' ;
$html .= '<tr>' ;
$html .= "<td height=\"16\" width=\"4\"><img src=\"../images/b_left.gif\" width=\"4\" height=\"16\" vspace=\"0\" onClick=\"javascript:top.location='$enlace';\"></td>" ;
$html .= '<td height="16" align="center" background="../images/b_center.gif" nowrap="nowrap"><div class="botonT"><a href="'.$enlace.'">'.$nombre.'</a></div></td>' ;
$html .= '<td height="16" width="4"><img src="../images/b_right.gif" alt="." width="4" height="16" hspace="0" vspace="0"></td>' ;
$html .= '</tr>' ;
$html .= '</table>\n' ;
$html .= '</table>' ;

return $html ;
}
Expand Down Expand Up @@ -221,11 +221,11 @@ static function makeLink($nombre, $enlace, $estilo='linkSeccion', $estiloSelecte
if(!$selected)
{
# CASO NORMAL
$html .= "\n<a class=\"$estilo\" href=\"$enlace\">$nombre</a>";
$html .= "<a class=\"$estilo\" href=\"$enlace\">$nombre</a>";

}else{
# CASO SELECCIONADO
$html .= "\n<a class=\"$estiloSelected\">$nombre</a>";
$html .= "<a class=\"$estiloSelected\">$nombre</a>";
}

return $html ;
Expand All @@ -239,9 +239,9 @@ static function crearSituacion($zonaAct, $localizacion2) {

$html = false ;

$html .= "\n<div id=\"infoSituacion\">";
$html .= "<div id=\"infoSituacion\">";
$html .= "<strong>$zonaAct</strong> : $localizacion2 ";
$html .= "\n</div>";
$html .= "</div>";

return $html ;
}
Expand All @@ -260,7 +260,7 @@ static function makeLinkAccion($nombre, $enlace, $accion=false, $estilo='linkAcc
/*
* caso municipios de nivel 3
*/
if(isset($_GET['t'])) $t = $_GET['t'];
if(isset($_GET['t'])) $t = safe_xss($_GET['t']);
global $municipios_title ;
global $comarcas_title ;
global $provincias_title ;
Expand All @@ -287,17 +287,17 @@ static function makeLinkAccion($nombre, $enlace, $accion=false, $estilo='linkAcc
if(!$selected) {

# CASO NORMAL
$html .= "\n<a class=\"$estilo\" href=\"$enlace\">";
$html .= "<a class=\"$estilo\" href=\"$enlace\">";
$html .= $icono ;
$html .= $nombre ;
$html .= "\n</a>";
$html .= "</a>";

}else{
# CASO SELECCIONADO
$html .= "\n<a class=\"$estiloSelected\" >";
$html .= "<a class=\"$estiloSelected\" >";
$html .= $icono ;
$html .= $nombre ;
$html .= "\n</a>";
$html .= "</a>";
}


Expand Down
4 changes: 4 additions & 0 deletions install/db/db_info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"data_version":"4.8.3",
"build_date":"2018-01-21 20:20:31"
}
Binary file modified install/db/dedalo4_install.backup
Binary file not shown.
1 change: 0 additions & 1 deletion install/set_psw/trigger.set_psw.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
?>\n" . $contents
);

#exit();

} #if($mode=='set_psw')
?>
2 changes: 1 addition & 1 deletion lib/dedalo/area/css/area.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion lib/dedalo/area_thesaurus/area_thesaurus.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@
css::$ar_url[] = DEDALO_LIB_BASE_URL."/$element_name/css/$element_name.css";
js::$ar_url[] = DEDALO_LIB_BASE_URL."/$element_name/js/$element_name.js";

$element_name = 'component_autocomplete';
css::$ar_url[] = DEDALO_LIB_BASE_URL."/$element_name/css/$element_name.css";
js::$ar_url[] = DEDALO_LIB_BASE_URL."/$element_name/js/$element_name.js";

$element_name = 'diffusion_index_ts';
css::$ar_url[] = DEDALO_LIB_BASE_URL."/diffusion/$element_name/css/$element_name.css";
#js::$ar_url[] = DEDALO_LIB_BASE_URL."/$element_name/js/$element_name.js";
Expand All @@ -92,11 +96,13 @@
#
# SEARCH FORM . ROWS_SEARCH
# Render search form html DEDALO_LANGS_SECTION_TIPO
$search_form_html = '';
/*
$section = section::get_instance(null, DEDALO_THESAURUS_SECTION_TIPO,'list');
$search_form_html = '';
$records_search = new records_search($section, 'list');
$search_form_html = $records_search->get_html();
#dump($records_search, ' $records_search ++ '.to_string());
#dump($records_search, ' $records_search ++ '.to_string());*/

#
# ACTIVE HIERARCHIES
Expand Down
58 changes: 46 additions & 12 deletions lib/dedalo/area_thesaurus/class.area_thesaurus.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,17 @@ public function get_tipology_name( $tipology_section_tipo ) {
$modo,
$lang,
$section_tipo);
$value = $component->get_valor(0);
$value = $component->get_valor($lang);

if (empty($value)) {
$tipology_name = component_input_text::render_list_value($value, $tipo, $parent, $modo, $lang, $section_tipo);
}else{
$tipology_name = $value;
}
}

if (empty($tipology_name)) {
$tipology_name = 'Tipology unstranslated ' . $tipo .' '. $parent;
}

return (string)$tipology_name;
}//end get_tipology_name
Expand Down Expand Up @@ -179,26 +183,42 @@ public function search_thesaurus( $request_options ) {
$response->msg = '';

$options = new stdClass();
$options->term = false;
$options->section_id = false;
$options->hierarchy_id = false;
$options->model = false;
$options->limit = 1000;
$options->term = false;
$options->section_id = false;
$options->hierarchy_id = false;
$options->model = false;
$options->limit = 1000;
$options->comparison_operator = false;
foreach ($request_options as $key => $value) {if (property_exists($options, $key)) $options->$key = $value;}
#dump($options->model, ' options model ++ '.to_string());

# Active hierarchies
$active_hierarchies = hierarchy::get_active_hierarchies();
#dump($active_hierarchies, ' $active_hierarchies ++ '.to_string());
if (empty($active_hierarchies)) {
$response->result = false;
$response->msg = 'Failed get_active_hierarchies. No active hierarchies found!'.to_string();
return $response;
}

# Target section tipos
$target_string = $options->model===true ? 'target_section_model' : 'target_section';
$target_section_tipos = array_get_by_key($active_hierarchies, $target_string);
#dump($target_section_tipos, ' $target_section_tipos ++ '.to_string($options->model));
if (empty($target_section_tipos)) {
$response->result = false;
$response->msg = 'Failed target_section_tipos. No target_section_tipos found!'.to_string();
return $response;
}

# Terms and tables
$all_term_tipo_by_map = hierarchy::get_all_term_tipo_by_map( $target_section_tipos );
#dump($all_term_tipo_by_map, ' $all_term_tipo_by_map ++ '.to_string());
if (empty($all_term_tipo_by_map)) {
$response->result = false;
$response->msg = 'Failed get_all_term_tipo_by_map for target_section_tipos:'.to_string($target_section_tipos);
return $response;
}

# Move matrix table (bigger talble probably) to the end to optimize results
/*
Expand All @@ -223,14 +243,15 @@ public function search_thesaurus( $request_options ) {
#dump($filter_section, ' filter_section ++ '.to_string());

# STRQUERY
$strQuery = '';
$strQuery = '';
end($all_term_tipo_by_map); // move the internal pointer to the end of the array
$last_key = key($all_term_tipo_by_map); // fetches the key of the element pointed to by the internal pointer
foreach ($all_term_tipo_by_map as $table => $ar_terms) {

// EACH TABLE QUERY
$strQuery .= "\n SELECT section_tipo, section_id FROM $table WHERE ";
$strQuery .= "\n SELECT section_tipo, section_id FROM $table a WHERE ";

#
# Filter term
if ($options->term!==false) {

Expand All @@ -240,7 +261,17 @@ public function search_thesaurus( $request_options ) {
#$last_term_tipo = end($ar_terms);
$ar_lines = array();
foreach ((array)$ar_terms as $term_tipo) {
$line = "\n f_unaccent(datos#>>'{components, $term_tipo, dato}') ILIKE f_unaccent('%".$term."%') ";

#$line = "\n f_unaccent(datos#>>'{components, $term_tipo, dato}') ILIKE f_unaccent('%".$term."%') ";
#dump($request_options, '$options->comparison_operator ++ '.to_string());
$comparison_operator = isset($options->comparison_operator->{$term_tipo}) ? $options->comparison_operator->{$term_tipo} : 'ILIKE';
$current_modelo_name = RecordObj_dd::get_modelo_name_by_tipo($term_tipo,true);
$search_query = $current_modelo_name::get_search_query( 'datos', $term_tipo, $tipo_de_dato_search='dato', $current_lang='all', $term, $comparison_operator);
if(SHOW_DEBUG===true) {
#error_log($search_query);
}
$line = "\n".$search_query;

if (!in_array($line, $ar_lines)) {
$ar_lines[] = $line;
}
Expand All @@ -250,12 +281,14 @@ public function search_thesaurus( $request_options ) {
$strQuery .= implode(" OR\n", $ar_lines);
}

#
# Filter section_id
if ($options->section_id!==false) {
if ($options->term!==false) $strQuery .= " AND ";
$strQuery .= "\n section_id = ".(int)$options->section_id." ";
}

#
# Filter hierarchy_id
if ($options->hierarchy_id!==false && ($options->section_id!==false || $options->term!==false)) {

Expand All @@ -280,11 +313,12 @@ public function search_thesaurus( $request_options ) {
if($table!==$last_key) $strQuery .= "\n UNION ALL ";
}
$strQuery .= "\n LIMIT $options->limit ";
#dump($strQuery, ' $strQuery ++ '.to_string());


$result = JSON_RecordObj_matrix::search_free($strQuery);
$n_rows = pg_num_rows($result);

# DEBUG LOG
debug_log(__METHOD__." strQuery: $strQuery ".exec_time($start_time," ").to_string(), logger::ERROR);

if(SHOW_DEBUG===true) {
Expand Down
2 changes: 1 addition & 1 deletion lib/dedalo/area_thesaurus/css/area_thesaurus.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/dedalo/area_thesaurus/css/area_thesaurus.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 13c997c

Please sign in to comment.