Ejemplo n.º 1
0
 function onSubmit($vals)
 {
     $i = $vals['ifname'];
     $html = str_replace(array("'", "\r", "\n"), array('\\\'', '\\r', '\\n'), $vals['html']);
     unset($vals['ifname']);
     unset($vals['submit_button']);
     header('Content-Type: text/html; charset=' . intl_charset());
     echo template_simple('source_return.spt', array('ifname' => $i, 'html' => $html));
     exit;
 }
Ejemplo n.º 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)
    {
        $data = '';
        $attrstr = $this->getAttrs();
        if ($generate_html) {
            static $includedJS = false;
            if (!$includedJS) {
                $data .= '<link rel="stylesheet" type="text/css" href="' . site_prefix() . '/js/calendar/calendar-' . $this->style . '.css" />' . NEWLINE;
                page_add_script(site_prefix() . '/js/calendar/calendar.js');
                page_add_script(site_prefix() . '/js/calendar/lang/calendar-' . $this->lang . '.js');
                page_add_script(site_prefix() . '/js/calendar/calendar-setup.js');
                $includedJS = true;
            }
            $showsTime = $this->showsTime ? 'true' : 'false';
            $adv = $this->advanced ? ' class="advanced"' : '';
            $data .= '<tr' . $adv . '>
				<td class="label"' . $this->invalid() . '>
					<label for="' . $this->name . '">' . template_simple($this->label_template, $this, '', true) . '</label>
				</td>
				<td class="field">
					<input type="hidden" name="' . $this->name . '" id="mf-calendar-' . $this->name . '" value="' . htmlentities_compat($this->data_value, ENT_COMPAT, intl_charset()) . '" ' . $attrstr . ' ' . $this->extra . ' />
					<table border="0" cellpadding="3" cellspacing="0" width="100%">
						<tr>
							<td width="50%">
								<span id="mf-calendar-' . $this->name . '-display" style="font-weight: bold">' . $this->displayValue() . '</span>
							</td>
							<td width="50%">
								<input type="submit" id="mf-calendar-' . $this->name . '-trigger" value="' . intl_get('Select Date') . '" />' . '
								&nbsp;
								<input type="submit" value="' . intl_get('Clear') . '" onclick="this.form.elements[\'' . $this->name . '\'].value = \'\'; document.getElementById(\'mf-calendar-' . $this->name . '-display\').innerHTML = \'' . intl_get('No date selected.') . '\'; return false" />
							</td>
						</tr>
					</table>
				</td>
			</tr>
			<script language="javascript" type="text/javascript">
				Calendar.setup ({
					inputField	: "mf-calendar-' . $this->name . '",
					ifFormat	: "' . $this->format . '",
					displayArea	: "mf-calendar-' . $this->name . '-display",
					daFormat	: "' . $this->displayFormat . '",
					button		: "mf-calendar-' . $this->name . '-trigger",
					align		: "Bl",
					showsTime	: ' . $showsTime . ',
					timeFormat	: "' . $this->timeFormat . '"
				});
			</script>' . NEWLINEx2;
        } else {
            $showsTime = $this->showsTime ? 'true' : 'false';
            $data .= '<input type="text" name="' . $this->name . '" id="mf-calendar-' . $this->name . '" value="' . htmlentities_compat($this->data_value, ENT_COMPAT, $intl->charset) . '" ' . $attrstr . ' ' . $this->extra . ' />
					&nbsp;
					<input type="submit" id="mf-calendar-' . $this->name . '-trigger" value="' . intl_get('Select Date') . '" onclick="alert (\'We\\\'re sorry, but the calendar popup is not available in your browser at this time.\'); return false" />
				<script language="javascript" type="text/javascript">
				Calendar.setup (
					{
						inputField	: "mf-calendar-' . $this->name . '",	// ID of the input field
						ifFormat	: "' . $this->format . '",		// the date format
						button		: "mf-calendar-' . $this->name . '-trigger",	// ID of the button
						showsTime	: ' . $showsTime . ',
						timeFormat	: "' . $this->timeFormat . '"
					}
				);
			</script>' . NEWLINEx2;
        }
        return $data;
    }
Ejemplo n.º 3
0
 /**
  * Takes a string (to serialize into a file name), and returns its contents
  * in a string (for the purpose of passing on to the visitor).
  * 
  * @access	public
  * @param	string	$file
  * @return	string
  * 
  */
 function show($file = '')
 {
     $charset = intl_charset();
     if (!empty($charset)) {
         header('Content-Type: text/html; charset=' . intl_charset());
     }
     if (is_object($this->bdb)) {
         // use bdb
         if ($this->bdb->exists($file)) {
             return $this->bdb->fetch($file);
         }
     } elseif ($this->dir == 'mod:proxy') {
         //
     } elseif (is_object($this->fs)) {
         $file = $this->serialize($file);
         return $this->fs->get($file);
     } else {
         // use the fs
         if (empty($file)) {
             return '';
         }
         $file = $this->serialize($file);
         if (@file_exists($this->dir . '/' . $file)) {
             return join('', file($this->dir . '/' . $file));
         }
     }
 }