public function run() { $db = Loader::db(); Loader::model('single_page'); Cache::disableLocalCache(); // we backup the custom styles table $this->backupCustomStylesTables(); // upgrade blocks that differ between versions $this->updateBlocks(); // Migrate data from the custom styles tables to the new approach $this->migrateCustomStyleData(); $this->setupSiteSearchIndexing(); $this->installTaskPermissions(); $this->updateDashboard(); // add the dark chocolate theme $pt = PageTheme::getByHandle('dark_chocolate'); if (!is_object($pt)) { $chocolate = PageTheme::add('dark_chocolate'); } Cache::enableLocalCache(); }
public function activate_files($ptID) { try { Loader::model("collection_types"); $pt = PageTheme::getByID($ptID); $txt = Loader::helper('text'); if (!is_array($this->post('pageTypes'))) { throw new Exception(t("You must specify at least one template to make into a page type.")); } $pkg = false; $pkgHandle = $pt->getPackageHandle(); if ($pkgHandle) { $pkg = Package::getByHandle($pkgHandle); } foreach ($this->post('pageTypes') as $ptHandle) { $data['ctName'] = $txt->unhandle($ptHandle); $data['ctHandle'] = $ptHandle; $ct = CollectionType::add($data, $pkg); } $this->set('message', t('Files in the theme were activated successfully.')); } catch (Exception $e) { $this->set('error', $e); } $this->view($ptID); }
public function run() { // Since we added the origfilename column in 5.0.0b1 we need to populate it Loader::block('library_file'); $bl = new LibraryFileBlockController(); $bl->populateOriginalFilenames(); // install the new block types made available BlockType::installBlockType('flash_content'); BlockType::installBlockType('guestbook'); BlockType::installBlockType('slideshow'); BlockType::installBlockType('search'); BlockType::installBlockType('google_map'); BlockType::installBlockType('video'); BlockType::installBlockType('rss_displayer'); BlockType::installBlockType('youtube'); BlockType::installBlockType('survey'); // rename external form $bt = BlockType::getByHandle('custom_form'); $db = Loader::db(); $tables = $db->MetaTables('TABLES'); if (isset($tables['btCustomForm']) && !isset($tables['btExternalForm'])) { $db->Execute("alter table btCustomForm rename btExternalForm"); } if (is_object($bt)) { BlockType::installBlockType('external_form', $bt->getBlockTypeID()); } // add new theme $th = PageTheme::getByHandle('greensalad'); if (!is_object($th)) { PageTheme::add('greensalad'); } }
public function reset() { $vt = Loader::helper('validation/token'); if ($vt->validate()) { $themeID = $this->post('themeID'); $pt = PageTheme::getByID($themeID); if (is_object($pt)) { $values = $pt->reset(); $this->redirect('/dashboard/pages/themes/customize', 'view', $themeID, 'reset'); } } }
public function run() { $this->x = new SimpleXMLElement("<concrete5-cif></concrete5-cif>"); $this->x->addAttribute('version', '1.0'); // First, attribute categories AttributeKeyCategory::exportList($this->x); // attribute types AttributeType::exportList($this->x); // then block types BlockTypeList::exportList($this->x); // now attribute keys (including user) AttributeKey::exportList($this->x); // now attribute keys (including user) AttributeSet::exportList($this->x); // now theme PageTheme::exportList($this->x); // now packages PackageList::export($this->x); // permission access entity types PermissionAccessEntityType::exportList($this->x); // now task permissions PermissionKey::exportList($this->x); // workflow types WorkflowType::exportList($this->x); // now jobs Loader::model('job'); Job::exportList($this->x); // now single pages $singlepages = $this->x->addChild("singlepages"); $db = Loader::db(); $r = $db->Execute('select cID from Pages where cFilename is not null and cFilename <> "" and cID not in (select cID from Stacks) order by cID asc'); while ($row = $r->FetchRow()) { $pc = Page::getByID($row['cID'], 'RECENT'); $pc->export($singlepages); } // now page types CollectionType::exportList($this->x); // now stacks/global areas Loader::model('stack/list'); StackList::export($this->x); // now content pages $pages = $this->x->addChild("pages"); $db = Loader::db(); $r = $db->Execute('select Pages.cID from Pages left join ComposerDrafts on Pages.cID = ComposerDrafts.cID where ComposerDrafts.cID is null and cIsTemplate = 0 and cFilename is null or cFilename = "" order by cID asc'); while ($row = $r->FetchRow()) { $pc = Page::getByID($row['cID'], 'RECENT'); $pc->export($pages); } Loader::model("system/captcha/library"); SystemCaptchaLibrary::exportList($this->x); Config::exportList($this->x); }
public function install($data = array()) { $pkg = parent::install(); // Set Theme // check for active themes $active_theme = PageTheme::getSiteTheme(); // strcmp($active_theme->getThemeHandle(), $themeHandle) == 0 if (is_object($active_theme) && $active_theme->getThemeHandle() !== 'elemental') { // Theme::setThemeHandle($themeHandle); // $pt = PageTheme::getByID($pThemeID); $pt = PageTheme::getByHandle('elemental'); $pt->applyToSite(); } }
public function install() { Loader::model('collection_types'); $pkg = parent::install(); PageTheme::add('casual', $pkg); $pagetypearray = array(array("left_sidebar", "Left Sidebar"), array("right_sidebar", "Right Sidebar"), array("full", "One Column"), array("three_column", "Three Column Layout")); foreach ($pagetypearray as $value) { $pageType = CollectionType::getByHandle($value[0]); if (!$pageType) { $pkg = Package::getByHandle('casual'); $newPageType = CollectionType::add(array('ctHandle' => $value[0], 'ctName' => t($value[1])), $pkg); } else { $newPageType = $pageType; } } }
public function exportAll() { $this->x = $this->getXMLRoot(); // First, attribute categories AttributeKeyCategory::exportList($this->x); // attribute types AttributeType::exportList($this->x); // then block types BlockTypeList::exportList($this->x); // now attribute keys (including user) AttributeKey::exportList($this->x); // now attribute keys (including user) AttributeSet::exportList($this->x); // now theme PageTheme::exportList($this->x); // now packages PackageList::export($this->x); // permission access entity types PermissionAccessEntityType::exportList($this->x); // now task permissions PermissionKey::exportList($this->x); // workflow types WorkflowType::exportList($this->x); // now jobs Loader::model('job'); Job::exportList($this->x); // now single pages $singlepages = $this->x->addChild("singlepages"); $db = Loader::db(); $r = $db->Execute('select cID from Pages where cFilename is not null and cFilename <> "" and cID not in (select cID from Stacks) order by cID asc'); while ($row = $r->FetchRow()) { $pc = Page::getByID($row['cID'], 'RECENT'); $pc->export($singlepages); } // now page types CollectionType::exportList($this->x); // now stacks/global areas Loader::model('stack/list'); StackList::export($this->x); $this->exportPages($this->x); Loader::model("system/captcha/library"); SystemCaptchaLibrary::exportList($this->x); Config::exportList($this->x); }
public function install() { Loader::library('mootools/attribute', FRONTEND_DEVELOPER_PACKAGE_HANDLE); $pkg = parent::install(); Loader::model('single_page'); Loader::model('attribute/categories/user'); Loader::model('attribute/categories/file'); $singlePages = array("/dashboard/mootools" => array('cName' => t('Mootools Plugin Developer'), 'cDescription' => t('Management of mootools plugin')), "/dashboard/mootools/plugin" => array('cName' => t('plugin'), 'cDescription' => t('Management of Mootools Plugin that does import')), "/dashboard/mootools/importer" => array('cName' => t('import'), 'cDescription' => t('Import from repository'))); foreach ($singlePages as $key => $page) { $collection = SinglePage::add($key, $pkg); if (!empty($collection)) { $collection->update($page); } } //The name of the user of github is added to the attribute. $values = array("akHandle" => MOOTOOLS_GITHUB_USER, "akName" => t("Name of user of github"), "akIsSearchable" => true, "akIsSearchableIndexed" => true, "akIsAutoCreated" => true, "akIsEditable" => true); $key = UserAttributeKey::add("text", $values, $pkg); $fileAttributes = array(array("type" => "boolean", "values" => array("akHandle" => MOOTOOLS_PLUGIN, "akName" => t("This file is a plugin of Mootools"), "akIsSearchable" => true, "akIsSearchableIndexed" => true, "akIsAutoCreated" => true, "akIsEditable" => true)), array("type" => "text", "values" => array("akHandle" => MOOTOOLS_COMPONENT_NAME, "akName" => t("Component name of Mootools"), "akIsSearchable" => true, "akIsSearchableIndexed" => true, "akIsAutoCreated" => true, "akIsEditable" => true)), array("type" => "text", "values" => array("akHandle" => MOOTOOLS_PLUGIN_LICENSE, "akName" => t("License of Mootools plugin"), "akIsSearchable" => true, "akIsSearchableIndexed" => true, "akIsAutoCreated" => true, "akIsEditable" => true)), array("type" => "text", "values" => array("akHandle" => MOOTOOLS_PLUGIN_AUTHORS, "akName" => t("Authors of Mootools plugin"), "akIsSearchable" => true, "akIsSearchableIndexed" => true, "akIsAutoCreated" => true, "akIsEditable" => true)), array("type" => "select", "values" => array("akHandle" => MOOTOOLS_PLUGIN_DEPENDENCES, "akName" => t("Dependence of Mootools plugin"), "akIsSearchable" => true, "akIsSearchableIndexed" => true, "akIsAutoCreated" => true, "akIsEditable" => true)), array("type" => "number", "values" => array("akHandle" => MOOTOOLS_PLUGIN_DISPLAY_ORDER, "akName" => t("The order of display of Mootools plugin"), "akIsSearchable" => true, "akIsSearchableIndexed" => true, "akIsAutoCreated" => true, "akIsEditable" => true))); $attributesKeys = array(); foreach ($fileAttributes as $key => $attr) { $type = $attr["type"]; $values = $attr["values"]; $handle = $values["akHandle"]; $attributesKeys[$handle] = FileAttributeKey::add($type, $values, $pkg); } if (!empty($attributesKeys[MOOTOOLS_PLUGIN_DEPENDENCES])) { $key = $attributesKeys[MOOTOOLS_PLUGIN_DEPENDENCES]; $db = Loader::db(); $db->Replace('atSelectSettings', array('akID' => $key->getAttributeKeyID(), 'akSelectAllowMultipleValues' => true), array('akID'), true); } BlockType::installBlockTypeFromPackage("mootools_plugin_build_form", $pkg); BlockType::installBlockTypeFromPackage("github_tags", $pkg); BlockType::installBlockTypeFromPackage("github_issues", $pkg); BlockType::installBlockTypeFromPackage("github_repository", $pkg); PageTheme::add('small_project', $pkg); }
public function testCustomizableStyleSheetObjects() { $defaults = dirname(__FILE__) . '/fixtures/elemental.less'; $list = \Concrete\Core\StyleCustomizer\Style\ValueList::loadFromLessFile($defaults); $env = Environment::get(); $pt = new PageTheme(); $pt->setThemeHandle('elemental'); $pt->setThemeDirectory($env->getPath(DIRNAME_THEMES . '/elemental')); $pt->setThemeURL($env->getURL(DIRNAME_THEMES . '/elmental')); $sheets = $pt->getThemeCustomizableStyleSheets(); $this->assertTrue(count($sheets) == 1); $this->assertTrue($sheets[0] instanceof \Concrete\Core\StyleCustomizer\Stylesheet); $css = $sheets[0]->getCss(); $this->assertTrue(strpos($css, "background-image: url('/path/to/server/concrete/themes/elemental/images/background-slider-default.png')") !== false); $sheets[0]->setValueList($list); $css = $sheets[0]->getCss(); $this->assertTrue(strpos($css, "background-image: url('/path/to/server/concrete/themes/elemental/images/testingit.jpg')") !== false); $this->assertTrue(strpos($css, 'font-family: "Testing Font Family"') !== false); $sheet = $pt->getStylesheetObject('typography.less'); $sheet->setValueList($list); $this->assertTrue($sheet->getOutputPath() == DIR_BASE . '/application/files/cache/css/elemental/typography.css'); $this->assertTrue($sheet->getOutputRelativePath() == DIR_REL . '/application/files/cache/css/elemental/typography.css'); }
} if (!isset($editor_selector)) { $editor_selector = 'ccm-advanced-editor'; } if (isset($editor_height)) { $textEditorHeight = $editor_height; } if (isset($editor_width)) { $textEditorWidth = $editor_width; } if (!isset($editor_mode)) { $txtEditorMode = Config::get('CONTENTS_TXT_EDITOR_MODE'); } else { $txtEditorMode = $editor_mode; } $theme = PageTheme::getSiteTheme(); ?> <script type="text/javascript"> var validElementsHtml5 = "@[accesskey|draggable|style|class|hidden|tabindex" + "|contenteditable|id|title|contextmenu|lang|dir<ltr?rtl|spellcheck" + "|onabort|onerror|onmousewheel|onblur|onfocus|onpause|oncanplay|onformchange|onplay" + "|oncanplaythrough|onforminput|onplaying|onchange|oninput|onprogress|onclick|oninvalid" + "|onratechange|oncontextmenu|onkeydown|onreadystatechange|ondblclick|onkeypress|onscroll" + "|ondrag|onkeyup|onseeked|ondragend|onload|onseeking|ondragenter|onloadeddata|onselect" + "|ondragleave|onloadedmetadata|onshow|ondragover|onloadstart|onstalled|ondragstart" + "|onmousedown|onsubmit|ondrop|onmousemove|onsuspend|ondurationmouseout|ontimeupdate" + "|onemptied|onmouseover|onvolumechange|onended|onmouseup|onwaiting]," + "a[target<_blank?_self?_top?_parent|ping|media|href|hreflang|type" + "|rel<alternate?archives?author?bookmark?external?feed?first?help?index?last?license?" + "next?nofollow?noreferrer?prev?search?sidebar?tag?up" +
public function activate_confirm($ptID, $token) { $l = PageTheme::getByID($ptID); $val = Loader::helper('validation/error'); $valt = Loader::helper('validation/token'); if (!$valt->validate('activate', $token)) { $val->add($valt->getErrorMessage()); $this->set('error', $val); } else { if (!is_object($l)) { $val->add('Invalid Theme'); $this->set('error', $val); } else { $l->applyToSite(); $this->set('message', t('Theme activated')); } } $this->view(); }
public function getSiteTheme() { $c = Page::getByID(HOME_CID); return PageTheme::getByID($c->getCollectionThemeID()); }
public function run() { if (!Config::get('SITE_INSTALLED_APP_VERSION')) { Config::save('SITE_INSTALLED_APP_VERSION', Config::get('SITE_APP_VERSION')); } BlockTypeList::resetBlockTypeDisplayOrder(); $th = PageTheme::getByHandle('greek_yogurt'); if (!is_object($th)) { PageTheme::add('greek_yogurt'); } $bt = BlockType::getByHandle('core_scrapbook_display'); if (is_object($bt)) { $bt->refresh(); } $bt = BlockType::getByHandle('search'); if (is_object($bt)) { $bt->refresh(); } $sp = Page::getByPath('/dashboard/users/group_sets'); if ($sp->isError()) { $d11 = SinglePage::add('/dashboard/users/group_sets'); $d11->update(array('cName' => t('Group Sets'))); } $sp = Page::getByPath('/dashboard/system/seo/bulk_seo_tool'); if ($sp->isError()) { $d1a = SinglePage::add('/dashboard/system/seo/bulk_seo_tool'); $d1a->update(array('cName' => t('Bulk SEO Updater'))); } $sp = Page::getByPath('/dashboard/system/permissions/users'); if ($sp->isError()) { $d1a = SinglePage::add('/dashboard/system/permissions/users'); $d1a->update(array('cName' => t('User Permissions'))); } $sp = Page::getByPath('/dashboard/blocks/permissions'); if ($sp->isError()) { $d1a = SinglePage::add('/dashboard/blocks/permissions'); $d1a->update(array('cName' => t('Block & Stack Permissions'))); } $sp = Page::getByPath('/dashboard/system/permissions/advanced'); if ($sp->isError()) { $d1b = SinglePage::add('/dashboard/system/permissions/advanced'); $d1b->update(array('cName' => t('Advanced Permissions'))); } $sp = Page::getByPath('/dashboard/workflow'); if ($sp->isError()) { $d1a = SinglePage::add('/dashboard/workflow'); $d1a->update(array('cName' => t('Workflow'))); } $sp = Page::getByPath('/dashboard/workflow/list'); if ($sp->isError()) { $d1a = SinglePage::add('/dashboard/workflow/list'); } $sp = Page::getByPath('/dashboard/workflow/me'); if ($sp->isError()) { $d1a = SinglePage::add('/dashboard/workflow/me'); $d1a->update(array('cName' => t('Waiting for Me'))); } $sp = Page::getByPath('/dashboard/system/environment/proxy'); if ($sp->isError()) { $d1a = SinglePage::add('/dashboard/system/environment/proxy'); $d1a->update(array('cName' => t('Proxy Server'))); } // update meta keywords $pageKeywords = array('/dashboard/composer' => t('blog, blogging'), '/dashboard/composer/write' => t('new blog, write blog, blogging'), '/dashboard/composer/drafts' => t('blog drafts, composer'), '/dashboard/sitemap' => t('pages, add page, delete page, copy, move, alias'), '/dashboard/sitemap/full' => t('pages, add page, delete page, copy, move, alias'), '/dashboard/sitemap/explore' => t('pages, add page, delete page, copy, move, alias, bulk'), '/dashboard/sitemap/search' => t('find page, search page, search, find, pages, sitemap'), '/dashboard/files/search' => t('add file, delete file, copy, move, alias, resize, crop, rename, images, title, attribute'), '/dashboard/files/attributes' => t('file, file attributes, title, attribute, description, rename'), '/dashboard/files/sets' => t('files, category, categories'), '/dashboard/files/add_set' => t('new file set'), '/dashboard/users' => t('users, groups, people, find, delete user, remove user, change password, password'), '/dashboard/users/search' => t('find, search, people, delete user, remove user, change password, password'), '/dashboard/users/groups' => t('user, group, people, permissions, access, expire'), '/dashboard/users/attributes' => t('user attributes, user data, gather data, registration data'), '/dashboard/users/add' => t('new user, create'), '/dashboard/users/add_group' => t('new user group, new group, group, create'), '/dashboard/users/group_sets' => t('group set'), '/dashboard/reports' => t('forms, log, error, email, mysql, exception, survey'), '/dashboard/reports/statistics' => t('hits, pageviews, visitors, activity'), '/dashboard/reports/forms' => t('forms, questions, response, data'), '/dashboard/reports/surveys' => t('questions, quiz, response'), '/dashboard/reports/logs' => t('forms, log, error, email, mysql, exception, survey, history'), '/dashboard/pages/themes' => t('new theme, theme, active theme, change theme, template, css'), '/dashboard/pages/themes/add' => t('theme'), '/dashboard/pages/themes/inspect' => t('page types'), '/dashboard/pages/themes/customize' => t('custom theme, change theme, custom css, css'), '/dashboard/pages/types' => t('page type defaults, global block, global area, starter, template'), '/dashboard/pages/attributes' => t('page attributes, custom'), '/dashboard/pages/single' => t('single, page, custom, application'), '/dashboard/workflow' => t('add workflow, remove workflow'), '/dashboard/blocks/stacks' => t('stacks, reusable content, scrapbook, copy, paste, paste block, copy block, site name, logo'), '/dashboard/blocks/stacks/list' => t('edit stacks, view stacks, all stacks'), '/dashboard/blocks/types' => t('block, refresh, custom'), '/dashboard/extend' => t('add-on, addon, add on, package, applications, ecommerce, discussions, forums, themes, templates, blocks'), '/dashboard/extend/install' => t('add-on, addon, ecommerce, install, discussions, forums, themes, templates, blocks'), '/dashboard/extend/update' => t('update, upgrade'), '/dashboard/extend/connect' => t('concrete5.org, my account, marketplace'), '/dashboard/extend/themes' => t('buy theme, new theme, marketplace, template'), '/dashboard/extend/add-ons' => t('buy addon, buy add on, buy add-on, purchase addon, purchase add on, purchase add-on, find addon, new addon, marketplace'), '/dashboard/system' => t('dashboard, configuration'), '/dashboard/system/basics/site_name' => t('website name, title'), '/dashboard/system/basics/icons' => t('logo, favicon, iphone, icon, bookmark'), '/dashboard/system/basics/editor' => t('tinymce, content block, fonts, editor, content, overlay'), '/dashboard/system/basics/multilingual' => t('translate, translation, internationalization, multilingual'), '/dashboard/system/basics/timezone' => t('timezone, profile, locale'), '/dashboard/system/basics/interface' => t('interface, quick nav, dashboard background, background image'), '/dashboard/system/seo/urls' => t('vanity, pretty url, seo, pageview, view'), '/dashboard/system/seo/bulk_seo_tool' => t('bulk, seo, change keywords, engine, optimization, search'), '/dashboard/system/seo/tracking_codes' => t('traffic, statistics, google analytics, quant, pageviews, hits'), '/dashboard/system/seo/statistics' => t('turn off statistics, tracking, statistics, pageviews, hits'), '/dashboard/system/seo/search_index' => t('configure search, site search, search option'), '/dashboard/system/optimization/cache' => t('cache option, change cache, override, turn on cache, turn off cache, no cache, page cache, caching'), '/dashboard/system/optimization/clear_cache' => t('cache option, turn off cache, no cache, page cache, caching'), '/dashboard/system/optimization/jobs' => t('index search, reindex search, build sitemap, sitemap.xml, clear old versions, page versions, remove old'), '/dashboard/system/permissions/site' => t('editors, hide site, offline, private, public, access'), '/dashboard/system/permissions/files' => t('file options, file manager, upload, modify'), '/dashboard/system/permissions/file_types' => t('security, files, media, extension, manager, upload'), '/dashboard/system/permissions/tasks' => t('security, actions, administrator, admin, package, marketplace, search'), '/dashboard/system/permissions/ip_blacklist' => t('security, lock ip, lock out, block ip, address, restrict, access'), '/dashboard/system/permissions/captcha' => t('security, registration'), '/dashboard/system/permissions/antispam' => t('antispam, block spam, security'), '/dashboard/system/permissions/maintenance_mode' => t('lock site, under construction, hide, hidden'), '/dashboard/system/registration/postlogin' => t('profile, login, redirect, specific, dashboard, administrators'), '/dashboard/system/registration/profiles' => t('member profile, member page, community, forums, social, avatar'), '/dashboard/system/registration/public_registration' => t('signup, new user, community'), '/dashboard/system/mail' => t('smtp, mail settings'), '/dashboard/system/mail/method' => t('email server, mail settings, mail configuration, external, internal'), '/dashboard/system/mail/importers' => t('email server, mail settings, mail configuration, private message, message system, import, email, message'), '/dashboard/system/attributes' => t('attribute configuration'), '/dashboard/system/attributes/sets' => t('attributes, sets'), '/dashboard/system/attributes/types' => t('attributes, types'), '/dashboard/system/environment/info' => t('overrides, system info, debug, support, help'), '/dashboard/system/environment/debug' => t('errors, exceptions, develop, support, help'), '/dashboard/system/environment/logging' => t('email, logging, logs, smtp, pop, errors, mysql, log'), '/dashboard/system/environment/file_storage_locations' => t('security, alternate storage, hide files'), '/dashboard/system/environment/proxy' => t('network, proxy server'), '/dashboard/system/backup_restore' => t('export, backup, database, sql, mysql, encryption, restore'), '/dashboard/system/backup_restore/update' => t('upgrade, new version, update'), '/dashboard/system/backup_restore/database' => t('export, database, xml, starting, points, schema, refresh, custom, tables'), '/dashboard/system/seo/search_index' => t('configure search, site search, search option'), '/dashboard/system/optimization/cache' => t('cache option, change cache, override, turn on cache, turn off cache, no cache, page cache, caching')); foreach ($pageKeywords as $page => $keywords) { $p = Page::getByPath($page, 'ACTIVE'); $ak = CollectionAttributeKey::getByHandle('meta_keywords'); if (is_object($p) && !$p->isError() && $ak instanceof AttributeKey) { $p->setAttribute('meta_keywords', $keywords); } } // install the permissions from permissions.xml $this->installPermissionsAndWorkflow(); $this->addGlobalBlockPermissions(); $this->migratePagePermissions(); $this->migratePagePermissionPageTypes(); $this->migrateAreaPermissions(); $this->migrateAreaPermissionBlockTypes(); $this->migrateBlockPermissions(); $this->migrateFileSetPermissions(); $this->migrateAddFilePermissions(); $this->migrateFilePermissions(); $this->migrateTaskPermissions(); $this->migrateThemes(); $this->migratePageTypes(); $this->setupDashboardIcons(); }
'dataType': 'json', 'success': function(r) { $('input[name=autosave]').val('0'); ccm_composerLastSaveTime = new Date(); $("#composer-save-status").html('<?php echo t("Page saved at ")?>' + r.time); $(".ccm-composer-hide-on-approved").show(); if (callback) { callback(); } } }); } ccm_composerLaunchPreview = function() { jQuery.fn.dialog.showLoader(); <?php $t = PageTheme::getSiteTheme(); ?> ccm_composerDoAutoSave(function() { ccm_previewInternalTheme(<?php echo $entry->getCollectionID()?>, <?php echo $t->getThemeID()?>, '<?php echo addslashes(str_replace(array("\r","\n","\n"),'',$t->getThemeName()))?>'); }); } ccm_composerSelectParentPage = function(cID) { $("input[name=cPublishParentID]").val(cID); $(".ccm-composer-hide-on-no-target").show(); $("#ccm-composer-publish-location").load('<?php echo $this->action("select_publish_target")?>', {'entryID': <?php echo $entry->getCollectionID()?>, 'cPublishParentID': cID}); jQuery.fn.dialog.closeTop(); } ccm_composerSelectParentPageAndSubmit = function(cID) { $("input[name=cPublishParentID]").val(cID);
<?php defined('C5_EXECUTE') or die("Access Denied."); $co = Request::get(); $v = View::getInstance(); $au = $co->getAuxiliaryData(); if (isset($au->theme) && isset($au->file)) { $pt = PageTheme::getByHandle($au->theme); $val = Cache::get('preview_theme_style', $pt->getThemeID(), false, true); header("Content-Type: text/css"); if (is_array($val)) { $values = $pt->mergeStylesFromPost($val); } $pt->outputStyleSheet($au->file, $values); }
public function testCustomizableStyleSheetObjects() { $defaults = dirname(__FILE__) . '/fixtures/greekyogurt.less'; $list = \Concrete\Core\StyleCustomizer\Style\ValueList::loadFromLessFile($defaults); $env = Environment::get(); $pt = new PageTheme(); $pt->setThemeHandle('greek_yogurt'); $pt->setThemeDirectory($env->getPath(DIRNAME_THEMES . '/greek_yogurt')); $pt->setThemeURL($env->getURL(DIRNAME_THEMES . '/greek_yogurt')); $sheets = $pt->getThemeCustomizableStyleSheets(); $this->assertTrue(count($sheets) == 1); $this->assertTrue($sheets[0] instanceof \Concrete\Core\StyleCustomizer\Stylesheet); $css = $sheets[0]->getCss(); $r = preg_match('/background-image: url\\(\'(.+)\'\\);/i', $css, $matches); $this->assertTrue(trim($matches[1]) == '/concrete/themes/greek_yogurt/images/spacer.gif'); $sheets[0]->setValueList($list); $css = $sheets[0]->getCss(); $r = preg_match('/background-image: url\\(\'(.+)\'\\);/i', $css, $matches); $this->assertTrue(trim($matches[1]) == '/concrete/themes/greek_yogurt/images/testingit.jpg'); $sheet = $pt->getStylesheetObject('typography.less'); $sheet->setValueList($list); $this->assertTrue($sheet->getOutputPath() == DIR_BASE . '/application/files/cache/css/greek_yogurt/typography.css'); $this->assertTrue($sheet->getOutputRelativePath() == DIR_REL . '/application/files/cache/css/greek_yogurt/typography.css'); }
?> </option> <option value="lt"<? if ($req['cChildrenSelect'] == 'lt') { ?> selected <? } ?>><?php echo t('Fewer Than'); ?> </option> </select> <input type="text" name="cChildren" value="<?php echo $req['cChildren']; ?> " /> </span> <span class="ccm-search-option" search-field="theme"> <select name="ptID"> <? $themes = PageTheme::getList(); ?> <? foreach($themes as $pt) { ?> <option value="<?php echo $pt->getThemeID(); ?> "><?php echo $pt->getThemeName(); ?> </option> <? } ?> </select> </span> <? foreach($searchFieldAttributes as $sfa) { $sfa->render('search'); ?> <? } ?>
foreach ($jobs as $j) { $jb = Job::getByHandle($j); if (is_object($jb)) { echo "Job {$j} had been installed; skip intalling. <br/>"; } else { #Job::installByPackage($j, $pkg); Job::installByHandle($j); echo "Job {$j} newly installed. <br/>"; } flush(); ob_flush(); } // Apply full_stack_style as the site theme echo '<br/>'; echo 'Applying full_stack_style as site theme...'; $pt = PageTheme::getByHandle('full_stack_style'); $pt->applyToSite(); echo 'Done.<br/>'; // Install event extends here #Events::extend('on_start', 'FSENLocalization', 'setupInterfaceLocalization4Request', 'models/fsen_localization.php'); #Events::extend('on_before_render', 'FSENLocalization', 'setupInterfaceLocalization4Page', 'models/fsen_localization.php'); // Apply page type for HOME page echo '<br/>'; echo '<br/>'; echo 'Applying page type for HOME...'; $home_page = Page::getByID(HOME_CID); $home_type = CollectionType::getByHandle('home'); $home_page->update(array('ctID' => $home_type->getCollectionTypeID())); echo 'Done. <br/>'; // disable full page cache for HOME page // $home_page->update (array ('cCacheFullPageContent' => 0));
exit; } $form = Loader::helper('form'); $pages = array(); if (is_array($_REQUEST['cID'])) { foreach ($_REQUEST['cID'] as $cID) { $pages[] = Page::getByID($cID); } } else { $pages[] = Page::getByID($_REQUEST['cID']); } $pcnt = 0; $isMasterCollection = false; $isSinglePage = false; $tArray = PageTheme::getGlobalList(); $tArray2 = PageTheme::getLocalList(); $tArray = array_merge($tArray, $tArray2); foreach ($pages as $c) { if ($c->isGeneratedCollection()) { $isSinglePage = true; } if ($c->isMasterCollection()) { $isMasterCollection = true; } $cp = new Permissions($c); if ($cp->canEditPageTheme() && $cp->canEditPageType()) { $pcnt++; } } if ($pcnt > 0) { // i realize there are a lot of loops through this, but the logic here is a bit tough to follow if you don't do it this way.
/** * used by the theme_paths and site_theme_paths files in config/ to hard coded certain paths to various themes * @access public * @param $path string * @param $theme object, if null site theme is default * @return void */ public function setThemeByPath($path, $theme = NULL) { if ($theme != VIEW_CORE_THEME && $theme != 'dashboard') { // this is a hack until we figure this code out. if (is_string($theme)) { $pageTheme = PageTheme::getByHandle($theme); if(is_object($pageTheme) && $pageTheme->getThemeHandle() == $theme) { // is it the theme that's been requested? $theme = $pageTheme; } } } $this->themePaths[$path] = $theme; }
private function installThemes($pkg) { PageTheme::add('boilerplate', $pkg); }
/** * Set the theme for a page using the page object * @param PageTheme $pl */ public function setTheme($pl) { $db = Loader::db(); $db->query('update CollectionVersions set ptID = ? where cID = ? and cvID = ?', array($pl->getThemeID(), $this->cID, $this->vObj->getVersionID())); parent::refreshCache(); }
<?php defined('C5_EXECUTE') or die("Access Denied."); Loader::model('collection_types'); Loader::library('view'); if (isset($_POST['ttask']) && $_POST['ttask'] == 'preview_theme_customization') { Cache::set('preview_theme_style', $_REQUEST['themeID'], $_POST, 30); } $previewCID = intval($_REQUEST['previewCID']); $themeID = intval($_REQUEST['themeID']); $ctID = intval($_REQUEST['ctID']); $collectionType = CollectionType::getByID($ctID); $c = Page::getByID($previewCID, 'RECENT'); //,"ACTIVE" $cp = new Permissions($c); if (!$cp->canEditPageTheme()) { throw new Exception(t('Access Denied')); } $v = View::getInstance(); if ($themeID > 0) { $th = PageTheme::getByID($themeID); if (!file_exists($th->getThemeDirectory())) { throw new Exception(t('Theme not found in %s', $th->getThemeDirectory())); } $v->setTheme($th); } $v->disableEditing(); $v->disableLinks(); $v->enablePreview(); $v->render($c);
$ct = CollectionType::getByID($c->getCollectionTypeID()); $nc = Page::getByID($_REQUEST['cParentID']); $ncp = new Permissions($nc); if ($ncp->canAddSubCollection($ct) && $c->canMoveCopyTo($nc)) { $c->markPendingAction('MOVE', $nc); header('Location: ' . BASE_URL . DIR_REL . '/' . DISPATCHER_FILENAME . '?cID=' . $_GET['cID'] . '&ctask=mcd' . $step); exit; } } } } else */ if ($_POST['update_theme']) { if ($cp->canAdminPage()) { $nvc = $c->getVersionToModify(); $data = array(); $pl = PageTheme::getByID($_POST['plID']); $c->setTheme($pl); if (!$c->isGeneratedCollection()) { if ($_POST['ctID']) { // now we have to check to see if you're allowed to update this page to this page type. // We do this by checking to see whether the PARENT page allows you to add this page type here. // if this is the home page then we assume you are good if ($c->getCollectionID() > 1) { Loader::model('collection_types'); $parentC = Page::getByID($c->getCollectionParentID()); $parentCP = new Permissions($parentC); $ct = CollectionType::getByID($_POST['ctID']); } if ($c->getCollectionID() == 1 || $parentCP->canAddSubCollection($ct)) { $data['ctID'] = $_POST['ctID']; $nvc->update($data);
ccm_composerLastSaveTime = new Date(); $("#composer-save-status").html('<div class="alert alert-info"><?php echo t("Page saved at "); ?> ' + r.time + '</div>'); $(".ccm-composer-hide-on-approved").show(); if (callback) { callback(); } } }); } ccm_composerLaunchPreview = function() { jQuery.fn.dialog.showLoader(); <? $t = PageTheme::getSiteTheme(); ?> ccm_composerDoAutoSave(function() { ccm_previewInternalTheme(<?php echo $entry->getCollectionID(); ?> , <?php echo $t->getThemeID(); ?> , '<?php echo addslashes(str_replace(array("\r", "\n", "\n"), '', $t->getThemeName())); ?> '); }); } ccm_composerSelectParentPage = function(cID) {
if (!$cp->canEditPageType() && !$cp->canEditPageTheme()) { die(t('Access Denied')); } $cnt = 0; for ($i = 0; $i < count($ctArray); $i++) { $ct = $ctArray[$i]; if ($c->getCollectionID() == 1 || $parentCP->canAddSubCollection($ct)) { $cnt++; } } $plID = $c->getCollectionThemeID(); $ctID = $c->getCollectionTypeID(); if ($plID == 0) { $pl = PageTheme::getSiteTheme(); $plID = $pl->getThemeID(); } ?> <div class="ccm-ui"> <form method="post" name="ccmThemeForm" action="<?php echo $c->getCollectionAction(); ?> "> <input type="hidden" name="plID" value="<?php echo $c->getCollectionThemeID(); ?> " /> <input type="hidden" name="ctID" value="<?php echo $c->getCollectionTypeID();
public function checkMobileView() { if (isset($_COOKIE['ccmDisableMobileView']) && $_COOKIE['ccmDisableMobileView'] == true) { define('MOBILE_THEME_IS_ACTIVE', false); return false; // break out if we've said we don't want the mobile theme } $page = Page::getCurrentPage(); if ($page instanceof Page && $page->isAdminArea()) { define('MOBILE_THEME_IS_ACTIVE', false); return false; // no mobile theme for the dashboard } Loader::library('3rdparty/mobile_detect'); $md = new Mobile_Detect(); if ($md->isMobile()) { $themeId = Config::get('MOBILE_THEME_ID'); if ($themeId > 0) { $mobileTheme = PageTheme::getByID($themeId); if ($mobileTheme instanceof PageTheme) { define('MOBILE_THEME_IS_ACTIVE', true); // we have to grab the instance of the view // since on_page_view doesn't give it to us $this->setTheme($mobileTheme); } } } if (!defined('MOBILE_THEME_IS_ACTIVE')) { define('MOBILE_THEME_IS_ACTIVE', false); } }
/** * Returns an array of package items (e.g. blocks, themes) */ public function getPackageItems() { $items = array(); Loader::model('single_page'); Loader::library('mail/importer'); Loader::model('job'); Loader::model('collection_types'); Loader::model('system/captcha/library'); Loader::model('system/antispam/library'); $items['attribute_categories'] = AttributeKeyCategory::getListByPackage($this); $items['permission_categories'] = PermissionKeyCategory::getListByPackage($this); $items['permission_access_entity_types'] = PermissionAccessEntityType::getListByPackage($this); $items['attribute_keys'] = AttributeKey::getListByPackage($this); $items['attribute_sets'] = AttributeSet::getListByPackage($this); $items['group_sets'] = GroupSet::getListByPackage($this); $items['page_types'] = CollectionType::getListByPackage($this); $items['mail_importers'] = MailImporter::getListByPackage($this); $items['configuration_values'] = Config::getListByPackage($this); $items['block_types'] = BlockTypeList::getByPackage($this); $items['page_themes'] = PageTheme::getListByPackage($this); $items['permissions'] = PermissionKey::getListByPackage($this); $items['single_pages'] = SinglePage::getListByPackage($this); $items['attribute_types'] = AttributeType::getListByPackage($this); $items['captcha_libraries'] = SystemCaptchaLibrary::getListByPackage($this); $items['antispam_libraries'] = SystemAntispamLibrary::getListByPackage($this); $items['jobs'] = Job::getListByPackage($this); $items['workflow_types'] = WorkflowType::getListByPackage($this); ksort($items); return $items; }
function getCollectionThemeObject() { if ($this->ptID < 1) { return PageTheme::getSiteTheme(); } else { $pl = PageTheme::getByID($this->ptID); return $pl; } }