Dotclear


Ignore:
Timestamp:
09/30/13 11:02:47 (12 years ago)
Author:
Denis Jean-Chirstian <contact@…>
Branch:
dcRepo
Message:

Move maintenance configuration to the new plugins configurator

Location:
plugins/maintenance
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • plugins/maintenance/_admin.php

    r2116 r2163  
    2929$core->addBehavior('adminAfterDashboardOptionsUpdate', array('dcMaintenanceAdmin',   'adminAfterDashboardOptionsUpdate')); 
    3030$core->addBehavior('adminPageHelpBlock',     array('dcMaintenanceAdmin',   'adminPageHelpBlock')); 
     31$core->addBehavior('pluginsToolsHeaders',    array('dcMaintenanceAdmin',   'pluginsToolsHeaders')); 
    3132 
    3233/** 
     
    222223          $core->auth->user_prefs->maintenance->put('dashboard_item', !empty($_POST['maintenance_dashboard_item']), 'boolean'); 
    223224     } 
    224  
    225225 
    226226     /** 
     
    293293          } 
    294294     } 
     295 
     296     /** 
     297      * Add javascript for plugin configuration. 
     298      * 
     299      * @param $core     <b>dcCore</b>  dcCore instance 
     300      * @param $module   <b>mixed</b>   Module ID or false if none 
     301      * @return     <b>string</b>  Header code for js inclusion 
     302      */ 
     303     public static function pluginsToolsHeaders($core, $module) 
     304     { 
     305          if ($module == 'maintenance') { 
     306               return dcPage::jsLoad('index.php?pf=maintenance/js/settings.js'); 
     307          } 
     308     } 
    295309} 
  • plugins/maintenance/index.php

    r2051 r2163  
    2727$code = empty($_POST['code']) ? null : (integer) $_POST['code']; 
    2828$tab = empty($_REQUEST['tab']) ? '' : $_REQUEST['tab']; 
    29  
    30 // Save settings 
    31  
    32 if (!empty($_POST['settings'])) { 
    33  
    34      try { 
    35           $core->blog->settings->maintenance->put( 
    36                'plugin_message',  
    37                !empty($_POST['settings_plugin_message']),  
    38                'boolean',  
    39                'Display alert message of late tasks on plugin page',  
    40                true,  
    41                true 
    42           ); 
    43  
    44           foreach($tasks as $t) { 
    45                if (!empty($_POST['settings_recall_type']) && $_POST['settings_recall_type'] == 'all') { 
    46                     $ts = $_POST['settings_recall_time']; 
    47                } 
    48                else { 
    49                     $ts = empty($_POST['settings_ts_'.$t->id()]) ? 0 : $_POST['settings_ts_'.$t->id()]; 
    50                } 
    51                $core->blog->settings->maintenance->put( 
    52                     'ts_'.$t->id(),  
    53                     abs((integer) $ts),  
    54                     'integer',  
    55                     sprintf('Recall time for task %s', $t->id()),  
    56                     true,  
    57                     $t->blog() 
    58                ); 
    59           } 
    60            
    61           http::redirect($p_url.'&done=1&tab='.$tab.'#'.$tab); 
    62      } 
    63      catch(Exception $e) { 
    64           $core->error->add($e->getMessage()); 
    65      } 
    66 } 
    6729 
    6830// Get task object 
     
    287249          '</div>'; 
    288250     } 
    289  
    290      // Settings 
    291  
    292      echo  
    293      '<div id="settings" class="multi-part" title="'.__('Alert settings').'">'. 
    294      '<h3>'.__('Alert settings').'</h3>'. 
    295      '<form action="'.$p_url.'" method="post">'. 
    296  
    297      '<h4 class="pretty-title">'.__('Activation').'</h4>'. 
    298      '<p><label for="settings_plugin_message" class="classic">'. 
    299      form::checkbox('settings_plugin_message', 1, $core->blog->settings->maintenance->plugin_message). 
    300      __('Display alert messages on late tasks').'</label></p>'. 
    301  
    302      '<p class="info">'.sprintf( 
    303           __('You can place list of late tasks on your %s.'), 
    304           '<a href="preferences.php#user-favorites">'.__('Dashboard').'</a>' 
    305      ).'</p>'. 
    306  
    307      '<h4 class="pretty-title vertical-separator">'.__('Frequency').'</h4>'. 
    308  
    309      '<p class="vertical-separator">'.form::radio(array('settings_recall_type', 'settings_recall_all'), 'all').' '. 
    310      '<label class="classic" for="settings_recall_all">'. 
    311      '<strong>'.__('Use one recall time for all tasks').'</strong></label>'. 
    312  
    313      '<p class="field wide vertical-separator"><label for="settings_recall_time">'.__('Recall time for all tasks:').'</label>'. 
    314      form::combo('settings_recall_time', $combo_ts, 'seperate', 'recall-for-all'). 
    315      '</p>'. 
    316  
    317      '<p class="vertical-separator">'.form::radio(array('settings_recall_type', 'settings_recall_separate'), 'separate', 1).' '. 
    318      '<label class="classic" for="settings_recall_separate">'. 
    319      '<strong>'.__('Use one recall time per task').'</strong></label>'; 
    320  
    321      foreach($tasks as $t) 
    322      { 
    323           echo 
    324           '<div class="two-boxes">'. 
    325  
    326           '<p class="field wide"><label for="settings_ts_'.$t->id().'">'.$t->task().'</label>'. 
    327           form::combo('settings_ts_'.$t->id(), $combo_ts, $t->ts(), 'recall-per-task'). 
    328           '</p>'. 
    329  
    330           '</div>'; 
    331      } 
    332  
    333      echo  
    334      '<p class="field wide"><input type="submit" value="'.__('Save this settings').'" /> '. 
    335      form::hidden(array('tab'), 'settings'). 
    336      form::hidden(array('settings'), 1). 
    337      $core->formNonce().'</p>'. 
    338      '</form>'. 
    339      '</div>'; 
    340251} 
    341252 
Note: See TracChangeset for help on using the changeset viewer.

Sites map