本文整理汇总了PHP中page_add_script函数的典型用法代码示例。如果您正苦于以下问题:PHP page_add_script函数的具体用法?PHP page_add_script怎么用?PHP page_add_script使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了page_add_script函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SiteglossaryEditForm
function SiteglossaryEditForm()
{
parent::MailForm();
$this->parseSettings('inc/app/siteglossary/forms/edit/settings.php');
global $cgi;
page_title(intl_get('Editing Glossary Term') . ': ' . $cgi->_key);
page_add_script('
function cms_cancel (f) {
if (arguments.length == 0) {
window.location.href = "/index/cms-app";
} else {
if (f.elements["_return"] && f.elements["_return"].value.length > 0) {
window.location.href = f.elements["_return"].value;
} else {
window.location.href = "/index/siteglossary-app";
}
}
return false;
}
');
// add cancel handler
$this->widgets['submit_button']->buttons[1]->extra = 'onclick="return cms_cancel (this.form)"';
$res = db_single('select * from siteglossary_term where word = ?', $cgi->_key);
foreach (get_object_vars($res) as $k => $v) {
$this->widgets[$k]->setValue($v);
}
}
示例2: SitepresenterAddForm
function SitepresenterAddForm()
{
parent::MailForm();
global $page, $cgi;
$this->parseSettings('inc/app/sitepresenter/forms/add/settings.php');
page_title(intl_get('Adding Presentation'));
loader_import('ext.phpsniff');
$sniffer = new phpSniff();
$this->_browser = $sniffer->property('browser');
// include formhelp, edit panel init, and cancel handler
page_add_script(site_prefix() . '/js/formhelp.js');
page_add_script(CMS_JS_FORMHELP_INIT);
page_onload('cms_init_edit_panels ()');
page_add_script('
function cms_cancel (f) {
if (arguments.length == 0) {
window.location.href = "/index/cms-app";
} else {
if (f.elements["_return"] && f.elements["_return"].value.length > 0) {
window.location.href = f.elements["_return"].value;
} else {
window.location.href = "/index/sitepresenter-app";
}
}
return false;
}
');
// add cancel handler
$this->widgets['submit_button']->buttons[1]->extra = 'onclick="return cms_cancel (this.form)"';
}
示例3: SitepresenterEditSlideForm
function SitepresenterEditSlideForm()
{
parent::MailForm();
$this->parseSettings('inc/app/sitepresenter/forms/edit/slide/settings.php');
page_add_script('
function cms_cancel (f) {
if (arguments.length == 0) {
window.location.href = "/index/cms-app";
} else {
if (f.elements["_return"] && f.elements["_return"].value.length > 0) {
window.location.href = f.elements["_return"].value;
} else {
window.location.href = "/index/sitepresenter-app";
}
}
return false;
}
');
$this->widgets['submit_button']->buttons[1]->extra = 'onclick="return cms_cancel (this.form)"';
global $cgi;
page_title(intl_get('Adding Slide to Presentation') . ': ' . db_shift('select title from sitepresenter_presentation where id = ?', $cgi->presentation));
$res = db_single('select * from sitepresenter_slide where id = ?', $cgi->id);
foreach (get_object_vars($res) as $k => $v) {
$this->widgets[$k]->setValue($v);
}
}
示例4: _link
function _link()
{
// display a button that pops up the boxchooser app
static $included = false;
if (!$included) {
page_add_script(site_prefix() . '/js/dialog.js');
page_add_script(loader_box('boxchooser/js', $this));
$included = true;
}
return template_simple('
<script language="javascript" type="text/javascript">
function boxchooser_{name}_handler () {
if (typeof dialogWin.returnedValue == \'object\') {
url = dialogWin.returnedValue[\'src\'];
} else {
url = dialogWin.returnedValue;
}
boxchooser_{name}_form.elements[boxchooser_{name}_element].value = unescape (url);
}
</script>
<input type="submit" onclick="boxchooser_{name}_get_file (this.form, \'{name}\'); return false" value="{intl Choose}" />
', $this);
}
示例5: onSubmit
function onSubmit($vals)
{
page_add_script(site_prefix() . '/js/dialog.js');
page_add_script(loader_box('boxchooser/js', $vals));
echo '<script language="javascript" type="text/javascript">';
echo 'boxchooser_' . $vals['name'] . '_select ("' . $vals['app'] . '/' . $vals['box'];
$pre = '?';
foreach ($this->_box_settings as $k => $v) {
echo $pre . $k . '=' . urlencode($vals[$k]);
$pre = '&';
}
echo '"); window.close (); </script>';
//info ($vals);
}
示例6: CmsAddSitellite_filesystemForm
function CmsAddSitellite_filesystemForm()
{
parent::MailForm();
global $page, $cgi;
$this->parseSettings('inc/app/cms/forms/add/sitellite_filesystem/settings.php');
page_title(intl_get('Adding File'));
loader_import('ext.phpsniff');
$sniffer = new phpSniff();
$this->_browser = $sniffer->property('browser');
// include formhelp, edit panel init, and cancel handler
page_add_script(site_prefix() . '/js/formhelp-compressed.js');
page_add_script(CMS_JS_FORMHELP_INIT);
page_add_script('
function cms_cancel (f) {
onbeforeunload_form_submitted = true;
if (arguments.length == 0) {
window.location.href = "/index/cms-browse-action?collection=sitellite_filesystem";
} else {
if (f.elements["_return"] && f.elements["_return"].value.length > 0) {
window.location.href = f.elements["_return"].value;
} else {
window.location.href = "/index/cms-browse-action?collection=sitellite_filesystem";
}
}
return false;
}
function cms_preview_action (f) {
cms_copy_values (f);
return cms_preview (f);
}
function cms_cancel_action (f) {
cms_copy_values (f);
if (confirm (\'Are you sure you want to cancel?\')) {
return cms_cancel (f);
}
return false;
}
');
if (session_pref('form_help') == 'off') {
page_add_script('
formhelp_disable = true;
');
}
$this->widgets['sitellite_owner']->setValue(session_username());
$this->widgets['sitellite_team']->setValue(session_team());
// add cancel handler
$this->widgets['submit_button']->buttons[1]->extra = 'onclick="return cms_cancel (this.form)"';
}
示例7: NewsEditForm
function NewsEditForm()
{
parent::MailForm();
$this->autosave = true;
$this->parseSettings('inc/app/news/forms/edit/settings.php');
global $page, $cgi;
page_title(intl_get('Editing News Story') . ': ' . $cgi->_key);
loader_import('ext.phpsniff');
$sniffer = new phpSniff();
$this->_browser = $sniffer->property('browser');
// include formhelp, edit panel init, and cancel handler
page_add_script(site_prefix() . '/js/formhelp-compressed.js');
page_add_script(CMS_JS_FORMHELP_INIT);
page_add_script('
function cms_cancel_unlock (f, collection, key) {
onbeforeunload_form_submitted = true;
if (arguments.length == 0) {
window.location.href = "' . site_prefix() . '/index/cms-unlock-action?collection=" + collection + "&key=" + key + "&return=' . site_prefix() . '/index/cms-app";
} else {
if (f.elements[\'_return\'] && f.elements[\'_return\'].value.length > 0) {
window.location.href = "' . site_prefix() . '/index/cms-unlock-action?collection=" + collection + "&key=" + key + "&return=" + f.elements[\'_return\'].value;
} else {
window.location.href = "' . site_prefix() . '/index/cms-unlock-action?collection=" + collection + "&key=" + key + "&return=' . site_prefix() . '/index/news-app";
}
}
return false;
}
');
if (session_pref('form_help') == 'off') {
page_add_script('
formhelp_disable = true;
');
}
// add cancel handler
$this->widgets['submit_button']->buttons[0]->extra = 'onclick="onbeforeunload_form_submitted = true;"';
$this->widgets['submit_button']->buttons[1]->extra = 'onclick="return cms_cancel_unlock (this.form, \'' . $cgi->_collection . '\', \'' . $cgi->_key . '\')"';
// get copy from repository
loader_import('cms.Versioning.Rex');
$rex = new Rex($cgi->_collection);
$_document = $rex->getCurrent($cgi->_key);
// set values from repository entry
foreach (get_object_vars($_document) as $k => $v) {
if (is_object($this->widgets[$k])) {
$this->widgets[$k]->setValue($v);
}
}
}
示例8: SitepollCommentAddForm
function SitepollCommentAddForm()
{
parent::MailForm();
$this->parseSettings('inc/app/sitepoll/forms/comment/add/settings.php');
page_title(intl_get('Add Comment'));
if (session_valid()) {
$this->widgets['user_id']->setDefault(session_username());
}
global $cgi;
page_add_script('
function sitepoll_cancel (f) {
window.location.href = "' . site_prefix() . '/index/sitepoll-results-action/poll.' . $cgi->poll . '";
return false;
}
');
$this->widgets['submit_button']->buttons[1]->extra = 'onclick="return sitepoll_cancel (this.form)"';
}
示例9: rpc_init
/**
* Sets up the necessary javascript includes and such for using
* the /js/rpc.js package. See that package for more info.
*
* Usage:
*
* echo rpc_init ('javascript to handle server response here...');
*
* @param string
* @return string
* @package Misc
*/
function rpc_init($handler = 'return false', $render = false)
{
if ($render) {
$out = '<script language="javascript" type="text/javascript" src="' . site_prefix() . '/js/rpc.js"> </script>' . NEWLINE;
$out .= '<script language="javascript" type="text/javascript">' . NEWLINE;
$out .= '<!-- ' . NEWLINEx2;
$out .= 'rpc_handler = new Function ("' . str_replace(array("\n", "\r", '"'), array(' ', ' ', '\\"'), $handler) . '");' . NEWLINEx2;
$out .= '// -->' . NEWLINE . '</script>' . NEWLINE;
$out .= '<iframe id="rpc-caller" style="border: 0px none; width: 0px; height: 0px"> </iframe>';
return $out;
}
page_add_script(site_prefix() . '/js/rpc.js');
page_add_script('
rpc_handler = new Function ("' . str_replace(array("\n", "\r", '"'), array(' ', ' ', '\\"'), $handler) . '");
');
return '<iframe id="rpc-caller" style="border: 0px none; width: 0px; height: 0px"> </iframe>';
}
示例10: SiteforumPostForm
function SiteforumPostForm()
{
parent::MailForm();
page_title(intl_get('Post a Message'));
$this->parseSettings('inc/app/siteforum/forms/post/settings.php');
page_add_script('
function siteforum_preview (f) {
t = f.target;
a = f.action;
f.target = "_blank";
f.action = "' . site_prefix() . '/index/siteforum-post-preview-action";
f.submit ();
f.target = t;
f.action = a;
return false;
}
function siteforum_insert_tag (tag) {
e = document.getElementById ("siteforum-body");
if (tag == "a") {
e.value += "<a href=\\"http://\\"></a>";
} else {
e.value += "<" + tag + "></" + tag + ">";
}
return false;
}
');
global $cgi;
$this->widgets['submit_button']->buttons[1]->extra = 'onclick="return siteforum_preview (this.form)"';
$this->widgets['submit_button']->buttons[2]->extra = 'onclick="history.go (-1); return false"';
if (!empty($cgi->quote)) {
$obj = db_single('select * from siteforum_post where id = ?', $cgi->quote);
if (strpos($obj->subject, 'Re: ') !== 0) {
$obj->subject = 'Re: ' . $obj->subject;
}
$this->widgets['subject']->setValue($obj->subject);
$this->widgets['body']->setValue("<strong>" . $obj->user_id . " said:</strong>\n" . "<blockquote>" . $obj->body . "</blockquote>\n\n");
}
if (!session_admin()) {
$this->widgets['notice'] = new MF_Widget_hidden('notice');
$this->widgets['notice']->form =& $this;
$this->widgets['notice']->setValue('no');
}
}
示例11: DiggerCommentsEditForm
function DiggerCommentsEditForm()
{
parent::MailForm();
$this->parseSettings('inc/app/digger/forms/comments/edit/settings.php');
page_title(intl_get('Editing Comment'));
global $cgi;
$comment = db_single('select * from digger_comments where id = ?', $cgi->id);
$this->widgets['user']->setValue($comment->user);
$this->widgets['comment_date']->setValue($comment->comment_date);
$this->widgets['comments']->setValue($comment->comments);
$this->widgets['story']->setValue($comment->story);
page_add_script('
function digger_cancel (f) {
window.location.href = "' . site_prefix() . '/index/digger-comments-action/id.' . $cgi->story . '";
return false;
}
');
$this->widgets['submit_button']->buttons[1]->extra = 'onclick="return digger_cancel (this.form)"';
}
示例12: NewsCommentAddForm
function NewsCommentAddForm()
{
parent::MailForm();
$this->parseSettings('inc/app/news/forms/comment/add/settings.php');
page_title(intl_get('Add Comment'));
if (session_valid()) {
$this->widgets['user_id']->setDefault(session_username());
}
global $cgi;
page_add_script('
function news_cancel (f) {
window.location.href = "' . site_prefix() . '/index/news-app/story.' . $cgi->story_id . '";
return false;
}
');
$this->widgets['submit_button']->buttons[1]->extra = 'onclick="return news_cancel (this.form)"';
if (!appconf('comments_security')) {
unset($this->widgets['security_test']);
}
}
示例13: NewsCommentEditForm
function NewsCommentEditForm()
{
parent::MailForm();
$this->parseSettings('inc/app/news/forms/comment/edit/settings.php');
page_title(intl_get('Editing Comment'));
loader_import('news.Comment');
$c = new NewsComment();
global $cgi;
$comment = $c->get($cgi->id);
$this->widgets['subject']->setValue($comment->subject);
$this->widgets['user_id']->setValue($comment->user_id);
$this->widgets['body']->setValue($comment->body);
$this->widgets['story_id']->setValue($comment->story_id);
page_add_script('
function news_cancel (f) {
window.location.href = "' . site_prefix() . '/index/news-app/story.' . $cgi->story_id . '";
return false;
}
');
$this->widgets['submit_button']->buttons[1]->extra = 'onclick="return news_cancel (this.form)"';
}
示例14: SiteglossaryAddForm
function SiteglossaryAddForm()
{
parent::MailForm();
$this->parseSettings('inc/app/siteglossary/forms/add/settings.php');
page_title(intl_get('Adding Glossary Term'));
page_add_script('
function cms_cancel (f) {
if (arguments.length == 0) {
window.location.href = "/index/cms-app";
} else {
if (f.elements["_return"] && f.elements["_return"].value.length > 0) {
window.location.href = f.elements["_return"].value;
} else {
window.location.href = "/index/siteglossary-app";
}
}
return false;
}
');
// add cancel handler
$this->widgets['submit_button']->buttons[1]->extra = 'onclick="return cms_cancel (this.form)"';
}
示例15: XedFullscreenForm
function XedFullscreenForm()
{
parent::MailForm();
$this->parseSettings('inc/app/xed/forms/fullscreen/settings.php');
global $cgi;
page_onunload('xed_fullscreen_copy_value ()');
page_add_script('
function xed_fullscreen_copy_value (form, field) {
s = xed_get_source ("xeditor");
opener.document.getElementById ("' . $cgi->ifname . '").contentWindow.document.body.innerHTML = s;
window.close ();
}
');
page_add_style('
.content {
padding-right: 0px ! important;
padding-left: 0px ! important;
padding-top: 3px ! important;
padding-bottom: 5px ! important;
}
');
}