/** * GeoAnalysis@index */ public function index() { $controller = new PageController(); $controller->setPageTitle(I18N::translate('Sosa Geographical dispersion')); $data = new ViewBag(); $data->set('title', $controller->getPageTitle()); $data->set('has_analysis', false); $ga_id = Filter::getInteger('ga_id'); if ($ga_id && ($ga = $this->provider->getGeoAnalysis($ga_id))) { $data->set('has_analysis', true); $data->set('geoanalysis', $ga); $controller->addExternalJavascript(Constants::WT_RAPHAEL_JS_URL())->addInlineJavascript(' jQuery("#geodispersion-tabs").tabs(); jQuery("#geodispersion-tabs").css("visibility", "visible"); jQuery.get( "module.php", { "mod" : "' . $this->module->getName() . '", "mod_action": "GeoAnalysis@dataTabs", "ga_id" : "' . $ga_id . '" }, function(data){ if(data){ jQuery("#geodisp-data-general").html(data.generaltab); jQuery("#geodisp-data-generations").html(data.generationstab); } jQuery(".loading-image").hide(); }, "json" ); '); } ViewFactory::make('GeoAnalysis', $this, $controller, $data)->render(); }
/** * SosaList@missing */ public function missing() { global $WT_TREE; $controller = new PageController(); $controller->setPageTitle(I18N::translate('Missing Ancestors')); $this->view_bag->set('title', $controller->getPageTitle()); if ($this->view_bag->get('is_setup', false)) { $this->view_bag->set('url_module', $this->module->getName()); $this->view_bag->set('url_action', 'SosaList@missing'); $this->view_bag->set('url_ged', $WT_TREE->getNameUrl()); $this->view_bag->set('min_gen', 2); $missing_list = $this->sosa_provider->getMissingSosaListAtGeneration($this->generation); $this->view_bag->set('has_missing', $this->generation > 0 && count($missing_list) > 0); $perc_sosa = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation), pow(2, $this->generation - 1)); $this->view_bag->set('perc_sosa', $perc_sosa); if ($this->view_bag->get('has_missing', false)) { $table_id = 'table-sosa-missing-' . Uuid::uuid4(); $this->view_bag->set('table_id', $table_id); $controller->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)->addInlineJavascript(' /* Initialise datatables */ jQuery.fn.dataTableExt.oSort["unicode-asc" ]=function(a,b) {return a.replace(/<[^<]*>/, "").localeCompare(b.replace(/<[^<]*>/, ""))}; jQuery.fn.dataTableExt.oSort["unicode-desc" ]=function(a,b) {return b.replace(/<[^<]*>/, "").localeCompare(a.replace(/<[^<]*>/, ""))}; jQuery.fn.dataTableExt.oSort["num-html-asc" ]=function(a,b) {a=parseFloat(a.replace(/<[^<]*>/, "")); b=parseFloat(b.replace(/<[^<]*>/, "")); return (a<b) ? -1 : (a>b ? 1 : 0);}; jQuery.fn.dataTableExt.oSort["num-html-desc"]=function(a,b) {a=parseFloat(a.replace(/<[^<]*>/, "")); b=parseFloat(b.replace(/<[^<]*>/, "")); return (a>b) ? -1 : (a<b ? 1 : 0);}; jQuery("#' . $table_id . '").dataTable( { dom: \'<"H"<"filtersH_' . $table_id . '">T<"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_' . $table_id . '">>\', ' . I18N::datatablesI18N() . ', jQueryUI: true, autoWidth:false, processing: true, retrieve: true, columns: [ /* 0-Sosa */ { type: "num", class: "center" }, /* 1-ID */ { class: "center" }, /* 2-givn */ { dataSort: 4, class: "left"}, /* 3-surn */ { dataSort: 5}, /* 4-GIVN,SURN */ { type: "unicode", visible: false}, /* 5-SURN,GIVN */ { type: "unicode", visible: false}, /* PERSO Modify table to include IsSourced module */ /* 6-INDI_SOUR */ { dataSort : 7, class: "center", visible: ' . (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME) ? 'true' : 'false') . ' }, /* 7-SORT_INDISC */ { visible : false}, /* 8-Father */ { class: "center"}, /* 9-Mother */ { class: "center"}, /* 10-Birth */ { dataSort : 11 , class: "center"}, /* 11-SORT_BIRT */ { visible : false}, /* 12-BIRT_PLAC */ { type: "unicode", class: "center"}, /* 13-BIRT_SOUR */ { dataSort : 14, class: "center", visible: ' . (ModuleManager::getInstance()->isOperational(Constants::MODULE_MAJ_ISSOURCED_NAME) ? 'true' : 'false') . ' }, /* 14-SORT_BIRTSC */{ visible : false}, /* 15-SEX */ { visible : false} /* END PERSO */ ], sorting: [[0,"asc"]], displayLength: 20, pagingType: "full_numbers" }); jQuery("#' . $table_id . '") /* Filter buttons in table header */ .on("click", "button[data-filter-column]", function() { var btn = jQuery(this); // De-activate the other buttons in this button group btn.siblings().removeClass("ui-state-active"); // Apply (or clear) this filter var col = jQuery("#' . $table_id . '").DataTable().column(btn.data("filter-column")); if (btn.hasClass("ui-state-active")) { btn.removeClass("ui-state-active"); col.search("").draw(); } else { btn.addClass("ui-state-active"); col.search(btn.data("filter-value")).draw(); } }); jQuery(".smissing-list").css("visibility", "visible"); jQuery(".loading-image").css("display", "none"); '); $unique_indis = array(); $sum_missing_different = 0; $sum_missing_different_without_hidden = 0; foreach ($missing_list as $num => $missing_tab) { if (isset($unique_indis[$missing_tab['indi']])) { unset($missing_list[$num]); continue; } $sum_missing_different += !$missing_tab['has_father'] + !$missing_tab['has_mother']; $person = Individual::getInstance($missing_tab['indi'], $WT_TREE); if (!$person || !$person->canShowName()) { unset($missing_list[$num]); continue; } $sum_missing_different_without_hidden += !$missing_tab['has_father'] + !$missing_tab['has_mother']; $unique_indis[$person->getXref()] = true; $missing_tab['indi'] = $person; $missing_list[$num] = $missing_tab; } $this->view_bag->set('missing_list', $missing_list); $this->view_bag->set('missing_diff_count', $sum_missing_different); $this->view_bag->set('missing_hidden', $sum_missing_different - $sum_missing_different_without_hidden); $perc_sosa_potential = Functions::safeDivision($this->sosa_provider->getSosaCountAtGeneration($this->generation - 1), pow(2, $this->generation - 2)); $this->view_bag->set('perc_sosa_potential', $perc_sosa_potential); } } ViewFactory::make('SosaListMissing', $this, $controller, $this->view_bag)->render(); }
* You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ namespace Fisharebest\Webtrees; /** * Defined in session.php * * @global Tree $WT_TREE */ global $WT_TREE; use Fisharebest\Webtrees\Controller\PageController; define('WT_SCRIPT_NAME', 'admin_trees_manage.php'); require './includes/session.php'; $controller = new PageController(); $controller->addExternalJavascript(WT_ADMIN_JS_URL)->restrictAccess(Auth::isAdmin() || Auth::isManager($WT_TREE))->setPageTitle(I18N::translate('Manage family trees')); // Show a reduced page when there are more than a certain number of trees $multiple_tree_threshold = Site::getPreference('MULTIPLE_TREE_THRESHOLD') ?: 500; // Note that glob() returns false instead of an empty array when open_basedir_restriction // is in force and no files are found. See PHP bug #47358. if (defined('GLOB_BRACE')) { $gedcom_files = glob(WT_DATA_DIR . '*.{ged,Ged,GED}', GLOB_NOSORT | GLOB_BRACE) ?: array(); } else { $gedcom_files = array_merge(glob(WT_DATA_DIR . '*.ged', GLOB_NOSORT) ?: array(), glob(WT_DATA_DIR . '*.Ged', GLOB_NOSORT) ?: array(), glob(WT_DATA_DIR . '*.GED', GLOB_NOSORT) ?: array()); } // Process POST actions switch (Filter::post('action')) { case 'delete': $gedcom_id = Filter::postInteger('gedcom_id'); if (Filter::checkCsrf() && $gedcom_id) { $tree = Tree::findById($gedcom_id);
/** * AdminConfig@index */ public function index() { global $WT_TREE; HookProvider::getInstance()->updateHooks(); $action = Filter::post('action'); if ($action == 'update' && Filter::checkCsrf()) { $this->update(); } Theme::theme(new AdministrationTheme())->init($WT_TREE); $ctrl = new PageController(); $ctrl->restrictAccess(Auth::isAdmin())->setPageTitle($this->module->getTitle()); $table_id = 'table-installedhooks-' . Uuid::uuid4(); $view_bag = new ViewBag(); $view_bag->set('title', $ctrl->getPageTitle()); $view_bag->set('table_id', $table_id); $view_bag->set('hook_list', HookProvider::getInstance()->getRawInstalledHooks()); $ctrl->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL)->addInlineJavascript(' jQuery(document).ready(function() { jQuery("#' . $table_id . '").dataTable( { ' . I18N::datatablesI18N() . ', sorting: [[ 2, "asc" ], [ 3, "asc" ]], displayLength: 10, pagingType: "full_numbers", columns: [ /* 0 Enabled */ { dataSort: 1, class: "center" }, /* 1 Enabled sort */ { visible: false}, /* 2 Hook function */ null, /* 3 Hook context */ null, /* 4 Module name */ null, /* 5 Priority */ { dataSort: 6, class: "center" }, /* 6 Priority sort */ { type: "num", visible: false} ] }); }); '); ViewFactory::make('AdminConfig', $this, $ctrl, $view_bag)->render(); }
/** * Certificate@listAll */ public function listAll() { global $WT_TREE; $controller = new PageController(); $controller->setPageTitle(I18N::translate('Certificates'))->restrictAccess($this->module->getSetting('MAJ_SHOW_CERT', Auth::PRIV_HIDE) >= Auth::accessLevel($WT_TREE)); $city = Filter::get('city'); if (!empty($city) && strlen($city) > 22) { $city = Functions::decryptFromSafeBase64($city); $controller->setPageTitle(I18N::translate('Certificates for %s', $city)); } $data = new ViewBag(); $data->set('title', $controller->getPageTitle()); $data->set('url_module', $this->module->getName()); $data->set('url_action', 'Certificate@listAll'); $data->set('url_ged', $WT_TREE->getNameUrl()); $data->set('cities', $this->provider->getCitiesList()); $data->set('selected_city', $city); $data->set('has_list', false); if (!empty($city)) { $table_id = 'table-certiflist-' . Uuid::uuid4(); $certif_list = $this->provider->getCertificatesList($city); if (!empty($certif_list)) { $data->set('has_list', true); $data->set('table_id', $table_id); $data->set('certificate_list', $certif_list); $controller->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)->addInlineJavascript(' /* Initialise datatables */ jQuery.fn.dataTableExt.oSort["unicode-asc" ]=function(a,b) {return a.replace(/<[^<]*>/, "").localeCompare(b.replace(/<[^<]*>/, ""))}; jQuery.fn.dataTableExt.oSort["unicode-desc" ]=function(a,b) {return b.replace(/<[^<]*>/, "").localeCompare(a.replace(/<[^<]*>/, ""))}; jQuery.fn.dataTableExt.oSort["num-html-asc" ]=function(a,b) {a=parseFloat(a.replace(/<[^<]*>/, "")); b=parseFloat(b.replace(/<[^<]*>/, "")); return (a<b) ? -1 : (a>b ? 1 : 0);}; jQuery.fn.dataTableExt.oSort["num-html-desc"]=function(a,b) {a=parseFloat(a.replace(/<[^<]*>/, "")); b=parseFloat(b.replace(/<[^<]*>/, "")); return (a>b) ? -1 : (a<b ? 1 : 0);}; jQuery("#' . $table_id . '").dataTable( { dom: \'<"H"<"filtersH_' . $table_id . '">T<"dt-clear">pf<"dt-clear">irl>t<"F"pl<"dt-clear"><"filtersF_' . $table_id . '">>\', ' . I18N::datatablesI18N() . ', jQueryUI: true, autoWidth: false, processing: true, columns: [ /* 0-Date */ { dataSort: 1, width: "15%", class: "center" }, /* 1-DateSort */ { type: "unicode", visible : false }, /* 2-Type */ { width: "5%", searchable: false, class: "center"}, /* 3-CertificateSort */ { type: "unicode", visible : false }, /* 4-Certificate */ { dataSort: 3, class: "left" } ], sorting: [[0,"asc"], [2,"asc"]], displayLength: 20, pagingType: "full_numbers" }); jQuery(".certificate-list").css("visibility", "visible"); jQuery(".loading-image").css("display", "none"); '); } } ViewFactory::make('CertificatesList', $this, $controller, $data)->render(); }
/** * AdminConfig@index */ public function index() { global $WT_TREE; Theme::theme(new AdministrationTheme())->init($WT_TREE); $controller = new PageController(); $controller->restrictAccess(Auth::isAdmin())->setPageTitle($this->module->getTitle()); $token = $this->module->getSetting('MAJ_AT_FORCE_EXEC_TOKEN'); if (is_null($token)) { $token = Functions::generateRandomToken(); $this->module->setSetting('PAT_FORCE_EXEC_TOKEN', $token); } $data = new ViewBag(); $data->set('title', $controller->getPageTitle()); $table_id = 'table-admintasks-' . Uuid::uuid4(); $data->set('table_id', $table_id); $data->set('trigger_url_root', WT_BASE_URL . 'module.php?mod=' . $this->module->getName() . '&mod_action=Task@trigger'); $token = $this->module->getSetting('MAJ_AT_FORCE_EXEC_TOKEN'); if (is_null($token)) { $token = Functions::generateRandomToken(); $this->module->setSetting('MAJ_AT_FORCE_EXEC_TOKEN', $token); } $data->set('trigger_token', $token); $this->provider->getInstalledTasks(); $controller->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL)->addInlineJavascript(' //Datatable initialisation jQuery.fn.dataTableExt.oSort["unicode-asc" ]=function(a,b) {return a.replace(/<[^<]*>/, "").localeCompare(b.replace(/<[^<]*>/, ""))}; jQuery.fn.dataTableExt.oSort["unicode-desc" ]=function(a,b) {return b.replace(/<[^<]*>/, "").localeCompare(a.replace(/<[^<]*>/, ""))}; jQuery.fn.dataTableExt.oSort["num-html-asc" ]=function(a,b) {a=parseFloat(a.replace(/<[^<]*>/, "")); b=parseFloat(b.replace(/<[^<]*>/, "")); return (a<b) ? -1 : (a>b ? 1 : 0);}; jQuery.fn.dataTableExt.oSort["num-html-desc"]=function(a,b) {a=parseFloat(a.replace(/<[^<]*>/, "")); b=parseFloat(b.replace(/<[^<]*>/, "")); return (a>b) ? -1 : (a<b ? 1 : 0);}; var adminTasksTable = jQuery("#' . $table_id . '").DataTable({ ' . I18N::datatablesI18N() . ', sorting: [[3, "asc"]], pageLength: 10, processing: true, serverSide : true, ajax : { url : "module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@jsonTasksList&ged=' . $WT_TREE->getNameUrl() . '", type : "POST" }, columns: [ /* 0 Edit */ { sortable: false, className: "text-center"}, /* 1 task_name */ { visible: false }, /* 2 Enabled */ { sortable: false, className: "text-center" }, /* 3 Task Title */ null, /* 4 Last Run */ null, /* 5 Last status */ { className: "text-center" }, /* 6 Frequency */ { sortable: false, className: "text-center" }, /* 7 Nb Occcurrences*/ { sortable: false, className: "text-center" }, /* 8 Is Running */ { sortable: false, className: "text-center" }, /* 9 Run task */ { sortable: false, className: "text-center" } ], }); ')->addInlineJavascript(' function generate_force_token() { jQuery("#bt_genforcetoken").attr("disabled", "disabled"); jQuery("#bt_tokentext").empty().html("<i class=\\"fa fa-spinner fa-pulse fa-fw\\"></i>"); jQuery("#token_url").load( "module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@generateToken", function() { jQuery("#bt_genforcetoken").removeAttr("disabled"); jQuery("#bt_tokentext").empty().html("' . I18N::translate('Regenerate token') . '"); adminTasksTable.ajax.reload(); } ); } function set_admintask_status(task, status) { jQuery.ajax({ url: "module.php", type: "GET", data: { mod: "' . $this->module->getName() . '", mod_action: "Task@setStatus", task: task, status: status }, error: function(result, stat, error) { var err = typeof result.responseJSON === "undefined" ? error : result.responseJSON.error; alert("' . I18N::translate('An error occured while editing this task:') . '" + err); }, complete: function(result, stat) { adminTasksTable.ajax.reload(null, false); } }); } function run_admintask(taskname) { jQuery("#bt_runtask_" + taskname).attr("disabled", "disabled"); jQuery("#bt_runtasktext_" + taskname).empty().html("<i class=\\"fa fa-cog fa-spin fa-fw\\"></i><span class=\\"sr-only\\">' . I18N::translate('Running') . '</span>"); jQuery("#bt_runtasktext_" + taskname).load( "module.php?mod=' . $this->module->getName() . '&mod_action=Task@trigger&force=' . $token . '&task=" + taskname, function() { jQuery("#bt_runtasktext_" + taskname).empty().html("<i class=\\"fa fa-check\\"></i>' . I18N::translate('Done') . '"); adminTasksTable.ajax.reload(); } ); } '); ViewFactory::make('AdminConfig', $this, $controller, $data)->render(); }
/** * AdminConfig@index */ public function index() { global $WT_TREE; Theme::theme(new AdministrationTheme())->init($WT_TREE); $controller = new PageController(); $controller->restrictAccess(Auth::isManager($WT_TREE))->setPageTitle($this->module->getTitle()); $data = new ViewBag(); $data->set('title', $controller->getPageTitle()); $data->set('tree', $WT_TREE); $data->set('root_url', 'module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig'); $table_id = 'table-geoanalysis-' . Uuid::uuid4(); $data->set('table_id', $table_id); $other_trees = array(); foreach (Tree::getAll() as $tree) { if ($tree->getTreeId() != $WT_TREE->getTreeId()) { $other_trees[] = $tree; } } $data->set('other_trees', $other_trees); $data->set('places_hierarchy', $this->provider->getPlacesHierarchy()); $controller->addExternalJavascript(WT_JQUERY_DATATABLES_JS_URL)->addExternalJavascript(WT_DATATABLES_BOOTSTRAP_JS_URL)->addInlineJavascript(' //Datatable initialisation jQuery.fn.dataTableExt.oSort["unicode-asc" ]=function(a,b) {return a.replace(/<[^<]*>/, "").localeCompare(b.replace(/<[^<]*>/, ""))}; jQuery.fn.dataTableExt.oSort["unicode-desc" ]=function(a,b) {return b.replace(/<[^<]*>/, "").localeCompare(a.replace(/<[^<]*>/, ""))}; jQuery.fn.dataTableExt.oSort["num-html-asc" ]=function(a,b) {a=parseFloat(a.replace(/<[^<]*>/, "")); b=parseFloat(b.replace(/<[^<]*>/, "")); return (a<b) ? -1 : (a>b ? 1 : 0);}; jQuery.fn.dataTableExt.oSort["num-html-desc"]=function(a,b) {a=parseFloat(a.replace(/<[^<]*>/, "")); b=parseFloat(b.replace(/<[^<]*>/, "")); return (a>b) ? -1 : (a<b ? 1 : 0);}; var geoAnalysisTable = jQuery("#' . $table_id . '") .on("draw.dt", function ( e, settings, json, xhr ) { jQuery("[data-toggle=\'tooltip\']").tooltip(); }).DataTable({ ' . I18N::datatablesI18N() . ', sorting: [[3, "asc"], [4, "asc"]], pageLength: 10, processing: true, serverSide : true, ajax : { url : "module.php?mod=' . $this->module->getName() . '&mod_action=AdminConfig@jsonGeoAnalysisList&ged=' . $WT_TREE->getNameUrl() . '", type : "POST" }, columns: [ /* 0 Edit */ { sortable: false, className: "text-center"}, /* 1 ID */ { visible: false }, /* 2 Enabled */ { sortable: false, className: "text-center" }, /* 3 Description */ null, /* 4 Analysis Level */ { dataSort: 5, className: "text-center" }, /* 5 ANAL_LEVEL_SORT*/ { visible: false }, /* 6 Map */ { sortable: false, className: "text-center" }, /* 7 Map Top Level */ { sortable: false, className: "text-center" }, /* 8 Use Flags */ { sortable: false, className: "text-center" }, /* 9 Place Details */ { sortable: false, className: "text-center" } ], }); ')->addInlineJavascript(' function set_geoanalysis_status(ga_id, status, gedcom) { jQuery.ajax({ url: "module.php", type: "GET", data: { mod: "' . $this->module->getName() . '", mod_action: "GeoAnalysis@setStatus", ga_id: ga_id, ged: typeof gedcom === "undefined" ? WT_GEDCOM : gedcom, status: status }, error: function(result, stat, error) { var err = typeof result.responseJSON === "undefined" ? error : result.responseJSON.error; alert("' . I18N::translate('An error occured while editing this analysis:') . '" + err); }, complete: function(result, stat) { geoAnalysisTable.ajax.reload(null, false); } }); } function delete_geoanalysis(ga_id, status, gedcom) { jQuery.ajax({ url: "module.php", type: "GET", data: { mod: "' . $this->module->getName() . '", mod_action: "GeoAnalysis@delete", ga_id: ga_id, ged: typeof gedcom === "undefined" ? WT_GEDCOM : gedcom }, error: function(result, stat, error) { var err = typeof result.responseJSON === "undefined" ? error : result.responseJSON.error; alert("' . I18N::translate('An error occured while deleting this analysis:') . '" + err); }, complete: function(result, stat) { geoAnalysisTable.ajax.reload(null, false); } }); } '); ViewFactory::make('AdminConfig', $this, $controller, $data)->render(); }