function SitefaqEditForm() { parent::MailForm(); global $page, $cgi; $this->extra = 'id="cms-edit-form"'; // get copy from repository loader_import('cms.Versioning.Rex'); $rex = new Rex($cgi->_collection); // default: database, database $_document = $rex->getCurrent($cgi->_key); $widgets = $rex->getStruct(); if (!$widgets) { $widgets = array(); } // edit widgets go here $this->widgets = array_merge($this->widgets, $widgets); foreach ($this->widgets as $k => $v) { if (isset($_document->{$k})) { $this->widgets[$k]->setValue($_document->{$k}); } } $w =& $this->addWidget('hidden', '_key'); $w =& $this->addWidget('hidden', '_collection'); $w =& $this->addWidget('hidden', '_return'); if ($rex->isVersioned) { $t =& $this->addWidget('textarea', 'changelog'); $t->alt = intl_get('Change Summary'); $t->rows = 3; $t->labelPosition = 'left'; $t->extra = 'id="changelog"'; } // submit buttons $w =& $this->addWidget('msubmit', 'submit_button'); $b =& $w->getButton(); $b->setValues(intl_get('Save')); $b =& $w->addButton('submit_button', intl_get('Cancel')); $b->extra = 'onclick="return cms_cancel (this.form)"'; $this->error_mode = 'all'; if ($rex->info['Collection']['singular']) { page_title(intl_get('Editing') . ' ' . $rex->info['Collection']['singular'] . ': ' . $_document->{$rex->key}); } else { page_title(intl_get('Editing Item') . ': ' . $_document->{$rex->key}); } // the SiteFAQ additions: if (appconf('user_anonymity')) { unset($this->widgets['name']); unset($this->widgets['email']); unset($this->widgets['url']); unset($this->widgets['ip']); unset($this->widgets['member_id']); } $admin_roles = session_admin_roles(); $this->widgets['assigned_to']->setValues(db_pairs('select username, concat(lastname, ", ", firstname, " (", username, ")") from sitellite_user where role in("' . join('", "', $admin_roles) . '") order by lastname, firstname, username')); if (!$_document->assigned_to) { $this->widgets['assigned_to']->setValue(session_username()); } }
function RealtyAddForm() { parent::MailForm(); $w =& $this->addWidget('hidden', 'collection'); $w =& $this->addWidget('hidden', '_return'); global $cgi; loader_import('cms.Versioning.Rex'); $rex = new Rex($cgi->collection); $widgets = $rex->getStruct(); if (!$widgets) { die($rex->error); } $this->widgets = array_merge($this->widgets, $widgets); foreach (array_keys($this->widgets) as $k) { if (strtolower(get_class($this->widgets[$k])) == 'mf_widget_xeditor') { $this->extra = 'onsubmit="xed_copy_value (this, \'' . $k . '\')"'; } } if (isset($rex->info['Collection']['singular'])) { page_title(intl_get('Adding') . ' ' . $rex->info['Collection']['singular']); } else { page_title(intl_get('Adding Item')); } $w =& $this->addWidget('msubmit', 'submit_button'); $b =& $w->getButton(); $b->setValues(intl_get('Create')); $b =& $w->addButton('submit_button', intl_get('Cancel')); $b->extra = 'onclick="return cms_cancel (this.form)"'; }
function CmsEditForm() { parent::MailForm(); $this->autosave = true; global $page, $cgi; $this->extra = 'id="cms-edit-form"'; // get copy from repository loader_import('cms.Versioning.Rex'); $rex = new Rex($cgi->_collection); // default: database, database if (strpos($rex->key, ',') !== false) { $pkeys = preg_split('/, ?/', $rex->key); $pvals = explode('|', $cgi->_key); $key = array(); for ($i = 0; $i < count($pkeys); $i++) { $key[$pkeys[$i]] = $pvals[$i]; } } else { $key = $cgi->_key; } $_document = $rex->getCurrent($key); $widgets = $rex->getStruct(); if (!$widgets) { $widgets = array(); } // edit widgets go here $this->widgets = array_merge($this->widgets, $widgets); foreach ($this->widgets as $k => $v) { if (strtolower(get_class($this->widgets[$k])) == 'mf_widget_xeditor') { $this->extra = 'onsubmit="xed_copy_value (this, \'' . $k . '\')"'; } if (isset($_document->{$k})) { $this->widgets[$k]->setValue($_document->{$k}); } } foreach ($rex->info as $k => $v) { if (preg_match('/^hint:(.*)$/', $k, $regs)) { if (!isset($this->widgets[$regs[1]])) { $w =& $this->createWidget($regs[1], $v); $w->id = $cgi->_key; } } } $w =& $this->addWidget('hidden', '_key'); $w =& $this->addWidget('hidden', '_collection'); $w =& $this->addWidget('hidden', '_return'); if ($rex->isVersioned) { $t =& $this->addWidget('textarea', 'changelog'); $t->alt = intl_get('Change Summary'); $t->rows = 3; $t->labelPosition = 'left'; $t->extra = 'id="changelog"'; if (isset($rex->info['hint:changelog'])) { $hint =& $rex->info['hint:changelog']; if ($hint['type']) { $t =& $t->changeType($hint['type']); unset($hint['type']); } foreach ($hint as $k => $v) { if (method_exists($t, $k)) { $t->{$k}($v); } else { $t->{$k} = $v; } } } $this->widgets['changelog'] =& $t; } // 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('Cancel')); $b->extra = 'onclick="return cms_cancel (this.form)"'; $this->error_mode = 'all'; if ($rex->info['Collection']['singular']) { page_title(intl_get('Editing') . ' ' . $rex->info['Collection']['singular'] . ': ' . $_document->{$rex->key}); } else { page_title(intl_get('Editing Item') . ': ' . $_document->{$rex->key}); } }
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') { $acl = array('sitellite_access' => new rList('sitellite_access', session_allowed_access_list())); break; } } } } $pg = new Pager($cgi->offset, $limit);
function MultilingualTranslateForm() { parent::MailForm(); $this->autosave = true; global $page, $cgi, $intl; $intl->language = $cgi->_lang; $intl->charset = $intl->languages[$intl->language]['charset']; $this->extra = 'id="multilingual-translate-form"'; $w =& $this->addWidget('template', '_header'); $this->lang = multilingual_filter_lang($cgi->_lang); $this->reflang = multilingual_filter_lang(intl_default_lang()); $w->template = '<tr><th colspan="2" width="50%">{intl Language}: {lang}</th><th width="50%">{intl Reference}: {reflang}</th></tr>'; // get copy from repository loader_import('cms.Versioning.Rex'); $rex = new Rex($cgi->_collection); $doc = $rex->getCurrent($cgi->_key); $widgets = $rex->getStruct(); if (!$widgets) { $widgets = array(); } // edit widgets go here $this->widgets = array_merge($this->widgets, $widgets); foreach ($this->widgets as $k => $v) { if (in_array($k, array($rex->key, 'sitellite_status', 'sitellite_access', 'sitellite_startdate', 'sitellite_expirydate', 'sitellite_owner', 'sitellite_team'))) { unset($this->widgets[$k]); continue; } if ($v->name != '_header' && !in_array($v->type, array('text', 'textarea', 'xeditor'))) { unset($this->widgets[$k]); continue; } if (strtolower(get_class($this->widgets[$k])) == 'mf_widget_xeditor') { $this->extra = 'onsubmit="xed_copy_value (this, \'' . $k . '\')"'; } if (isset($doc->{$k})) { $this->widgets[$k]->reference = $doc->{$k}; } } $w =& $this->addWidget('hidden', '_key'); $w =& $this->addWidget('hidden', '_collection'); $w =& $this->addWidget('hidden', '_lang'); $w =& $this->addWidget('status', '_status'); $w->alt = intl_get('Translation Status'); $w->setValue('draft'); $w->reference = ''; // submit buttons $w =& $this->addWidget('msubmit', 'submit_button'); $w->reference = ''; $b =& $w->getButton(); $b->setValues(intl_get('Save')); $b =& $w->addButton('submit_button', intl_get('Cancel')); $b->extra = 'onclick="return cms_cancel (this.form)"'; $this->error_mode = 'all'; if ($rex->info['Collection']['singular']) { page_title(intl_get('Translating') . ' ' . $rex->info['Collection']['singular'] . ': ' . $doc->{$rex->key}); } else { page_title(intl_get('Translating Item') . ': ' . $doc->{$rex->key}); } $tr = new Translation($cgi->_collection, $cgi->_lang); $curr = $tr->get($cgi->_key); if ($curr) { foreach ($curr->data as $k => $v) { if (isset($this->widgets[$k])) { $this->widgets[$k]->setDefault($v); } } $this->widgets['_status']->setDefault($curr->sitellite_status); } }
$urls = array(); loader_import('cms.Versioning.Rex'); foreach (Rex::getCollections() as $table) { $rex = new Rex($table); if (!$rex->collection) { echo 'Collection "' . $table . '" failed to load. Continuing.' . NEWLINE; continue; } if (empty($rex->info['Collection']['sitesearch_url'])) { continue; } $find = array(); if (!empty($rex->info['Collection']['sitesearch_include_field'])) { $find[$rex->info['Collection']['sitesearch_include_field']] = new rEqual($rex->info['Collection']['sitesearch_include_field'], 'yes'); } $struct = $rex->getStruct(); if (isset($struct['sitellite_status'])) { $find['sitellite_status'] = new rEqual('sitellite_status', 'approved'); } if (isset($struct['sitellite_access'])) { $find['sitellite_access'] = new rEqual('sitellite_access', 'public'); } foreach ($rex->getList($find) as $obj) { $urls[] = 'http://' . conf('Site', 'domain') . '/index/' . sprintf($rex->info['Collection']['sitesearch_url'], $obj->{$rex->key}); } } $out = '<?xml version="1.0" encoding="UTF-8"?' . ">\n"; $out .= '<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">' . "\n"; foreach ($urls as $url) { $out .= '<url><loc>' . $url . "</loc></url>\n"; }
exit; } // END CLI KEEPOUT CHECKING // documents scheduler task // Publishes queued documents and archives expired ones. $states = array('queued' => array('to' => 'approved', 'sitellite_startdate' => '(sitellite_startdate is not null and sitellite_startdate <= now())', 'sitellite_expirydate' => '(sitellite_expirydate is null or sitellite_expirydate > sitellite_startdate)', 'msg' => 'Publishing queued item.'), 'approved' => array('to' => 'archived', 'sitellite_expirydate' => '(sitellite_expirydate is not null and sitellite_expirydate <= now())', 'sitellite_startdate' => '', 'msg' => 'Archiving expired item.')); loader_import('cms.Versioning.Rex'); foreach (Rex::getCollections() as $table) { $rex = new Rex($table); if (!$rex->collection) { echo 'Collection "' . $table . '" failed to load. Continuing.' . NEWLINE; continue; } elseif ($rex->info['Collection']['scheduler_skip']) { continue; } $cols = $rex->getStruct(); if (!isset($cols['sitellite_startdate'])) { // no scheduling in this collection continue; } $pkcol = $rex->key; foreach ($states as $fromState => $state) { $toState = $state['to']; $find = array('sitellite_status' => new rEqual('sitellite_status', $fromState)); if (!empty($state['sitellite_startdate'])) { $find['sitellite_startdate'] = new rLiteral($state['sitellite_startdate']); } if (!empty($state['sitellite_expirydate'])) { $find['sitellite_expiry'] = new rLiteral($state['sitellite_expirydate']); } $list =& $rex->getStoreList($find);