Browse Source

Correction et dernier ajout sur la fonctionnalité isverbose
Attention, j'ai renommé la variable car folder != feed ...

cobalt74 5 years ago
parent
commit
f98b55cacf
10 changed files with 76 additions and 14 deletions
  1. 1 1
      Update-2.0.sql
  2. 17 2
      action.php
  3. 2 2
      article.php
  4. 3 3
      index.php
  5. 1 1
      install.php
  6. 1 0
      locale/en.json
  7. 1 0
      locale/fr.json
  8. 1 0
      settings.php
  9. 28 2
      templates/marigolds/js/script.js
  10. 21 3
      templates/marigolds/settings.html

+ 1 - 1
Update-2.0.sql

@@ -14,4 +14,4 @@ Description :
 ALTER TABLE `leed_feed` ADD `isverbose` INT(1) NOT NULL;
 
 -- évolution pour les flux RSS défini verbeux qu'il faut ou ne faut pas afficher sur la page d'accueil.
-INSERT INTO `leed_configuration` (`key`,`value`) VALUES ('displayFolderIsVerbose',1);
+INSERT INTO `leed_configuration` (`key`,`value`) VALUES ('optionFeedIsVerbose',1);

+ 17 - 2
action.php

@@ -563,7 +563,7 @@ switch ($action){
         $configurationManager->put('displayOnlyUnreadFeedFolder',$_['displayOnlyUnreadFeedFolder']);
     break;
 
-    case 'displayFolderIsVerbose':
+    case 'displayFeedIsVerbose':
         if($myUser==false) {
             $response_array['status'] = 'noconnect';
             $response_array['texte'] = _t('YOU_MUST_BE_CONNECTED_ACTION');
@@ -574,10 +574,25 @@ switch ($action){
         // changement du statut isverbose du feed
         $feed = new Feed();
         $feed = $feed->getById($_['idFeed']);
-        $feed->setIsverbose(($_['displayFolderIsVerbose']=="0"?1:0));
+        $feed->setIsverbose(($_['displayFeedIsVerbose']=="0"?1:0));
         $feed->save();
         break;
 
+    case 'optionFeedIsVerbose':
+        if($myUser==false) {
+            $response_array['status'] = 'noconnect';
+            $response_array['texte'] = _t('YOU_MUST_BE_CONNECTED_ACTION');
+            header('Content-type: application/json');
+            echo json_encode($response_array);
+            exit();
+        }
+        // changement du statut de l'option
+        $configurationManager = new Configuration();
+        $conf = $configurationManager->getAll();
+        $configurationManager->put('optionFeedIsVerbose',($_['optionFeedIsVerbose']=="0"?0:1));
+
+        break;
+
     default:
         require_once("SimplePie.class.php");
         Plugin::callHook("action_post_case", array(&$_,$myUser));

+ 2 - 2
article.php

@@ -21,7 +21,7 @@ $articleDisplayDate = $configurationManager->get('articleDisplayDate');
 $articleDisplayAuthor = $configurationManager->get('articleDisplayAuthor');
 $articleDisplayHomeSort = $configurationManager->get('articleDisplayHomeSort');
 $articleDisplayFolderSort = $configurationManager->get('articleDisplayFolderSort');
-$displayFolderIsVerbose = $configurationManager->get('displayFolderIsVerbose');
+$optionFeedIsVerbose = $configurationManager->get('optionFeedIsVerbose');
 
 $tpl->assign('articleView',$articleView);
 $tpl->assign('articleDisplayLink',$articleDisplayLink);
@@ -76,7 +76,7 @@ switch($action){
     default:
         $filter = array('unread'=>1);
         if($articleDisplayHomeSort) {$order = 'pubdate desc';} else {$order = 'pubdate asc';}
-        if($displayFolderIsVerbose) {
+        if($optionFeedIsVerbose) {
             $events = $eventManager->loadAllOnlyColumn($target,$filter,$order,$startArticle.','.$articlePerPages);
         } else {
             $events = $eventManager->getEventsNotVerboseFeed($startArticle,$articlePerPages,$order,$target);

+ 3 - 3
index.php

@@ -38,7 +38,7 @@ $articleDisplayFolderSort = $configurationManager->get('articleDisplayFolderSort
 $displayOnlyUnreadFeedFolder = $configurationManager->get('displayOnlyUnreadFeedFolder');
 if (!isset($displayOnlyUnreadFeedFolder)) $displayOnlyUnreadFeedFolder=false;
 ($displayOnlyUnreadFeedFolder=='true')?$displayOnlyUnreadFeedFolder_reverse='false':$displayOnlyUnreadFeedFolder_reverse='true';
-$displayFolderIsVerbose = $configurationManager->get('displayFolderIsVerbose');
+$optionFeedIsVerbose = $configurationManager->get('optionFeedIsVerbose');
 
 $tpl->assign('articleDisplayContent',$configurationManager->get('articleDisplayContent'));
 $tpl->assign('articleView',$configurationManager->get('articleView'));
@@ -121,7 +121,7 @@ switch($action){
     case 'unreadEvents':
     default:
         $filter = array('unread'=>1);
-        if($displayFolderIsVerbose) {
+        if($optionFeedIsVerbose) {
             $numberOfItem = $eventManager->rowCount($filter);
         } else {
             $numberOfItem = $eventManager->getEventCountNotVerboseFeed();
@@ -130,7 +130,7 @@ switch($action){
         $pages = ($articlePerPages>0?ceil($numberOfItem/$articlePerPages):1);
         $startArticle = ($page-1)*$articlePerPages;
         if($articleDisplayHomeSort) {$order = 'pubdate desc';} else {$order = 'pubdate asc';}
-        if($displayFolderIsVerbose) {
+        if($optionFeedIsVerbose) {
             $events = $eventManager->loadAllOnlyColumn($target,$filter,$order,$startArticle.','.$articlePerPages);
         } else {
             $events = $eventManager->getEventsNotVerboseFeed($startArticle,$articlePerPages,$order,$target);

+ 1 - 1
install.php

@@ -184,7 +184,7 @@ if (isset($_['installButton']) && empty($test['Erreur'])) { // Pas d'erreur, l'i
     $configurationManager->add('articleDisplayHomeSort','1');
     $configurationManager->add('articleDisplayFolderSort','1');
     $configurationManager->add('displayOnlyUnreadFeedFolder','false');
-    $configurationManager->add('displayFolderIsVerbose',1);
+    $configurationManager->add('optionFeedIsVerbose',1);
     $configurationManager->add('synchronisationType','auto');
     $configurationManager->add('feedMaxEvents','50');
     $configurationManager->add('synchronisationCode',$synchronisationCode);

+ 1 - 0
locale/en.json

@@ -45,6 +45,7 @@
  "FEED":"Feed",
  "FEED_MANAGING":"Feed managing",
  "FEED_OPTION":"Feed options",
+ "FEED_OPTION_ISVERBOSE":"Enable / Disable option to hide the desired feed on your home page:",
  "FEED_RSS_LINK":"RSS feed link ",
  "FEED_SYNCHRONISATION":"Feed synchronization",
  "FOLD":"Fold",

+ 1 - 0
locale/fr.json

@@ -45,6 +45,7 @@
  "FEED":"Flux",
  "FEED_MANAGING":"Gestion des flux",
  "FEED_OPTION":"Option des flux",
+ "FEED_OPTION_ISVERBOSE":"Activer / Désactiver l'option pour cacher les flux souhaités de la page d'accueil :",
  "FEED_RSS_LINK":"Lien du flux RSS",
  "FEED_SYNCHRONISATION":"Synchronisation des flux",
  "FOLD":"Plier",

+ 1 - 0
settings.php

@@ -23,6 +23,7 @@ $tpl->assign('articleDisplayHomeSort', $configurationManager->get('articleDispla
 $tpl->assign('articleDisplayFolderSort', $configurationManager->get('articleDisplayFolderSort'));
 $tpl->assign('articleDisplayContent', $configurationManager->get('articleDisplayContent'));
 $tpl->assign('articleView', $configurationManager->get('articleView'));
+$tpl->assign('optionFeedIsVerbose', $configurationManager->get('optionFeedIsVerbose'));
 
 //Suppression de l'état des plugins inexistants
 Plugin::pruneStates();

+ 28 - 2
templates/marigolds/js/script.js

@@ -605,14 +605,40 @@ function getUrlVars()
 // affiche ou cache les feeds n'ayant pas d'article non lus.
 function toggleFeedVerbose(button,action,idFeed){
     $.ajax({
-        url: "./action.php?action=displayFolderIsVerbose&displayFolderIsVerbose="+action+"&idFeed="+idFeed,
+        url: "./action.php?action=displayFeedIsVerbose&displayFeedIsVerbose="+action+"&idFeed="+idFeed,
         success:function(msg){
             if(msg.status == 'noconnect') {
                 alert(msg.texte)
             } else {
                 if( console && console.log && msg!="" ) console.log(msg);
                 //changement de l'évènement onclick pour faire l'inverse lors du prochain clic
-                $(button).attr('onclick','toggleFeedVerbose(this,'+!action+', '+idFeed+');');
+                var reverseaction = 0
+                if (action==0) { reverseaction = 1 }
+                $(button).attr('onclick','toggleFeedVerbose(this,'+reverseaction+', '+idFeed+');');
+            }
+        }
+    });
+}
+
+// Bouton permettant l'affichage des options d'affichage et de non affichage des flux souhaités en page d'accueil
+function toggleOptionFeedVerbose(button,action){
+    $.ajax({
+        url: "./action.php?action=optionFeedIsVerbose&optionFeedIsVerbose="+action,
+        success:function(msg){
+            if(msg.status == 'noconnect') {
+                alert(msg.texte)
+            } else {
+                if( console && console.log && msg!="" ) console.log(msg);
+                //changement de l'évènement onclick pour faire l'inverse lors du prochain clic
+                var reverseaction = 0
+                if (action==0) { reverseaction = 1 }
+                $(button).attr('onclick','toggleOptionFeedVerbose(this,'+reverseaction+');');
+                //Changement du statut des cases à cocher sur les feed (afficher ou cacher)
+                if (action==1){
+                    $('.feedVerbose').hide();
+                }else{
+                    $('.feedVerbose').show();
+                }
             }
         }
     });

+ 21 - 3
templates/marigolds/settings.html

@@ -59,6 +59,16 @@
 
                 </section>
 
+                <section class="addBloc">
+                    <h3>{function="_t('FEED_OPTION')"}</h3>
+                    <span>{function="_t('FEED_OPTION_ISVERBOSE')"}</span>
+                    {if="$optionFeedIsVerbose==0"}
+                    <input class="" onclick="toggleOptionFeedVerbose(this,1)" type="checkbox" checked>
+                    {else}
+                    <input class="" onclick="toggleOptionFeedVerbose(this,0)" type="checkbox">
+                    {/if}
+                </section>
+
                     <ul class="clear nochip">
                     {$feedsForFolder=""}
                     {loop="$folders"}
@@ -93,10 +103,18 @@
                                             <option {if="$value2->getFolder()==$value3->getId()"}selected="selected"{/if} value="{$value3->getId()}">{$value3->getName()}</option>
                                             {/loop}
                                         </select>
-                                        {if="$value2->getIsverbose()==0"}
-                                        <input class="feedVerbose" onclick="toggleFeedVerbose(this,{$value2->getIsverbose()},{$value2->getId()})" type="checkbox" title="{function="_t('HIDE_FEED_IS_VERBOSE')"}">
+                                        {if="$optionFeedIsVerbose==0"}
+                                            {if="$value2->getIsverbose()==0"}
+                                            <input class="feedVerbose" onclick="toggleFeedVerbose(this,{$value2->getIsverbose()},{$value2->getId()})" type="checkbox" title="{function="_t('HIDE_FEED_IS_VERBOSE')"}">
+                                            {else}
+                                            <input class="feedVerbose" onclick="toggleFeedVerbose(this,{$value2->getIsverbose()},{$value2->getId()})" type="checkbox" title="{function="_t('HIDE_FEED_IS_VERBOSE')"}" checked>
+                                            {/if}
                                         {else}
-                                        <input class="feedVerbose" onclick="toggleFeedVerbose(this,{$value2->getIsverbose()},{$value2->getId()})" type="checkbox" title="{function="_t('HIDE_FEED_IS_VERBOSE')"}" checked>
+                                            {if="$value2->getIsverbose()==0"}
+                                            <input class="feedVerbose" style="display: none;" onclick="toggleFeedVerbose(this,{$value2->getIsverbose()},{$value2->getId()})" type="checkbox" title="{function="_t('HIDE_FEED_IS_VERBOSE')"}">
+                                            {else}
+                                            <input class="feedVerbose" style="display: none;" onclick="toggleFeedVerbose(this,{$value2->getIsverbose()},{$value2->getId()})" type="checkbox" title="{function="_t('HIDE_FEED_IS_VERBOSE')"}" checked>
+                                            {/if}
                                         {/if}
                                     </div>
                                 </li>