Exemple #1
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;
    }
Exemple #2
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;
        $this->extra .= ' size="35"';
        //$_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>&nbsp;&nbsp;</td>\n\t\t<td class=\"field\">" . '<table border="0" cellpadding="2" cellspacing="2"><tr><td valign="top">' . $_inner->display(0) . '</td></tr><td valign="top">' . $_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 mailto (f, e) {
						v = f.elements[\'MF_\' + e + \'_EXTERN\'].value;
						i = v.indexOf (\'mailto:\', 0);
						if (i >= 0) {
							return false;
						}
						f.elements[\'MF_\' + e + \'_EXTERN\'].value = \'mailto:\' + v;
						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;
					}

					var anchor_form = false;
					var anchor_element = false;
					dialogWin.scrollbars = \'yes\';
					dialogWin.resizable = \'yes\';
					function anchor (anchor_list) {
						params = \'\';
						sep = \'?\';
						for (i = 0; i < anchor_list.length; i++) {
							params += sep + anchor_list[i].name + \'=\' + anchor_list[i].value;
							sep = \'&\';
						}
						openDGDialog (
							\'{site/prefix}/index/xed-anchors-action\' + params,
							400,
							300,
							anchor_handler
						);
					}

					function go_anchors (f, e) {
						anchor_form = f;
						anchor_element = e;
						anchor_list = opener.document.getElementById (f.elements[\'ifname\'].value).xed_get_anchors (f.elements[\'ifname\'].value);
						anchor (anchor_list);
						return false;
					}

					function anchor_handler () {
						if (typeof dialogWin.returnedValue == \'object\') {
							a = dialogWin.returnedValue[\'src\'];
						} else {
							a = dialogWin.returnedValue;
						}
						anchor_form.elements[\'MF_\' + anchor_element + \'_EXTERN\'].value = \'#\' + a;
					}

				</script>

				{if obj.files}&nbsp;<a href="#" onclick="filechooser_get_file (document.forms[0], \'{name}\'); return false"><img src="{site/prefix}/inc/app/cms/pix/icons/files.gif" alt="{intl Files}" title="{intl Files}" border="0" /></a>{end if}
				{if obj.email}&nbsp;<a href="#" onclick="mailto (document.forms[0], \'{name}\'); return false"><img src="{site/prefix}/inc/app/cms/pix/icons/email.gif" alt="{intl Email}" title="{intl Email}" border="0" /></a>{end if}
				{if obj.bookmarks}&nbsp;<a href="#" onclick="bookmarks (document.forms[0], \'{name}\'); return false"><img src="{site/prefix}/inc/app/cms/pix/icons/bookmark-darker.gif" alt="{intl Bookmarks}" title="{intl Bookmarks}" border="0" /></a>{end if}
				{if obj.anchors}&nbsp;<a href="#" onclick="go_anchors (document.forms[0], \'{name}\'); return false"><img src="{site/prefix}/inc/app/cms/pix/icons/anchor.gif" alt="{intl Anchors}" title="{intl Anchors}" border="0" /></a>{end if}
				<!-- 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;
    }