Forum des Objets Communicants et Solutions pour les Libérer...
Vous souhaitez réagir à ce message ? Créez un compte en quelques clics ou connectez-vous pour continuer.

Forum des Objets Communicants et Solutions pour les Libérer...


 
AccueilAccueil  GalerieGalerie  RechercherRechercher  Dernières imagesDernières images  S'enregistrerS'enregistrer  Connexion  
-50%
Le deal à ne pas rater :
-50% Baskets Nike Air Huarache
64.99 € 129.99 €
Voir le deal

 

 Patch pour labels du plugin memo

Aller en bas 
2 participants
AuteurMessage
guyou
Nabz Junior
Nabz Junior
guyou


Localisation : Région Toulousaine
Nabaztag : Alfred (v2)
Nbr de messages : 94
Carottes : 4429

Patch pour labels du plugin memo Empty
MessageSujet: Patch pour labels du plugin memo   Patch pour labels du plugin memo Icon_minitimeLun 2 Juil 2012 - 13:46

Hello,

En voulant essayer le plugin memo, je me suis fourvoyé : j'ai mis l'adresse d'un fichier audio. Bien entendu, ça n'a pas fonctionné. Et quand Alfred m'a lut toute l'URL, j'ai compris mon erreur, que j'ai pu valider en relisant le code : il faut mettre un texte, qui sera lu.

Analysant les sources de mon erreur, je vous propose un patch. Dans celui-ci, je renomme tous les "webcast" en "memo" (j'ai supposé que la présence du mot webcast dans les source du plugin memo était une coquille). Je n'ai pas trop changé la page PHP, mais je me dit qu'un peu plus d'information serait utile.

Dans cet esprit, avez-vous envisagé la mise en place d'une structure pour de l'aide en ligne ? Par exemple, une page aide.php dans chaque plugin ?

Ci-dessous, la patch.
nabzdevil Attention, je n'ai toujours pas pris le temps d'installer une conf. de test. Donc il faut une relecture attentive de mon patch et, éventuellement, un test avant passage en prod. nabzdevil

Code:
From: Guilhem Bonnefille <guilhem.bonnefille@gmail.com>
Subject: [PATCH] Fix memo plugin labels

The different "Webcast" labels in the plugin's configuration page
introduce incorrect understanding of the plugin. We can think the
expected string is an URL to an audio content. But it's wrong.

Replacing by "Memo" seems better.

Signed-off-by: Guilhem Bonnefille <guilhem.bonnefille@gmail.com>

---
 .../ojn_admin/plugins/bunnies/memo.plugin.php      |  24 ++++----
 server/plugins/memo/plugin_memo.cpp                |  64 ++++++++++----------
 server/plugins/memo/plugin_memo.h                  |  12 ++--
 3 files changed, 50 insertions(+), 50 deletions(-)

diff --git a/http-wrapper/ojn_admin/plugins/bunnies/memo.plugin.php b/http-wrapper/ojn_admin/plugins/bunnies/memo.plugin.php
index 0ea1e33..5a6870d 100644
--- a/http-wrapper/ojn_admin/plugins/bunnies/memo.plugin.php
+++ b/http-wrapper/ojn_admin/plugins/bunnies/memo.plugin.php
@@ -9,23 +9,23 @@ $days = array(
 7 => "Sunday"
 );
 if(!empty($_POST['a'])) {
-      if($_POST['a']=="dwebcast") {
-              if(!empty($_POST['dwebcastT']) && !empty($_POST['dwebcastM'])) {
-                      $retour = $ojnAPI->getApiString("bunny/".$_SESSION['bunny']."/memo/adddaily?message=".urlencode($_POST['dwebcastM']).
+      if($_POST['a']=="dmemo") {
+              if(!empty($_POST['dmemoT']) && !empty($_POST['dmemoM'])) {
+                      $retour = $ojnAPI->getApiString("bunny/".$_SESSION['bunny']."/memo/adddaily?message=".urlencode($_POST['dmemoM'])."&t
                        $_SESSION['message'] = isset($retour['ok']) ? $retour['ok'] : "Error : ".$retour['error'];
                        header("Location: bunny_plugin.php?p=memo");
                }
        }
-      else if($_POST['a']=="webcast") {
-              if(!empty($_POST['webcastT']) && !empty($_POST['webcastM']) && !empty($_POST['webcastD'])) {
-                      $retour = $ojnAPI->getApiString("bunny/".$_SESSION['bunny']."/memo/addwebcast?message=".urlencode($_POST['webcastM'])
+      else if($_POST['a']=="memo") {
+              if(!empty($_POST['memoT']) && !empty($_POST['memoM']) && !empty($_POST['memoD'])) {
+                      $retour = $ojnAPI->getApiString("bunny/".$_SESSION['bunny']."/memo/addmemo?message=".urlencode($_POST['memoM'])."&tim
                        $_SESSION['message'] = isset($retour['ok']) ? $retour['ok'] : "Error : ".$retour['error'];
                        header("Location: bunny_plugin.php?p=memo");
                }
        }
 }
 else if(!empty($_GET['rt']) && !empty($_GET['rd'])) {
-      $retour = $ojnAPI->getApiString("bunny/".$_SESSION['bunny']."/memo/removewebcast?day=".$_GET['rd']."&time=".$_GET['rt']."&".$ojnAPI->
+      $retour = $ojnAPI->getApiString("bunny/".$_SESSION['bunny']."/memo/removememo?day=".$_GET['rd']."&time=".$_GET['rt']."&".$ojnAPI->get
        $_SESSION['message'] = isset($retour['ok']) ? $retour['ok'] : "Error : ".$retour['error'];
        header("Location: bunny_plugin.php?p=memo");
 }
@@ -35,15 +35,15 @@ else if(!empty($_GET['rw'])) {
        header("Location: bunny_plugin.php?p=memo");
 }
 $wDList = $ojnAPI->getApiString("bunny/".$_SESSION['bunny']."/memo/getdailylist?".$ojnAPI->getToken());
-$wList = $ojnAPI->getApiString("bunny/".$_SESSION['bunny']."/memo/getwebcastslist?".$ojnAPI->getToken());
+$wList = $ojnAPI->getApiString("bunny/".$_SESSION['bunny']."/memo/getmemoslist?".$ojnAPI->getToken());
 
 ?>
 <form method="post">
 <fieldset>
 <legend>Actions</legend>
-<input type="radio" name="a" value="dwebcast" /> Add a daily webcast at (hh:mm) <input type="text" name="dwebcastT" maxlength="5" style="wid
+<input type="radio" name="a" value="dmemo" /> Add a daily memo at (hh:mm) <input type="text" name="dmemoT" maxlength="5" style="width:50px"
 <br />
-<input type="radio" name="a" value="webcast" /> Add a webcast at (hh:mm) <input type="text" name="webcastT" maxlength="5" style="width:50px"
+<input type="radio" name="a" value="memo" /> Add a memo at (hh:mm) <input type="text" name="memoT" maxlength="5" style="width:50px" /> on <s
 <br />
 <input type="submit" value="Enregister">
 
@@ -54,7 +54,7 @@ if(isset($wList['list']->item)){
 <center>
 <table style="width: 80%">
        <tr>
-              <th colspan="4">Webcast</th>
+              <th colspan="4">Memo</th>
        </tr>
        <tr>
                <th>Day</th>
@@ -82,7 +82,7 @@ if(isset($wDList['list']->item)){
 <center>
 <table style="width: 80%">
        <tr>
-              <th colspan="3">Daily Webcast</th>
+              <th colspan="3">Daily Memo</th>
        </tr>
        <tr>
                <th>Time</th>
diff --git a/server/plugins/memo/plugin_memo.cpp b/server/plugins/memo/plugin_memo.cpp
index d951487..0d25994 100755
--- a/server/plugins/memo/plugin_memo.cpp
+++ b/server/plugins/memo/plugin_memo.cpp
@@ -38,7 +38,7 @@ void PluginMemo::OnCron(Bunny * b, QVariant v)
 
 void PluginMemo::OnBunnyConnect(Bunny * b)
 {
-      QMap<QString, QVariant> listDaily = b->GetPluginSetting(GetName(), "DailyWebcasts", QMap<QString, QVariant>()).toMap();
+      QMap<QString, QVariant> listDaily = b->GetPluginSetting(GetName(), "DailyMemos", QMap<QString, QVariant>()).toMap();
        QMapIterator<QString, QVariant> i(listDaily);
        while (i.hasNext()) {
                i.next();
@@ -46,7 +46,7 @@ void PluginMemo::OnBunnyConnect(Bunny * b)
                QString message = i.value().toString();
                Cron::RegisterDaily(this, QTime::fromString(time, "hh:mm"), b, QVariant::fromValue(message));
        }
-      QMap<QString, QVariant> list = b->GetPluginSetting(GetName(), "Webcasts", QMap<QString, QVariant>()).toMap();
+      QMap<QString, QVariant> list = b->GetPluginSetting(GetName(), "Memos", QMap<QString, QVariant>()).toMap();
        QMapIterator<QString, QVariant> i2(list);
        while (i2.hasNext()) {
                i2.next();
@@ -65,33 +65,33 @@ void PluginMemo::OnBunnyDisconnect(Bunny * b)
 
 void PluginMemo::InitApiCalls()
 {
-      DECLARE_PLUGIN_BUNNY_API_CALL("addwebcast(day,time,message)", PluginMemo, Api_AddWebcast);
-      DECLARE_PLUGIN_BUNNY_API_CALL("removewebcast(day,time)", PluginMemo, Api_RemoveWebcast);
-      DECLARE_PLUGIN_BUNNY_API_CALL("getwebcastslist()", PluginMemo, Api_ListWebcast);
-      DECLARE_PLUGIN_BUNNY_API_CALL("adddaily(time,message)", PluginMemo, Api_AddDailyWebcast);
-      DECLARE_PLUGIN_BUNNY_API_CALL("removedaily(time)", PluginMemo, Api_RemoveDailyWebcast);
-      DECLARE_PLUGIN_BUNNY_API_CALL("getdailylist()", PluginMemo, Api_ListDailyWebcast);
+      DECLARE_PLUGIN_BUNNY_API_CALL("addmemo(day,time,message)", PluginMemo, Api_AddMemo);
+      DECLARE_PLUGIN_BUNNY_API_CALL("removememo(day,time)", PluginMemo, Api_RemoveMemo);
+      DECLARE_PLUGIN_BUNNY_API_CALL("getmemoslist()", PluginMemo, Api_ListMemo);
+      DECLARE_PLUGIN_BUNNY_API_CALL("adddaily(time,message)", PluginMemo, Api_AddDailyMemo);
+      DECLARE_PLUGIN_BUNNY_API_CALL("removedaily(time)", PluginMemo, Api_RemoveDailyMemo);
+      DECLARE_PLUGIN_BUNNY_API_CALL("getdailylist()", PluginMemo, Api_ListDailyMemo);
 }
 
-PLUGIN_BUNNY_API_CALL(PluginMemo::Api_AddWebcast)
+PLUGIN_BUNNY_API_CALL(PluginMemo::Api_AddMemo)
 {
        Q_UNUSED(account);
 
        QString hTime = hRequest.GetArg("time");
        int hDay = hRequest.GetArg("day").toInt();
        QString message = hRequest.GetArg("message");
-      QMap<QString, QVariant> list = bunny->GetPluginSetting(GetName(), "Webcasts", QMap<QString, QVariant>()).toMap();
+      QMap<QString, QVariant> list = bunny->GetPluginSetting(GetName(), "Memos", QMap<QString, QVariant>()).toMap();
        if(!list.contains(QString::number(hDay)+"|"+hTime))
        {
                Cron::RegisterWeekly(this, (Qt::DayOfWeek)hDay, QTime::fromString(hTime, "hh:mm"), bunny, QVariant::fromValue(message));
                list.insert(QString::number(hDay)+"|"+hTime,message);
-              bunny->SetPluginSetting(GetName(), "Webcasts", list);
-              return new ApiManager::ApiOk(QString("Add webcast at '%1' to bunny '%2'").arg(hTime, QString(bunny->GetID())));
+              bunny->SetPluginSetting(GetName(), "Memos", list);
+              return new ApiManager::ApiOk(QString("Add memo at '%1' to bunny '%2'").arg(hTime, QString(bunny->GetID())));
        }
-      return new ApiManager::ApiError(QString("Webcast already exists at '%1' for bunny '%2'").arg(hTime, QString(bunny->GetID())));
+      return new ApiManager::ApiError(QString("Memo already exists at '%1' for bunny '%2'").arg(hTime, QString(bunny->GetID())));
 }
 
-PLUGIN_BUNNY_API_CALL(PluginMemo::Api_RemoveWebcast)
+PLUGIN_BUNNY_API_CALL(PluginMemo::Api_RemoveMemo)
 {
        Q_UNUSED(account);
 
@@ -99,70 +99,70 @@ PLUGIN_BUNNY_API_CALL(PluginMemo::Api_RemoveWebcast)
        if(!hRequest.HasArg("time"))
                return new ApiManager::ApiError(QString("Missing argument 'time' for plugin Memo"));
 
-      QMap<QString, QVariant> list = bunny->GetPluginSetting(GetName(), "Webcasts", QMap<QString, QVariant>()).toMap();
+      QMap<QString, QVariant> list = bunny->GetPluginSetting(GetName(), "Memos", QMap<QString, QVariant>()).toMap();
        QString time = hRequest.GetArg("time");
    if(list.contains(QString::number(hDay)+"|"+time))
    {
                list.remove(QString::number(hDay)+"|"+time);
-        bunny->SetPluginSetting(GetName(), "Webcasts", list);
+        bunny->SetPluginSetting(GetName(), "Memos", list);
 
                // Recreate crons
        OnBunnyDisconnect(bunny);
        OnBunnyConnect(bunny);
-        return new ApiManager::ApiOk(QString("Remove webcast at '%1' for bunny '%2'").arg(hRequest.GetArg("time"), QString(bunny->GetID())));
+        return new ApiManager::ApiOk(QString("Remove memo at '%1' for bunny '%2'").arg(hRequest.GetArg("time"), QString(bunny->GetID())));
    }
-    return new ApiManager::ApiError(QString("No webcast at '%1' for bunny '%2'").arg(hRequest.GetArg("time"), QString(bunny->GetID())));
+    return new ApiManager::ApiError(QString("No memo at '%1' for bunny '%2'").arg(hRequest.GetArg("time"), QString(bunny->GetID())));
 }
 
-PLUGIN_BUNNY_API_CALL(PluginMemo::Api_ListDailyWebcast)
+PLUGIN_BUNNY_API_CALL(PluginMemo::Api_ListDailyMemo)
 {
    Q_UNUSED(account);
    Q_UNUSED(hRequest);
-   return new ApiManager::ApiMappedList(bunny->GetPluginSetting(GetName(), "DailyWebcasts", QMap<QString, QVariant>()).toMap());
+   return new ApiManager::ApiMappedList(bunny->GetPluginSetting(GetName(), "DailyMemos", QMap<QString, QVariant>()).toMap());
 }
diff --git a/server/plugins/memo/plugin_memo.h b/server/plugins/memo/plugin_memo.h
index 98da217..fb76981 100755
--- a/server/plugins/memo/plugin_memo.h
+++ b/server/plugins/memo/plugin_memo.h
@@ -20,12 +20,12 @@ public:
 
    // API
    void InitApiCalls();
-   PLUGIN_BUNNY_API_CALL(Api_AddWebcast);
-   PLUGIN_BUNNY_API_CALL(Api_RemoveWebcast);
-   PLUGIN_BUNNY_API_CALL(Api_ListWebcast);
-   PLUGIN_BUNNY_API_CALL(Api_AddDailyWebcast);
-   PLUGIN_BUNNY_API_CALL(Api_RemoveDailyWebcast);
-   PLUGIN_BUNNY_API_CALL(Api_ListDailyWebcast);
+   PLUGIN_BUNNY_API_CALL(Api_AddMemo);
+   PLUGIN_BUNNY_API_CALL(Api_RemoveMemo);
+   PLUGIN_BUNNY_API_CALL(Api_ListMemo);
+   PLUGIN_BUNNY_API_CALL(Api_AddDailyMemo);
+   PLUGIN_BUNNY_API_CALL(Api_RemoveDailyMemo);
+   PLUGIN_BUNNY_API_CALL(Api_ListDailyMemo);
 
 private:
    QDir memoFolder;
--
tg: (b9c5799..) t/fix/memo-labels (depends on: master)
Revenir en haut Aller en bas
http://nathguil.free.fr/
Pixel du Rezo
Special Nabz
Special Nabz



Age : 44
Localisation : Montpellier
Nabaztag : Ptiloo (V1), Kymoo (V2), Mymoo (V2), Lyloo (V2), Maryloo (V2), Faitoo (V2), Titoo (V2), Kachoo (Karotz)
Nbr de messages : 2708
Carottes : 13103

Patch pour labels du plugin memo Empty
MessageSujet: Re: Patch pour labels du plugin memo   Patch pour labels du plugin memo Icon_minitimeLun 2 Juil 2012 - 16:46

Merci pour ce patch, je regarde ca au plus vite.

Concernant l'aide, c'est effectivement une idée à laquelle nous avons tous pensé... Mais cela prend du temps.
Personnelement, mes points forts sont surtout du coté du code, alors que je suis mauvais en design, et en prose... donc écrire les pages d'aide, c'est pas ce que je fais le mieux.

_____________________________


Toutes les infos sur mon serveur openJabNab sont sur mon wiki nabaztag/tag et openJabnab
Revenir en haut Aller en bas
http://openjabnab.fr/
 
Patch pour labels du plugin memo
Revenir en haut 
Page 1 sur 1
 Sujets similaires
-
» Plugin pour le TTS sur Wordpress ?
» Idée pour un nouveau Plugin
» Coup de main possible pour le dev de plugin ?
» Problème pour requête plugin météo
» [OJN] Recherche testeur pour plugin "music"

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
Forum des Objets Communicants et Solutions pour les Libérer... :: II. Nabaztag, Karotz, mir:ror, Dal:Dal (Violet Object Operating System) :: Les Nabaztags sont sauvés ! Les solutions... :: [OJN] OpenJabNab-
Sauter vers: