diff --git a/oss/vtiger/trunk/modules/Portal/Delete.php b/oss/vtiger/trunk/modules/Portal/Delete.php
new file mode 100644
index 00000000..f426e90e
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Portal/Delete.php
@@ -0,0 +1,22 @@
+pquery($del_query, array($_REQUEST['record']));
+
+ //code added for returning back to the current view after delete from list view
+header("Location: index.php?action=PortalAjax&module=Portal&file=ListView&mode=ajax&datamode=manage");
+?>
diff --git a/oss/vtiger/trunk/modules/Portal/ListView.php b/oss/vtiger/trunk/modules/Portal/ListView.php
new file mode 100644
index 00000000..15f17bf9
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Portal/ListView.php
@@ -0,0 +1,78 @@
+pquery($query, array());
+//Getting the Default URL Value if any
+$default_url = $adb->query_result($result,0,'portalurl');
+$no_of_portals=$adb->num_rows($result);
+$portal_info=array();
+//added as an enhancement to set default
+?>
+
+query_result($result,0,'portalurl');
+$smarty = new vtigerCRM_Smarty;
+$smarty->assign("THEME", $theme);
+$smarty->assign("IMAGE_PATH", $image_path);
+$smarty->assign("MOD", $mod_strings);
+$smarty->assign("DEFAULT_URL", $def_ault);
+$smarty->assign("APP", $app_strings);
+$smarty->assign("PORTAL_COUNT", count($portal_info));
+$smarty->assign("PORTALS", $portal_info);
+$smarty->assign("MODULE", $currentModule);
+$smarty->assign("DEFAULT",'yes');
+$smarty->assign("CATEGORY", getParentTab());
+if($_REQUEST['datamode'] == 'data')
+ $smarty->display("MySitesContents.tpl");
+elseif($_REQUEST['datamode'] == 'manage')
+ $smarty->display("MySitesManage.tpl");
+else
+ $smarty->display("MySites.tpl");
+?>
diff --git a/oss/vtiger/trunk/modules/Portal/Popup.php b/oss/vtiger/trunk/modules/Portal/Popup.php
new file mode 100644
index 00000000..969cdabb
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Portal/Popup.php
@@ -0,0 +1,67 @@
+pquery($query, array($portalid));
+ $portalname = $adb->query_result($result,0,'portalname');
+ $portalurl = $adb->query_result($result,0,'portalurl');
+ /* to remove http:// from portal url*/
+ $portalurl = preg_replace("/http:\/\//i","",$portalurl);
+}
+$portal_inputs='';
+$portal_inputs.='
';
+
+echo $portal_inputs;
+
+
+?>
diff --git a/oss/vtiger/trunk/modules/Portal/Portal.js b/oss/vtiger/trunk/modules/Portal/Portal.js
new file mode 100644
index 00000000..129b2c00
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Portal/Portal.js
@@ -0,0 +1,146 @@
+/*********************************************************************************
+** The contents of this file are subject to the vtiger CRM Public License Version 1.0
+ * ("License"); You may not use this file except in compliance with the License
+ * The Original Code is: vtiger CRM Open Source
+ * The Initial Developer of the Original Code is vtiger.
+ * Portions created by vtiger are Copyright (C) vtiger.
+ * All Rights Reserved.
+*
+ ********************************************************************************/
+
+
+function fetchAddSite(id)
+{
+ $("status").style.display="inline";
+ new Ajax.Request(
+ 'index.php',
+ {queue: {position: 'end', scope: 'command'},
+ method: 'post',
+ postBody:'module=Portal&action=PortalAjax&file=Popup&record='+id,
+ onComplete: function(response) {
+ $("status").style.display="none";
+ $('editportal_cont').innerHTML = response.responseText;
+ }
+ }
+ );
+}
+
+function fetchContents(mode)
+{
+ // Reloading the window is better, If not reloaded ... mysitesArray variable needs to be updated
+ // using eval method on javascript.
+ if(mode == 'data') {
+ window.location.href = 'index.php?module=Portal&action=ListView&parenttab=Tools';
+ return;
+ }
+ $("status").style.display="inline";
+ new Ajax.Request(
+ 'index.php',
+ {queue: {position: 'end', scope: 'command'},
+ method: 'post',
+ postBody:'action=PortalAjax&mode=ajax&module=Portal&file=ListView&datamode='+mode,
+ onComplete: function(response) {
+ $("status").style.display="none";
+ $('portalcont').innerHTML = response.responseText;
+ }
+ }
+ );
+}
+function DeleteSite(id)
+{
+ if(confirm(alert_arr.SURE_TO_DELETE))
+ {
+ $("status").style.display="inline";
+ new Ajax.Request(
+ 'index.php',
+ {queue: {position: 'end', scope: 'command'},
+ method: 'post',
+ postBody:'action=PortalAjax&mode=ajax&file=Delete&module=Portal&record='+id,
+ onComplete: function(response) {
+ $("status").style.display="none";
+ $('portalcont').innerHTML = response.responseText;
+ }
+ }
+ );
+ }
+}
+function SaveSite(id)
+{
+ if ($('portalurl').value.replace(/^\s+/g, '').replace(/\s+$/g, '').length==0) {
+ alert(alert_arr.SITEURL_CANNOT_BE_EMPTY)
+ return false;
+ }
+ if ($('portalname').value.replace(/^\s+/g, '').replace(/\s+$/g, '').length==0) {
+ alert(alert_arr.SITENAME_CANNOT_BE_EMPTY)
+ return false;
+ }
+ Effect.Puff('orgLay');
+ $("status").style.display="inline";
+ var portalurl = document.getElementById('portalurl').value;
+ var portalurl = portalurl.replace(/&/g, "#$#$#");
+ var portalname = document.getElementById('portalname').value;
+ new Ajax.Request(
+ 'index.php',
+ {queue: {position: 'end', scope: 'command'},
+ method: 'post',
+ postBody:'action=PortalAjax&mode=ajax&file=Save&module=Portal&portalname='+portalname+'&portalurl='+portalurl+'&record='+id,
+ onComplete: function(response) {
+ if(response.responseText.indexOf(":#:FAILURE") > -1)
+ {
+ alert(alert_arr.VALID_DATA)
+ }else
+ {
+ $('portalcont').innerHTML = response.responseText;
+ }
+ $("status").style.display="none";
+ }
+ }
+ );
+}
+function setSite(oUrllist)
+{
+ //var url = oUrllist.options[oUrllist.options.selectedIndex].value;
+ var id = oUrllist.options[oUrllist.options.selectedIndex].value;
+ document.getElementById('locatesite').src = mysitesArray[id];
+}
+//added as an enhancement to set default value
+function defaultMysites(oSelectlist)
+{
+ var id = $("urllist").value;
+ $("status").style.display="block";
+ new Ajax.Request(
+ 'index.php',
+ {queue: {position: 'end', scope: 'command'},
+ method: 'post',
+ postBody:'action=PortalAjax&mode=ajax&file=Save&module=Portal&check=true&passing_var='+id,
+ onComplete: function(response) {
+ //alert(response.responseText);
+ $("status").style.display="none";
+ }
+ }
+ );
+
+}
+
+var oRegex = new Object() ;
+oRegex.UriProtocol = new RegExp('') ;
+oRegex.UriProtocol.compile( '^(((http|https|ftp|news):\/\/)|mailto:)', 'gi' ) ;
+
+oRegex.UrlOnChangeProtocol = new RegExp('') ;
+oRegex.UrlOnChangeProtocol.compile( '^(http|https|ftp|news)://(?=.)', 'gi' ) ;
+
+function OnUrlChange()
+{
+ var sUrl;
+ var sProtocol;
+
+ sUrl=document.getElementById("portalurl").value ;
+ sProtocol=oRegex.UrlOnChangeProtocol.exec( sUrl ) ;
+ if ( sProtocol )
+ {
+ sUrl = sUrl.substr( sProtocol[0].length ) ;
+ document.getElementById("portalurl").value = sUrl ;
+ }
+
+
+}
diff --git a/oss/vtiger/trunk/modules/Portal/Portal.php b/oss/vtiger/trunk/modules/Portal/Portal.php
new file mode 100644
index 00000000..de7e3a38
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Portal/Portal.php
@@ -0,0 +1,47 @@
+println("just entered the SavePortal method");
+ $portalid=$adb->getUniqueID('vtiger_portal');
+ $query="insert into vtiger_portal values(?,?,?,?,?)";
+ $params=array($portalid,$portalname,$portalurl,0,0);
+ $adb->println($query);
+ $result=$adb->pquery($query,$params);
+ return $portalid;
+}
+/** Function to update the portal in database
+ * @param $portalname : Type String
+ * @param $portalurl : Type String
+ * @param $portalid : Type Integer
+ * This function updates the portal with the given $portalname,$portalurl
+ * This Returns $portalid
+ */
+function UpdatePortal($portalname,$portalurl,$portalid)
+{
+ global $adb;
+ $adb->println("just entered the SavePortal method");
+ $query="update vtiger_portal set portalname=? ,portalurl=? where portalid=?";
+ $params=array($portalname, $portalurl, $portalid);
+ $adb->println($query);
+ $result=$adb->pquery($query, $params);
+ return $portalid;
+}
+?>
diff --git a/oss/vtiger/trunk/modules/Portal/PortalAjax.php b/oss/vtiger/trunk/modules/Portal/PortalAjax.php
new file mode 100644
index 00000000..b1b7fcdc
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Portal/PortalAjax.php
@@ -0,0 +1,13 @@
+
+
diff --git a/oss/vtiger/trunk/modules/Portal/Save.php b/oss/vtiger/trunk/modules/Portal/Save.php
new file mode 100644
index 00000000..032f027e
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Portal/Save.php
@@ -0,0 +1,44 @@
+pquery($updateDefalt, array($_REQUEST['passing_var']));
+ $updateZero = "UPDATE vtiger_portal SET setdefault=0 WHERE portalid not in(?)";
+ $set_default= $adb->pquery($updateZero, array($_REQUEST['passing_var']));
+ exit();
+}
+if($portlname != '' && $portlurl != '')
+{
+ if(isset($_REQUEST['record']) && $_REQUEST['record'] !='')
+ {
+ $result=UpdatePortal($portlname,"http://".str_replace("#$#$#","&",$portlurl),$_REQUEST['record']);
+ }
+ else
+ {
+ $result=SavePortal($portlname,"http://".str_replace("#$#$#","&",$portlurl));
+ }
+ header("Location: index.php?action=PortalAjax&module=Portal&file=ListView&mode=ajax&datamode=manage");
+}else
+{
+ echo ":#:FAILURE";
+}
+?>
diff --git a/oss/vtiger/trunk/modules/Portal/index.php b/oss/vtiger/trunk/modules/Portal/index.php
new file mode 100644
index 00000000..d46fe334
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Portal/index.php
@@ -0,0 +1,13 @@
+
diff --git a/oss/vtiger/trunk/modules/Portal/language/en_us.lang.php b/oss/vtiger/trunk/modules/Portal/language/en_us.lang.php
new file mode 100644
index 00000000..6fb714bf
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Portal/language/en_us.lang.php
@@ -0,0 +1,34 @@
+"BookMarked URL's",
+'LBL_MANAGE_BOOKMARKS'=>'Manage Bookmarks',
+'LBL_BOOKMARK_LIST'=>'Bookmark List',
+'LBL_MY_BOOKMARKS'=>'My Bookmarks',
+'LBL_NEW_BOOKMARK'=>'New Bookmark',
+'LBL_BOOKMARK'=>'Bookmark',
+'LBL_NAME'=>'Name :',
+'LBL_URL'=>'URL :',
+'LBL_ADD'=>'Add',
+'LBL_SNO'=>'#',
+'LBL_BOOKMARK_NAME_URL'=>'Bookmark Name & URL',
+'LBL_TOOLS'=>'Tools',
+'LBL_MANAGE_SITES'=>'Manage Sites',
+'LBL_MY_SITES'=>'Sites',
+
+// Added/Updated for vtiger CRM 5.0.4
+//added as an enhancement
+'LBL_SET_DEFAULT_BUTTON'=>'Set As Default',
+);
+?>
diff --git a/oss/vtiger/trunk/modules/Portal/language/zh_cn.lang.php b/oss/vtiger/trunk/modules/Portal/language/zh_cn.lang.php
new file mode 100644
index 00000000..0e9b86a2
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Portal/language/zh_cn.lang.php
@@ -0,0 +1,44 @@
+ '书签网址的',
+'LBL_MANAGE_BOOKMARKS' => '管理书签',
+'LBL_BOOKMARK_LIST' => '书签列表',
+'LBL_MY_BOOKMARKS' => '我的书签',
+'LBL_NEW_BOOKMARK' => '新增书签',
+'LBL_BOOKMARK' => '书签',
+'LBL_NAME' => '名称:',
+'LBL_URL' => '网址:',
+'LBL_ADD' => '新增',
+'LBL_SNO' => '#',
+'LBL_BOOKMARK_NAME_URL' => '书签名称 & 网址',
+'LBL_TOOLS' => '工具',
+'LBL_MANAGE_SITES' => '管理网站',
+'LBL_MY_SITES' => '我的网站',
+
+// Added/Updated for vtiger CRM 5.0.4
+//added as an enhancement
+'LBL_SET_DEFAULT_BUTTON'=>'预设',
+);
+?>