Skip to content
View in the app

A better way to browse. Learn more.

Дизайн и модификация Invision Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Предпросмотр для записей Links

Помогите создать предпросмотр записей и комментариев перед отправкой, приложения Links.

Featured Replies

В шаблоны commentForm и linkForm в самое начало добавляете

<if test="isset($this->request['preview'])">
<php>
$comment = IPSText::getTextClass( 'editor' )->processRawPost( 'Post' );
IPSText::getTextClass( 'bbcode' )->parse_html = 0;
IPSText::getTextClass( 'bbcode' )->parse_nl2br = 1;
IPSText::getTextClass( 'bbcode' )->parse_smilies = ( $this->settings[ 'l_emo_comments' ] == 1 ) ? 1 : 0;
IPSText::getTextClass( 'bbcode' )->parse_bbcode = 1;
IPSText::getTextClass( 'bbcode' )->parsing_section = 'links_comments';
$comment  = IPSText::getTextClass( 'bbcode' )->preDisplayParse( IPSText::getTextClass( 'bbcode' )->preDbParse( $comment ) );
</php>
<if test="!$this->settings['disable_lightbox']">
	{parse template="include_lightbox" group="global" params=""}
</if>
<h2 class='maintitle'>Preview</h2>
<div class='post_wrap'>
	<div class='row2' style='padding:8px'>
		<div class='post entry-content'>{$comment}</div>
	</div>
</div>
<br />
</if>

Только в linkForm

IPSText::getTextClass( 'bbcode' )->parsing_section = 'links_comments';

заменяете на

IPSText::getTextClass( 'bbcode' )->parsing_section	= 'links_ldesc';

 

В commentForm после

<input type='submit' name='submit' value='{$data[ 'button' ]}' class='input_submit' accesskey='s' />

добавляете

<input type="submit" name="preview" value="Preview" tabindex="0" class="input_submit alt" />

В linkForm после

<input type='submit' name='submit' value='{$link[ 'button' ]}' class='input_submit' accesskey='s' />

добавляете

<input type="submit" name="preview" value="Preview" tabindex="0" class="input_submit alt" />

 

В admin/applications_addon/other/links/modules_public/links/links.php после

$linkDesc = IPSText::getTextClass( 'bbcode' )->preDbParse( $linkDesc );

добавляете

		if (isset($this->request['preview']))
	{
		return $this->showLinkForm($type);
	}

  • Author

@newbie,

Большое спасибо, то что надо!

 

P.S. А можно что бы при внесении изменений в формы, при нажатии на кнопку предпросмотра, изменённые данные не только отображались в окне предпросмотра, а также и сохранялись в формах (как например в сообщениях на форуме).

  • Author

P.S. А можно что бы при внесении изменений в формы, при нажатии на кнопку предпросмотра, изменённые данные не только отображались в окне предпросмотра, а также и сохранялись в формах (как например в сообщениях на форуме).

В форме комментариев сохраняется, а в форме записи - нет.

Выше

		/* Simply show the form */
	$this->output = $this->registry->output->getTemplate( 'links' )->linkForm( $this->links->getMessages(), $link, $cat );

Добавить

		if (isset($this->request['preview']))
	{
		$link[ 'editor' ] = IPSText::getTextClass( 'editor' )->showEditor( $this->request['Post'] ? IPSText::getTextClass( 'bbcode' )->preEditParse( $this->request['Post'] ) : '' , 'Post' );
		$link['link_title'] = trim($this->request[ 'link' ]);
		$link['link_url'] = trim($this->request[ 'href' ]);
	}

  • Author

@newbie,

Ещё раз спасибо за вашу неоценимую помощь!

  • Author

@newbie,

Кстати, на основе всего этого, сделал также предпросмотр и в записях Календаря. Всё отлично, вот только также не сохраняется в форме, а этот ваш код:

        if (isset($this->request['preview']))
       {
           $link[ 'editor' ] = IPSText::getTextClass( 'editor' )->showEditor( $this->request['Post'] ? IPSText::getTextClass( 'bbcode' )->preEditParse( $this->request['Post'] ) : '' , 'Post' );
           $link['link_title'] = trim($this->request[ 'link' ]);
           $link['link_url'] = trim($this->request[ 'href' ]);
       }

Не могу понять куда именно вставить в файле calendars.php

Не могу понять куда именно вставить в файле calendars.php

Там код должен быть совсем другим.

  • Author

Там код должен быть совсем другим.

А какой не подскажете?

Вам для всех полей что ли нужно?

Там же их очень много.

  • Author

Вам для всех полей что ли нужно?

Там же их очень много.

Нет. На основании данных что вы сделали для приложения Links, я сделал и для Календаря.

 

В шаблон calendarEventForm поместил в самый верх:

 

<if test="isset($this->request['preview'])"><php>$comment = IPSText::getTextClass( 'editor' )->processRawPost( 'Post' );IPSText::getTextClass( 'bbcode' )->parse_html = 0;IPSText::getTextClass( 'bbcode' )->parse_nl2br = 1;IPSText::getTextClass( 'bbcode' )->parse_smilies	= intval($allow_emoticons);IPSText::getTextClass( 'bbcode' )->parse_bbcode = 1;IPSText::getTextClass( 'bbcode' )->parsing_section	= 'calendar';$comment  = IPSText::getTextClass( 'bbcode' )->preDisplayParse( IPSText::getTextClass( 'bbcode' )->preDbParse( $comment ) );</php>
<div class='general_box alt'><h2 class='maintitle'> Предпросмотр записи</h2></div><div class='post_block' style='margin-bottom: -1px'><div class='post_wrap' style='background: #F4F2D8'><div class='author_info' style='margin: 5px 0 0px 0;background: #F4F2D8<if test="$this->registry->output->skin['set_id'] != 22"><else />;width: 150px</if>'></div><div class='post_body whitebox_event'<if test="$this->registry->output->skin['set_id'] != 22"><else /> style='margin-left: 152px'</if>><div class='message'>{$comment}</div></div></div></div><br /></if>

 

В самый низ:

<input type="submit" name="preview" value="Предпросмотр записи" tabindex="0" class="input_submit alt" style='font-size: 14px'/>

 

В файл calendars.php перед:

if( ! checkdate( $month, $day , $year ) )
       {
		$this->registry->output->showError( 'calendar_invalid_date', 10427 );
	}

 

Поместил:

		if (isset($this->request['preview']))
	{
	return $this->calendarEventForm($type);
	}

 

И знаете, всё заработало, предпросмотр появился. Однако при внесении изменений в форму, при нажатии на кнопку предпросмотра, изменённые данные не сохраняются в форме.

Я имею ввиду

calendar.png

Все нужны или только текст?

  • Author

Я имею ввиду

А это не нужно. Я в Календаре не использую эти дату окончания и начала. Публикуется в основной календарь и для всех.

Добавьте выше

		/* Output */
	$this->output .= $this->registry->output->getTemplate( 'calendar' )->calendarEventForm(

		if (isset($this->request['preview']))
	{
		$event['event_title'] = IPSText::getTextClass( 'bbcode' )->stripBadWords( trim( $this->request['event_title'] ) );
		$event['event_content'] = $this->request['Post'] ? IPSText::getTextClass( 'bbcode' )->preEditParse( $this->request['Post'] ) : '';
	}

Если что-то еще нужно будет, пишите

  • Author

Добавьте выше

Спасибо, то что надо!

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.