Example #1
0
    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);
        }
    }
Example #2
0
    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)"';
    }
Example #3
0
    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);
        }
    }
Example #4
0
    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);
    }
Example #5
0
 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);
 }
Example #6
0
    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)"';
    }
Example #7
0
    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);
            }
        }
    }
Example #8
0
    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)"';
    }
Example #9
0
/**
 * 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>';
}
Example #10
0
    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');
        }
    }
Example #11
0
    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)"';
    }
Example #12
0
    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']);
        }
    }
Example #13
0
    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)"';
    }
Example #14
0
    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)"';
    }
Example #15
0
    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;
			}
		');
    }
Example #16
0
function sitestreamer_flash($file, $width, $height, $fg = '0x444444', $bg = '0xAAAAAA')
{
    static $num = 0;
    $num++;
    if (@file_exists('inc/app/sitestreamer/lib/swfobject.js')) {
        $image = str_replace('.flv', '.jpg', $file);
        if (!@file_exists('inc/data' . $image)) {
            $image = '';
        }
        page_add_script(site_prefix() . '/inc/app/sitestreamer/lib/swfobject.js');
        return template_simple('<p align="center" class="sitestreamer-video" id="sitestreamer-video{num}"><a href="http://www.macromedia.com/go/getflashplayer">You need the Flash Player to watch this video.</a></p>
			<script type="text/javascript">
				var swfobj{num} = new SWFObject ("{site/prefix}/inc/app/sitestreamer/lib/player.swf", "sitestreamer-video", "{width}", "{height}", "9", "{bg}");
				swfobj{num}.addParam ("allowfullscreen","true");
				swfobj{num}.addParam ("flashvars", "file={site/prefix}/index/cms-filesystem-action{file}{if not empty (obj[image])}&image={site/prefix}/index/cms-filesystem-action{image}{end if}");
				swfobj{num}.write ("sitestreamer-video{num}");
			</script>', array('file' => $file, 'image' => $image, 'width' => $width, 'height' => $height, 'fg' => $fg, 'bg' => $bg, 'num' => $num));
    }
    sitestreamer_flvheader();
    $height += 40;
    return template_simple("<p align='center' class='sitestreamer-video'><object width='{width}' height='{height}' id='flvPlayer'>\r\n <param name='allowFullScreen' value='true'>\r\n <param name='movie' value='{site/prefix}/inc/app/sitestreamer/lib/player.swf?movie={site/prefix}/index/cms-filesystem-action{file}&fgcolor={fg}&bgcolor={bg}&volume=70'>\r\n <embed src='{site/prefix}/inc/app/sitestreamer/lib/player.swf?movie={site/prefix}/index/cms-filesystem-action{file}&fgcolor={fg}&bgcolor={bg}&volume=70' width='{width}' height='{height}' allowFullScreen='true' type='application/x-shockwave-flash'>\r\n</object></p>", array('file' => $file, 'width' => $width, 'height' => $height, 'fg' => $fg, 'bg' => $bg));
}
Example #17
0
    function SiteforumPostEditForm()
    {
        parent::MailForm();
        page_title(intl_get('Edit a Post'));
        $this->parseSettings('inc/app/siteforum/forms/post/edit/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"';
        loader_import('siteforum.Post');
        $p = new SiteForum_Post();
        $post = $p->get($cgi->id);
        $this->widgets['subject']->setValue($post->subject);
        $this->widgets['body']->setValue($post->body);
    }
Example #18
0
    function NewsAddForm()
    {
        parent::MailForm();
        global $page, $cgi;
        $this->parseSettings('inc/app/news/forms/add/settings.php');
        page_title(intl_get('Adding News Story'));
        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-app";
				} else {
					if (f.elements["_return"] && f.elements["_return"].value.length > 0) {
						window.location.href = f.elements["_return"].value;
					} else {
						window.location.href = "/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 (this.form)"';
    }
Example #19
0
// import any object we need from the global namespace
global $page, $menu;
// box logic begins here
if ($parameters['recursive'] == 'no') {
    $recur = false;
} else {
    $recur = true;
}
//page_id ('sitemap');
if ($context == 'action') {
    page_title(intl_get('Site Map'));
}
page_add_script(site_prefix() . '/js/jquery-1.2.3.min.js');
page_add_script(site_prefix() . '/js/jquery.cookie.js');
page_add_script(site_prefix() . '/js/jquery-treeview/jquery.treeview.min.js');
page_add_style(site_prefix() . '/js/jquery-treeview/jquery.treeview.css');
page_add_script('<script type="text/javascript">
$(function () {
	$("#sitemap").treeview ({
		animated: "medium",
		control: "#sidetreecontrol",
		persist: "location"
	});
});
</script>');
page_add_style('<style type="text/css">
ul#sitemap>li>a {
	font-weight: bold;
}
</style>');
echo preg_replace('/^<ul>/', '<ul id="sitemap" class="treeview-gray">', $menu->display('html', '<a href="{site/prefix}/index/{id}">{title}</a>', $recur));
Example #20
0
    /**
     * Returns the display HTML for this widget.  The optional
     * parameter determines whether or not to automatically display the widget
     * nicely, or whether to simply return the widget (for use in a template).
     * 
     * @access	public
     * @param	boolean	$generate_html
     * @return	string
     * 
     */
    function display($generate_html = 0)
    {
        $data = '';
        $attrstr = $this->getAttrs();
        $selected = explode(',', $this->data_value);
        loader_import('saf.Misc.RPC');
        echo rpc_init('return false');
        $this->size = false;
        $this->multiple = false;
        if ($this->size) {
            $multiple = ' size="' . $this->size . '"';
            $braces = '';
            if ($this->multiple) {
                $multiple = ' multiple="multiple"' . $multiple;
                $braces = '[]';
            }
        } else {
            $multiple = '';
            $braces = '';
        }
        loader_import('saf.GUI.Prompt');
        page_add_script('
			var cms_' . $this->name . '_form = false;
			var cms_' . $this->name . '_elem = false;
			var cms_' . $this->name . '_action = false;
			var cms_' . $this->name . '_oldhandler;

			//var rpc_handler = new Function ("if (arguments[0] == true) { if (cms_' . $this->name . '_action == \'add\') { cms_' . $this->name . '_add_item (); } else { cms_' . $this->name . '_remove_item (); } } else { if (cms_' . $this->name . '_action == \'add\') { cms_' . $this->name . '_add_alert (); } else { cms_' . $this->name . '_remove_alert (); } }");

			function cms_' . $this->name . '_add_item (res) {
				if (res == false) {
					cms_' . $this->name . '_add_alert ();
					return;
				}

				f = cms_' . $this->name . '_form;
				words = cms_' . $this->name . '_elem;

				// 2. add the selected keywords to the list
				for (i = 0; i < words.length; i++) {
					if (document.all) {
						f.elements[\'' . $this->name . $braces . '\'].options[f.elements[\'' . $this->name . $braces . '\'].options.length + 1] = new Option ("/" + words[i], words[i], false, true);
					} else {
						o = document.createElement (\'option\');
						o.text = words[i];
						o.value = words[i];
						f.elements[\'' . $this->name . $braces . '\'].add (o, null);
					}
				}

				rpc_handler = null;
				rpc_handler = cms_' . $this->name . '_oldhandler;
			}

			function cms_' . $this->name . '_remove_item (res) {
				if (res == false) {
					cms_' . $this->name . '_remove_alert ();
					return;
				}

				f = cms_' . $this->name . '_form;

				// 2. remove the selected keywords from the list
				for (i = f.elements[\'' . $this->name . $braces . '\'].options.length - 1; i >= 0; i--) {
					if (f.elements[\'' . $this->name . $braces . '\'].options[i].selected) {
						// remove
						if (document.all) {
							f.elements[\'' . $this->name . $braces . '\'].options.remove (i);
						} else {
							f.elements[\'' . $this->name . $braces . '\'].options[i] = null;
						}
						break;
					}
				}

				rpc_handler = null;
				rpc_handler = cms_' . $this->name . '_oldhandler;
			}

			function cms_' . $this->name . '_add_alert () {
				alert (\'Failed to add folder: Permission denied.  Please check your server permissions and try again.\');
			}

			function cms_' . $this->name . '_remove_alert () {
				alert (\'Failed to remove folder: Permission denied.  Please check that the selected folder is empty, and that your server permissions are correct, and try again.\');
			}

			function cms_' . $this->name . '_add (f) {
				cms_' . $this->name . '_form = f;

				// 0. collect our new items(s) from the user
				prompt (
					\'New folder(s) -- separate multiple with commas (one, two, three)\',
					\'\',
					function (word) {
						if (word == null || word.length == 0) {
							return false;
						}
						words = word.split (/, ?/);

						cms_' . $this->name . '_oldhandler = rpc_handler;
						rpc_handler = null;
						rpc_handler = cms_' . $this->name . '_add_item;

						// 1. call {site/prefix}/index/' . str_replace('/', '-', $this->addAction) . '-action in a popup
						cms_' . $this->name . '_form = f;
						cms_' . $this->name . '_elem = words;
						cms_' . $this->name . '_action = "add";

						rpc_handler = new Function ("if (arguments[0] == true) { if (cms_' . $this->name . '_action == \'add\') { cms_' . $this->name . '_add_item (); } else { cms_' . $this->name . '_remove_item (); } } else { if (cms_' . $this->name . '_action == \'add\') { cms_' . $this->name . '_add_alert (); } else { cms_' . $this->name . '_remove_alert (); } }");

						rpc_call (\'' . site_prefix() . '/index/' . str_replace('/', '-', $this->addAction) . '-action?path=' . $this->basedir . '&items=\' + word);
					}
				);

				// 3. cancel the click
				return false;
			}

			function cms_' . $this->name . '_remove (f) {
				// 0. collect the selected items from the "items" field
				word = \'\';
				sep = \'\';
				for (i = 0; i < f.elements[\'' . $this->name . $braces . '\'].options.length; i++) {
					if (f.elements[\'' . $this->name . $braces . '\'].options[i].selected) {
						word = word + sep + f.elements[\'' . $this->name . $braces . '\'].options[i].value;
						sep = \',\';
					}
				}

				// 0.1. confirm that they want to delete the selected list
				c = confirm (\'' . intl_get('Are you sure you want to remove this folder?') . '  \' + word);
				if (! c) {
					return false;
				}

				cms_' . $this->name . '_oldhandler = rpc_handler;
				rpc_handler = null;
				rpc_handler = cms_' . $this->name . '_remove_item;

				// 1. call {site/prefix}/index/' . str_replace('/', '-', $this->addAction) . '-action in a popup
				cms_' . $this->name . '_form = f;
				cms_' . $this->name . '_action = "remove";
				rpc_call (\'' . site_prefix() . '/index/' . str_replace('/', '-', $this->removeAction) . '-action?path=' . $this->basedir . '&items=\' + word);

				// 3. cancel the click
				return false;
			}
		');
        if ($generate_html) {
            $data .= '<tr>
				<td class="label"' . $this->invalid() . ' valign="top">
					<label for="' . $this->name . '" id="' . $this->name . '-label">' . template_simple($this->label_template, $this, '', true) . '</label>
				</td>
				<td class="field">
					<table border="0" cellpadding="3" cellspacing="0">
						<tr>
							<td valign="top">
					<select name="' . $this->name . $braces . '" ' . $multiple . $attrstr . ' ' . $this->extra . '>' . NEWLINE;
            foreach ($this->getList() as $k => $v) {
                $data .= TABx2 . TABx2 . TABx2 . '<option value="' . $k . '"';
                if (in_array($k, $selected)) {
                    $data .= ' selected="selected"';
                }
                $data .= '>' . $v . '</option>' . NEWLINE;
            }
            $data .= '</select>
							</td>
							<td valign="top" width="100%">
					<input type="submit" value="' . intl_get('Add') . '" onclick="return cms_' . $this->name . '_add (this.form)" /><br />
					<input type="submit" value="' . intl_get('Remove') . '" onclick="return cms_' . $this->name . '_remove (this.form)" />
							</td>
						</tr>
					</table>
				</td>
			</tr>' . NEWLINEx2;
        } else {
        }
        return $data;
    }
Example #21
0
<?php

loader_import('sitegallery.Functions');
if (session_admin()) {
    $acl = session_allowed_sql();
} else {
    $acl = session_approved_sql();
}
$res = db_fetch_array('select name, display_title, extension, description from sitellite_filesystem where path = ? and ' . $acl . ' order by name asc', $parameters['path']);
if ($parameters['title']) {
    if ($box['context'] == 'action') {
        page_title($parameters['title']);
    } else {
        echo '<h2>' . $parameters['title'] . '</h2>';
    }
}
$valid = appconf('valid');
foreach (array_keys($res) as $k) {
    if (!in_array(strtolower($res[$k]->extension), $valid)) {
        unset($res[$k]);
        continue;
    }
    $res[$k]->src = sitegallery_get_thumbnail($parameters['path'] . '/' . $res[$k]->name . '.' . $res[$k]->extension, true);
    //list ($res[$k]->width, $res[$k]->height) = getimagesize ('inc/data/' . $parameters['path'] . '/' . $res[$k]->name . '.' . $res[$k]->extension);
}
template_simple_register('results', $res);
page_add_script(site_prefix() . '/inc/app/sitegallery/js/prototype.js');
page_add_script(site_prefix() . '/inc/app/sitegallery/js/scriptaculous.js?load=effects');
page_add_script(site_prefix() . '/inc/app/sitegallery/js/lightbox.js');
page_add_style(site_prefix() . '/inc/app/sitegallery/html/lightbox.css');
echo template_simple('gallery.spt', array('path' => $parameters['path'], 'total' => count($res) + 1, 'desc' => $parameters['descriptions']));
Example #22
0
    /**
     * Returns the display HTML for this widget.  The optional
     * parameter determines whether or not to automatically display the widget
     * nicely, or whether to simply return the widget (for use in a template).
     * 
     * @access	public
     * @param	boolean	$generate_html
     * @return	string
     * 
     */
    function display($generate_html = 0)
    {
        parent::display($generate_html);
        if ($this->cols == '') {
            $this->cols = 60;
        }
        if ($this->rows == '') {
            $this->rows = 16;
        }
        if ($this->isHtml) {
            page_add_script('/js/tiny_mce/tiny_mce.js');
            page_add_script(template_simple('
				tinyMCE.init ({
					mode : "textareas",
					theme : "advanced",
					editor_selector : "tinyarea",
					plugins : "{tinyPlugins}",
					relative_urls : false,
					theme_advanced_buttons1 : "{tinyButtons1}",
					theme_advanced_buttons2 : "{tinyButtons2}",
					theme_advanced_buttons3 : "{tinyButtons3}",
					theme_advanced_toolbar_location : "top",
					theme_advanced_toolbar_align : "left",
					theme_advanced_path_location : "bottom",
					extended_valid_elements : "{tinyValidElements}"
				});
			', $this));
        }
        $this->attrstr = $this->getAttrs();
        $this->label = template_simple($this->label_template, $this, '', true);
        if ($generate_html) {
            if ($this->labelPosition == 'left') {
                return template_simple($this->_template_left, $this);
            }
            return template_simple($this->_template_top, $this);
        }
        return template_simple($this->_template_no_table, $this);
    }
Example #23
0
    function _link()
    {
        // display a button that pops up the pagechooser app
        static $included = false;
        if (!$included) {
            page_add_script(site_prefix() . '/js/dialog.js');
            page_add_script(site_prefix() . '/js/rpc.js');
            //page_add_script (loader_box ('wfolderbrowser/js', $this));
            //$included = true;
        }
        if ($this->limit) {
            $this->limit_str = 'yes';
        } else {
            $this->limit_str = '';
        }
        return template_simple('
			<script language="javascript" type="text/javascript">

				var prpc = new rpc ();

				var pagebrowser = {
					url: \'{site/prefix}/index/wffolderbrowser-rpc-action\',
					action: prpc.action,

					setTitle: function (id) {
						var pagechooser_{name}_id = id;
						prpc.call (
							this.action (\'getTrail\', [id, \'{limit_str}\', true]),
							function (request) {
								o = eval (request.responseText);
								txt = \'\';
								sep = \'\';
								if (o.length == 0 || (o.length == 1 && o[0].id == \'\')) {
									txt = \'root\';
								} else {
									for (i = 0; i < o.length; i++) {
										if (o[i].id == pagechooser_{name}_id) {
											txt += sep + o[i].title;
											sep = \' / \';
										} else {
											//txt += sep + \'<a href="#\' + o[i].id + \'" onclick="return pagechooser_{name}_handler_local (\\\'\' + o[i].id + \'\\\')">\' + o[i].title + \'</a>\';
											txt += sep + o[i].title;
											sep = \' / \';
										}
									}
								}
								document.getElementById (\'mf-pagechooser-{filter pagebrowser_filter_name}{name}{end filter}-display\').innerHTML = txt; // + \' / \' + pagechooser_{name}_id;
							}
						);
						return false;
					}
				}

				var pagechooser_{name}_form = false;
				var pagechooser_{name}_element = false;
				var pagechooser_{name}_attrs = false;
				dialogWin.scrollbars = \'yes\';
				dialogWin.resizable = \'yes\';
				
				function pagechooser_{name} () {
					openDGDialog (
						\'{site/prefix}/index/wffolderbrowser-app?id=\' + pagechooser_{name}_form.elements[pagechooser_{name}_element].value + \'&limit={limit_str}\',
						400,
						300,
						pagechooser_{name}_handler
					);
				}
				
				function pagechooser_{name}_get_page (f, e) {
					pagechooser_{name}_form = f;
					pagechooser_{name}_element = e;
					pagechooser_{name} ();
					return false;
				}

				function pagechooser_{name}_handler () {
					url = dialogWin.returnedValue;
					pagechooser_{name}_form.elements[pagechooser_{name}_element].value = url;
					pagebrowser.setTitle (url);
				}

				function pagechooser_{name}_handler_local (url) {
					if (! pagechooser_{name}_form) {
						pagechooser_{name}_form = document.forms[0];
						pagechooser_{name}_element = \'{name}\';
					}
					pagechooser_{name}_form.elements[pagechooser_{name}_element].value = url;
					return pagebrowser.setTitle (url);
				}

				function pagechooser_{name}_clear (f, e) {
					f.elements[e].value = \'\';
					pagebrowser.setTitle (\'\');
				}

			</script>

			<input type="submit" onclick="pagechooser_{name}_get_page (this.form, \'{name}\'); return false" value="{intl Browse...}" />
			<input type="submit" onclick="pagechooser_{name}_clear (this.form, \'{name}\'); return false" value="{intl Clear}" />
		', $this);
    }
Example #24
0
    function CmsEditSitellite_pageForm()
    {
        parent::MailForm();
        $this->autosave = true;
        global $page, $cgi;
        loader_import('ext.phpsniff');
        $sniffer = new phpSniff();
        $this->_browser = $sniffer->property('browser');
        $this->extra = 'id="cms-edit-form" onsubmit="xed_copy_value (this, \'body\')"';
        // include formhelp
        page_add_script(site_prefix() . '/js/formhelp-compressed.js');
        page_add_script('
			formhelp_prepend = \'<table border="0" cellpadding="0"><tr><td width="12" valign="top"><img src="' . site_prefix() . '/inc/app/cms/pix/arrow-10px.gif" alt="" border="0" /></td><td valign="top">\';
			formhelp_append = \'</td></tr></table>\';

			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;
			}

			function page_id () {
				f = document.forms[0];
				if (f.elements[\'id\'].value.length == 0) {
					sugg_id = f.elements[\'title\'].value.toLowerCase ();
					sugg_id = sugg_id.replace (/[àáâäå]/g, \'a\');
					sugg_id = sugg_id.replace (/[çč]/g, \'c\');
					sugg_id = sugg_id.replace (/[éèêëě]/g, \'e\');
					sugg_id = sugg_id.replace (/[íìîï]/g, \'i\');
					sugg_id = sugg_id.replace (/[ñ]/g, \'n\');
					sugg_id = sugg_id.replace (/[óòôöø]/g, \'o\');
					sugg_id = sugg_id.replace (/[úùûüů]/g, \'u\');
					sugg_id = sugg_id.replace (/[ÿ]/g, \'y\');
					sugg_id = sugg_id.replace (/[š]/g, \'s\');
					sugg_id = sugg_id.replace (/[ř]/g, \'r\');
					sugg_id = sugg_id.replace (/[ž]/g, \'z\');
					sugg_id = sugg_id.replace (/[ý]/g, \'y\');
					sugg_id = sugg_id.replace (/[á]/g, \'a\');
					sugg_id = sugg_id.replace (/[ť]/g, \'t\');
					sugg_id = sugg_id.replace (/[í]/g, \'i\');
					sugg_id = sugg_id.replace (/[ď]/g, \'d\');
					sugg_id = sugg_id.replace (/[ň]/g, \'n\');
					sugg_id = sugg_id.replace (/^[^a-z0-9_-]+/g, \'\');
					sugg_id = sugg_id.replace (/[^a-z0-9_-]+$/g, \'\');
					sugg_id = sugg_id.replace (/[^a-z0-9_-]+/g, \'-\');
					sugg_id = sugg_id.replace (/-+/g, \'-\');
					f.elements[\'id\'].value = sugg_id;
				}
			}

			function page_id_to_lower () {
				f = document.forms[0];
				f.elements[\'id\'].value = f.elements[\'id\'].value.toLowerCase ();
			}
		');
        if (session_pref('form_help') == 'off') {
            page_add_script('
				formhelp_disable = true;
			');
        }
        // get copy from repository
        loader_import('cms.Versioning.Rex');
        $rex = new Rex($cgi->_collection);
        // default: database, database
        $_document = $rex->getCurrent($cgi->_key);
        $w =& $this->addWidget('tab', 'tab1');
        $w->title = intl_get('Edit');
        // edit widgets go here
        $w =& $this->addWidget('hidden', '_key');
        $w =& $this->addWidget('hidden', '_collection');
        $w =& $this->addWidget('hidden', '_return');
        $w =& $this->addWidget('text', 'title');
        $w->alt = intl_get('Page Title');
        //$w->addRule ('not empty', 'You must enter a title for your page.');
        $help = addslashes(intl_get('The standard title of the web page, usually used in the content body as a top-level heading.'));
        $w->extra = 'size="40" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide (); page_id ()"';
        $w->setValue($_document->title);
        $w->length = 128;
        $w =& $this->addWidget('text', 'id');
        $w->alt = intl_get('Page ID');
        $w->addRule('not empty', 'You must enter an ID for your page.');
        $w->addRule('not regex "[^a-zA-Z0-9_-]"', 'Your page ID contains invalid characters.');
        $w->addRule('func "rex_unique_id_rule"', 'Your modified page ID already exists.');
        $w->addRule('func "cms_rule_no_actions"', 'Your page ID cannot end in -action, -app, or -form.');
        $help = addslashes(intl_get('The unique page identifier, used in the URL to request this page (ie. /index/page_id).  Must contain only letters, numbers, dashes, and underscores (ie. product_info).'));
        $w->extra = 'size="40" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide (); page_id_to_lower ()"';
        $w->setValue($cgi->_key);
        $w->length = 72;
        $w =& $this->addWidget('text', 'nav_title');
        $w->alt = intl_get('Title in Navigation');
        $help = addslashes(intl_get('This allows you to specify an alternate title to use when linking to this page.'));
        $w->extra = 'size="40" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"';
        $w->setValue($_document->nav_title);
        $w->length = 128;
        $w->advanced = true;
        $w =& $this->addWidget('text', 'head_title');
        $w->alt = intl_get('Window Title');
        $help = addslashes(intl_get('This allows you to specify an alternate title to use in the header of the document, which will appear in the top bar of the browser window.'));
        $w->extra = 'size="40" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"';
        $w->setValue($_document->head_title);
        $w->length = 128;
        $w->advanced = true;
        $w =& $this->addWidget('xed.Widget.Xeditor', 'body');
        if (appconf('tidy_path')) {
            $w->tidy_path = appconf('tidy_path');
        }
        $w->addRule('not empty', 'You must enter content into your page body.');
        $w->setValue($_document->body);
        //$w->length = 65535;
        // set page title
        if (empty($_document->title)) {
            page_title(intl_get('Editing Page') . ': ' . $_document->id);
        } else {
            page_title(intl_get('Editing Page') . ': ' . $_document->title);
        }
        $w =& $this->addWidget('tab', 'tab2');
        $w->title = intl_get('Properties');
        // property widgets go here
        $t =& $this->addWidget('section', 'section1');
        $t->title = intl_get('Display Settings');
        $t =& $this->addWidget('pagebrowser.Widget.Pagebrowser', 'below_page');
        $t->alt = intl_get('Location in Web Site');
        $t->setValue($_document->below_page);
        $help = addslashes(intl_get('Choose the page that this page should appear under in the hierarchy of the web site.'));
        $t->extra = 'id="below_page" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"';
        $t =& $this->addWidget('cms.Widget.Templates', 'template');
        $t->alt = intl_get('Display with Template');
        $t->setValue($_document->template);
        $help = addslashes(intl_get('Choose which template you want this page to be displayed with.  This changes the look and feel of the page.'));
        $t->extra = 'id="template" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"';
        $t =& $this->addWidget('select', 'include');
        $t->alt = intl_get('Include in Site Navigation?');
        $t->setValues(array('yes' => 'Yes', 'no' => 'No'));
        $t->setValue($_document->include);
        $help = addslashes(intl_get('This determines whether or not you want the page to appear in the web site menus and site maps.'));
        $t->extra = 'id="include" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"';
        $t->advanced = true;
        $t =& $this->addWidget('select', 'include_in_search');
        $t->alt = intl_get('Include in Search?');
        $t->setValues(array('yes' => 'Yes', 'no' => 'No'));
        $t->setValue($_document->include_in_search);
        $help = addslashes(intl_get('This determines whether or not you want the page to be indexed to appear in search results.'));
        $t->extra = 'id="include_in_search" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"';
        $t->advanced = true;
        $t =& $this->addWidget('text', 'sort_weight');
        $t->alt = intl_get('Sorting Weight');
        $t->setValue($_document->sort_weight);
        $help = addslashes(intl_get('This determines the position of the page within the web site menus and site maps.  Pages with a higher value appear closer to the top.  Pages with the same value are sorted alphabetically.'));
        $t->extra = 'id="sort_weight" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"';
        $t->advanced = true;
        $t =& $this->addWidget('select', 'is_section');
        $t->alt = intl_get('Is This a Section Index?');
        $t->setValues(array('yes' => 'Yes', 'no' => 'No'));
        $t->setValue($_document->is_section);
        $help = addslashes(intl_get('If you make this page a section index, then pages below it will adopt its template settings if theirs is not specified explicitly.  This allows you to give a consistent look and feel to entire sections of your web site.'));
        $t->extra = 'id="is_section" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"';
        $t->advanced = true;
        $t =& $this->addWidget('xed.Widget.Linker', 'external');
        $t->alt = intl_get('Forward to (URL)');
        $t->setValue($_document->external);
        $help = addslashes(intl_get('If you provide a link to an external web page or file (ie. a PDF or Word document), then this page can act as an alias for that resource within your web site navigation.'));
        $t->extra = 'size="40" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"';
        $t->length = 128;
        $t->advanced = true;
        $t->files = false;
        $t->anchors = false;
        $t->email = false;
        $t =& $this->addWidget('section', 'section3');
        $t->title = intl_get('Page Attributes');
        $t =& $this->addWidget('cms.Widget.Keywords', 'keywords');
        $t->alt = intl_get('Keywords');
        $t->setValue($_document->keywords);
        $help = addslashes(intl_get('Type in or select the keywords from the global list that describe the current page.  Keywords help target your page to its intended audience in search engines and site searches.'));
        $t->extra = 'id="keywords" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"';
        $t =& $this->addWidget('textarea', 'description');
        $t->alt = intl_get('Description');
        $t->setValue($_document->description);
        $t->rows = 3;
        $t->labelPosition = 'left';
        $help = addslashes(intl_get('A description helps target your page to its intended audience in search engines and site searches performed by visitors.'));
        $t->extra = 'id="description" style="overflow: hidden" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"';
        $w =& $this->addWidget('tab', 'tab3');
        $w->title = intl_get('State');
        // state widgets go here
        $t =& $this->addWidget('status', 'sitellite_status');
        $t->collection = 'sitellite_page';
        $t->alt = intl_get('Status');
        $t->setDefault('draft');
        $t->setValue($_document->sitellite_status);
        $help = addslashes(intl_get('The status determines what stage of its lifecycle that your document is in.  Only Approved pages can be viewed on the live site.  Queued pages are set to be approved on the specified Publish On date (below) by the scheduler.'));
        $t->extra = 'id="sitellite_status" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"';
        $t =& $this->addWidget('access', 'sitellite_access');
        $t->alt = intl_get('Access Level');
        $t->setValue($_document->sitellite_access);
        $help = addslashes(intl_get('The access level of a document determines who is allowed to view it.  This allows you to make portions of your site completely private, or only available to specific user roles (ie. members-only).'));
        $t->extra = 'id="sitellite_access" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"';
        $t =& $this->addWidget('calendar', 'sitellite_startdate');
        $t->alt = intl_get('Publish On (If Status is "Queued")');
        $t->nullable = true;
        $t->showsTime = true;
        $t->format = '%Y-%m-%d %H:%M:%S';
        $t->displayFormat = '%a, %e %b, %Y - %l:%M%P';
        $t->setValue($_document->sitellite_startdate);
        $t->advanced = true;
        $t =& $this->addWidget('calendar', 'sitellite_expirydate');
        $t->alt = intl_get('Archive On (If Status is "Approved")');
        $t->nullable = true;
        $t->showsTime = true;
        $t->format = '%Y-%m-%d %H:%M:%S';
        $t->displayFormat = '%a, %e %b, %Y - %l:%M%P';
        $t->setValue($_document->sitellite_expirydate);
        $t->advanced = true;
        $t =& $this->addWidget('owner', 'sitellite_owner');
        $t->alt = intl_get('Created By');
        $t->setValue($_document->sitellite_owner);
        $t->advanced = true;
        $t =& $this->addWidget('team', 'sitellite_team');
        $t->alt = intl_get('Owned by Team');
        $t->setValue($_document->sitellite_team);
        $t->extra = 'id="sitellite_team"';
        $t->advanced = true;
        $t =& $this->addWidget('textarea', 'changelog');
        $t->alt = intl_get('Change Summary');
        $t->rows = 3;
        $t->labelPosition = 'left';
        $help = addslashes(intl_get('The change summary helps give other site editors, including yourself, a more complete history of the changes that have been made to this page.'));
        $t->extra = 'id="changelog" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"';
        $w =& $this->addWidget('tab', 'tab-end');
        // submit buttons
        $w =& $this->addWidget('msubmit', 'submit_button');
        $b =& $w->getButton();
        $b->setValues(intl_get('Save'));
        $b->extra = 'onclick="onbeforeunload_form_submitted = true"';
        $b =& $w->addButton('submit_button', intl_get('Preview'));
        $b->extra = 'onclick="return cms_preview (this.form)"';
        $b =& $w->addButton('submit_button', intl_get('Cancel'));
        $b->extra = 'onclick="return cms_cancel_unlock (this.form, \'' . urlencode($cgi->_collection) . '\', \'' . urlencode($cgi->_key) . '\')"';
        $this->error_mode = 'all';
    }
Example #25
0
    function CmsAddSitellite_sidebarForm()
    {
        parent::MailForm();
        page_title(intl_get('Adding Sidebar'));
        global $page, $cgi;
        loader_import('ext.phpsniff');
        $sniffer = new phpSniff();
        $this->_browser = $sniffer->property('browser');
        $this->extra = 'id="cms-edit-form" onsubmit="xed_copy_value (this, \'body\')"';
        // include formhelp
        page_add_script(site_prefix() . '/js/formhelp-compressed.js');
        page_add_script('
			formhelp_prepend = \'<table border="0" cellpadding="0"><tr><td width="12" valign="top"><img src="' . site_prefix() . '/inc/app/cms/pix/arrow-10px.gif" alt="" border="0" /></td><td valign="top">\';
			formhelp_append = \'</td></tr></table>\';

			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;
			');
        }
        $w =& $this->addWidget('tab', 'tab1');
        $w->title = intl_get('Edit');
        // edit widgets go here
        $w =& $this->addWidget('text', 'id');
        $w->alt = intl_get('Sidebar ID');
        $w->addRule('not empty', 'You must enter an ID for your sidebar.');
        $w->addRule('not regex "[^a-zA-Z0-9_-]"', 'Your ID contains invalid characters.');
        $w->addRule('unique "sitellite_sidebar/id"', 'A sidebar with this ID already exists.');
        $help = addslashes(intl_get('Must contain only letters, numbers, underscores, and dashes (ie. product_info).'));
        $w->extra = 'onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"';
        $w->length = 32;
        $w =& $this->addWidget('hidden', 'collection');
        $w =& $this->addWidget('hidden', '_return');
        $w =& $this->addWidget('text', 'title');
        $w->alt = intl_get('Sidebar Title');
        //$w->addRule ('not empty', 'You must enter a title for your sidebar.');
        $w->extra = 'size="40"';
        $w->length = 72;
        $w =& $this->addWidget('xed.Widget.Xeditor', 'body');
        if (appconf('tidy_path')) {
            $w->tidy_path = appconf('tidy_path');
        }
        //$w->addRule ('not empty', 'You must enter content into your sidebar body.');
        $w->length = 65535;
        $w =& $this->addWidget('tab', 'tab2');
        $w->title = intl_get('Properties');
        // property widgets go here
        //$t =& $this->addWidget ('section', 'section1');
        //$t->title = intl_get ('Display Settings');
        $res = db_fetch('select * from sitellite_sidebar_position order by id asc');
        if (!$res) {
            $res = array('left' => intl_get('Left'));
        } elseif (is_object($res)) {
            $res = array($res->id => ucwords($res->id));
        } else {
            $n = array();
            foreach ($res as $row) {
                $n[$row->id] = ucwords($row->id);
            }
            $res = $n;
        }
        $t =& $this->addWidget('cms.Widget.Position', 'position');
        $t->alt = intl_get('Position');
        $t->setValues($res);
        $help = addslashes(intl_get('Choose the position where you want this sidebar to appear.'));
        $t->extra = 'id="position" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"';
        $t =& $this->addWidget('text', 'sorting_weight');
        $t->alt = intl_get('Sorting Order');
        global $cgi;
        if ($cgi->position) {
            $t->setDefault((string) db_shift('select sorting_weight + 1 from sitellite_sidebar where position = ? order by sorting_weight desc limit 1', $cgi->position));
        } else {
            $t->setDefault((string) db_shift('select sorting_weight + 1 from sitellite_sidebar order by sorting_weight desc limit 1'));
        }
        $help = addslashes(intl_get('The larger the number, the further down the list of sidebars in the same position the current sidebar will appear.'));
        $t->extra = 'id="sorting_weight" style="width: 50px" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"';
        $t->advanced = true;
        loader_box('sitellite/nav/init');
        $t =& $this->addWidget('multiple', 'show_on_pages');
        $t->alt = intl_get('Show in Sections');
        $t->setValues(array_merge(array('all' => intl_get('All')), menu_get_sections()));
        $help = addslashes(intl_get('Choose the web site sections where you want this sidebar to appear. Ctrl-click to select more than one section.'));
        $t->extra = 'id="show_on_pages" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"';
        $t->size = 5;
        $t =& $this->addWidget('boxchooser.Widget.Boxchooser', 'alias');
        $t->alt = intl_get('Alias of (a box name)');
        $help = addslashes(intl_get('This allows you to specify the name of a box that will provide the contents of this sidebar.'));
        $t->extra = 'id="alias" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"';
        $t->length = 255;
        $t->advanced = true;
        $w =& $this->addWidget('tab', 'tab3');
        $w->title = intl_get('State');
        // state widgets go here
        $t =& $this->addWidget('status', 'sitellite_status');
        $t->alt = intl_get('Status');
        $t->setValue('draft');
        $help = addslashes(intl_get('The status determines what stage of its lifecycle that your document is in.  Only Approved items can be viewed on the live site.  Queued items are set to be approved on the specified Publish On date (below) by the scheduler.'));
        $t->extra = 'id="sitellite_status" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"';
        $t =& $this->addWidget('access', 'sitellite_access');
        $t->alt = intl_get('Access Level');
        $t->setValue('public');
        $help = addslashes(intl_get('The access level of a document determines who is allowed to view it.  This allows you to make portions of your site completely private, or only available to specific user roles (ie. members-only).'));
        $t->extra = 'id="sitellite_access" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"';
        $t =& $this->addWidget('calendar', 'sitellite_startdate');
        $t->alt = intl_get('Publish On (If Status is "Queued")');
        $t->nullable = true;
        $t->showsTime = true;
        $t->format = '%Y-%m-%d %H:%M:%S';
        $t->displayFormat = '%a, %e %b, %Y - %l:%M%P';
        $t->advanced = true;
        $t =& $this->addWidget('calendar', 'sitellite_expirydate');
        $t->alt = intl_get('Archive On (If Status is "Approved")');
        $t->nullable = true;
        $t->showsTime = true;
        $t->format = '%Y-%m-%d %H:%M:%S';
        $t->displayFormat = '%a, %e %b, %Y - %l:%M%P';
        $t->advanced = true;
        $t =& $this->addWidget('owner', 'sitellite_owner');
        $t->alt = intl_get('Created By');
        $t->setValue(session_username());
        $t->advanced = true;
        $t =& $this->addWidget('team', 'sitellite_team');
        $t->alt = intl_get('Owned by Team');
        $t->setValue(session_team());
        $t->extra = 'id="sitellite_team"';
        $t->advanced = true;
        $t =& $this->addWidget('textarea', 'changelog');
        $t->alt = intl_get('Change Summary');
        $t->rows = 3;
        $t->labelPosition = 'left';
        $help = addslashes(intl_get('The change summary helps give other site editors, including yourself, a more complete history of the changes that have been made to this item.'));
        $t->extra = 'id="changelog" onfocus="formhelp_show (this, \'' . $help . '\')" onblur="formhelp_hide ()"';
        $t->setValue('Sidebar added.');
        $w =& $this->addWidget('tab', 'tab-end');
        // submit buttons
        $w =& $this->addWidget('msubmit', 'submit_button');
        $b =& $w->getButton();
        $b->setValues(intl_get('Create'));
        $b->extra = 'onclick="onbeforeunload_form_submitted = true"';
        //$b =& $w->addButton ('submit_button', intl_get ('Preview'));
        //$b->extra = 'onclick="return cms_preview (this.form)"';
        $b =& $w->addButton('submit_button', intl_get('Cancel'));
        $b->extra = 'onclick="return cms_cancel (this.form)"';
        $this->error_mode = 'all';
    }
Example #26
0
}
sort($data['subfolders']);
usort($data['images'], 'image_sort');
if (!is_writeable(site_docroot() . $data['location'])) {
    $data['writeable'] = false;
} else {
    $data['writeable'] = true;
}
if (!session_allowed('imagechooser_delete', 'rw', 'resource')) {
    $data['delete'] = false;
} else {
    $data['delete'] = true;
}
if (session_get('imagechooser_err')) {
    $data['err'] = session_get('imagechooser_err');
    session_set('imagechooser_err', null);
}
if (session_get('imagechooser_pagelist')) {
    $data['pagelist'] = session_get('imagechooser_pagelist');
    session_set('imagechooser_pagelist', null);
}
page_add_script(site_prefix() . '/js/dialog.js');
page_add_script(template_simple('js.spt'));
function output_options($name)
{
    $info = pathinfo($name);
    return '{&quot;filetype&quot;: &quot;' . strtolower($info['extension']) . '&quot;}';
}
// show me the money
template_simple_register('cgi', $cgi);
echo template_simple('admin.spt', $data);
Example #27
0
<?php

if (session_admin()) {
    $acl = session_allowed_sql();
} else {
    $acl = session_approved_sql();
}
$res = db_fetch_array('select name, display_title, extension, description from sitellite_filesystem where path = ? and ' . $acl . ' order by name asc', $parameters['path']);
$valid = appconf('valid');
foreach (array_keys($res) as $k) {
    if (!in_array(strtolower($res[$k]->extension), $valid)) {
        unset($res[$k]);
    }
}
if ($parameters['title']) {
    if ($box['context'] == 'action') {
        page_title($parameters['title']);
    } else {
        echo '<h2>' . $parameters['title'] . '</h2>';
    }
}
page_add_script(site_prefix() . '/js/rollover.js');
template_simple_register('results', $res);
template_simple_register('first', array_shift($res));
echo template_simple('slideshow.spt', array('path' => $parameters['path'], 'total' => count($res) + 1, 'desc' => $parameters['descriptions'], 'delay' => $parameters['delay']));
Example #28
0
    /**
     * Returns the display HTML for this widget.  The optional
     * parameter determines whether or not to automatically display the widget
     * nicely, or whether to simply return the widget (for use in a template).
     * 
     * @access	public
     * @param	boolean	$generate_html
     * @return	string
     * 
     */
    function display($generate_html = 0)
    {
        $data = '';
        $attrstr = $this->getAttrs();
        $selected = explode(',', $this->data_value);
        page_add_script('
			function cms_recipient_add (f) {
				user = f.elements[\'' . $this->name . '_users\'].options[f.elements[\'' . $this->name . '_users\'].selectedIndex].value;
				if (user.length == 0) {
					user = f.elements[\'' . $this->name . '_email\'].value;
					if (user.length == 0) {
						return false;
					}
					name = user;
				} else {
					name = f.elements[\'' . $this->name . '_users\'].options[f.elements[\'' . $this->name . '_users\'].selectedIndex].text;
				}

				// 2. add the selected user to the list
				if (document.all) {
					f.elements[\'' . $this->name . '[]\'].options[f.elements[\'' . $this->name . '[]\'].options.length] = new Option (name, user, false, false);
				} else {
					o = document.createElement (\'option\');
					o.text = name;
					o.value = user;
					f.elements[\'' . $this->name . '[]\'].add (o, null);
				}

				f.elements[\'' . $this->name . '_users\'].selectedIndex = null;

				f.elements[\'' . $this->name . '_email\'].value = \'\';

				// 3. cancel the click
				return false;
			}

			function cms_recipient_remove (f) {
				for (i = f.elements[\'' . $this->name . '[]\'].options.length - 1; i >= 0; i--) {
					if (f.elements[\'' . $this->name . '[]\'].options[i].selected) {
						// remove
						if (document.all) {
							f.elements[\'' . $this->name . '[]\'].options.remove (i);
						} else {
							f.elements[\'' . $this->name . '[]\'].options[i] = null;
						}
					}
				}

				return false;
			}

			function cms_recipient_select_all (f) {
				for (i = 0; i < f.elements[\'' . $this->name . '[]\'].options.length; i++) {
					f.elements[\'' . $this->name . '[]\'].options[i].selected = true;
				}
			}
		');
        if ($generate_html) {
            global $cgi;
            $users = $this->getUsers();
            if (is_array($cgi->{$this->name})) {
                $list = $cgi->{$this->name};
            } else {
                $list = array();
            }
            $data .= '<tr>
				<td class="label"' . $this->invalid() . ' valign="top">
					<label for="' . $this->name . '" id="' . $this->name . '-label">' . template_simple($this->label_template, $this, '', true) . '</label>
				</td>
				<td class="field">
					<table border="0" cellpadding="3" cellspacing="0">
						<tr>
							<td valign="top">
					<select name="' . $this->name . '[]" multiple="multiple" size="5" ' . $attrstr . ' ' . $this->extra . '>' . NEWLINE;
            foreach ($list as $value) {
                $data .= TABx2 . TABx2 . TABx2 . '<option value="' . $value . '"';
                if (isset($users[$value])) {
                    $data .= '>' . $users[$value] . '</option>' . NEWLINE;
                } else {
                    $data .= '>' . $value . '</option>' . NEWLINE;
                }
            }
            $data .= '</select>
							</td>
							<td valign="top">
					<table cellpadding="3" cellspacing="1" border="0">
					<tr><td>User</td><td><select name="' . $this->name . '_users">
						<option value="">- ' . intl_get('SELECT') . ' -</option>' . NEWLINE;
            foreach ($users as $user => $name) {
                if ($user == session_username()) {
                    continue;
                }
                $data .= TABx2 . TABx2 . TABx2 . '<option value="' . $user . '"';
                $data .= '>' . $name . '</option>' . NEWLINE;
            }
            $data .= '</select></td></tr>
					<tr><td>Email</td><td><input type="text" name="' . $this->name . '_email" size="10" /> <input type="submit" value="' . intl_get('Add') . '" onclick="return cms_recipient_add (this.form)" /></td></tr>
					</table><br />
					<input type="submit" value="' . intl_get('Remove Selected') . '" onclick="return cms_recipient_remove (this.form)" />
							</td>
						</tr>
					</table>
				</td>
			</tr>' . NEWLINEx2;
        } else {
        }
        return $data;
    }
Example #29
0
    function _link()
    {
        // display a button that pops up the filechooser app
        static $included = false;
        if (!$included) {
            page_add_script(site_prefix() . '/js/dialog.js');
            page_add_script(loader_box('filechooser/js'));
            $included = true;
        }
        return template_simple('
			<script language="javascript" type="text/javascript">

				function filechooser_handler () {
					if (typeof dialogWin.returnedValue == \'object\') {
						url = \'{site/url}\' + dialogWin.returnedValue[\'src\'];
					} else {
						url = \'{site/url}\' + dialogWin.returnedValue;
					}
					filechooser_form.elements[filechooser_element].value = url;
				}

				function filechooser_view_current (src) {
					if (src.length > 0) {
						filechooser_view (src);
					}
					return false;
				}

			</script>

			{if obj.view_current}
			<input type="submit" onclick="return filechooser_view_current (this.form.elements[\'{name}\'].value)" value="{intl View Current}" />
			{end if}
			<input type="submit" onclick="filechooser_get_file (this.form, \'{name}\'); return false" value="{intl Choose}" />
		', $this);
    }
Example #30
0
    /**
     * Returns the display HTML for this widget.  The optional
     * parameter determines whether or not to automatically display the widget
     * nicely, or whether to simply return the widget (for use in a template).
     * 
     * @access	public
     * @param	boolean	$generate_html
     * @return	string
     * 
     */
    function display($generate_html = 0)
    {
        $_inner = new MF_Widget_pagebrowser('MF_' . $this->name . '_INNER');
        //$_inner->nullable = $this->nullable;
        //$_inner->table = 'sitellite_page';
        //$_inner->primary_key = 'id';
        //$_inner->display_column = 'if(nav_title != "", nav_title, if(title != "", title, id))';
        //$_inner->ref_column = 'below_page';
        //$_inner->self_ref = true;
        //$_inner->addblank = true;
        $_inner->alt = intl_get('Internal');
        $_inner->data_value = $this->data_value_INNER;
        $_extern = new MF_Widget_text('MF_' . $this->name . '_EXTERN');
        $_extern->nullable = $this->nullable;
        $_extern->alt = intl_get('External');
        $_extern->data_value = $this->data_value_EXTERN;
        //$_inner->extra = $this->extra;
        $_extern->extra = $this->extra;
        $_page = new MF_Widget_hidden($this->name);
        if ($generate_html) {
            page_add_script(site_prefix() . '/js/dialog.js');
            page_add_script(loader_box('filechooser/js'));
            $data = $_page->display(0) . "\n";
            $data .= "\t<tr>\n\t\t<td class=\"label\" valign=\"top\"><label for=\"" . $this->name . '" id="' . $this->name . '-label" ' . $this->invalid() . '>' . template_simple($this->label_template, $this, '', true) . "</label></td>\n\t\t<td class=\"field\">" . '<table border="0" cellpadding="2" cellspacing="2"><tr><td>' . intl_get('Internal') . '</td><td>' . $_inner->display(0) . '</td></tr><td>' . intl_get('External') . '</td><td>' . $_extern->display(0);
            $data .= template_simple('
				<script language="javascript" type="text/javascript">

					function filechooser_handler () {
						if (typeof dialogWin.returnedValue == \'object\') {
							url = \'{site/prefix}\' + dialogWin.returnedValue[\'src\'];
						} else {
							url = \'{site/prefix}\' + dialogWin.returnedValue;
						}
						filechooser_form.elements[\'MF_\' + filechooser_element + \'_EXTERN\'].value = url;
					}

					var bookmark_form = false;
					var bookmark_element = false;
					dialogWin.scrollbars = \'yes\';
					dialogWin.resizable = \'yes\';
					function bookmark () {
						openDGDialog (
							\'{site/prefix}/index/xed-bookmarks-action\',
							400,
							300,
							bookmark_handler
						);
					}

					function bookmarks (f, e) {
						bookmark_form = f;
						bookmark_element = e;
						bookmark ();
						return false;
					}

					function bookmark_handler () {
						if (typeof dialogWin.returnedValue == \'object\') {
							url = dialogWin.returnedValue[\'src\'];
						} else {
							url = dialogWin.returnedValue;
						}
						bookmark_form.elements[\'MF_\' + bookmark_element + \'_EXTERN\'].value = url;
					}

				</script>

				<input type="submit" onclick="bookmarks (this.form, \'{name}\'); return false" value="{intl Bookmarks}" />
				<input type="submit" onclick="filechooser_get_file (this.form, \'{name}\'); return false" value="{intl Files}" />
			', $this);
            $data .= '</td></tr></table>' . "</td>\n\t</tr>\n";
        } else {
            $data = $_page->display(0);
            $data .= $_inner->display(0) . '<br />' . $_extern->display(0);
        }
        return $data;
    }