Created
January 15, 2019 16:56
-
-
Save phaniav/51a81dd044e7467881704e91e646517e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%@ Page Language="C#" AutoEventWireup="true" Debug="true" %> | |
<!DOCTYPE html> | |
<head> | |
<title>Sitecore utilities</title> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> | |
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> | |
</head> | |
<script runat="server" language="C#"> | |
void PauseButton_OnClick(Object sender, EventArgs e) | |
{ | |
Sitecore.ContentSearch.Maintenance.IndexCustodian.PauseIndexing(); | |
} | |
void UnPauseButton_OnClick(Object sender, EventArgs e) | |
{ | |
Sitecore.ContentSearch.Maintenance.IndexCustodian.ResumeIndexing(); | |
} | |
void CreateItemButton_OnClick(Object sender, EventArgs e) | |
{ | |
Sitecore.Data.Database masterDB = Sitecore.Configuration.Factory.GetDatabase("master"); | |
Sitecore.Data.Items.Item parentItem = masterDB.GetItem(new Sitecore.Data.ID(Request.Form["ParentGuid"])); | |
Sitecore.Data.Managers.ItemManager.AddFromTemplate("Products", new Sitecore.Data.ID(Request.Form["TemplateGuid"]), parentItem, new Sitecore.Data.ID(Request.Form["ItemGuid"])); | |
} | |
</script> | |
<body> | |
<form id="MyForm" runat="server"> | |
<div class="container"> | |
<h2> Sitecore utilities </h2> | |
</div> | |
<div class="container"> | |
<div class="row"> | |
<div class="well"> | |
<h3>Control Indexing</h3> | |
<div class="form-group"> | |
<asp:button id="PauseButton" text="Pause Indexing" OnClick="PauseButton_OnClick" runat="server"></asp:button> | |
<asp:button id="UnPauseButton" text="Un Pause Indexing" OnClick="UnPauseButton_OnClick" runat="server"></asp:button> | |
</div> | |
</div> | |
</div> | |
</div> | |
<div class="container"> | |
<div class="row"> | |
<div class="well"> | |
<asp:Label ID="ItemLabel" runat="server" ></asp:Label> | |
<h3>Create Item with Guid, Template and Parent Item ID</h3> | |
<div class="form-group"> | |
<label for="ItemGuid">Enter Item Guid:</label> | |
<input type="text" class="form-control" id="ItemGuid" runat="server"> | |
</div> | |
<div class="form-group"> | |
<label for="TemplateGuid">Enter Template Guid:</label> | |
<input type="text" class="form-control" id="TemplateGuid" runat="server"> | |
</div> | |
<div class="form-group"> | |
<label for="ParentGuid">Enter Parent Guid:</label> | |
<input type="text" class="form-control" id="ParentGuid" runat="server"> | |
</div> | |
<div class="form-group"> | |
<asp:button id="CreateItemButton" text="Create Item" OnClick="CreateItemButton_OnClick" runat="server"></asp:button> | |
</div> | |
</div> | |
</div> | |
</div> | |
</form> | |
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment