[ Index ]
 

Code source de eGroupWare 1.2.106-2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/manual/inc/ -> class.uimanualadmin.inc.php (source)

   1  <?php
   2  /**************************************************************************\
   3  * eGroupWare - Online User manual                                          *
   4  * http://www.eGroupWare.org                                                *
   5  * Written and copyright (c) 2004-6 by RalfBecker@outdoor-training.de       *
   6  * --------------------------------------------                             *
   7  *  This program is free software; you can redistribute it and/or modify it *
   8  *  under the terms of the GNU General Public License as published by the   *
   9  *  Free Software Foundation; either version 2 of the License, or (at your  *
  10  *  option) any later version.                                              *
  11  \**************************************************************************/
  12  
  13  /* $Id: class.uimanualadmin.inc.php 21356 2006-04-13 13:31:10Z ralfbecker $ */
  14  
  15  include_once (EGW_INCLUDE_ROOT.'/wiki/inc/class.xmlwiki.inc.php');
  16  
  17  class uimanualadmin extends xmlwiki
  18  {
  19      var $public_functions = array(
  20          'import' =>True,
  21      );
  22      var $manual_config;
  23      var $mconfig;
  24  
  25  	function uimanualadmin()
  26      {
  27          CreateObject('manual.uimanual');    // sets the default config
  28  
  29          $this->mconfig =& CreateObject('phpgwapi.config','manual');
  30          $this->mconfig->read_repository();
  31          $this->manual_config =& $this->mconfig->config_data;
  32          
  33          $this->wiki_id = (int) $this->manual_config['manual_wiki_id'];
  34          $this->xmlwiki($this->wiki_id);    // call the constructor of the class we extend
  35      }
  36  
  37  	function import()
  38      {
  39          $url = $this->manual_config['manual_update_url'];
  40          $from = explode('/',$url);
  41          $from = count($from) > 2 ? $from[2] : $url;
  42  
  43          if (($langs = $GLOBALS['egw']->translation->get_installed_langs()))
  44          {
  45              $langs = implode(',',array_keys($langs));
  46              $url .= (strstr($url,'?') === False ? '?' : '&').'lang='.$langs;
  47          }
  48          // only do an incremental update if the langs are unchanged and we already did an update
  49          if ($langs == $this->manual_config['manual_langs'] && $this->manual_config['manual_updated'])
  50          {
  51              $url .= (strstr($url,'?') === False ? '?' : '&').'modified='.(int) $this->manual_config['manual_updated'];
  52          }
  53  
  54          $GLOBALS['egw_info']['flags']['app_header'] = lang('manual').' - '.lang('download');
  55          $GLOBALS['egw']->common->egw_header();
  56          parse_navbar();
  57          echo str_pad('<h3>'.lang('Starting import from %1, this might take several minutes (specialy if you start it the first time) ...',
  58              '<a href="'.$url.'" target="_blank">'.$from.'</a>')."</h3>\n",4096);    // dirty hack to flushes the buffer;
  59          @set_time_limit(0);
  60  
  61          $status = xmlwiki::import($url,True);
  62          
  63          $this->manual_config['manual_updated'] = $status['meta']['exported'];
  64          $this->manual_config['manual_langs'] = $langs;
  65          $this->mconfig->save_repository();
  66  
  67          echo '<h3>'.lang('%1 manual page(s) added or updated',count($status['imported']))."</h3>\n";
  68  
  69          $GLOBALS['egw']->common->egw_footer();
  70      }
  71  
  72  	function menu($args)
  73      {
  74          display_section('manual','manual',array(
  75              'Site Configuration' => $GLOBALS['egw']->link('/index.php','menuaction=admin.uiconfig.index&appname=manual'),
  76              'install or update the manual-pages' => $GLOBALS['egw']->link('/index.php',array('menuaction'=>'manual.uimanualadmin.import')),
  77          ));
  78      }
  79      
  80  	function config($args)
  81      {
  82          $GLOBALS['egw_info']['server']['found_validation_hook'] = True;
  83  
  84          return true;
  85      }
  86  }
  87  
  88  function final_validation($settings)
  89  {
  90      //echo "final_validation()"; _debug_array($settings);
  91      if ($settings['manual_allow_anonymous'])
  92      {
  93          // check if anon user set and exists
  94          if (!$settings['manual_anonymous_user'] || !($anon_user = $GLOBALS['egw']->accounts->name2id($settings['manual_anonymous_user'])))
  95          {
  96              $GLOBALS['config_error'] = 'Anonymous user does NOT exist!';
  97          }
  98          else    // check if anon user has run-rights for manual
  99          {
 100              $locations = $GLOBALS['egw']->acl->get_all_location_rights($anon_user,'manual');
 101              if (!$locations['run'])
 102              {
 103                  $GLOBALS['config_error'] = 'Anonymous user has NO run-rights for the application!';
 104              }
 105          }
 106      }
 107  }


Généré le : Sun Feb 25 17:20:01 2007 par Balluche grâce à PHPXref 0.7