Help is ready, we just have to insert datas in helpCh array (manager.js)

Warning: there is a conflict with auto resize of help
This commit is contained in:
Xavier Guimard 2010-11-01 07:05:51 +00:00
parent 80d631fdff
commit ad83bbfa76
4 changed files with 54 additions and 15 deletions

View File

@ -241,7 +241,7 @@ option
#content_filearea table tr td #content_filearea table tr td
{ {
text-align:left; text-align:left;
vertical-align:center; vertical-align:middle;
} }
#content_filearea table #content_filearea table
{ {

View File

@ -2,6 +2,13 @@
* Lemonldap::NG Manager jQuery scripts * Lemonldap::NG Manager jQuery scripts
*/ */
/* Help chapters */
var helpCh={
rules:'/pages/documentation/1.0/writingrulesand_headers.html#rules',
headers:'/pages/documentation/1.0/writingrulesand_headers.html#headers',
default:'/'
};
/* Init simpleTreeCollection */ /* Init simpleTreeCollection */
var simpleTreeCollection; var simpleTreeCollection;
@ -58,9 +65,6 @@ $(document).ready(function(){
return false; return false;
}); });
/* Load default help */
$('#help_content').load(scriptname+'?help=default');
/* Display configuration datas */ /* Display configuration datas */
getCfgAttributes(); getCfgAttributes();
display('cfgDatas',''); display('cfgDatas','');
@ -72,7 +76,7 @@ $(document).ready(function(){
drag:false, drag:false,
afterClick:function(node){ afterClick:function(node){
var span=$('span:first',node); var span=$('span:first',node);
$('#help_content').load(scriptname+'?help='+span.attr('help')); loadHelp(span.attr('help'));
simpleTreeDefaultJqueryClasses(); simpleTreeDefaultJqueryClasses();
simpleTreeToggleJqueryClasses(); simpleTreeToggleJqueryClasses();
}, },
@ -112,6 +116,10 @@ $(document).ready(function(){
simpleTreeSetMenuStyle(style); simpleTreeSetMenuStyle(style);
return false; return false;
}); });
/* Load default help */
loadHelp('default');
}); });
function simpleTreeSetMenuStyle(style){ function simpleTreeSetMenuStyle(style){
if(style=="tree"){ if(style=="tree"){
@ -347,12 +355,13 @@ function display(div,title) {
$('#newapplicationr,#delapplication').hide(); $('#newapplicationr,#delapplication').hide();
$('#newpostr,#delpost').hide(); $('#newpostr,#delpost').hide();
$('#newpostdatar,#delpostdata').hide(); $('#newpostdatar,#delpostdata').hide();
var height_cur=$('#buttons').height()+$('#edition').height()+$('#help').height(); /* TODO: conflict with loadAndScroll */
/*var height_cur=$('#buttons').height()+$('#edition').height()+$('#help').height();
var height_max=$('#menu').height(); var height_max=$('#menu').height();
if(height_cur > height_max || $('#help_content').is(':visible')==false){ if(height_cur > height_max || $('#help_content').is(':visible')==false){
$('#help h1 img').toggle(); $('#help h1 img').toggle();
$('#help_content').toggle(); $('#help_content').toggle();
} }*/
} }
function none(id) { function none(id) {
currentId=id; currentId=id;
@ -700,7 +709,7 @@ function vhost(id){
} }
function cfgDatas(id){ function cfgDatas(id){
var span=$('#'+id+' span'); var span=$('#'+id+' span');
$('#help_content').load(scriptname+'?help='+span.attr('help')); loadHelp(span.attr('help'));
display('cfgDatas',''); display('cfgDatas','');
getCfgAttributes(); getCfgAttributes();
} }
@ -1272,11 +1281,39 @@ function networkPb(){
popup('<h3>Network problem</h3>'); popup('<h3>Network problem</h3>');
} }
function loadAndScrollToAnchor(url) { function loadAndScroll(url,prefix){
var t=url.match(/^(.*?)(?:#(.*))$/); var t=url.match(/^(.*?)(?:#(.*))?$/);
var dir=t[1].match(/(.*\/)/);
$('#help_content').load(t[1],function(){ $('#help_content').load(t[1],function(){
/* Scroll to anchor if defined */
if(typeof(t[2])=='string') if(typeof(t[2])=='string')
$('#help_content').attr('scrollTop',$("a[name='"+t[2]+"']").position().top-$('#help_content').position().top); $('#help_content').attr('scrollTop',$("a[name='"+t[2]+"']").position().top-$('#help_content').position().top);
/* Replace help_content links */
$('#help_content a').each(function(i){
if(typeof($(this).attr('href'))=='string'){
/* Links must be opened in another window */
$(this).attr('target','_blank');
var href=$(this).attr('href');
/* absolute links are prefixed if needed */
if(typeof(prefix)=='string' && typeof(dir[0])=='string' && href.match(/^\//)){
$(this).attr('href',prefix+href);
}
/* relative links are replaced by absolute ones */
//else if(href.match(/^\.\./)){
else if(!href.match(/^https?:\/\//)){
$(this).attr('href',dir[0]+href);
}
}
});
}); });
} }
var lasthelp='';
function loadHelp(ch){
var url;
if(typeof(helpCh[ch])!='string'){ch='default';}
if(ch!=lasthelp){
url=helpCh[ch];
loadAndScroll('/doc'+url,'/doc');
lasthelp=ch;
}
}

View File

@ -8,7 +8,7 @@
<link href="<TMPL_VAR NAME="DIR">/lemonldap-ng.ico" rel="shortcut icon" /> <link href="<TMPL_VAR NAME="DIR">/lemonldap-ng.ico" rel="shortcut icon" />
<link rel="stylesheet" type="text/css" href="<TMPL_VAR NAME="DIR">/ui-lightness/jquery-ui-1.8.5.custom.css" /> <link rel="stylesheet" type="text/css" href="<TMPL_VAR NAME="DIR">/ui-lightness/jquery-ui-1.8.5.custom.css" />
<link rel="stylesheet" type="text/css" title="menu" href="<TMPL_VAR NAME="DIR">/<TMPL_VAR NAME="CSS">" /> <link rel="stylesheet" type="text/css" title="menu" href="<TMPL_VAR NAME="DIR">/<TMPL_VAR NAME="CSS">" />
<link rel="stylesheet" type="text/css" title="help" href="/doc/css/screen.css" /> <link rel="stylesheet" type="text/css" href="/doc/css/screen.css" />
<script src="<TMPL_VAR NAME="DIR">/jquery-1.4.2.min.js" type="text/JavaScript"></script> <script src="<TMPL_VAR NAME="DIR">/jquery-1.4.2.min.js" type="text/JavaScript"></script>
<script src="<TMPL_VAR NAME="DIR">/jquery-ui-1.8.5.custom.min.js" type="text/JavaScript"></script> <script src="<TMPL_VAR NAME="DIR">/jquery-ui-1.8.5.custom.min.js" type="text/JavaScript"></script>
<script src="<TMPL_VAR NAME="DIR">/jquery.cookie.js" type="text/JavaScript"></script> <script src="<TMPL_VAR NAME="DIR">/jquery.cookie.js" type="text/JavaScript"></script>

View File

@ -34,15 +34,17 @@ sub cstruct {
], ],
rules => { rules => {
_nodes => ["hash:/locationRules/$k2:rules:rules"], _nodes => ["hash:/locationRules/$k2:rules:rules"],
_js => 'rulesRoot' _js => 'rulesRoot',
_help => 'rules',
}, },
headers => { headers => {
_nodes => ["hash:/exportedHeaders/$k2"], _nodes => ["hash:/exportedHeaders/$k2"],
_js => 'hashRoot' _js => 'hashRoot',
_help => 'headers',
}, },
post => { post => {
_nodes => ["post:/post/$k2:post:post"], _nodes => ["post:/post/$k2:post:post"],
_js => 'postRoot' _js => 'postRoot',
}, },
vhostOptions => { vhostOptions => {
_nodes => [qw(vhostPort vhostHttps)], _nodes => [qw(vhostPort vhostHttps)],