Seite 1 von 2

Dateianhänge-Block (Board3 Portal) "falsch herum"+Hyperlink

Verfasst: 26.01.2012 09:19
von techno-com
Ein Hallo....

habe jetzt das Board und auch den "großen Freund" kreuz und quer gefüttert mit Suchanfragen, scheinbar bin ich aber echt der einzige der mein Anliegen nicht lösen konnte bzw. den es überhaupt stört.

Es geht um das "Portal Modul" vom Board3-Portal namens "Dateianhänge-Block".

Dieser zeigt bei mir die letzten 3-5 Dateianhänge auf der Portal-Startseite an die erstellt/hochgeladen wurden, finde ich eine schöne Sache.
Die Reihenfolge dieser Anzeige ist allerdings akt. so das der älteste Anhand zuerst angezeigt wird, also eigentlich genau falsch herum wie es sein sollte.

Ich kann das ändern indem ich im Admin-Panel unter "Sortierung der Dateianhänge: => Dateianhänge sortiert nach Erstellungszeit anzeigen. => Absteigend Aufsteigend" von aufsteigend auf absteigend umstelle.... dann werden aber die Dateianhänge in allen erstellten Beiträgen auch umgedreht und das ist natürlich nicht hinnehmbar da div. Beiträge auf "Bild1" verlinken was dann natürlich statt weiterhin vorne dann ganz hinten stehen würde !

Frage also => wo kann ich das "einzeln" umstellen von aufsteigend auf absteigend beim "Dateianhänge-Block" oder andersherum bei der Bilderanzeige im Beitrag ?

---------------------

Frage 2:
[ externes Bild ]
Das sind meine akt. Einstellungen für Dateianhänge .....
Viele Kunden kommen jetzt aber echt mit Bildern von 1.8MB und mehr bzw. einer riesen Auflösung daher und wollen diese hochladen .....
Dann geht das oft nicht, es wird dem Kunden aber keine "Fehlermeldung"/Begründung ausgegeben warum das nicht geht (wie z.B. "ihr Bild ist zu groß...").... kann man das ändern bzw. gibt es sogar ein PlugIn das Bilder "anpasst" auf verwertbare/vertretbare Größen ?

----------------------

Frage 3:
aus jedem Forum kenne ich es das man Hyperlinks erstellen kann... also einen Teil aus dem Beitrag markieren und dann auf den "Hyperlink-Button" klickt der dann ein Popup öffnet wo ich die URL + Art des Links (z.B. öffnen im neuen Fenster etc.) auswählen kann... hier wird der Teil der markiert wurde beim drücken des Hyperlink-Buttons nur mit (Anfang + Ende Teil) versehen und man ... .png[/img]


Ich hoffe ich habe es verständlich erklärt... fallst nicht einfach melden :lol:

Re: Dateianhänge-Block (Board3 Portal) "falsch herum"+Hyperl

Verfasst: 26.01.2012 14:05
von Michel_61
Hallo,

zu Frage 1, da ist wohl etwas mehr erforderlich, wenn du Bilder von anderen dateianhängen unterscheiden möchtest um sie anders zu sortieren. Diese Funktion ist im B3P so nicht vorhanden, aber vielleicht wirst du auf dem Portalforum speziell dazu was finden: http://www.board3.de/index.php

zu Frage 2, empfehle ich dir den GalerieMOD, da hast du dann auch eine bessere Möglichkeit der Verwaltung und bilder werden automatisch angepasst.

zu Frage 3, da kann ich dir leider nicht weiter helfen....

Re: Dateianhänge-Block (Board3 Portal) "falsch herum"+Hyperl

Verfasst: 26.01.2012 17:04
von Kirk
Hi
Zu 1.
Wenn du die die Anzeige der Dateianhänge änderst, wird normaler Weise nichts an den Dateianhängen in den
Beitträgen geändert.

Zu 2.
Schau dir das mal an: http://phpbb3.pytalhost.com/viewtopic.php?f=11&t=189

Re: Dateianhänge-Block (Board3 Portal) "falsch herum"+Hyperl

Verfasst: 27.01.2012 08:32
von techno-com
Nein... es werden dann bei mir auch die Anhänge in alten Beiträgen gedreht wie ich zuvor auch schon geschrieben hatte !

Habe diesbezüglich aber wie angeraten mal im Board3-Forum eine Anfrage eingestellt ! :)

Re: Dateianhänge-Block (Board3 Portal) "falsch herum"+Hyperl

Verfasst: 03.02.2012 09:00
von techno-com
Im Board3-Forum kommt absolut keine Antwort, nicht einmal eine kleinste Stellungnahme dazu ! :(

Scheint wohl niemanden zu interessieren, hätte man das auch gleich alles weglassen können !


P.s. 3. habe ich nun selbst was gefunden.... url image prompt 0.2.0 - Popup zur URL- und IMG-Eingabe in Beiträgen MOD ... würde auch hier schön rein passen, macht die URL-Funktion sehr viel schöner/einfacher. Und dann noch eines dafür (für welches ich mich jetzt entschieden habe und das gerade einbaue)

Re: Dateianhänge-Block (Board3 Portal) "falsch herum"+Hyperl

Verfasst: 05.02.2012 20:16
von techno-com
Board3-Forum = Board der müden Krieger !

Null Reaktion..... also hilft nur deaktivieren und drauf verzichten !

Re: Dateianhänge-Block (Board3 Portal) "falsch herum"+Hyperl

Verfasst: 05.02.2012 20:35
von BNa
Versuche mal folgendes

Öffne

root/portal/includes/functions.php

Finde

Code: Alles auswählen

            // Pull attachment data
            $sql2 = 'SELECT *
                FROM ' . ATTACHMENTS_TABLE . '
                WHERE post_msg_id = '. $row['post_id'] .'
                AND in_message = 0
                ORDER BY filetime DESC';
            $result2 = $db->sql_query($sql2); 
Ersetze mit

Code: Alles auswählen

            // Pull attachment data
            $sql2 = 'SELECT *
                FROM ' . ATTACHMENTS_TABLE . '
                WHERE post_msg_id = '. $row['post_id'] .'
                AND in_message = 0
                ORDER BY filetime ASC';
            $result2 = $db->sql_query($sql2); 

Re: Dateianhänge-Block (Board3 Portal) "falsch herum"+Hyperl

Verfasst: 05.02.2012 21:00
von techno-com
Danke :)

Geändert + Style aktualisiert + Cache gelöscht => leider keine Änderung, immer noch der älteste Upload ganz vorne dort !

Sollte das nicht etwas sein das man in der "portal_attachments.php" finden sollte ?

Re: Dateianhänge-Block (Board3 Portal) "falsch herum"+Hyperl

Verfasst: 05.02.2012 21:07
von BNa
Kenne die Mod nicht und benutze auch keine Portalsysteme, aber das sollte, in der von Dir benannten Datei, die richtige Stelle sein.

Achtung, diese Stelle findet sich zweimal in der Datei root/portal/modules/portal_attachments.php

Finde

Code: Alles auswählen

                    ORDER BY
                        filetime ' . ((!$config['display_order']) ? 'DESC' : 'ASC') . ', post_msg_id ASC';
Diese beiden Stellen ändern in

Code: Alles auswählen

                    ORDER BY
                        filetime ' . ((!$config['display_order']) ? 'ASC' : 'DESC') . ', post_msg_id ASC';
oder

Code: Alles auswählen

                    ORDER BY
                        filetime ' . ((!$config['display_order']) ? 'DESC' : 'ASC') . ', post_msg_id DESC';
oder

Code: Alles auswählen

                    ORDER BY
                        filetime ' . ((!$config['display_order']) ? 'ASC' : 'DESC') . ', post_msg_id DESC';
Eine der Lösungen sollte zum Erfolg führen.

Re: Dateianhänge-Block (Board3 Portal) "falsch herum"+Hyperl

Verfasst: 05.02.2012 22:53
von techno-com
Das ist da gar nicht drin bei mir !

portal_attachments.php

Code: Alles auswählen

<?php
/**
*
* @package Board3 Portal v2 - Attachments
* @copyright (c) Board3 Group ( www.board3.de )
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
	exit;
}

/**
* @package Modulname
*/
class portal_attachments_module
{
	/**
	* Allowed columns: Just sum up your options (Exp: left + right = 10)
	* top		1
	* left		2
	* center	4
	* right		8
	* bottom	16
	*/
	public $columns = 31;

	/**
	* Default modulename
	*/
	public $name = 'PORTAL_ATTACHMENTS';

	/**
	* Default module-image:
	* file must be in "{T_THEME_PATH}/images/portal/"
	*/
	public $image_src = 'portal_attach.png';

	/**
	* module-language file
	* file must be in "language/{$user->lang}/mods/portal/"
	*/
	public $language = 'portal_attachments_module';

	public function get_template_center($module_id)
	{
		global $config, $template, $db, $user, $auth, $phpEx, $phpbb_root_path;

		$attach_forums = false;
		$where = '';
		$filetypes = array();

		// Get filetypes and put them into an array
		if(isset($config['board3_attachments_filetype_' . $module_id]) && strlen($config['board3_attachments_filetype_' . $module_id]) > 0)
		{
			$filetypes = explode(',', $config['board3_attachments_filetype_' . $module_id]);
		}

		if($config['board3_attachments_forum_ids_' . $module_id] !== '')
		{
			$attach_forums_config = (strpos($config['board3_attachments_forum_ids_' . $module_id], ',') !== false) ? explode(',', $config['board3_attachments_forum_ids_' . $module_id]) : array($config['board3_attachments_forum_ids_' . $module_id]);
			$forum_list =  array_unique(array_keys($auth->acl_getf('f_read', true)));
			
			if($config['board3_attachments_forum_exclude_' . $module_id])
			{
				$forum_list = array_unique(array_diff($forum_list, $attach_forums_config));
			}
			else
			{
				$forum_list =  array_unique(array_intersect($attach_forums_config, $forum_list));
			}
		}
		else
		{
			$forum_list =  array_unique(array_keys($auth->acl_getf('f_read', true)));
		}

		if(sizeof($forum_list))
		{
			$attach_forums = true;
			$where = 'AND ' . $db->sql_in_set('t.forum_id', $forum_list);
		}

		if(sizeof($filetypes))
		{
			if($config['board3_attachments_exclude_' . $module_id])
			{
				$where .= ' AND ' . $db->sql_in_set('a.extension', $filetypes, true);
			}
			else
			{
				$where .= ' AND ' . $db->sql_in_set('a.extension', $filetypes);
			}
		}

		if($attach_forums === true)
		{
			// Just grab all attachment info from database
			$sql = 'SELECT
						a.*,
						t.forum_id
					FROM
						' . ATTACHMENTS_TABLE . ' a,
						' . TOPICS_TABLE . ' t
					WHERE
						a.topic_id <> 0
						AND a.topic_id = t.topic_id
						' . $where . '
					ORDER BY
						filetime ' . ((!$config['display_order']) ? 'DESC' : 'ASC') . ', post_msg_id ASC';
			$result = $db->sql_query_limit($sql, $config['board3_attachments_number_' . $module_id]);

			while ($row = $db->sql_fetchrow($result))
			{
				$size_lang = ($row['filesize'] >= 1048576) ? $user->lang['MIB'] : (($row['filesize'] >= 1024) ? $user->lang['KIB'] : $user->lang['BYTES']);
				$row['filesize'] = ($row['filesize'] >= 1048576) ? round((round($row['filesize'] / 1048576 * 100) / 100), 2) : (($row['filesize'] >= 1024) ? round((round($row['filesize'] / 1024 * 100) / 100), 2) : $row['filesize']);

				$replace = character_limit(utf8_substr($row['real_filename'], 0, strrpos($row['real_filename'], '.')), $config['board3_attach_max_length_' . $module_id]);

				$template->assign_block_vars('attach', array(
					'FILESIZE'			=> $row['filesize'] . ' ' . $size_lang,
					'FILETIME'			=> $user->format_date($row['filetime']),
					'DOWNLOAD_COUNT'	=> (int) $row['download_count'], // grab downloads count
					'FILENAME'			=> $replace,
					'REAL_FILENAME'		=> $row['real_filename'],
					'PHYSICAL_FILENAME'	=> basename($row['physical_filename']),
					'ATTACH_ID'			=> $row['attach_id'],
					'POST_IDS'			=> (!empty($post_ids[$row['attach_id']])) ? $post_ids[$row['attach_id']] : '',
					'POST_MSG_ID'		=> $row['post_msg_id'], // grab post ID to redirect to post
					'U_FILE'			=> append_sid($phpbb_root_path . 'download/file.' . $phpEx, 'id=' . $row['attach_id']),
					'U_TOPIC'			=> append_sid($phpbb_root_path . 'viewtopic.'.$phpEx, 'p='.$row['post_msg_id'].'#p'.$row['post_msg_id']),
				));
			}
			$db->sql_freeresult($result);

			$template->assign_var('S_DISPLAY_ATTACHMENTS', true);
		} 
		else 
		{
			$template->assign_var('S_DISPLAY_ATTACHMENTS', false);
		}

		return 'attachments_center.html';
	}

	public function get_template_side($module_id)
	{
		global $config, $template, $db, $user, $auth, $phpEx, $phpbb_root_path;

		$attach_forums = false;
		$where = '';
		$filetypes = array();

		// Get filetypes and put them into an array
		if(isset($config['board3_attachments_filetype_' . $module_id]) && strlen($config['board3_attachments_filetype_' . $module_id]) > 0)
		{
			$filetypes = explode(',', $config['board3_attachments_filetype_' . $module_id]);
		}

		if($config['board3_attachments_forum_ids_' . $module_id] !== '')
		{
			$attach_forums_config = (strpos($config['board3_attachments_forum_ids_' . $module_id], ',') !== false) ? explode(',', $config['board3_attachments_forum_ids_' . $module_id]) : array($config['board3_attachments_forum_ids_' . $module_id]);
			$forum_list =  array_unique(array_keys($auth->acl_getf('f_read', true)));
			
			if($config['board3_attachments_forum_exclude_' . $module_id])
			{
				$forum_list = array_unique(array_diff($forum_list, $attach_forums_config));
			}
			else
			{
				$forum_list =  array_unique(array_intersect($attach_forums_config, $forum_list));
			}
		}
		else
		{
			$forum_list =  array_unique(array_keys($auth->acl_getf('f_read', true)));
		}

		if(sizeof($forum_list))
		{
			$attach_forums = true;
			$where = 'AND ' . $db->sql_in_set('t.forum_id', $forum_list);
		}

		if(sizeof($filetypes))
		{
			if($config['board3_attachments_exclude_' . $module_id])
			{
				$where .= ' AND ' . $db->sql_in_set('a.extension', $filetypes, true);
			}
			else
			{
				$where .= ' AND ' . $db->sql_in_set('a.extension', $filetypes);
			}
		}

		if($attach_forums === true)
		{
			// Just grab all attachment info from database
			$sql = 'SELECT
						a.*,
						t.forum_id
					FROM
						' . ATTACHMENTS_TABLE . ' a,
						' . TOPICS_TABLE . ' t
					WHERE
						a.topic_id <> 0
						AND a.topic_id = t.topic_id
						' . $where . '
					ORDER BY
						filetime ' . ((!$config['display_order']) ? 'DESC' : 'ASC') . ', post_msg_id ASC';
			$result = $db->sql_query_limit($sql, $config['board3_attachments_number_' . $module_id]);

			while ($row = $db->sql_fetchrow($result))
			{
				$size_lang = ($row['filesize'] >= 1048576) ? $user->lang['MIB'] : (($row['filesize'] >= 1024) ? $user->lang['KIB'] : $user->lang['BYTES']);
				$row['filesize'] = ($row['filesize'] >= 1048576) ? round((round($row['filesize'] / 1048576 * 100) / 100), 2) : (($row['filesize'] >= 1024) ? round((round($row['filesize'] / 1024 * 100) / 100), 2) : $row['filesize']);

				$replace = character_limit(utf8_substr($row['real_filename'], 0, strrpos($row['real_filename'], '.')), $config['board3_attach_max_length_' . $module_id]);

				$template->assign_block_vars('attach', array(
					'FILESIZE'			=> $row['filesize'] . ' ' . $size_lang,
					'FILETIME'			=> $user->format_date($row['filetime']),
					'DOWNLOAD_COUNT'	=> (int) $row['download_count'], // grab downloads count
					'FILENAME'			=> $replace,
					'REAL_FILENAME'		=> $row['real_filename'],
					'PHYSICAL_FILENAME'	=> basename($row['physical_filename']),
					'ATTACH_ID'			=> $row['attach_id'],
					'POST_IDS'			=> (!empty($post_ids[$row['attach_id']])) ? $post_ids[$row['attach_id']] : '',
					'POST_MSG_ID'		=> $row['post_msg_id'], // grab post ID to redirect to post
					'U_FILE'			=> append_sid($phpbb_root_path . 'download/file.' . $phpEx, 'id=' . $row['attach_id']),
					'U_TOPIC'			=> append_sid($phpbb_root_path . 'viewtopic.'.$phpEx, 'p='.$row['post_msg_id'].'#p'.$row['post_msg_id']),
				));
			}
			$db->sql_freeresult($result);

			$template->assign_var('S_DISPLAY_ATTACHMENTS', true);
		} 
		else 
		{
			$template->assign_var('S_DISPLAY_ATTACHMENTS', false);
		}

		return 'attachments_side.html';
	}

	public function get_template_acp($module_id)
	{
		return array(
			'title'	=> 'ACP_PORTAL_ATTACHMENTS_NUMBER_SETTINGS',
			'vars'	=> array(
				'legend1'							=> 'ACP_PORTAL_ATTACHMENTS_NUMBER_SETTINGS',
				'board3_attachments_number_' . $module_id			=> array('lang' => 'PORTAL_ATTACHMENTS_NUMBER'		 ,	'validate' => 'int',		'type' => 'text:3:3',		 'explain' => true),
				'board3_attach_max_length_' . $module_id			=> array('lang' => 'PORTAL_ATTACHMENTS_MAX_LENGTH'		 ,	'validate' => 'int',		'type' => 'text:3:3',		 'explain' => true),
				'board3_attachments_forum_ids_' . $module_id		=> array('lang' => 'PORTAL_ATTACHMENTS_FORUM_IDS',	'validate' => 'string',		'type' => 'custom',	'explain' => true,	'method' => 'select_forums', 'submit' => 'store_selected_forums'),
				'board3_attachments_forum_exclude_' . $module_id	=> array('lang' => 'PORTAL_ATTACHMENTS_FORUM_EXCLUDE', 'validate' => 'bool', 'type' => 'radio:yes_no',	 'explain' => true),
				'board3_attachments_filetype_' . $module_id			=> array('lang' => 'PORTAL_ATTACHMENTS_FILETYPE',	'validate' => 'string', 	'type' => 'custom',	'explain' => true,	'method' => 'select_filetype', 'submit' => 'store_filetypes'),
				'board3_attachments_exclude_' . $module_id			=> array('lang' => 'PORTAL_ATTACHMENTS_EXCLUDE', 	'validate' => 'bool',	'type' => 'radio:yes_no',	'explain' => true),
			),
		);
	}

	/**
	* API functions
	*/
	public function install($module_id)
	{
		set_config('board3_attachments_number_' . $module_id, 8);
		set_config('board3_attach_max_length_' . $module_id, 15);
		set_config('board3_attachments_forum_ids_' . $module_id, '');
		set_config('board3_attachments_forum_exclude_' . $module_id, 0);
		set_config('board3_attachments_filetype_' . $module_id, '');
		set_config('board3_attachments_exclude_' . $module_id, 0);
		return true;
	}

	public function uninstall($module_id)
	{
		global $db;

		$del_config = array(
			'board3_attachments_number_' . $module_id,
			'board3_attach_max_length_' . $module_id,
			'board3_attachments_forum_ids_' . $module_id,
			'board3_attachments_forum_exclude_' . $module_id,
			'board3_attachments_filetype_' . $module_id,
			'board3_attachments_exclude_' . $module_id,
		);
		$sql = 'DELETE FROM ' . CONFIG_TABLE . '
			WHERE ' . $db->sql_in_set('config_name', $del_config);
		return $db->sql_query($sql);
	}
	
	// Create select box for attachment filetype
	public function select_filetype($value, $key, $module_id)
	{
		global $db, $user, $config;
		
		// Get extensions
		$sql = 'SELECT *
			FROM ' . EXTENSIONS_TABLE . '
			ORDER BY extension ASC';
		$result = $db->sql_query($sql);
		
		while ($row = $db->sql_fetchrow($result))
		{
			$extensions[] = $row;
		}
		
		$selected = array();
		if(isset($config['board3_attachments_filetype_' . $module_id]) && strlen($config['board3_attachments_filetype_' . $module_id]) > 0)
		{
			$selected = explode(',', $config['board3_attachments_filetype_' . $module_id]);
		}
		
		// Build options
		$ext_options = '<select id="' . $key . '" name="' . $key . '[]" multiple="multiple">';
		foreach ($extensions as $id => $ext)
		{
			$ext_options .= '<option value="' . $ext['extension'] . '"' . ((in_array($ext['extension'], $selected)) ? ' selected="selected"' : '') . '>' . $ext['extension'] . '</option>';
		}
		$ext_options .= '</select>';
		
		return $ext_options;
	}
	
	// Store selected filetypes
	public function store_filetypes($key, $module_id)
	{
		global $db, $cache;
		
		// Get selected extensions
		$values = request_var($key, array(0 => ''));
		
		$filetypes = implode(',', $values);
		
		set_config('board3_attachments_filetype_' . $module_id, $filetypes);

	}
	
	// Create forum select box
	public function select_forums($value, $key)
	{
		global $user, $config;

		$forum_list = make_forum_select(false, false, true, true, true, false, true);
		
		$selected = array();
		if(isset($config[$key]) && strlen($config[$key]) > 0)
		{
			$selected = explode(',', $config[$key]);
		}
		// Build forum options
		$s_forum_options = '<select id="' . $key . '" name="' . $key . '[]" multiple="multiple">';
		foreach ($forum_list as $f_id => $f_row)
		{
			$s_forum_options .= '<option value="' . $f_id . '"' . ((in_array($f_id, $selected)) ? ' selected="selected"' : '') . (($f_row['disabled']) ? ' disabled="disabled" class="disabled-option"' : '') . '>' . $f_row['padding'] . $f_row['forum_name'] . '</option>';
		}
		$s_forum_options .= '</select>';

		return $s_forum_options;

	}
	
	// Store selected forums
	public function store_selected_forums($key)
	{
		global $db, $cache;
		
		// Get selected extensions
		$values = request_var($key, array(0 => ''));
		
		$news = implode(',', $values);
		
		set_config($key, $news);
	
	}
}