<?php if (!defined('APP_PATH')) exit;?><!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 href="http://127.0.0.5/magic/Data/Public/codemirror/codemirror.css" rel="stylesheet" type="text/css" />
<link href="http://127.0.0.5/magic/Data/Public/codemirror/theme/eclipse.css" rel="stylesheet" type="text/css" />
<link href="http://127.0.0.5/magic/Data/Public/codemirror/theme/mbo.css" rel="stylesheet" type="text/css" />
<link href="http://127.0.0.5/magic/Data/Public/codemirror/theme/twilight.css" rel="stylesheet" type="text/css" />
<link href="http://127.0.0.5/magic/Data/Public/codemirror/theme/monokai.css" rel="stylesheet" type="text/css" />
<link href="http://127.0.0.5/magic/Data/Public/codemirror/addon/dialog.css" rel="stylesheet" type="text/css" />
<link href="http://127.0.0.5/magic/Data/Public/codemirror/theme/matchesonscrollbar.css" rel="stylesheet" type="text/css" />
<script src="http://127.0.0.5/magic/Data/Public/codemirror/codemirror.js"></script>
<script src="http://127.0.0.5/magic/Data/Public/codemirror/addon/active-line.js"></script>
<script src="http://127.0.0.5/magic/Data/Public/codemirror/addon/search.js"></script>
<script src="http://127.0.0.5/magic/Data/Public/codemirror/addon/dialog.js"></script>
<script src="http://127.0.0.5/magic/Data/Public/codemirror/addon/sublime.js"></script>
<script src="http://127.0.0.5/magic/Data/Public/codemirror/mode/javascript.js"></script>
<script src="http://127.0.0.5/magic/Data/Public/codemirror/mode/css.js"></script>
<script src="http://127.0.0.5/magic/Data/Public/codemirror/mode/php.js"></script>
</head>
<style type="text/css">
*,html,body{padding:0;margin:0;font-size:13px}
li{list-style:none;}
.place{height:40px;width:100%;background:url(http://127.0.0.5/magic/Data/Public/images/righttop.gif) repeat-x;}
.place span{line-height:40px; font-weight:bold;float:left; margin-left:12px;}
.placeul li{float:left; line-height:40px; padding-left:7px; padding-right:12px; background:url(http://127.0.0.5/magic/Data/Public/images/rlist.gif) no-repeat right;}
.placeul li a{color:#000;text-decoration: none}
.placeul li:last-child{background:none;}
.theme{margin:10px 10px;float:right;}
.scbtn1{border:none;width:65px;height:25px;font-size:14px;font-weight:bold;color:#fff; cursor:pointer;border-radius:3px; behavior:url(http://127.0.0.5/magic/Data/Public/js/pie.htc);background:url(http://127.0.0.5/magic/Data/Public/images/btnbg1.png) repeat-x center;}
</style>
<body>
<iframe id="blank" name="blank"  style="display:none" src="blank.html"></iframe>
<form method="post" target="blank" action="?r=files-index-save">
<input type="hidden" name="path" value="<?php echo $fullpath;?>">
<div class="place">
	<span>位置：</span>
	<ul class="placeul">
		<li><a href="/">首页</a></li>
		<li><a href="#">系统设置</a></li>
		<li><a href="#">文件管理</a></li>
	</ul>
	<div class="theme">
		<input type="submit" class="scbtn1" value="保存">&nbsp;&nbsp;
		<input type="button" onclick="window.location.href='?r=files'" class="scbtn1" value="返回">&nbsp;&nbsp;
		切换主题：
		<select onchange="selectTheme()" id="select">
			<option selected>eclipse</option>
			<option>monokai</option>
			<option>ambiance</option>
			<option>mbo</option>
		</select>
	</div>
</div>
<div class="formbody">
<textarea id="code" name="content"><?php echo $file['content'];?></textarea>
<script>
	var value = "// The bindings defined specifically in the Sublime Text mode\nvar bindings = {\n";
	var map = CodeMirror.keyMap.sublime;
	 for (var key in map) {
		var val = map[key];
		if (key != "fallthrough" && val != "..." && (!/find/.test(val) || /findUnder/.test(val)))
		  value += "  \"" + key + "\": \"" + val + "\",\n";
	  }
  value += "}\n\n// The implementation of joinLines\n";
  value += CodeMirror.commands.joinLines.toString().replace(/^function\s*\(/, "function joinLines(").replace(/\n  /g, "\n") + "\n";
  var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
	value: value,
    lineNumbers: true,
    keyMap: "sublime",
    autoCloseBrackets: true,
    showCursorWhenSelecting: true,
    styleActiveLine: true,
    matchBrackets: true,
    indentUnit: 4,
    indentWithTabs: true
  });
  var input = document.getElementById("select");
  function selectTheme() {
    var theme = input.options[input.selectedIndex].textContent;
    editor.setOption("theme", theme);
    location.hash = "#" + theme;
  }
  var choice = document.getElementById("select").options[0].text;
  if (choice) {
    input.value = choice;
    editor.setOption("theme", choice);
  }
  CodeMirror.on(window, "hashchange", function() {
    var theme = location.hash.slice(1);
    if (theme) { input.value = theme; selectTheme(); }
  });
</script>		
</div>
</form>
</body>
</html>
