webgui/www/extras/wobject/Survey/editsurvey/object.js
Patrick Donelan b7520da07d Merge commit 'tags/WebGUI_7.6.8-beta' into survey-rfe
* commit 'tags/WebGUI_7.6.8-beta': (96 commits)
  Release 7.6.8-beta
  preparing for 7.6.8 release
  convert to new storage format
  fixing photo comment test
  fixed: Syndicated Content corrupts wide characters
  Add the WikiPage to the list of contributions shown in the Account Contributions tab.
  added #!/usr/bin/env perl to all utility scripts
  Forward port i18n fix for Gallery Album RSS list.
  Fix some Survey i18n typos in the time limit hoverhelp.
  Large batch of Help and i18n.  Also, make sure that the
  Fix a typo in the i18n help for the ITransact Pay Driver.
  Correct dataform captcha variable name in the help.
  Forward porting expanded patch for handling deleted things.
  Have Thingy check for existance of table and column to prevent
  Fix linking to other things and autocreating the form field for it.
  Update test to match fixed code.
  Remove the warnings pragma
  Only resize photos if they are larger than the Gallery resolutions.
  Fix a syntax error made in the i18n of the search button.
  I18n'ed a submit button in the manage transactions screen.
  ...

Conflicts:

	lib/WebGUI/Asset/Wobject/Survey.pm
	lib/WebGUI/Asset/Wobject/Survey/SurveyJSON.pm
	www/extras/wobject/Survey/editsurvey.js
	www/extras/wobject/Survey/editsurvey/object.js
2009-01-14 06:00:06 +00:00

86 lines
2.3 KiB
JavaScript

/*global Survey, YAHOO */
if (typeof Survey === "undefined") {
var Survey = {};
}
Survey.ObjectTemplate = (function(){
var editor;
var dialog;
return {
loadObject: function(html, type){
document.getElementById('edit').innerHTML = html;
var btns = [{
text: "Submit",
handler: function(){
editor.saveHTML();
this.submit();
},
isDefault: true
}, {
text: "Copy",
handler: function(){
document.getElementById('copy').value = 1;
this.submit();
}
}, {
text: "Cancel",
handler: function(){
this.cancel();
}
}, {
text: "Delete",
handler: function(){
document.getElementById('delete').value = 1;
this.submit();
}
}];
dialog = new YAHOO.widget.Dialog(type, {
width: "600px",
context: [document.body, 'tr', 'tr'],
visible: false,
constraintoviewport: true,
buttons: btns
});
if (type !== 'answer') {
btns.push({
text: "Preview",
handler: function(){
window.location.search = 'func=jumpTo;id=' + dialog.getData().id;
}
});
}
dialog.callback = Survey.Comm.callback;
dialog.render();
var textareaId = type + 'Text';
var textarea = YAHOO.util.Dom.get(textareaId);
var height = YAHOO.util.Dom.getStyle(textarea, 'height');
if (!height) {
height = '300px';
}
editor = new YAHOO.widget.SimpleEditor(textareaId, {
height: height,
width: '100%',
dompath: false //Turns on the bar at the bottom
});
if (editor.get('toolbar')) {
editor.get('toolbar').titlebar = false;
}
editor.render();
dialog.show();
}
};
})();