ここの情報は古いです。ご理解頂いた上でお取り扱いください。

source: OpenPNE3/trunk/apps/pc_backend/modules/design/templates/homeWidgetPlotSuccess.php @ 9582

Last change on this file since 9582 was 9582, checked in by ebihara, 12 years ago

#3194:added ability to set widets to home

File size: 3.7 KB
Line 
1<?php use_helper('Javascript') ?>
2
3<?php echo javascript_tag("
4function showModalOnParent(url)
5{
6  var modal = parent.document.getElementById('modal');
7  var modalContents = parent.document.getElementById('modal_contents');
8  var modalIframe = modalContents.getElementsByTagName('iframe')[0];
9  modalIframe.src = url;
10  new Effect.Appear(modal, {from:0, to:0.7});
11  new Effect.Appear(modalContents, {from:0, to:1.0});
12}
13
14function insertHiddenTags(type, ids)
15{
16  var form = parent.document.getElementById('widgetForm');
17  var hiddens = form.getElementsByClassName(type + 'Widget');
18
19  while (hiddens.length)
20  {
21    Element.remove(hiddens[0]);
22  }
23
24  for (var i = 0; i < ids.length; i++)
25  {
26    if (!ids[i])
27    {
28      continue;
29    }
30
31    var obj = document.createElement('input');
32    obj.setAttribute('class', type + 'Widget');
33    obj.setAttribute('type', 'hidden');
34    obj.setAttribute('name', 'widget[' + type + '][' + i + ']');
35    obj.setAttribute('value', ids[i]);
36    new Insertion.Bottom(form, obj);
37  }
38}
39
40function dropNewWidget(type, name, obj)
41{
42  var form = parent.document.getElementById('widgetForm');
43  var hiddens = form.getElementsByClassName(type + 'New');
44  for (var i = 0; i < hiddens.length; i++)
45  {
46    if (hiddens[i].value == name)
47    {
48      Element.remove(hiddens[i]);
49      break;
50    }
51  }
52  Element.remove(obj);
53}
54
55");
56?>
57
58<div id="plotBody" class="<?php echo $layoutPattern ?>">
59<div id="container">
60
61<?php if ($layoutPattern === 'layoutA') : ?>
62<div id="plotTop">
63<?php foreach ($topWidgets as $widget) : ?>
64<div class="widget" id="plotTop_widget_<?php echo $widget->getId() ?>">
65<?php
66echo link_to_function($widgetConfig[$widget->getName()]['caption']['ja_JP'], 'showModalOnParent(\''.url_for('design/homeEditWidget?id='.$widget->getId()).'\')');
67?>
68</div>
69<?php endforeach; ?>
70<div class="emptyWidget">
71<?php echo link_to_function(__('ウィジェットを追加'), 'showModalOnParent(\''.url_for('design/homeAddWidget?type=top').'\')') ?>
72</div>
73</div>
74<?php echo sortable_element('plotTop', array(
75  'only' => 'widget',
76  'tag'  => 'div',
77  'onUpdate' => 'function(s){insertHiddenTags(\'top\', Sortable.sequence(s, s.id))}',
78)) ?>
79<?php endif; ?>
80
81<?php if ($layoutPattern === 'layoutA' || $layoutPattern === 'layoutB') : ?>
82<div id="plotSideMenu">
83<?php foreach ($sideMenuWidgets as $widget) : ?>
84<div class="widget" id="plotSideMenu_widget_<?php echo $widget->getId() ?>">
85<?php
86echo link_to_function($widgetConfig[$widget->getName()]['caption']['ja_JP'], 'showModalOnParent(\''.url_for('design/homeEditWidget?id='.$widget->getId()).'\')');
87?>
88</div>
89<?php endforeach; ?>
90<div class="emptyWidget">
91<?php echo link_to_function(__('ウィジェットを追加'), 'showModalOnParent(\''.url_for('design/homeAddWidget?type=sideMenu').'\')') ?>
92</div>
93</div>
94<?php echo sortable_element('plotSideMenu', array(
95  'only' => 'widget',
96  'tag'  => 'div',
97  'onUpdate' => 'function(s){insertHiddenTags(\'sideMenu\', Sortable.sequence(s, s.id))}',
98)) ?>
99<?php endif; ?>
100
101<div id="plotContents">
102<?php foreach ($contentsWidgets as $widget) : ?>
103<div class="widget" id="plotContents_widget_<?php echo $widget->getId() ?>">
104<?php
105echo link_to_function($widgetConfig[$widget->getName()]['caption']['ja_JP'], 'showModalOnParent(\''.url_for('design/homeEditWidget?id='.$widget->getId()).'\')');
106?>
107</div>
108<?php endforeach; ?>
109<div class="emptyWidget">
110<?php echo link_to_function(__('ウィジェットを追加'), 'showModalOnParent(\''.url_for('design/homeAddWidget?type=contents').'\')') ?>
111</div>
112</div>
113<?php echo sortable_element('plotContents', array(
114  'only' => 'widget',
115  'tag'  => 'div',
116  'onUpdate' => 'function(s){insertHiddenTags(\'contents\', Sortable.sequence(s, s.id))}',
117)) ?>
118
119</div>
120</div>
Note: See TracBrowser for help on using the repository browser.