[chronojump] New products gui (80% done)



commit 1febf0e8da33917ddaac47c1bffa060172d54960
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Dec 29 18:05:57 2020 +0100

    New products gui (80% done)

 glade/app1.glade                         | 255 +++++++++++++++++++++++++++++--
 images/md/baseline_store_yellow_24dp.png | Bin 0 -> 7016 bytes
 src/Makefile.am                          |   6 +-
 src/gui/app1/chronojump.cs               |  23 ++-
 src/gui/app1/icons.cs                    |   5 +-
 src/gui/app1/menu.cs                     |  23 +++
 src/gui/app1/news.cs                     |  73 +++++++++
 src/news.cs                              |  25 +++
 src/sqlite/news.cs                       |   4 +-
 9 files changed, 389 insertions(+), 25 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index 5cbfe791..602d1b1f 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -23577,6 +23577,9 @@ Concentric</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -28423,6 +28426,18 @@ Concentric</property>
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">6</property>
                                                             <child>
+                                                            <widget class="GtkLabel" 
id="label_video_encoder_tests_will_be_filmed">
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" translatable="yes">Tests 
will be filmed</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="pack_type">end</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
                                                             <widget class="GtkHBox" 
id="hbox_video_encoder_capturing">
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">4</property>
@@ -28459,18 +28474,6 @@ Concentric</property>
                                                             </packing>
                                                             </child>
                                                             <child>
-                                                            <widget class="GtkLabel" 
id="label_video_encoder_tests_will_be_filmed">
-                                                            <property name="can_focus">False</property>
-                                                            <property name="label" translatable="yes">Tests 
will be filmed</property>
-                                                            </widget>
-                                                            <packing>
-                                                            <property name="expand">False</property>
-                                                            <property name="fill">False</property>
-                                                            <property name="pack_type">end</property>
-                                                            <property name="position">0</property>
-                                                            </packing>
-                                                            </child>
-                                                            <child>
                                                             <widget class="GtkHBox" 
id="hbox_video_encoder_no_capturing">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
@@ -36711,6 +36714,9 @@ then click this button.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -42567,6 +42573,231 @@ then click this button.</property>
                                     <property name="type">tab</property>
                                   </packing>
                                 </child>
+                                <child>
+                                  <widget class="GtkAlignment" id="alignment_news">
+                                    <property name="can_focus">False</property>
+                                    <property name="top_padding">4</property>
+                                    <property name="bottom_padding">4</property>
+                                    <property name="left_padding">2</property>
+                                    <property name="right_padding">4</property>
+                                    <child>
+                                      <widget class="GtkVBox" id="vbox_news">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
+                                        <property name="border_width">4</property>
+                                        <property name="spacing">4</property>
+                                        <child>
+                                          <widget class="GtkFrame" id="frame27">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="label_xalign">0</property>
+                                            <property name="label_yalign">1</property>
+                                            <property name="shadow_type">in</property>
+                                            <child>
+                                              <widget class="GtkViewport" id="viewport16">
+                                                <property name="visible">True</property>
+                                                <property name="can_focus">False</property>
+                                                <property name="border_width">4</property>
+                                                <child>
+                                                  <widget class="GtkVBox" id="vbox148">
+                                                    <property name="visible">True</property>
+                                                    <property name="can_focus">False</property>
+                                                    <child>
+                                                      <widget class="GtkHBox" id="hbox443">
+                                                        <property name="visible">True</property>
+                                                        <property name="can_focus">False</property>
+                                                        <child>
+                                                          <widget class="GtkVBox" id="vbox149">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <child>
+                                                            <widget class="GtkLabel" id="label_news_title">
+                                                            <property name="height_request">40</property>
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="wrap">True</property>
+                                                            <property name="width_chars">80</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">True</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkHBox" id="hbox450">
+                                                            <property name="height_request">400</property>
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">16</property>
+                                                            <child>
+                                                            <widget class="GtkLabel" 
id="label_news_description_and_link">
+                                                            <property name="width_request">300</property>
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="wrap">True</property>
+                                                            <property name="width_chars">80</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkImage" id="image_news">
+                                                            <property name="width_request">400</property>
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property 
name="stock">gtk-missing-image</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                          </widget>
+                                                          <packing>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                          </packing>
+                                                        </child>
+                                                      </widget>
+                                                      <packing>
+                                                        <property name="expand">True</property>
+                                                        <property name="fill">False</property>
+                                                        <property name="position">0</property>
+                                                      </packing>
+                                                    </child>
+                                                  </widget>
+                                                </child>
+                                              </widget>
+                                            </child>
+                                            <child>
+                                              <widget class="GtkHBox" id="hbox447">
+                                                <property name="visible">True</property>
+                                                <property name="can_focus">False</property>
+                                                <property name="spacing">6</property>
+                                                <child>
+                                                  <widget class="GtkImage" id="image_news_blue">
+                                                    <property name="visible">True</property>
+                                                    <property name="can_focus">False</property>
+                                                    <property name="stock">gtk-missing-image</property>
+                                                  </widget>
+                                                  <packing>
+                                                    <property name="expand">False</property>
+                                                    <property name="fill">False</property>
+                                                    <property name="position">0</property>
+                                                  </packing>
+                                                </child>
+                                                <child>
+                                                  <widget class="GtkImage" id="image_news_yellow">
+                                                    <property name="can_focus">False</property>
+                                                    <property name="stock">gtk-missing-image</property>
+                                                  </widget>
+                                                  <packing>
+                                                    <property name="expand">False</property>
+                                                    <property name="fill">False</property>
+                                                    <property name="position">1</property>
+                                                  </packing>
+                                                </child>
+                                                <child>
+                                                  <widget class="GtkLabel" id="label_news_frame">
+                                                    <property name="visible">True</property>
+                                                    <property name="can_focus">False</property>
+                                                    <property name="label" translatable="yes">New 
products</property>
+                                                  </widget>
+                                                  <packing>
+                                                    <property name="expand">True</property>
+                                                    <property name="fill">True</property>
+                                                    <property name="position">2</property>
+                                                  </packing>
+                                                </child>
+                                              </widget>
+                                              <packing>
+                                                <property name="type">label_item</property>
+                                              </packing>
+                                            </child>
+                                          </widget>
+                                          <packing>
+                                            <property name="expand">True</property>
+                                            <property name="fill">True</property>
+                                            <property name="position">0</property>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <widget class="GtkHButtonBox" id="hbuttonbox10">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <child>
+                                              <widget class="GtkButton" id="button_news_close">
+                                                <property name="visible">True</property>
+                                                <property name="can_focus">True</property>
+                                                <property name="can_default">True</property>
+                                                <property name="receives_default">False</property>
+                                                <signal name="clicked" 
handler="on_button_news_close_clicked" swapped="no"/>
+                                                <accelerator key="Escape" signal="clicked"/>
+                                                <child>
+                                                  <widget class="GtkEventBox" 
id="eventbox_button_news_close">
+                                                    <property name="visible">True</property>
+                                                    <property name="can_focus">False</property>
+                                                    <child>
+                                                      <widget class="GtkLabel" id="label412">
+                                                        <property name="visible">True</property>
+                                                        <property name="can_focus">False</property>
+                                                        <property name="label" 
translatable="yes">Close</property>
+                                                      </widget>
+                                                    </child>
+                                                  </widget>
+                                                </child>
+                                              </widget>
+                                              <packing>
+                                                <property name="expand">False</property>
+                                                <property name="fill">False</property>
+                                                <property name="position">0</property>
+                                              </packing>
+                                            </child>
+                                            <child>
+                                              <placeholder/>
+                                            </child>
+                                            <child>
+                                              <placeholder/>
+                                            </child>
+                                          </widget>
+                                          <packing>
+                                            <property name="expand">False</property>
+                                            <property name="fill">False</property>
+                                            <property name="position">1</property>
+                                          </packing>
+                                        </child>
+                                      </widget>
+                                    </child>
+                                  </widget>
+                                  <packing>
+                                    <property name="position">6</property>
+                                  </packing>
+                                </child>
+                                <child>
+                                  <widget class="GtkLabel" id="label411">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="label">news</property>
+                                  </widget>
+                                  <packing>
+                                    <property name="position">6</property>
+                                    <property name="tab_fill">False</property>
+                                    <property name="type">tab</property>
+                                  </packing>
+                                </child>
                               </widget>
                               <packing>
                                 <property name="resize">True</property>
diff --git a/images/md/baseline_store_yellow_24dp.png b/images/md/baseline_store_yellow_24dp.png
new file mode 100644
index 00000000..52259f82
Binary files /dev/null and b/images/md/baseline_store_yellow_24dp.png differ
diff --git a/src/Makefile.am b/src/Makefile.am
index 8922b01e..12d77c77 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -18,6 +18,7 @@ SOURCES = \
        gui/app1/contactsExercise.cs\
        gui/app1/forceSensor.cs\
        gui/app1/forceSensorAnalyze.cs\
+       gui/app1/news.cs\
        gui/app1/session/delete.cs\
        gui/app1/session/addEdit.cs\
        gui/app1/session/backup.cs\
@@ -564,8 +565,9 @@ RESOURCES = \
        ../images/md/folders_blue.png,image_folders.png \
        ../images/md/folders_backup_blue.png,image_db_backup.png \
        ../images/md/baseline_help_blue_24dp.png,image_help.png \
-       ../images/md/baseline_store_blue_24dp.png,image_store.png \
-       ../images/md/baseline_store_blue_news_24dp.png,image_store_news.png \
+       ../images/md/baseline_store_blue_24dp.png,image_store_blue.png \
+       ../images/md/baseline_store_yellow_24dp.png,image_store_yellow.png \
+       ../images/md/baseline_store_blue_news_24dp.png,image_store_has_new_products.png \
        ../images/chronojump_icon.png,chronojump_icon.png \
        ../images/chronojump_icon_transp.png,chronojump_icon_transp.png \
        ../images/chronojump_icon_graph.png,chronojump_icon_graph.png \
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index be467a91..7a09493c 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -82,6 +82,7 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.EventBox eventbox_radio_mode_multi_chronopic_small;
        [Widget] Gtk.EventBox eventbox_button_open_chronojump;
        [Widget] Gtk.EventBox eventbox_button_help_close;
+       [Widget] Gtk.EventBox eventbox_button_news_close;
        [Widget] Gtk.EventBox eventbox_button_exit_cancel;
        [Widget] Gtk.EventBox eventbox_button_exit_confirm;
 
@@ -464,7 +465,7 @@ public partial class ChronoJumpWindow
        private string progVersion;
        private string progName;
        private enum notebook_start_pages { PROGRAM, SENDLOG, EXITCONFIRM }
-       private enum notebook_sup_pages { START, CONTACTS, ENCODER, SESSION, NETWORKSPROBLEMS, HELP }
+       private enum notebook_sup_pages { START, CONTACTS, ENCODER, SESSION, NETWORKSPROBLEMS, HELP, NEWS }
        private enum notebook_analyze_pages { STATISTICS, JUMPSPROFILE, JUMPSDJOPTIMALFALL, 
JUMPSWEIGHTFVPROFILE, JUMPSEVOLUTION, JUMPSRJFATIGUE, SPRINT, FORCESENSOR, RACEENCODER }
 
        private string runningFileName; //useful for knowing if there are two chronojump instances
@@ -603,6 +604,7 @@ public partial class ChronoJumpWindow
                UtilGtk.EventBoxColorBackgroundActive (eventbox_radio_mode_multi_chronopic_small, 
UtilGtk.YELLOW, UtilGtk.YELLOW_LIGHT);
                UtilGtk.EventBoxColorBackgroundActive (eventbox_button_open_chronojump, UtilGtk.YELLOW, 
UtilGtk.YELLOW_LIGHT);
                UtilGtk.EventBoxColorBackgroundActive (eventbox_button_help_close, UtilGtk.YELLOW, 
UtilGtk.YELLOW_LIGHT);
+               UtilGtk.EventBoxColorBackgroundActive (eventbox_button_news_close, UtilGtk.YELLOW, 
UtilGtk.YELLOW_LIGHT);
                UtilGtk.EventBoxColorBackgroundActive (eventbox_button_exit_cancel, UtilGtk.YELLOW, 
UtilGtk.YELLOW_LIGHT);
                UtilGtk.EventBoxColorBackgroundActive (eventbox_button_exit_confirm, UtilGtk.YELLOW, 
UtilGtk.YELLOW_LIGHT);
                app1s_eventboxes_paint();
@@ -822,19 +824,24 @@ public partial class ChronoJumpWindow
                        image_session_new_blue.Visible = false;
                        image_session_load3_blue.Visible = false;
                        image_session_import1_blue.Visible = false;
+                       image_news_blue.Visible = false;
 
                        image_session_new_yellow.Visible = true;
                        image_session_load3_yellow.Visible = true;
                        image_session_import1_yellow.Visible = true;
+                       image_news_yellow.Visible = true;
                } else {
                        image_session_new_blue.Visible = true;
                        image_session_load3_blue.Visible = true;
                        image_session_import1_blue.Visible = true;
+                       image_news_blue.Visible = true;
 
                        image_session_new_yellow.Visible = false;
                        image_session_load3_yellow.Visible = false;
                        image_session_import1_yellow.Visible = false;
+                       image_news_yellow.Visible = false;
                }
+               UtilGtk.ContrastLabelsLabel (Config.ColorBackgroundIsDark, label_news_frame);
        }
 
        private void testNewStuff()
@@ -6770,22 +6777,22 @@ LogB.Debug("mc finished 5");
                }
        }
 
-       private void on_button_menu_news_clicked (object o, EventArgs args)
-       {
-               getNews();
-       }
-
        private bool pulsePingAndNewsGTK ()
        {
                if(! pingThread.IsAlive)
                {
-                       if(News.InsertIfNeeded (newsAtDB_l, newsAtServer_l))
+                       // 1) Insert if needed
+                       if(newsAtServer_l != null && News.InsertIfNeeded (newsAtDB_l, newsAtServer_l))
                        {
-                               Pixbuf pixbuf = new Pixbuf (null, Util.GetImagePath(false) + 
"image_store_news.png");
+                               Pixbuf pixbuf = new Pixbuf (null, Util.GetImagePath(false) + 
"image_store_has_new_products.png");
                                image_menu_news.Pixbuf = pixbuf;
                                image_menu_news1.Pixbuf = pixbuf;
                        }
 
+                       // 2) update newsAtDB_l
+                       newsAtDB_l = SqliteNews.Select(false, -1);
+
+                       // 3) end this pulse
                        LogB.Information("pulsePingAndNews ending here");
                        LogB.ThreadEnded();
                        return false;
diff --git a/src/gui/app1/icons.cs b/src/gui/app1/icons.cs
index 8c6847f7..4d8762b9 100644
--- a/src/gui/app1/icons.cs
+++ b/src/gui/app1/icons.cs
@@ -248,9 +248,12 @@ public partial class ChronoJumpWindow
                image_contacts_exercise_settings.Pixbuf = pixbuf;
                image_encoder_exercise_settings.Pixbuf = pixbuf;
 
-               pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_store.png");
+               pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_store_blue.png");
                image_menu_news.Pixbuf = pixbuf;
                image_menu_news1.Pixbuf = pixbuf;
+               image_news_blue.Pixbuf = pixbuf;
+               pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_store_yellow.png");
+               image_news_yellow.Pixbuf = pixbuf;
 
                //pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_minimize.png");
                //image_minimize.Pixbuf = pixbuf;
diff --git a/src/gui/app1/menu.cs b/src/gui/app1/menu.cs
index 2b25a0d3..63822dda 100644
--- a/src/gui/app1/menu.cs
+++ b/src/gui/app1/menu.cs
@@ -21,6 +21,7 @@
 //this file has methods of ChronoJumpWindow related to manage menu
 
 using System;
+using Gdk;
 using Gtk;
 using Glade;
 using System.Collections.Generic; //List
@@ -306,6 +307,28 @@ public partial class ChronoJumpWindow
                notebook_sup.CurrentPage = app1s_notebook_sup_entered_from;
        }
 
+       private void on_button_menu_news_clicked (object o, EventArgs args)
+       {
+               //fill the widget
+               news_fill(newsAtDB_l);
+
+               //sensitivity and notebook management
+               menus_and_mode_sensitive(false);
+               app1s_notebook_sup_entered_from = notebook_sup.CurrentPage;
+               notebook_sup.CurrentPage = Convert.ToInt32(notebook_sup_pages.NEWS);
+       }
+
+       private void on_button_news_close_clicked (object o, EventArgs args)
+       {
+               menus_and_mode_sensitive(true);
+               notebook_sup.CurrentPage = app1s_notebook_sup_entered_from;
+
+               //put default news store icon because window has been opened (and hopefully seen)
+               Pixbuf pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_store_blue.png");
+               image_menu_news.Pixbuf = pixbuf;
+               image_menu_news1.Pixbuf = pixbuf;
+       }
+
        private int getMenuButtonsMaxWidth(List<int> l)
        {
                int max = 0;
diff --git a/src/gui/app1/news.cs b/src/gui/app1/news.cs
new file mode 100644
index 00000000..38e5f377
--- /dev/null
+++ b/src/gui/app1/news.cs
@@ -0,0 +1,73 @@
+/*
+ * This file is part of ChronoJump
+ *
+ * Chronojump is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or   
+ *    (at your option) any later version.
+ *    
+ * Chronojump is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
+ *    GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Copyright (C) 2020   Xavier de Blas <xaviblas gmail com>
+ */
+
+using System;
+using Gdk;  //pixbuf
+using Glade;
+using System.IO;
+using System.Collections.Generic; //List<T>
+
+public partial class ChronoJumpWindow
+{
+       [Widget] Gtk.Image image_news_blue;
+       [Widget] Gtk.Image image_news_yellow;
+       [Widget] Gtk.Label label_news_frame;
+       [Widget] Gtk.Alignment alignment_news;
+       [Widget] Gtk.Label label_news_title;
+       [Widget] Gtk.Label label_news_description_and_link;
+        [Widget] Gtk.Image image_news;
+
+       Pixbuf image_news_pixbuf;
+
+       private void news_fill (List<News> news_l)
+       {
+               if(news_l.Count == 0)
+                       return;
+
+               News news = news_l[0];
+
+               label_news_title.Text = "<b>" + news.GetTitle(false) + "</b>";
+               label_news_title.UseMarkup = true;
+               label_news_description_and_link.Text = news.GetDescription(false) + "\n\n" + 
news.GetLink(false);
+
+               news_loadImage(news);
+               alignment_news.Show(); // is hidden at beginning to allow being well shown when filled
+       }
+
+       private void news_loadImage(News news)
+       {
+               //TODO: share method for getting extension
+               string extension = "";
+               if(Util.IsJpeg(news.LinkServerImage))
+                       extension = ".jpg";
+               else if (Util.IsPng(news.LinkServerImage))
+                       extension = ".png";
+
+               string filename = Path.Combine(News.GetNewsDir(), news.Code.ToString() + extension);
+               LogB.Information("news image filename: " + filename);
+               if(File.Exists(filename))
+               {
+                       Pixbuf pixbuf = new Pixbuf (filename);
+                       image_news.Pixbuf = pixbuf;
+                       LogB.Information("exists");
+               }
+       }
+
+}
diff --git a/src/news.cs b/src/news.cs
index a8a64946..fbd359d6 100644
--- a/src/news.cs
+++ b/src/news.cs
@@ -76,6 +76,31 @@ public class News
                return SqliteNews.Insert(dbconOpened, toSQLInsertString());
        }
 
+       public string GetTitle(bool es)
+       {
+               if(es)
+                       return titleEs;
+               else
+                       return titleEn;
+       }
+
+       public string GetLink(bool es)
+       {
+               if(es)
+                       return linkEs;
+               else
+                       return linkEn;
+       }
+
+       public string GetDescription(bool es)
+       {
+               if(es)
+                       return descriptionEs;
+               else
+                       return descriptionEn;
+       }
+
+
        /* public static methods */
 
        /*
diff --git a/src/sqlite/news.cs b/src/sqlite/news.cs
index 28b4a2d5..03d988ed 100644
--- a/src/sqlite/news.cs
+++ b/src/sqlite/news.cs
@@ -39,7 +39,7 @@ class SqliteNews : Sqlite
 
        //server table is created like this:
        //create table news (code INT NOT NULL AUTO_INCREMENT PRIMARY KEY, category INT, version INT, titleEn 
char(255), titleEs char(255), linkEn char(255), linkEs char(255), descriptionEn char(255), descriptionEs 
char(255), linkServerImage char(255));
-       //INSERT INTO news VALUES (NULL, 1, 0, "my title", "mi título", "https://chronojump.org/software/";, 
"https://chronojump.org/es/programa/";, "This is the description", "Esta es la descripción", 
"https://chronojump.org/wp-content/uploads/2019/08/Adaptadors-scaled.jpeg";);
+       //INSERT INTO news VALUES (NULL, 1, 0, "Race Analyzer kit", "Kit Analizador Carreras", 
"https://chronojump.org/product-category/races/race_analyzer_kit/";, 
"https://chronojump.org/es/categoria-producto/carreras/kit_analizador_carreras/";, "Device that allows you to 
analyze and graph races from the time obtained every 3cm of race.\nThe mathematical model implemented by 
Chronojump allows you to graph speeds, accelerations, forces and instantaneous powers.", "Dispositivo que 
permite analizar y graficar carreras a partir del tiempo obtenido cada 3cm.\nEl modelo matemático 
implementado por Chronojump le permite graficar velocidades, aceleraciones, fuerzas y potencias 
instantáneas.", "https://chronojump.org/wp-content/uploads/2020/12/Race-Analyzer_new_products_400w.jpeg";);
 
 
        protected internal static void createTable ()
@@ -88,7 +88,7 @@ class SqliteNews : Sqlite
                if(code != -1)
                        codeStr = " WHERE code = " + code;
 
-               dbcmd.CommandText = "SELECT * FROM " + table + codeStr;
+               dbcmd.CommandText = "SELECT * FROM " + table + codeStr + " ORDER BY code DESC";
 
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]