Search button should take to item if selected from autocomplete

This commit is contained in:
alexY 2015-04-29 15:54:20 +03:00
parent 23cce8216d
commit 4372ee7db0
14 changed files with 114 additions and 41 deletions

View file

@ -910,7 +910,7 @@ namespace WebsitePanel.EnterpriseServer {
/// <remarks/>
/// //TODO START
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://smbsaas/websitepanel/enterpriseserver/GetSearchObject", RequestNamespace = "http://smbsaas/websitepanel/enterpriseserver", ResponseNamespace = "http://smbsaas/websitepanel/enterpriseserver", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public System.Data.DataSet GetSearchObject(int userId, string filterColumn, string filterValue, int statusId, int roleId, string sortColumn, int startRow, int maximumRows, string colType)
public System.Data.DataSet GetSearchObject(int userId, string filterColumn, string filterValue, int statusId, int roleId, string sortColumn, int startRow, int maximumRows, string colType, string fullType)
{
object[] results = this.Invoke("GetSearchObject", new object[] {
userId,
@ -921,7 +921,8 @@ namespace WebsitePanel.EnterpriseServer {
sortColumn,
startRow,
maximumRows,
colType
colType,
fullType
});
return ((System.Data.DataSet)(results[0]));
}

View file

@ -141,7 +141,7 @@ namespace WebsitePanel.EnterpriseServer
//TODO START
public static DataSet GetSearchObject(int actorId, int userId, string filterColumn, string filterValue,
int statusId, int roleId, string sortColumn, int startRow, int maximumRows, string colType, bool recursive)
int statusId, int roleId, string sortColumn, int startRow, int maximumRows, string colType, string fullType, bool recursive)
{
return SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure,
ObjectQualifier + "GetSearchObject",
@ -155,7 +155,8 @@ namespace WebsitePanel.EnterpriseServer
new SqlParameter("@startRow", startRow),
new SqlParameter("@maximumRows", maximumRows),
new SqlParameter("@recursive", recursive),
new SqlParameter("@ColType", colType));
new SqlParameter("@ColType", colType),
new SqlParameter("@FullType", fullType));
}
//TODO END

View file

@ -319,10 +319,10 @@ namespace WebsitePanel.EnterpriseServer
//TODO START
public static DataSet GetSearchObject(int userId, string filterColumn, string filterValue,
int statusId, int roleId, string sortColumn, int startRow, int maximumRows, string colType)
int statusId, int roleId, string sortColumn, int startRow, int maximumRows, string colType, string fullType)
{
return DataProvider.GetSearchObject(SecurityContext.User.UserId, userId,
filterColumn, filterValue, statusId, roleId, sortColumn, startRow, maximumRows, colType, false);
filterColumn, filterValue, statusId, roleId, sortColumn, startRow, maximumRows, colType, fullType, false);
}
//TODO END

View file

@ -138,9 +138,9 @@ namespace WebsitePanel.EnterpriseServer
[WebMethod]
public DataSet GetSearchObject(int userId, string filterColumn, string filterValue,
int statusId, int roleId, string sortColumn, int startRow, int maximumRows, string colType)
int statusId, int roleId, string sortColumn, int startRow, int maximumRows, string colType, string fullType)
{
return PackageController.GetSearchObject(userId, filterColumn, filterValue, statusId, roleId, sortColumn, startRow, maximumRows, colType);
return PackageController.GetSearchObject(userId, filterColumn, filterValue, statusId, roleId, sortColumn, startRow, maximumRows, colType, fullType);
}
//TODO END

View file

@ -47,19 +47,22 @@ namespace WebsitePanel.WebPortal
{
DataSet dsObjectItems = ES.Services.Packages.GetSearchObject(PanelSecurity.EffectiveUserId, null,
String.Format("%{0}%", filterValue),
0, 0, "", 0, 100, columnType);
0, 0, "", 0, 100, columnType,fullType);
DataTable dt = dsObjectItems.Tables[2];
List<Dictionary<string, string>> dataList = new List<Dictionary<string, string>>();
for (int i = 0; i < dt.Rows.Count; ++i)
{
DataRow row = dt.Rows[i];
Dictionary<string, string> obj = new Dictionary<string, string>();
obj["ColumnType"] = row["ColumnType"].ToString();
obj["TextSearch"] = row["TextSearch"].ToString();
obj["ItemID"] = row["ItemID"].ToString();
obj["PackageID"] = row["PackageID"].ToString();
obj["FullType"] = row["FullType"].ToString();
dataList.Add(obj);
if ((fullType == null) || (fullType.Length == 0) || (fullType == row["FullType"].ToString()))
{
Dictionary<string, string> obj = new Dictionary<string, string>();
obj["ColumnType"] = row["ColumnType"].ToString();
obj["TextSearch"] = row["TextSearch"].ToString();
obj["ItemID"] = row["ItemID"].ToString();
obj["PackageID"] = row["PackageID"].ToString();
obj["FullType"] = row["FullType"].ToString();
dataList.Add(obj);
}
}
var jsonSerialiser = new JavaScriptSerializer();

View file

@ -250,25 +250,25 @@ namespace WebsitePanel.Portal
#region Service Items Paged Search
DataSet dsObjectItemsPaged;
public int SearchObjectItemsPagedCount(string filterColumn, string filterValue, string colType)
public int SearchObjectItemsPagedCount(string filterColumn, string filterValue, string fullType, string colType)
{
return (int)dsObjectItemsPaged.Tables[0].Rows[0][0];
}
public DataTable SearchObjectItemsPaged(int maximumRows, int startRowIndex, string sortColumn,
string filterColumn, string filterValue, string colType)
string filterColumn, string filterValue, string colType, string fullType)
{
dsObjectItemsPaged = ES.Services.Packages.GetSearchObject(PanelSecurity.EffectiveUserId, filterColumn,
String.Format("%{0}%", filterValue),
0, 0, sortColumn, startRowIndex, maximumRows, colType);
0, 0, sortColumn, startRowIndex, maximumRows, colType, fullType);
return dsObjectItemsPaged.Tables[2];
}
public DataTable SearchObjectTypes(string filterColumn, string filterValue, string sortColumn)
public DataTable SearchObjectTypes(string filterColumn, string filterValue, string fullType, string sortColumn)
{
dsObjectItemsPaged = ES.Services.Packages.GetSearchObject(PanelSecurity.EffectiveUserId, filterColumn,
String.Format("%{0}%", filterValue),
0, 0, sortColumn, 0, 0, "");
0, 0, sortColumn, 0, 0, "",fullType);
return dsObjectItemsPaged.Tables[1];
}
//TODO END

View file

@ -91,6 +91,7 @@
<SelectParameters>
<asp:QueryStringParameter Name="filterColumn" QueryStringField="Criteria" />
<asp:QueryStringParameter Name="filterValue" QueryStringField="Query" />
<asp:QueryStringParameter Name="fullType" QueryStringField="FullType" />
</SelectParameters>
</asp:ObjectDataSource>
@ -99,6 +100,7 @@
<SelectParameters>
<asp:QueryStringParameter Name="filterColumn" QueryStringField="Criteria" />
<asp:QueryStringParameter Name="filterValue" QueryStringField="Query" />
<asp:QueryStringParameter Name="fullType" QueryStringField="FullType" />
</SelectParameters>
</asp:ObjectDataSource>

View file

@ -6,10 +6,12 @@
<script type="text/javascript">
//<![CDATA[
$("#<%= tbSearch.ClientID %>").keypress(function () {
$("#<%= tbSearchText.ClientID %>").val('');
$("#<%= tbObjectId.ClientID %>").val('');
$("#<%= tbPackageId.ClientID %>").val('');
$("#<%= tbSearch.ClientID %>").keypress(function (e) {
if (e.keyCode != 13) { // VK_RETURN
$("#<%= tbSearchText.ClientID %>").val('');
$("#<%= tbObjectId.ClientID %>").val('');
$("#<%= tbPackageId.ClientID %>").val('');
}
});
$(document).ready(function () {
@ -41,12 +43,13 @@
$("#<%= tbSearchText.ClientID %>").val(item.code.TextSearch);
$("#<%= tbObjectId.ClientID %>").val(item.code.ItemID);
$("#<%= tbPackageId.ClientID %>").val(item.code.PackageID);
$("#<%= ImageButton1.ClientID %>").trigger("click");
}
});
});//]]>
</script>
<asp:UpdatePanel runat="server" ID="updatePanelUsers" UpdateMode="Conditional" ChildrenAsTriggers="true">
<asp:Panel runat="server" ID="updatePanelUsers" UpdateMode="Conditional" ChildrenAsTriggers="true">
<ContentTemplate>
<table cellpadding="0" cellspacing="0" align="right">
<tr>
@ -104,4 +107,4 @@
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>

View file

@ -19,7 +19,7 @@ namespace WebsitePanel.Portal.SkinControls {
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.UpdatePanel updatePanelUsers;
protected global::System.Web.UI.WebControls.Panel updatePanelUsers;
/// <summary>
/// tbSearch control.

View file

@ -3,8 +3,12 @@
<script type="text/javascript">
//<![CDATA[
$(document).ready(function () {
$("#tbSearch").keypress(function () {
$("#tbSearchText").val('');
$("#tbSearch").keypress(function (e) {
if (e.keyCode != 13) { // VK_RETURN
$("#tbSearchText").val('');
$("#tbObjectId").val('');
$("#tbPackageId").val('');
}
});
$("#tbSearch").autocomplete({
@ -15,14 +19,14 @@
dataType: "json",
data: {
term: request.term,
fullType: '',
columnType: "'" + $("#ddlFilterColumn").val() + "'"
fullType: 'Users'
// columnType: "'" + $("#ddlFilterColumn").val() + "'"
},
url: "AjaxHandler.ashx",
success: function (data) {
response($.map(data, function (item) {
return {
label: item.TextSearch,
label: item.TextSearch + " [" + item.ColumnType + "]",
code: item
};
}));
@ -34,6 +38,9 @@
$("#ddlFilterColumn").val(item.code.ColumnType);
$("#tbSearchFullType").val(item.code.FullType);
$("#tbSearchText").val(item.code.TextSearch);
$("#tbObjectId").val(item.code.ItemID);
$("#tbPackageId").val(item.code.PackageID);
$("#<%= cmdSearch.ClientID %>").trigger("click");
}
});
});//]]>
@ -45,7 +52,7 @@
<table>
<tr>
<td>
<asp:DropDownList ClientIDMode="Static" ID="ddlFilterColumn" runat="server" CssClass="NormalTextBox" resourcekey="ddlFilterColumn">
<asp:DropDownList ClientIDMode="Static" ID="ddlFilterColumn" runat="server" CssClass="NormalTextBox" resourcekey="ddlFilterColumn" style="display:none">
</asp:DropDownList>
</td>
<td>
@ -76,7 +83,20 @@
type="hidden"
>
</asp:TextBox>
<asp:TextBox
ID="tbObjectId"
ClientIDMode="Static"
runat="server"
type="hidden"
>
</asp:TextBox>
<asp:TextBox
ID="tbPackageId"
ClientIDMode="Static"
runat="server"
type="hidden"
>
</asp:TextBox>
<asp:ImageButton
ID="cmdSearch"
runat="server"

View file

@ -98,10 +98,27 @@ namespace WebsitePanel.Portal
protected void cmdSearch_Click(object sender, ImageClickEventArgs e)
{
Response.Redirect(NavigatePageURL(PortalUtils.GetUserCustomersPageId(),
PortalUtils.USER_ID_PARAM, PanelSecurity.SelectedUserId.ToString(),
"FilterColumn=" + ddlFilterColumn.SelectedValue,
"FilterValue=" + Server.UrlEncode(FilterValue)));
if (tbObjectId.Text.Length > 0)
{
Response.Redirect(PortalUtils.GetUserHomePageUrl(Int32.Parse(tbObjectId.Text)));
}
else
{
String strText = tbSearchText.Text;
if (strText.Length > 0)
{
Response.Redirect(NavigatePageURL(PortalUtils.GetUserCustomersPageId(),
PortalUtils.USER_ID_PARAM, PanelSecurity.SelectedUserId.ToString(),
"FilterColumn=" + ddlFilterColumn.SelectedValue,
"FilterValue=" + Server.UrlEncode(FilterValue)));
}
else
{
Response.Redirect(PortalUtils.NavigatePageURL(PortalUtils.GetObjectSearchPageId(),
PortalUtils.USER_ID_PARAM, PanelSecurity.SelectedUserId.ToString(),
"Query=" + Server.UrlEncode(tbSearch.Text),"FullType=Users"));
}
}
}
}
}

View file

@ -66,6 +66,24 @@ namespace WebsitePanel.Portal {
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox tbSearchText;
/// <summary>
/// tbObjectId control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox tbObjectId;
/// <summary>
/// tbPackageId control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox tbPackageId;
/// <summary>
/// cmdSearch control.
/// </summary>

View file

@ -4890,7 +4890,6 @@
<Content Include="ProviderControls\HyperV2012R2_Settings.ascx" />
<Content Include="SearchObject.ascx" />
<Content Include="ScheduleTaskControls\UserPasswordExpirationNotificationView.ascx" />
<Content Include="SearchObject.ascx" />
<Content Include="SettingsUserPasswordExpirationLetter.ascx" />
<Content Include="SettingsUserPasswordResetLetter.ascx" />
<Content Include="VPS2012\RemoteDesktop\Connect.aspx" />