WIP management pages

master
Harald Wolff 2018-03-13 21:41:01 +01:00
parent b4ffe35e71
commit 8212944533
10 changed files with 177 additions and 36 deletions

View File

@ -53,13 +53,48 @@ function treeRefresh(objPath){
editorLoad(objPath);
}
function editorClear(){
window.editor_fields = {}
}
function editorDeclareControl(ctl, field = null){
if (field == null){
field = ctl.getAttribute("name");
}
window.editor_fields[ field ] = ctl;
}
function editorLoad(objPath){
var editor = $("editor");
var url = objPath + "/_hm_edit";
var treesource = callURL(url);
editorClear();
loadHTML(editor, treesource);
}
function editorApply(objPath){
var formData = FormData();
for (var field in window.editor_fields){
if (window.editor_fields.hasOwnProperty( field )){
}
}
formData.append( )
}
function editorSave(){
alert("Submit");
return false;
}

View File

@ -1,6 +1,20 @@
<h1><%=self._aq_name%></h1>
<div class="small bold"><%=self.__class__.__name__%></div>
<form onsubmit="return editorSave();">
<div class="block">
<button class="button" onclick="editorSave();">Speichern</button>
</div>
<div class="section">
<div class="section-title">Basic Attributes</div>
<div class="">Page Title <input type="text" id="title" name="title"/></div>
<div class="">Include in Navigation?</div>
</div>
<div id="localeditor"><%content%></div>
<script type="text/javascript">
@ -8,5 +22,11 @@
if (nodediv != null){
nodediv.class += " selected";
}
editorDeclareControl($("wo_title"));
editorDeclareControl($("title"));
editorDeclareControl($("nav_visible"));
</script>
</form>

View File

@ -14,6 +14,11 @@ h1,h2,h3,h4,h5 {
display: inline-block;
}
textarea {
min-width: 50%;
min-height: 400px;
}
.popup {
position: absolute;
left: 75%;
@ -23,7 +28,7 @@ h1,h2,h3,h4,h5 {
border: 1px solid #202040;
background-color: #C0C0FF;
border-radius: 5px;
padding: 5px;
padding: 15px;
}
* > .popup {
@ -55,16 +60,35 @@ div:hover > .pulldown {
z-index: 1;
}
.section {
display: block;
border: 1px dotted silver;
}
.section > .section-title {
border-bottom: 1px solid black;
margin-bottom: 5px;
}
.button {
.button, input{
position: relative;
display: inline-block;
border: 1px solid #202040;
background-color: #E0E0FF;
border-radius: 3px;
}
.button.small {
width: 14px;
height: 14px;
border: 1px solid #202040;
background-color: #A0A0FF;
border-radius: 5px;
}
input {
padding: 3px;
min-width: 400px;
}
input.small {
min-width: 200px;
}
.right {
@ -72,6 +96,16 @@ div:hover > .pulldown {
display: block;
}
.section > div {
border: 1px dotted silver;
height: 28px;
text-
}
.section > div > input {
//left: 10%;
right: -20%;
}
@ -82,6 +116,33 @@ div:hover > .pulldown {
margin-bottom: 40px;
}
#tree {
display: inline-block;
width: 15%;
min-height: 95%;
position: absolute;
float: left;
padding-right: 1%;
border-right: 1px solid black;
}
#editor {
display: block;
position: absolute;
left: 17%;
width: 85%;
}
#menu>a {
display: inline;
}
@ -91,17 +152,7 @@ div:hover > .pulldown {
display: inline-block;
}
#tree {
display: block;
width: 15%;
min-height: 80%;
position: relative;
float: left;
padding-right: 15px;
margin-right: 15px;
border-right: 1px solid black;
}
.row {
display: block;
@ -176,17 +227,6 @@ div:hover > .pulldown {
}
#editor {
display: block;
left: 15%;
width: 85%;
}
textarea#editor {
min-width: 50%;
min-height: 300px;
}
.typename, .bold {
display: inline;
font-weight: bold;
@ -198,10 +238,10 @@ textarea#editor {
.block {
display: block;
border: 1px solid black;
background-color: #C0C0C0;
//background-color: #C0C0C0;
margin-bottom: 10px;
margin-top: 10px;
}

View File

@ -4,9 +4,9 @@
<div class="row">
<div class="right">
<%if len(node._aq_path)>1%>
<div class="button" onclick="onRemoveButton(this,'<%='/'.join([x._aq_name for x in node._aq_path])%>');"></div>
<div class="button small" onclick="onRemoveButton(this,'<%='/'.join([x._aq_name for x in node._aq_path])%>');"></div>
<%end%>
<div class="button">
<div class="button small">
<div class="popup">
<select size="1" id="objTypeName-<%=node._persistence_id()%>">
<%iterate ot node.wo_accepts()%>

View File

@ -10,7 +10,7 @@ function preview_loaded(){
}
function preview(){
var editor = document.getElementById("source_editor");
var editor = document.getElementById("dpage_source");
var fdata = new FormData();
fdata.set( "content", editor.value );
@ -26,6 +26,11 @@ function sourcechanged(){
previewTimeout = setTimeout( preview, 2000 );
}
function saveSource(){
var tmplSrc = $("dpage_source").value;
}
</script>
@ -33,8 +38,8 @@ function sourcechanged(){
<iframe id="preview-frame" name="preview" src=""></iframe>
</div>
<form action="<%=request.self()%>" method="POST" enctype="multipart/form-data" accept-charset="utf-8">
<input type="submit" value="Speichern"/><br/>
<textarea id="source_editor" name="content" oninput="sourcechanged();"><%=self.source(request)%></textarea><br/>
<input type="submit" value="Speichern"/>
</form>
<textarea id="dpage_source" name="content" oninput="sourcechanged();"><%=self.source(request)%></textarea><br/>
<script type="text/javascript">
editorDeclareControl($("dpage_source"));
</script>

View File

@ -0,0 +1,41 @@
from simplelog import log
from hserver.api.WebCallable import WebCallable
class FADescription:
def __init__(self, name, formName = None):
if formName is None:
formName = name
self.__name = name
self.__formName = formName
class FormApplyable:
FA_Names = {}
def formApply(self,request):
fa_names = self.__collectNames()
for name in fa_names:
fa_attr = fa_names[ name ]
if fa_attr in request.form():
setattr( self, name, request.form()[ fa_attr ])
def __collectNames(self):
fa_names = {}
bases = self.__bases__
for base in bases:
if hasattr(base, "FA_Names"):
fa_names.update( base.FA_Names )
log("FormApplyable: collectNames(): {0}".format( fa_names ))
return fa_names
def __apply(self,request, o = None):
self.formApply(request)
_hm_apply = WebCallable( method = __apply )