diff --git a/oss/vtiger/trunk/modules/Administration/language/zh_cn.lang.php b/oss/vtiger/trunk/modules/Administration/language/zh_cn.lang.php
index bc2c99eb..7735d6ca 100644
--- a/oss/vtiger/trunk/modules/Administration/language/zh_cn.lang.php
+++ b/oss/vtiger/trunk/modules/Administration/language/zh_cn.lang.php
@@ -5,7 +5,7 @@
* ---------------------------------------------
* HA WEBSYSTEMS
* http://www.hawebs.net
- * https://www.hawebs.org/forums/computer/
+ * http://forums.hawebs.net/computer/index.php
*
* CONTACT
* huyuchengus@gmail.com / yuchenghu@hawebs.net
diff --git a/oss/vtiger/trunk/modules/CustomerPortal/language/zh_cn.lang.php b/oss/vtiger/trunk/modules/CustomerPortal/language/zh_cn.lang.php
index b87309fd..6fa50c4b 100644
--- a/oss/vtiger/trunk/modules/CustomerPortal/language/zh_cn.lang.php
+++ b/oss/vtiger/trunk/modules/CustomerPortal/language/zh_cn.lang.php
@@ -1,41 +1,184 @@
'客户门户 ',
-'LBL_BASIC_SETTINGS'=>'基本设置',
-'LBL_ADVANCED_SETTINGS'=>'高级设置',
-'LBL_MODULE'=>'模块',
-'LBL_VIEW_ALL_RECORD'=>'查看所有相关记录 ?',
-'YES'=>'是',
-'NO'=>'否',
-'LBL_USER_DESCRIPTION'=>'您可以通过设置来决定上述选定的用户的相关权限,比如字段是否可见,模块是否可用等.',
-'SELECT_USERS'=>'选择用户',
-'LBL_DISABLE'=>'禁用',
-'LBL_ENABLE' =>'启用',
-'Module' => '模块',
-'Sequence' =>'次序',
-'Visible'=>'可见'
+/*********************************************************************************
+ * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
+ * ("License"); You may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
+ * the specific language governing rights and limitations under the License.
+ * The Original Code is: SugarCRM Open Source
+ * The Initial Developer of the Original Code is SugarCRM, Inc.
+ * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
+ * All Rights Reserved.
+ * Contributor(s): ______________________________________.
+ ********************************************************************************/
+/*********************************************************************************
+ * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/modules/Emails/language/en_us.lang.php,v 1.17 2005/03/28 06:31:38 rank Exp $
+ * Description: Defines the English language pack for the Account module.
+ ********************************************************************************/
+
+$mod_strings = Array(
+// Mike Crowe Mod --------------------------------------------------------added for general search
+ 'LBL_GENERAL_INFORMATION' => '一般信息',
+ 'LBL_MODULE_NAME' => '邮件',
+ 'LBL_MODULE_TITLE' => '邮件: 首页',
+ 'LBL_SEARCH_FORM_TITLE' => '搜寻邮件',
+ 'LBL_LIST_FORM_TITLE' => '邮件列表',
+ 'LBL_NEW_FORM_TITLE' => '追踪邮件',
+
+ 'LBL_LIST_SUBJECT' => '标题',
+ 'LBL_LIST_CONTACT' => '联系人',
+ 'LBL_LIST_RELATED_TO' => '相关人事',
+ 'LBL_LIST_DATE' => '寄出日期',
+ 'LBL_LIST_TIME' => '寄出时间',
+
+ 'ERR_DELETE_RECORD' => '必须有记录编号才能删除该笔账号.',
+ 'LBL_DATE_SENT' => '寄出日期:',
+ 'LBL_DATE_AND_TIME' => '寄出日期 & 时间:',
+ 'LBL_DATE' => '寄出日期:',
+ 'LBL_TIME' => '寄出时间:',
+ 'LBL_SUBJECT' => '标题:',
+ 'LBL_BODY' => '邮件内容:',
+ 'LBL_CONTACT_NAME' => '联系人名称: ',
+'LBL_EMAIL' => '邮件:',
+'LBL_DETAILVIEW_EMAIL'=>'邮件',
+'LBL_COLON'=>':',
+'LBL_CHK_MAIL'=>'检查邮件',
+'LBL_COMPOSE'=>'新邮件',
+//Single change for 5.0.3
+'LBL_SETTINGS'=>'邮件服务器设置',
+'LBL_EMAIL_FOLDERS'=>'邮件数据夹',
+'LBL_INBOX' => '收件夹',
+'LBL_SENT_MAILS'=>'邮件备份',
+'LBL_TRASH' => '垃圾桶',
+ 'LBL_JUNK_MAILS' => '广告邮件',
+ 'LBL_TO_LEADS' => '转为准客户',
+ 'LBL_TO_CONTACTS' => '转为联系人',
+ 'LBL_TO_ACCOUNTS' => '转为客户',
+ 'LBL_MY_MAILS' => '我的邮件',
+ 'LBL_QUAL_CONTACT' => '已转换邮件(转为联系人)',
+ 'LBL_MAILS' => '邮件',
+ 'LBL_QUALIFY_BUTTON' => '转换',
+ 'LBL_REPLY_BUTTON' => '回应',
+ 'LBL_FORWARD_BUTTON' => '转寄',
+ 'LBL_DOWNLOAD_ATTCH_BUTTON' => '下载附加档案',
+ 'LBL_FROM' => '寄件人:',
+ 'LBL_CC' => '副本:',
+ 'LBL_BCC' => '密件副本:',
+
+ 'NTC_REMOVE_INVITEE' => '您确定要移除这封来信?',
+'LBL_INVITEE'=>'接收者',
+
+// Added Fields
+// Contacts-SubPanelViewContactsAndUsers.php
+ 'LBL_BULK_MAILS' => '大量寄信',
+ 'LBL_ATTACHMENT' => '附件',
+'LBL_UPLOAD' => '上传',
+ 'LBL_FILE_NAME' => '文件名称',
+ 'LBL_SEND' => '寄出',
+
+'LBL_EMAIL_TEMPLATES' => '邮件样版',
+ 'LBL_TEMPLATE_NAME' => '样版名称',
+ 'LBL_DESCRIPTION' => '描述',
+ 'LBL_EMAIL_TEMPLATES_LIST' => '邮件样版列表',
+ 'LBL_EMAIL_INFORMATION' => '邮件信息',
+
+
+
+
+//for v4 release added
+ 'LBL_NEW_LEAD' => '新增潜在客户',
+ 'LBL_LEAD_TITLE' => '潜在客户',
+
+ 'LBL_NEW_PRODUCT' => '新增商品',
+ 'LBL_PRODUCT_TITLE' => '商品',
+ 'LBL_NEW_CONTACT' => '新增联系人',
+ 'LBL_CONTACT_TITLE' => '联系人',
+ 'LBL_NEW_ACCOUNT' => '新增公司',
+ 'LBL_ACCOUNT_TITLE' => '公司',
+
+// Added vtiger_fields after vtiger4 - Beta
+'LBL_USER_TITLE' => '使用者',
+ 'LBL_NEW_USER' => '新增使用者',
+
+// Added for 4 GA
+ 'LBL_TOOL_FORM_TITLE' => '邮件编辑器',
+//Added for 4GA
+'Date & Time Sent' => '寄出日期 & 时间',
+ 'Sales Enity Module' => '客服模块',
+
+ 'Related To' => '相关人事',
+ 'Assigned To' => '负责人',
+ 'Subject' => '标题',
+ 'Attachment' => '附件',
+ 'Description' => '描述',
+ 'Time Start' => '开始时间',
+ 'Created Time' => '建立时间',
+ 'Modified Time' => '修改时间',
+
+ 'MESSAGE_CHECK_MAIL_SERVER_NAME' => '请检查电子邮件服务器名称...',
+ 'MESSAGE_CHECK_MAIL_ID' => '请检查负责人的信箱编号...',
+ 'MESSAGE_MAIL_HAS_SENT_TO_USERS' => '邮件将会寄出给指定的使用者:',
+ 'MESSAGE_MAIL_HAS_SENT_TO_CONTACTS' => '邮件将会寄出给指定的联系人:',
+ 'MESSAGE_MAIL_ID_IS_INCORRECT' => '邮件格式不正确. 请检查这封邮件的Id...',
+ 'MESSAGE_ADD_USER_OR_CONTACT' => '请新增其它位使用者或联系人...',
+ 'MESSAGE_MAIL_SENT_SUCCESSFULLY' => ' 邮件已顺利寄出!',
+
+// Added for web mail post 4.0.1 release
+ 'LBL_FETCH_WEBMAIL' => '取得网页邮件',
+//Added for 4.2 Release -- CustomView
+ 'LBL_ALL' => '全部',
+ 'MESSAGE_CONTACT_NOT_WANT_MAIL' => '这个联系人不想要收到电子邮件',
+ 'LBL_WEBMAILS_TITLE' => '网页邮件',
+ 'LBL_EMAILS_TITLE' => '电子邮件',
+ 'LBL_MAIL_CONNECT_ERROR_INFO' => '联机到邮件服务器时发生错误,检查我的账号=>邮件服务器列表=>邮件账号',
+ 'LBL_ALLMAILS' => '所有邮件',
+ 'LBL_TO_USERS' => '给使用者',
+ 'LBL_TO' => '收件人:',
+'LBL_IN_SUBJECT' => '主旨',
+ 'LBL_IN_SENDER' => '寄件人',
+ 'LBL_IN_SUBJECT_OR_SENDER' => '主旨或寄件人',
+ 'SELECT_EMAIL' => '选择邮件编号',
+ 'Sender' => '寄件人',
+ 'LBL_CONFIGURE_MAIL_SETTINGS' => '您的收件邮件服务器还没设定',
+ 'LBL_MAILSELECT_INFO' => '有下面相关邮件编号,请选择要寄送的邮件编号',
+ 'LBL_MAILSELECT_INFO1' => '下面的邮件编号与选择的项目有关',
+ 'LBL_MAILSELECT_INFO2' => '选择要寄送的邮件编号类型',
+ 'LBL_MULTIPLE' => '多选',
+ 'LBL_COMPOSE_EMAIL' => '发送邮件',
+ 'LBL_VTIGER_EMAIL_CLIENT'=>'vtiger Webmail 客户',
+
+//Added for 5.0.3
+'TITLE_VTIGERCRM_MAIL'=>'vtigerCRM 邮件',
+'TITLE_COMPOSE_MAIL'=>'组成邮件',
+
+'MESSAGE_MAIL_COULD_NOT_BE_SEND'=>'邮件不能寄发到被分配的用户.',
+'MESSAGE_PLEASE_CHECK_ASSIGNED_USER_EMAILID'=>'请检查被分配的用户电子邮件id...',
+'MESSAGE_PLEASE_CHECK_THE_FROM_MAILID'=>'请检查电子邮件id',
+'MESSAGE_MAIL_COULD_NOT_BE_SEND_TO_THIS_EMAILID'=>'邮件不能寄发到这电子邮件id',
+'PLEASE_CHECK_THIS_EMAILID'=>'请检查这邮件id...',
+'LBL_CC_EMAIL_ERROR'=>'您的CC邮件ID不是适当的',
+'LBL_BCC_EMAIL_ERROR'=>'您的BCC邮件ID不是适当的',
+'LBL_NO_RCPTS_EMAIL_ERROR'=>'没有指定移植对象',
+'LBL_CONF_MAILSERVER_ERROR'=>'请设置您外部的邮件服务器 ---> 外出的服务器链接',
+'LBL_VTIGER_EMAIL_CLIENT'=>'vtiger Webmail 客户',
+'LBL_MAILSELECT_INFO3'=>'您不能查看选择记录的邮件ID.',
+'LBL_NO_RECORDS' => '这个文件夹没有记录',
+//Added for script alerts
+'FEATURE_AVAILABLE_INFO' => '这个特点只支持Microsoft Internet Explorer 5.5+或更高!',
+'DOWNLOAD_CONFIRAMATION' => '您想要下载文件 ?',
+'LBL_PLEASE_ATTACH' => '请再尝试附上一个合法的文件',
+'LBL_KINDLY_UPLOAD' => '请配置 upload_tmp_dir variable in php.ini file.',
+'LBL_EXCEED_MAX' => '抱歉, 上传的文件超出最大值极限。请尝试一个小文件 ',
+'LBL_BYTES' => ' 字节',
+'LBL_CHECK_USER_MAILID' => '请检查当前用户的电邮ID是否正确',
+
+// Added/Updated for vtiger CRM 5.0.4
+'Activity Type'=>'任务类型',
+'LBL_MAILSELECT_INFO'=>'has the following Email IDs associated.Please Select the Email IDs to which,the mail should be sent',
+'LBL_NO_RECORDS' => 'No Records Found',
+'LBL_PRINT_EMAIL'=> 'Print',
);
?>
diff --git a/oss/vtiger/trunk/modules/Faq/CallRelatedList.php b/oss/vtiger/trunk/modules/Faq/CallRelatedList.php
new file mode 100644
index 00000000..db811c92
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Faq/CallRelatedList.php
@@ -0,0 +1,86 @@
+retrieve_entity_info($RECORD,$currentmodule);
+ $focus->id = $RECORD;
+ $focus->name=$focus->column_fields['question'];
+ $log->debug("id is ".$focus->id);
+ $log->debug("name is ".$focus->name);
+ }
+
+ global $mod_strings;
+ global $app_strings;
+ global $currentModule;
+ global $theme;
+ $theme_path="themes/".$theme."/";
+ $image_path=$theme_path."images/";
+
+ $smarty = new vtigerCRM_Smarty;
+
+ if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
+ $focus->id = "";
+ }
+ if(isset($_REQUEST['mode']) && $_REQUEST['mode'] != ' ') {
+ $smarty->assign("OP_MODE",vtlib_purify($_REQUEST['mode']));
+ }
+ if (isset($focus->name)) $smarty->assign("NAME", $focus->name);
+ $related_array=getRelatedLists($currentModule,$focus);
+ require_once('include/ListView/RelatedListViewSession.php');
+ if(!empty($_REQUEST['selected_header']) && !empty($_REQUEST['relation_id'])) {
+ $relationId = vtlib_purify($_REQUEST['relation_id']);
+ RelatedListViewSession::addRelatedModuleToSession($relationId,
+ vtlib_purify($_REQUEST['selected_header']));
+ }
+ $open_related_modules = RelatedListViewSession::getRelatedModulesFromSession();
+ $smarty->assign("SELECTEDHEADERS", $open_related_modules);
+
+ $smarty->assign("RELATEDLISTS", $related_array);
+ $smarty->assign("CATEGORY",$category);
+
+ // Module Sequence Numbering
+ $mod_seq_field = getModuleSequenceField($currentModule);
+ if ($mod_seq_field != null) {
+ $mod_seq_id = $focus->column_fields[$mod_seq_field['name']];
+ } else {
+ $mod_seq_id = $focus->id;
+ }
+ $smarty->assign('MOD_SEQ_ID', $mod_seq_id);
+ // END
+
+ $smarty->assign("ID",$focus->id);
+ $smarty->assign("MODULE",$currentmodule);
+ $smarty->assign("SINGLE_MOD",$app_strings['Faq']);
+ $smarty->assign("UPDATEINFO",updateInfo($focus->id));
+ $smarty->assign("MOD",$mod_strings);
+ $smarty->assign("APP",$app_strings);
+ $smarty->assign("THEME", $theme);
+ $smarty->assign("IMAGE_PATH", $image_path);
+ $smarty->assign("TODO_PERMISSION",CheckFieldPermission('parent_id','Calendar'));
+ $smarty->assign("EVENT_PERMISSION",CheckFieldPermission('parent_id','Events'));
+ $check_button = Button_Check($module);
+ $smarty->assign("CHECK", $check_button);
+
+ $smarty->display("RelatedLists.tpl");
+}
+?>
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/Faq/CustomView.php b/oss/vtiger/trunk/modules/Faq/CustomView.php
new file mode 100644
index 00000000..93231ed6
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Faq/CustomView.php
@@ -0,0 +1,14 @@
+
diff --git a/oss/vtiger/trunk/modules/Faq/Delete.php b/oss/vtiger/trunk/modules/Faq/Delete.php
new file mode 100644
index 00000000..cc085145
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Faq/Delete.php
@@ -0,0 +1,38 @@
+
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/Faq/DetailView.php b/oss/vtiger/trunk/modules/Faq/DetailView.php
new file mode 100644
index 00000000..b6f422a0
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Faq/DetailView.php
@@ -0,0 +1,130 @@
+retrieve_entity_info($_REQUEST['record'],"Faq");
+ $focus->id = $_REQUEST['record'];
+}
+
+if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true')
+{
+ $focus->id = "";
+}
+
+global $theme;
+$theme_path="themes/".$theme."/";
+$image_path=$theme_path."images/";
+
+$log->info("Faq detail view");
+$smarty = new vtigerCRM_Smarty;
+$smarty->assign("MOD", $mod_strings);
+$smarty->assign("APP", $app_strings);
+$smarty->assign("UPDATEINFO",updateInfo($focus->id));
+
+if(isset($focus->column_fields[question]))
+ $smarty->assign("NAME", $focus->column_fields[question]);
+
+$category = getParenttab();
+$smarty->assign("CATEGORY",$category);
+
+$smarty->assign("THEME", $theme);
+$smarty->assign("IMAGE_PATH", $image_path);
+$smarty->assign("PRINT_URL", "phprint.php?jt=".session_id().$GLOBALS['request_string']);
+$smarty->assign("BLOCKS", getBlocks($currentModule,"detail_view",'',$focus->column_fields));
+$smarty->assign("SINGLE_MOD",$currentModule);
+$smarty->assign("MODULE",$currentModule);
+
+// Module Sequence Numbering
+$mod_seq_field = getModuleSequenceField($currentModule);
+if ($mod_seq_field != null) {
+ $mod_seq_id = $focus->column_fields[$mod_seq_field['name']];
+} else {
+ $mod_seq_id = $focus->id;
+}
+$smarty->assign('MOD_SEQ_ID', $mod_seq_id);
+// END
+
+$smarty->assign("ID", vtlib_purify($_REQUEST['record']));
+if(isPermitted("Faq","EditView",$_REQUEST['record']) == 'yes')
+ $smarty->assign("EDIT_DUPLICATE","permitted");
+
+if(isPermitted("Faq","Delete",$_REQUEST['record']) == 'yes')
+ $smarty->assign("DELETE","permitted");
+
+$check_button = Button_Check($module);
+$smarty->assign("CHECK", $check_button);
+$smarty->assign("IS_REL_LIST",isPresentRelatedLists($currentModule));
+
+$tabid = getTabid("Faq");
+$validationData = getDBValidationData($focus->tab_name,$tabid);
+$data = split_validationdataArray($validationData);
+
+$smarty->assign("VALIDATION_DATA_FIELDNAME",$data['fieldname']);
+$smarty->assign("VALIDATION_DATA_FIELDDATATYPE",$data['datatype']);
+$smarty->assign("VALIDATION_DATA_FIELDLABEL",$data['fieldlabel']);
+
+//Added to display the Faq comments information
+$smarty->assign("COMMENT_BLOCK",$focus->getFAQComments($_REQUEST['record']));
+$smarty->assign("EDIT_PERMISSION",isPermitted($currentModule,'EditView',$_REQUEST['record']));
+
+if(PerformancePrefs::getBoolean('DETAILVIEW_RECORD_NAVIGATION', true) && isset($_SESSION[$currentModule.'_listquery'])){
+ $recordNavigationInfo = ListViewSession::getListViewNavigation($focus->id);
+ VT_detailViewNavigation($smarty,$recordNavigationInfo,$focus->id);
+}
+if($singlepane_view == 'true') {
+ $related_array = getRelatedLists($currentModule,$focus);
+ $smarty->assign("RELATEDLISTS", $related_array);
+ require_once('include/ListView/RelatedListViewSession.php');
+ if(!empty($_REQUEST['selected_header']) && !empty($_REQUEST['relation_id'])) {
+ RelatedListViewSession::addRelatedModuleToSession(vtlib_purify($_REQUEST['relation_id']),
+ vtlib_purify($_REQUEST['selected_header']));
+ }
+ $open_related_modules = RelatedListViewSession::getRelatedModulesFromSession();
+ $smarty->assign("SELECTEDHEADERS", $open_related_modules);
+}
+
+$smarty->assign("SinglePane_View", $singlepane_view);
+
+// Record Change Notification
+$focus->markAsViewed($current_user->id);
+// END
+
+// Gather the custom link information to display
+include_once('vtlib/Vtiger/Link.php');
+$customlink_params = Array('MODULE'=>$currentModule, 'RECORD'=>$focus->id, 'ACTION'=>vtlib_purify($_REQUEST['action']));
+$smarty->assign('CUSTOM_LINKS', Vtiger_Link::getAllByType(getTabid($currentModule), Array('DETAILVIEWBASIC','DETAILVIEW','DETAILVIEWWIDGET'), $customlink_params));
+// END
+
+$smarty->assign('DETAILVIEW_AJAX_EDIT', PerformancePrefs::getBoolean('DETAILVIEW_AJAX_EDIT', true));
+$smarty->display("DetailView.tpl");
+?>
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/Faq/DetailViewAjax.php b/oss/vtiger/trunk/modules/Faq/DetailViewAjax.php
new file mode 100644
index 00000000..d81af138
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Faq/DetailViewAjax.php
@@ -0,0 +1,58 @@
+retrieve_entity_info($crmid,"Faq");
+
+ //Added to avoid the comment save, when we edit other fields through ajax edit
+ if($fieldname != 'comments')
+ $modObj->column_fields['comments'] = '';
+
+ $modObj->column_fields[$fieldname] = $fieldvalue;
+ $modObj->id = $crmid;
+ $modObj->mode = "edit";
+ $modObj->save("Faq");
+ if($modObj->id != "")
+ {
+ if($fieldname == "comments")
+ {
+ $comments = $modObj->getFAQComments($modObj->id);
+ echo ":#:SUCCESS".$comments;
+ }
+ else
+ echo ":#:SUCCESS";
+ }else
+ {
+ echo ":#:FAILURE";
+ }
+ }else
+ {
+ echo ":#:FAILURE";
+ }
+}elseif($ajaxaction == "LOADRELATEDLIST" || $ajaxaction == "DISABLEMODULE"){
+ require_once 'include/ListView/RelatedListViewContents.php';
+}
+?>
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/Faq/EditView.php b/oss/vtiger/trunk/modules/Faq/EditView.php
new file mode 100644
index 00000000..5fbd2e6c
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Faq/EditView.php
@@ -0,0 +1,141 @@
+assign("SEARCH", $searchurl);
+//4600 ends
+
+if(isset($_REQUEST['record']))
+{
+ $focus->id = $_REQUEST['record'];
+ $focus->mode = 'edit';
+ $focus->retrieve_entity_info($_REQUEST['record'],"Faq");
+}
+if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true')
+{
+ $focus->id = "";
+ $focus->mode = '';
+}
+if(empty($_REQUEST['record']) && $focus->mode != 'edit'){
+ setObjectValuesFromRequest($focus);
+}
+
+global $theme;
+$theme_path="themes/".$theme."/";
+$image_path=$theme_path."images/";
+
+$disp_view = getView($focus->mode);
+if($disp_view == 'edit_view')
+ $smarty->assign("BLOCKS",getBlocks($currentModule,$disp_view,$mode,$focus->column_fields));
+else
+{
+ $smarty->assign("BASBLOCKS",getBlocks($currentModule,$disp_view,$mode,$focus->column_fields,'BAS'));
+}
+
+$smarty->assign("OP_MODE",$disp_view);
+
+$smarty->assign("MODULE",$currentModule);
+$smarty->assign("SINGLE_MOD",$currentModule);
+$smarty->assign("MOD", $mod_strings);
+$smarty->assign("APP", $app_strings);
+
+$smarty->assign("ID", $focus->id);
+if(isset($focus->column_fields[question]))
+ $smarty->assign("NAME", $focus->column_fields[question]);
+
+$category = getParentTab();
+$smarty->assign("CATEGORY",$category);
+
+if($focus->mode == 'edit')
+{
+ $smarty->assign("UPDATEINFO",updateInfo($focus->id));
+ $smarty->assign("MODE", $focus->mode);
+}
+
+if(isset($_REQUEST['return_module'])) $smarty->assign("RETURN_MODULE", vtlib_purify($_REQUEST['return_module']));
+else $smarty->assign("RETURN_MODULE","Faq");
+if(isset($_REQUEST['return_action'])) $smarty->assign("RETURN_ACTION", vtlib_purify($_REQUEST['return_action']));
+else $smarty->assign("RETURN_ACTION","index");
+if(isset($_REQUEST['return_id'])) $smarty->assign("RETURN_ID", vtlib_purify($_REQUEST['return_id']));
+
+$smarty->assign("THEME", $theme);
+$smarty->assign("IMAGE_PATH", $image_path);
+$smarty->assign("PRINT_URL", "phprint.php?jt=".session_id().$GLOBALS['request_string']);
+
+$smarty->assign("CALENDAR_LANG", $app_strings['LBL_JSCALENDAR_LANG']);
+$smarty->assign("CALENDAR_DATEFORMAT", parse_calendardate($app_strings['NTC_DATE_FORMAT']));
+
+
+$tabid = getTabid("Faq");
+$validationData = getDBValidationData($focus->tab_name,$tabid);
+$data = split_validationdataArray($validationData);
+
+ $smarty->assign("VALIDATION_DATA_FIELDNAME",$data['fieldname']);
+ $smarty->assign("VALIDATION_DATA_FIELDDATATYPE",$data['datatype']);
+ $smarty->assign("VALIDATION_DATA_FIELDLABEL",$data['fieldlabel']);
+
+$check_button = Button_Check($module);
+$smarty->assign("CHECK", $check_button);
+
+if($_REQUEST['record'] != '')
+{
+ //Added to display the Faq comments information
+ $smarty->assign("COMMENT_BLOCK",$focus->getFAQComments($_REQUEST['record']));
+}
+$smarty->assign("DUPLICATE",vtlib_purify($_REQUEST['isDuplicate']));
+
+global $adb;
+// Module Sequence Numbering
+$mod_seq_field = getModuleSequenceField($currentModule);
+if($focus->mode != 'edit' && $mod_seq_field != null) {
+ $autostr = getTranslatedString('MSG_AUTO_GEN_ON_SAVE');
+ $mod_seq_string = $adb->pquery("SELECT prefix, cur_id from vtiger_modentity_num where semodule = ? and active=1",array($currentModule));
+ $mod_seq_prefix = $adb->query_result($mod_seq_string,0,'prefix');
+ $mod_seq_no = $adb->query_result($mod_seq_string,0,'cur_id');
+ if($adb->num_rows($mod_seq_string) == 0 || $focus->checkModuleSeqNumber($focus->table_name, $mod_seq_field['column'], $mod_seq_prefix.$mod_seq_no))
+ echo '
'. getTranslatedString('LBL_DUPLICATE'). ' '. getTranslatedString($mod_seq_field['label'])
+ .' - '. getTranslatedString('LBL_CLICK') .' '.getTranslatedString('LBL_HERE').' '
+ . getTranslatedString('LBL_TO_CONFIGURE'). ' '. getTranslatedString($mod_seq_field['label']) .'';
+ else
+ $smarty->assign("MOD_SEQ_ID",$autostr);
+} else {
+ $smarty->assign("MOD_SEQ_ID", $focus->column_fields[$mod_seq_field['name']]);
+}
+// END
+
+if($focus->mode == 'edit')
+ $smarty->display("salesEditView.tpl");
+else
+ $smarty->display("CreateView.tpl");
+?>
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/Faq/Faq.js b/oss/vtiger/trunk/modules/Faq/Faq.js
new file mode 100644
index 00000000..7fa41f4a
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Faq/Faq.js
@@ -0,0 +1,21 @@
+/*********************************************************************************
+** 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 clear_form(form)
+{
+ for (j = 0; j < form.elements.length; j++)
+ {
+ if (form.elements[j].type == 'text' || form.elements[j].type == 'select-one')
+ {
+ form.elements[j].value = '';
+ }
+ }
+}
+
diff --git a/oss/vtiger/trunk/modules/Faq/Faq.php b/oss/vtiger/trunk/modules/Faq/Faq.php
new file mode 100644
index 00000000..936eba25
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Faq/Faq.php
@@ -0,0 +1,200 @@
+'crmid','vtiger_faq'=>'id','vtiger_faqcomments'=>'faqid');
+
+ var $entity_table = "vtiger_crmentity";
+
+ var $column_fields = Array();
+
+ var $sortby_fields = Array('question','category','id');
+
+ // This is the list of vtiger_fields that are in the lists.
+ var $list_fields = Array(
+ 'FAQ Id'=>Array('faq'=>'id'),
+ 'Question'=>Array('faq'=>'question'),
+ 'Category'=>Array('faq'=>'category'),
+ 'Product Name'=>Array('faq'=>'product_id'),
+ 'Created Time'=>Array('crmentity'=>'createdtime'),
+ 'Modified Time'=>Array('crmentity'=>'modifiedtime')
+ );
+
+ var $list_fields_name = Array(
+ 'FAQ Id'=>'',
+ 'Question'=>'question',
+ 'Category'=>'faqcategories',
+ 'Product Name'=>'product_id',
+ 'Created Time'=>'createdtime',
+ 'Modified Time'=>'modifiedtime'
+ );
+ var $list_link_field= 'question';
+
+ var $search_fields = Array(
+ 'Account Name'=>Array('account'=>'accountname'),
+ 'City'=>Array('accountbillads'=>'bill_city'),
+ );
+
+ var $search_fields_name = Array(
+ 'Account Name'=>'accountname',
+ 'City'=>'bill_city',
+ );
+
+ //Added these variables which are used as default order by and sortorder in ListView
+ var $default_order_by = 'id';
+ var $default_sort_order = 'DESC';
+
+ var $mandatory_fields = Array('question','faq_answer','createdtime' ,'modifiedtime');
+
+ /** Constructor which will set the column_fields in this object
+ */
+ function Faq() {
+ $this->log =LoggerManager::getLogger('faq');
+ $this->log->debug("Entering Faq() method ...");
+ $this->db = PearDatabase::getInstance();
+ $this->column_fields = getColumnFields('Faq');
+ $this->log->debug("Exiting Faq method ...");
+ }
+
+ function save_module($module)
+ {
+ //Inserting into Faq comment table
+ $this->insertIntoFAQCommentTable('vtiger_faqcomments', $module);
+
+ }
+
+
+ /** Function to insert values in vtiger_faqcomments table for the specified module,
+ * @param $table_name -- table name:: Type varchar
+ * @param $module -- module:: Type varchar
+ */
+ function insertIntoFAQCommentTable($table_name, $module)
+ {
+ global $log;
+ $log->info("in insertIntoFAQCommentTable ".$table_name." module is ".$module);
+ global $adb;
+
+ $current_time = $adb->formatDate(date('Y-m-d H:i:s'), true);
+
+ if($this->column_fields['comments'] != '')
+ $comment = $this->column_fields['comments'];
+ else
+ $comment = $_REQUEST['comments'];
+
+ if($comment != '')
+ {
+ $params = array('', $this->id, from_html($comment), $current_time);
+ $sql = "insert into vtiger_faqcomments values(?, ?, ?, ?)";
+ $adb->pquery($sql, $params);
+ }
+ }
+
+
+ /** Function to get the list of comments for the given FAQ id
+ * @param int $faqid - FAQ id
+ * @return list $list - return the list of comments and comment informations as a html output where as these comments and comments informations will be formed in div tag.
+ **/
+ function getFAQComments($faqid)
+ {
+ global $log, $default_charset;
+ $log->debug("Entering getFAQComments(".$faqid.") method ...");
+ global $mod_strings;
+ $sql = "select * from vtiger_faqcomments where faqid=?";
+ $result = $this->db->pquery($sql, array($faqid));
+ $noofrows = $this->db->num_rows($result);
+
+ //In ajax save we should not add this div
+ if($_REQUEST['action'] != 'FaqAjax')
+ {
+ $list .= '
';
+ }
+
+ for($i=0;$i<$noofrows;$i++)
+ {
+ $comment = $this->db->query_result($result,$i,'comments');
+ $createdtime = $this->db->query_result($result,$i,'createdtime');
+ if($comment != '')
+ {
+ //this div is to display the comment
+ if($_REQUEST['action'] == 'FaqAjax') {
+ $comment = htmlentities($comment, ENT_QUOTES, $default_charset);
+ }
+ $list .= ''.make_clickable(nl2br($comment)).'
';
+
+ //this div is to display the created time
+ $list .= ''.$mod_strings['Created Time'];
+ $list .= ' : '.$createdtime.'
';
+ }
+ }
+
+ $list .= $enddiv;
+
+ $log->debug("Exiting getFAQComments method ...");
+ return $list;
+ }
+
+ /*
+ * Function to get the primary query part of a report
+ * @param - $module Primary module name
+ * returns the query string formed on fetching the related data for report for primary module
+ */
+ function generateReportsQuery($module){
+ $moduletable = $this->table_name;
+ $moduleindex = $this->table_index;
+
+ $query = "from $moduletable
+ inner join vtiger_crmentity on vtiger_crmentity.crmid=$moduletable.$moduleindex
+ left join vtiger_products as vtiger_products$module on vtiger_products$module.productid = vtiger_faq.product_id
+ left join vtiger_groups as vtiger_groups$module on vtiger_groups$module.groupid = vtiger_crmentity.smownerid
+ left join vtiger_users as vtiger_users$module on vtiger_users$module.id = vtiger_crmentity.smownerid
+ left join vtiger_groups on vtiger_groups.groupid = vtiger_crmentity.smownerid
+ left join vtiger_users on vtiger_users.id = vtiger_crmentity.smownerid";
+ return $query;
+ }
+
+ /*
+ * Function to get the relation tables for related modules
+ * @param - $secmodule secondary module name
+ * returns the array with table names and fieldnames storing relations between module and this module
+ */
+ function setRelationTables($secmodule){
+ $rel_tables = array (
+ "Documents" => array("vtiger_senotesrel"=>array("crmid","notesid"),"vtiger_faq"=>"id"),
+ );
+ return $rel_tables[$secmodule];
+ }
+}
+?>
diff --git a/oss/vtiger/trunk/modules/Faq/FaqAjax.php b/oss/vtiger/trunk/modules/Faq/FaqAjax.php
new file mode 100644
index 00000000..ce66087f
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Faq/FaqAjax.php
@@ -0,0 +1,13 @@
+
diff --git a/oss/vtiger/trunk/modules/Faq/ListFaq.php b/oss/vtiger/trunk/modules/Faq/ListFaq.php
new file mode 100644
index 00000000..0621eac5
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Faq/ListFaq.php
@@ -0,0 +1,165 @@
+$title,'Header'=>$listview_header,'Entries'=>$listview_entries) where as listview_header and listview_entries are arrays of header and entity values which are returned from function getListViewHeader and getListViewEntries
+ */
+function getMyFaq($maxval,$calCnt)
+{
+ require_once("data/Tracker.php");
+ require_once('modules/Faq/Faq.php');
+ require_once('include/logging.php');
+ require_once('include/ListView/ListView.php');
+ require_once('include/utils/utils.php');
+ require_once('modules/CustomView/CustomView.php');
+
+ global $current_language,$current_user,$list_max_entries_per_page,$theme,$adb;
+ $current_module_strings = return_module_language($current_language, 'Faq');
+
+ $log = LoggerManager::getLogger('faq_list');
+
+ $url_string = '';
+ $sorder = '';
+ $oCustomView = new CustomView("Faq");
+ $customviewcombo_html = $oCustomView->getCustomViewCombo();
+ if(isset($_REQUEST['viewname']) == false || $_REQUEST['viewname']=='')
+ {
+ if($oCustomView->setdefaultviewid != "")
+ {
+ $viewid = $oCustomView->setdefaultviewid;
+ }else
+ {
+ $viewid = "0";
+ }
+ }
+ $focus = new Faq();
+
+ $theme_path="themes/".$theme."/";
+ $image_path=$theme_path."images/";
+
+ //Retreive the list from Database
+ //<<<<<<<<>>>>>>>>
+ $currentModule = 'Faq';
+ $viewId = getCvIdOfAll($currentModule);
+ $queryGenerator = new QueryGenerator($currentModule, $current_user);
+ $queryGenerator->initForCustomViewById($viewId);
+ $meta = $queryGenerator->getMeta($currentModule);
+ $accessibleFieldNameList = array_keys($meta->getModuleFields());
+ $customViewFields = $queryGenerator->getCustomViewFields();
+ $fields = $queryGenerator->getFields();
+ $newFields = array_diff($fields, $customViewFields);
+ $widgetFieldsList = array('question','product_id');
+ $widgetFieldsList = array_intersect($accessibleFieldNameList, $widgetFieldsList);
+ $widgetSelectedFields = array_chunk(array_intersect($customViewFields, $widgetFieldsList), 2);
+ //select the first chunk of two fields
+ $widgetSelectedFields = $widgetSelectedFields[0];
+ if(count($widgetSelectedFields) < 2) {
+ $widgetSelectedFields = array_chunk(array_merge($widgetSelectedFields, $accessibleFieldNameList), 2);
+ //select the first chunk of two fields
+ $widgetSelectedFields = $widgetSelectedFields[0];
+ }
+ $newFields = array_merge($newFields, $widgetSelectedFields);
+ $queryGenerator->setFields($newFields);
+ $_REQUEST = getMyFaqSearch($_REQUEST);
+ $queryGenerator->addUserSearchConditions($_REQUEST);
+ $search_qry = '&query=true'.getSearchURL($_REQUEST);
+ $query = $queryGenerator->getQuery();
+
+ //<<<<<<<>>>>>>>>
+
+ $query .= " LIMIT 0," . $adb->sql_escape_string($maxval);
+
+ if($calCnt == 'calculateCnt') {
+ $list_result_rows = $adb->query(mkCountQuery($query));
+ return $adb->query_result($list_result_rows, 0, 'count');
+ }
+
+ $list_result = $adb->query($query);
+
+ //Retreiving the no of rows
+ $noofrows = $adb->num_rows($list_result);
+
+ //Retreiving the start value from request
+ if(isset($_REQUEST['start']) && $_REQUEST['start'] != '')
+ {
+ $start = vtlib_purify($_REQUEST['start']);
+ }
+ else
+ {
+
+ $start = 1;
+ }
+
+ //Retreive the Navigation array
+ $navigation_array = getNavigationValues($start, $noofrows, $list_max_entries_per_page);
+
+ if ($navigation_array['start'] == 1)
+ {
+ if($noofrows != 0)
+ $start_rec = $navigation_array['start'];
+ else
+ $start_rec = 0;
+ if($noofrows > $list_max_entries_per_page)
+ {
+ $end_rec = $navigation_array['start'] + $list_max_entries_per_page - 1;
+ }
+ else
+ {
+ $end_rec = $noofrows;
+ }
+
+ }
+ else
+ {
+ if($navigation_array['next'] > $list_max_entries_per_page)
+ {
+ $start_rec = $navigation_array['next'] - $list_max_entries_per_page;
+ $end_rec = $navigation_array['next'] - 1;
+ }
+ else
+ {
+ $start_rec = $navigation_array['prev'] + $list_max_entries_per_page;
+ $end_rec = $noofrows;
+ }
+ }
+
+
+ //Retreive the List View Table Header
+ $title=array('myFaqs.gif',$current_module_strings['LBL_MY_FAQ'],'home_myfaq');
+ $controller = new ListViewController($adb, $current_user, $queryGenerator);
+ $controller->setHeaderSorting(false);
+ $header = $controller->getListViewHeader($focus,$currentModule,$url_string,$sorder,
+ $order_by, true);
+
+ $entries = $controller->getListViewEntries($focus,$currentModule,$list_result,
+ $navigation_array, true);
+
+ $values=Array('ModuleName'=>'Faq','Title'=>$title,'Header'=>$header,'Entries'=>$entries,'search_qry'=>$search_qry);
+ if ( ($display_empty_home_blocks && $noofrows == 0 ) || ($noofrows>0) )
+ return $values;
+}
+
+function getMyFaqSearch($output) {
+ $output['&query'] = 'true';
+ $output['&Fields0'] = 'faqstatus';
+ $output['&Condition0'] = 'n';
+ $output['&Srch_value0'] = 'Obsolete';
+ $output['&searchtype'] = 'advance';
+ $output['&search_cnt'] = '1';
+ $output['matchtype'] = 'any';
+ return $output;
+}
+
+?>
diff --git a/oss/vtiger/trunk/modules/Faq/ListView.php b/oss/vtiger/trunk/modules/Faq/ListView.php
new file mode 100644
index 00000000..d8d4bc7d
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Faq/ListView.php
@@ -0,0 +1,267 @@
+initSortbyField('Faq');
+// END
+$smarty = new vtigerCRM_Smarty;
+
+$other_text = Array();
+
+if(!$_SESSION['lvs'][$currentModule])
+{
+ unset($_SESSION['lvs']);
+ $modObj = new ListViewSession();
+ $modObj->sorder = $sorder;
+ $modObj->sortby = $order_by;
+ $_SESSION['lvs'][$currentModule] = get_object_vars($modObj);
+}
+
+if($_REQUEST['errormsg'] != '')
+{
+ $errormsg = vtlib_purify($_REQUEST['errormsg']);
+ $smarty->assign("ERROR","The User does not have permission to delete ".$errormsg." ".$currentModule);
+}else
+{
+ $smarty->assign("ERROR","");
+}
+$url_string = '';
+//<<<>>>>>>
+$oCustomView = new CustomView("Faq");
+$viewid = $oCustomView->getViewId($currentModule);
+$customviewcombo_html = $oCustomView->getCustomViewCombo($viewid);
+$viewnamedesc = $oCustomView->getCustomViewByCvid($viewid);
+
+//Added to handle approving or denying status-public by the admin in CustomView
+$statusdetails = $oCustomView->isPermittedChangeStatus($viewnamedesc['status']);
+$smarty->assign("CUSTOMVIEW_PERMISSION",$statusdetails);
+
+//To check if a user is able to edit/delete a customview
+$edit_permit = $oCustomView->isPermittedCustomView($viewid,'EditView',$currentModule);
+$delete_permit = $oCustomView->isPermittedCustomView($viewid,'Delete',$currentModule);
+$smarty->assign("CV_EDIT_PERMIT",$edit_permit);
+$smarty->assign("CV_DELETE_PERMIT",$delete_permit);
+
+//<<<<>>>>
+
+//<<<<<<<<<<<<<<<<<<< sorting - stored in session >>>>>>>>>>>>>>>>>>>>
+if($_REQUEST['order_by'] != '')
+ $order_by = $adb->sql_escape_string($_REQUEST['order_by']);
+else
+ $order_by = (($_SESSION['FAQ_ORDER_BY'] != '')?($_SESSION['FAQ_ORDER_BY']):($focus->default_order_by));
+
+if($_REQUEST['sorder'] != '')
+ $sorder = $adb->sql_escape_string($_REQUEST['sorder']);
+else
+ $sorder = (($_SESSION['FAQ_SORT_ORDER'] != '')?($_SESSION['FAQ_SORT_ORDER']):($focus->default_sort_order));
+
+$_SESSION['FAQ_ORDER_BY'] = $order_by;
+$_SESSION['FAQ_SORT_ORDER'] = $sorder;
+//<<<<<<<<<<<<<<<<<<< sorting - stored in session >>>>>>>>>>>>>>>>>>>>
+
+if($viewid != 0)
+{
+ $CActionDtls = $oCustomView->getCustomActionDetails($viewid);
+}
+elseif($viewid ==0)
+{
+ echo "";
+ exit;
+}
+
+if(isPermitted('Faq','Delete','') == 'yes')
+$other_text ['del'] = $app_strings[LBL_MASS_DELETE];
+
+
+//Retreive the list from Database
+//Retreive the list from Database
+//<<<<<<<<>>>>>>>>
+global $current_user;
+$queryGenerator = new QueryGenerator($currentModule, $current_user);
+if ($viewid != "0") {
+ $queryGenerator->initForCustomViewById($viewid);
+} else {
+ $queryGenerator->initForDefaultCustomView();
+}
+
+if(isset($_REQUEST['query']) && $_REQUEST['query'] == 'true')
+{
+ $queryGenerator->addUserSearchConditions($_REQUEST);
+ $ustring = getSearchURL($_REQUEST);
+ // we have a query
+ $url_string .="&query=true".$ustring;
+ $smarty->assign("SEARCH_URL",$url_string);
+}
+$list_query = $queryGenerator->getQuery();
+
+$view_script = "";
+if(isset($order_by) && $order_by != '')
+{
+ $tablename = getTableNameForField('Faq',$order_by);
+ $tablename = (($tablename != '')?($tablename."."):'');
+ if( $adb->dbType == "pgsql")
+ $list_query .= ' GROUP BY '.$tablename.$order_by;
+
+ $list_query .= ' ORDER BY '.$tablename.$order_by.' '.$sorder;
+}
+//Constructing the list view
+
+$smarty->assign("MOD", $mod_strings);
+$smarty->assign("APP", $app_strings);
+$smarty->assign("THEME", $theme);
+$smarty->assign("IMAGE_PATH",$image_path);
+$smarty->assign("MODULE",$currentModule);
+$smarty->assign("BUTTONS",$other_text);
+$smarty->assign("CATEGORY",$category);
+$smarty->assign("SINGLE_MOD",'Document');
+
+if($viewnamedesc['viewname'] == 'All')
+{
+ $smarty->assign("ALL", 'All');
+}
+
+//Postgres 8 fixes
+if( $adb->dbType == "pgsql")
+ $list_query = fixPostgresQuery( $list_query, $log, 0);
+
+if(PerformancePrefs::getBoolean('LISTVIEW_COMPUTE_PAGE_COUNT', false) === true){
+ $count_result = $adb->query( mkCountQuery( $list_query));
+ $noofrows = $adb->query_result($count_result,0,"count");
+}else{
+ $noofrows = null;
+}
+
+$queryMode = (isset($_REQUEST['query']) && $_REQUEST['query'] == 'true');
+$start = ListViewSession::getRequestCurrentPage($currentModule, $list_query, $viewid, $queryMode);
+
+$navigation_array = VT_getSimpleNavigationValues($start,$list_max_entries_per_page,$noofrows);
+
+$limit_start_rec = ($start-1) * $list_max_entries_per_page;
+
+if( $adb->dbType == "pgsql")
+ $list_result = $adb->pquery($list_query. " OFFSET $limit_start_rec LIMIT $list_max_entries_per_page", array());
+else
+ $list_result = $adb->pquery($list_query. " LIMIT $limit_start_rec, $list_max_entries_per_page", array());
+
+$recordListRangeMsg = getRecordRangeMessage($list_result, $limit_start_rec,$noofrows);
+$smarty->assign('recordListRange',$recordListRangeMsg);
+
+if($viewid !='')
+$url_string .= "&viewname=".$viewid;
+
+//Retreive the List View Table Header
+$controller = new ListViewController($adb, $current_user, $queryGenerator);
+$listview_header = $controller->getListViewHeader($focus,$currentModule,$url_string,$sorder,
+ $order_by);
+$smarty->assign("LISTHEADER", $listview_header);
+
+$listview_header_search = $controller->getBasicSearchFieldInfoList();
+$smarty->assign("SEARCHLISTHEADER",$listview_header_search);
+
+$listview_entries = $controller->getListViewEntries($focus,$currentModule,$list_result,
+ $navigation_array);
+$smarty->assign("LISTHEADER", $listview_header);
+$smarty->assign("LISTENTITY", $listview_entries);
+$smarty->assign("SELECT_SCRIPT", $view_script);
+
+//Added to select Multiple records in multiple pages
+$smarty->assign("SELECTEDIDS", vtlib_purify($_REQUEST['selobjs']));
+$smarty->assign("ALLSELECTEDIDS", vtlib_purify($_REQUEST['allselobjs']));
+$smarty->assign("CURRENT_PAGE_BOXES", implode(array_keys($listview_entries),";"));
+
+$navigationOutput = getTableHeaderSimpleNavigation($navigation_array, $url_string,"Faq","index",$viewid);
+$alphabetical = AlphabeticalSearch($currentModule,'index','question','true','basic',"","","","",$viewid);
+$fieldnames = $controller->getAdvancedSearchOptionString();
+$criteria = getcriteria_options();
+$smarty->assign("CRITERIA", $criteria);
+$smarty->assign("FIELDNAMES", $fieldnames);
+$smarty->assign("ALPHABETICAL", $alphabetical);
+$smarty->assign("NAVIGATION", $navigationOutput);
+$smarty->assign("CUSTOMVIEW_OPTION",$customviewcombo_html);
+$smarty->assign("VIEWID", $viewid);
+$smarty->assign("SINGLE_MOD" ,'Faq');
+
+if(isPermitted('Faq','EditView','') == 'yes') {
+ $other_text['mass_edit'] = $app_strings[LBL_MASS_EDIT];
+}
+$smarty->assign("BUTTONS",$other_text);
+$check_button = Button_Check($module);
+$smarty->assign("CHECK", $check_button);
+
+ListViewSession::setSessionQuery($currentModule,$list_query,$viewid);
+
+// Gather the custom link information to display
+include_once('vtlib/Vtiger/Link.php');
+$customlink_params = Array('MODULE'=>$currentModule, 'ACTION'=>vtlib_purify($_REQUEST['action']), 'CATEGORY'=> $category);
+$smarty->assign('CUSTOM_LINKS', Vtiger_Link::getAllByType(getTabid($currentModule), Array('LISTVIEWBASIC','LISTVIEW'), $customlink_params));
+// END
+
+if(isset($_REQUEST['ajax']) && $_REQUEST['ajax'] != '')
+ $smarty->display("ListViewEntries.tpl");
+else
+ $smarty->display("ListView.tpl");
+?>
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/Faq/ListViewPagging.php b/oss/vtiger/trunk/modules/Faq/ListViewPagging.php
new file mode 100644
index 00000000..333f1768
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Faq/ListViewPagging.php
@@ -0,0 +1,11 @@
+
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/Faq/MassEdit.php b/oss/vtiger/trunk/modules/Faq/MassEdit.php
new file mode 100644
index 00000000..348dab37
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Faq/MassEdit.php
@@ -0,0 +1,45 @@
+mode = '';
+$mode = 'mass_edit';
+$disp_view = getView($focus->mode);
+
+$smarty = new vtigerCRM_Smarty;
+$smarty->assign("BLOCKS",getBlocks($currentModule,$disp_view,$mode,$focus->column_fields));
+$smarty->assign("IDS",$_REQUEST['idstring']);
+$smarty->assign("MASS_EDIT","1");
+$smarty->assign("MODULE",$currentModule);
+$smarty->assign("APP",$app_strings);
+$smarty->assign("CATEGORY",getParentTab());
+
+$theme_path="themes/".$theme."/";
+$image_path=$theme_path."images/";
+$smarty->assign("THEME", $theme);
+$smarty->assign("IMAGE_PATH", $image_path);
+
+// Field Validation Information
+$tabid = getTabid($currentModule);
+$validationData = getDBValidationData($focus->tab_name,$tabid);
+$validationArray = split_validationdataArray($validationData);
+
+$smarty->assign("VALIDATION_DATA_FIELDNAME",$validationArray['fieldname']);
+$smarty->assign("VALIDATION_DATA_FIELDDATATYPE",$validationArray['datatype']);
+$smarty->assign("VALIDATION_DATA_FIELDLABEL",$validationArray['fieldlabel']);
+
+$smarty->display('MassEditForm.tpl');
+
+?>
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/Faq/MassEditSave.php b/oss/vtiger/trunk/modules/Faq/MassEditSave.php
new file mode 100644
index 00000000..2c3d6e86
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Faq/MassEditSave.php
@@ -0,0 +1,71 @@
+retrieve_entity_info($recordid, $currentModule);
+ $focus->mode = 'edit';
+ $focus->id = $recordid;
+ foreach($focus->column_fields as $fieldname => $val)
+ {
+ if(isset($_REQUEST[$fieldname."_mass_edit_check"]))
+ {
+ if($fieldname == 'assigned_user_id'){
+ if($_REQUEST['assigntype'] == 'U') {
+ $value = $_REQUEST['assigned_user_id'];
+ } elseif($_REQUEST['assigntype'] == 'T') {
+ $value = $_REQUEST['assigned_group_id'];
+ }
+ } else {
+ if(is_array($_REQUEST[$fieldname]))
+ $value = $_REQUEST[$fieldname];
+ else
+ $value = trim($_REQUEST[$fieldname]);
+ }
+ $focus->column_fields[$fieldname] = $value;
+ }
+ else{
+ $focus->column_fields[$fieldname] = decode_html($focus->column_fields[$fieldname]);
+ }
+ }
+ // Avoiding comment update on ticket
+ $focus->column_fields['comments'] = '';
+ $_REQUEST['comments'] = '';
+ // END
+ $focus->save($currentModule);
+ }
+ }
+}
+
+$parenttab = getParentTab();
+header("Location: index.php?module=$return_module&action=$return_action&parenttab=$parenttab$rstart");
+?>
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/Faq/Save.php b/oss/vtiger/trunk/modules/Faq/Save.php
new file mode 100644
index 00000000..320f42f9
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Faq/Save.php
@@ -0,0 +1,54 @@
+column_fields['assigned_user_id'] = $_REQUEST['assigned_user_id'];
+} elseif($_REQUEST['assigntype'] == 'T') {
+ $focus->column_fields['assigned_user_id'] = $_REQUEST['assigned_group_id'];
+}
+$focus->save("Faq");
+$return_id = $focus->id;
+
+if(isset($_REQUEST['return_module']) && $_REQUEST['return_module'] != "") $return_module = vtlib_purify($_REQUEST['return_module']);
+else $return_module = "Faq";
+if(isset($_REQUEST['return_action']) && $_REQUEST['return_action'] != "") $return_action = vtlib_purify($_REQUEST['return_action']);
+else $return_action = "DetailView";
+if(isset($_REQUEST['return_id']) && $_REQUEST['return_id'] != "") $return_id = vtlib_purify($_REQUEST['return_id']);
+
+$local_log->debug("Saved record with id of ".$return_id);
+
+header("Location: index.php?action=$return_action&module=$return_module&record=$return_id&start=".vtlib_purify($_REQUEST['pagenumber']).$search);
+?>
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/Faq/Settings.php b/oss/vtiger/trunk/modules/Faq/Settings.php
new file mode 100644
index 00000000..48a80c0b
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Faq/Settings.php
@@ -0,0 +1,13 @@
+
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/Faq/TagCloud.php b/oss/vtiger/trunk/modules/Faq/TagCloud.php
new file mode 100644
index 00000000..859b11ff
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Faq/TagCloud.php
@@ -0,0 +1,12 @@
+
diff --git a/oss/vtiger/trunk/modules/Faq/UnifiedSearch.php b/oss/vtiger/trunk/modules/Faq/UnifiedSearch.php
new file mode 100644
index 00000000..9a37320c
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Faq/UnifiedSearch.php
@@ -0,0 +1,11 @@
+
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/Faq/index.php b/oss/vtiger/trunk/modules/Faq/index.php
new file mode 100644
index 00000000..6bb2260c
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Faq/index.php
@@ -0,0 +1,17 @@
+
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/Faq/language/en_us.lang.php b/oss/vtiger/trunk/modules/Faq/language/en_us.lang.php
new file mode 100644
index 00000000..31615a1d
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Faq/language/en_us.lang.php
@@ -0,0 +1,144 @@
+'FAQ',
+'LBL_MODULE_TITLE'=>'FAQ: Home',
+'LBL_SEARCH_FORM_TITLE'=>'FAQ Search',
+'LBL_LIST_FORM_TITLE'=>'FAQ List',
+'LBL_NEW_FORM_TITLE'=>'New Faq',
+'LBL_MEMBER_ORG_FORM_TITLE'=>'Member Organizations',
+
+'LBL_LIST_ACCOUNT_NAME'=>'Faq Name',
+'LBL_LIST_CITY'=>'City',
+'LBL_LIST_WEBSITE'=>'Website',
+'LBL_LIST_STATE'=>'State',
+'LBL_LIST_PHONE'=>'Phone',
+'LBL_LIST_EMAIL_ADDRESS'=>'Email Address',
+'LBL_LIST_CONTACT_NAME'=>'Contact Name',
+'LBL_FAQ_INFORMATION'=>'Faq Information',
+
+//DON'T CONVERT THESE THEY ARE MAPPINGS
+'db_name' => 'LBL_LIST_ACCOUNT_NAME',
+'db_website' => 'LBL_LIST_WEBSITE',
+'db_billing_address_city' => 'LBL_LIST_CITY',
+
+//END DON'T CONVERT
+
+'LBL_ACCOUNT'=>'Faq:',
+'LBL_ACCOUNT_NAME'=>'Faq Name:',
+'LBL_PHONE'=>'Phone:',
+'LBL_WEBSITE'=>'Website:',
+'LBL_FAX'=>'Fax:',
+'LBL_TICKER_SYMBOL'=>'Ticker Symbol:',
+'LBL_OTHER_PHONE'=>'Other Phone:',
+'LBL_ANY_PHONE'=>'Any Phone:',
+'LBL_MEMBER_OF'=>'Member of:',
+'LBL_EMAIL'=>'Email:',
+'LBL_EMPLOYEES'=>'Employees:',
+'LBL_OTHER_EMAIL_ADDRESS'=>'Other Email:',
+'LBL_ANY_EMAIL'=>'Any Email:',
+'LBL_OWNERSHIP'=>'Ownership:',
+'LBL_RATING'=>'Rating:',
+'LBL_INDUSTRY'=>'Industry:',
+'LBL_SIC_CODE'=>'SIC Code:',
+'LBL_TYPE'=>'Type:',
+'LBL_ANNUAL_REVENUE'=>'Annual Revenue:',
+'LBL_ADDRESS_INFORMATION'=>'Address Information',
+'LBL_ACCOUNT_INFORMATION'=>'Faq Information',
+'LBL_BILLING_ADDRESS'=>'Billing Address:',
+'LBL_SHIPPING_ADDRESS'=>'Shipping Address:',
+'LBL_ANY_ADDRESS'=>'Any Address:',
+'LBL_CITY'=>'City:',
+'LBL_STATE'=>'State:',
+'LBL_POSTAL_CODE'=>'Postal Code:',
+'LBL_COUNTRY'=>'Country:',
+'LBL_DESCRIPTION_INFORMATION'=>'Description Information',
+'LBL_DESCRIPTION'=>'Description:',
+'NTC_COPY_BILLING_ADDRESS'=>'Copy billing address to shipping address',
+'NTC_COPY_SHIPPING_ADDRESS'=>'Copy shipping address to billing address',
+'NTC_REMOVE_MEMBER_ORG_CONFIRMATION'=>'Are you sure you want to remove this record as a member organization?',
+'LBL_DUPLICATE'=>'Potential Duplicate Faq',
+'MSG_DUPLICATE' => 'Creating this vtiger_account may vtiger_potentialy create a duplicate vtiger_account. You may either select an vtiger_account from the list below or you may click on Create New Faq to continue creating a new vtiger_account with the previously entered data.',
+
+'LBL_INVITEE'=>'Contacts',
+'ERR_DELETE_RECORD'=>"A record number must be specified to delete the vtiger_account.",
+
+'LBL_SELECT_ACCOUNT'=>'Select Faq',
+'LBL_GENERAL_INFORMATION'=>'General Information',
+
+//for v4 release added
+'LBL_NEW_POTENTIAL'=>'New Potential',
+'LBL_POTENTIAL_TITLE'=>'Potentials',
+
+'LBL_NEW_TASK'=>'New Task',
+'LBL_TASK_TITLE'=>'Tasks',
+'LBL_NEW_CALL'=>'New Call',
+'LBL_CALL_TITLE'=>'Calls',
+'LBL_NEW_MEETING'=>'New Meeting',
+'LBL_MEETING_TITLE'=>'Meetings',
+'LBL_NEW_EMAIL'=>'New Email',
+'LBL_EMAIL_TITLE'=>'Emails',
+'LBL_NEW_CONTACT'=>'New Contact',
+'LBL_CONTACT_TITLE'=>'Contacts',
+
+//Added for 4GA Release
+'Category'=>'Category',
+'Related To'=>'Related To',
+'Question'=>'Question',
+'Answer'=>'Answer',
+'Comments'=>'Comments',
+'LBL_COMMENTS'=>'Comments',//give the same value given to the above string 'Comments'
+'Created Time'=>'Created Time',
+'Modified Time'=>'Modified Time',
+
+//Added vtiger_fields after 4.2 alpha
+'LBL_TICKETS'=>'Tickets',
+'LBL_FAQ'=>'FAQ',
+'Product Name'=>'Product Name',
+'FAQ Id'=>'FAQ Id',
+'Add Comment'=>'Add Comment',
+'LBL_ADD_COMMENT'=>'Add Comment',//give the same value given to the above string 'Add Comment'
+'LBL_COMMENT_INFORMATION'=>'Comment Information',
+'Status'=>'Status',
+
+//Added on 10-12-2005
+'LBL_QUESTION'=>'Question',
+'LBL_CATEGORY'=>'Category',
+'LBL_MY_FAQ'=>'My Recent FAQs',
+
+//Added for existing Picklist Entries
+
+'General'=>'General',
+
+'Draft'=>'Draft',
+'Reviewed'=>'Reviewed',
+'Published'=>'Published',
+'Obsolete'=>'Obsolete',
+
+// Module Sequence Numbering
+'Faq No' => 'Faq No',
+// END
+
+);
+
+?>
diff --git a/oss/vtiger/trunk/modules/Faq/language/zh_cn.lang.php b/oss/vtiger/trunk/modules/Faq/language/zh_cn.lang.php
new file mode 100644
index 00000000..35360345
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Faq/language/zh_cn.lang.php
@@ -0,0 +1,143 @@
+ '常见问答',
+'LBL_MODULE_TITLE' => '常见问答: 首页',
+'LBL_SEARCH_FORM_TITLE' => '搜寻问答',
+'LBL_LIST_FORM_TITLE' => '问答列表',
+'LBL_NEW_FORM_TITLE' => '新增问答',
+'LBL_MEMBER_ORG_FORM_TITLE' => '会员所属组织单位',
+
+'LBL_LIST_ACCOUNT_NAME' => '问答名称',
+'LBL_LIST_CITY' => '乡镇市区',
+'LBL_LIST_WEBSITE' => '网站',
+'LBL_LIST_STATE' => '县市',
+'LBL_LIST_PHONE' => '电话',
+'LBL_LIST_EMAIL_ADDRESS' => '电子邮件地址',
+'LBL_LIST_CONTACT_NAME' => '联系人名称',
+'LBL_FAQ_INFORMATION' => '常见问答信息',
+
+//DON'T CONVERT THESE THEY ARE MAPPINGS
+'db_name' => 'LBL_LIST_ACCOUNT_NAME',
+'db_website' => 'LBL_LIST_WEBSITE',
+'db_billing_address_city' => 'LBL_LIST_CITY',
+
+//END DON'T CONVERT
+
+'LBL_ACCOUNT' => '常见问答:',
+'LBL_ACCOUNT_NAME' => '问答名称:',
+'LBL_PHONE' => '电话:',
+'LBL_WEBSITE' => '网站:',
+'LBL_FAX' => '传真:',
+'LBL_TICKER_SYMBOL' => '传票符号:',
+'LBL_OTHER_PHONE' => '其它电话:',
+'LBL_ANY_PHONE' => '其它电话:',
+'LBL_MEMBER_OF' => '会员:',
+'LBL_EMAIL' => '电子邮件:',
+'LBL_EMPLOYEES' => '员工:',
+'LBL_OTHER_EMAIL_ADDRESS' => '其它电子邮件:',
+'LBL_ANY_EMAIL' => '其它电子邮件:',
+'LBL_OWNERSHIP' => '所有人:',
+'LBL_RATING' => '评价:',
+'LBL_INDUSTRY' => '企业:',
+'LBL_SIC_CODE' => '统一编号:',
+'LBL_TYPE' => '类型:',
+'LBL_ANNUAL_REVENUE' => '年营业额:',
+'LBL_ADDRESS_INFORMATION' => '地址信息',
+'LBL_ACCOUNT_INFORMATION' => '问答信息',
+'LBL_BILLING_ADDRESS' => '发票地址:',
+'LBL_SHIPPING_ADDRESS' => '送货地址:',
+'LBL_ANY_ADDRESS' => '其它地址:',
+'LBL_CITY' => '乡镇市区:',
+'LBL_STATE' => '县市:',
+'LBL_POSTAL_CODE' => '邮政编码:',
+'LBL_COUNTRY' => '国家:',
+'LBL_DESCRIPTION_INFORMATION' => '描述信息',
+'LBL_DESCRIPTION' => '描述:',
+'NTC_COPY_BILLING_ADDRESS' => '复制发票地址到送货地址',
+'NTC_COPY_SHIPPING_ADDRESS' => '复制送货地址至发票地址',
+'NTC_REMOVE_MEMBER_ORG_CONFIRMATION' => '您确定要移除关于这笔会员组织单位的记录?',
+'LBL_DUPLICATE' => '复制具有潜力的问答',
+'MSG_DUPLICATE' => '建立这个客户数据可能造成数据重复,您可以从下面选择一个客户的资料来更新或是点选建立新问答来透过刚刚输入的数据建立新项目。',
+
+'LBL_INVITEE' => '联系人',
+'ERR_DELETE_RECORD' => '在删除公司前必须输入正确的记录编号.',
+
+'LBL_SELECT_ACCOUNT' => '选择问答',
+'LBL_GENERAL_INFORMATION' => '一般信息',
+
+//for v4 release added
+'LBL_NEW_POTENTIAL' => '新增潜在案件',
+'LBL_POTENTIAL_TITLE' => '潜在案件',
+
+'LBL_NEW_TASK' => '新增任务',
+'LBL_TASK_TITLE' => '任务',
+'LBL_NEW_CALL' => '新增电话记录',
+'LBL_CALL_TITLE' => '电话记录',
+'LBL_NEW_MEETING' => '新增会议',
+'LBL_MEETING_TITLE' => '会议',
+'LBL_NEW_EMAIL' => '新增电子邮件',
+'LBL_EMAIL_TITLE' => '电子邮件',
+'LBL_NEW_CONTACT' => '新增联系人',
+'LBL_CONTACT_TITLE' => '联系人',
+
+//Added for 4GA Release
+'Category' => '类别',
+'Related To' => '相关人事',
+'Question' => '问题',
+'Answer' => '回答',
+'Comments' => '意见',
+'LBL_COMMENTS'=>'意见',//give the same value given to the above string 'Comments'
+'Created Time' => '建立时间',
+'Modified Time' => '修改时间',
+
+//Added vtiger_fields after 4.2 alpha
+'LBL_TICKETS' => '传票',
+'LBL_FAQ' => '常见问答',
+'Product Name' => '产品名称',
+'FAQ Id' => '常见问答编号',
+'Add Comment' => '新增意见',
+'LBL_ADD_COMMENT'=>'新增意见',//give the same value given to the above string 'Add Comment'
+'LBL_COMMENT_INFORMATION'=>'意见信息',
+'Status'=>'状态',
+
+//Added on 10-12-2005
+'LBL_QUESTION'=>'问题',
+'LBL_CATEGORY'=>'类别',
+'LBL_MY_FAQ'=>'我的最近常见问题',
+
+//Added for existing Picklist Entries
+
+'General' => '一般',
+
+'Draft' => '草稿',
+'Reviewed' => '已审阅',
+'Published' => '已发布',
+'Obsolete' => '过期',
+
+// Module Sequence Numbering
+'Faq No' => 'Faq No',
+// END
+);
+
+?>
diff --git a/oss/vtiger/trunk/modules/Faq/updateRelations.php b/oss/vtiger/trunk/modules/Faq/updateRelations.php
new file mode 100644
index 00000000..e333a98f
--- /dev/null
+++ b/oss/vtiger/trunk/modules/Faq/updateRelations.php
@@ -0,0 +1,48 @@
+pquery("insert into vtiger_senotesrel values (?,?)", array($forCRMRecord,$id));
+ else {
+ $focus->save_related_module($currentModule, $forCRMRecord, $dest_mod, $id);
+ }
+ }
+}
+
+header("Location: index.php?action=$action&module=$currentModule&record=$forCRMRecord&parenttab=$parenttab");
+
+?>
\ No newline at end of file