public function GetInput()
 {
     $dropdown = create_file_dropdown($this->GetProperty('inputname'), $this->GetProperty('dir'), $this->GetContent(), 'jpg,jpeg,png,gif', '', $this->GetProperty('allow_none'), '', $this->GetProperty('prefix'), $this->GetProperty('exclude'));
     if ($dropdown === false) {
         $dropdown = lang('error_retrieving_file_list');
     }
     return $dropdown;
 }
Beispiel #2
0
 /**
  * A method to display a single input element for an object basic, or extended property.
  *
  * @abstract
  * @param string The property name
  * @param boolean Wether or not we are in add or edit mode.
  * @return array consisting of two elements.  A label, and the input element.
  */
 protected function display_single_element($one, $adding)
 {
     $gCms = cmsms();
     $config = $gCms->GetConfig();
     switch ($one) {
         case 'cachable':
             return array('<label for="in_cachable">' . lang('cachable') . ':</label>', '<input type="hidden" name="cachable" value="0"/><input id="in_cachable" class="pagecheckbox" type="checkbox" value="1" name="cachable"' . ($this->mCachable ? ' checked="checked"' : '') . ' />', lang('help_page_cachable'));
             break;
         case 'title':
             return array('<label for="in_title">*' . lang('title') . '</label>:', '<input type="text" id="in_title" name="title" value="' . cms_htmlentities($this->mName) . '" />');
             break;
         case 'menutext':
             return array('<label for="in_menutext">*' . lang('menutext') . '</label>:', '<input type="text" name="menutext" id="in_menutext" value="' . cms_htmlentities($this->mMenuText) . '" />');
             break;
         case 'parent':
             $contentops = $gCms->GetContentOperations();
             $tmp = $contentops->CreateHierarchyDropdown($this->mId, $this->mParentId, 'parent_id', 0, 1, 0, 1, get_site_preference('listcontent_showtitle', true));
             if (empty($tmp) && !check_permission(get_userid(), 'Manage All Content')) {
                 return array('', '<input type="hidden" name="parent_id" value="' . $this->mParentId . '" />');
             }
             if (!empty($tmp)) {
                 return array('<label for="parent_id">' . lang('parent') . '</label>:', $tmp);
             }
             break;
         case 'active':
             if (!$this->DefaultContent()) {
                 return array('<label for="id_active">' . lang('active') . '</label>:', '<input type="hidden" name="active" value="0"/><input class="pagecheckbox" type="checkbox" name="active" id="id_active" value="1"' . ($this->mActive ? ' checked="checked"' : '') . ' />');
             }
             break;
         case 'showinmenu':
             return array('<label for="showinmenu">' . lang('showinmenu') . '</label>:', '<input type="hidden" name="showinmenu" value="0"/><input class="pagecheckbox" type="checkbox" value="1" name="showinmenu" id="showinmenu"' . ($this->mShowInMenu ? ' checked="checked"' : '') . ' />');
             break;
         case 'target':
             $text = '<option value="---">' . lang('none') . '</option>';
             $text .= '<option value="_blank"' . ($this->GetPropertyValue('target') == '_blank' ? ' selected="selected"' : '') . '>_blank</option>';
             $text .= '<option value="_parent"' . ($this->GetPropertyValue('target') == '_parent' ? ' selected="selected"' : '') . '>_parent</option>';
             $text .= '<option value="_self"' . ($this->GetPropertyValue('target') == '_self' ? ' selected="selected"' : '') . '>_self</option>';
             $text .= '<option value="_top"' . ($this->GetPropertyValue('target') == '_top' ? ' selected="selected"' : '') . '>_top</option>';
             return array('<label for="target">' . lang('target') . '</label>:', '<select name="target" id="target">' . $text . '</select>', lang('info_target'));
             break;
         case 'alias':
             return array('<label for="alias">' . lang('pagealias') . '</label>:', '<input type="text" name="alias" id="alias" value="' . $this->mAlias . '" />', lang('help_page_alias'));
             break;
         case 'secure':
             $opt = '';
             if ($this->mSecure) {
                 $opt = ' checked="checked"';
             }
             $str = '<input type="hidden" name="secure" value="0"/>';
             $str .= '<input type="checkbox" name="secure" id="secure" value="1"' . $opt . '/>';
             return array('<label for="secure">' . lang('secure_page') . '</label>:', $str);
             break;
         case 'page_url':
             if (!$this->DefaultContent()) {
                 $str = '<input type="text" name="page_url" id="page_url" value="' . $this->mURL . '" size="50" maxlength="255"/>';
                 $prompt = '<label for="page_url">' . lang('page_url') . '</label>:';
                 if (get_site_preference('content_mandatory_urls', 0)) {
                     $prompt = '*' . $prompt;
                 }
                 return array($prompt, $str, lang('help_page_url'));
             }
             break;
         case 'image':
             $dir = cms_join_path($config['image_uploads_path'], get_site_preference('content_imagefield_path'));
             $data = $this->GetPropertyValue('image');
             $dropdown = create_file_dropdown('image', $dir, $data, 'jpg,jpeg,png,gif', '', true, '', 'thumb_', 1, 1);
             if (!$dropdown) {
                 return;
             }
             return array('<label for="image">' . lang('image') . '</label>:', $dropdown);
             break;
         case 'thumbnail':
             $dir = cms_join_path($config['image_uploads_path'], get_site_preference('content_thumbnailfield_path'));
             $data = $this->GetPropertyValue('thumbnail');
             $dropdown = create_file_dropdown('thumbnail', $dir, $data, 'jpg,jpeg,png,gif', '', true, '', 'thumb_', 0, 1);
             if (!$dropdown) {
                 return FALSE;
             }
             return array('<label for="thumbnail">' . lang('thumbnail') . '</label>:', $dropdown);
             break;
         case 'titleattribute':
             return array('<label for="titleattribute">' . lang('titleattribute') . '</label>:', '<input type="text" name="titleattribute" id="titleattribute" maxlength="255" size="80" value="' . cms_htmlentities($this->mTitleAttribute) . '" />');
             break;
         case 'accesskey':
             return array('<label for="accesskey">' . lang('accesskey') . '</label>:', '<input type="text" name="accesskey" id="accesskey" maxlength="5" value="' . cms_htmlentities($this->mAccessKey) . '" />');
             break;
         case 'tabindex':
             return array('<label for="tabindex">' . lang('tabindex') . '</label>:', '<input type="text" name="tabindex" id="tabindex" maxlength="5" value="' . cms_htmlentities($this->mTabIndex) . '" />');
             break;
         case 'extra1':
             return array('<label for="extra1">' . lang('extra1') . '</label>:', '<input type="text" name="extra1" id="extra1" maxlength="255" size="80" value="' . cms_htmlentities($this->GetPropertyValue('extra1')) . '" />');
             break;
         case 'extra2':
             return array('<label for="extra2">' . lang('extra2') . '</label>:', '<input type="text" name="extra2" id="extra2" maxlength="255" size="80" value="' . cms_htmlentities($this->GetPropertyValue('extra2')) . '" />');
             break;
         case 'extra3':
             return array('<label for="extra3">' . lang('extra3') . '</label>:', '<input type="text" name="extra3" id="extra3" maxlength="255" size="80" value="' . cms_htmlentities($this->GetPropertyValue('extra3')) . '" />');
             break;
         case 'owner':
             $showadmin = check_ownership(get_userid(), $this->Id());
             $userops = $gCms->GetUserOperations();
             if (!$adding && ($showadmin || check_permission(get_userid(), 'Manage All Content'))) {
                 return array('<label for="owner">' . lang('owner') . '</label>:', $userops->GenerateDropdown($this->Owner()));
             }
             break;
         case 'additionaleditors':
             // do owner/additional-editor stuff
             if ($adding || check_ownership(get_userid(), $this->Id()) || check_permission(get_userid(), 'Manage All Content')) {
                 return $this->ShowAdditionalEditors();
             }
             break;
         default:
             stack_trace();
             die('unknown property ' . $one);
     }
 }
 private function _display_image_block($blockInfo, $value, $adding)
 {
     $gCms = cmsms();
     $config = $gCms->GetConfig();
     $adddir = get_site_preference('contentimage_path');
     if ($blockInfo['dir'] != '') {
         $adddir = $blockInfo['dir'];
     }
     $dir = cms_join_path($config['uploads_path'], $adddir);
     $optprefix = '';
     //$optprefix = 'uploads';
     //if( !empty($blockInfo['dir']) ) $optprefix .= '/'.$blockInfo['dir'];
     $inputname = $blockInfo['id'];
     if (isset($blockInfo['inputname'])) {
         $inputname = $blockInfo['inputname'];
     }
     $dropdown = create_file_dropdown($inputname, $dir, $value, 'jpg,jpeg,png,gif', $optprefix, true);
     if ($dropdown === false) {
         $dropdown = lang('error_retrieving_file_list');
     }
     return $dropdown;
 }
Beispiel #4
0
 private function _display_image_block($blockInfo, $value, $adding)
 {
     global $gCms;
     $config =& $gCms->GetConfig();
     $dir = cms_join_path($config['uploads_path'], $blockInfo['dir']);
     $optprefix = 'uploads';
     if (!empty($blockInfo['dir'])) {
         $optprefix .= '/' . $blockInfo['dir'];
     }
     $inputname = $blockInfo['id'];
     if (isset($blockInfo['inputname'])) {
         $inputname = $blockInfo['inputname'];
     }
     $dropdown = create_file_dropdown($inputname, $dir, $value, 'jpg,jpeg,png,gif', $optprefix, true);
     if ($dropdown === false) {
         $dropdown = lang('error_retrieving_file_list');
     }
     return $dropdown;
 }