viewgit/inc/functions.php:22 Function utf8_encode() is deprecated [8192]

editing a description of a media detail for when in list or grid mode stays on iframe

Chris Pollett [2024-04-12 17:Apr:th]
editing a description of a media detail for when in list or grid mode stays on iframe
Filename
src/controllers/Controller.php
src/controllers/components/SocialComponent.php
src/views/MediadetailView.php
src/views/elements/WikiElement.php
diff --git a/src/controllers/Controller.php b/src/controllers/Controller.php
index 30a4b7016..0c3572666 100755
--- a/src/controllers/Controller.php
+++ b/src/controllers/Controller.php
@@ -318,8 +318,8 @@ abstract class Controller
      * @param string $copy_fields $_REQUEST fields to copy for redirect
      * @param bool $restart if yioop is being run as its own server rather than
      *      under apache whether to restart this server.
-     * @param bool $use_base_url set true if the base_url be included in the
-     *      redirect
+     * @param bool $use_base_url set true if the base_url should
+     *   be included in the redirect
      */
     public function redirectWithMessage($message, $copy_fields = false,
         $restart = false, $use_base_url = false)
diff --git a/src/controllers/components/SocialComponent.php b/src/controllers/components/SocialComponent.php
index eef22af06..675ae96b0 100644
--- a/src/controllers/components/SocialComponent.php
+++ b/src/controllers/components/SocialComponent.php
@@ -3354,6 +3354,7 @@ class SocialComponent extends Component implements CrawlConstants
         $data['OPEN_IN_TABS'] = empty($_SESSION['OPEN_IN_TABS']) ? false :
             true;
         $data["SHARE_WALL_EDIT"] = false;
+        $data['TARGET'] = $target ?? "";
         if (!empty($group_id)) {
             if (isset($share_wall_data) && !empty($page_name)) {
                 $page_info = $group_model->getPageInfoByName($group_id,
@@ -4845,6 +4846,15 @@ EOD;
             $success = $group_model->setResourceDescription($resource_name,
                 $resource_description, $group_id, $page_info['ID'],
                 $sub_path ?? "");
+            if ($data['TARGET'] == 'child') {
+                $_REQUEST['arg'] = 'media-detail-edit';
+                $_REQUEST['resources'] = 'false';
+                $_REQUEST['page_id'] = $page_info['ID'];
+                $preserve_fields[] = 'n';
+                $preserve_fields[] = 'page_id';
+                $preserve_fields[] = 'resources';
+                $preserve_fields[] = 'target';
+            }
             if ($success) {
                 return $parent->redirectWithMessage(
                     tl('social_component_resource_description_saved'),
@@ -5345,6 +5355,7 @@ EOD;
             "share_wall_data" => 'string',
             "show" => 'int',
             "sort" => 'string',
+            "target" => "string",
         ];
         $strings_array = [
             "page_name" => C\TITLE_LEN,
diff --git a/src/views/MediadetailView.php b/src/views/MediadetailView.php
index e2c8edfc1..b48bab710 100644
--- a/src/views/MediadetailView.php
+++ b/src/views/MediadetailView.php
@@ -280,14 +280,17 @@ class MediadetailView extends View implements CrawlConstants
                 $data['MODE']);
             $a = ($data['CONTROLLER'] == 'static') ? 'showPage' : 'wiki';
             $page_name = ($data['CONTROLLER'] == 'static') ? 'p' : 'page_name';
+            $child_frame = (!empty($data['TARGET']));
             ?>
-            <form target="_parent">
+            <form <?= $child_frame ? "" : 'target="_parent"' ?>>
             <input type="hidden" name='<?=C\CSRF_TOKEN?>'
                 value='<?=$data[C\CSRF_TOKEN]?>' >
             <input type="hidden" name='arg' value='<?=$arg ?>' >
             <input type="hidden" name='a' value='<?=$a ?>' >
             <input type="hidden" name='c' value='<?=$data['CONTROLLER'] ?>' >
-            <input type="hidden" name='n' value='<?=$name ?>' >
+            <input type="hidden" name='n' value='<?=$name ?>' ><?=
+             ($child_frame) ?
+                "<input type='hidden' name='target' value='child' >" : "" ?>
             <input type="hidden" name='<?= $page_name ?>'
                 value='<?=$data['PAGE_NAME']?>' >
             <?php
diff --git a/src/views/elements/WikiElement.php b/src/views/elements/WikiElement.php
index 7955fd04f..f6542bd48 100644
--- a/src/views/elements/WikiElement.php
+++ b/src/views/elements/WikiElement.php
@@ -1446,7 +1446,8 @@ class WikiElement extends Element implements CrawlConstants
         }
         $info_link = ($is_detail) ? "" : "&nbsp;<a class='info-link' ".
             "onclick='toggleDisplay(\"info-item\");elt(\"info-frame\").src=".
-            "\"$alt_current_media_url\";window.event.stopPropagation();".
+            "\"$alt_current_media_url&target=child\";" .
+            "window.event.stopPropagation();" .
             "return false;' href='$alt_current_media_url'>&#9432;</a>";
         if ($is_seen && $is_list) {
             e("<$td class='view-indicator huge-font'><span " .
ViewGit