Beispiel #1
0
 protected function lazy_get_children()
 {
     global $core;
     $values = $this->values;
     $nid = $values[Node::NID];
     $is_alone = !$this->module->model->select('nid')->where(array('siteid' => $core->site_id))->rc;
     list($contents_tags) = $this->module->get_contents_section($values[Node::NID], $values[Page::TEMPLATE]);
     #
     # parentid
     #
     $parentid_el = null;
     if (!$is_alone) {
         $parentid_el = new PopPage('select', array(Form::LABEL => 'parentid', Element::OPTIONS_DISABLED => $nid ? array($nid => true) : null, Element::DESCRIPTION => 'parentid'));
     }
     #
     # location element
     #
     $location_el = null;
     if (!$is_alone) {
         $location_el = new PopPage('select', array(Form::LABEL => 'location', Element::GROUP => 'advanced', Element::WEIGHT => 10, Element::OPTIONS_DISABLED => $nid ? array($nid => true) : null, Element::DESCRIPTION => 'location'));
     }
     $contents_children = array();
     if (isset($contents_tags[Element::CHILDREN])) {
         $contents_children = $contents_tags[Element::CHILDREN];
         unset($contents_tags[Element::CHILDREN]);
         $this->attributes = \ICanBoogie\array_merge_recursive($this->attributes, $contents_tags);
     }
     return array_merge(parent::lazy_get_children(), array(Page::LABEL => new Text(array(Form::LABEL => 'label', Element::DESCRIPTION => 'label')), Page::PARENTID => $parentid_el, Page::SITEID => null, Page::IS_NAVIGATION_EXCLUDED => new Element(Element::TYPE_CHECKBOX, array(Element::LABEL => 'is_navigation_excluded', Element::GROUP => 'visibility', Element::DESCRIPTION => 'is_navigation_excluded')), Page::PATTERN => new Text(array(Form::LABEL => 'pattern', Element::GROUP => 'advanced', Element::DESCRIPTION => 'pattern')), Page::LOCATIONID => $location_el), $contents_children);
 }
Beispiel #2
0
 protected function get_attributes()
 {
     global $core;
     $page = $core->site->resolve_view_target('search/home');
     if ($page) {
         $description_link = (string) new A($page->title, \ICanBoogie\Routing\contextualize("/admin/pages/{$page->nid}/edit"));
     } else {
         $description_link = '<q>' . new A('Pages', \ICanBoogie\Routing\contextualize('/admin/pages')) . '</q>';
     }
     return \ICanBoogie\array_merge_recursive(parent::get_attributes(), array(Element::GROUPS => array('primary' => array('description' => I18n\t($page ? 'description' : 'description_nopage', array(':link' => $description_link))))));
 }
Beispiel #3
0
 public function __construct(array $attributes = array())
 {
     global $core;
     $user = $core->user;
     $is_member = !$user->is_guest;
     $values = array();
     if ($is_member) {
         $values[Comment::AUTHOR] = $user->name;
         $values[Comment::AUTHOR_EMAIL] = $user->email;
     }
     parent::__construct(\ICanBoogie\array_merge_recursive($attributes, array(Form::RENDERER => 'Simple', Form::VALUES => $values, Form::HIDDENS => array(Operation::DESTINATION => 'comments', Operation::NAME => 'save'), Element::CHILDREN => array(Comment::AUTHOR => new Text(array(Element::LABEL => 'Name', Element::REQUIRED => true)), Comment::AUTHOR_EMAIL => new Text(array(Element::LABEL => 'E-mail', Element::REQUIRED => true, Element::VALIDATOR => array('Brickrouge\\Form::validate_email'))), Comment::AUTHOR_URL => new Text(array(Element::LABEL => 'Website')), Comment::CONTENTS => new Element('textarea', array(Element::REQUIRED => true, Element::LABEL_MISSING => 'Message', 'class' => 'span6', 'rows' => 8)), Comment::NOTIFY => new Element(Element::TYPE_RADIO_GROUP, array(Form::LABEL => "Shouhaitez-vous être informé d'une réponse à votre message ?", Element::OPTIONS => array('yes' => "Bien sûr !", 'author' => "Seulement si c'est l'auteur du billet qui répond.", 'no' => "Pas la peine, je viens tous les jours."), Element::DEFAULT_VALUE => 'no', 'class' => 'inputs-list'))), Element::WIDGET_CONSTRUCTOR => 'SubmitComment', 'action' => '#view-comments-submit', 'class' => 'widget-submit-comment')), 'div');
 }
Beispiel #4
0
 /**
  * Defines the "view", "list" and "home" views.
  */
 protected function lazy_get_views()
 {
     return \ICanBoogie\array_merge_recursive(parent::lazy_get_views(), ['view' => ['title' => "Record detail", 'provider' => __NAMESPACE__ . '\\ViewProvider', 'assets' => [], 'renders' => \Icybee\Modules\Views\View::RENDERS_ONE], 'list' => ['title' => "Records list", 'provider' => __NAMESPACE__ . '\\ViewProvider', 'assets' => [], 'renders' => \Icybee\Modules\Views\View::RENDERS_MANY], 'home' => ['title' => "Records home", 'provider' => __NAMESPACE__ . '\\ViewProvider', 'assets' => [], 'renders' => \Icybee\Modules\Views\View::RENDERS_MANY]]);
 }
Beispiel #5
0
    public static function alter_block_edit(Event $event)
    {
        global $core;
        if (!isset($core->modules['comments'])) {
            return;
        }
        $values = null;
        $key = 'comments/reply';
        $metas_prefix = 'metas[' . $key . ']';
        if ($event->entry) {
            $entry = $event->entry;
            $values = array($metas_prefix => unserialize($entry->metas[$key]));
        }
        $ns = \ICanBoogie\escape($metas_prefix);
        $event->tags = \ICanBoogie\array_merge_recursive($event->tags, array(Form::VALUES => $values ? $values : array(), Element::CHILDREN => array($key => new Element\Templated('div', array(Element::GROUP => 'notify', Element::CHILDREN => array($metas_prefix . '[is_notify]' => new Element(Element::TYPE_CHECKBOX, array(Element::LABEL => 'Activer la notification aux réponses', Element::DESCRIPTION => "Cette option déclanche l'envoi\n\t\t\t\t\t\t\t\t\t\td'un email à l'auteur ayant choisi d'être informé d'une\n\t\t\t\t\t\t\t\t\t\tréponse à son commentaire.")), $metas_prefix . '[from]' => new Text(array(Form::LABEL => 'Adresse d\'expédition')), $metas_prefix . '[bcc]' => new Text(array(Form::LABEL => 'Copie cachée')), $metas_prefix . '[subject]' => new Text(array(Form::LABEL => 'Sujet du message')), $metas_prefix . '[template]' => new Element('textarea', array(Form::LABEL => 'Patron du message', Element::DESCRIPTION => "Le sujet du message et le corps du message\n\t\t\t\t\t\t\t\t\t\tsont formatés par <a href=\"http://github.com/Weirdog/WdPatron\" target=\"_blank\">WdPatron</a>,\n\t\t\t\t\t\t\t\t\t\tutilisez ses fonctionnalités avancées pour les personnaliser.")))), <<<EOT
<div class="panel">
<div class="form-element is_notify">{\${$metas_prefix}[is_notify]}</div>
<table>
<tr><td class="label">{\${$metas_prefix}[from].label:}</td><td>{\${$metas_prefix}[from]}</td>
<td class="label">{\${$metas_prefix}[bcc].label:}</td><td>{\${$metas_prefix}[bcc]}</td></tr>
<tr><td class="label">{\${$metas_prefix}[subject].label:}</td><td colspan="3">{\${$metas_prefix}[subject]}</td></tr>
<tr><td colspan="4">{\${$metas_prefix}[template]}<button type="button" class="reset small warn" value="/api/forms/feedback.comments/defaults?type=notify" data-ns="{$ns}">Valeurs par défaut</button></td></tr>
</table>
</div>
EOT
))));
    }
Beispiel #6
0
 protected function get_attributes()
 {
     return \ICanBoogie\array_merge_recursive(parent::get_attributes(), array(Element::GROUPS => array('response' => array('title' => "Message de notification à l'auteur lors d'une réponse"), 'spam' => array('title' => 'Paramètres anti-spam'))));
 }
Beispiel #7
0
/*
 * This file is part of the Icybee package.
 *
 * (c) Olivier Laviale <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
$_SERVER['DOCUMENT_ROOT'] = __DIR__;
require __DIR__ . '/../vendor/autoload.php';
#
# Create the _core_ instance used for the tests.
#
global $core;
$core = new \ICanBoogie\Core(\ICanBoogie\array_merge_recursive(\ICanBoogie\get_autoconfig(), ['config-path' => [__DIR__ . DIRECTORY_SEPARATOR . 'config'], 'module-path' => [realpath(__DIR__ . '/../')]]));
$core();
#
# Install modules
#
$errors = new \ICanBoogie\Errors();
foreach (array_keys($core->modules->enabled_modules_descriptors) as $module_id) {
    #
    # The index on the `constructor` column of the `nodes` module clashes with SQLite, we don't
    # care right now, so the exception is discarted.
    #
    try {
        $core->modules[$module_id]->install($errors);
    } catch (\Exception $e) {
        $errors[$module_id] = "Unable to install module: " . $e->getMessage();
    }
Beispiel #8
0
 /**
  * Adds the "archives" view type and adds assets to the inherited "list" view type.
  *
  * @see Icybee\Modules\Contents.Module::get_views()
  */
 protected function get_views()
 {
     $assets = array('css' => array(DIR . 'public/page.css'));
     return \ICanBoogie\array_merge_recursive(parent::get_views(), array('list' => array('assets' => $assets), 'archives' => array('title' => "Archives des articles", 'class' => __NAMESPACE__ . '\\ArchivesView', 'provider' => 'Icybee\\Modules\\Contents\\ViewProvider', 'assets' => $assets, 'renders' => View::RENDERS_MANY)));
 }
Beispiel #9
0
 protected function get_views()
 {
     $assets = array('assets' => array('css' => array(DIR . 'public/page.css')));
     return \ICanBoogie\array_merge_recursive(parent::get_views(), array('view' => $assets, 'list' => $assets, 'home' => $assets));
 }
Beispiel #10
0
 protected function lazy_get_attributes()
 {
     return \ICanBoogie\array_merge_recursive(parent::lazy_get_attributes(), [Element::GROUPS => ['connection' => ['title' => 'Connection'], 'advanced' => ['title' => 'Advanced']]]);
 }
 public function __construct($tags, $dummy = null)
 {
     parent::__construct(\ICanBoogie\array_merge_recursive($tags, array(Element::CHILDREN => array('gender' => new Element(Element::TYPE_RADIO_GROUP, array(self::LABEL => 'Gender', Element::OPTIONS => array('salutation.misses', 'salutation.miss', 'salutation.mister'), Element::REQUIRED => true)), 'lastname' => new Text(array(self::LABEL => 'Lastname', Element::REQUIRED => true)), 'firstname' => new Text(array(self::LABEL => 'Firstname', Element::REQUIRED => true)), 'media' => new Text(array(self::LABEL => 'Média')), 'email' => new Text(array(self::LABEL => 'E-Mail', Element::REQUIRED => true, Element::VALIDATOR => array('Brickrouge\\Form::validate_email'))), 'subject' => new Text(array(self::LABEL => 'Subject', Element::REQUIRED => true)), 'message' => new Element('textarea', array(self::LABEL => 'Your message'))))));
 }
Beispiel #12
0
 protected function lazy_get_attributes()
 {
     return \ICanBoogie\array_merge_recursive(parent::lazy_get_attributes(), array(Element::GROUPS => array('album' => array('title' => 'Photos', 'description' => "Les photos peuvent être ordonnées par glisser-déposer."))));
 }
Beispiel #13
0
 protected function get_attributes()
 {
     return \ICanBoogie\array_merge_recursive(parent::get_attributes(), array(Element::GROUPS => array('messages' => array('title' => 'messages'), 'options' => array('title' => 'options'), 'operation' => array('title' => 'operation'))));
 }
Beispiel #14
0
 /**
  * Overrides the "view", "list" and "home" views to provide different providers.
  */
 protected function lazy_get_views()
 {
     $options = ['assets' => ['css' => [DIR . 'public/page.css']], 'provider' => __NAMESPACE__ . '\\ViewProvider'];
     return \ICanBoogie\array_merge_recursive(parent::lazy_get_views(), ['view' => $options, 'list' => $options, 'home' => $options]);
 }
 /**
  * Resolves heritage between modules.
  *
  * @param array $modules
  *
  * @return array
  */
 protected function resolve_heritage(array $modules)
 {
     foreach ($modules as &$module) {
         if (empty($module[Options::DIRECTIVE_INHERITS])) {
             continue;
         }
         $inherits = $module[Options::DIRECTIVE_INHERITS];
         unset($module[Options::DIRECTIVE_INHERITS]);
         $module = \ICanBoogie\array_merge_recursive($modules[$inherits], $module);
     }
     return $modules;
 }
Beispiel #16
0
 public function __construct(array $attributes = array())
 {
     parent::__construct(\ICanBoogie\array_merge_recursive($attributes, array(self::RENDERER => 'Simple', Element::CHILDREN => array('gender' => new Element(Element::TYPE_RADIO_GROUP, array(self::LABEL => 'Salutation', Element::OPTIONS => array('salutation.Misses', 'salutation.Mister'), Element::REQUIRED => true, 'class' => 'inline-inputs')), 'firstname' => new Text(array(self::LABEL => 'Firstname', Element::REQUIRED => true)), 'lastname' => new Text(array(self::LABEL => 'Lastname', Element::REQUIRED => true)), 'company' => new Text(array(self::LABEL => 'Company')), 'email' => new Text(array(self::LABEL => 'E-mail', Element::REQUIRED => true, Element::VALIDATOR => array('Brickrouge\\Form::validate_email'))), 'message' => new Element('textarea', array(self::LABEL => 'Your message', Element::REQUIRED => true))))), 'div');
 }
Beispiel #17
0
 protected function get_attributes()
 {
     return \ICanBoogie\array_merge_recursive(parent::get_attributes(), array(Element::GROUPS => array('location' => array('title' => 'Emplacement', 'class' => 'location'), 'i18n' => array('title' => 'Internationalisation'), 'advanced' => array('title' => 'Advanced parameters'))));
 }
 public function __construct(array $attributes = array())
 {
     global $core;
     parent::__construct(\ICanBoogie\array_merge_recursive(array(Element::CHILDREN => array(new Element('div', array(Form::LABEL => 'Dimensions', Element::CHILDREN => array('w' => $this->elements['w'] = new Text(array(Text::ADDON => 'px', 'class' => 'measure', 'size' => 5)), ' × ', 'h' => $this->elements['h'] = new Text(array(Text::ADDON => 'px', 'class' => 'measure', 'size' => 5))))), 'method' => $this->elements['method'] = new Element('select', array(Form::LABEL => 'Méthode', Element::OPTIONS => array(Image::RESIZE_FILL => 'Remplir', Image::RESIZE_FIT => 'Ajuster', Image::RESIZE_SURFACE => 'Surface', Image::RESIZE_FIXED_HEIGHT => 'Hauteur fixe, largeur ajustée', Image::RESIZE_FIXED_HEIGHT_CROPPED => 'Hauteur fixe, largeur respectée', Image::RESIZE_FIXED_WIDTH => 'Largeur fixe, hauteur ajustée', Image::RESIZE_FIXED_WIDTH_CROPPED => 'Largeur fixe, hauteur respectée', Image::RESIZE_CONSTRAINED => 'Contraindre'))), 'no-upscale' => $this->elements['no-upscale'] = new Element(Element::TYPE_CHECKBOX, array(Element::LABEL => 'Redimensionner mais ne pas agrandir')), new Element('div', array(Form::LABEL => 'Format de la miniature', self::CHILDREN => array('format' => $this->elements['format'] = new Element('select', array(self::OPTIONS => array('jpeg' => 'JPEG', 'png' => 'PNG', 'gif' => 'GIF'), self::DEFAULT_VALUE => 'jpeg', 'style' => 'vertical-align: middle; width: auto')), '&nbsp;', 'quality' => $this->elements['quality'] = new Text(array(Text::ADDON => 'Qualité', Text::ADDON_POSITION => 'before', self::DEFAULT_VALUE => 80, 'class' => 'measure', 'size' => 3))))), 'background' => $this->elements['background'] = new Text(array(Form::LABEL => 'Remplissage')), 'filter' => $this->elements['filter'] = new Text(array(Form::LABEL => 'Filtre'))), 'class' => 'adjust widget-adjust-thumbnail-version', 'data-widget-constructor' => 'AdjustThumbnailVersion'), $attributes));
 }
 public function __construct($tags, $dummy = null)
 {
     parent::__construct(\ICanBoogie\array_merge_recursive($tags, array(self::RENDERER => 'Simple', Element::CHILDREN => array('email' => new Text(array(Element::LABEL => 'Votre e-mail', Element::REQUIRED => true, Element::VALIDATOR => array('Brickrouge\\Form::validate_email'))), 'message' => new Element('textarea', array(self::LABEL_MISSING => 'Message', Element::REQUIRED => true))))));
 }
Beispiel #20
0
 public function __construct(array $attributes = array())
 {
     parent::__construct(\ICanBoogie\array_merge_recursive(array(self::CHILDREN => array('from' => new Text(array(Group::LABEL => 'email_from')), 'destination' => new Text(array(Group::LABEL => 'email_destination')), 'bcc' => new Text(array(Group::LABEL => 'email_bcc')), 'subject' => new Text(array(Group::LABEL => 'email_subject')), 'template' => new Element('textarea', array(Group::LABEL => 'email_template')))), $attributes));
 }