function toggle() { // switch browse level if (session_pref('browse_level') == 'normal') { session_pref_set('browse_level', 'advanced'); } else { session_pref_set('browse_level', 'normal'); } return true; }
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)"'; }
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); } } }
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)"'; }
/** * Returns the preferred language of the current visitor. * If the $method is 'http' then it uses the HTTP Accept-Language * string for this info. If the $method is 'cookie' it uses a * cookie (specified by the $cookieName property) to determine, * if the $method is 'session' it relies on the global * $session object, and if the $method is 'url' then it uses the * start of the URL to determine the language (e.g., /fr/ or /en/). * Default is 'http'. * * @access public * @param string $method * @return string * */ function negotiate($method = 'http') { if ($method == 'http') { $accepted = array(); $keys = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']); foreach ($keys as $lang) { // remove trailing ";q=" data if ($pos = strpos($lang, ';')) { $lang = trim(substr($lang, 0, $pos)); } // check for country code if ($pos = strpos($lang, '-')) { list($lang, $cn) = explode('-', $lang); if ($lang == 'i') { $lang = $cn; unset($cn); } if (isset($cn)) { if (is_array($accepted[$lang])) { $accepted[$lang][] = $cn; } else { $accepted[$lang] = array($cn); } } elseif (!is_array($accepted[$lang])) { $accepted[$lang] = array(''); } } else { if (is_array($accepted[$lang])) { $accepted[$lang][] = ''; } else { $accepted[$lang] = array(''); } } } foreach ($accepted as $lang => $cnlist) { foreach ($cnlist as $cn) { if (!empty($cn)) { $name = $lang . '-' . $cn; } else { $name = $lang; } if (isset($this->languages[$name])) { // found return $name; } } } } elseif ($method == 'cookie') { // use a cookie (see $cookieName property) global $cookie; if (isset($cookie->{$this->cookieName}) && isset($this->languages[$cookie->{$this->cookieName}])) { return $cookie->{$this->cookieName}; } } elseif ($method == 'session') { // use $session->lang $lang = session_pref('lang'); if (isset($lang) && isset($this->languages[$lang])) { return $lang; } } elseif ($method == 'url') { // use /en/ or /fr/ to set language global $conf; $parts = parse_url($_SERVER['REQUEST_URI']); list($root, $null) = explode('/index', $parts['path']); $root = trim($root, '/'); if (!empty($root)) { $list = explode('/', $root); $lang = array_shift($list); if (isset($this->languages[$lang])) { //$conf['Site']['level']++; $this->url_increase_level = true; return $lang; } } } return $this->default; }
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'; }
<?php global $cgi; if (empty($cgi->collection)) { header('Location: ' . site_prefix() . '/index/cms-cpanel-action'); exit; } loader_import('cms.Versioning.Rex'); loader_import('saf.GUI.Pager'); //loader_import ('saf.Misc.TableHeader'); //loader_import ('cms.Versioning.Facets'); $limit = session_pref('browse_limit'); if (!isset($cgi->offset)) { $cgi->offset = 0; } $data = array('collection' => $cgi->collection); $rex = new Rex($cgi->collection); if (!$rex->collection) { header('Location: ' . site_prefix() . '/index/cms-cpanel-action'); exit; } // get access control $struct = array_keys($rex->getStruct()); $acl = array(); if (!$struct) { $struct = array(); } else { $acl_list = session_allowed_access_list(); if (!in_array('all', $acl_list)) { foreach ($struct as $k) { if ($k == 'sitellite_access') {
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'; }
<p><a href="{site/prefix}/index" target="_top">{intl Browse your web site.}</a></p>'); return; } elseif ($cgi->refreshed == 'true') { // any drafts? if ($cgi->skip_drafts != 'true') { loader_import('saf.MailForm.Autosave'); $a = new Autosave(); $list = $a->retrieve_all(); if (count($list) > 0) { loader_import('cms.Filters'); page_title(intl_get('Previous Drafts Found')); echo template_simple('autosave_login.spt', $list); return; } } if (!empty($cgi->forward)) { header('Location: ' . base64_decode($cgi->forward)); exit; } if (session_pref('start_page') == 'web view') { header('Location: ' . site_prefix() . '/index'); exit; } else { header('Location: ' . site_prefix() . '/index/cms-cpanel-action'); exit; } } else { header('Location: ' . site_prefix() . '/index/cms-app'); exit; } // unused below now...
function CmsEditSitellite_filesystemForm() { parent::MailForm(); $this->autosave = true; $this->parseSettings('inc/app/cms/forms/edit/sitellite_filesystem/settings.php'); global $page, $cgi; page_title(intl_get('Editing File') . ': ' . $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; } 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; '); } // add cancel handler $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 $info = pathinfo($_document->name); if ($info['dirname'] == '.') { $info['dirname'] = ''; } $_document->folder = $info['dirname']; $_document->file = $_document->name; unset($_document->name); foreach (get_object_vars($_document) as $k => $v) { if (is_object($this->widgets[$k])) { $this->widgets[$k]->setValue($v); } } /*if ($rex->determineAction ($cgi->_key) != 'modify') { // turn name field into hidden w/ _key's value $this->widgets['name'] =& $this->widgets['name']->changeType ('info'); $this->widgets['name']->setValue (basename ($cgi->_key)); $this->widgets['folder'] =& $this->widgets['folder']->changeType ('info'); $this->widgets['folder']->setValue (dirname ($cgi->_key)); }*/ }
function DataGrid($collection, $fields, $limit = false) { if (!$limit) { $limit = session_pref('browse_limit'); if (!$limit) { $limit = 10; } } $this->limit = $limit; $this->collection = $collection; $this->fields = $fields; }
/** * Creates a widget from a name and an array, usually taken from a parsed * settings.php (ini formatted) file. * * @access public * @param string * @param array hash */ function &createWidget($name, $data) { // create widget $type = $data['type']; unset($data['type']); $widget =& $this->addWidget($type, $name); // handle setValues if (!empty($data['setValues'])) { if (strpos($data['setValues'], 'eval:') === 0) { eval(CLOSE_TAG . OPEN_TAG . ' $widget->setValues (' . substr($data['setValues'], 5) . '); ' . CLOSE_TAG); } elseif (preg_match('/, ?/', $data['setValues'])) { $widget->setValues(preg_split('/, ?/', $data['setValues'])); // eval (CLOSE_TAG . OPEN_TAG . ' $widget->setValues (array (' . $data['setValues'] . ')); ' . CLOSE_TAG); } else { if (strpos($data['setValues'], '\'') === 0 && strrpos($data['setValues'], '\'') == strlen($data['setValues']) - 1) { $data['setValues'] = substr($data['setValues'], 1, strlen($data['setValues']) - 2); } $widget->setValues($data['setValues']); } // eval (CLOSE_TAG . OPEN_TAG . ' $widget->setValues (' . $data['setValues'] . '); ' . CLOSE_TAG); } unset($data['setValues']); if (!empty($data['setDefault'])) { if (strpos($data['setDefault'], 'eval:') === 0) { eval(CLOSE_TAG . OPEN_TAG . ' $widget->setDefault (' . substr($data['setDefault'], 5) . '); ' . CLOSE_TAG); } else { $widget->setDefault($data['setDefault']); } } if (!empty($data['setValue'])) { if (strpos($data['setValue'], 'eval:') === 0) { eval(CLOSE_TAG . OPEN_TAG . ' $widget->setValue (' . substr($data['setValue'], 5) . '); ' . CLOSE_TAG); } else { $widget->setValue($data['setValue']); } } if (!empty($data['setRules'])) { if (strpos($data['setRules'], 'eval:') === 0) { eval(CLOSE_TAG . OPEN_TAG . ' $widget->rules = ' . substr($data['setRules'], 5) . '); ' . CLOSE_TAG); } } // handle rules //foreach (preg_split ('/, ?/', $data['rules'], -1, PREG_SPLIT_NO_EMPTY) as $rule) { // $widget->addRule ($rule); //} //unset ($data['rules']); // widget properties foreach ($data as $key => $value) { if (strpos($key, 'rule ') === 0) { if (is_array($value)) { if (function_exists('intl_get')) { $value[1] = intl_get($value[1]); } $widget->addRule($value[0], $value[1]); } else { $widget->addRule($value); } } elseif (strpos($key, 'value ') === 0) { $widget->setValues($value, $value); } elseif ($type == 'msubmit' && strpos($key, 'button ') === 0) { $b =& $widget->getButton(); if (empty($b->value)) { if (is_array($value)) { if (function_exists('intl_get')) { $value[0] = intl_get($value[0]); } $b->setValues($value[0]); $b->extra = $value[1]; } else { if (function_exists('intl_get')) { $value = intl_get($value); } $b->setValues($value); } } else { if (is_array($value)) { if (function_exists('intl_get')) { $value[0] = intl_get($value[0]); } $b =& $widget->addButton($name, $value[0]); $b->extra = $value[1]; } else { if (function_exists('intl_get')) { $value = intl_get($value); } $widget->addButton($name, $value); } } } elseif ($key == 'alt') { if (function_exists('intl_get')) { $widget->{$key} = intl_get($value); } else { $widget->{$key} = $value; } } elseif (method_exists($widget, $key)) { $widget->{$key}($value); } else { $widget->{$key} = $value; } } if (!empty($widget->formhelp) && session_pref('form_help') == 'on') { $widget->extra .= ' onfocus="formhelp_show (this, \'' . addslashes($widget->formhelp) . '\')" onblur="formhelp_hide ()"'; } unset($widget); return $this->widgets[$name]; }