[Fusionforge-commits] r15816 - trunk/src/www/widgets

Franck VILLAUME nerville at fusionforge.org
Sun Jun 24 15:07:08 CEST 2012


Author: nerville
Date: 2012-06-24 15:07:07 +0200 (Sun, 24 Jun 2012)
New Revision: 15816

Modified:
   trunk/src/www/widgets/widget.php
Log:
indent

Modified: trunk/src/www/widgets/widget.php
===================================================================
--- trunk/src/www/widgets/widget.php	2012-06-22 14:29:03 UTC (rev 15815)
+++ trunk/src/www/widgets/widget.php	2012-06-24 13:07:07 UTC (rev 15816)
@@ -1,5 +1,5 @@
 <?php
-/*
+/**
  * http://fusionforge.org
  *
  * This file is part of FusionForge. FusionForge is free software;
@@ -34,83 +34,83 @@
 $vOwner = new Valid_Widget_Owner('owner');
 $vOwner->required();
 if ($request->valid($vOwner)) {
-    $owner = $request->get('owner');
-    $owner_id   = (int)substr($owner, 1);
-    $owner_type = substr($owner, 0, 1);
-    switch($owner_type) {
-        case WidgetLayoutManager::OWNER_TYPE_USER:
-            $owner_id = user_getid();
-            $redirect = '/my/';
-            $good = true;
-            break;
-        case WidgetLayoutManager::OWNER_TYPE_GROUP:
-            $pm = ProjectManager::instance();
-            if ($project = $pm->getProject($owner_id)) {
-                $group_id = $owner_id;
-                $_REQUEST['group_id'] = $_GET['group_id'] = $group_id;
-                $request->params['group_id'] = $group_id; //bad!
-                $redirect = '/projects/'. $project->getUnixName();
-                $good = true;
-            }
-            break;
-        default:
-            break;
-    }
-    if ($good) {
-        if ($request->exist('name')) {
-            $param = $request->get('name');
-            $v = array_keys($param);
-            $name = array_pop($v);
-            $instance_id = (int)$param[$name];
-            if ($widget =& Widget::getInstance($name)) {
-                if ($widget->isAvailable()) {
-                    switch ($request->get('action')) {
-                        case 'rss':
-                            $widget->displayRss();
-                            exit();
-                            break;
-                        case 'update':
-                            if ($layout_id = (int)$request->get('layout_id')) {
-                                if ($owner_type == WidgetLayoutManager::OWNER_TYPE_USER ||
-				    forge_check_perm('project_admin', $group_id) ||
-				    forge_check_global_perm('forge_admin')) {
-                                    if ($request->get('cancel') || $widget->updatePreferences($request)) {
-                                        $lm->hideWidgetPreferences($owner_id, $owner_type, $layout_id, $name, $instance_id);
-                                    }
-                                }
-                            }
-                            break;
-                        case 'ajax':
-                            if ($widget->isAjax()) {
+	$owner = $request->get('owner');
+	$owner_id   = (int)substr($owner, 1);
+	$owner_type = substr($owner, 0, 1);
+	switch($owner_type) {
+		case WidgetLayoutManager::OWNER_TYPE_USER:
+		$owner_id = user_getid();
+		$redirect = '/my/';
+		$good = true;
+		break;
+		case WidgetLayoutManager::OWNER_TYPE_GROUP:
+		$pm = ProjectManager::instance();
+		if ($project = $pm->getProject($owner_id)) {
+			$group_id = $owner_id;
+			$_REQUEST['group_id'] = $_GET['group_id'] = $group_id;
+			$request->params['group_id'] = $group_id; //bad!
+			$redirect = '/projects/'. $project->getUnixName();
+			$good = true;
+		}
+		break;
+		default:
+		break;
+	}
+	if ($good) {
+		if ($request->exist('name')) {
+			$param = $request->get('name');
+			$v = array_keys($param);
+			$name = array_pop($v);
+			$instance_id = (int)$param[$name];
+			if ($widget =& Widget::getInstance($name)) {
+				if ($widget->isAvailable()) {
+					switch ($request->get('action')) {
+						case 'rss':
+							$widget->displayRss();
+							exit();
+							break;
+						case 'update':
+							if ($layout_id = (int)$request->get('layout_id')) {
+								if ($owner_type == WidgetLayoutManager::OWNER_TYPE_USER ||
+									forge_check_perm('project_admin', $group_id) ||
+									forge_check_global_perm('forge_admin')) {
+									if ($request->get('cancel') || $widget->updatePreferences($request)) {
+										$lm->hideWidgetPreferences($owner_id, $owner_type, $layout_id, $name, $instance_id);
+									}
+								}
+							}
+							break;
+						case 'ajax':
+							if ($widget->isAjax()) {
 								header("Cache-Control: no-store, no-cache, must-revalidate");
 								sysdebug_ajaxbody();
-                                $widget->loadContent($instance_id);
-                                echo $widget->getContent();
-                                exit();
-                            }
-                            break;
-                        case 'iframe':
-                            echo '<html><head>';
-                            $GLOBALS['HTML']->displayStylesheetElements();
-                            echo '</head><body class="main_body_row contenttable">';
-                            $widget->loadContent($instance_id);
-                            echo $widget->getContent();
-                            echo '</body></html>';
-                            exit;
-                            break;
-                        case 'process':
-                            $widget->loadContent($instance_id);
-                            $widget->process($owner_type, $owner_id);
-                            exit;
-                        default:
-                            break;
-                    }
-                }
-            }
-        }
-    }
+								$widget->loadContent($instance_id);
+								echo $widget->getContent();
+								exit();
+							}
+							break;
+						case 'iframe':
+							echo '<html><head>';
+							$GLOBALS['HTML']->displayStylesheetElements();
+							echo '</head><body class="main_body_row contenttable">';
+							$widget->loadContent($instance_id);
+							echo $widget->getContent();
+							echo '</body></html>';
+							exit;
+							break;
+						case 'process':
+							$widget->loadContent($instance_id);
+							$widget->process($owner_type, $owner_id);
+							exit;
+						default:
+							break;
+					}
+				}
+			}
+		}
+	}
 }
 if (!$request->isAjax()) {
-    htmlRedirect($redirect);
+	htmlRedirect($redirect);
 }
 ?>




More information about the Fusionforge-commits mailing list