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

Fix bug in auto advancing for media element; linkdropdown now use checkmarks, a=chris

Chris Pollett [2020-08-02 18:Aug:nd]
Fix bug in auto advancing for media element; linkdropdown now use checkmarks, a=chris
Filename
src/css/search.css
src/views/elements/GroupfeedElement.php
src/views/elements/WikiElement.php
src/views/helpers/FeedsHelper.php
src/views/helpers/OptionsHelper.php
diff --git a/src/css/search.css b/src/css/search.css
index 364371097..ddb9a0c0b 100755
--- a/src/css/search.css
+++ b/src/css/search.css
@@ -3021,34 +3021,34 @@ ul.link-dropdown
     font-size: 14px;
     margin: 0;
     padding: 0;
-    list-style: none;
+    list-style-type: none;
 }
 ul.link-dropdown li
 {
+    background: #FCFCFC;
     display: block;
-    position: relative;
     float: left;
+    margin: 0;
+    padding: 2px 5px 2px 5px;
+    position: relative;
+    white-space: nowrap;
 }
 ul.link-dropdown li ul
 {
     display: none;
     margin: 0;
     padding: 0;
-    list-style: none;
+    list-style-type: none;
 }
-ul.link-dropdown li
+ul.link-dropdown > li,
+ul.link-dropdown ul li
 {
-    background: #FCFCFC;
-    margin: 0;
-    padding: 2px 5px 2px 5px;
-    white-space: nowrap;
+    border-left: 1px solid #999;
+    border-right: 1px solid #999;
 }
-
 ul.link-dropdown > li,
 ul.link-dropdown ul li:first-child
 {
-    border-left: 1px solid #999;
-    border-right: 1px solid #999;
     border-top: 1px solid #999;
     border-top-left-radius: 5px;
     border-top-right-radius: 5px;
@@ -3056,8 +3056,6 @@ ul.link-dropdown ul li:first-child
 ul.link-dropdown > li,
 ul.link-dropdown ul li:last-child
 {
-    border-left: 1px solid #999;
-    border-right: 1px solid #999;
     border-bottom: 1px solid #999;
     border-bottom-left-radius: 5px;
     border-bottom-right-radius: 5px;
diff --git a/src/views/elements/GroupfeedElement.php b/src/views/elements/GroupfeedElement.php
index 289b68d61..b2e2da580 100644
--- a/src/views/elements/GroupfeedElement.php
+++ b/src/views/elements/GroupfeedElement.php
@@ -233,13 +233,13 @@ class GroupfeedElement extends Element implements CrawlConstants
                 && $pub_date_diff > C\ONE_HOUR) || ($pub_date_diff > C\ONE_DAY);
             $old_pubdate = ($pub_data_change) ? $pub_date : $old_pubdate;
             $pub_date = $this->view->helper("feeds")->getPubdateString(
-                $time, $pub_date);
+                $time, $pub_date, false);
             $edit_date = false;
             $user_background = "white";
             if (isset($page['EDIT_DATE']) && $page['EDIT_DATE'] &&
                 $page['EDIT_DATE'] != $page['PUBDATE']) {
                 $edit_date = $this->view->helper("feeds")->getPubdateString(
-                    $time, $page['EDIT_DATE']);
+                    $time, $page['EDIT_DATE'], false);
             }
             $encode_source = urlencode(urlencode($page[self::SOURCE_NAME]));
             $group_result = "small-group-result";
diff --git a/src/views/elements/WikiElement.php b/src/views/elements/WikiElement.php
index b8031bc44..b4f036e5b 100644
--- a/src/views/elements/WikiElement.php
+++ b/src/views/elements/WikiElement.php
@@ -240,7 +240,7 @@ class WikiElement extends Element implements CrawlConstants
                     ?>];
                 end_next_resource = false;
                 <?php
-                $url_connective = (C\REDIRECTS_ON) ? "/" : "&n=";
+                $url_connective =  "&n=";
                 if ($i < $num_resources) { ?>
                     end_next_resource = url_prefix + '<?=$url_connective .
                         urlencode($resource["name"]) ?>';<?php
@@ -287,8 +287,12 @@ class WikiElement extends Element implements CrawlConstants
                                 elt('next-link').href= url_prefix +
                                     '<?=$url_connective ?>' +
                                     next_resources[current_resource_index + 1]
+                            } else if (current_resource_index + 1 ==
+                                next_resources.length && end_next_resource) {
+                                elt('next-link').href= end_next_resource;
                             } else if (end_next_resource) {
                                 window.location = end_next_resource;
+                                return;
                             } else {
                                 elt('next-link').style.display = 'none';
                             }
@@ -300,14 +304,18 @@ class WikiElement extends Element implements CrawlConstants
                                 encodeURIComponent(old_resource),
                                 encodeURIComponent(
                                     next_resources[current_resource_index])));
-                            page_path_elt = elt('media-path');
-                            page_path_elt.options[
-                                page_path_elt.selectedIndex].text =
-                                next_resources[current_resource_index].replace(
-                                /\.\S{3,5}$/, "");
-                            current_resource_index++;
-                            media_elt.load();
-                            media_elt.play();
+                            if (next_resources[current_resource_index]) {
+                                let next_resource_name =
+                                    next_resources[current_resource_index
+                                    ].replace(/\.\S{3,5}$/, "");
+                                page_path_elt = elt('selected-media-path');
+                                page_path_elt.innerHTML = next_resource_name;
+                                page_path_elt = elt('selected2-media-path');
+                                page_path_elt.innerHTML = next_resource_name;
+                                current_resource_index++;
+                                media_elt.load();
+                                media_elt.play();
+                            }
                         }
                     }
                 }
diff --git a/src/views/helpers/FeedsHelper.php b/src/views/helpers/FeedsHelper.php
index f1566a43b..d445f4bc4 100644
--- a/src/views/helpers/FeedsHelper.php
+++ b/src/views/helpers/FeedsHelper.php
@@ -216,26 +216,32 @@ class FeedsHelper extends Helper implements CrawlConstants
      *
      * @param int $time timestamp for current time
      * @param int $pub_date timestamp for feed_item publication
+     * @param bool $relative_times if true use relative times like
+     * y seconds ago
      * @return string in the current locale the time difference
      */
-    public function getPubdateString($time, $pub_date)
+    public function getPubdateString($time, $pub_date, $relative_times = true)
     {
         $delta = $time - $pub_date;
         if ($delta < C\ONE_DAY) {
             $num_hours = ceil($delta/C\ONE_HOUR);
-            if ($num_hours <= 2) {
-                if ($num_hours > 1) {
-                    $pub_date = tl('feeds_helper_view_onehour');
+            if ($relative_times) {
+                if ($num_hours <= 2) {
+                    if ($num_hours > 1) {
+                        $pub_date = tl('feeds_helper_view_onehour');
+                    } else {
+                        $num_minutes = floor($delta/C\ONE_MINUTE);
+                        $remainder_seconds = $delta % C\ONE_MINUTE;
+                        $pub_date =
+                            tl('feeds_helper_view_minsecs', $num_minutes,
+                                $remainder_seconds);
+                    }
                 } else {
-                    $num_minutes = floor($delta/C\ONE_MINUTE);
-                    $remainder_seconds = $delta % C\ONE_MINUTE;
                     $pub_date =
-                        tl('feeds_helper_view_minsecs', $num_minutes,
-                            $remainder_seconds);
+                        tl('feeds_helper_view_hourdate', $num_hours);
                 }
             } else {
-                $pub_date =
-                    tl('feeds_helper_view_hourdate', $num_hours);
+                $pub_date = date("g:i a", $pub_date);
             }
         } else {
             $pub_date = date("d/m/Y", $pub_date);
diff --git a/src/views/helpers/OptionsHelper.php b/src/views/helpers/OptionsHelper.php
index fda6d88cd..02fa3b1e1 100755
--- a/src/views/helpers/OptionsHelper.php
+++ b/src/views/helpers/OptionsHelper.php
@@ -165,6 +165,8 @@ class OptionsHelper extends Helper
             $stretch = ($_SERVER["MOBILE"]) ? 4 : 6;
             $word_wrap_len = $stretch * C\NAME_TRUNCATE_LEN;
             $id_info = ($id != "") ? " id='$id' " : " ";
+            $selected_id_info = ($id != "") ? " id='selected-$id' " : " ";
+            $selected_id_info2 = ($id != "") ? " id='selected2-$id' " : " ";
             $opt_group = "";
             foreach ($options as $value => $text) {
                 if (empty($selected_text) || $value == $selected) {
@@ -178,15 +180,24 @@ class OptionsHelper extends Helper
             <form class="dropdown-container" <?= $id_info ?>>
             <ul class="link-dropdown">
                 <li tabindex="0"><b><a class="dropdown-selector"
+                    <?=$selected_id_info?>
                     href="javascript:this.preventDefault;"><?=$selected_text
                     ?></a></b>
                 <ul><?php
                 foreach ($options as $value => $text) {
                     if (empty($text) && !empty($value)) {?>
                         <li><b><?=$value ?></b></li><?php
-                    } else { ?>
-                        <li><a <?=$opt_group?>  href="<?=$url_prefix . $value
-                            ?>" ><?= $text ?></a></li><?php
+                    } else {
+                        if ($selected_text == $text) {?>
+                            <li>&check;<a <?=
+                                $selected_id_info2 ?> <?=
+                                $opt_group?>  href="<?=$url_prefix .
+                                $value ?>" ><?= $text ?></a></li><?php
+                        } else {?>
+                            <li>&nbsp;&nbsp;&nbsp;<a <?=
+                                $opt_group?>  href="<?=$url_prefix .
+                                $value ?>" ><?= $text ?></a></li><?php
+                        }
                     }
                 }?>
                 </ul>
ViewGit