3 * Copyright (c) Xerox Corporation, Codendi Team, 2001-2009. All rights reserved
4 * Copyright 2013, Franck Villaume - TrivialDev
6 * This file is a part of Fusionforge.
8 * Fusionforge is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * Fusionforge is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with Fusionforge. If not, see <http://www.gnu.org/licenses/>.
22 require_once 'WidgetLayout_Row.class.php';
23 require_once 'WidgetLayout_Row_Column.class.php';
35 function WidgetLayout($id, $name, $description, $scope) {
38 $this->description = $description;
39 $this->scope = $scope;
40 $this->rows = array();
48 function display($readonly, $owner_id, $owner_type) {
49 foreach($this->rows as $key => $nop) {
50 $this->rows[$key]->display($readonly, $owner_id, $owner_type);
53 $cells = "['". implode("', '", $this->getColumnIds()) ."']";
55 <script type='text/javascript'>/* <![CDATA[ */
57 jQuery.each(cells, function(key, value) {
58 jQuery('#'+value).sortable({
60 connectWith: '.ui-sortable',
61 forcePlaceholderSize: true,
62 forceHelperSize: true,
63 placeholder: 'ui-state-highlight',
64 handle: '.widget_titlebar_handle',
65 update: function (event, ui) {
66 var urlparams = '/widgets/updatelayout.php?owner=$owner_type'+$owner_id+'&layout_id='+$this->id;
67 jQuery('#'+value).children('div').each(function(){
68 urlparams += '&'+value+'[]='+jQuery(this).attr('id').replace('widget_','');
70 jQuery.post(urlparams);
79 function getColumnIds() {
81 foreach($this->rows as $key => $nop) {
82 $ret = array_merge($ret, $this->rows[$key]->getColumnIds());