dimitry Опубликовано 13 Августа 2007 Жалоба Поделиться Опубликовано 13 Августа 2007 А возможно ли сделать функцию мультцитирования для IPB 1.3 так, чтобы существовали кнопки Цитата+ и Цитата- и при их нажатии в ответ парсились выбранные посты в цитатах? Цитата Ссылка на комментарий Поделиться на других сайтах Прочее
Jax Опубликовано 14 Августа 2007 Жалоба Поделиться Опубликовано 14 Августа 2007 Возможно. У Hostem на его форуме видел. Цитата Ссылка на комментарий Поделиться на других сайтах Прочее
FatCat Опубликовано 14 Августа 2007 Жалоба Поделиться Опубликовано 14 Августа 2007 Сохранять можно в куки, чтобы с аяксом не мучаться. Цитата Ссылка на комментарий Поделиться на других сайтах Прочее
dimitry Опубликовано 14 Августа 2007 Автор Жалоба Поделиться Опубликовано 14 Августа 2007 Ну у Hostem это не столько мультицитирование, а, скорее, вставка нескольких цитат в быстрый ответ.А я имел ввиду то, что сейчас есть (уже давно есть) в платной версии IPB - кнопки Цитата+ и Цитата- (добавление к многочисленным цитатам) Ну у Hostem это не столько мультицитирование, а, скорее, вставка нескольких цитат в быстрый ответ.А я имел ввиду то, что сейчас есть (уже давно есть) в платной версии IPB - кнопки Цитата+ и Цитата- (добавление к многочисленным цитатам) Цитата Ссылка на комментарий Поделиться на других сайтах Прочее
Sannis Опубликовано 14 Августа 2007 Жалоба Поделиться Опубликовано 14 Августа 2007 dimitry, собственно можно ж взять код из 2.1, не думаю что будет сложно прикрутить его к 1.3. Благо там всего-то записать в куки - прочитать куки - взять посты из бд. Цитата Ссылка на комментарий Поделиться на других сайтах Прочее
dimitry Опубликовано 14 Августа 2007 Автор Жалоба Поделиться Опубликовано 14 Августа 2007 skin_topic.php Найти: {$post['edit_button']}{$post['delete_button']} После добавить: <a href=\"#\" onclick=\"multiquote_add({$post['pid']}); return false;\" title=\"{$this->ipsclass->lang['mq_title']}\">{$post['mq_start_image']}</a> Найти: function mod_wrapper($id="", $text="") { global $ibforums; return <<<EOF <option value='$id'>$text</option> EOF; } Ниже добавить: //=========================================================================== // <ips:mq_image_add:desc::trigger:> //=========================================================================== function mq_image_add($pid) { global $ibforums; return <<<EOF //--starthtml--// <img src=\"{$this->ipsclass->vars['img_url']}/p_mq_add.gif\" name=\"mad_$pid\" alt=\"+\" /> //--endhtml--// EOF; } //=========================================================================== // <ips:mq_image_remove:desc::trigger:> //=========================================================================== function mq_image_remove($pid) { global $ibforums; return <<<EOF //--starthtml--// <img src=\"{$this->ipsclass->vars['img_url']}/p_mq_remove.gif\" name=\"mad_$pid\" alt=\"-\" /> //--endhtml--// EOF; } quote.js Куда-то в конец добавить функцию: function multiquote_add(id){saved=new Array();clean=new Array();add=1;if(tmp=my_getcookie('mqtids')){saved=tmp.split(",");}for(i=0;i<saved.length;i++){if(saved[i]!=""){if(saved[i]==id){add=0;}else{clean[clean.length]=saved[i];}}}if(add){clean[clean.length]=id;eval("document.mad_"+id+".src=removequotebutton");eval("document.mad_"+id+".title='-'");}else{eval(" document.mad_"+id+".src=addquotebutton");eval("document.mad_"+id+".title='+'");}my_setcookie('mqtids',clean.join(','),0);return false;} post_parser.php В этот скрипт надо умудриться запихнуть соответствующим образом препарированную под IPB 1.3 функцию: function check_multi_quote() { $raw_post = ''; if ( ! $this->ipsclass->input['qpid'] ) { $this->ipsclass->input['qpid'] = $this->ipsclass->my_getcookie('mqtids'); if ($this->ipsclass->input['qpid'] == ",") { $this->ipsclass->input['qpid'] = ""; } } else { //----------------------------------------- // Came from reply button //----------------------------------------- $this->ipsclass->input['parent_id'] = $this->ipsclass->input['qpid']; } $this->ipsclass->input['qpid'] = preg_replace( "/[^,\d]/", "", trim($this->ipsclass->input['qpid']) ); if ( $this->ipsclass->input['qpid'] ) { $this->quoted_pids = preg_split( '/,/', $this->ipsclass->input['qpid'], -1, PREG_SPLIT_NO_EMPTY ); //----------------------------------------- // Get the posts from the DB and ensure we have // suitable read permissions to quote them //----------------------------------------- if ( count($this->quoted_pids) ) { $this->ipsclass->DB->cache_add_query( 'post_get_quoted', array( 'quoted_pids' => $this->quoted_pids ) ); $this->ipsclass->DB->cache_exec_query(); while ( $tp = $this->ipsclass->DB->fetch_row() ) { if ( $this->ipsclass->check_perms( $this->ipsclass->forums->forum_by_id[ $tp['forum_id'] ]['read_perms']) == TRUE ) { if ( $this->han_editor->method == 'rte' ) { $tmp_post = $this->parser->convert_ipb_html_to_html( $tp['post'] ); } else { $tmp_post = trim( $this->parser->pre_edit_parse( $tp['post'] ) ); } if ( $this->ipsclass->vars['strip_quotes'] ) { $tmp_post = $this->_recursive_kill_quotes( $tmp_post ); $tmp_post = preg_replace( "#(?:\n|\r|\r\n){3,}#s", "\n", trim($tmp_post) ); } $extra = ""; if ( $tmp_post ) { if ( $this->han_editor->method == 'rte' ) { $raw_post .= "[quote name='".$this->parser->make_quote_safe($tp['author_name'])."' date='".$this->parser->make_quote_safe($this->ipsclass->get_date( $tp['post_date'], 'LONG', 1 ))."' post='".$tp['pid']."']<br />{$tmp_post}<br />".$extra.'[/quote]'."<br /><br /><br />"; } else { $raw_post .= "[quote name='".$this->parser->make_quote_safe($tp['author_name'])."' date='".$this->parser->make_quote_safe($this->ipsclass->get_date( $tp['post_date'], 'LONG', 1 ))."' post='".$tp['pid']."']\n$tmp_post\n".$extra.'[/quote]'."\n\n\n"; } } } } $raw_post = trim($raw_post)."\n"; } } //----------------------------------------- // Make raw POST safe for the text area //----------------------------------------- $raw_post .= $this->ipsclass->txt_raw2form( isset($_POST['Post']) ? $_POST['Post'] : '' ); return $raw_post; } post_new_post.php Найти функцию function show_form(&$class) { : В ней: $raw_post = isset($HTTP_POST_VARS['Post']) ? $std->txt_htmlspecialchars($HTTP_POST_VARS['Post']) : ""; Перед эти добавить: //----------------------------------------- // Are we quoting posts? //----------------------------------------- $raw_post = $this->check_multi_quote(); Найти: //--------------------------------------- // Add in siggy buttons and such //--------------------------------------- $class->html_checkboxes(); //--------------------------------------- $this->nav = array( "<a href='{$class->base_url}act=SC&c={$class->forum['cat_id']}'>{$class->forum['cat_name']}</a>", "<a href='{$class->base_url}act=SF&f={$class->forum['id']}'>{$class->forum['name']}</a>", ); $this->title = $ibforums->lang['posting_new_topic']; Ниже добавить: //----------------------------------------- // Reset multi-quote cookie //----------------------------------------- $this->ipsclass->my_setcookie('mqtids', ',', 0); post_peply_post.php Найти функцию function show_form($class) { В ней найти: $raw_post = isset($HTTP_POST_VARS['Post']) ? $std->txt_htmlspecialchars($HTTP_POST_VARS['Post']) : ""; Перед этим вставить: //----------------------------------------- // Are we quoting posts? //----------------------------------------- $raw_post = $this->check_multi_quote(); Найти: $this->title = $ibforums->lang['replying_in'].' '.$this->topic['title']; Ниже добавить: //----------------------------------------- // Reset multi-quote cookie //----------------------------------------- $this->ipsclass->my_setcookie('mqtids', ',', 0); Topics.php Найти: //----------------------------------------- // Siggie stuff //----------------------------------------- Выше добавить что-то подобное: //----------------------------------------- // Multi Quoting? //----------------------------------------- $row['mq_start_image'] = $this->ipsclass->compiled_templates['skin_topic']->mq_image_add($row['pid']); if ( $this->qpids ) { if ( strstr( ','.$this->qpids.',', ','.$row['pid'].',' ) ) { $row['mq_start_image'] = $this->ipsclass->compiled_templates['skin_topic']->mq_image_remove($row['pid']); } } lang_topic.php Найти: $lang = array ( После добавить: 'mq_title' => 'Добавить к многочисленным цитатам', Кнопки: style_images/1/p_mq_add.gif http://www.ibresource.ru/forums/style_images/1/p_mq_add.gif style_images/1/p_mq_remove.gif http://www.ibresource.ru/forums/style_images/1/p_mq_remove.gif Цитата Ссылка на комментарий Поделиться на других сайтах Прочее
Рекомендуемые сообщения
Присоединиться к обсуждению
Вы можете ответить сейчас, а зарегистрироваться позже. Если у вас уже есть аккаунт, войдите, чтобы ответить от своего имени.