protected function init()
 {
     parent::init();
     $this->tag = null;
     $this->template = __DIR__ . '/select.tpl';
     $this->addClass('ui_panel_select');
 }
 protected function init()
 {
     parent::init();
     $this->tag = 'p';
     $this->template = __DIR__ . '/text.tpl';
     $this->addClass('ui_panel_text');
 }
 protected function init()
 {
     parent::init();
     // FIXME (CSH) Re-implement fallback / root panel submission / find a better solution ...
     //       $this->form('POST', null, Io_Mimetype::APPLICATION_FORM_URLENCODED(), 'ISO-8859-15');
     $this->form();
     //       $this->ajaxEnabled=false;
     $this->add(new Ui_Panel_Label('labela', null, 'Google.com.hk 使用下列语言: 中文(繁體) English'));
     $this->add(new Ui_Panel_Label('labelb', null, I18n_Script::Hans()->transformToLatn('Google.com.hk 使用下列语言: 中文(繁體) English')));
     $this->add(new Ui_Panel_Label('labelc', null, I18n_Script::Hans()->transformToAscii('Google.com.hk 使用下列语言: 中文(繁體) English')));
     $this->add(new Ui_Panel_Label('labeld', null, String::toLowercaseUrlIdentifier(I18n_Script::Hans()->transformToAscii('Google.com.hk 使用下列语言: 中文(繁體) English'))));
     $this->add(new Ui_Panel_Tabs('tabs'));
     $this->tabs->add(new Ui_Panel_Disclosure('disclosure', null, 'Disclosure'));
     $this->tabs->disclosure->add(new Ui_Panel_Datetime('date'));
     $this->tabs->add(new Ui_Panel_Editor_Text('text', null, 'Text'));
     $this->tabs->add(new Ui_Panel_Image('image', Io_Image::valueOf(__DIR__ . '/test.jpg'), 'Image'));
     $this->tabs->image->attribute('width', 64);
     $this->tabs->image->embedded = true;
     $this->tabs->add(new Ui_Panel_Upload_File('file', null, 'File'));
     $this->tabs->add(new Ui_Panel_Select('list', null, 'List', ['A', 'B', 'C']));
     $this->tabs->add(new Ui_Panel_Editor_Html('html', null, 'HTML'));
     $button = new Ui_Panel_Button_Submit('submit', null, 'Submit');
     $button->callback = [$this, 'onSubmit'];
     $this->add($button);
 }
 protected function init()
 {
     parent::init();
     $this->tag = null;
     $this->template = __DIR__ . '/pager.tpl';
     $this->panelType = 'ui/panel/pager';
     $this->panelPropertiesToggle = ['page', 'pageable', 'swipe'];
     $this->addClass('ui_panel_pager');
 }
 protected function init()
 {
     parent::init();
     $this->template = __DIR__ . '/datetime.tpl';
     $this->addClass('ui_panel_datetime');
     if (!($value = $this->value())) {
         $this->value(Date::now());
     }
 }
 protected function init()
 {
     parent::init();
     $this->tag = null;
     $this->template = __DIR__ . '/button.tpl';
     $this->attribute('type', self::TYPE_PLAIN);
     $this->attribute('value', $this->title);
     $this->addClass('ui_panel_button');
 }
 /**
  * @see \Components\Ui_Panel::onRetrieveValue() onRetrieveValue
  */
 protected function onRetrieveValue()
 {
     parent::onRetrieveValue();
     $uploadPathTmp = self::temporaryUploadPath();
     if ($uploadPathTmp->isDirectory()) {
         $this->scanTemporaryUploadPath($uploadPathTmp);
     }
     $uploadPath = self::uploadPath();
     $this->m_files = [];
     $this->scanUploadPath($uploadPath, '', $this->m_files);
     if (($remove = $this->requestParam('remove')) && isset($this->m_files[$remove])) {
         $this->m_files[$remove]->delete();
         unset($this->m_files[$remove]);
     }
 }
 public function render($panel_ = null)
 {
     /* @var $value \Components\Io_Image */
     if (($value = $this->value()) && $value->exists()) {
         $image = $value;
         $height = (int) $this->attribute('height');
         $width = (int) $this->attribute('width');
         if ($width || $height) {
             $dimensions = $value->getDimensions();
             if (!$width) {
                 $width = round($dimensions->x / ($dimensions->y / $height));
             } else {
                 if (!$height) {
                     $height = round($dimensions->y / ($dimensions->x / $width));
                 }
             }
             if ($this->embedded) {
                 $image = Io_Image::valueOf(Environment::pathResource('ui', 'image', 'tmp', $width, $height, $value->getName()));
                 if (false === $image->exists()) {
                     $value->scale(Point::of($width, $height));
                     $value->saveAs($image);
                 }
             }
         }
         $this->attribute('width', $width);
         $this->attribute('height', $height);
         if ($this->embedded) {
             $this->attribute('src', sprintf('data:%s;base64,%s', $image->getMimetype(), $image->getBase64()));
         } else {
             $this->attribute('src', (string) Media_Scriptlet_Engine::imageUri('thumbnail', $image->getPath(), $width, $height));
         }
     } else {
         if (null !== $value && Debug::active()) {
             Log::debug('components/ui/panel/image', 'Image for given location does not exist [%s].', $value);
         }
     }
     return parent::render();
 }
 /**
  * @see \Components\Ui_Panel::remove() remove
  */
 public function remove(UI_Panel $panel_)
 {
     parent::remove($panel_);
     $index = [];
     while ($next = array_shift($this->m_index)) {
         if ($next === $panel_->name) {
             continue;
         }
         array_push($index, $next);
     }
     $this->m_index = $index;
     $this->m_count--;
 }
 /**
  * @see \Components\Ui_Panel::value() value
  */
 public function value($value_ = null)
 {
     return (array) parent::value($value_);
 }
 /**
  * @see \Components\Ui_Panel::add() add
  */
 public function add(Ui_Panel $panel_, $category_ = null)
 {
     parent::add($panel_, $category_);
     $panel_->addClass('ui_panel_slider_item');
 }
 protected function init()
 {
     parent::init();
     $this->addClass('ui_panel_label');
 }
 protected function init()
 {
     parent::init();
     $this->template = __DIR__ . '/frame.tpl';
     $this->addClass('ui_panel_frame');
 }
 /**
  * @param \Components\Ui_Panel $panel_
  */
 public function remove(Ui_Panel $panel_)
 {
     $panel_->parent = null;
     $panel_->clearId();
     foreach ($this->m_categories as $category => $panels) {
         if (isset($this->m_categories[$category][$panel_->name])) {
             unset($this->m_categories[$category][$panel_->name]);
         }
     }
     unset($this->m_children[$panel_->name]);
 }