Commit 4f072e7d authored by Alain Takoudjou's avatar Alain Takoudjou

Add a new editor page with two column

parent 74a3abcf
...@@ -192,7 +192,7 @@ overflow-y: scroll; ...@@ -192,7 +192,7 @@ overflow-y: scroll;
.main_content{ .main_content{
position:relative; position:relative;
width: 100%; width: 99.6%;
height: 430px; height: 430px;
margin-top:10px; margin-top:10px;
border:1px solid #4c6172; border:1px solid #4c6172;
...@@ -435,25 +435,27 @@ padding: 10px;height: 80px;padding-bottom:15px;} ...@@ -435,25 +435,27 @@ padding: 10px;height: 80px;padding-bottom:15px;}
} }
.file_tree_short{ .file_tree_short{
width: 525px; width: 228px;
height: 170px; height: 379px;
border: solid 1px #678dad; border: solid 1px #678dad;
background: #fff; background: #fff;
overflow: auto; overflow: auto;
padding: 5px; padding: 5px;
float:left;
} }
.box_software{ .box_software{
width: 362px; width: 240px;
height: 100px;
background: #fff; background: #fff;
padding: 5px;
float:right;
} }
.software_details{float: left;}
#details_box{ #details_box{
display:none; display:block;
margin-top:10px;
} }
#code{
float: right;
width: 692px;
}
#details_head{margin-bottom: 10px;}
#contentInfo{ #contentInfo{
width: 926px; width: 926px;
...@@ -492,10 +494,6 @@ h2.hight:hover{ ...@@ -492,10 +494,6 @@ h2.hight:hover{
cursor: pointer; cursor: pointer;
} }
.software_details{
padding: 10px;
}
.log_content{ .log_content{
border: solid 1px #4c6172; border: solid 1px #4c6172;
padding: 2px; padding: 2px;
...@@ -675,7 +673,7 @@ div.sep{display:block; height:7px;} ...@@ -675,7 +673,7 @@ div.sep{display:block; height:7px;}
#pClose, .close{background:url(../images/close.png) no-repeat 0px 0px; display:block; width:22px; height:22px; cursor:pointer} #pClose, .close{background:url(../images/close.png) no-repeat 0px 0px; display:block; width:22px; height:22px; cursor:pointer}
#pClose:hover, .close:hover{background:url(../images/close_hover.png) no-repeat 0px 0px;} #pClose:hover, .close:hover{background:url(../images/close_hover.png) no-repeat 0px 0px;}
.md5sum {margin:10px; font-size:15px;} .md5sum {margin:10px; font-size:15px;}
.title{background: #e4e4e4; width: 100%; height: 25px; padding-top:2px; text-indent: 5px; color: #737373; text-shadow: 0px 1px #FFF;} .title{background: #e4e4e4; width: 100%; height: 26px; padding-top:2px; text-indent: 5px; color: #737373; text-shadow: 0px 1px #FFF;}
.menu-box-left{float:left; width: 135px; font-size:14px; background: #e4e4e4; padding:5px 0 5px 5px; margin-top:10px; .menu-box-left{float:left; width: 135px; font-size:14px; background: #e4e4e4; padding:5px 0 5px 5px; margin-top:10px;
font-size:14px; border-radius: 4px 0 0 4px;} font-size:14px; border-radius: 4px 0 0 4px;}
.menu-box-right{background: #e4e4e4; padding: 5px; float:right; width: 745px; margin-left: -5px; .menu-box-right{background: #e4e4e4; padding: 5px; float:right; width: 745px; margin-left: -5px;
......
...@@ -17,8 +17,13 @@ $(document).ready(function () { ...@@ -17,8 +17,13 @@ $(document).ready(function () {
workdir = $("input#workdir").val(), workdir = $("input#workdir").val(),
currentProject = workdir + "/" + projectDir.replace(workdir, "").split('/')[1], currentProject = workdir + "/" + projectDir.replace(workdir, "").split('/')[1],
send = false, send = false,
edit = false; edit = false,
selection = "",
edit_status = "";
var base_path = function() {
return softwareDisplay ? projectDir : currentProject;
}
function setEditMode(file) { function setEditMode(file) {
var i, var i,
...@@ -32,12 +37,11 @@ $(document).ready(function () { ...@@ -32,12 +37,11 @@ $(document).ready(function () {
} }
} }
function selectFile(file) { function openFile(file) {
$("#info").empty(); if (send) {
$("#info").append(file); return;
$("input#subfolder").val(file); }
$("#md5sum").empty(); send = true;
send = false;
edit = false; edit = false;
if (file.substr(-1) !== "/") { if (file.substr(-1) !== "/") {
$.ajax({ $.ajax({
...@@ -49,16 +53,19 @@ $(document).ready(function () { ...@@ -49,16 +53,19 @@ $(document).ready(function () {
if (data.code === 1) { if (data.code === 1) {
$("#edit_info").empty(); $("#edit_info").empty();
name = file.split('/'); name = file.split('/');
if (file.length > 65) { if (file.length > 60) {
//substring title. //substring title.
start = file.length - 65; start = file.length - 60;
file = "..." + file.substring(file.indexOf("/", (start + 1))); file = "..." + file.substring(file.indexOf("/", (start + 1)));
} }
$("#edit_info").append("Current file: " + file); $("#edit_info").append(" " + file);
$("a#option").show(); $("a#option").show();
editor.getSession().setValue(data.result); editor.getSession().setValue(data.result);
setEditMode(name[name.length - 1]); setEditMode(name[name.length - 1]);
edit = true; edit = true;
$("input#subfolder").val(file);
$("span#edit_status").html("");
edit_status = "";
} else { } else {
$("#error").Popup(data.result, {type: 'error', duration: 5000}); $("#error").Popup(data.result, {type: 'error', duration: 5000});
} }
...@@ -67,47 +74,52 @@ $(document).ready(function () { ...@@ -67,47 +74,52 @@ $(document).ready(function () {
}); });
} else { } else {
$("#edit_info").empty(); $("#edit_info").empty();
$("#edit_info").append("No file selected"); $("#edit_info").append("No file in editor");
$("a#option").hide(); $("a#option").hide();
editor.getSession().setValue(""); editor.getSession().setValue("");
} }
return; return;
} }
function selectFile(file) {
$("#info").empty();
$("#info").append("Selection: " + file);
selection = file;
return;
}
/*
function setDetailBox() { function setDetailBox() {
var state = $("#details_box").css("display"); var state = $("#details_box").css("display");
if (state === "none") { if (state === "none") {
$("#details_box").slideDown("normal"); $("#details_box").fadeIn("normal");
$("#details_head").removeClass("hide"); $("#details_head").removeClass("hide");
$("#details_head").addClass("show"); $("#details_head").addClass("show");
} else { } else {
$("#details_box").slideUp("normal"); $("#details_box").fadeOut("normal");
$("#details_head").removeClass("show"); $("#details_head").removeClass("show");
$("#details_head").addClass("hide"); $("#details_head").addClass("hide");
} }
} } */
function switchContent() { function switchContent() {
var root = projectDir; var root = projectDir;
if (!softwareDisplay) { if (!softwareDisplay) {
$("#switch").empty(); $("#switch").empty();
$("#switch").append("Switch to Software files"); $("#switch").append("Switch to Profile ");
root = currentProject; root = currentProject;
} else { } else {
$("#switch").empty(); $("#switch").empty();
$("#switch").append("Switch to Project files"); $("#switch").append("Switch to Project");
} }
$('#fileTree').fileTree({ root: root, script: $SCRIPT_ROOT + script, folderEvent: 'click', expandSpeed: 750, collapseSpeed: 750, multiFolder: false, selectFolder: true }, function (file) { $('#fileTree').fileTree({ root: root, script: $SCRIPT_ROOT + script, folderEvent: 'click', expandSpeed: 750, collapseSpeed: 750, multiFolder: false, selectFolder: true }, function (file) {
selectFile(file); selectFile(file);
}); }, function (file) { openFile(file); });
$("#info").empty(); $("#info").empty();
$("#info").append("Select directory or nothing for root directory..."); $("#info").append("Selection: " + base_path());
$("input#subfolder").val(""); selection = "";
} }
function getmd5sum() { function getmd5sum() {
var file = $("input#subfolder").val();
if (send) { if (send) {
return; return;
} }
...@@ -118,8 +130,8 @@ $(document).ready(function () { ...@@ -118,8 +130,8 @@ $(document).ready(function () {
data: {file: $("input#subfolder").val()}, data: {file: $("input#subfolder").val()},
success: function (data) { success: function (data) {
if (data.code === 1) { if (data.code === 1) {
$("#md5sum").empty(); $("#info").empty();
$("#md5sum").append('md5sum : <span>' + data.result + '</span>'); $("#info").html("Md5sum Current file: " + data.result);
} else { } else {
$("#error").Popup(data.result, {type: 'error', duration: 5000}); $("#error").Popup(data.result, {type: 'error', duration: 5000});
} }
...@@ -186,19 +198,27 @@ $(document).ready(function () { ...@@ -186,19 +198,27 @@ $(document).ready(function () {
]; ];
$('#fileTree').fileTree({ root: projectDir, script: $SCRIPT_ROOT + script, folderEvent: 'click', expandSpeed: 750, collapseSpeed: 750, multiFolder: false, selectFolder: true }, function (file) { $('#fileTree').fileTree({ root: projectDir, script: $SCRIPT_ROOT + script, folderEvent: 'click', expandSpeed: 750, collapseSpeed: 750, multiFolder: false, selectFolder: true }, function (file) {
selectFile(file); selectFile(file);
}, function (file) { openFile(file); });
$("#info").append("Selection: " + base_path());
/*setDetailBox();*/
editor.on("change", function (e) {
if (edit_status === "" && edit) {
$("span#edit_status").html("*");
}
}); });
setDetailBox();
$("#add").click(function () { $("#add").click(function () {
var path = softwareDisplay ? projectDir : currentProject; var path = base_path();
if (send) { if (send) {
return false; return false;
} }
if ($("input#file").val() === "" || $("input#file").val() === "Enter name here...") { if ($("input#file").val() === "" || $("input#file").val() === "Name here...") {
$("#error").Popup("Please enter your file or folder name", {type: 'alert', duration: 3000}); $("#error").Popup("Please select a directory or nothing for root directory and enter your file name", {type: 'alert', duration: 5000});
return false; return false;
} }
if ($("input#subfolder").val() !== "") { if (selection !== "") {
path = $("input#subfolder").val(); path = selection;
} }
path = path + "/" + $("input#file").val(); path = path + "/" + $("input#file").val();
send = true; send = true;
...@@ -213,8 +233,8 @@ $(document).ready(function () { ...@@ -213,8 +233,8 @@ $(document).ready(function () {
$("#flash").fadeOut('normal'); $("#flash").fadeOut('normal');
$("#flash").empty(); $("#flash").empty();
$("#info").empty(); $("#info").empty();
$("#info").append("Select parent directory or nothing for root..."); $("#info").append("Selection: " + base_path());
$("input#subfolder").val(""); selection = "";
} else { } else {
$("#error").Popup(data.result, {type: 'error', duration: 5000}); $("#error").Popup(data.result, {type: 'error', duration: 5000});
} }
...@@ -243,6 +263,7 @@ $(document).ready(function () { ...@@ -243,6 +263,7 @@ $(document).ready(function () {
success: function (data) { success: function (data) {
if (data.code === 1) { if (data.code === 1) {
$("#error").Popup("File saved succefuly!", {type: 'confirm', duration: 3000}); $("#error").Popup("File saved succefuly!", {type: 'confirm', duration: 3000});
$("span#edit_status").html("");
} else { } else {
$("#error").Popup(data.result, {type: 'error', duration: 5000}); $("#error").Popup(data.result, {type: 'error', duration: 5000});
} }
...@@ -252,9 +273,9 @@ $(document).ready(function () { ...@@ -252,9 +273,9 @@ $(document).ready(function () {
return false; return false;
}); });
$("#details_head").click(function () { /*$("#details_head").click(function () {
setDetailBox(); setDetailBox();
}); });*/
$("#switch").click(function () { $("#switch").click(function () {
softwareDisplay = !softwareDisplay; softwareDisplay = !softwareDisplay;
...@@ -267,14 +288,15 @@ $(document).ready(function () { ...@@ -267,14 +288,15 @@ $(document).ready(function () {
}); });
$("#clearselect").click(function () { $("#clearselect").click(function () {
edit = false;
$("#info").empty(); $("#info").empty();
$("#info").append("Select directory or nothing for root directory..."); $("#info").append("Selection: " + base_path());
$("input#subfolder").val(""); $("input#subfolder").val("");
$("#edit_info").empty(); $("#edit_info").empty();
$("#edit_info").append("No file selected"); $("#edit_info").append("No file in editor");
editor.getSession().setValue(""); editor.getSession().setValue("");
$("#md5sum").empty();
$("a#option").hide(); $("a#option").hide();
selection = "";
return false; return false;
}); });
$("#adddevelop").click(function () { $("#adddevelop").click(function () {
......
...@@ -18,37 +18,40 @@ ...@@ -18,37 +18,40 @@
<input type="hidden" name="workdir" id="workdir" value="{{workDir}}" /> <input type="hidden" name="workdir" id="workdir" value="{{workDir}}" />
<input type="hidden" name="subfolder" id="subfolder" value="" /> <input type="hidden" name="subfolder" id="subfolder" value="" />
<div id="software_folder"> <div id="software_folder">
<h2 class="hight show" id="details_head">Current software release file content</h2> <div class="software_details">
<div class="software_details" id="details_box"> <a href="#" id="switch" class="lshare no-right-border" style="float:left">Switch to Project</a>
<div id="fileTree" class="file_tree_short"></div> <a href="#" id="clearselect" class="lshare no-right-border" style="float:left">Reset</a>
<a href="#" id="save" class="lshare" style="float:left">Save</a>
<div class="clear"></div>
<div id="details_box">
<div id="fileTree" class="file_tree_short" title="Double click to edit selected file..."></div>
<div class="box_software"> <div class="box_software">
<h2>Add new file or folder</h2> <input type="text" name="file" id="file" size='12' value="Name here..." />
<input type="text" name="file" id="file" size='22' value="Enter name here..." /> &nbsp;<select name="type" id="type">
&nbsp;&nbsp;&nbsp;<select name="type" id="type">
<option value="file">file</option> <option value="file">file</option>
<option value="folder">folder</option> <option value="folder">folder</option>
</select> </select>
&nbsp;&nbsp;&nbsp;<input type="submit" name="add" id ="add" value="Add" class="button"/> &nbsp;<input type="submit" name="add" id ="add" value="Add" class="button"/>
<br/><br/>
<a href="#" id="switch" class="lshare">Switch to Project files</a>
<a href="" id="clearselect" class="lshare">Clear selection</a><br/><br/>
<div id="file_info" class="file_info"><span id="info">Select directory or nothing for root directory...</span></div>
</div> </div>
<div class="clear"></div>
</div> </div>
<div class="clear"></div> </div>
<div id="code" style="margin-top:10px"> <div id="code">
<h2 class='title'><span id="edit_info">No file selected</span> <a style="display:none" id='option' href='#' rel='tooltip' title='Show more option'>[More]</a></h2> <h2 class='title'>
<div class='md5sum' id='md5sum'></div> <a style="display:none" id='option' href='#' rel='tooltip' title='Show more option'>[Current file]</a><span id="edit_info">No file in editor</span>
<span id="edit_status"></span>
</h2>
<div class="main_content"> <div class="main_content">
<pre id="editor"> <pre id="editor">
</pre> </pre>
</div> </div>
<input type=submit value="Save" id="save" class="button"> <!--<input type=submit value="Save" id="save" class="button">-->
</div> </div>
</div> </div>
<div class="clear"></div>
<div id="file_info" class="file_info"><span id="info"></span></div>
<br/>
</form> </form>
<div id="tooltip-option" style="display:none"> <div id="tooltip-option" style="display:none">
<span class="list first-list">MD5 SUM for the current file</span> <span class="list first-list">MD5 SUM for the current file</span>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment