You are here:  » Upgrade from v13/03A to 14/06A


Upgrade from v13/03A to 14/06A

Submitted by ChrisNBC on Thu, 2014-10-23 09:51 in

Hi David,

Please could you tell me if there is an upgrade path from v13/03A to the latest distribution. I'm particularly interested in the feature which allows filters to be re ordered.

Thanks in advance.

Regards

Chris

Submitted by support on Thu, 2014-10-23 10:22

Hi Chris,

To add re-ordering to admin/feeds_filters.php (13/03A) first look for the following code at line 95:

      print "<td>";

...and REPLACE with:

      print "<td>";
      admin_tool("↑","?filename=".urlencode($filename)."&resequence=".$filter["id"]."&to=".($k-1),($filter["created"]>$first_created),TRUE);
      admin_tool("↓","?filename=".urlencode($filename)."&resequence=".$filter["id"]."&to=".($k+1),($filter["created"]<$last_created),TRUE);

Next, look for the following code at line 77:

    print "<table class='feeds'>";

...and REPLACE with:

    $first_created = $rows[0]["created"];
    $last_created = $rows[count($rows)-1]["created"];
    print "<table class='feeds'>";

And finally look for the following code at line 14:

  $filename = $_GET["filename"];

...and REPLACE with:

  $filename = $_GET["filename"];
  if (isset($_GET["resequence"]))
  {
    $sql = "SELECT id,created FROM `".$config_databaseTablePrefix."filters` WHERE filename='".database_safe($filename)."' ORDER BY created";
    if (database_querySelect($sql,$filters))
    {
      $sql = "UPDATE `".$config_databaseTablePrefix."filters` SET created = '".database_safe($_GET["to"])."' WHERE id = '".database_safe($_GET["resequence"])."'";
      database_queryModify($sql,$result);
      $created = 0;
      foreach($filters as $filter)
      {
        if ($filter["id"]==$_GET["resequence"])
        {
          continue;
        }
        if ($created==$_GET["to"])
        {
          $created++;
        }
        $sql = "UPDATE `".$config_databaseTablePrefix."filters` SET created = '".$created."' WHERE id = '".$filter["id"]."'";
        database_queryModify($sql,$result);
        $created++;
      }
    }
    header("Location: feeds_filters.php?filename=".urlencode($filename));
    exit();
  }

Cheers,
David.
--
PriceTapestry.com

Submitted by ChrisNBC on Thu, 2014-10-23 10:39

Hi David,

Thanks for the above which works perfectly!

Best regards
Chris

Submitted by ChrisNBC on Mon, 2014-11-03 13:27

Hi David,

I just wondered if you could suggest if there is a way to add the same functionality to the global filters?

Thanks in advance.

Regards
Chris

Submitted by support on Mon, 2014-11-03 15:33

Hi Chris,

To add re-ordering to admin/global_filters.php (13/03A) first look for the following code at line 76:

      print "<td>";

...and REPLACE with:

      print "<td>";
      admin_tool("↑","?resequence=".$filter["id"]."&to=".($k-1),($filter["created"]>$first_created),TRUE);
      admin_tool("↓","?resequence=".$filter["id"]."&to=".($k+1),($filter["created"]<$last_created),TRUE);

Next, look for the following code at line 58:

    print "<table>";

...and REPLACE with:

    $first_created = $rows[0]["created"];
    $last_created = $rows[count($rows)-1]["created"];
    print "<table>";

And finally look for the following code at line 12:

  if (isset($_POST["submit"]))

...and REPLACE with:

  if (isset($_GET["resequence"]))
  {
    $sql = "SELECT id,created FROM `".$config_databaseTablePrefix."filters` WHERE filename='' ORDER BY created";
    if (database_querySelect($sql,$filters))
    {
      $sql = "UPDATE `".$config_databaseTablePrefix."filters` SET created = '".database_safe($_GET["to"])."' WHERE id = '".database_safe($_GET["resequence"])."'";
      database_queryModify($sql,$result);
      $created = 0;
      foreach($filters as $filter)
      {
        if ($filter["id"]==$_GET["resequence"])
        {
          continue;
        }
        if ($created==$_GET["to"])
        {
          $created++;
        }
        $sql = "UPDATE `".$config_databaseTablePrefix."filters` SET created = '".$created."' WHERE id = '".$filter["id"]."'";
        database_queryModify($sql,$result);
        $created++;
      }
    }
    header("Location: global_filters.php");
    exit();
  }
  if (isset($_POST["submit"]))

Cheers,
David.
--
PriceTapestry.com

Submitted by ChrisNBC on Mon, 2014-11-03 16:52

Hi David,

Thanks as always for the quick response.

I just made the changes above and it all works beautifully.

Best regards
Chris