Re: [TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] Errors on Add Structure, Add and Remove Page Actions in Wiki Multi Print Pages

test--- via TikiWiki-cvs <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <[email protected]>
On Fri, 08 Nov 2024 15:56:28 +0000 [email protected], Tiki code commits information [email protected] said

> 
> 
> Benoit Grégoire pushed to branch master at Tiki Wiki CMS Groupware / Tiki
> 
> 
> Commits:
> d2779827 by ushindi bienvenu at 2024-11-08T15:49:22+00:00
> [FIX]  Errors on Add Structure, Add and Remove Page Actions in Wiki Multi
> Print Pages
> ---
> * Fix undefined array keys
> 
> See merge request tikiwiki/tiki!6094
> 
> - - - - -
> 
> 
> 2 changed files:
> 
> - templates/tiki-print_pages.tpl
> - tiki-print_pages.php
> 
> 
> Changes:
> 
> =====================================
> templates/tiki-print_pages.tpl
> =====================================
> @@ -134,7 +134,7 @@
>                 <h2>{tr}Add Pages from Structures:{/tr}</h2>
>                 <div class="mb-3 row">
>                     <div class="col-sm-12">
> -                        <select name="structureId" size="5"
> style="width:99%" border="1" class="form-control">
> +                        <select name="structureId" size="5"
> style="width:99%" border="1" class="form-control" required>
>                             {section name=ix loop=$structures}
>                                 {if
> !in_array($structures[ix].page_ref_id,$printstructures)}
>                                     <option
> value="{$structures[ix].page_ref_id|escape}">{$structures[ix].pageName}</option>
> 
> 
> =====================================
> tiki-print_pages.php
> =====================================
> @@ -70,19 +70,27 @@ if (isset($_REQUEST["find"])) {
> }
> $smarty->assign('find', $find);
> if (isset($_REQUEST["addpage"])) {
> -    if (! in_array($_REQUEST["pageName"], $printpages)) {
> -        foreach ($_REQUEST['pageName'] as $value) {
> -            $printpages[] = $value;
> +    if (! isset($_REQUEST["pageName"])) {
> +        Feedback::error(tra('Please select at least one page'));
> +    } else {
> +        if (! in_array($_REQUEST["pageName"], $printpages)) {
> +            foreach ($_REQUEST['pageName'] as $value) {
> +                $printpages[] = $value;
> +            }
>         }
>     }
>     $printstructures = [];
>     $cookietab = 2;
> }
> if (isset($_REQUEST["removepage"])) {
> -    foreach ($_REQUEST['selectedpages'] as $value) {
> -        unset($printpages[$value]);
> +    if (! isset($_REQUEST["selectedpages"])) {
> +        Feedback::warning(tra('Please select page to remove'));
> +    } else {
> +        foreach ($_REQUEST['selectedpages'] as $value) {
> +            unset($printpages[$value]);
> +        }
>     }
> -        $printpages = array_merge($printpages);
> +    $printpages = array_merge($printpages);
>     $cookietab = 2;
> }
> if (isset($_REQUEST["clearpages"])) {
> @@ -93,13 +101,17 @@ if (isset($_REQUEST["clearstructures"])) {
>     $printstructures = [];
> }
> if (isset($_REQUEST['addstructurepages'])) {
> -    $struct = $structlib->get_subtree($_REQUEST["structureId"]);
> -    foreach ($struct as $struct_page) {
> -        // Handle dummy last entry
> -        if ($struct_page["pos"] != '' && $struct_page["last"] == 1) {
> -            continue;
> +    if (! isset($_REQUEST["structureId"])) {
> +        Feedback::error(tra('Please select a structure'));
> +    } else {
> +        $struct = $structlib->get_subtree($_REQUEST["structureId"]);
> +        foreach ($struct as $struct_page) {
> +            // Handle dummy last entry
> +            if ($struct_page["pos"] != '' && $struct_page["last"] == 1) {
> +                continue;
> +            }
> +            $printpages[] = $struct_page["pageName"];
>         }
> -        $printpages[] = $struct_page["pageName"];
>     }
>     $cookietab = 2;
> }
> 
> 
> 
> View it on GitLab:
> https://gitlab.com/tikiwiki/tiki/-/commit/d2779827b8cb65fcda4cf1fd5ac0779df5a10ad2
> 
> -- 
> View it on GitLab:
> https://gitlab.com/tikiwiki/tiki/-/commit/d2779827b8cb65fcda4cf1fd5ac0779df5a10ad2
> You're receiving this email because of your account on gitlab.com.
> 
> 
> 

This is a test of reply




_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.