1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-19 12:11:55 +02:00

Forum attachment updated to work with recent changes to thumbUrl(). Forum URL post detection improved. Forum attachments can now be seen in the 'Latest Posts" of the admin area.

This commit is contained in:
Cameron 2016-04-16 10:15:29 -07:00
parent 9f3bcbfca6
commit 4aba2f6149
3 changed files with 55 additions and 9 deletions

View File

@ -55,7 +55,8 @@ class forum_url // plugin-folder + '_url'
);
$config['topic'] = array(
'regex' => '^forum/(.*)/(\d*)(?:-|/)([\w-]*)/?\??(.*)',
'regex' => 'forum\/([^\/]*)\/([\d]*)(?:\/|-)([\w-]*)/?\??(.*)',
// 'regex' => '^forum/(.*)/(\d*)(?:-|/)([\w-]*)/?\??(.*)',
'sef' => 'forum/{forum_sef}/{thread_id}/{thread_sef}/',
'redirect' => '{e_PLUGIN}forum/forum_viewtopic.php?id=$2&$4'
);

View File

@ -1155,11 +1155,11 @@ if(!deftrue('OLD_FORUMADMIN'))
'post_entry' => array ( 'title' => "Post", 'type' => 'bbarea', 'data' => 'str', 'width' => '20%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
// 'gen_chardata' => array ( 'title' => "Issue", 'type' => 'method', 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
'post_user' => array ( 'title' => LAN_USER, 'type' => 'user', 'batch'=>false, 'data' => 'int', 'width' => '5%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left nowrap', ),
// 'gen_intdata' => array ( 'title' => "Topic", 'type' => 'method', 'batch'=>true, 'data' => 'int', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ),
'options' => array ( 'title' => LAN_OPTIONS, 'type' => null, 'data' => null, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center last', 'forced' => '1', 'readParms'=>'edit=0' ),
'post_attachments' => array ( 'title' => "Attachments", 'type' => 'method', 'batch'=>false, 'data' => 'int', 'width' => '10%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
'options' => array ( 'title' => LAN_OPTIONS, 'type' => null, 'data' => null, 'width' => '2%', 'thclass' => 'right last', 'class' => 'right last', 'forced' => '1', 'readParms'=>'edit=0' ),
);
protected $fieldpref = array('post_datestamp', 'post_entry', 'post_user');
protected $fieldpref = array('post_datestamp', 'post_entry', 'post_user', 'post_attachments');
// optional
@ -1192,8 +1192,56 @@ if(!deftrue('OLD_FORUMADMIN'))
class post_form_ui extends e_admin_form_ui
{
function post_attachments($curVal,$mode)
{
switch($mode)
{
case 'read': // List Page
$data = e107::unserialize($curVal);
$tp = e107::getParser();
$fl = e107::getFile();
$text = '';
if(!empty($data['img']))
{
$text .= "<ul class='list-unstyled'>";
foreach($data['img'] as $v)
{
$text .= "<li><span class='label label-primary'>".$tp->toGlyph('fa-file-image-o').$v['name']."</span> <small>".$fl->file_size_encode($v['size'])."</small></li>";
}
$text .= "</ul>";
}
if(!empty($data['file']))
{
$text .= "<ul class='list-unstyled'>";
foreach($data['file'] as $v)
{
$text .= "<li><span class='label label-primary'>".$tp->toGlyph('fa-file-text-o').$v['name']."</span> <small>".$fl->file_size_encode($v['size'])."</small></li>";
}
$text .= "</ul>";
}
return $text;
break;
case 'write': // Edit Page
$data = e107::unserialize($curVal);
return print_a($data,true);
break;
case 'filter':
case 'batch':
// return $array;
break;
}
}

View File

@ -109,11 +109,8 @@ class plugin_forum_view_shortcodes extends e_shortcode
$attachArray = e107::unserialize($this->postInfo['post_attachments']);
$thumbAtt = (!empty($this->defaultImgAttachSize)) ? array('w'=>$this->defaultImgAttachSize, 'x'=>1) : null;
if(!empty($this->defaultImgAttachSize))
{
$tp->thumbWidth($this->defaultImgAttachSize); // set the attachment size.
}
//print_a($attachArray);
foreach($attachArray as $type=>$vals)
@ -157,7 +154,7 @@ class plugin_forum_view_shortcodes extends e_shortcode
// return $baseDir.$file;
if(file_exists($baseDir.$file))
{
$thumb = $tp->thumbUrl($baseDir.$file,'x=1',true);
$thumb = $tp->thumbUrl($baseDir.$file,$thumbAtt,true);
$full = $tp->thumbUrl($baseDir.$file,'w=1000&x=1', true);
//TODO Use jQuery zoom instead.