public function view() { $uh = Loader::helper('concrete/urls'); $bt = BlockType::getByHandle('switch_language'); Loader::model('section', 'multilingual'); $ml = MultilingualSection::getList(); $c = Page::getCurrentPage(); $al = MultilingualSection::getBySectionOfSite($c); $languages = array(); $locale = ACTIVE_LOCALE; if (is_object($al)) { $locale = $al->getLanguage(); } foreach ($ml as $m) { $languages[$m->getCollectionID()] = $m->getLanguageText($locale) . ' ' . (strlen($m->msIcon) ? '(' . $m->msIcon . ')' : ''); } $this->set('languages', $languages); $this->set('languageSections', $ml); $this->set('action', $uh->getBlockTypeToolsURL($bt) . '/switch'); if (is_object($al)) { $this->set('activeLanguage', $al->getCollectionID()); } $pkg = Package::getByHandle('multilingual'); $mdl = Loader::helper('default_language', 'multilingual'); $this->set('defaultLanguage', $mdl->getSessionDefaultLocale()); $this->set('cID', $c->getCollectionID()); }
public function run() { $sp = Page::getByPath('/dashboard/system/seo/excluded'); if (!is_object($sp) || $sp->isError()) { $sp = SinglePage::add('/dashboard/system/seo/excluded'); $sp->update(array('cName' => t('Excluded URL Word List'))); $sp->setAttribute('meta_keywords', 'pretty, slug'); } $bt = BlockType::getByHandle('next_previous'); if (is_object($bt)) { $bt->refresh(); } $db = Loader::db(); $columns = $db->MetaColumns('Pages'); if (isset($columns['PTID'])) { $db->Execute('alter table Pages drop column ptID'); } if (isset($columns['CTID'])) { $db->Execute('alter table Pages drop column ctID'); } $bt = BlockType::getByHandle('search'); if (is_object($bt)) { $bt->refresh(); } }
public function run() { $bt = BlockType::getByHandle('youtube'); if (is_object($bt)) { $bt->refresh(); } }
public function up(Schema $schema) { $bt = \BlockType::getByHandle('image_slider'); if (is_object($bt)) { $bt->refresh(); } }
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 run() { $bt = BlockType::getByHandle('guestbook'); if (is_object($bt)) { $bt->refresh(); } }
public function testSave() { $bt = BlockType::installBlockType($this->btHandle); $btx = BlockType::getByID(1); $class = $btx->getBlockTypeClass(); $btc = new $class(); $bID = 1; foreach ($this->requestData as $type => $requestData) { $nb = $bt->add($requestData); $data = $this->expectedRecordData[$type]; $db = Loader::db(); $r = $db->GetRow('select * from `' . $btc->getBlockTypeDatabaseTable() . '` where bID = ?', array($bID)); foreach ($data as $key => $value) { $this->assertTrue($r[$key] == $value, 'Key `' . $key . '` did not equal expected value `' . $value . '` instead equalled `' . $r[$key] . '` (type `' . $type . '`)'); } $bID++; ob_start(); $bv = new BlockView($nb); $bv->render('view'); $contents = ob_get_contents(); ob_end_clean(); $contents = trim($contents); if (isset($this->expectedOutput[$type])) { $this->assertTrue($this->expectedOutput[$type] == $contents, 'Output `' . $contents . '` did not equal expected output `' . $this->expectedOutput[$type] . '` (type `' . $type . '`)'); } } }
public function run() { $bt = BlockType::getByHandle('google_map'); if (is_object($bt) && !$bt->isError()) { $bt->refresh(); } }
public function install() { $pkg = parent::install(); Loader::model('single_page'); Loader::model('job'); // install job $jb = Job::installByPackage('generate_multilingual_sitemap', $pkg); $p = SinglePage::add('/dashboard/multilingual', $pkg); if (is_object($p)) { $p->update(array('cName' => t('Multilingual'), 'cDescription' => t('Translate your site.'))); } $p1 = SinglePage::add('/dashboard/multilingual/setup', $pkg); if (is_object($p1)) { $p1->update(array('cName' => t('Setup'), 'cDescription' => '')); } $p2 = SinglePage::add('/dashboard/multilingual/page_report', $pkg); if (is_object($p2)) { $p2->update(array('cName' => t('Page Report'), 'cDescription' => '')); } BlockType::installBlockTypeFromPackage('switch_language', $pkg); $ak = CollectionAttributeKey::getByHandle('multilingual_exclude_from_copy'); if (!is_object($ak)) { CollectionAttributeKey::add('BOOLEAN', array('akHandle' => 'multilingual_exclude_from_copy', 'akName' => t('Exclude from Internationalization Copy'), 'akIsSearchable' => true), $pkg); } }
public function addBlock($blockTypeHandle) { $bt = BlockType::getByHandle($blockTypeHandle); $cct = ComposerControlType::getByHandle('block'); $control = $ctca->getPageTypeComposerControlByIdentifier($bt->getBlockID()); // add control $composerFLS = $control->addToPageTypeComposerFormLayoutSet($this->layoutSet); }
public function up(Schema $schema) { // added new delimiter settings. $bt = \BlockType::getByHandle('page_attribute_display'); if (is_object($bt)) { $bt->refresh(); } }
public function uninstall() { BlockType::getByHandle('tweetcrete')->controller->uninstall(); parent::uninstall(); //make sure the block table gets dropped $db = Loader::db(); $db->Execute('DROP TABLE IF EXISTS btTweetcrete'); $db->Execute('DROP TABLE IF EXISTS btTweetcreteUserOrHashSettings'); }
private function getOrInstallBlockType($pkg, $btHandle) { $bt = BlockType::getByHandle($btHandle); if (empty($bt)) { BlockType::installBlockTypeFromPackage($btHandle, $pkg); $bt = BlockType::getByHandle($btHandle); } return $bt; }
public function save() { if (isset($this->notesBlock)) { $this->notesBlock->delete(); } $data['content'] = $this->post('dashboard_notes'); $bt = BlockType::getByHandle('content'); $this->uc->addBlock($bt, 'dashboard_notes', $data); $this->redirect('/dashboard/', 'module','notes','notes_saved'); }
public function run() { $bt = BlockType::getByHandle('image'); if (is_object($bt)) { $bt->refresh(); } $bt = BlockType::getByHandle('form'); if (is_object($bt)) { $bt->refresh(); } }
public function up(Schema $schema) { $bt = \BlockType::getByHandle('file'); if (is_object($bt)) { $bt->refresh(); } if (\Config::get('conversation.banned_words')) { \Config::set('conversations.banned_words', true); } }
public function install() { $pkg = parent::install(); //Install block BlockType::installBlockTypeFromPackage('custom_contact_form', $pkg); //Install dashboard page Loader::model('single_page'); $p = SinglePage::add('/dashboard/reports/custom_contact_form', $pkg); $p->update(array('cName' => t('Contact Form Submissions'))); $p->setAttribute('icon_dashboard', 'icon-list-alt'); }
function getRssUrl($b) { $uh = Loader::helper('concrete/urls'); if (!$b) { return ''; } $btID = $b->getBlockTypeID(); $bt = BlockType::getByID($btID); $c = $b->getBlockCollectionObject(); $a = $b->getBlockAreaObject(); $rssUrl = $uh->getToolsURL('rss', 'page_list_teasers') . "?bID=" . $b->getBlockID() . "&cID=" . $c->getCollectionID() . "&arHandle=" . $a->getAreaHandle(); return $rssUrl; }
public function run() { BlockType::installBlockType('tags'); BlockType::installBlockType('next_previous'); BlockType::installBlockType('date_nav'); Loader::model('collection_types'); $blogEntry = CollectionType::getByHandle('blog_entry'); if (!$blogEntry || !intval($blogEntry->getCollectionTypeID())) { $data['ctHandle'] = 'blog_entry'; $data['ctName'] = t('Blog Entry'); $blogEntry = CollectionType::add($data); } }
public function install() { $pkg = parent::install(); Loader::model('single_page'); Loader::model('attribute/categories/collection'); // install attributes $cab1 = CollectionAttributeKey::add('BOOLEAN', array('akHandle' => 'easynews_section', 'akName' => t('NEWS Section'), 'akIsSearchable' => true), $pkg); //install pages $def = SinglePage::add('/dashboard/easy_news', $pkg); $def->update(array('cName' => 'Easy News', 'cDescription' => t('Manage site news.'))); $def = SinglePage::add('/dashboard/easy_news/help', $pkg); $def->update(array('cName' => 'Easy News Help', 'cDescription' => t('Easy News help.'))); //install block BlockType::installBlockTypeFromPackage('easynews_list', $pkg); }
public function add($cID, $arHandle, $btID, $action) { $c = \Page::getByID($cID); if (is_object($c) && !$c->isError()) { $a = \Area::getOrCreate($c, $arHandle); if (is_object($a)) { $ap = new \Permissions($a); $bt = \BlockType::getByID($btID); if (is_object($bt) && $ap->canAddBlock($bt)) { $controller = $bt->getController(); return $this->deliverResponse($controller, $action); } } } $response = new Response(t('Access Denied')); return $response; }
public function up(Schema $schema) { try { $table = $schema->getTable('SystemDatabaseQueryLog'); $table->addColumn('ID', 'integer', array('unsigned' => true, 'autoincrement' => true)); $table->setPrimaryKey(array('ID')); } catch (\Exception $e) { } $db = \Database::connection(); $db->executeQuery("DELETE FROM FileSetFiles WHERE fID NOT IN (SELECT fID FROM Files)"); $db->executeQuery("DELETE FROM FileSearchIndexAttributes WHERE fID NOT IN (SELECT fID FROM Files)"); $db->executeQuery("DELETE FROM DownloadStatistics WHERE fID NOT IN (SELECT fID FROM Files)"); $db->executeQuery("DELETE FROM FilePermissionAssignments WHERE fID NOT IN (SELECT fID FROM Files)"); $bt = \BlockType::getByHandle('page_list'); if (is_object($bt)) { $bt->refresh(); } }
public function testPageStylesBlock() { $ps = new \Concrete\Core\StyleCustomizer\Inline\StyleSet(); $ps->setBackgroundColor('#aaa'); $ps->save(); $c = $this->createPage('This is my test page'); $bt = BlockType::installBlockType('content'); $b = $c->addBlock($bt, 'Main', array('content' => 'Sample content.')); $b->setCustomStyleSet($ps); $this->assertEquals(1, $b->getCustomStyleSetID()); $b2 = Block::getByID(1, $c, 'Main'); $this->assertEquals(1, $b2->getBlockID()); $style = $b2->getCustomStyle(); $this->assertInstanceOf('\\Concrete\\Core\\Block\\CustomStyle', $style); $b2->resetCustomStyle(); $css = $style->getCSS(); $this->assertEquals('ccm-custom-style-container ccm-custom-style-main-1', $style->getContainerClass()); $this->assertEquals('.ccm-custom-style-container.ccm-custom-style-main-1{background-color:#aaa}', $css); }
function testCoreImageBlockWithNoOverridesHasCorrectTemplates() { // Test a. $p = Page::getByID(1); $blocks = $p->getBlocks('Header'); $b = $blocks[0]; $bvt = new BlockViewTemplate($b); $this->assertEqual($bvt->getTemplate(), DIR_BASE_CORE . '/blocks/image/view.php', 'Test A'); // Test b. $bt = BlockType::getByHandle('image'); global $a, $ap, $c, $cp; if (is_object($bt)) { ob_start(); $bv = new BlockView(); $bv->render($bt, 'add', array('a' => $a, 'ap' => $ap, 'c' => $c, 'cp' => $cp)); ob_end_clean(); } $this->assertEqual($bv->getTemplate(), DIR_BASE_CORE . '/blocks/image/add.php', 'Test B'); }
public function testUpdate() { $db = Database::get(); $this->assertTrue($db->tableExists('Files')); $sm = $db->getSchemaManager(); $directory = dirname(__FILE__) . '/fixtures/'; $configuration = new \Concrete\Core\Updater\Migrations\Configuration(); $configuration->setMigrationsDirectory($directory); $configuration->registerMigrationsFromDirectory($directory); $migrations = $configuration->getMigrations(); $originalLogs = $sm->listTableDetails('Logs'); $this->assertEquals(2, count($migrations)); $this->assertTrue(array_key_exists('20140908071333', $migrations)); $this->assertInstanceOf('\\Doctrine\\DBAL\\Migrations\\Version', $migrations['20140908071333']); $migrations = $configuration->getMigrationsToExecute('up', '20140908095447'); $this->assertEquals(2, count($migrations)); $migrations = $configuration->getMigrationsToExecute('up', '20140908071333'); $this->assertEquals(1, count($migrations)); $migration = $migrations['20140908071333']; $migration->execute('up'); $newLogs = $sm->listTableDetails('Logs'); $fPassword = $sm->listTableDetails('Files')->getColumn('fPassword'); $this->assertFalse($originalLogs->hasColumn('testcolumn')); $this->assertTrue($newLogs->hasColumn('testcolumn')); $this->assertInstanceof('\\Doctrine\\DBAL\\Types\\TextType', $fPassword->getType()); $migration->execute('down'); $fPassword = $sm->listTableDetails('Files')->getColumn('fPassword'); $newLogs = $sm->listTableDetails('Logs'); $this->assertInstanceof('\\Doctrine\\DBAL\\Types\\StringType', $fPassword->getType()); $this->assertFalse($newLogs->hasColumn('testcolumn')); $migrations = $configuration->getMigrationsToExecute('up', '20140908095447'); foreach ($migrations as $migration) { $migration->execute('up'); } $this->assertTrue($db->tableExists('Widgets')); $bt = BlockType::getByHandle('file'); $this->assertInstanceOf('\\Concrete\\Core\\Block\\BlockType\\BlockType', $bt); $this->assertEquals(2, $bt->getBlockTypeID()); // because we cleared it out once already. $ids = $db->GetOne('select count(btID) from BlockTypes'); $this->assertEquals(1, $ids); }
private function add_personal_homepage($user_name, $nick_name, $doc_lang) { $page = Page::getByPath("/{$doc_lang}/engineer/{$user_name}"); if ($page->getCollectionID() > 0) { $this->set('error', t('Existed username: %s!', $user_name)); return false; } $page_type = CollectionType::getByHandle('personal_homepage'); $parent_page = Page::getByPath("/{$doc_lang}/engineer"); $page = $parent_page->add($page_type, array('cName' => $nick_name, 'cHandle' => $user_name)); if ($page instanceof Page) { $block_type = BlockType::getByHandle("fse_public_profile"); $area = new Area('Side Bar'); $page->addBlock($block_type, $area, array("fseUsername" => $user_name)); } else { $this->set('error', t('Failed to create personal homepage!')); return false; } return true; }
public function run() { $bt = BlockType::getByHandle('guestbook'); if (is_object($bt)) { $bt->refresh(); } // add user export users task permission $pk = PermissionKey::getByHandle('access_user_search_export'); if (!$pk instanceof PermissionKey) { $pk = PermissionKey::add('user', 'access_user_search_export', 'Export Site Users', 'Controls whether a user can export site users or not', false, false); $pa = $pk->getPermissionAccessObject(); if (!is_object($pa)) { $pa = PermissionAccess::create($pk); } $adminGroup = Group::getByID(ADMIN_GROUP_ID); //Make sure "Adminstrators" group still exists if ($adminGroup) { $adminGroupEntity = GroupPermissionAccessEntity::getOrCreate($adminGroup); $pa->addListItem($adminGroupEntity); $pt = $pk->getPermissionAssignmentObject(); $pt->assignPermissionAccess($pa); } } if (!Config::get('SECURITY_TOKEN_JOBS')) { Config::save('SECURITY_TOKEN_JOBS', Loader::helper('validation/identifier')->getString(64)); } if (!Config::get('SECURITY_TOKEN_ENCRYPTION')) { Config::save('SECURITY_TOKEN_ENCRYPTION', Loader::helper('validation/identifier')->getString(64)); } if (!Config::get('SECURITY_TOKEN_VALIDATION')) { Config::save('SECURITY_TOKEN_VALIDATION', Loader::helper('validation/identifier')->getString(64)); } $sp = Page::getByPath('/dashboard/system/mail/method/test_settings'); if (!is_object($sp) || $sp->isError()) { $sp = SinglePage::add('/dashboard/system/mail/method/test_settings'); $sp->update(array('cName' => t('Test Mail Settings'))); $sp->setAttribute('meta_keywords', 'test smtp, test mail'); } }
public function up(Schema $schema) { // image resizing options $sp = Page::getByPath('/dashboard/system/files/image_uploading'); if (!is_object($sp) || $sp->isError()) { $sp = \Concrete\Core\Page\Single::add('/dashboard/system/files/image_uploading'); $sp->update(array('cName' => 'Image Uploading')); } // background size/position \Concrete\Core\Database\Schema\Schema::refreshCoreXMLSchema(array('StyleCustomizerInlineStyleSets')); $bt = \BlockType::getByHandle('image_slider'); if (is_object($bt)) { $bt->refresh(); } $bt = \BlockType::getByHandle('youtube'); if (is_object($bt)) { $bt->refresh(); } $bt = \BlockType::getByHandle('autonav'); if (is_object($bt)) { $bt->refresh(); } }
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); }
<div class="ccm-dashboard-inner"> <a style="float: right" href="<?=View::url($cPath) ?>"><?= t("« Return to Scrapbook List") ?></a> <div class="sillyIE7"><?= $ih->button_js( t('Add Block to Scrapbook'), 'GlobalScrapbook.addBlock(event)','left'); ?></div> <div class="ccm-spacer"></div> <div id="ccm-scrapbook-list" class="ui-sortable"> <? if( !count($globalScrapbookBlocks) ){ echo t('You have no items in this scrapbook.'); }else foreach($globalScrapbookBlocks as $b) { $b->setBlockAreaObject($globalScrapbookArea); $bv = new BlockView(); $bt = BlockType::getByID( $b->getBlockTypeID() ); $bp = new Permissions($b); $btIcon = $ci->getBlockTypeIconURL($bt); //give this block a name if it doesn't have one if( !strlen($b->getBlockName()) ){ $b->updateBlockName( $scrapbookName.' '.intval($b->bID) ); } ?> <div class="ccm-scrapbook-list-item" id="ccm-scrapbook-list-item-<?=intval($b->bID)?>"> <div class="ccm-block-type"> <div class="options"> <? if ($bp->canWrite()) { ?> <a href="javascript:void(0)" onclick="GlobalScrapbook.toggleRename(<?=intval($b->bID) ?>)"><?=t('Rename')?></a> | <a href="javascript:void(0)" onclick="GlobalScrapbook.editBlockTemplate(<?=intval($b->bID) ?>)" ><?=t('Custom Template')?></a>