Source for file CMS3_PackageUninstaller.php

Documentation is available at CMS3_PackageUninstaller.php

  1. <?php     
  2. //              (F)
  3. // CMS3 - A Three Content Management System.
  4. // Copyright (C) 2007  Jop... (Jonas F. Jensen).
  5. // 
  6. // This program is free software; you can redistribute it and/or
  7. // modify it under the terms of the GNU General Public License
  8. // as published by the Free Software Foundation; either version 2
  9. // of the License, or (at your option) any later version.
  10. // 
  11. // This program is distributed in the hope that it will be useful,
  12. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. // GNU General Public License for more details.
  15. //
  16. // You should have received a copy of the GNU General Public License
  17. // along with this program; if not, write to the Free Software
  18. // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  19.  
  20. /**
  21. *This file defines CMS3_PackageUninstaller
  22. *
  23. @package    PackageUninstaller
  24. @author    Jonas F. Jensen <jopsen@gmail.com>
  25. @copyright    2007 Jonas F. Jensen.
  26. @license    http://www.gnu.org/licenses/gpl.txt
  27. */
  28.  
  29. /*
  30. *PackageUninstaller provides a frontend for removing packages.
  31. */
  32. class CMS3_PackageUninstaller extends CMS3_System_Plugin implements ISystemCallbackIConfigure //TODO: Perhaps implement IProvidesHelp
  33. {
  34.  
  35.     //ISystemCallback implementation
  36.     //used for ajax save...
  37.  
  38.     
  39.     /**
  40.      * Handles a callback from ajax application.
  41.      *
  42.      * @param string data Data attached to this callback
  43.      * @return 
  44.      * @access public
  45.      */
  46.     public function SystemCallback$data ){
  47.         if($data == "Remove"){
  48.             print $this->Owner->GetPlugin("PackageManager")->RemovePlugin($_POST["SelectedPackage"]"Package removed successfully" "Error while removing package.";
  49.         }else{
  50.             //Nothing smart to do, just return a soft 404
  51.             print "Error: 404, data not found.";
  52.         }
  53.     }
  54.  
  55.  
  56.     //IConfigure implementation
  57.  
  58.     
  59.     /**
  60.     * Gets an absolute address of an icon for this plugin
  61.     */
  62.     public function GetControlCenterIcon(){
  63.         return $this->Owner->GetCMS3URL("bin/" $this->GetPluginID("/config.png";
  64.     }
  65.  
  66.     /**
  67.     * Gets menu entry string
  68.     */
  69.     public function GetControlCenterMenuEntry(){
  70.         //TODO: i18n
  71.         return "Remove package";
  72.     }
  73.  
  74.     /**
  75.      * Gets a dojo based ajax guide for configuration of the plugin.
  76.      *
  77.      * @param IEmbedmentOutputHandler OutputHandler
  78.      * @return IEmbedmentOutputHandler 
  79.      * @access public
  80.      */
  81.     public function &Configure($Identifier null&$EmbedmentOutputHandler ){
  82.         //Load templates from files
  83.         $Head file_get_contents($this->Owner->GetCMS3Path("data/" $this->GetPluginID("/ConfigHead.htm");
  84.         $Body file_get_contents($this->Owner->GetCMS3Path("data/" $this->GetPluginID("/ConfigBody.htm");
  85.  
  86.             //Generate content
  87.         foreach($this->Owner->GetPlugin("PackageManager")->ListPlugins(as $Plugin//Note: we're getting it from PackageManager, since not all plugins are removable
  88.         {
  89.             $Options .= "<option value='" $Plugin "' >" $Plugin "</option>\n";
  90.         }
  91.         $Body str_replace("CMS3URL",$this->Owner->GetCMS3URL(,$Body);
  92.         $Body str_replace("OPTIONS",$Options ,$Body);
  93.  
  94.         //Parse the output
  95.         $EmbedmentOutputHandler->ExtentHeader($Head);
  96.         $EmbedmentOutputHandler->SetBody($Body);
  97.         return $EmbedmentOutputHandler;
  98.     }
  99.  
  100.  
  101.         //Implementation of IPlugin
  102.  
  103.     
  104.     /**
  105.      * Gets the pluginID of the plugin.
  106.      *
  107.      * @return string 
  108.      * @access public
  109.      */
  110.     public function GetPluginID)
  111.     {
  112.         return "PackageUninstaller";
  113.     }
  114.  
  115.  
  116. }
  117.  
  118.  
  119. ?>

Documentation generated on Mon, 30 Apr 2007 01:59:05 +0200 by phpDocumentor 1.3.1