Global search autocomplete should open concrete object if selected from list.
This commit is contained in:
parent
bef8b22bbb
commit
23cce8216d
4 changed files with 118 additions and 13 deletions
|
@ -32,6 +32,8 @@ namespace WebsitePanel.WebPortal
|
|||
Dictionary<string, string> obj = new Dictionary<string, string>();
|
||||
obj["ColumnType"] = "PackageName";
|
||||
obj["TextSearch"] = row["PackageName"].ToString();
|
||||
obj["ItemID"] = row["ItemID"].ToString();
|
||||
obj["PackageID"] = row["PackageID"].ToString();
|
||||
obj["FullType"] = "Space";
|
||||
dataList.Add(obj);
|
||||
}
|
||||
|
@ -54,6 +56,8 @@ namespace WebsitePanel.WebPortal
|
|||
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);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,12 @@
|
|||
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
$("#<%= tbSearch.ClientID %>").keypress(function () {
|
||||
$("#<%= tbSearchText.ClientID %>").val('');
|
||||
$("#<%= tbObjectId.ClientID %>").val('');
|
||||
$("#<%= tbPackageId.ClientID %>").val('');
|
||||
});
|
||||
|
||||
$(document).ready(function () {
|
||||
$("#<%= tbSearch.ClientID %>").autocomplete({
|
||||
zIndex: 100,
|
||||
|
@ -33,6 +39,8 @@
|
|||
$("#<%= tbSearchColumnType.ClientID %>").val(item.code.ColumnType);
|
||||
$("#<%= tbSearchFullType.ClientID %>").val(item.code.FullType);
|
||||
$("#<%= tbSearchText.ClientID %>").val(item.code.TextSearch);
|
||||
$("#<%= tbObjectId.ClientID %>").val(item.code.ItemID);
|
||||
$("#<%= tbPackageId.ClientID %>").val(item.code.PackageID);
|
||||
}
|
||||
});
|
||||
});//]]>
|
||||
|
@ -70,6 +78,18 @@
|
|||
type="hidden"
|
||||
>
|
||||
</asp:TextBox>
|
||||
<asp:TextBox
|
||||
ID="tbObjectId"
|
||||
runat="server"
|
||||
type="hidden"
|
||||
>
|
||||
</asp:TextBox>
|
||||
<asp:TextBox
|
||||
ID="tbPackageId"
|
||||
runat="server"
|
||||
type="hidden"
|
||||
>
|
||||
</asp:TextBox>
|
||||
|
||||
<asp:ImageButton
|
||||
ID="ImageButton1"
|
||||
|
|
|
@ -44,6 +44,13 @@ namespace WebsitePanel.Portal.SkinControls
|
|||
{
|
||||
public partial class GlobalSearch : WebsitePanelControlBase
|
||||
{
|
||||
const string TYPE_WEBSITE = "WebSite";
|
||||
const string TYPE_DOMAIN = "Domain";
|
||||
const string TYPE_ORGANIZATION = "Organization";
|
||||
const string PID_SPACE_WEBSITES = "SpaceWebSites";
|
||||
const string PID_SPACE_DIMAINS = "SpaceDomains";
|
||||
const string PID_SPACE_EXCHANGESERVER = "SpaceExchangeServer";
|
||||
|
||||
class Tab
|
||||
{
|
||||
int index;
|
||||
|
@ -115,6 +122,41 @@ namespace WebsitePanel.Portal.SkinControls
|
|||
"ItemTypeID=" + ddlItemType.SelectedValue)); */
|
||||
}
|
||||
|
||||
public string GetItemPageUrl(string fullType, string itemType, int itemId, int spaceId)
|
||||
{
|
||||
string res = "";
|
||||
if (fullType.Equals("Users"))
|
||||
{
|
||||
res = PortalUtils.GetUserHomePageUrl(itemId);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (itemType)
|
||||
{
|
||||
case TYPE_WEBSITE:
|
||||
res = PortalUtils.NavigatePageURL(PID_SPACE_WEBSITES, "ItemID", itemId.ToString(),
|
||||
PortalUtils.SPACE_ID_PARAM + "=" + spaceId, "ctl=edit_item",
|
||||
"moduleDefId=websites");
|
||||
break;
|
||||
case TYPE_DOMAIN:
|
||||
res = PortalUtils.NavigatePageURL(PID_SPACE_DIMAINS, "DomainID", itemId.ToString(),
|
||||
PortalUtils.SPACE_ID_PARAM + "=" + spaceId, "ctl=edit_item",
|
||||
"moduleDefId=domains");
|
||||
break;
|
||||
case TYPE_ORGANIZATION:
|
||||
res = PortalUtils.NavigatePageURL(PID_SPACE_EXCHANGESERVER, "ItemID", itemId.ToString(),
|
||||
PortalUtils.SPACE_ID_PARAM + "=" + spaceId, "ctl=edit_item",
|
||||
"moduleDefId=ExchangeServer");
|
||||
break;
|
||||
default:
|
||||
res = PortalUtils.GetSpaceHomePageUrl(itemId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
//TODO START
|
||||
protected void btnSearchObject_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
@ -124,6 +166,12 @@ namespace WebsitePanel.Portal.SkinControls
|
|||
if (strText.Length > 0)
|
||||
{
|
||||
if (strFullType == "Users")
|
||||
{
|
||||
if (tbObjectId.Text.Length > 0)
|
||||
{
|
||||
Response.Redirect(PortalUtils.GetUserHomePageUrl(Int32.Parse(tbObjectId.Text)));
|
||||
}
|
||||
else
|
||||
{
|
||||
Response.Redirect(PortalUtils.NavigatePageURL(PortalUtils.GetUsersSearchPageId(),
|
||||
PortalUtils.USER_ID_PARAM, PanelSecurity.SelectedUserId.ToString(),
|
||||
|
@ -131,7 +179,14 @@ namespace WebsitePanel.Portal.SkinControls
|
|||
"Criteria=" + Server.UrlEncode(strColumnType)
|
||||
));
|
||||
}
|
||||
}
|
||||
else if (strFullType == "Space")
|
||||
{
|
||||
if (tbObjectId.Text.Length > 0)
|
||||
{
|
||||
Response.Redirect(GetItemPageUrl(strFullType,tbSearchColumnType.Text,Int32.Parse(tbObjectId.Text),Int32.Parse(tbPackageId.Text)));
|
||||
}
|
||||
else
|
||||
{
|
||||
Response.Redirect(PortalUtils.NavigatePageURL(PortalUtils.GetSpacesSearchPageId(),
|
||||
PortalUtils.USER_ID_PARAM, PanelSecurity.SelectedUserId.ToString(),
|
||||
|
@ -139,6 +194,13 @@ namespace WebsitePanel.Portal.SkinControls
|
|||
"Criteria=" + Server.UrlEncode(strColumnType)
|
||||
));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tbObjectId.Text.Length > 0)
|
||||
{
|
||||
Response.Redirect(GetItemPageUrl(strFullType, tbSearchColumnType.Text, Int32.Parse(tbObjectId.Text), Int32.Parse(tbPackageId.Text)));
|
||||
}
|
||||
else
|
||||
{
|
||||
Response.Redirect(PortalUtils.NavigatePageURL(PortalUtils.GetObjectSearchPageId(),
|
||||
|
@ -146,6 +208,7 @@ namespace WebsitePanel.Portal.SkinControls
|
|||
"Query=" + Server.UrlEncode(strText)));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Response.Redirect(PortalUtils.NavigatePageURL(PortalUtils.GetObjectSearchPageId(),
|
||||
|
|
|
@ -57,6 +57,24 @@ namespace WebsitePanel.Portal.SkinControls {
|
|||
/// </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>
|
||||
/// ImageButton1 control.
|
||||
/// </summary>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue