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