TinyPortal

Development => Block Codes => Topic started by: Dragooon on July 27, 2007, 08:55:27 AM

Title: SMF Gallery Lite(1.7.X) Quick Upload Block(Left/Right/Center)
Post by: Dragooon on July 27, 2007, 08:55:27 AM
Hello,

I saw some requests of making a SMF Gallery Quick Upload block So I made one.
There are 2 code snippets.1 is For left/right side and other is for center block.I made it using the main template function that Gallery uses so basically no credits to me.
- Uses all fields a normal Gallery upload box does
- Can be shown to guests but upload will be denied because of SMF Gallery Functionality
- Uses all fields in Left/Right side to
- No modification to code required
To be added in a phpblock.Tested with SMF Gallery Lite 1.7.X and TP 0.9.8 with SMF 1.1.2/3
For Center :
//Quick Gallery Upload Box(Center)
//Made by Dragooon.
//Credits are all to mod author since I used the
//Template Function in it.
global $scripturl, $modSettings, $db_prefix, $txt, $context, $settings, $boarddir;

require ($boarddir . '/Themes/default/languages/Gallery.english.php');

//Get the category
@$cat = (int) $_REQUEST['cat'];

echo '<div class="tborder">';

// Load the spell checker?
if ($context['show_spellchecking'])
echo '
<script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/spellcheck.js"></script>';


echo '<form method="POST" enctype="multipart/form-data" name="picform" id="picform" action="' . $scripturl . '?action=gallery&sa=add2">
<table border="0" cellpadding="0" cellspacing="0" width="100%" height="129">
  <tr class="catbg">
    <td width="50%" colspan="2" height="19" align="center">
    <b>' . $txt['gallery_form_addpicture'] . '</b></td>
  </tr>
  <tr class="windowbg2">
  <td align="right"><b>' . $txt['gallery_form_title'] . '</b>&nbsp;</td>
  <td><input type="text" name="title" /></td>
  </tr>
  <tr class="windowbg2">
  <td align="right"><b>' . $txt['gallery_form_category'] . '</b>&nbsp;</td>
  <td><select name="cat">';

$dbresult = db_query("SELECT ID_CAT, title FROM {$db_prefix}gallery_cat ORDER BY roworder ASC", __FILE__, __LINE__);

while($row = mysql_fetch_assoc($dbresult))
{

echo '<option value="' . $row['ID_CAT']  . '" ' . (($cat == $row['ID_CAT']) ? ' selected="selected"' : '') .'>' . $row['title'] . '</option>';

}


echo '</select>
  </td>
  </tr>
  <tr class="windowbg2">
  <td align="right"><b>' . $txt['gallery_form_description'] . '</b>&nbsp;</td>
  <td><textarea name="description" rows="6" cols="55"></textarea>';

      if ($context['show_spellchecking'])
      echo '
      <br /><input type="button" value="', $txt['spell_check'], '" onclick="spellCheck(\'picform\', \'description\');" />';



echo '
  </td>
  </tr>
  <tr class="windowbg2">
  <td align="right"><b>' . $txt['gallery_form_keywords'] . '</b>&nbsp;</td>
  <td><input type="text" name="keywords" maxlength="100" />
  </tr>
  <tr class="windowbg2">
  <td align="right"><b>' . $txt['gallery_form_uploadpic'] . '</b>&nbsp;</td>

    <td><input type="file" size="48" name="picture" />';

  if(!empty($modSettings['gallery_max_width']))
echo '<br />' . $txt['gallery_form_maxwidth'] .  $modSettings['gallery_max_width'] . $txt['gallery_form_pixels'];
  if(!empty($modSettings['gallery_max_height']))
  echo '<br />' . $txt['gallery_form_maxheight'] .  $modSettings['gallery_max_height'] . $txt['gallery_form_pixels'];

echo '
    </td>
  </tr>';

  if(!empty($modSettings['gallery_commentchoice']))
  {
echo '
   <tr class="windowbg2">
<td align="right"><b>' . $txt['gallery_form_additionaloptions'] . '</b>&nbsp;</td>
<td><input type="checkbox" name="allowcomments" checked="checked" /><b>' . $txt['gallery_form_allowcomments'] .'</b>
  </tr>';
  }

echo '
  <tr class="windowbg2">
    <td width="28%" colspan="2" height="26" align="center" class="windowbg2">

    <input type="submit" value="' . $txt['gallery_form_addpicture'] . '" name="submit" /><br />';

  if(!allowedTo('smfgallery_autoapprove'))
  echo $txt['gallery_form_notapproved'];

echo '
    </td>
  </tr>
</table>

</form>
</div>';

if ($context['show_spellchecking'])
if(function_exists('parse_bbc'))
echo '<form action="', $scripturl, '?action=spellcheck" method="post" accept-charset="', $context['character_set'], '" name="spell_form" id="spell_form" target="spellWindow"><input type="hidden" name="spellstring" value="" /></form>';
else
echo '<form name="spell_form" id="spell_form" method="post" target="spellWindow" action="', $scripturl, '?action=spellcheck"><input type="hidden" name="spell_formname" value="" /><input type="hidden" name="spell_fieldname" value="" /><input type="hidden" name="spellstring" value="" /></form>';

This one was for center blocks,

If you want one for left/right here is the code:
//Quick Gallery Upload Box(Left/Right side)
//Made by Dragooon.
//Credits are all to mod author since I used the
//Template Function in it.
global $scripturl, $modSettings, $db_prefix, $txt, $context, $settings, $boarddir;
require($boarddir . '/Themes/default/languages/Gallery.english.php');


//Get the category
@$cat = (int) $_REQUEST['cat'];

echo '<div class="tborder">';

// Load the spell checker?
if ($context['show_spellchecking'])
echo '
<script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/spellcheck.js"></script>';


echo '<form method="POST" enctype="multipart/form-data" name="picform" id="picform" action="' . $scripturl . '?action=gallery&sa=add2">
<table border="0" cellpadding="0" cellspacing="0" width="100%" height="129">
  <tr class="catbg">
    <td width="50%" colspan="2" height="19" align="left">
    <b>' . $txt['gallery_form_addpicture'] . '</b></td>
  </tr>
  <tr class="windowbg2">
  <td align="left"><b>' . $txt['gallery_form_title'] . '<br></b>&nbsp;
<input type="text" name="title" /></td>
  </tr>
  <tr class="windowbg2">
  <td align="left"><b><br><br>' . $txt['gallery_form_category'] . '</b>&nbsp;
   <select name="cat">';

$dbresult = db_query("SELECT ID_CAT, title FROM {$db_prefix}gallery_cat ORDER BY roworder ASC", __FILE__, __LINE__);

while($row = mysql_fetch_assoc($dbresult))
{

echo '<option value="' . $row['ID_CAT']  . '" ' . (($cat == $row['ID_CAT']) ? ' selected="selected"' : '') .'>' . $row['title'] . '</option>';

}


echo '</select>
  </td>
  </tr>
  <br><br><tr class="windowbg2">
  <td align="left"><b><br><br>' . $txt['gallery_form_description'] . '</b>&nbsp;
    <textarea name="description" rows="3" cols="15"></textarea>';

      if ($context['show_spellchecking'])
      echo '
      <br /><input type="button" value="', $txt['spell_check'], '" onclick="spellCheck(\'picform\', \'description\');" />';



echo '
  </td>
  </tr>
  <tr class="windowbg2">
  <td align="left"><b><br><br>' . $txt['gallery_form_keywords'] . '</b>&nbsp;
  <input type="text" name="keywords" maxlength="100" />
  </tr>
  <tr class="windowbg2">
  <td align="left"><b><br><br>' . $txt['gallery_form_uploadpic'] . '<br></b>&nbsp;
        <input type="file" size="10" name="picture" />';

  if(!empty($modSettings['gallery_max_width']))
echo '<br />' . $txt['gallery_form_maxwidth'] .  $modSettings['gallery_max_width'] . $txt['gallery_form_pixels'];
  if(!empty($modSettings['gallery_max_height']))
  echo '<br />' . $txt['gallery_form_maxheight'] .  $modSettings['gallery_max_height'] . $txt['gallery_form_pixels'];

echo '
    </td>
  </tr>';

  if(!empty($modSettings['gallery_commentchoice']))
  {
echo '
   <tr class="windowbg2">
<td align="left"><b>' . $txt['gallery_form_additionaloptions'] . '</b>&nbsp;
<input type="checkbox" name="allowcomments" checked="checked" /><b>' . $txt['gallery_form_allowcomments'] .'</b>
  </tr>';
  }

echo '
  <tr class="windowbg2">
    <td width="28%" colspan="2" height="26" align="left" class="windowbg2">

    <input type="submit" value="' . $txt['gallery_form_addpicture'] . '" name="submit" /><br />';

  if(!allowedTo('smfgallery_autoapprove'))
  echo $txt['gallery_form_notapproved'];

echo '
    </td>
  </tr>
</table>

</form>
</div>';

if ($context['show_spellchecking'])
if(function_exists('parse_bbc'))
echo '<form action="', $scripturl, '?action=spellcheck" method="post" accept-charset="', $context['character_set'], '" name="spell_form" id="spell_form" target="spellWindow"><input type="hidden" name="spellstring" value="" /></form>';
else
echo '<form name="spell_form" id="spell_form" method="post" target="spellWindow" action="', $scripturl, '?action=spellcheck"><input type="hidden" name="spell_formname" value="" /><input type="hidden" name="spell_fieldname" value="" /><input type="hidden" name="spellstring" value="" /></form>';


Demo can be found at my crappy test site -
http://gforumx.com/tst

Hope you like it.
Title: Re: SMF Gallery Lite(1.7.X) Quick Upload Block(Left/Right/Center)
Post by: sindy on July 27, 2007, 10:09:08 AM
Hi..dragoon,its a nice block,thanks,I install in my site
Oh,,where can I the theme FerryTema download,pleas post a link to zip file.
Title: Re: SMF Gallery Lite(1.7.X) Quick Upload Block(Left/Right/Center)
Post by: Dragooon on July 27, 2007, 10:12:00 AM
Hehe Sorry But I cant release it.
I converted it but I dont still got permission to release it.
Title: Re: SMF Gallery Lite(1.7.X) Quick Upload Block(Left/Right/Center)
Post by: sindy on July 27, 2007, 10:17:42 AM
Thanks,,I wait antill you release it?about one weak!!
Title: Re: SMF Gallery Lite(1.7.X) Quick Upload Block(Left/Right/Center)
Post by: Dragooon on July 27, 2007, 10:21:45 AM
I dont know.It all depends on when I'll get my permission.
Title: Re: SMF Gallery Lite(1.7.X) Quick Upload Block(Left/Right/Center)
Post by: sindy on July 27, 2007, 11:45:05 AM
Ok,can you tell mi from where you convertet it and how,Thanks
Title: Re: SMF Gallery Lite(1.7.X) Quick Upload Block(Left/Right/Center)
Post by: Dragooon on July 27, 2007, 11:49:00 AM
Sure
http://www.cripcan.com/cripconvert.htm