[Fusionforge-commits] r9649 - in trunk/gforge: common common/include common/mvc www/include

Mélanie Le Bail melanelebail at libremir.placard.fr.eu.org
Thu Apr 29 16:46:29 CEST 2010


Author: melanelebail
Date: 2010-04-29 16:46:28 +0200 (Thu, 29 Apr 2010)
New Revision: 9649

Added:
   trunk/gforge/common/mvc/
   trunk/gforge/common/mvc/Actions.class.php
   trunk/gforge/common/mvc/Controler.class.php
   trunk/gforge/common/mvc/Views.class.php
Modified:
   trunk/gforge/common/include/Group.class.php
   trunk/gforge/common/include/Plugin.class.php
   trunk/gforge/www/include/Layout.class.php
   trunk/gforge/www/include/plugins_utils.php
Log:
Prepare integration of plugin Hudson (MVC model)


Modified: trunk/gforge/common/include/Group.class.php
===================================================================
--- trunk/gforge/common/include/Group.class.php	2010-04-29 14:32:17 UTC (rev 9648)
+++ trunk/gforge/common/include/Group.class.php	2010-04-29 14:46:28 UTC (rev 9649)
@@ -1223,6 +1223,22 @@
 		}
 		return false ;
 	}
+	/**
+	 *  added for Codendi compatibility
+	 *  usesServices - returns true if the group uses a particular plugin 
+	 *
+	 *  @param	string	name of the plugin
+	 *  @return	boolean	whether plugin is being used or not
+	 */
+	function usesService($pluginname) {
+		$plugins_data = $this->getPlugins() ;
+		foreach ($plugins_data as $p_id => $p_name) {
+			if ($p_name == $pluginname) {
+				return true ;
+			}
+		}
+		return false ;
+	}
 
 	/**
 	 *  setPluginUse - enables/disables plugins for the group

Modified: trunk/gforge/common/include/Plugin.class.php
===================================================================
--- trunk/gforge/common/include/Plugin.class.php	2010-04-29 14:32:17 UTC (rev 9648)
+++ trunk/gforge/common/include/Plugin.class.php	2010-04-29 14:46:28 UTC (rev 9649)
@@ -74,6 +74,18 @@
 		else
 			return 'plugins/'.$this->name ;
 	}
+	/**
+	 * Added for Codendi compatibility
+	 * getPluginPath() - get installation dir for the plugin
+	 *
+	 * @return the directory where the plugin should be linked.
+	 */
+	function getPluginPath () {
+		if (isset($this->installdir) && $this->installdir)
+			return $this->installdir;
+		else
+			return 'plugins/'.$this->name ;
+	}
 
 	/**
 	 * CallHook() - call a particular hook

Added: trunk/gforge/common/mvc/Actions.class.php
===================================================================
--- trunk/gforge/common/mvc/Actions.class.php	                        (rev 0)
+++ trunk/gforge/common/mvc/Actions.class.php	2010-04-29 14:46:28 UTC (rev 9649)
@@ -0,0 +1,54 @@
+<?php
+/* 
+ * Copyright 2005, STMicroelectronics
+ *
+ * Originally written by Manuel Vacelet
+ *
+ * This file is a part of Codendi.
+ *
+ * Codendi is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Codendi is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Codendi. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * Modify model following given actions.
+ *
+ * This is a part of lite Model/View/Controler design pattern.
+ *
+ * @package Codendi-mvc
+ * @copyright STMicroelectronics, 2005
+ * @author    Manuel Vacelet <manuel.vacelet-abecedaire at st.com>
+ * @license   http://opensource.org/licenses/gpl-license.php GPL
+ */
+class Actions {
+    
+    var $_controler;
+    function Actions(&$controler) {
+        $this->_controler =& $controler;
+    }
+    
+    function getControler() {
+        return $this->_controler;
+    }
+    
+  function check() {
+    return true;
+  }
+
+  function process($action, $params = array()) {
+    if($this->check()) {
+      $this->$action($params);
+    }
+  }
+}
+?>
\ No newline at end of file

Added: trunk/gforge/common/mvc/Controler.class.php
===================================================================
--- trunk/gforge/common/mvc/Controler.class.php	                        (rev 0)
+++ trunk/gforge/common/mvc/Controler.class.php	2010-04-29 14:46:28 UTC (rev 9649)
@@ -0,0 +1,66 @@
+<?php
+/* 
+ * Copyright 2005, STMicroelectronics
+ *
+ * Originally written by Manuel Vacelet
+ *
+ * This file is a part of Codendi.
+ *
+ * Codendi is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Codendi is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Codendi. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * Link datas, views and actions.
+ *
+ * This is a part of lite Model/View/Controler design pattern.
+ *
+ * @package Codendi-mvc
+ * @copyright STMicroelectronics, 2005
+ * @author    Manuel Vacelet <manuel.vacelet-abecedaire at st.com>
+ * @license   http://opensource.org/licenses/gpl-license.php GPL
+ */
+class Controler {
+  /* protected */ var $gid;
+  /* protected */ var $view;
+  /* protected */ var $action;
+  /* protected */ var $_viewParams   = array();
+  /* protected */ var $_actionParams = array();
+
+  function request() {
+  }
+
+  function viewsManagement() {
+    $className = get_class($this).'Views';
+    $wv = new $className($this, $this->gid, $this->view, $this->_viewParams);
+    return $wv->display($this->view);
+  }
+
+  function actionsManagement() {
+    $className = get_class($this).'Actions';
+    $wa = new $className($this, $this->gid);
+    $wa->process($this->action, $this->_actionParams);
+  }
+
+  function process() {
+    $this->request();
+
+    if($this->action)
+      $this->actionsManagement();
+    
+    return $this->viewsManagement();
+  }
+
+}
+
+?>
\ No newline at end of file

Added: trunk/gforge/common/mvc/Views.class.php
===================================================================
--- trunk/gforge/common/mvc/Views.class.php	                        (rev 0)
+++ trunk/gforge/common/mvc/Views.class.php	2010-04-29 14:46:28 UTC (rev 9649)
@@ -0,0 +1,66 @@
+<?php
+/* 
+ * Copyright 2005, STMicroelectronics
+ *
+ * Originally written by Manuel Vacelet
+ *
+ * This file is a part of Codendi.
+ *
+ * Codendi is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Codendi is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Codendi. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * Representation of model.
+ *
+ * This is a part of lite Model/View/Controler design pattern.
+ *
+ * @package Codendi-mvc
+ * @copyright STMicroelectronics, 2005
+ * @author    Manuel Vacelet <manuel.vacelet-abecedaire at st.com>
+ * @license   http://opensource.org/licenses/gpl-license.php GPL
+ */
+class Views {
+  /* protected array */  var $html_params; 
+  /* protected string */ var $view; 
+  /* protected Controler */ var $_controler;
+  
+  function View(&$controler, $view = null, $params = array()) {
+      $this->_controler =& $controler;
+      $this->view=$view;
+  }
+  
+    function getControler() {
+        return $this->_controler;
+    }
+    
+
+  function header() {
+    site_project_header($this->html_params);
+  }
+
+  function footer() {
+    site_project_footer($this->html_params);
+  }
+
+  function main() {
+    
+  }  
+
+  function display($view='') {
+    $this->header();
+    if(!empty($view)) $this->$view();
+    $this->footer();
+  }
+}
+?>
\ No newline at end of file

Modified: trunk/gforge/www/include/Layout.class.php
===================================================================
--- trunk/gforge/www/include/Layout.class.php	2010-04-29 14:32:17 UTC (rev 9648)
+++ trunk/gforge/www/include/Layout.class.php	2010-04-29 14:46:28 UTC (rev 9649)
@@ -317,6 +317,7 @@
 		plugin_hook ("javascript",false);
 		echo '
 		</script>';
+		plugin_hook ("javascript_file",false);
 	}
                
         function bodyHeader($params){

Modified: trunk/gforge/www/include/plugins_utils.php
===================================================================
--- trunk/gforge/www/include/plugins_utils.php	2010-04-29 14:32:17 UTC (rev 9648)
+++ trunk/gforge/www/include/plugins_utils.php	2010-04-29 14:46:28 UTC (rev 9649)
@@ -23,19 +23,26 @@
         session_redirect($url);
 }
 function htmlIframe($url,$poub) {
-        echo ('<iframe src= "'.$url.'" width=100% height=500px></iframe>');
+        if (isset($poub['id'])) {
+                $id=$poub['id'];
+        }
+        else {
+                $id='';
+        }
+        echo ('<iframe src= "'.$url.'" id="'.$id.'" width=100% height=500px></iframe>');
 }
+    
+function helpButton($help) {
 
-
-function helpButton($help) {
-        
 }
 function getIcon($url,$w=16,$h=16,$args=array()) {
-        echo html_image($url,$w,$h,$args);
-}
+        echo html_image($url,$w,$h,$args); 
+}   
 function getImage($img) {
         echo util_make_url($html->imgroot.$img);
 
 }
+function get_server_url() {
+        return util_make_url();
+}
 ?>
-




More information about the Fusionforge-commits mailing list