Changeset 839


Ignore:
Timestamp:
Sep 18, 2016, 6:41:49 PM (8 years ago)
Author:
chronos
Message:
  • Modified: Use TinyMCE editor for news content.
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/System.php

    r795 r839  
    2828  var $CommandLine;
    2929  var $PageHeaders;
     30  var $BaseView;
    3031
    3132  function __construct()
  • trunk/Application/UpdateTrace.php

    r831 r839  
    20312031  $Manager->Execute('UPDATE `Service` SET `InternetSpeedMin`=`InternetSpeedMin`*1000;');
    20322032  $Manager->Execute('UPDATE `Service` SET `InternetSpeedMax`=`InternetSpeedMax`*1000;');
     2033}
     2034
     2035function UpdateTo838($Manager)
     2036{
     2037  $Manager->Execute('ALTER TABLE `News` CHANGE `Date` `Date` DATETIME NULL, CHANGE `TargetDate` `TargetDate` DATETIME NULL;');
    20332038}
    20342039
     
    21262131      818 => array('Revision' => 824, 'Function' => 'UpdateTo824'),
    21272132      824 => array('Revision' => 831, 'Function' => 'UpdateTo831'),
     2133      831 => array('Revision' => 838, 'Function' => 'UpdateTo838'),
    21282134    ));
    21292135  }
  • trunk/Application/Version.php

    r834 r839  
    11<?php
    22
    3 $Revision = 834; // Subversion revision
    4 $DatabaseRevision = 831; // SQL structure revision
    5 $ReleaseTime = strtotime('2016-07-03');
     3$Revision = 838; // Subversion revision
     4$DatabaseRevision = 838; // SQL structure revision
     5$ReleaseTime = strtotime('2016-09-18');
  • trunk/Modules/News/NewsPage.php

    r790 r839  
    6666    if($this->System->User->CheckPermission('News', 'Insert', 'Group', $Category['Id']))
    6767    {
     68      $this->System->PageHeaders[] = array($this, 'GetPageHeader');
    6869      $Output = '<strong>Vložení nové aktuality:</strong><br />';
    6970      // TODO: Static reference to dynamic category item
     
    121122        $Enclosures = substr($Enclosures, 1);
    122123
    123         $_POST['content'] = str_replace("\n",'<br />',$_POST['content']);
    124124        $this->Database->insert('News', array('Category' => $Category['Id'], 'Title' => $_POST['title'],
    125125          'Content' => $_POST['content'], 'Date' => 'NOW()', 'IP' => $RemoteAddr,
     
    133133  }
    134134
     135  function GetPageHeader()
     136  {
     137    return('<script src="'.$this->System->Link('/Packages/TinyMCE/tinymce.min.js').'"></script>'.
     138        "<script>tinymce.init({
     139  selector: 'textarea',
     140  force_p_newlines : false,
     141  force_br_newlines : true,
     142  convert_newlines_to_brs : false,
     143  remove_linebreaks : true,
     144  plugins: [
     145    'advlist autolink lists link image charmap print preview anchor',
     146    'searchreplace visualblocks code fullscreen',
     147    'insertdatetime media table contextmenu paste code'
     148  ],
     149  toolbar: 'insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image',
     150  language: 'cs_CZ',
     151});</script>");
     152  }
     153
    135154  function ShowEdit()
    136155  {
     
    143162      if(($this->System->User->User['Id'] == $Row['User']))
    144163      {
    145         $Row['Content'] = str_replace('<br />', '', $Row['Content']);
     164        $this->System->PageHeaders[] = array($this, 'GetPageHeader');
    146165        $Output .= '<strong>Editace aktuality v kategorii '.$Category['Caption'].':</strong><br />';
    147166        $Output .= '<form action="?action=update" method="post">'.
    148167        '<input type="hidden" value="'.$_GET['id'].'" name="id">'.
    149168        'Nadpis:<br /><input type="text" size="54" name="title" value="'.$Row['Title'].'"><br />'.
    150         'Obsah:<br /><textarea name="content" rows="20" cols="40">'.$Row['Content'].'</textarea><br />'.
     169        'Obsah:<br /><textarea name="content" rows="20" cols="40" style="width: 50%">'.$Row['Content'].'</textarea><br />'.
    151170        'Odkaz:<br /><input type="text" size="54" name="link" value="'.$Row['Link'].'"><br />'.
    152171        '<input type="hidden" name="category" value="'.$Category['Id'].'"><br />'.
     
    172191        if($this->System->User->User['Id'] == $Row['User'])
    173192        {
    174           $_POST['content'] = str_replace("\n", '<br />', $_POST['content']);
    175193          $this->Database->update('News', 'Id='.$_POST['id'], array('Title' => $_POST['title'],
    176194            'Content' => $_POST['content'], 'Link' => $_POST['link']));
Note: See TracChangeset for help on using the changeset viewer.