[BETA] Multi-interface posting (Update..New Dev)

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
CrazyPhil
Registered User
Posts: 153
Joined: Sat Mar 16, 2002 4:03 am
Location: Ottawa, Canada

[BETA] Multi-interface posting (Update..New Dev)

Post by CrazyPhil »

This mod is now being developed by a new developer, go to this post:

http://www.phpbb.com/phpBB/viewtopic.ph ... 554#646554

##########################################


Heres my idea:

Image

You can make a normal post, or a premade interface post (for a help forum, request forum or others). The radio buttons would switch between the interface. This would make it easier for users submiting problems or whatever in the order and shape the admin want it, because also the data between the forum boxes could be inserted into html, which then becomes the preformatted post.

Thanks for any help!!!

-Phil
Last edited by CrazyPhil on Sun Jul 06, 2003 5:19 am, edited 7 times in total.
DanielT
Former Team Member
Posts: 3324
Joined: Tue Aug 27, 2002 10:55 am
Contact:

Re: req: multi-interface posting

Post by DanielT »

CrazyPhil wrote: Heres my idea:

Image

You can make a normal post, or a premade interface post (for a help forum, request forum or others). The radio buttons would switch between the interface. This would make it easier for users submiting problems or whatever in the order and shape the admin want it, because also the data between the forum boxes could be inserted into html, which then becomes the preformatted post.

Thanks for any help!!!

-Phil


i dont see the image
CrazyPhil
Registered User
Posts: 153
Joined: Sat Mar 16, 2002 4:03 am
Location: Ottawa, Canada

Post by CrazyPhil »

Now? lol
DanielT
Former Team Member
Posts: 3324
Joined: Tue Aug 27, 2002 10:55 am
Contact:

Post by DanielT »

yes and that is a realy good idea!
CrazyPhil
Registered User
Posts: 153
Joined: Sat Mar 16, 2002 4:03 am
Location: Ottawa, Canada

Post by CrazyPhil »

This an example of what needs to be put together..there is more but I don't know how to do it! lol
Example code (just thrown together):

Code: Select all

<form name="form1" method="post" action="">
  <p>
    <label>
    <input type="radio" name="option" value="normal" checked>
    Normal </label>
    <br>
    <label>
    <input type="radio" name="option" value="help">
    Help</label>
    <br>
  </p>
  <p>&nbsp; </p>
  <p> 
    <input type="text" name="field1">
  </p>
  <p> 
    <input type="text" name="field2">
  </p>
  <p>
    <textarea name="area3"></textarea>
  </p>
  <p> 
    <input type="text" name="field4">
  </p>
  <p>
    <input type="text" name="field5">
  </p>
  </form>
  
$var1 = "<B>" . $HTTP_POST_VARS['field1'] . "</B>";
$var2 = "<B>" . $HTTP_POST_VARS['field2'] . "</B>";
$var3 = "<font size="10"><B>" . $HTTP_POST_VARS['area3'] . "</font></B>";
$var4 = "<B>" . $HTTP_POST_VARS['field4'] . "</B>";
$var5 = "<B>" . $HTTP_POST_VARS['field5'] . "</B>";

$varfinished = $var1 ."<br>" $var2 ."<br>" $var3 ."<br>" $var4 ."<br>" $var5;
If $HTTP_POST_VARS['option']="help" 
{
$message = $varfinished
}
CrazyPhil
Registered User
Posts: 153
Joined: Sat Mar 16, 2002 4:03 am
Location: Ottawa, Canada

Post by CrazyPhil »

Accidental Repost..
SFGrimoire
Registered User
Posts: 10
Joined: Sat Sep 14, 2002 3:16 am
Location: Arizona

Post by SFGrimoire »

Funny that, I was just looking for a mod to do message templating like this. I'm looking for something that can be applied on a per forum basis with the ability to force the template on the first message in that forum. This would be useful for a variety of forums I've set up for our intranet. I'm not a phpBB guru nor do I know much about PHP in general but I was thinking something that was inserted as additional modes in posting.php.

The goal of course it to guide users into posting properly formatted messages for work requests or problem tracking status reports by pre-formatting the message based on custom form input on the initial post instead of allowing them to post a regular message, but only on designated forums. Replies would be in the form of a regular message.
Mr. Tech
Registered User
Posts: 2700
Joined: Tue Sep 24, 2002 4:49 am
Location: Nice and hot Australia
Contact:

Post by Mr. Tech »

I think it's a great idea mate!!! :D
CrazyPhil
Registered User
Posts: 153
Joined: Sat Mar 16, 2002 4:03 am
Location: Ottawa, Canada

Post by CrazyPhil »

Now if only it can be done...
all we need is a bit of javascript and php.
Javascript to switch the interface when using the radio button.
Php to apply the variables!

I wish I knew to do both, and I'd be creating mods everyday!
CrazyPhil
Registered User
Posts: 153
Joined: Sat Mar 16, 2002 4:03 am
Location: Ottawa, Canada

Post by CrazyPhil »

Ok i went and searched on a way how to switch forms using javascript, I intergrated it into my forum to test it..anyways tomorrow I will show a demo product here. For now I'll post what I've done..and yes it does work to some extent! ANY HELP ON THIS PROJECT WOULD BE AWESOME!!!


* WARNING THE BELOW IS UNDER DEVELOPMENT (THOUGH IT DOES WORK, IT HAS BUGS...!!! USE AT YOUR OWN RISK! *

Edited Files:

Code: Select all

posting_body.tpl
posting.php
functions_post.php

Code: Select all

posting_body.tpl
Find:

Code: Select all

  <td nowrap="nowrap" align="right"><span class="gensmall"><a href="javascript:bbstyle(-1)" class="genmed" onMouseOver="helpline('a')">{L_BBCODE_CLOSE_TAGS}</a><br>
                    </span>
Add after:

Code: Select all

<SELECT NAME="selectList" onChange="changeForm(this.form.selectList)">
                      <option value="form1" selected>Normal Post</option>
                      <option value="form2">Second Type</option>
                    </SELECT>

Find and DELETE:

Code: Select all

if (document.post.message.value.length < 2) {
		formErrors = "{L_EMPTY_MESSAGE}";
	}



Find:

Code: Select all

  <textarea name="message" rows="15" cols="35" wrap="virtual" style="width:450px" tabindex="3" class="post" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);">{MESSAGE}</textarea>

Replace With:

Code: Select all

<SCRIPT LANGUAGE="JavaScript"><!-- 
function changeForm(what) { 
    for (var i=0; i<what.options.length; i++) { 
        if (what.options[i].selected) { 
            if (document.all)         document.all[what.options[i].value].style.visibility="visible"; 
            else if (document.layers) document.layers[what.options[i].value].visibility = "visible"; 
        } 
        else { 
            if (document.all)         document.all[what.options[i].value].style.visibility="hidden"; 
            else if (document.layers) document.layers[what.options[i].value].visibility = "hidden"; 
        } 
    } 
} 
//--></SCRIPT> 

<DIV ID="form1" style="position: absolute; top: 313px; left: 235px; visibility: visible;"> 
                Under Development 
                <textarea name="message" rows="15" cols="35" wrap="virtual" style="width:450px" tabindex="3" class="post" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);">{MESSAGE}</textarea> 

</DIV> 

<DIV ID="form2" style="position: absolute; top: 313px; left: 235px; visibility: hidden;"> 

Value1<br> 
<input type="TEXT" name="value1" class="post" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);"> 
Value2<br> 
<input type="TEXT" name="value2" class="post" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);"> 
<br> 
Text Box<br> 
<textarea name="textarea" class="post" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);"></textarea> 
</DIV> 
Close And Save "Posting_body.tpl".

Code: Select all

posting.php
Find:

Code: Select all

$message = ( !empty($HTTP_POST_VARS['message']) ) ? $HTTP_POST_VARS['message'] : '';
Add After:

Code: Select all

 if ( $message == '' )
			 {
			$value1 = ( !empty($HTTP_POST_VARS['value1']) ) ? $HTTP_POST_VARS['value1'] : ''; 
			$value2 = ( !empty($HTTP_POST_VARS['value2']) ) ? $HTTP_POST_VARS['value2'] : ''; 
			$textarea = ( !empty($HTTP_POST_VARS['textarea']) ) ? $HTTP_POST_VARS['textarea'] : ''; 
			$html1 = "<B>" . $value1. "</B>"; 
			$html2 = "<B>" . $value2 . "</B>"; 
            $html3 = "<B>" . $textarea . "</B>"; 
			$message = "". $html1 . "<br>" . $html2 . "<br><br>" . $html3 ."";
			}
			else
			{
	       $message = ( !empty($HTTP_POST_VARS['message']) ) ? $HTTP_POST_VARS['message'] : '';
		   }

Save and Close "Posting.php"

Code: Select all

functions_post.php
Find and DELETE:

Code: Select all

// Check message
	if ( !empty($message) )
	{
		$bbcode_uid = ( $bbcode_on ) ? make_bbcode_uid() : '';
		$message = prepare_message(trim($message), $html_on, $bbcode_on, $smilies_on, $bbcode_uid);
	}
	else if ( $mode != 'delete' && $mode != 'polldelete' ) 
	{
		$error_msg .= ( !empty($error_msg) ) ? '<br />' . $lang['Empty_message'] : $lang['Empty_message'];
	}

Save and Close "Functions_post.php".



KNOWN BUGS:

bbcodes don't work (The buttons do work and enter the tags, though only in the normal post mode)
Div tags don't move so when someone gets a "did not enter subject" error message, the post box will be on top of other things, like its moved up.
imagedude
Registered User
Posts: 296
Joined: Wed Sep 25, 2002 10:28 pm
Location: /home/kai
Name: Kai Ponte
Contact:

Post by imagedude »

Okay, this is almost what I'm looking for. Hmm. I tried it and I get the empty posting issue. (I'm using Veror's icicle theme.) Has anybody implemented this.

Here's my original question:
http://www.phpbb.com/phpBB/viewtopic.php?t=62218


Kai
AbelaJohnB
Former Team Member
Posts: 5674
Joined: Fri Jul 06, 2001 11:56 pm

Post by AbelaJohnB »

All this is -totally- doable, it's just a -huge- amount of work !!

If you are not familure with phpBB's security methods, you'll want to be very cautious about adding new features.

Lastly, phpBB2.2 (unknown release date) should be able to handle additional 'fields' such as this. Just a FYI.


<ok, you guys can get back on-topic now>
imagedude
Registered User
Posts: 296
Joined: Wed Sep 25, 2002 10:28 pm
Location: /home/kai
Name: Kai Ponte
Contact:

Post by imagedude »

Okay, I implemented it. Yikes! The DIV just screws up everything! I'm wonndering if an innerHTML item would be better or just add a switch for the fields then concatenate the text fields.

KP
CrazyPhil
Registered User
Posts: 153
Joined: Sat Mar 16, 2002 4:03 am
Location: Ottawa, Canada

Post by CrazyPhil »

I would very much like to complete this idea, and yes the DIV is annoying as hell, I've tried other methods that I know of but DIV is only way to keep it in place to some extent, maybe the pull down menu could load a different template which it self gives different variables.

Like posting.php?type=1&mode=... etc..
And that pulls a different template out, or something.

if (type == "") {
//Normal Post
} elseif (type == "1") {
//Different Template
}
imagedude
Registered User
Posts: 296
Joined: Wed Sep 25, 2002 10:28 pm
Location: /home/kai
Name: Kai Ponte
Contact:

Post by imagedude »

I'm going with the different template idea, too. I'm putting a switch into the template to choose how the posting type will be displayed based on a selection in the forum admin. I just did this for a mod with define topic sort order, and I'm kind of following that guideline along with your instructions.

I'll post when I get something!
Post Reply

Return to “[2.0.x] MODs in Development”