Changeset 1498 in ExiteCMS


Ignore:
Timestamp:
07/01/08 23:52:31 (4 years ago)
Author:
root
Message:

Added a new reporting core module. Version 7.2 will come with some build in reports, modules can now add their own.
Updated the modules administration module, and added support for pluggable reports and pluggable searches (not implemented yet)

Location:
trunk
Files:
7 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/administration/modules.php

    r1488 r1498  
    171171    // register the installation of this module 
    172172    $result = dbquery("INSERT INTO ".$db_prefix."modules (mod_title, mod_folder, mod_version) VALUES ('$mod_title', '$mod_folder', '$mod_version')"); 
     173    // save the key, we might need it later 
     174    $mod_id = mysql_insert_id(); 
     175 
     176    // if a module is installed, and if reports are defined, install the report links for this module 
     177    if ($mod_id && isset($mod_report_links) && is_array($mod_report_links) && count($mod_report_links)) { 
     178 
     179        // loop through the defined reports 
     180        foreach ($mod_report_links as $mod_report) { 
     181 
     182            // check if the code exists for this report 
     183            if (isset($mod_report['name']) && file_exists(PATH_MODULES.$mod_folder."/report.".$mod_report['name'].".php")) { 
     184                // check if the template exists for this report 
     185                if (file_exists(PATH_MODULES.$mod_folder."/templates/modules.".$mod_folder.".report.".$mod_report['name'].".tpl")) { 
     186                    // verify the other fields 
     187                    $mod_report['visibility'] = (isset($mod_report['visibility']) && isNum($mod_report['visibility']) ? $mod_report['visibility'] : 103); 
     188                    $mod_report['title'] = isset($mod_report['title']) ? $mod_report['title'] : ("Report: ".$mod_report['name']); 
     189                    $mod_report['version'] = isset($mod_report['version']) ? $mod_report['version'] : $mod_version; 
     190                    // add it to the report table 
     191                    $result = dbquery("INSERT INTO ".$db_prefix."reports (report_mod_id, report_name, report_title, report_version, report_visibility)  
     192                        VALUES ('".$mod_id."', '".$mod_report['name']."', '".$mod_report['title']."', '".$mod_report['version']."', '".$mod_report['visibility']."')"); 
     193                } 
     194            } 
     195        } 
     196    } 
     197 
     198    // if a module is installed, and if searches are defined, install the search links for this module 
     199    if ($mod_id && isset($mod_search_links) && is_array($mod_search_links) && count($mod_search_links)) { 
     200 
     201        // loop through the defined reports 
     202        foreach ($mod_search_links as $mod_search) { 
     203 
     204            // check if the code exists for this search 
     205            if (isset($mod_search['name']) && file_exists(PATH_MODULES.$mod_folder."/search.".$mod_search['name'].".php")) { 
     206                // check if the template exists for this search 
     207                if (file_exists(PATH_MODULES.$mod_folder."/templates/modules.".$mod_folder.".search.".$mod_search['name'].".tpl")) { 
     208                    // verify the other fields 
     209                    $mod_search['visibility'] = (isset($mod_search['visibility']) && isNum($mod_search['visibility']) ? $mod_search['visibility'] : 103); 
     210                    $mod_search['title'] = isset($mod_search['title']) ? $mod_search['title'] : ("Search: ".$mod_search['name']); 
     211                    $mod_search['version'] = isset($mod_search['version']) ? $mod_search['version'] : $mod_version; 
     212                    // add it to the search table 
     213                    $result = dbquery("INSERT INTO ".$db_prefix."searches (search_mod_id, search_name, search_title, search_version, search_visibility)  
     214                        VALUES ('".$mod_id."', '".$mod_search['name']."', '".$mod_search['title']."', '".$mod_search['version']."', '".$mod_search['visibility']."')"); 
     215                } 
     216            } 
     217        } 
     218    } 
    173219 
    174220    // update the access rights of the site administrators to include this new module 
     
    303349    // remove the module from the installed modules list 
    304350    $result = dbquery("DELETE FROM ".$db_prefix."modules WHERE mod_id='$id'"); 
     351 
     352    // remove any reports associated with this module 
     353    $result = dbquery("DELETE FROM ".$db_prefix."reports WHERE report_mod_id='$id'"); 
     354 
     355    // remove any searches associated with this module 
     356    $result = dbquery("DELETE FROM ".$db_prefix."searches WHERE search_mod_id='$id'"); 
     357} 
     358 
     359if ($action == 'locales' && isset($id)) { 
     360 
     361    // make sure the ID passed is numeric 
     362    if (!isNum($id)) fallback(FUSION_SELF.$aidlink); 
     363     
     364    // check if it exists 
     365    $result = dbquery("SELECT * FROM ".$db_prefix."modules WHERE mod_id='$id'"); 
     366    if (!$result)  fallback(FUSION_SELF.$aidlink); 
     367 
     368    // get the module data 
     369    $data = dbarray($result); 
     370 
     371    // load the module installer to start the upgrade 
     372    include PATH_MODULES.$data['mod_folder']."/module_installer.php"; 
     373 
     374    // if locale strings are defined, load them into the database 
     375    if (isset($localestrings) && is_array($localestrings)) { 
     376        foreach($localestrings as $locales_code => $locales_strings) { 
     377            load_localestrings($locales_strings, $locales_code, "modules.".$mod_folder); 
     378        } 
     379    } 
     380 
    305381} 
    306382 
     
    419495        foreach($localestrings as $locales_code => $locales_strings) { 
    420496            load_localestrings($locales_strings, $locales_code, "modules.".$mod_folder); 
     497        } 
     498    } 
     499 
     500    // remove any reports associated with this module 
     501    $result = dbquery("DELETE FROM ".$db_prefix."reports WHERE report_mod_id='$id'"); 
     502 
     503    // if a module is installed, and if reports are defined, (re)install the report links for this module 
     504    if (isset($mod_report_links) && is_array($mod_report_links) && count($mod_report_links)) { 
     505 
     506        // loop through the defined reports 
     507        foreach ($mod_report_links as $mod_report) { 
     508 
     509            // check if the code exists for this report 
     510            if (isset($mod_report['name']) && file_exists(PATH_MODULES.$mod_folder."/report.".$mod_report['name'].".php")) { 
     511                // check if the template exists for this report 
     512                if (file_exists(PATH_MODULES.$mod_folder."/templates/modules.".$mod_folder.".report.".$mod_report['name'].".tpl")) { 
     513                    // verify the other fields 
     514                    $mod_report['visibility'] = (isset($mod_report['visibility']) && isNum($mod_report['visibility']) ? $mod_report['visibility'] : 103); 
     515                    $mod_report['title'] = isset($mod_report['title']) ? $mod_report['title'] : ("Report: ".$mod_report['name']); 
     516                    $mod_report['version'] = isset($mod_report['version']) ? $mod_report['version'] : $mod_version; 
     517                    // add it to the report table 
     518                    $result = dbquery("INSERT INTO ".$db_prefix."reports (report_mod_id, report_name, report_title, report_version, report_visibility)  
     519                        VALUES ('".$id."', '".$mod_report['name']."', '".$mod_report['title']."', '".$mod_report['version']."', '".$mod_report['visibility']."')"); 
     520                } 
     521            } 
     522        } 
     523 
     524    } 
     525 
     526    // remove any searches associated with this module 
     527    $result = dbquery("DELETE FROM ".$db_prefix."searches WHERE search_mod_id='$id'"); 
     528 
     529    // if a module is installed, and if searches are defined, install the search links for this module 
     530    if (isset($mod_search_links) && is_array($mod_search_links) && count($mod_search_links)) { 
     531 
     532        // loop through the defined reports 
     533        foreach ($mod_search_links as $mod_search) { 
     534 
     535            // check if the code exists for this search 
     536            if (isset($mod_search['name']) && file_exists(PATH_MODULES.$mod_folder."/search.".$mod_search['name'].".php")) { 
     537                // check if the template exists for this search 
     538                if (file_exists(PATH_MODULES.$mod_folder."/templates/modules.".$mod_folder.".search.".$mod_search['name'].".tpl")) { 
     539                    // verify the other fields 
     540                    $mod_search['visibility'] = (isset($mod_search['visibility']) && isNum($mod_search['visibility']) ? $mod_search['visibility'] : 103); 
     541                    $mod_search['title'] = isset($mod_search['title']) ? $mod_search['title'] : ("Search: ".$mod_search['name']); 
     542                    $mod_search['version'] = isset($mod_search['version']) ? $mod_search['version'] : $mod_version; 
     543                    // add it to the search table 
     544                    $result = dbquery("INSERT INTO ".$db_prefix."searches (search_mod_id, search_name, search_title, search_version, search_visibility)  
     545                        VALUES ('".$id."', '".$mod_search['name']."', '".$mod_search['title']."', '".$mod_search['version']."', '".$mod_search['visibility']."')"); 
     546                } 
     547            } 
    421548        } 
    422549    } 
  • trunk/administration/tools/language_pack_English.php

    r1495 r1498  
    497497        $localestrings['253'] = "Suspended Members:"; 
    498498        $localestrings['255'] = "Deleted Members:"; 
    499         $localestrings['256'] = "Reporting"; 
     499        $localestrings['256'] = "Reports"; 
    500500        $localestrings['257'] = "Comments:"; 
    501501        $localestrings['258'] = "Shoutbox Posts:"; 
    502502        $localestrings['259'] = "Forum Posts:"; 
    503         $localestrings['260'] = "x"; 
     503        $localestrings['260'] = "Searches"; 
    504504        $localestrings['261'] = "x"; 
    505505        $localestrings['262'] = "Unread Posts:"; 
     
    601601        $localestrings['424'] = "There are no modules and plugins available for installation"; 
    602602        $localestrings['425'] = "There are no modules and plugins available that match your filter"; 
     603        $localestrings['426'] = "Refresh the locale strings"; 
    603604        $localestrings['mod001'] = "This module requires at least version %s of ExiteCMS.<br />"; 
    604605        $localestrings['mod002'] = "This module is written for version %s of ExiteCMS. Please ask the author for an upgrade.<br />"; 
     
    860861        $localestrings['492'] = "If checked, the site will redirect to the exact URL given"; 
    861862        load_localestrings($localestrings, LP_LOCALE, "admin.redirects", $step); 
     863 
     864        $localestrings = array(); 
     865        $localestrings['400'] = "Reporting"; 
     866        $localestrings['401'] = "Install"; 
     867        $localestrings['403'] = "Filter on status"; 
     868        $localestrings['404'] = "x"; 
     869        $localestrings['405'] = "x"; 
     870        $localestrings['406'] = "Version"; 
     871        $localestrings['407'] = "Developer"; 
     872        $localestrings['408'] = "Contact"; 
     873        $localestrings['409'] = "Email"; 
     874        $localestrings['410'] = "Web"; 
     875        $localestrings['411'] = "Uninstall"; 
     876        $localestrings['412'] = "Uninstall this report?"; 
     877        $localestrings['413'] = "x"; 
     878        $localestrings['414'] = "Not Installed"; 
     879        $localestrings['415'] = "Installed"; 
     880        $localestrings['416'] = "Upgrade Available"; 
     881        $localestrings['417'] = "Error executing installation function: "; 
     882        $localestrings['418'] = "Not compatible"; 
     883        $localestrings['419'] = "Error. Unknown command type: "; 
     884        $localestrings['420'] = "Status"; 
     885        $localestrings['421'] = "Options"; 
     886        $localestrings['422'] = "Upgrade"; 
     887        $localestrings['423'] = "Go"; 
     888        $localestrings['424'] = "There are no reports available for installation"; 
     889        $localestrings['425'] = "There are no reports available that match your filter"; 
     890        $localestrings['mod001'] = "This report requires at least version %s of ExiteCMS.<br />"; 
     891        $localestrings['mod002'] = "This report is written for version %s of ExiteCMS. Please ask the author for an upgrade.<br />"; 
     892        $localestrings['mod003'] = "This report requires a minumum ExiteCMS revision level of %s.<br />"; 
     893        $localestrings['mod004'] = "This report can not be installed. Required information is missing from the report installer.<br />"; 
     894        $localestrings['mod005'] = "This report does not function beyond ExiteCMS revision level %s.<br />"; 
     895        load_localestrings($localestrings, LP_LOCALE, "admin.reporting", $step); 
     896 
     897        $localestrings = array(); 
     898        $localestrings['400'] = "Reports"; 
     899        $localestrings['401'] = "Report Title"; 
     900        $localestrings['402'] = "Visibility"; 
     901        $localestrings['403'] = "Options"; 
     902        $localestrings['404'] = "Deactivate"; 
     903        $localestrings['405'] = "Activate"; 
     904        $localestrings['406'] = "Modify this report"; 
     905        $localestrings['407'] = "Delete this report"; 
     906        $localestrings['408'] = "Currently there are no reports defined"; 
     907        $localestrings['409'] = "Add a Report"; 
     908        $localestrings['410'] = "from"; 
     909        $localestrings['411'] = "View this report"; 
     910        load_localestrings($localestrings, LP_LOCALE, "admin.reports", $step); 
    862911 
    863912        $localestrings = array(); 
     
    29492998 
    29502999        $localestrings = array(); 
     3000        $localestrings['rpt400'] = "Available Reports"; 
     3001        $localestrings['rpt401'] = "Report"; 
     3002        $localestrings['rpt402'] = "View"; 
     3003        $localestrings['rpt403'] = "Currently there are no reports defined"; 
     3004        $localestrings['rpt404'] = "Result for the requested report"; 
     3005        $localestrings['rpt405'] = "Report List"; 
     3006        load_localestrings($localestrings, LP_LOCALE, "main.reports", $step); 
     3007 
     3008        $localestrings = array(); 
    29513009        $localestrings['400'] = "Search"; 
    29523010        $localestrings['401'] = "Search for:"; 
     
    32313289if (!defined('LP_CHARSET')) define('LP_CHARSET', "iso-8859-1"); 
    32323290if (!defined('LP_VERSION')) define('LP_VERSION', "7.10"); 
    3233 if (!defined('LP_DATE')) define('LP_DATE', "1214854709"); 
    3234 $lp_date = "1214854709"; 
     3291if (!defined('LP_DATE')) define('LP_DATE', "1214934137"); 
     3292$lp_date = "1214934137"; 
    32353293 
    32363294/*---------------------------------------------------+ 
  • trunk/administration/tools/language_pack_Nederlands.php

    r1495 r1498  
    497497        $localestrings['253'] = "Geblokeerde gebruikers:"; 
    498498        $localestrings['255'] = "Verwijderde gebruikers:"; 
    499         $localestrings['256'] = "Rapportages"; 
     499        $localestrings['256'] = "Rapporten"; 
    500500        $localestrings['257'] = "Commentaar:"; 
    501501        $localestrings['258'] = "Shoutbox berichten:"; 
    502502        $localestrings['259'] = "Forum berichten:"; 
    503         $localestrings['260'] = "x"; 
     503        $localestrings['260'] = "Zoekacties"; 
    504504        $localestrings['261'] = "x"; 
    505505        $localestrings['262'] = "Ongelezen berichten:"; 
     
    601601        $localestrings['424'] = "Er zijn geen modules of plugins beschikbaar voor installatie"; 
    602602        $localestrings['425'] = "Er zijn geen modules of plugins aanwezig die voldoen aan het filter"; 
     603        $localestrings['426'] = "Locales opnieuw inladen"; 
    603604        $localestrings['mod001'] = "Deze module vereist minstens ExiteCMS versie %s.<br />"; 
    604605        $localestrings['mod002'] = "Deze module is gemaakt voor versie %s van ExiteCMS. Neem contact op met de ontwikkelaar voor een nieuwere versie.<br />"; 
     
    860861        $localestrings['492'] = "Indien gemarkeerd wordt de nieuwe URL geladen d.m.v. een redirect"; 
    861862        load_localestrings($localestrings, LP_LOCALE, "admin.redirects", $step); 
     863 
     864        $localestrings = array(); 
     865        $localestrings['400'] = "Reporting"; 
     866        $localestrings['401'] = "Install"; 
     867        $localestrings['403'] = "Filter on status"; 
     868        $localestrings['404'] = "x"; 
     869        $localestrings['405'] = "x"; 
     870        $localestrings['406'] = "Version"; 
     871        $localestrings['407'] = "Developer"; 
     872        $localestrings['408'] = "Contact"; 
     873        $localestrings['409'] = "Email"; 
     874        $localestrings['410'] = "Web"; 
     875        $localestrings['411'] = "Uninstall"; 
     876        $localestrings['412'] = "Uninstall this report?"; 
     877        $localestrings['413'] = "x"; 
     878        $localestrings['414'] = "Not Installed"; 
     879        $localestrings['415'] = "Installed"; 
     880        $localestrings['416'] = "Upgrade Available"; 
     881        $localestrings['417'] = "Error executing installation function: "; 
     882        $localestrings['418'] = "Not compatible"; 
     883        $localestrings['419'] = "Error. Unknown command type: "; 
     884        $localestrings['420'] = "Status"; 
     885        $localestrings['421'] = "Options"; 
     886        $localestrings['422'] = "Upgrade"; 
     887        $localestrings['423'] = "Go"; 
     888        $localestrings['424'] = "There are no reports available for installation"; 
     889        $localestrings['425'] = "There are no reports available that match your filter"; 
     890        $localestrings['mod001'] = "This report requires at least version %s of ExiteCMS.<br />"; 
     891        $localestrings['mod002'] = "This report is written for version %s of ExiteCMS. Please ask the author for an upgrade.<br />"; 
     892        $localestrings['mod003'] = "This report requires a minumum ExiteCMS revision level of %s.<br />"; 
     893        $localestrings['mod004'] = "This report can not be installed. Required information is missing from the report installer.<br />"; 
     894        $localestrings['mod005'] = "This report does not function beyond ExiteCMS revision level %s.<br />"; 
     895        load_localestrings($localestrings, LP_LOCALE, "admin.reporting", $step); 
     896 
     897        $localestrings = array(); 
     898        $localestrings['400'] = "Rapporten"; 
     899        $localestrings['401'] = "Rapport titel"; 
     900        $localestrings['402'] = "Toegang voor"; 
     901        $localestrings['403'] = "Opties"; 
     902        $localestrings['404'] = "Deactiveer"; 
     903        $localestrings['405'] = "Activeer"; 
     904        $localestrings['406'] = "Wijzig dit rapport"; 
     905        $localestrings['407'] = "Verwijder this report"; 
     906        $localestrings['408'] = "Er zijn momenteel geen rapporten gedefinieerd"; 
     907        $localestrings['409'] = "Rapport toevoegen"; 
     908        $localestrings['410'] = "van"; 
     909        $localestrings['411'] = "Rapport aanmaken"; 
     910        load_localestrings($localestrings, LP_LOCALE, "admin.reports", $step); 
    862911 
    863912        $localestrings = array(); 
     
    29492998 
    29502999        $localestrings = array(); 
     3000        $localestrings['rpt400'] = "Beschikbare rapporten"; 
     3001        $localestrings['rpt401'] = "Rapport"; 
     3002        $localestrings['rpt402'] = "Bekijk"; 
     3003        $localestrings['rpt403'] = "Er zijn op dit moment geen rapporten beschikbaar"; 
     3004        $localestrings['rpt404'] = "Resultaat voor het rapport"; 
     3005        $localestrings['rpt405'] = "Rapportenlijst"; 
     3006        load_localestrings($localestrings, LP_LOCALE, "main.reports", $step); 
     3007 
     3008        $localestrings = array(); 
    29513009        $localestrings['400'] = "Zoeken"; 
    29523010        $localestrings['401'] = "Zoeken naar:"; 
     
    32313289if (!defined('LP_CHARSET')) define('LP_CHARSET', "iso-8859-1"); 
    32323290if (!defined('LP_VERSION')) define('LP_VERSION', "7.10"); 
    3233 if (!defined('LP_DATE')) define('LP_DATE', "1214854713"); 
    3234 $lp_date = "1214854713"; 
     3291if (!defined('LP_DATE')) define('LP_DATE', "1214934141"); 
     3292$lp_date = "1214934141"; 
    32353293 
    32363294/*---------------------------------------------------+ 
  • trunk/files/locales/en.main.global.php

    r1491 r1498  
    33// locale       : English 
    44// locale name  : main.global 
    5 // generated on : Sun Jun 29 2008, 16:31:43 CEST 
     5// generated on : Tue Jul 1 2008, 23:49:35 CEST 
    66// translators  : ExiteCMS team,WanWizard 
    77// ---------------------------------------------------------- 
  • trunk/includes/templates/admin.modules.tpl

    r1488 r1498  
    101101            <a href='{$smarty.const.FUSION_SELF}{$aidlink}&amp;action=install&amp;module={$modules[id].folder}&amp;filter={$filter}'><img src='{$smarty.const.THEME}images/cog_add.gif' alt='{$locale.401}' title='{$locale.401}' /></a> 
    102102        {/if} 
     103        {if $settings.sitename == "ExiteCMS Support Site"} 
     104            <a href='{$smarty.const.FUSION_SELF}{$aidlink}&amp;action=locales&amp;id={$modules[id].id}&amp;filter={$filter}'><img src='{$smarty.const.THEME}images/page_refresh.gif' alt='{$locale.426}' title='{$locale.426}' /></a> 
     105        {/if} 
    103106        </td> 
    104107    </tr> 
Note: See TracChangeset for help on using the changeset viewer.