08-20-2009 11:02 PM
<div class="yui-gd">
<div class="yui-u first"><label for="${args.htmlid}-addContent">${msg("label.HowToAddContent")}:</label></div>
<div class="yui-u">
<select id="addContent" name="addContent" onchange="dropdown(this)">
<option value="1" selected="selected">${msg("label.generateFromDescription")}</option>
<option value="2">${msg("label.uploadFile")}</option>
</select>
</div>
</div>
<script type="text/javascript">//<![CDATA[
function dropdown(sel){
//if(document.getElementById("addContent").value == "1")
if(sel.value == "0"){
document.getElementById('desc').style.display = 'block'
}
else {
document.getElementById('desc').style.display = 'none'
}
}
//]]></script>
08-21-2009 03:07 AM
<html>
<head><title>select</title></head>
<body>
<select id="addContent" name="addContent" onchange="dropdown(this)">
<option value="1" selected="selected">label.generateFromDescription</option>
<option value="2">label.uploadFile</option>
</select>
<div id="desc">This is the desc div</div>
<script type="text/javascript">//<![CDATA[
function dropdown(sel)
{
if (sel.value == "1")
{
document.getElementById('desc').style.display = 'block';
}
else
{
document.getElementById('desc').style.display = 'none';
}
}
//]]></script>
<select id="${args.htmlid}-addContent" name="addContent" onchange="dropdown(this)">
<option value="1" selected="selected">${msg("label.generateFromDescription")}</option>
<option value="2">${msg("label.uploadFile")}</option>
</select>
<div id="${args.htmlid}-addContent-desc">This is the desc div</div>
<script type="text/javascript">//<![CDATA[
function dropdown(sel)
{
var descDiv = YAHOO.util.Dom.get('${args.htmlid}-addContent-desc');
descDiv.style.display = sel.value == "1" ? "block" : "none";
}
//]]></script>
08-21-2009 03:29 AM
<div id="${args.htmlid}-dialog" class="create-folder" >
<script type="text/javascript">//<![CDATA[
function dropdown(sel)
{
var descDiv = YAHOO.util.Dom.get('desc');
descDiv.style.display = sel.value == "1" ? "block" : "none";
}
//]]></script>
<div class="hd">${msg("title")}</div>
<div class="bd">
<form id="${args.htmlid}-form" action="" method="post">
<div class="yui-g">
<h2>${msg("header")}:</h2>
</div>
<div class="yui-gd">
<div class="yui-u first"><label for="${args.htmlid}-name">${msg("label.name")}:</label></div>
<div class="yui-u"><input id="${args.htmlid}-name" type="text" name="name" tabindex="1" /> *</div>
</div>
<div class="yui-gd">
<div class="yui-u first"><label for="${args.htmlid}-title">${msg("label.title")}</label></div>
<div class="yui-u"><input id="${args.htmlid}-title" type="text" name="title" tabindex="2" /></div>
</div>
<div class="yui-gd">
<div class="yui-u first"><label for="${args.htmlid}-addContent">${msg("label.HowToAddContent")}:</label></div>
<div class="yui-u">
<select id="${args.htmlid}-addContent" name="addContent" onchange="dropdown(this)">
<option value="1" selected="selected">${msg("label.generateFromDescription")}</option>
<option value="2">${msg("label.uploadFile")}</option>
</select>
</div>
</div>
<div class="yui-gd" id = "desc">
<div class="yui-u first"><label for="${args.htmlid}-description">${msg("label.description")}:</label></div>
<div class="yui-u"><textarea id="${args.htmlid}-description" name="description" rows="16" cols="150" tabindex="3" ></textarea></div>
</div>
<div class="yui-gd" id="${args.htmlid}-privilegetype-field">
<div class="yui-u first"><label for="${args.htmlid}-privilegetype">${msg("label.privilegetype")}:</label></div>
<div class="yui-u">
<select id="${args.htmlid}-privilegetype" name="privilegetype" tabindex="4">
<option value="Normal">${msg("label.Normal")}</option>
<option value="Confidential">${msg("label.Confidential")}</option>
<option value="Public">${msg("label.Public")}</option>
</select>
</div>
<div class="yui-gd" id="${args.htmlid}-mywidth-field">
<div class="yui-u first"><label for="${args.htmlid}-mywidth">${msg("label.doctype")}:</label></div>
<div class="yui-u">
<select id="${args.htmlid}-mywidth" name="mywidth" tabindex="5">
<option value="PT">PT</option>
<option value="OTH">OTH</option>
</select>
</div>
</div>
<div class="bdft">
<input type="button" id="${args.htmlid}-ok" value="${msg("button.ok")}" tabindex="6" />
<input type="button" id="${args.htmlid}-cancel" value="${msg("button.cancel")}" tabindex="7" />
</div>
</form>
</div>
</div>
08-21-2009 04:42 AM
08-21-2009 09:37 AM
this.modules.createFolder = new Alfresco.module.SimpleDialog(this.id + "-createFolder").setOptions(
{
width: "80em",
templateUrl: Alfresco.constants.URL_SERVICECONTEXT + "modules/documentlibrary/create-folder",
actionUrl: actionUrl,
doSetupFormsValidation:
{
fn: doSetupFormsValidation,
scope: this
},
firstFocus: this.id + "-createFolder-name",
onSuccess:
{
fn: function DLTB_onNewFolder_callback(response)
{
var folder = response.json.results[0];
YAHOO.Bubbling.fire("folderCreated",
{
name: folder.name,
parentPath: folder.parentPath,
nodeRef: folder.nodeRef
});
Alfresco.util.PopupManager.displayMessage(
{
text: this._msg("message.new-folder.success", folder.name)
});
},
scope: this
}
});
}
else
in simple-dialog.js:
show: function AmSD_show()
{
if (this.dialog)
{
this._showDialog();
}
else
{
var data = {
htmlid : this.id
};
if (this.options.templateRequestParams)
{
data = YAHOO.lang.merge(this.options.templateRequestParams,data);
}
Alfresco.util.Ajax.request(
{
url: this.options.templateUrl,
dataObj:data,
successCallback:
{
fn: this.onTemplateLoaded,
scope: this
},
failureMessage: "Could not load dialog template from '" + this.options.templateUrl + "'.",
scope: this,
execScripts: true
});
}
return this;
},
That's just another reason why it's better to add event handling in the main .js file rather than inline.which .js file should i add the event handling ?
08-21-2009 09:41 AM
which .js file should i add the event handling ?The one where you load your "add content" dialog. Maybe you need to back-up and describe exactly what you're trying to achieve and what you've done so far.
I have tried to add event handling in toolbar-min.jsDon't edit the -min.js files. Edit the uncompressed ones and then run them through the YUI Compressor to produce the -min.js version.
08-21-2009 09:45 AM
which .js file should i add the event handling ?The one where you load your "add content" dialog. Maybe you need to back-up and describe exactly what you're trying to achieve and what you've done so far.
It doesn't matter that much - the solution I gave above would still work.I have tried to add event handling in toolbar-min.jsDon't edit the -min.js files. Edit the uncompressed ones and then run them through the YUI Compressor to produce the -min.js version.
Mike
08-21-2009 09:46 AM
is toolbar-min.jsin simple-dialog.js:
this.modules.createFolder = new Alfresco.module.SimpleDialog(this.id + "-createFolder").setOptions(
{
width: "80em",
templateUrl: Alfresco.constants.URL_SERVICECONTEXT + "modules/documentlibrary/create-folder",
actionUrl: actionUrl,
doSetupFormsValidation:
{
fn: doSetupFormsValidation,
scope: this
},
firstFocus: this.id + "-createFolder-name",
onSuccess:
{
fn: function DLTB_onNewFolder_callback(response)
{
var folder = response.json.results[0];
YAHOO.Bubbling.fire("folderCreated",
{
name: folder.name,
parentPath: folder.parentPath,
nodeRef: folder.nodeRef
});
Alfresco.util.PopupManager.displayMessage(
{
text: this._msg("message.new-folder.success", folder.name)
});
},
scope: this
}
});
}
else
show: function AmSD_show()
{
if (this.dialog)
{
this._showDialog();
}
else
{
var data = {
htmlid : this.id
};
if (this.options.templateRequestParams)
{
data = YAHOO.lang.merge(this.options.templateRequestParams,data);
}
Alfresco.util.Ajax.request(
{
url: this.options.templateUrl,
dataObj:data,
successCallback:
{
fn: this.onTemplateLoaded,
scope: this
},
failureMessage: "Could not load dialog template from '" + this.options.templateUrl + "'.",
scope: this,
execScripts: true
});
}
return this;
},
Hi Thanks Mike,
So system have set the execSCript to ture, but actually the <script> are still not work.That's just another reason why it's better to add event handling in the main .js file rather than inline.which .js file should i add the event handling ?
I have tried to add event handling in toolbar-min.js
it wouldn't throw out error, but it didn't take action, what's the reason ?
08-21-2009 10:29 AM
alert(this.id);
var addcontent = YAHOO.util.Dom.get(this.id + "-addContent");
alert(addcontent.value);
function fnCallback(e) { alert("click"); };
YAHOO.util.Event.addListener(addcontent, "change", fnCallback);
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.