[Vtigercrm-commits] [vtiger-commits] r6806 - in /vtigercrm/trunk: Smarty/templates/RelatedLists.tpl modules/uploads/add2db.php modules/uploads/language/en_us.lang.php modules/uploads/upload.php
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Tue May 30 20:32:49 EDT 2006
Author: don
Date: Tue May 30 18:32:43 2006
New Revision: 6806
Log:
New UI for attachments has been integrated
Modified:
vtigercrm/trunk/Smarty/templates/RelatedLists.tpl
vtigercrm/trunk/modules/uploads/add2db.php
vtigercrm/trunk/modules/uploads/language/en_us.lang.php
vtigercrm/trunk/modules/uploads/upload.php
Modified: vtigercrm/trunk/Smarty/templates/RelatedLists.tpl
==============================================================================
--- vtigercrm/trunk/Smarty/templates/RelatedLists.tpl (original)
+++ vtigercrm/trunk/Smarty/templates/RelatedLists.tpl Tue May 30 18:32:43 2006
@@ -114,7 +114,7 @@
{elseif $header eq 'Attachments'}
<input title="New Notes" accessyKey="F" class="small" onclick="this.form.action.value='EditView'; this.form.return_action.value='CallRelatedList'; this.form.module.value='Notes'" type="submit" name="button" value="Add new Note">
<input type="hidden" name="fileid">
- <input title="New Attachment" accessyKey="F" class="small" onclick="this.form.action.value='upload'; this.form.module.value='uploads'" type="submit" name="button" value="Add new Attachment"></td>
+ <input title="New Attachment" accessyKey="F" class="small" onclick="OpenWindow('index.php?module=uploads&action=uploadsAjax&file=upload&return_action=CallRelatedList&return_module={$MODULE}&return_id={$id}');" type="button" name="button" value="Add new Attachment"></td>
{elseif $header eq 'Quotes'}
<input title="New Quote" accessyKey="F" class="small" onclick="this.form.action.value='EditView';this.form.module.value='Quotes'" type="submit" name="button" value="Add new Quote"></td>
@@ -216,3 +216,9 @@
<div id="sendmail_cont" style="z-index:100001;position:absolute;width:310px;"></div>
{/if}
+<script>
+function OpenWindow(url)
+{ldelim}
+ openPopUp('xAttachFile',this,url,'attachfileWin',380,375,'menubar=no,toolbar=no,location=no,status=no,resizable=no');
+{rdelim}
+</script>
Modified: vtigercrm/trunk/modules/uploads/add2db.php
==============================================================================
--- vtigercrm/trunk/modules/uploads/add2db.php (original)
+++ vtigercrm/trunk/modules/uploads/add2db.php Tue May 30 18:32:43 2006
@@ -27,10 +27,8 @@
$uploaddir = $directory;
$crmid = $_REQUEST['return_id'];
-for ($filecount=0;$filecount<count($_FILES) && $_FILES['file_'.$filecount]!='';$filecount++)
-{
// Arbitrary File Upload Vulnerability fix - Philip
- $binFile = $_FILES['file_'.$filecount]['name'];
+ $binFile = $_FILES['filename']['name'];
$ext_pos = strrpos($binFile, ".");
@@ -41,17 +39,17 @@
$binFile .= ".txt";
}
- $_FILES["file_".$filecount]["name"] = $binFile;
+ $_FILES["filename"]["name"] = $binFile;
// Vulnerability fix ends
//decide the file path where we should upload the file in the server
$upload_filepath = decideFilePath();
- if(move_uploaded_file($_FILES["file_".$filecount]["tmp_name"],$upload_filepath.$crmid."_".$_FILES["file_".$filecount]["name"]))
+ if(move_uploaded_file($_FILES["filename"]["tmp_name"],$upload_filepath.$crmid."_".$_FILES["filename"]["name"]))
{
$filename = $crmid.'_'.basename($binFile);
- $filetype= $_FILES['file_'.$filecount]['type'];
- $filesize = $_FILES['file_'.$filecount]['size'];
+ $filetype= $_FILES['filename']['type'];
+ $filesize = $_FILES['filename']['size'];
if($filesize != 0)
{
@@ -73,11 +71,10 @@
$sql1 .= $crmid."','".$current_id."')";
$result = $adb->query($sql1);
- header("Location: index.php?action=".$_REQUEST['return_action']."&module=".$_REQUEST['return_module']."&record=".$_REQUEST['return_id']."&filename=".$filename."");
+ echo '<script>window.opener.location.href = window.opener.location.href;self.close();</script>';
}
else
{
- include('themes/'.$theme.'/header.php');
$errormessage = "<font color='red'><B>Error Message<ul>
<li><font color='red'>Invalid file OR</font>
<li><font color='red'>File has no data</font>
@@ -92,7 +89,6 @@
if($errorCode == 4)
{
- include('themes/'.$theme.'/header.php');
$errormessage = "<B><font color='red'>Kindly give a valid file for upload!</font></B> <br>" ;
echo $errormessage;
include "upload.php";
@@ -100,19 +96,16 @@
else if($errorCode == 2)
{
$errormessage = "<B><font color='red'>Sorry, the uploaded file exceeds the maximum filesize limit. Please try a file smaller than 1000000 bytes</font></B> <br>";
- include('themes/'.$theme.'/header.php');
echo $errormessage;
include "upload.php";
//echo $errorCode;
}
else if($errorCode == 3 || $errorcode == '')
{
- include('themes/'.$theme.'/header.php');
echo "<b><font color='red'>Problems in file upload. Please try again!</font></b><br>";
include "upload.php";
}
}
-}
?>
Modified: vtigercrm/trunk/modules/uploads/language/en_us.lang.php
==============================================================================
--- vtigercrm/trunk/modules/uploads/language/en_us.lang.php (original)
+++ vtigercrm/trunk/modules/uploads/language/en_us.lang.php Tue May 30 18:32:43 2006
@@ -23,10 +23,11 @@
$mod_strings = Array(
//Added fields for uploads (attach files)
-'LBL_DESCRIPTION'=>'Description:',
-'LBL_FILENAME'=>'File Name:',
-'LBL_ATTACH_FILE'=>'File Attachment',
-'LBL_UPLOAD'=>'Upload',
+'LBL_ATTACH_FILE'=>'Attach File',
+'LBL_STEP_SELECT_FILE'=>'Step 1 : Select File',
+'LBL_BROWSE_FILES'=>'Click the browse button and select the file to be attached',
+'LBL_DESCRIPTION'=>'Step 2 : Write some description',
+'LBL_OPTIONAL'=>'(optional)',
);
?>
Modified: vtigercrm/trunk/modules/uploads/upload.php
==============================================================================
--- vtigercrm/trunk/modules/uploads/upload.php (original)
+++ vtigercrm/trunk/modules/uploads/upload.php Tue May 30 18:32:43 2006
@@ -8,73 +8,57 @@
*
********************************************************************************/
-->
+<?
+global $theme;
+$theme_path="themes/".$theme."/";
+?>
<HTML>
+<head>
+ <link type="text/css" href="<? echo $theme_path;?>style.css" rel="stylesheet">
+</head>
<BODY>
-<script type='text/javascript' src='modules/Products/multifile.js'></script>
<FORM METHOD="post" action="index.php?module=uploads&action=add2db&return_module=<?php echo $_REQUEST['return_module']?>" enctype="multipart/form-data">
<?php
$ret_action = $_REQUEST['return_action'];
$ret_module = $_REQUEST['return_module'];
$ret_id = $_REQUEST['return_id'];
- echo get_module_title($ret_module,$ret_module." : ".$mod_strings['LBL_ATTACH_FILE'],true);
?>
-<br>
+
<INPUT TYPE="hidden" NAME="MAX_FILE_SIZE" VALUE="1000000">
<INPUT TYPE="hidden" NAME="return_module" VALUE="<?php echo $ret_module ?>">
<INPUT TYPE="hidden" NAME="return_action" VALUE="<?php echo $ret_action ?>">
<INPUT TYPE="hidden" NAME="return_id" VALUE="<?php echo $ret_id ?>">
-<div align="right" style="width:60%"><font class="required">*</font><?php echo $app_strings['NTC_REQUIRED'] ?></div>
+<table width="100%" border="0" cellpadding="5" cellspacing="0" class="small">
+<tr>
+<td class="genHeaderSmall" align="left"><? echo $mod_strings["LBL_ATTACH_FILE"];?></td>
+<td width="70%" align="right"> </td>
-<table width="60%" border="0" cellspacing="0" cellpadding="0" class="formOuterBorder">
- <tr>
- <td class="formSecHeader"> <?php echo $mod_strings['LBL_ATTACH_FILE_INFO'] ?> </td>
- </tr>
- <tr>
- <td>
- <TABLE BORDER="0" cellspacing="1" cellpadding="0">
- <TR>
- <TD class="dataLabel" width="25%">
- <div align="right"><font class="required">*</font> <?php echo $mod_strings['LBL_FILENAME']; ?> </div>
- </TD>
- <TD>
- <input name="imagelist" type="hidden" value="">
- <div id="files_list" style="border: 1px solid grey; width: 500px; padding: 5px; background: rgb(255, 255, 255) none repeat scroll 0%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initial; font-size: x-small">Files Maximum 6
- <input id="my_file_element" type="file" name="file_1" >
- <!--{foreach key=num item=image from=$maindata[3]}
- {if $image neq ''}
- <div align="center">
- <img src="test/product/{$image}" height="50"> [{$image}]<input id="file_{$num}" v
- alue="Delete" type="button" onclick='this.parentNode.parentNode.removeChild(this.parentNode);delRowEmt("{$image}")'>
- </div>
- {/if}
- {/foreach}-->
-<script>
- <!-- Create an instance of the multiSelector class, pass it the output target and the max number of files -->
- var multi_selector = new MultiSelector( document.getElementById( 'files_list' ), 6 );
- <!-- Pass in the file element -->
- multi_selector.addElement( document.getElementById( 'my_file_element' ) );
-</script>
+</tr>
+<tr><td colspan="2"><hr /></td></tr>
+<tr>
+<td width="30%" colspan="2" align="left"><b><? echo $mod_strings["LBL_STEP_SELECT_FILE"];?></b><br>
+<? echo $mod_strings["LBL_BROWSE_FILES"]; ?>
+</td>
+</tr>
+<tr>
+<td width="30%" colspan="2" align="left"><input type="file" name="filename"/></td>
- <!--<INPUT TYPE="file" NAME="binFile"></TD>-->
- </TR>
- <TR>
- <TD class="dataLabel" width="25%" valign="top" >
- <div align="right"> <?php echo $mod_strings['LBL_DESCRIPTION']; ?></div>
- </TD>
- <TD width="75%"><TEXTAREA NAME="txtDescription" ROWS="3" COLS="50"></TEXTAREA></TD>
- </TR>
- </TABLE>
- </td>
- </tr>
-</table>
+</tr>
+<tr><td colspan="2"> </td></tr>
+<tr>
+<td width="30%" colspan="2" align="left"><b> <? echo $mod_strings["LBL_DESCRIPTION"];?> </b><? echo $mod_strings["LBL_OPTIONAL"];?></td>
+</tr>
+<tr><td colspan="2" align="left"><textarea cols="50" rows="5" name="txtDescription" class="txtBox"></textarea></td></tr>
+<tr><td colspan="2" style="border-bottom:1px dashed #CCCCCC;"> </td></tr>
-<br>
-
-<table width="60%" cellpadding="0" cellspacing="0" border="0">
- <tr>
- <td><div align="center"><INPUT TYPE="submit" class="button" VALUE="<?php echo $mod_strings['LBL_UPLOAD']; ?>"></div></td>
- </tr>
+<tr>
+<td colspan="2" align="center">
+<input type="submit" name="save" value=" Attach " class="classBtn" />
+<input type="button" name="cancel" value=" Cancel " class="classBtn" onclick="self.close();" />
+</td>
+</tr>
+<tr><td colspan="2" style="border-top:1px dashed #CCCCCC;"> </td></tr>
</table>
</FORM>
More information about the vtigercrm-commits
mailing list