= 2) {
$items .= "
";
}
if ($status >= 1) {
$items .= "
";
}
$status = 1;
$items .= "
". $_REQUEST['main'][$i]. "
". $_REQUEST['addr'][$i]. "";
}
if ($_REQUEST['sub'][$i]) {
if ($status >= 2) {
$items .= "
";
}
$status = 2;
$items .= "
". $_REQUEST['sub'][$i]. "
". $_REQUEST['addr'][$i]. "";
}
if ($_REQUEST['child'][$i]) {
$status = 3;
$items .= "
". $_REQUEST['child'][$i]. "
". $_REQUEST['addr'][$i]. "
";
}
}
}
if ($status >= 2) {
$items .= "
";
}
if ($status >= 1) {
$items .= "
";
}
!$xml->ID && $xml->ID = createid();
!$xml->width && $xml->width = 180;
!$xml->height && $xml->height = 28;
!$xml->margin && $xml->margin = 2;
!$xml->fontSize && $xml->fontSize = 13;
!$xml->borderSize && $xml->borderSize = 1;
$xml->bgColor && $bgColor = "#$xml->bgColor";
$xml->color && $color = "#$xml->color";
$xml->borderColor && $borderColor = "#$xml->borderColor";
$xml->hoverColor && $hoverColor = "#$xml->hoverColor";
$xml = "
". $_REQUEST['ID']. "
". $_REQUEST['Title']. "
". $_REQUEST['type']. "
". $_REQUEST['width']. "
". $_REQUEST['height']. "
". $_REQUEST['margin']. "
". $_REQUEST['fontSize']. "
". $_REQUEST['color']. "
". $_REQUEST['bgColor']. "
". $_REQUEST['hoverColor']. "
". $_REQUEST['borderSize']. "
". $_REQUEST['borderColor']. "
". $_REQUEST['borderType']. "
". $_REQUEST['mainIcon']. "
". $_REQUEST['subIcon']. "
". $_REQUEST['childIcon']. "
$items
";
file_put_contents($System[datadir]. "/menu/". $_REQUEST['ID']. ".xml", $xml);
logregist("サイドメニュー(". $_REQUEST['Title']. ")の編集");
}
if ($_REQUEST[action] != 'regist') {
header("Content-type:text/html; charset=utf-8");
$script = "/jquery/sidemenu/js/webwidget_vertical_menu.js";
$css = "/jquery/sidemenu/css/webwidget_vertical_menu.css";
$js = "";
if ($_REQUEST[type] == 'tree') {
$script = "/jquery/treeview/jquery.treeview.js";
$css = "/jquery/treeview/treeview.css";
$js = "";
$js2 = "<script type=\"text/javascript\" src=\"/jquery/treeview/lib/jquery.cookie.js\"></script>";
}
echo <<<_
preview
$js
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ページのタイトル</title>
<link type="text/css" href="$css" rel="stylesheet" />
<script type="text/javascript" src="/jquery/js/jquery-1.6.4.min.js"></script>
<script type="text/javascript" src="$script"></script>
<script type="text/javascript" src="/trycms/system.js"></script>
$js2
</head>
<body>
_;
if ($_REQUEST[type] == 'tree') {
echo <<<_
<div id="sidemenu">ここにメニューが挿入される</div>
<!--
Ajaxでの挿入は、Ajaxでオブジェクト挿入後にデザインを初期化するための
javascriptをページの最後に追加する必要が有ります。
-->
<script type="text/javascript">
getAjaxText('/trycms/jquery.php?cmd=$_REQUEST[type]&ID=$_REQUEST[ID]&ajax=1', 'sidemenu', menu_initialize);
function menu_initialize() {
$(document).ready(function(){
$("#$_REQUEST[ID]").treeview({
animated: "fast",
collapsed: true,
persist: "cookie",
cookieId: "treeview-black"
});
});
}
</script>
</body>
</html>
";
exit;
}
}
if ($_REQUEST[action] == "form") {
$width = '925px;';
if ($_REQUEST[ID] && is_file("$System[datadir]/menu/$_REQUEST[ID].xml")) {
$xml = simplexml_load_file("$System[datadir]/menu/$_REQUEST[ID].xml");
$title = $xml->Title;
$mainCnt = count($xml->Items->main);
$i = 0;
foreach ($xml->Items->main as $mainobj) {
$main = ''; $sub = ''; $child = '';
$main = $xml->Items->main[$i]->title;
$action = $xml->Items->main[$i]->action;
if (isset($xml->Items->main[$i]->sub)) {
$j = 0;
foreach ($xml->Items->main[$i]->sub as $subobj) {
$sub = $xml->Items->main[$i]->sub[$j]->title;
$action = $xml->Items->main[$i]->sub[$j]->action;
if (isset($xml->Items->main[$i]->sub[$j]->child)) {
$k = 0;
foreach ($xml->Items->main[$i]->sub[$j]->child as $childobj) {
$child = $xml->Items->main[$i]->sub[$j]->child[$k]->title;
$action = $xml->Items->main[$i]->sub[$j]->child[$k]->action;
$data[] = join("\t", array($main, $sub, $child, $action));
$main = ''; $sub = ''; $child = '';
$k++;
}
} else {
$data[] = join("\t", array($main, $sub, $child, $action));
$main = ''; $sub = ''; $child = '';
}
$j++;
}
} else {
$data[] = join("\t", array($main, $sub, $child, $action));
}
$i++;
}
}
!$_REQUEST[ID] && $_REQUEST[ID] = createid();
!$xml->width && $xml->width = 180;
!$xml->height && $xml->height = 28;
!$xml->margin && $xml->margin = 2;
!$xml->fontSize && $xml->fontSize = 13;
!$xml->borderSize && $xml->borderSize = 1;
$xml->bgColor && $bgColor = "#$xml->bgColor";
$xml->color && $color = "#$xml->color";
$xml->borderColor && $borderColor = "#$xml->borderColor";
$xml->hoverColor && $hoverColor = "#$xml->hoverColor";
!$xml->borderType && $xml->borderType = "outset";
if ($xml->Type == 'tree') {
$Type[1] = "checked";
} else {
$Type[0] = "checked";
}
$i = 0;
foreach ($Borders as $line) {
$check = "";
$xml->borderType == $line && $check = "checked";
$bordertype .= "
$line";
$i++;
}
$doc .=<<<_
_;
} else {
$width = '100%';
$doc .=<<<_
| No. |
タイプ |
タイトル |
挿入タグ |
更新日 |
_;
if ($dh = opendir("$System[datadir]/menu")) {
while (($file = readdir($dh)) !== false) {
if (preg_match("/\.xml$/", $file) && $file != "apymenu.xml") {
$Files[] = $file;
}
}
closedir($dh);
}
if (is_array($Files)) {
$i = 1;
foreach ($Files as $file) {
$xml = simplexml_load_file("$System[datadir]/menu/$file");
$date = jst_time(filemtime("$System[datadir]/menu/$file"), 5);
$title = $xml->Title;
$id = $xml->ID;
$doc .=<<<_
| $i |
$xml->Type |
$title |
<!--#include virtual="/trycms/jquery.php?cmd=$xml->Type&ID=$xml->ID"--> |
$date |
_;
$i++;
}
}
$doc .=<<<_
_;
}
$html .=<<<_
_;
$client = new window;
$client->name = 'client';
$client->width = $width;
$client->display = 'block';
$client->caption = "サイドメニュー";
$client->drag = false;
$client->resize = false;
$client->closebutton = true;
$client->closeFunc = '';
$client->smallbutton = true;
$client->height = '';
$client->border = false;
$client->bgcolor = '';
$client->statusbar = false;
$client->bgcolor = '';
$client->date = false;
$client->time = false;
$client->copy = false;
$client->body = $doc;
$html .= $client->show();
$javascript =<<<_
var previewwin;
var selectLine;
var imageField;
if (parent.mailform) {
$('#mailformbutton').css('display', 'block');
}
$('.selectColor').ColorPicker({
onSubmit: function(hsb, hex, rgb, el) {
$(el).val(hex);
$(el).css('backgroundColor', '#' + hex);
$(el).ColorPickerHide();
},
onBeforeShow: function () {
$(this).ColorPickerSetColor(this.value);
}})
.bind('keyup', function(){
$(this).ColorPickerSetColor(this.value);
});
$(function() {
$("#sortable").sortable();
/*$("#sortable").disableSelection();*/
});
function show_help() {
if ($('#help').css('display') == 'none') {
$('#help').css('display', 'block');
$('#help2').css('display', 'block');
document.getElementById('helpimg').src='images/help_open.png';
} else {
$('#help').css('display', 'none');
$('#help2').css('display', 'none');
document.getElementById('helpimg').src='images/help_close.png';
}
}
function gosubmit() {
with(document.clientform) {
target='';
action.value='regist';
submit();
}
}
function preview() {
document.getElementById('confirmdialog').innerHTML=
'\
 | \
\
最新のプレビューを表示すると自動的に現在の設定が保存されます。\
何も編集されていない場合は、[保存しない]を選択してください。\
保存すると編集履歴にも保存されます。 \
\
プレビューを表示しますか?\
| \
\
';
$(function() {
$('#confirmdialog').dialog({
title: '確認',
resizable: false,
width:400,
height:200,
modal: true,
buttons: {
保存する: function() {
$(this).dialog('close');
previewwin = window.open('', 'previewwin');
document.clientform.target='previewwin';
document.clientform.action.value='saveview';
$('#deleteButton').css('display', 'block');
document.clientform.submit();
previewwin.focus();
},
保存しない: function() {
$(this).dialog('close');
previewwin = window.open('', 'previewwin');
document.clientform.target='previewwin';
document.clientform.action.value='preview';
$('#deleteButton').css('display', 'block');
document.clientform.submit();
previewwin.focus();
},
キャンセル: function() {
$(this).dialog('close');
}
}
});
});
}
function selectContents(type,title) {
$('#popup').dialog('close');
getAjaxText('ajax.php?cmd='+type, 'ajaxdialog');
$(function() {
$('#ajaxdialog').dialog({
title: title,
resizable: false,
width:800,
modal: true,
show: 'blind',
hide: 'blind',
buttons: {
閉じる: function() {
$(this).dialog('close');
}
}
});
});
}
function clearColor(id) {
var obj = document.getElementById(id);
obj.value='';
obj.style.background=null;
}
function setfilename(path) {
$('#addr'+selectLine).val(path);
}
function setimgfilename(path) {
$('#'+imageField).val(path);
}
function windowGoResize() {
var h = $(window).height();
document.getElementById('scroolBody').style.height=h-60+'px';
}
windowGoResize();
window.onresize=windowGoResize;
_;
?>