• 0
  • 2 RepliesReplies
  • 3761 ReadTimes Read
  • 0 PointsPoints

Topic: [Tutorial] Remover el area de adjuntar archivos.

Usuario: Maliante
Rango: Friend de SMFSimple
Mensajes: 1361
Points: 181
Mi web: http://www.ftasupport.info
Perfil: View Profile
Pais:
pr
Aqui algo que hice simplemente por capricho.

Buscando la solucion a adjuntar fotos por imageshack me di con la interrogante si podia eliminar el area de adjuntar archivos y borrando esta area se elimina totalmente y sin problemas.

Vamos a ./Themes/default/Post.template.php

buscamos y eliminamos estas lineas

Code: [Select]
// If this post already has attachments on it - give information about them.
if (!empty($context['current_attachments']))
{
echo '
<dl id="postAttachment">
<dt>
', $txt['attached'], ':
</dt>
<dd class="smalltext">
<input type="hidden" name="attach_del[]" value="0" />
', $txt['uncheck_unwatchd_attach'], ':
</dd>';
foreach ($context['current_attachments'] as $attachment)
echo '
<dd class="smalltext">
<label for="attachment_', $attachment['id'], '"><input type="checkbox" id="attachment_', $attachment['id'], '" name="attach_del[]" value="', $attachment['id'], '"', empty($attachment['unchecked']) ? ' checked="checked"' : '', ' class="input_check" /> ', $attachment['name'], (empty($attachment['approved']) ? ' (' . $txt['awaiting_approval'] . ')' : ''), '</label>
</dd>';
echo '
</dl>';
}

// Is the user allowed to post any additional ones? If so give them the boxes to do it!
if ($context['can_post_attachment'])
{
echo '
<dl id="postAttachment2">
<dt>
', $txt['attach'], ':
</dt>
<dd class="smalltext">
<input type="file" size="60" name="attachment[]" id="attachment1" class="input_file" /> (<a href="javascript:void(0);" onclick="cleanFileInput(\'attachment1\');">', $txt['clean_attach'], '</a>)';

// Show more boxes only if they aren't approaching their limit.
if ($context['num_allowed_attachments'] > 1)
echo '
<script type="text/javascript"><!-- // --><![CDATA[
var allowed_attachments = ', $context['num_allowed_attachments'], ';
var current_attachment = 1;

function addAttachment()
{
allowed_attachments = allowed_attachments - 1;
current_attachment = current_attachment   1;
if (allowed_attachments <= 0)
return alert("', $txt['more_attachments_error'], '");

setOuterHTML(document.getElementById("moreAttachments"), \'<dd class="smalltext"><input type="file" size="60" name="attachment[]" id="attachment\'   current_attachment   \'" class="input_file" /> (<a href="javascript:void(0);" onclick="cleanFileInput(\\\'attachment\'   current_attachment   \'\\\');">', $txt['clean_attach'], '</a>)\'   \'</dd><dd class="smalltext" id="moreAttachments"><a href="#" onclick="addAttachment(); return false;">(', $txt['more_attachments'], ')<\'   \'/a><\'   \'/dd>\');

return true;
}
// ]]></script>
</dd>
<dd class="smalltext" id="moreAttachments"><a href="#" onclick="addAttachment(); return false;">(', $txt['more_attachments'], ')</a></dd>';

echo '
<dd class="smalltext">';

// Show some useful information such as allowed extensions, maximum size and amount of attachments allowed.
if (!empty($modSettings['attachmentCheckExtensions']))
echo '
', $txt['allowed_types'], ': ', $context['allowed_extensions'], '<br />';

if (!empty($context['attachment_restrictions']))
echo '
', $txt['attach_restrictions'], ' ', implode(', ', $context['attachment_restrictions']), '<br />';

if (!$context['can_post_attachment_unapproved'])
echo '
<span class="alert">', $txt['attachment_requires_approval'], '</span>', '<br />';

echo '
</dd>
</dl>';
}

Una vez eliminado damos a salvar y listo sin espacio para adjuntar.



Espero les sirva.

Saludos
Maliante
You do not have permission to give points
point 0 Points

This topic did not receive points.

Usuario: Lean
Rango: Fundador
Mensajes: 6782
Points: 236
Perfil: View Profile
Pais:
ar
Re:[Tutorial] Remover el area de adjuntar archivos.
Reply #1 March 04, 2011 - 04:02 16:02
Muy bueno! Una sola cosa, mas que borrar podrias hacerlo un comentario en php y si el dia de maƱana lo quieres volver a tener le sacas el comentario y listo.

Quedaria algo asi:
Code: [Select]
/*
   // If this post already has attachments on it - give information about them.
   if (!empty($context['current_attachments']))
   {
      echo '
               <dl id="postAttachment">
                  <dt>
                     ', $txt['attached'], ':
                  </dt>
                  <dd class="smalltext">
                     <input type="hidden" name="attach_del[]" value="0" />
                     ', $txt['uncheck_unwatchd_attach'], ':
                  </dd>';
      foreach ($context['current_attachments'] as $attachment)
         echo '
                  <dd class="smalltext">
                     <label for="attachment_', $attachment['id'], '"><input type="checkbox" id="attachment_', $attachment['id'], '" name="attach_del[]" value="', $attachment['id'], '"', empty($attachment['unchecked']) ? ' checked="checked"' : '', ' class="input_check" /> ', $attachment['name'], (empty($attachment['approved']) ? ' (' . $txt['awaiting_approval'] . ')' : ''), '</label>
                  </dd>';
      echo '
               </dl>';
   }

   // Is the user allowed to post any additional ones? If so give them the boxes to do it!
   if ($context['can_post_attachment'])
   {
      echo '
               <dl id="postAttachment2">
                  <dt>
                     ', $txt['attach'], ':
                  </dt>
                  <dd class="smalltext">
                     <input type="file" size="60" name="attachment[]" id="attachment1" class="input_file" /> (<a href="javascript:void(0);" onclick="cleanFileInput(\'attachment1\');">', $txt['clean_attach'], '</a>)';

      // Show more boxes only if they aren't approaching their limit.
      if ($context['num_allowed_attachments'] > 1)
         echo '
                     <script type="text/javascript"><!-- // --><![CDATA[
                        var allowed_attachments = ', $context['num_allowed_attachments'], ';
                        var current_attachment = 1;

                        function addAttachment()
                        {
                           allowed_attachments = allowed_attachments - 1;
                           current_attachment = current_attachment   1;
                           if (allowed_attachments <= 0)
                              return alert("', $txt['more_attachments_error'], '");

                           setOuterHTML(document.getElementById("moreAttachments"), \'<dd class="smalltext"><input type="file" size="60" name="attachment[]" id="attachment\'   current_attachment   \'" class="input_file" /> (<a href="javascript:void(0);" onclick="cleanFileInput(\\\'attachment\'   current_attachment   \'\\\');">', $txt['clean_attach'], '</a>)\'   \'</dd><dd class="smalltext" id="moreAttachments"><a href="#" onclick="addAttachment(); return false;">(', $txt['more_attachments'], ')<\'   \'/a><\'   \'/dd>\');

                           return true;
                        }
                     // ]]></script>
                  </dd>
                  <dd class="smalltext" id="moreAttachments"><a href="#" onclick="addAttachment(); return false;">(', $txt['more_attachments'], ')</a></dd>';

      echo '
                  <dd class="smalltext">';

      // Show some useful information such as allowed extensions, maximum size and amount of attachments allowed.
      if (!empty($modSettings['attachmentCheckExtensions']))
         echo '
                     ', $txt['allowed_types'], ': ', $context['allowed_extensions'], '<br />';

      if (!empty($context['attachment_restrictions']))
         echo '
                     ', $txt['attach_restrictions'], ' ', implode(', ', $context['attachment_restrictions']), '<br />';

      if (!$context['can_post_attachment_unapproved'])
         echo '
                     <span class="alert">', $txt['attachment_requires_approval'], '</span>', '<br />';

      echo '
                  </dd>
               </dl>';
   }
*/

Como veras al principio tiene el simbolo /* (apertura de comentario en php) y al final del codigo el simbolo */ (Cierre de comentario en php)

Espero que sirva el tip jeje

Usuario: Maliante
Rango: Friend de SMFSimple
Mensajes: 1361
Points: 181
Mi web: http://www.ftasupport.info
Perfil: View Profile
Pais:
pr
Re:[Tutorial] Remover el area de adjuntar archivos.
Reply #2 March 04, 2011 - 05:29 17:29
Exelente idea. Poco a poco hacemos mucho.

Saludos
Maliante

 

TAGS



top

Smfsimple.com es un sitio destinado a brindar un servicio de soporte y herramientas para foros realizados con el sistema de foros gratuito simplemachines.org. Contamos con un selecto equipo de desarrolladores y conocedores del sistema, sus foros estaran en buenas manos.
This site is not affiliated with or endorsed by Simple Machines