Monday, July 23, 2012

SugarCRM View documents in browser.


( Currently Supported PDF and Text file )

- Make a directory called “doc” within the “custom” folder (rights: 777).
- Make a  php file called “showfile.php” (rights: 777) in the “prudento” folder.
- Place the following code within showfile.php:



for all doc:::::
<?php
$FileNaam=$_GET['file'];
$FileType=$_GET['type'];
$base = str_replace(‘/custom/doc/showfile.php’, ” ,$_SERVER['PHP_SELF'] );
echo ‘<body scroll=”no” style=”overflow:hide; height:480px;”>’;
echo ‘<div id=”bg_image” style=”position:absolute; top:0px; left:0px; height:100%; width:100%”>’;
echo ‘<embed src=”http://docs.google.com/gview?url=http://’ . $_SERVER['SERVER_NAME'] . $base . ‘/cache/upload/’. $FileNaam .’&embedded=true “id=”application/pdf” width=”100%” height=”480px” ></embed >’;
echo ‘</div>’;
?>


for pdf and text exclude doc::::::::

<?php
$FileNaam=$_GET['file'];
$FileType=$_GET['type'];
/************************************
* find root of the sugarinstallation
************************************/
$base = str_replace(‘/custom/doc/showfile.php’, ” ,$_SERVER['PHP_SELF'] );

/************************************
* build html page to show in iframe field
************************************/

echo ‘<body scroll=”no” style=”overflow:hidden; height:100%;”>’;
echo ‘<div id=”bg_image” style=”position:absolute; top:0px; left:0px; height:100%; width:100%”>’;
echo ‘<embed src=”http://’ . $_SERVER['SERVER_NAME'] . $base . ‘/cache/upload/’. $FileNaam .’” id=”imgPhoto” width=”100%” height=”100%” ></embed >’;
echo ‘</div>’;
?>


Go to studio=>documents=>fields an make a costum field with these properties:
- Datatype: Iframe
- Field label: Preview
- Generate URL: Yes
- Standard value: http://domain.com/custom/doc/showfile.php?file={document_revision_id}
- Maximun size: 225
- Iframe height: 500
- Save
- Go to studio=>documents=>layout=>detailview and make a panel called something like “preview”
- Place the “preview” block on the new panel and make it fit the whole line.
- Do a quick repair in the admin menu
- Open the .htaccess (if any) in the sugar root folder.
- Comment out or delete the 2 rows with the cache and temp folder ( otherwise Googledocs cant access the files)

SugarCRM login page







Dear All,
Upgrade your sugarcrm 5.2 login page to sugarcrm 6.3
1) find the attachments .
2) goto modules => Users
3) copy Login.php to Login_org.php
4) now replace Login.php Login.php.txt

Ad