$info) {
$currentvalue = isset($values[$name]) ? $values[$name] : null;
if (!empty($info['values'])) {
$options = explode(',', $info['values']);
$optionhtml = '';
foreach ($options as $i=>$option) {
$option = trim($option);
$optionhtml .= <<isSelected($currentvalue, $option)}>$option
CUSTOM_OPTION;
}
$html .= <<
OPTION_HTML;
}
else {
$html .= <<
CUSTOM_INPUT;
}
}
return $this->fieldset(_DOWN_CUSTOM_FIELDS_HEAD, $html);
}
private function isSelected ($value, $option) {
if ($value == $option) return 'selected="selected"';
}
private function showClassification ($fileid) {
$classfnlist = remositoryClassification::classfnList($fileid);
$html = '';
foreach ($classfnlist as $type=>$clist) {
$html .= <<
$type: |
$clist |
CLASSN_LIST;
}
if ($html) $classnhtml = <<
$html
CLASSN_HTML;
if (!empty($classnhtml)) return $this->fieldset(_DOWN_CLASSIFICATIONS, $classnhtml);
}
private function showPublishing ($file) {
$html = $this->simpleCheckBox ($file, 'published', _DOWN_PUB);
$html .= $this->simpleInputBox(_DOWN_PUBLISH_FROM,'publish_from',$file->publish_from,25);
$html .= $this->simpleInputBox(_DOWN_PUBLISH_TO,'publish_to',$file->publish_to,25);
return $this->fieldset(_DOWN_PUBLISHING, $html);
}
private function showFeaturing ($file) {
$html = $this->simpleCheckBox ($file, 'featured', _DOWN_IS_FEATURED);
$html .= $this->simpleInputBox(_DOWN_FEATURE_START,'featured_st_date',$file->featured_st_date,25);
$html .= $this->simpleInputBox(_DOWN_FEATURE_END,'featured_end_date',$file->featured_end_date,25);
return $this->fieldset(_DOWN_FEATURED, $html);
}
private function showMetadata ($file) {
$html = $this->simpleInputBox(_DOWN_KEYWORDS,'keywords',$file->keywords,50);
$html .= $this->simpleInputBox(_DOWN_WINDOW_TITLE,'windowtitle',$file->windowtitle,50);
return $this->fieldset(_DOWN_METADATA, $html);
}
private function showShortDescription ($file) {
$html = $this->simpleCheckBox ($file, 'autoshort', _DOWN_AUTO_SHORT);
$html .= $this->simpleInputArea(_DOWN_DESC_SMALL, _DOWN_DESC_SMALL_MAX, 'smalldesc', $file->smalldesc, 6, 44, false);
return $this->fieldset(_DOWN_SHORT_DESCRIPTION, $html);
}
private function showLicense ($file) {
$html = $this->simpleCheckBox ($file, 'licenseagree', _DOWN_LICENSE_AGREE);
$html .= $this->simpleInputArea(_DOWN_LICENSE, _DOWN_DESC_MAX, 'license', $file->license, 6, 44, false);
return $this->fieldset(_DOWN_LICENSE_HEADING, $html);
}
private function showAboutFile ($file) {
$html = $this->simpleInputBox(_DOWN_FILE_AUTHOR,'fileauthor',$file->fileauthor,25);
$html .= $this->simpleInputBox(_DOWN_DOWNLOADS,'downloads',$file->downloads,25);
$html .= $this->simpleInputBox(_DOWN_FILE_DATE,'filedate',$file->filedate,25);
$html .= $this->simpleInputBox(_DOWN_FILE_SIZE,'filesize',$file->filesize,25);
$html .= $this->simpleInputBox(_DOWN_FILE_TYPE,'filetype',$file->filetype,25);
$html .= $this->simpleInputBox(_DOWN_FILE_HOMEPAGE,'filehomepage',$file->filehomepage,25);
$file->addSubmitterEmail();
$html .= $this->showSubmitterEmail ($file);
return $this->fieldset(_DOWN_ABOUT_FILE, $html);
}
private function showSubmitterEmail ($file) {
if (isset($file->submit_email)) {
$legend = _DOWN_SUB_ID_SORT;
return <<
$file->submit_email
EMAIL_LINK;
}
}
private function showComments ($comments, $interface, $fileid) {
$listhtml = '';
foreach ($comments as $comment) {
$time = strtotime($comment->date);
if ($this->repository->Set_date_locale) {
setlocale(LC_TIME, $this->repository->Set_date_locale);
$date = strftime($this->repository->Date_Format, $time);
}
else $date = date ($this->repository->Date_Format, $time);
// Change for multiple repositories
// $dlink = $interface->getCfg('admin_site')."/index2.php?option=com_remository&repnum=$this->repnum&act=files&task=dcomment&cfid=$fileid&commentid=$comment->id";
$dlink = $interface->getCfg('admin_site')."/index2.php?option=com_remository&act=files&task=dcomment&cfid=$fileid&commentid=$comment->id";
$listhtml .= <<
Delete
|
$date
|
$comment->username
|
|
COMMENT_LINE;
}
if (count($comments)) {
$date_head = _DOWN_DATE;
$user_head = _DOWN_NAME_TITLE;
$comment_head = _DOWN_COMMENTS;
$html = <<
| |
$date_head |
$user_head |
$comment_head |
$listhtml
COMMENTS;
return $this->fieldset(_DOWN_COMMENTS_HEADING, $html);
}
}
private function showPhysical ($file, $orphanpath) {
$html = '';
if ($file->islocal) {
if ($file->id) $html .= $this->simpleInputBox(_DOWN_REAL_NAME,'realname',$file->realname(),44);
if (!$orphanpath) $html .= $this->simpleUploadBox(_SUBMIT_NEW_FILE, 39);
}
else $html .= $this->simpleInputBox(_DOWNLOAD_URL,'url',$file->url(),44);
if (!$file->islocal) $html .= $this->showLocaliseLink($file);
return $this->fieldset(_DOWN_PHYSICAL_FILE, $html);
}
private function showLocaliseLink ($file) {
$interface = remositoryInterface::getInstance();
$absolute_path = $interface->getCfg('absolute_path');
$live_site = $interface->getCfg('live_site');
$oldpath = $absolute_path.substr($file->url,strlen($live_site));
$linktext = _DOWN_LOCALISE_REMOTE_FILE;
if (0 === strpos($file->url,$live_site) AND file_exists($oldpath)) return <<
$linktext
LOCALISE_LINK;
}
public function view ($file, $customnames, $comments=array())
{
if (!$this->clist) {
echo _DOWN_FILE_SUBMIT_NOCHOICES;
return;
}
$interface = remositoryInterface::getInstance();
$live_site = $interface->getCfg('live_site');
$orphanpath = remositoryRepository::getParam($_REQUEST, 'orphanpath', '');
$containerid = isset($file->containerid) ? $file->containerid : '';
$oldid = isset($file->oldid) ? $file->oldid : '';
if (!realpath($orphanpath)) $orphanpath = '';
$iconList = remositoryFile::getIcons();
$this->commonScripts('description');
if (!defined('_ALIRO_IS_PRESENT')) $formstart = <<
FORM_START;
else $formstart = '';
$heading = _DOWN_REMOSITORY.' '._DOWN_EDIT_FILE.' (ID='.$file->id.')';
$loctext = _DOWN_SUGGEST_LOC;
$leftcontents = $this->narrowInputBox(_DOWN_FILE_TITLE, 'filetitle', $file->filetitle, 50);
$leftcontents .= $this->narrowInputBox(_DOWN_SUBTITLE, 'subtitle', $file->subtitle, 50);
$leftcontents .= $this->narrowInputBox(_DOWN_FILE_VER,'fileversion',$file->fileversion,15);
$leftcontents .= $this->narrowInputBox(_DOWN_PRICE_LABEL,'price',$file->price,15);
$leftcontents .= $this->simpleInputArea(_DOWN_DESC, _DOWN_DESC_MAX, 'description', $file->description, 50, 100, true);
$leftcontents .= $this->showCustomFields($file->custom_values, $customnames);
$leftcontents .= $this->showClassification($file->id);
$leftcontents .= $this->simpleIcons($file, $iconList);
$leftcontents .= $this->showComments($comments, $interface, $file->id);
if ($this->repository->Max_Thumbnails == 0) $leftcontents .= $this->simpleInputBox(_DOWN_SCREEN,'screenurl',$file->screenurl,75);
$this->editfileScript();
echo <<
$formstart
$loctext
$this->clist
$leftcontents
MAIN_DIV;
echo $this->showPublishing($file);
echo $this->showFeaturing($file);
echo $this->showPhysical($file, $orphanpath);
echo $this->showMetadata($file);
echo $this->showShortDescription($file);
echo $this->showLicense($file);
echo $this->showAboutFile($file);
//echo $this->showAccessControl($file, $roleselect);
echo <<
END_PAGE;
if (!defined('_ALIRO_IS_PRESENT')) echo '';
$tooltip = <<
TOOL_TIP;
$interface->addCustomHeadTag($tooltip);
}
}