Dotclear

Changeset 1989:b234959829da


Ignore:
Timestamp:
09/22/13 02:49:48 (12 years ago)
Author:
Denis Jean-Chirstian <contact@…>
Branch:
default
Message:

Revamp plugin maintenance, step 5, now open to admin user and various fixes, addresses #999

Files:
12 edited

Legend:

Unmodified
Added
Removed
  • locales/en/plugins.po

    r1984 r1989  
    10031003msgstr "" 
    10041004 
    1005 msgid "Display count of expired tasks on maintenance dashboard icon" 
    1006 msgstr "" 
    1007  
    1008 msgid "Display list of expired tasks on dashboard items" 
     1005msgid "Display count of late tasks on maintenance dashboard icon" 
     1006msgstr "" 
     1007 
     1008msgid "Display list of late tasks on dashboard items" 
    10091009msgstr "" 
    10101010 
     
    10361036msgstr "" 
    10371037 
    1038 msgid "Index all comments" 
     1038msgid "Index all comments for search engine" 
    10391039msgstr "" 
    10401040 
     
    10521052msgstr "" 
    10531053 
    1054 msgid "Index all posts" 
     1054msgid "Index all entries for search engine" 
    10551055msgstr "" 
    10561056 
     
    11061106msgstr "" 
    11071107 
     1108msgid "You have not sufficient permissions to view this page" 
     1109msgstr "" 
     1110 
    11081111msgid "Settings successfully updated" 
    11091112msgstr "" 
     
    11211124msgstr "" 
    11221125 
    1123 msgid "Display alert messages on expired tasks" 
     1126msgid "Display alert messages on late tasks" 
    11241127msgstr "" 
    11251128 
     
    11301133msgstr "" 
    11311134 
    1132 msgid "You can place list of expired tasks on your %s." 
     1135msgid "You can place list of late tasks on your %s." 
    11331136msgstr "" 
    11341137 
  • locales/fr/plugins.po

    r1984 r1989  
    12191219msgstr "Gérer les tâches" 
    12201220 
    1221 msgid "Display count of expired tasks on maintenance dashboard icon" 
    1222 msgstr "Afficher le nombre de tâches expirées sur l'icône maintenance du tableau de bord" 
    1223  
    1224 msgid "Display list of expired tasks on dashboard items" 
    1225 msgstr "Afficher la liste des tâches expirées dans les éléments du tableau de bord" 
     1221msgid "Display count of late tasks on maintenance dashboard icon" 
     1222msgstr "Afficher le nombre de tâches en retard sur l'icône maintenance du tableau de bord" 
     1223 
     1224msgid "Display list of late tasks on dashboard items" 
     1225msgstr "Afficher la liste des tâches en retard dans les éléments du tableau de bord" 
    12261226 
    12271227msgid "Failed to execute task." 
     
    12521252msgstr "Index du moteur de recherche" 
    12531253 
    1254 msgid "Index all comments" 
    1255 msgstr "Indexation de tous les commentaires" 
     1254msgid "Index all comments for search engine" 
     1255msgstr "Indexer tous les commentaires pour le moteur de recherche" 
    12561256 
    12571257msgid "Next" 
     
    12671267msgstr "Impossible d'indexer les commentaires." 
    12681268 
    1269 msgid "Index all posts" 
    1270 msgstr "Indexation de tous les billets" 
     1269msgid "Index all entries for search engine" 
     1270msgstr "Indexer tous les billets pour le moteur de recherche" 
    12711271 
    12721272msgid "Indexing entry %d to %d." 
     
    13211321msgstr "Jamais" 
    13221322 
     1323msgid "You have not sufficient permissions to view this page" 
     1324msgstr "Vous n'avez pas les autorisations suffisantes pour accéder à cette page" 
     1325 
    13231326msgid "Settings successfully updated" 
    13241327msgstr "Paramètres mis à jour avec succès" 
    13251328 
    13261329msgid "You should execute it now." 
    1327 msgstr "Vous devriez l'exécuter à nouveau." 
     1330msgstr "Vous devriez l'exécuter dès maintenant." 
    13281331 
    13291332msgid "Execute task" 
     
    13361339msgstr "Paramètres" 
    13371340 
    1338 msgid "Display alert messages on expired tasks" 
    1339 msgstr "Afficher les messages d'alert sur les tâches expirées." 
     1341msgid "Display alert messages on late tasks" 
     1342msgstr "Afficher les messages d'alerte sur les tâches en retard." 
    13401343 
    13411344msgid "Recall time for all tasks:" 
     
    13451348msgstr "Délai de rappel par tâche :" 
    13461349 
    1347 msgid "You can place list of expired tasks on your %s." 
    1348 msgstr "Vous pouvez placer la liste des tâches expirées sur votre %s." 
     1350msgid "You can place list of late tasks on your %s." 
     1351msgstr "Vous pouvez placer la liste des tâches en retard sur votre %s." 
    13491352 
    13501353#, php-format 
  • plugins/importExport/inc/lib.ie.maintenance.php

    r1959 r1989  
    1414class ieMaintenanceExportblog extends dcMaintenanceTask 
    1515{ 
     16     protected $perm = 'admin'; 
    1617     protected $tab = 'backup'; 
    1718     protected $group = 'zipblog'; 
  • plugins/maintenance/_admin.php

    r1984 r1989  
    1818     'index.php?pf=maintenance/icon.png', 
    1919     preg_match('/plugin.php\?p=maintenance(&.*)?$/', $_SERVER['REQUEST_URI']), 
    20      $core->auth->isSuperAdmin() 
     20     $core->auth->check('admin', $core->blog->id) 
    2121); 
    2222 
     
    192192          '<p><label for="maintenance_dashboard_icon" class="classic">'. 
    193193          form::checkbox('maintenance_dashboard_icon', 1, $core->auth->user_prefs->maintenance->dashboard_icon). 
    194           __('Display count of expired tasks on maintenance dashboard icon').'</label></p>'. 
     194          __('Display count of late tasks on maintenance dashboard icon').'</label></p>'. 
    195195 
    196196          '<p><label for="maintenance_dashboard_item" class="classic">'. 
    197197          form::checkbox('maintenance_dashboard_item', 1, $core->auth->user_prefs->maintenance->dashboard_item). 
    198           __('Display list of expired tasks on dashboard items').'</label></p>'. 
     198          __('Display list of late tasks on dashboard items').'</label></p>'. 
    199199 
    200200          '</div>'; 
  • plugins/maintenance/_define.php

    r1925 r1989  
    1616     /* Description*/         "Maintain your installation", 
    1717     /* Author */             "Olivier Meunier & Association Dotclear", 
    18      /* Version */            '1.3' 
     18     /* Version */            '1.3.1', 
     19     /* Permission */         'admin' 
    1920); 
  • plugins/maintenance/inc/class.dc.maintenance.php

    r1984 r1989  
    7777               } 
    7878 
    79                $this->tasks[$task] = new $task($this, 'plugin.php?p=maintenance'); 
     79               if (($t = new $task($this, 'plugin.php?p=maintenance')) === null 
     80               || $t->perm() === null && !$this->core->auth->isSuperAdmin() 
     81               || !$this->core->auth->check($t->perm(), $this->core->blog->id)) { 
     82                    continue; 
     83               } 
     84 
     85               $this->tasks[$task] = $t; 
    8086          } 
    8187 
  • plugins/maintenance/inc/class.dc.maintenance.task.php

    r1984 r1989  
    2929     protected $ajax = false; 
    3030     protected $blog = false; 
     31     protected $perm = null; 
    3132 
    3233     protected $id; 
     
    5556          $this->init(); 
    5657 
     58          if ($this->perm() === null && !$this->core->auth->isSuperAdmin() 
     59          || !$this->core->auth->check($this->perm(), $this->core->blog->id)) { 
     60               return null; 
     61          } 
     62 
    5763          $this->p_url = $p_url; 
    5864          $this->id = get_class($this); 
     
    7278 
    7379          $this->ts = abs((integer) $ts); 
     80 
     81          return true; 
    7482     } 
    7583 
     
    8391     { 
    8492          return null; 
     93     } 
     94 
     95     /** 
     96      * Get task permission. 
     97      * 
     98      * Return user permission required to run this task  
     99      * or null for super admin. 
     100      * 
     101      * @return <b>mixed</b> Permission. 
     102      */ 
     103     public function perm() 
     104     { 
     105          return $this->perm; 
     106     } 
     107 
     108     /** 
     109      * Get task scope. 
     110      *. 
     111      * Is task limited to current blog. 
     112      * 
     113      * @return <b>boolean</b> Limit to blog 
     114      */ 
     115     public function blog() 
     116     { 
     117          return $this->blog; 
    85118     } 
    86119 
  • plugins/maintenance/inc/tasks/class.dc.maintenance.indexcomments.php

    r1984 r1989  
    2222     { 
    2323          $this->name         = __('Search engine index'); 
    24           $this->task         = __('Index all comments'); 
     24          $this->task         = __('Index all comments for search engine'); 
    2525          $this->step_task    = __('Next'); 
    2626          $this->step         = __('Indexing comment %d to %d.'); 
  • plugins/maintenance/inc/tasks/class.dc.maintenance.indexposts.php

    r1984 r1989  
    2222     { 
    2323          $this->name         = __('Search engine index'); 
    24           $this->task         = __('Index all posts'); 
     24          $this->task         = __('Index all entries for search engine'); 
    2525          $this->step_task    = __('Next'); 
    2626          $this->step         = __('Indexing entry %d to %d.'); 
  • plugins/maintenance/inc/tasks/class.dc.maintenance.zipmedia.php

    r1984 r1989  
    1414class dcMaintenanceZipmedia extends dcMaintenanceTask 
    1515{ 
     16     protected $perm = 'admin'; 
    1617     protected $blog = true; 
    1718     protected $tab = 'backup'; 
  • plugins/maintenance/inc/tasks/class.dc.maintenance.ziptheme.php

    r1984 r1989  
    1414class dcMaintenanceZiptheme extends dcMaintenanceTask 
    1515{ 
     16     protected $perm = 'admin'; 
    1617     protected $blog = true; 
    1718     protected $tab = 'backup'; 
  • plugins/maintenance/index.php

    r1985 r1989  
    1212if (!defined('DC_CONTEXT_ADMIN')) { return; } 
    1313 
    14 dcPage::checkSuper(); 
    15  
    16 // main class 
     14// Set env 
     15 
     16$core->blog->settings->addNamespace('maintenance'); 
    1717 
    1818$maintenance = new dcMaintenance($core); 
    19 $core->blog->settings->addNamespace('maintenance'); 
    20  
    21 // Set var 
     19$tasks = $maintenance->getTasks(); 
    2220 
    2321$msg = ''; 
     
    2826 
    2927$code = empty($_POST['code']) ? null : (integer) $_POST['code']; 
    30 $tab = empty($_REQUEST['tab']) ? 'maintenance' : $_REQUEST['tab']; 
     28$tab = empty($_REQUEST['tab']) ? '' : $_REQUEST['tab']; 
    3129 
    3230// Save settings 
     
    3937               !empty($_POST['settings_plugin_message']),  
    4038               'boolean',  
    41                'Display alert message of expired tasks on plugin page',  
     39               'Display alert message of late tasks on plugin page',  
    4240               true,  
    4341               true 
    4442          ); 
    4543 
    46           foreach($maintenance->getTasks() as $t) { 
     44          foreach($tasks as $t) { 
    4745               if (!empty($_POST['settings_recall_time']) && $_POST['settings_recall_time'] == 'seperate') { 
    4846                    $ts = empty($_POST['settings_ts_'.$t->id()]) ? 0 : $_POST['settings_ts_'.$t->id()]; 
     
    5755                    sprintf('Recall time for task %s', $t->id()),  
    5856                    true,  
    59                     true 
     57                    $t->blog() 
    6058               ); 
    6159          } 
     
    138136</head> 
    139137<body>'; 
     138 
     139// Check if there is somthing to display according to user permissions 
     140if (empty($tasks)) { 
     141     echo dcPage::breadcrumb( 
     142          array( 
     143               __('Plugins') => '', 
     144               '<a href="'.$p_url.'">'.__('Maintenance').'</a>' => '', 
     145               '<span class="page-title">'.html::escapeHTML($task->name()).'</span>' => '' 
     146          ) 
     147     ). 
     148     '<p class="warn">'.__('You have not sufficient permissions to view this page.').'</p>'. 
     149     '</body></html>'; 
     150 
     151     return null; 
     152} 
    140153 
    141154// Success message 
     
    201214     { 
    202215          $res_group = ''; 
    203           foreach($maintenance->getGroups($core) as $group_id => $group_name) 
     216          foreach($maintenance->getGroups() as $group_id => $group_name) 
    204217          { 
    205218               $res_task = ''; 
    206                foreach($maintenance->getTasks($core) as $t) 
     219               foreach($tasks as $t) 
    207220               { 
    208221                    if ($t->group() != $group_id || $t->tab() != $tab_id) { 
     
    256269               form::hidden(array('tab'), $tab_id). 
    257270               $core->formNonce().'</p>'. 
    258                '<p class="form-note info">'.__('This may take a very long time.').'.</p>'. 
     271               '<p class="form-note info">'.__('This may take a very long time.').'</p>'. 
    259272               '</form>'. 
    260273               '</div>'; 
     
    264277     // Advanced tasks (that required a tab) 
    265278 
    266      foreach($maintenance->getTasks($core) as $t) 
     279     foreach($tasks as $t) 
    267280     { 
    268281          if ($t->group() !== null) { 
     
    292305     '<p><label for="settings_plugin_message" class="classic">'. 
    293306     form::checkbox('settings_plugin_message', 1, $core->blog->settings->maintenance->plugin_message). 
    294      __('Display alert messages on expired tasks').'</label></p>'. 
     307     __('Display alert messages on late tasks').'</label></p>'. 
    295308 
    296309     '<p><label for="settings_recall_time">'.__('Recall time for all tasks:').'</label>'. 
     
    300313     '<p>'.__('Recall time per task:').'</p>'; 
    301314 
    302      foreach($maintenance->getTasks($core) as $t) 
     315     foreach($tasks as $t) 
    303316     { 
    304317          echo 
     
    319332     '</form>'. 
    320333     '<p class="info">'.sprintf( 
    321           __('You can place list of expired tasks on your %s.'), 
     334          __('You can place list of late tasks on your %s.'), 
    322335          '<a href="preferences.php#user-favorites">'.__('Dashboard').'</a>' 
    323336     ).'</a></p>'. 
Note: See TracChangeset for help on using the changeset viewer.

Sites map