output
stringlengths 34
25.7k
| instruction
stringlengths 81
31k
| input
stringclasses 1
value |
---|---|---|
You can put it to the Foundation layer. Any project in any layer can have references to the Foundation layer. Also, a Foundation project can have references to another Foundation project, but you need to follow this rule:
Unlike the Feature layer, there is no strict convention on dependencies between modules in the foundation layer. This means that one Foundation layer module can depend on another Foundation layer module in the solution – as long as they rely on the basic principles on component architecture such as the Acyclic Dependencies Principle and the Stable Abstractions Principle:
Source:
Helix principles
Do not forget that Habitat is just an example of how Helix principles should be applied.
|
Sitecore Habitat with Glass Mapper
Just wondering if I use glass mapper or any DI framwork then will I need to implement in each project separetly? otherwise if I create a separate project for DI or Glassmapper and add the reference in each habitat project then i guess it will break the habitat rule which says keep the module separate.
| |
So the problem was in the .EndEdit() call.
By calling .EndEdit(false, true) you are essentially telling Sitecore two things:
Do not update revision, revision date and so on. In other words, try and "hide" that the update took place
Disable events for this update
So basically you did pretty much everything you could, to try and hide the fact that you were adding versions and adding fields, to your surroundings. Including Content Editor, which would then not get notified that item changes took place. Caches would not get invalidated. And so on.
|
Item.Versions.AddVersion() - fields not being saved
I am adding a new version of an item in a different language. This works fine.
Them I am setting the field values on the new version, but those values are not saved. The code is basically (simplified):
Item englishItemVersion = _newDatabase.GetItem(swedishItem.ID, englishLanguage).Versions.AddVersion();
englishItemVersion.Editing.BeginEdit();
englishItemVersion.Fields[{guid}].Value = “my English title”;
englishItemVersion.Editing.EndEdit(false, true);
When i debug the code, all the fields on the new itemversion is set, but as soon as the code hits EndEdit(false, true);, all the values in the fields disappear. Why is that?
| |
This is likely a bug in Sitecore 8.2, as earlier versions of Sitecore 8 prevent you from removing the last strip from the ribbon, as can be see in the following screenshot:
Resolving the Issue
I suggest that you try to work around the issue by opening up Chrome Dev Tools (via F12 in your chrome browser) or Firebug (or whatever Mozilla calls it these days; via F12 in FireFox), and search for the (div) element with id="Ribbon". If it is there, update it so that it has a reasonable width and height and make sure that it is set to display: block (all via CSS), in order to make it visible. Then right-click the element and the Context Menu should appear, allowing you to add back one or more ribbon strips.
If you are unable to find the (div) element with id="Ribbon" then try doing the same thing for the (div) element with id="RibbonPanel". That one should render no matter what (even if it isn't displaying, due to content/CSS/etc).
If you still cannot fix the issue, try going into the User Manager, selecting your user and clicking the "Reset Settings" button. I have not tested this one myself, but it may work, as well.
|
Unhide Ribbon strips
I have managed to hide all ribbon strips by right clicking on ribbon and un checking them.
I have zero strips now, on the ribbon and so, ribbon is hidden. I cannot able to get them back.
I have tried:
Application Pool Recycle
Reset to default settings in control panel
Could anyone have suggestions on how to get back the ribbon in sitecore8.2
| |
I don't know if the problem is relevant yet, but it's actually possible to switch Sitecore to using POST queries instead of GET when communicating to Solr.
You need to decompile the IOC integration library that you use from the Sitecore Solr Support Package. On the project where I currently work we use Unity. And here's what we did:
public void Initialize() {
...
if (SolrContentSearchManager.EnableHttpCache)
{
this.Container.RegisterType(typeof(ISolrCache), typeof(HttpRuntimeCache), new InjectionMember[0]);
List<ContainerRegistration> list = this.Container.Registrations.Where<ContainerRegistration>((Func<ContainerRegistration, bool>)(r => r.RegisteredType == typeof(ISolrConnection))).ToList<ContainerRegistration>();
if (list.Count > 0)
{
foreach (ContainerRegistration containerRegistration in list)
{
ContainerRegistration registration = containerRegistration;
SolrServerElement solrServerElement = this.Cores.FirstOrDefault<SolrServerElement>((Func<SolrServerElement, bool>)(core => registration.Name == core.Id + registration.MappedToType.FullName));
if (solrServerElement == null)
{
Log.Error("The Solr Core configuration for the '" + registration.Name + "' Unity registration could not be found. The HTTP cache for the Solr connection to the Core cannot be configured.", (object)this);
}
else
{
InjectionMember[] injectionMemberArray = new InjectionMember[1]
{
//Change starts
(InjectionMember) new InjectionConstructor(new object[2] {
(object) new SolrConnection(solrServerElement.Url),
(object) solrServerElement.Url
})
};
this.Container.RegisterType(typeof(ISolrConnection), typeof(PostSolrConnection), registration.Name, (LifetimeManager)null, injectionMemberArray);
//Change ends
}
}
}
}
...
}
When you do this change, you also need to adjust the maxBooleanClauses setting in your solrconfig.xml if you have more than 1024 clauses in any of your queries. See https://wiki.apache.org/solr/SolrConfigXml for more information.
|
Solr query length limit
We are having an issue where queries are too big so we get error 414 (Request-URI Too Long).
From what I can see, sitecore sends a GET request with the query to the server. Is there a way to switch this so it sends a POST request instead? If not, how do you usually handle big queries in SOLR?
PS: we tried modifying the requestBufferSize in jetty.xml and still didn't work.
Using bitnami solr 4.10.3 and Sitecore 8.1 update 1
| |
You can use either, but I recommend ApplicationPoolIdentity whenever possible. TBH, your question really isn't Sitecore-specific, but the below info should help to get you started.
Application Pool Identity vs NETWORK SERVICE
The security of ApplicationPoolIdentity will always be greater than or equal to that of NETWORK SERVICE, given that the same access rights are applied to both.
When using AppPoolIdentity, you have a separate identity (security account) for each app pool. This means that you can control the services and securities for your application pool, specifically, agnostic of any other application pools or services. In other words, if you have multiple services and/or applications then ApplicationPoolIdentity is more secure, otherwise it is pretty much the same, though ApplicationPoolIdentity is more extensible (and a bit easier to read in Windows Event Logs, IMHO).
In contrast, NETWORK SERVICE can be used for any/all of your services, i.e. it can be used by more than one without issue. While this sounds like a nice feature that might save you some time, this actually means that if you use it your securities cannot be controlled on a service-by-service or application-by-application basis. All services and/or applications that use NETWORK SERVICE will have the same permissions, which can be a pretty big security risk.
Food for Thought
Imagine that you use NETWORK SERVICE on your site and you also happen to use NETWORK SERVICE on an IIS-based service that a hacker manages to break into. Imagine that the hack allows the hacker to access the server's file system. Because you used NETWORK SERVICE for the application pool's security account, the hacker now has access to your site's folder and to anything that your site had access too. Now, the hacker can not only gain access to your site's ConnectionStrings and web.config, but also to things in your System folder (since Sitecore requires access to some of the System folders), your databases (since they have your ConnectionStrings), and beyond!
More information
This post from iis.net gives a good description of the different security accounts that you can use and their similarities/differences.
|
What is the recommended application pool identity to use for Sitecore?
I have always used "Network Service" as the application pool identity for Sitecore since 6.0 through 8.1 and never had any problems. A co-worker stated recently that the "AppPoolIdentity" is the recommended version for 7+. What is the recommended identity?
| |
There's an entry for this in the Sitecore presentation component troubleshooting guide
It's this section:
If layout details indicate that the layout engine should bind a
control to a placeholder, but the layout engine cannot locate a
placeholder with that key in the layouts and sublayouts already
processed, the layout engine does not create an error visible to the
browser. Instead, the layout engine writes warning messages such as
the following to the page trace visible in the Sitecore browser-based
debugger:
Warning
A rendering was not used on the page
The placeholder was not found
If you locate any of these warning messages in the page
trace, confirm that the sublayouts and renderings in layout details
for the item specify placeholder keys that exist in the layout and
sublayouts specified. Ensure that placeholder settings list controls
in component nesting order. For example, a sublayout containing a
placeholder should appear before the controls that bind to that
placeholder. Ensure that fully qualified placeholder keys reflect the
correct placeholder nesting order.
It sounds like this is a common issue - if you look in your placeholder settings, check that you have the correct placeholder controls and that they are in nested order (so make sure your 3 inner placeholders are below their parent placeholder).
If that isn't what's wrong - you could also try using fully qualified placeholder names (e.g. instead of "Right" use "/Content/Right").
|
Warning: A rendering was not used on the page. The placeholder "xxxxxx" was not found
There is a Desktop Layout (Desktop.aspx) with several controls (Figure 1 and Figure 3). One of the controls called "Two Column Big Left" (TwoColumnBigLeft.ascx) has three placeholders (Inner Content Top, Left, Right). Then, there are six controls added to the three placeholders on the "Two Column Big Left" control.
Page Title (Inner Content Top)
Generic Body Content (Left)
Video Carousel (Left)
Capability Accordian (Left)
Generic Callout (Right)
Generic Callout (Right)
I am getting warnings in Debug mode (Figure 2) and caching is not working correctly (it is supposed to vary by data on the "Playbook Playlist" control, but it is cached permanently).
Is this considered a correct way to configure the Presentation Details? What do I need to do to get rid of the warnings? Do the placeholders all need to be on Desktop.aspx? Or, maybe the TwoColumnBigLeft.ascx page needs to be included on the Desktop.aspx page directly in the code (not through Sitecore presentation details)? Should I create a second version of the Desktop.aspx page to use for this page?
Other than the caching problem, the page looks fine in the web browser.
Figure 1
Figure 2
Figure 3
| |
This code is execute when you click this button :
[Serializable]
public class ResetSettings : Command, ISupportsContinuation
{
/// <summary>
/// Executes the command in the specified context.
/// </summary>
/// <param name="context">The context.</param>
public override void Execute(CommandContext context)
{
Assert.ArgumentNotNull(context, "context");
string text = context.Parameters["username"];
if (!ValidationHelper.ValidateUserWithMessage(text))
{
return;
}
System.Collections.Specialized.NameValueCollection nameValueCollection = new System.Collections.Specialized.NameValueCollection();
nameValueCollection["username"] = text;
ClientPipelineArgs args = new ClientPipelineArgs(nameValueCollection);
ContinuationManager.Current.Start(this, "Run", args);
}
/// <summary>
/// Runs the pipeline.
/// </summary>
/// <param name="args">The args.</param>
protected void Run(ClientPipelineArgs args)
{
Assert.ArgumentNotNull(args, "args");
ListString listString = new ListString(args.Parameters["username"]);
if (args.IsPostBack)
{
if (args.Result == "yes")
{
foreach (string current in listString)
{
User user = User.FromName(current, true);
Assert.IsNotNull(user, typeof(User));
UserProfile profile = user.Profile;
List<string> customPropertyNames = profile.GetCustomPropertyNames();
string value = "/" + current + "/";
foreach (string current2 in customPropertyNames)
{
if (current2.StartsWith(value, StringComparison.InvariantCultureIgnoreCase))
{
profile.RemoveCustomProperty(current2);
}
}
profile.Save();
RegistryCache registryCache = CacheManager.GetRegistryCache(Context.Site);
if (registryCache != null)
{
registryCache.Clear();
}
Log.Audit(this, "Reset settings: {0}", new string[]
{
user.Name
});
}
AjaxScriptManager.Current.Dispatch("usermanager:refresh");
return;
}
}
else
{
if (listString.Count == 1)
{
User user2 = User.FromName(listString[0], true);
Assert.IsNotNull(user2, typeof(User));
SheerResponse.Confirm(Translate.Text("Are you sure you want to reset the settings of {0}?", new object[]
{
user2.GetLocalName()
}));
}
else
{
SheerResponse.Confirm(Translate.Text("Are you sure you want to reset the settings of these {0} users?", new object[]
{
listString.Count
}));
}
args.WaitForPostBack();
}
}
}
Update:
Reset should remove only custom information like size of the dialogs or preselect options in some controls.
Example: You click on right corner Show Database Name for an editor.
If you press Reset Settings for that editor, Database Name will be reset and will not be shown on the bottom right corner.
|
What Does the "Reset Settings" button in the User Manager do?
Looking in the User Manager, I see a "Reset Settings" button under the "Change Password" button in the ribbon, and I cannot find any information online (docs or blog posts) on what it actually does. Can anyone describe the functionality of this button?
I am on Sitecore 8.1.2, but this button has been around for quite a while.
| |
There is a mismatch between your Sitecore binaries and Sitecore configuration.
The OnPackageInstallStartingRemoteHandler method was only added to PackagingEventHandler in Sitecore 8.2 Update 1. It didn't exist yet in 8.2 Initial Release. Which means you have 8.2 (or earlier) binaries with 8.2 Update 1 configuration.
What happens, most likely, is that you are using Habitat that targets Sitecore 8.2 Initial Release (as it says on the Getting Started page) with a Sitecore instance based on Sitecore 8.2 Update 1. Habitat will deploy the binaries it targets during the build, so your 8.2u1 dlls are overwritten with 8.2 dlls.
Install Sitecore 8.2 Initial Release instead of 8.2u1 and the issue will be fixed.
Always check that the version of Habitat you pulled is using the correct version of Sitecore, as they are both continually getting updated. For example, it currently requires Sitecore 8.2 Update 4 - including Web Forms for Marketers Update 4 (rev 170518).
|
Error setting up Habitat instance of Sitecore with "Could not instantiate event handler." error
While setting up an instance of the Habitat demo site, I have followed all the steps as in the past but when the Sync Unicorn Gulp task begins, it exits with the following error:
Could not instantiate event handler. Type: Sitecore.ContentSearch.Events.PackagingEventHandler. Method: OnPackageInstallStartingRemoteHandler (method: Sitecore.Events.Event.GetConfigSubscribers()).
I thought maybe there was a problem with one of the resources used in the setup or even the clean instance of Sitecore. Since I get this same error when I try to log into Sitecore.
To be sure, I deleted the Sitecore instance for the Habitat solution and re-deployed with Sitecore SIM. I verified that I could see the default Sitecore home page and also logged in successfully.
Before proceeding, I made sure to have the latest of the following installed:
Node/NPM (6.9.2 and 3.10.9)
Bower (1.8.0)
Gulp (3.9.1)
Web Essentials 2015.3
Bundler & Minifier
Web Compiler
EditorConfig
I ran npm install at the root from an elevated command prompt without error.
I then opened Visual Studion as an administrator and ran the default task in Task Runner Explorer for the Solution 'Habitat' and watched it proceed without an errors through the first 4 tasks:
Copy-Sitecore-License
Nuget-Restore
Publish-All-Projects
Apply-Xml-Transform
When it comes time to run the Sync-Unicorn task, the console displays the error message, which is also displayed when I try to log into Sitecore.
Not sure how diagnose this error or where to look next.
| |
You can write some JavaScript to update the URL as you scroll. You'll also want to update the Coveo Search Results component to have an anchor at each result that corresponds to the URL change.
For example, you can have an anchor on the 25th result called #result25. The JavaScript would set your URL with location.hash based on some calculations fired off by the scroll event. When you click on the result, your URL should be something like /results#result25. When you go back in your browser, it should take you back to that anchor.
|
Coveo UI return to result list
Using Coveo UI and infinite scroll. How can we return user back to same place in search result list? Ex: user scrolls through the results and clicks on a result item to view the article. Is there a way to return the user to same place in search result on click Back button or a hard link to position on the page?
I notice as we scroll the result list, url is not updated.
Any suggestion on how to achieve this?
| |
To get connection strings and/or endpoints of xDB Cloud Set that is based on Sitecore xDB Cloud services v1.0 or v2.0, you have to perform the following steps:
Get the Sitecore Nexus Auth key to talk to xDB Cloud services.
Get the Deployment ID of xDB Set you are interested in.
Get a list of endpoints for the specified xDB Set.
Sitecore Nexus Auth Key
To get the key, call the SSO Encode Sitecore License REST API:
Request
POST https://gateway-sso-scs.cloud.sitecore.net/api/License/Encode
Content-Type: application/xml
Request Headers
The Content-Type is used to declare the general type of data. Set this header to application/xml.
Request Body
The body of the request contains sitecore license file:
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="http://www.sitecore.net/licenseviewer/license.xsl"?>
<signedlicense id="[sitecore license id]">
...
<Signature>...</Signature>
...
</signedlicense>
Response
Status code 200 (OK) is returned for a successful response with the following JSON document in the body:
{
"Key": "X-ScS-Nexus-Auth",
"Value": "[sitecore nexus key]"
}
2. Sitecore Deployment ID
To get a list of all provisioned xDB Sets, call the List xDB Sets REST API.
Request
GET https://gateway-xdb-scs.cloud.sitecore.net/api/xdb/[sitecore license id]
X-ScS-Nexus-Auth: [sitecore nexus key]
Request Headers
The X-ScS-Nexus-Auth is used to authenticate the request to Sitecore xDB Cloud service. It is a string value, unique to your Sitecore License ID.
Request Body
None.
Response
Status code 200 (OK) is returned for a successful response with the following JSON document in the body:
[
{
"DeploymentId": "My-xDB-Cloud-Prod"
},
{
"DeploymentId": "My-xDB-Cloud-NonProd"
}
]
3. Sitecore xDB Set Endpoints
To get a list of all endpoints of the specified xDB Set, call the following REST API, which is undocumented.
This REST API is exactly the same thing that Sitecore xDB Cloud Client
calls for xDB Cloud 1.0 if you examine the Sitecore.Cloud.Xdb
assembly using such tool as .NET Reflector or dotPeek.
Request
GET https://discovery-xdb-cloud.sitecore.net/xdb/set/[sitecore license id]?DeploymentId=[xdb cloud deployment id]
X-ScS-Nexus-Auth: [sitecore nexus key]
Request Headers
The X-ScS-Nexus-Auth is used to authenticate the request to Sitecore xDB Cloud service. It is a string value, unique to your Sitecore License ID.
Request Body
None.
Response
Status code 200 (OK) is returned for a successful response with the following JSON document in the body:
{
"LicenseId": "[sitecore license id]",
"DeploymentId": "[sitecore xdb cloud deployment id]",
"XdbConnectionStrings": {
"analytics": "mongodb://[user-name]:[password]@[host1]:[port1],[host2]:[port2]/[guid]-Analytics?ssl=true;replicaSet=[hostX];connectTimeout=1m;maxIdleTime=1m;socketTimeout=1m",
"tracking.live": "mongodb://[user-name]:[password]@[host1]:[port1],[host2]:[port2]/[guid]-TrackingLive?ssl=true;replicaSet=[hostX];connectTimeout=1m;maxIdleTime=1m;socketTimeout=1m",
"tracking.history": "mongodb://[user-name]:[password]@[host1]:[port1],[host2]:[port2]/[guid]-TrackingHistory?ssl=true;replicaSet=[hostX];connectTimeout=1m;maxIdleTime=1m;socketTimeout=1m",
"tracking.contact": "mongodb://[user-name]:[password]@[host1]:[port1],[host2]:[port2]/[guid]-TrackingContact?ssl=true;replicaSet=[hostX];connectTimeout=1m;maxIdleTime=1m;socketTimeout=1m"
},
"ReportingServiceUri": "https://Reporting-[deployment type]-[guid]-[location]-Xdb-Sc.cloudapp.net",
"DeploymentType": "[Prod | NonProd]",
"SitecoreVersion": "[sitecore experience platform version]",
"Location": "[West US | North Europe | Japan East | Australia Southeast]",
"Indexes": {
"sitecore-analytics-cloud-index": {
"Name": "[guid]-analyticsindex",
"BaseUrl": "https://[search service name].search.windows.net/indexes",
"QueryKey": "[query key]",
"ApiVersion": "2015-02-28"
}
},
"XdbCloudVersion": "[1.0 | 2.0]",
"ReportingServiceCertificate": "[certificate thumbprint]"
}
|
How to get connection strings / endpoints of my xDB Cloud Set
Sitecore has provisioned xDB Cloud Set for me. How can I get connection strings and/or endpoints of my xDB Cloud Set?
For example, I want to connect to databases in MongoDB using Robomongo tool.
| |
It is an expected behavior. Sitecore uses publish targets field to determine if the item need to be published to some target, however publishing target field is shared so you can't specify publishing targets depends on language version. And you can select specific language and specific target only in Publish dialog.
You can customize publishing process, in case to add additional field to a publish target item and restrict some languages.
|
Publishing restriction according to language and target
We are still using an old version (6.6).
We have multiple publishing targets (one is a web and the other production) and there is one specific language (Spanish 'es') item we have made publishable to web target by selecting the web target check box in the publishing section.
When we publish the Spanish item, the Spanish language gets published to web target only. But now we added the version of any item in Spanish and publish it to all targets in all languages, the item version in Spanish also gets published to all targets including production even though the Spanish language is not available on the production target, because this is restricted. I have verified this item by switching to that target database. I thought that if we don't have language in one target then the language version of the item would not be published.
Are we thinking right?
| |
'New-SCWebDeployPackage' cmdlet will be available after importing assembly Sitecore.Cloud.Cmdlets.dll
By default, loading an assembly from a network path in PowerShell console is disabled, It can be enabled by creating two PowerShell configuration files:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe.config
C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<runtime>
<loadFromRemoteSources enabled="true"/>
</runtime>
</configuration>
Open new PowerShell console window and import module:
Import-Module "$PSScriptRoot\Sitecore.Cloud.Cmdlets.dll"
|
New-SCWebDeployPackage is not recognized
I'm trying to package a Sitecore solution and followed the instructions mentioned in the following URLs.
https://doc.sitecore.net/cloud/working_with_sitecore_azure/configuring_sitecore_azure/getting_started_with_sitecore_azure_toolkit?roles=developer
https://doc.sitecore.net/cloud/working_with_sitecore_azure/configuring_sitecore_azure/package_a_sitecore_solution_for_the_azure_app_service?roles=developer
I have PowerShell (5.0). I have also updated Azure PowerShell Module 3.1.0
When I run the command Start-SitecoreAzurePackaging with all the options specified in the Sitecore documentation, I get the following error.
The term 'New-SCWebDeployPackage' is not recognized as the name of a
cmdlet, function, script file, or operable program. Check the spelling
of the name, or if a path was included, verify that the path is
correct and try again.
Am I missing something?
| |
Stiecore have a few ways to enable content editing in the Experience Editor. This is not specific to treelist field but can be used for other fields as well like multi list etc.
As alternative to Edit Frames the similar functionality can be implemented quite simply with the help of Custom Experience Buttons.
You can use standard Sample Item template, item based on this template and standard Sample Rendering.
The steps required to take to enable editing a tree list field in the Content Editor are following:
Log in to Sitecore Desktop, switch to "core" database;
Under /sitecore/content/Applications/WebEdit/Custom Experience Buttons create an item based on /sitecore/templates/System/WebEdit/field Editor Button. Name it "Edit List". This button will be referenced by a rendering later;
Fill in the fields of the newly created item: Header - "Edit Address", Fields - pipe-separated list of... - "Address", Tooltip - "Click to edit Address list" and choose an icon for the item;
Save changes;
Switch to "master" database;
Add a tree list field to the /sitecore/templates/Sample/Sample Item template, name it "Address";
Open /sitecore/layout/Renderings/Sample/Sample Rendering item;
Navigate to Experience Editor Buttons section;
Add "Edit List" button to the right side of the Experience Editor buttons section;
Save changes.
Now, when you try to open /sitecore/content/Home item in the Experience Editor, you will notice an additional button when you click on the Sample Rendering area. When you click it, a window with "Address" field will be opened and enabled for editing.
This approach does not require writing any code, thus it's quite convenient to use it with different types of complex fields.
|
Sitecore MVC - Edit Frame for treelist field
We are implementing editframe in sitecore MVC to make treelist field editable (List of address) in experience editor. We have created the Edit button for field in sitecore
core DB and add the field name which need to edit.
"/sitecore/content/Applications/WebEdit/Edit Frame Buttons/Custom Frame Buttons/Treelist Field"
We want to implement Editframe for a field of the type "treelist" in MVC.
Could you give us some code or steps on how to implement it?
| |
This can a tricky situation with a lot of possible soltuions, and I have had to work through this several times before, myself. SXA definitely isn't right for this solution, but one of the below might be.
Pre-Implementation Considerations
Will the client want/need to modify the HTML in the Content Editor, i.e. will they need to modify it on their own
Does the client have experience with HTML, where they can control their HTML as needed, or will an RTE be required?
Will you need to content manage any of the page around the HTML, i.e. will you be using a Sitecore controlled header or footer, etc.
To RTE or Not to RTE
Sitecore Rich Text Editor is great...until it isn't. First off, you should only consider using it if you are going to manage other content on the page. Don't use an RTE for the entire page. From the standpoint of content entry and formatting rich text content, Sitecore's implementation of the Telerik editor does a pretty decent job and even lets you add your own HTML. If you client will need to modify the HTML on their own but doesn't have the HTML knowledge to do this without a GUI then the RTE is going to have to suffice.
However, Sitecore's RTE also has many problems for managing HTML content. First off, the RTE will change your HTML as it sees fit, in order to best approximate what it thinks your editors want. This means that if you have scripts that are dependent on the HTML then you risk those scripts breaking, you could risk your styles being broken or CSS bugs being introduced, and so on. Basically, this works well for a well-defined and bounded section of content being managed for a page with a consistent overall design and structure, but it doesn't work all that well for an entire page being managed.
To @TamasTarnok's point, yes, disabling scripts in your RTE field is a possibility, but it wouldn't be my recommended approach since you can't disable scripts for just those fields that you want to use to store the HTML content of a page. Rather, you have to disable the scripts for all fields. There is a reason why Sitecore disables scripts in this field by default. If you can avoid it, I wouldn't change it. If, however, your client does need the ability to modify the HTML content on their own and cannot do so without an RTE GUI then this option is worth consideration.
The Multiline Text Field Type
The Multiline Text field type would be my recommended approach, if you plan to content manage other components on the page. As with the RTE, don't use an MLT for an entire page. It is meant specifically for what you are looking to do: managing raw HTML/script markup. This field will work great OOTB with no additional modifications, so long as your client either doesn't need to modify the HTML content on their own or else knows HTML well enough to modify the content without a GUI.
With this approach, you are guaranteed that the HTML content you enter in the field will not be modified or manipulated and will be exactly what renders out on the front-end. Additionally, you don't have to make a solution wide change that affects all of your site's RTE fields.
File-System Based Solutions
If you aren't going to be content managing (i.e. controlling components, like the header, footer, etc.) any of the page around the HTML (which I think is the case for your solution) then I would go with a file-system based solution. The idea here is that you already have the HTML files and all you really need to do is upload them to your web root.
I would create a custom admin tool for your Content Authors to upload the files and store them at the desired path. You could even manage the unzipping of the files for only a few minutes (or seconds, if you don't need to look up the System.IO.Compression namespace) of additional effort.
Be sure to keep the following in mind:
If they need to be able to delete HTML files, they should have a mechanism to do that (can simply allow them to specify a path to an HTML file in the root and delete the file at that path)
You may want to have a warning display if they try to overwrite an existing file
If they need to be able to modify the HTML/content at will themselves, and uploading new files to overwrite the old ones isn't a feasible option then this might not be the way to go
If you have scaled environment with separated CM and CD servers, you will need to set up a sync process or have your file upload copy the files to the CD server(s) as well (or something similar)
If you want to support publishing, you will also need a custom mechanism to do so, as well
|
Run HTML site from Media Library
We are in process of migrating the Java Vigenette CMS on to sitecore platform. One of the thing that current content authors have been doing is below for short lived sites:
Get the zipped HTML site from Digital Agencies.
Content authors then simply extract it on CMS and site is up and running. (with no developer involvement)
We had a look at sitecore experience accelerator, which isn't going to fit.
We are thinking of simply unzipping the file on to media library and do and redirect setup.
Has anyone got better idea/experience?
| |
Update 1 has that security issue fixed by default.
In Sitecore 8.2 Update 1, a list of allowed serializable types is included out of the box. You can find the list in the configuration file Sitecore.Analytics.SessionSerialization.config.
Note that the security patch SC2016-001-128003 had the allowed types configured in the configuration file Sitecore.SessionSerialization.config instead (without the Analytics suffix). So if you upgrade your instance to 8.2 Update 1 from an earlier version with the patch applied, you will need to make sure the following files are removed from your solution:
\App_Config\Include\Sitecore.SessionSerialization.config
\bin\Sitecore.SessionSerialization.dll
As well as that the following file is updated with the 8.2u1 version:
\sitecore\service\Analytics\Session\PushSession.ashx
|
Do I need to apply SC2016-001-128003 to 8.2 Update-1?
The article says only Initial Release of 8.2 is affected but doesn't say Update 1 is not vulnerable.
| |
@fcommittees72783 should be a multi-value field because it contains values separated by semicolons (897ad68518d1427c81d5070dfef1869a;1c631b4a5c0342f996d56bd7fb6ed81a)
If a field with semicolons is not multi-value, the index will take that field as a standard string field, not returning results when the document matches only one of those values.
To set this flag, get in the Coveo.SearchProvider.Custom.config and add the following line in the defaultIndexConfiguration node:
<fieldMap type="Coveo.SearchProvider.CoveoFieldMap, Coveo.SearchProvider">
<fieldNames hint="raw:AddFieldByFieldName">
<fieldType fieldName="committees" isMultiValue="true" settingType="Coveo.Framework.Configuration.FieldConfiguration, Coveo.Framework" />
</fieldNames>
</fieldMap>
(You can also add it directly in your Coveo.SearchProvider.Config, but it might get overwritten when updating)
Also, your other fields fz95xpath72783 and falltemplates72783 are already defined as multi-value fields in the fieldMap OOTB.
|
Content does not show in Coveo despite matching criteria
I have a Coveo search view I've customized to show content based on the page you're on matching to whether that value is in a multilist field in Sitecore. The server environment is on-prem CES 7 free version, using version 222 of the Coveo for Sitecore and associated API/CES/etc.
This is my query header:
aq:((@syssource==("Coveo_web_index") NOT @ftemplateid72783==("adb6ca4f-03ef-4f47-b9ac-9ce2ba53ff97","fe5dd826-48c6-436d-b87a-7c4210c7413b"))) (@fhaslayout72783 == "1" AND @fz95xpath72783 == "6377c5571646415ab4922f0f02830104" AND @falltemplates72783 == "9b610063e99f40b6afd5402f5cfaf2d2") (@fcommittees72783 == "1c631b4a5c0342f996d56bd7fb6ed81a")
cq:(@fz95xlanguage72783=="en" @fz95xlatestversion72783=="1")
This query returns no results. I went into the Coveo console and found one of the documents that's supposed to be in this result set, so I know it's in the specified index. The item has no security on it. I looked up the fields that are specified in the query:
@ftemplateid72783 - ca328a29-fbe3-41fc-afc0-dbf8602823e8
@fhaslayout72783 - 1
@fz95xpath72783 - 11111111111111111111111111111111;0de95ae441ab4d019eb067441b7c2450;4c5e4cfbe30b446e917024609ce91722;4a7bb7ee89fb4e02896bfb4e27d1ba57;6377c5571646415ab4922f0f02830104;777fdec3a8da45759797983b9f77f49c;f7e17f6a646d4bc68b6a4f1abb3fdb0c;8e30e4b87e2b405eb7d53922c6c9318d
@falltemplates72783 - ca328a29fbe341fcafc0dbf8602823e8;9b610063e99f40b6afd5402f5cfaf2d2
@fcommittees72783 - 897ad68518d1427c81d5070dfef1869a;1c631b4a5c0342f996d56bd7fb6ed81a
@fz95xlanguage72783 - en
@fz95xlatestversion72783 - 1
So it looks like the content matches the criteria, which leaves me perplexed as to why it's not working right. The folks using the system have said if only one item is selected in the list, it appears to work fine, so is there a different syntax in the buildingQuery statement that I need other than args.queryBuilder.advancedExpression.add('@Model.ToCoveoFieldName("Committees") == "' + pageId + '"');? I was going with that because it worked for the path and "all templates" parameters.
| |
You can update the GlassV3Item.tt file and make use of the Custom Data property in TDS to set whether a field should not be lazy loaded.
Let's add some comments to keep this clean. Add this near the top of the file with the rest of the setting comments (Line 38 on clean tt file)
/*
dontloadlazy=true
Sets the field setting to DontLoadLazily
*/
Add a new method to the end of the file which will check whether the field has the above property set on it in TDS (Line 240 on a clean file):
public static string GetGlassFieldLoadLazily(SitecoreField field)
{
string loadLazy = GetCustomProperty(field.Data, "dontloadlazy");
bool isDontLoadLazy;
bool.TryParse(loadLazy, out isDontLoadLazy);
if (isDontLoadLazy)
return ", Setting = SitecoreFieldSettings.DontLoadLazily";
return string.Empty;
}
Next update the code generation to reference your method and pass through the field settings:
Line 75:
[SitecoreField(<#= AsInterfaceName(template.Name) #>Constants.<#= GetPropertyName(field) #>FieldName <#= GetGlassFieldLoadLazily(field) #>)]
Line 119:
[SitecoreField(<#= AsInterfaceName(template.Name) #>Constants.<#= GetPropertyName(field) #>FieldName <#= GetGlassFieldLoadLazily(field) #>)]
For every field which you wish the setting to apply to, update the properties for that field in TDS and set dontloadlazy=true in Custom Data.
Generate the code for your project and then property will now be added to the generated code.
|
How can I add custom attribute values to my Glass models generated by TDS?
Let's say I have several custom templates in my solution that are managed via a TDS project. There's also code generation set up that creates strongly-typed Glass models based on GlassV3Item.tt.
I want to be able to add custom [SitecoreField] attribute values for some of my template fields.
For example, one of the fields is generated like this:
[SitecoreField(SomeTemplateConstants.TagsFieldName)]
IEnumerable<ITag> Tags { get; set; }
I want to disable lazy loading for this field, so that it's generated like this instead:
[SitecoreField(SomeTemplateConstants.TagsFieldName, Setting = SitecoreFieldSettings.DontLoadLazily)]
IEnumerable<ITag> Tags { get; set; }
I'd like this custom field setting to be configurable via the TDS project.
How can I achieve this?
| |
The solution
If you are sure that the contact currently has a session on the site, then you should NOT release it to the Collection Database.
Instead, you should use this method:
manager.SaveAndReleaseContact(lockedContact);
This will save the contact data back to the Shared Session. All data will be saved to the Collection Database at the end of the session.
Background
ContactManager class uses two storage types underneath:
ContactRepository which works directly with the Collection database;
SharedSessionStateManager which works with the Shared Session.
When you call .TryLoadContact(contactId) and the contact does not have a live session, then the contact will be locked in the Collection DB and loaded into the Shared Session. It is then also locked in the Shared Session so that your current thread can work with the contact exclusively.
If you call .TryLoadContact(contactId) and the contact does have a live session in the same cluster, that means that the contact is already present in the Shared Session (and is locked in the Collection Database). The contact will be locked and loaded from the Shared Session without querying the Collection DB.
At this point, regardless of where the contact was loaded from, it is now in the Shared Session and locked to your thread. You can now update contact data before releasing it.
When you call .SaveAndReleaseContact(contact), the contact is released in the Shared Session, so other threads and members of the web cluster can use it. It is not released in the Collection DB yet - it remains in the Shared Session until it expires.
When you call .SaveAndReleaseContactToXdb(contact), it will be saved and unlocked in the Collection Database. This is not what you want in your scenario, because the web instance should be able to continue working with the contact. This method does NOT remove the contact from the Shared Session, so xDB will assume it still has a lock on the contact. This is why it simply overwrites the data at the end of the session.
Note that there is another override of the last method: .SaveAndReleaseContactToXdb(contactId), which takes a contact ID instead of a contact object. The important difference is that this method WILL remove the contact from the Shared Session before saving it to xDB.
Choosing between the available ways of accessing the contact
If you are in a page request, you should access the current contact via Tracker.Current.Contact.
If your code is not in a page request, but the user may have a live session, use the ContactManager with the methods described above.
If the contact is not in a live session right now, you should use ContactRepository. See an example on how to use it here.
|
Why are custom xDB facets being overwritten on session end?
In our Sitecore 8.1-3 solution I have created a custom xDB facet with a few different elements. When users log in to our site we call Tracker.Current.Session.Identify(emailAddress); to properly identify them. I believe that what happens when we identify a user is that Sitecore gets a copy of their current Contact data and puts it in session. (I may be wrong about this)
Then later on our site if a user does certain things we have some custom code that updates some data in their xDB Contact record. The code that we use to update their xDB Contact record looks like this:
var manager = Sitecore.Configuration.Factory.CreateObject("tracking/contactManager", true) as ContactManager;
var lockResult = manager.TryLoadContact(_contact.ContactId);
switch (lockResult.Status)
{
case LockAttemptStatus.Success:
var lockedContact = lockResult.Object;
lockedContact.ContactSaveMode = ContactSaveMode.AlwaysSave;
//Update the contact
//Marketing Info
var marketingInfo = lockedContact.GetFacet<IMarketingData>("Marketing Data");
marketingInfo.Organization = txtOrganization.Text;
marketingInfo.Industries = txtIndustries.Text;
marketingInfo.ProductTypes = txtProductTypes.Text;
manager.SaveAndReleaseContactToXdb(lockedContact);
break;
case LockAttemptStatus.NotFound:
Log.Info("LockAttempStatus.NotFound", this);
break;
default:
Log.Info("Contact could not be locked", this);
break;
}
So when that code runs it immediately updates the contact record in xDB. I have used RoboMongo to verify this. However what I have noticed is that if I let the user's session expire that the contact record in xDB seems to revert back to the data that was there before. I am guessing that Sitecore keeps a copy of the contact record in session and when the session expires it writes it back to xDB and overwrites the changes that my code made.
Is there a way to prevent this? I am thinking that maybe there is some way after the manager.SaveAndReleaseContactToXdb line of code that I could update the contact data stored in session so that it now has the updated data.
| |
If you look at the source on GitHub - the Sitecore8AppConfigReader.cs file, it does a simple check on the version number:
public override bool IsSupportedVersion(Version version)
{
if (version == null) { return false; }
var min = new Version("8.0");
var max = new Version("8.1");
if (version.CompareTo(min) != -1 && version.CompareTo(max) == -1)
{
return true;
}
return base.IsSupportedVersion(version);
}
So if you want the message to stop, you would need to fork the code and update that class. Obviously you should test that the config reader for 8.2 is still compatible. If not, you will need to create your own config reader for 8.2.
It should still be compatible, so you do have the option of ignoring he message if you just want to wait for Adam to update the source.
|
How to resolve this error when using 'LinqPad Driver for Sitecore' with Sitecore 8.1?
I'm trying to use LinqPad Driver for Sitecore with LinqPad application by connecting to Local Sitecore (version 8.1 Update-1).
However I'm getting below error when trying to test connection.
Test Connection to Sitecore
Connection settings are valid for 8.1.0.151207.
This version of Sitecore is not supported by the currently selected
IAppConfigReader class.
This means that config changes implemented by the IAppConfigReader may
conflict with your version of Sitecore. This will not affect the
Sitecore server, but it may prevent LINQPad from being able to
properly communicate with the Sitecore server.
If you experience problems you may need to implement a new
IAppConfigReader or extend the one currently being used.
[added screenshot below for the same]
How to resolve this warning message?
| |
The tool currently only supports upgrading from 7.2. You'll have 2 options when it comes to upgrading:
Follow the standard upgrade process from Sitecore. You'll need to upgrade in order, so you'll need to follow the upgrade process to go from 8.0 update 2 to 8.1, then from 8.1 to 8.2
Stand up a new 8.2 instance, then migrate you current code and content from your 8.0 instance to the new 8.2 instance.
|
Best way to upgrade from Sitecore 8.0 Update 2 to 8.2 Update 1
I want to upgrade a Sitecore environment ( 8.0 Update 2 to 8.2 Update 1 ).
I recently went to a general Sitecore Presentation and there they mentioned that i could use a new Upgrade tool.
I found this page " https://dev.sitecore.net/Downloads/Express_Migration_Tool/ " where they mention a tool to upgrade from Sitecore 7.2 to 8.2. But it can only be done from Sitecore 7.2 with this tool it seems.
There's also for some reason a empty section about a newer version of the upgrade tool ? ( might be what i'm looking for but there is no information on it now ).
Am i looking at the wrong tool, do you know about an other way to upgrade my Sitecore version. ( Or do i not need an upgrade tool at all for this specific upgrade ? I've never done any Sitecore upgrade at this point )
Any feedback and comments are welcome.
| |
The problem ended up being a typo in my class that disposes the rendering.
The full answer can be seen here: Error Related to GetEnd() Method in a Custom Rendering Wrapper - Sitecore 8.2
|
Custom chrome styling causing XHTML validation issue
I am using Sitecore 8.2 in a Helix configuration and added some custom chrome placeholder styling that I found in the Professional Sitecore 8 Development book. The code works in that I can now see the custom chrome styling, but I am now receiving XHTML validation errors, whereas I wasn't getting these errors before.
I read that HTML5 tags may cause this kind of XHTML error, but the HTML5 tags I'm currently using were not causing this error before I added the chrome styling.
I also searched for the rendering IDs named in each error in the page source and they were each referring to the <code></code> block that I believe contains the Json for each placeholder.
Does anyone know if the tag is not XHTML compliant? If it is, what can I do about this error?
Update: I've also discovered that when I check the Validation tool in the Home tab in the Proofing section from XP Editor, I have numerous warnings like "Warning: Could not find schema information for the element 'html'." and for every other common html tag.
| |
Unlike the Sitecore XP1 and XM1 packages, the XP0 package contains a zip inside the zip.
You need to unpack that zip to your hard drive first (so it directly has the Content folder, and other files directly inside it), then upload it to your BlobStorage. Use the link of that blob in your ARM template parameters, and the install should work fine.
|
Deploy a new Sitecore environment to Azure App Service
Following steps in this link:
I uploaded the standard Sitecore 8.2 rev. 161115 (WDP XP0 package).zip to a newly created azure storage file share and used the link with the SAS token in it in the parameters json (link below altered to prevent package being available to the public).
https://XXXXXXXstorage.file.core.windows.net/wdp/Sitecore%208.2%20rev.%20161115%20(WDP%20XP0%20package).zip?st=2016-12-13T13%3A48%3A00Z&se=2020-12-14T13%3A48%3A00Z&sp=rl&sv=2015-12-11&sr=f&sig=y48hyhmQc9B2alOAve%2BfFLEdO9ETXyMfwmR%2FNDj8XSE%3D
I get the error message below.
This is a newly created azure trial with the $200 credit. I would appreciate it if someone can let me know if anything in the log jumps out at them.
New-AzureRmResourceGroupDeployment : 8:16:20 AM - Resource Microsoft.Web/sites/extensions 'xp0-dev-single/MSDeploy' failed with message '{
"status": "failed",
"error": {
"code": "ResourceDeploymentFailure",
"message": "The resource operation completed with terminal provisioning state 'failed'.",
"details": [
{
"code": "Failed",
"message": "AppGallery Deploy Failed: 'Microsoft.WindowsAzure.Storage.StorageException: Blob type of the blob reference doesn't match blob type of the blob. ---&amp;gt;
System.InvalidOperationException: Blob type of the blob reference doesn't match blob type of the blob.\r\n at
Microsoft.WindowsAzure.Storage.Blob.CloudBlob.UpdateAfterFetchAttributes(BlobAttributes blobAttributes, HttpWebResponse response, Boolean ignoreMD5)\r\n at
Microsoft.WindowsAzure.Storage.Blob.CloudBlob.&amp;lt;&amp;gt;c__DisplayClass18.&amp;lt;FetchAttributesImpl&amp;gt;b__17(RESTCommand`1 cmd, HttpWebResponse resp, Exception ex,
OperationContext ctx)\r\n at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext)\r\n --- End
of inner exception stack trace ---\r\n at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext
operationContext)\r\n at Microsoft.Web.Deployment.WebApi.AppGalleryPackage.IsPremiumApp()\r\n at
Microsoft.Web.Deployment.WebApi.DeploymentController.CheckCanDeployIfAppIsPremium(AppGalleryPackageInfo packageInfo, Boolean&amp;amp; isPremium)\r\nRequest
Information\r\nRequestID:a1fdaf21-001a-0135-0c4b-559fec000000\r\nRequestDate:Tue, 13 Dec 2016 14:15:56 GMT\r\nStatusMessage:OK\r\n'\r\nFailed to download package.\r\nAppGallery Deploy
Failed: 'Microsoft.WindowsAzure.Storage.StorageException: Blob type of the blob reference doesn't match blob type of the blob. ---&gt; System.InvalidOperationException: Blob type of the blob
reference doesn't match blob type of the blob.\r\n at Microsoft.WindowsAzure.Storage.Blob.CloudBlob.UpdateAfterFetchAttributes(BlobAttributes blobAttributes, HttpWebResponse response,
Boolean ignoreMD5)\r\n at Microsoft.WindowsAzure.Storage.Blob.CloudBlob.&lt;&gt;c__DisplayClass14.&lt;GetBlobImpl&gt;b__11(RESTCommand`1 cmd, HttpWebResponse resp, Exception ex,
OperationContext ctx)\r\n at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.EndGetResponse[T](IAsyncResult getResponseResult)\r\n --- End of inner exception stack trace ---\r\n
at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.EndExecuteAsync[T](IAsyncResult result)\r\n at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2
endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at
Microsoft.Web.Deployment.WebApi.AppGalleryPackage.&lt;Download&gt;d__a.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at
Microsoft.Web.Deployment.WebApi.AppGalleryPackage.&lt;Download&gt;d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at
Microsoft.Web.Deployment.WebApi.DeploymentController.&lt;DownloadAndDeployPackage&gt;d__d.MoveNext()\r\nRequest
Information\r\nRequestID:a1fdaf25-001a-0135-0d4b-559fec000000\r\nRequestDate:Tue, 13 Dec 2016 14:15:57 GMT\r\nStatusMessage:OK\r\n'"
}
]
}
}'
At C:\Projects\GitHub\Sitecore.Azure\Cloud.Services.Provisioning.SDK\tools\Sitecore.Cloud.Cmdlets.psm1:78 char:31
+ ... eployment = New-AzureRmResourceGroupDeployment -Name $Name -ResourceG ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet
New-AzureRmResourceGroupDeployment : 8:16:20 AM - AppGallery Deploy Failed: 'Microsoft.WindowsAzure.Storage.StorageException: Blob type of the blob reference doesn't match blob type of the
blob. ---&amp;gt; System.InvalidOperationException: Blob type of the blob reference doesn't match blob type of the blob.
at Microsoft.WindowsAzure.Storage.Blob.CloudBlob.UpdateAfterFetchAttributes(BlobAttributes blobAttributes, HttpWebResponse response, Boolean ignoreMD5)
at Microsoft.WindowsAzure.Storage.Blob.CloudBlob.&amp;lt;&amp;gt;c__DisplayClass18.&amp;lt;FetchAttributesImpl&amp;gt;b__17(RESTCommand`1 cmd, HttpWebResponse resp, Exception ex,
OperationContext ctx)
at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext)
--- End of inner exception stack trace ---
at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.ExecuteSync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext)
at Microsoft.Web.Deployment.WebApi.AppGalleryPackage.IsPremiumApp()
at Microsoft.Web.Deployment.WebApi.DeploymentController.CheckCanDeployIfAppIsPremium(AppGalleryPackageInfo packageInfo, Boolean&amp;amp; isPremium)
Request Information
RequestID:a1fdaf21-001a-0135-0c4b-559fec000000
RequestDate:Tue, 13 Dec 2016 14:15:56 GMT
StatusMessage:OK
'
Failed to download package.
AppGallery Deploy Failed: 'Microsoft.WindowsAzure.Storage.StorageException: Blob type of the blob reference doesn't match blob type of the blob. ---&gt; System.InvalidOperationException:
Blob type of the blob reference doesn't match blob type of the blob.
at Microsoft.WindowsAzure.Storage.Blob.CloudBlob.UpdateAfterFetchAttributes(BlobAttributes blobAttributes, HttpWebResponse response, Boolean ignoreMD5)
at Microsoft.WindowsAzure.Storage.Blob.CloudBlob.&lt;&gt;c__DisplayClass14.&lt;GetBlobImpl&gt;b__11(RESTCommand`1 cmd, HttpWebResponse resp, Exception ex, OperationContext ctx)
at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.EndGetResponse[T](IAsyncResult getResponseResult)
--- End of inner exception stack trace ---
at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.EndExecuteAsync[T](IAsyncResult result)
at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Web.Deployment.WebApi.AppGalleryPackage.&lt;Download&gt;d__a.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Web.Deployment.WebApi.AppGalleryPackage.&lt;Download&gt;d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Web.Deployment.WebApi.DeploymentController.&lt;DownloadAndDeployPackage&gt;d__d.MoveNext()
Request Information
RequestID:a1fdaf25-001a-0135-0d4b-559fec000000
RequestDate:Tue, 13 Dec 2016 14:15:57 GMT
StatusMessage:OK
'
At C:\Projects\GitHub\Sitecore.Azure\Cloud.Services.Provisioning.SDK\tools\Sitecore.Cloud.Cmdlets.psm1:78 char:31
+ ... eployment = New-AzureRmResourceGroupDeployment -Name $Name -ResourceG ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet
New-AzureRmResourceGroupDeployment : 8:16:20 AM - Template output evaluation skipped: at least one resource deployment operation failed. Please list deployment operations for details. Please
see https://aka.ms/arm-debug for usage details.
At C:\Projects\GitHub\Sitecore.Azure\Cloud.Services.Provisioning.SDK\tools\Sitecore.Cloud.Cmdlets.psm1:78 char:31
+ ... eployment = New-AzureRmResourceGroupDeployment -Name $Name -ResourceG ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet
New-AzureRmResourceGroupDeployment : 8:16:20 AM - Template output evaluation skipped: at least one resource deployment operation failed. Please list deployment operations for details. Please
see https://aka.ms/arm-debug for usage details.
At C:\Projects\GitHub\Sitecore.Azure\Cloud.Services.Provisioning.SDK\tools\Sitecore.Cloud.Cmdlets.psm1:78 char:31
+ ... eployment = New-AzureRmResourceGroupDeployment -Name $Name -ResourceG ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet
| |
The solution I am currently considering is to have a h1-text on the landing page Sitecore item itself. When the components are rendered the Hero controller will take this h1-text, wrap the Hero image in a h1 tag and use the h1-text as the Hero image alt tag.
Before doing this it will check to see if there are any other Hero renderings present on the page. If there are and if this Hero rendering are higher up in the stack then it won't render the h1 around the Hero and it won't change the alt-text of the image.
In the original question I said that a Hero rendering would not always be present on the landing page. But I could use the same approach in the other renderings as well, so the controller of each rendering will scan to see if an eligible h1 rendering has already been added and if so just do nothing. Otherwise it would wrap the image of the eligible h1 rendering in a h1 tag and set the alt-tag of the image to the h1-text. This would ensure that a h1 tag is always present on a landing page.
It may be a bit of a complicated solution, but as I said I cannot have h1 tags hidden by CSS or have a h1 tag visible on the page.
|
One H1 tag on a landing page built by loosely coupled renderings
We are building a landing page which only consists of loosely coupled renderings in an atomic design. The first rendering is usually a "Hero" component but not always. The Hero component can potentially be present multiple times on the landing page as it is a loosely coupled rendering that can be used on other pages as well.
I need to stick a h1 tag on the landing page, but because the page itself is empty and it only consists of one placeholder and loosely coupled renderings I am not sure where to put it. All the renderings that make up the landing page have images on them and I want to wrap one of these images in a h1 tag and give the image an alt-text. According to people who know more about SEO than me that is an acceptable way of doing it. The design does not allow for a visible h1-text and I cannot just hide a h1 tag through CSS as search engines would punish the website for doing that, so it needs to be displayed in an image alt tag wrapped in a h1.
So I need to ensure that the h1-tag is displayed once and only once per landing page, but it doesn't matter where it is placed as long as it is present.
Surely, this is a very common scenario when working with loosely coupled components, so I am curious to know how other people have solved this problem?
| |
One possible solution is to create a rule that runs either on:
item:open if user shouldn't be able to read the item if denied editing access
item:lock if user shouldn't be able to lock and edit if denied editing access
item:saving allow user to make changes but not save if denied editing access
etc.
The rule's condition and action logic would read similar to the following (shortened for readability on SSE)
when current item is descendant of item with the Shared Content Library template
and when current user does not have write access to all uses of current item
Deny user access to item and display "Editing permission denied..." message
In order to do this, you would need the following:
Event Handler to run the rule
Rule Settings items (with necessary rule context folders, definitions, tag(s), element folders, etc.)
Custom condition to check ancestors of the current item to see if any are "Shared Content Library" items
Custom condition to check datasource dependencies of the current item to see there are any that the user doesn't have access to. There are many ways to do this: you could use a powershell script; you could run the Sitecore.ContentSearch.Pipelines.GetDependencies pipeline (depending on your implementation and version); etc.
Custom action that calls a command to display an error message to the author that explains why they cannot edit the item
Performance Consideration
The biggest problem is that this could seriously slow down the Sitecore Client and heavily impact the Content Authoring experience, so you should should strongly consider caching the output of each of the custom conditions.
|
Dynamic User Permissions for Shared Datasource Items
Due to a recent mishap, our client is requesting that when a Content Author tries to edit an item we first check to see if the item is used as a datasource for any items that the Content Author does not have permission to edit, and deny editing (write/delete/rename) permissions if so.
Does anyone know a good way to do this?
Note: I added my working idea as a possible solution, but I'm not super happy with it right now. It's a lot of effort and I am very concerned about the performance toll that it will take.
Sitecore Architecture
In the Sitecore architecture at a site level, there are two locations where I store rendering datasources:
Page Content Library (PCL): under the page item; page-specific datasources that are not used by any other page
Shared Content Library (SCL): under the site item; site-specific datasources that can be shared by renderings on multiple pages
Visual Example of the Issue
Consider the following Sitecore tree structure:
|- MySite
|--+- Global Settings
|--+- Shared Content Library
|--|--+- Banners
|--|--+- Headlines
|--|--+- Callouts
|--|--|--+- My Shared Callout * Dynamically deny permissions to this item
|--|--+- ...
|--+- Home * "My Shared Callout" used; no edit permissions
|--|--+- Page Content Library
|--|--|--+- Banners
|--|--|--+- Headlines
|--|--|--+- Callouts
|--|--|--+- ...
|--|--+- About * shared datasource used; has edit permissions
|--|--|--+- Page Content Library
|--|--|--|--+- Banners
|--|--|--|--+- Headlines
|--|--|--|--+- Callouts
|--|--|--|--+- ...
|--|--+--+- ...
Note that the callout component, "My Shared Callout", is shared by a rendering on both the Home page item and the About page item. Note also that in this example, the specific content author doesn't have permission to edit the Home page item but does have permission to edit the About page item.
In this example, in order to allow the Content Author to edit all of the content for the About item, he must have permission to edit shared datasource content in the Shared Content Library. However, if a particular datasource is used by a rendering on a page item that the Content Author doesn't jave permission to edit, then this would mean that the Content Author could edit content for a page that (s)he does not have permission to edit.
| |
private void FillInUserData(Control control)
{
foreach (Control child in control.Controls)
{
if (child is BaseControl)
{
if (child is InputControl)
{
InputControl field = (InputControl)child;
if (((BaseControl)child).ControlName.Equals("Email Address"))
field.Text = UserSession.EmailAddress;
}
}
}
}
I figured this syntax out by debugging:
|
Filling In WFFM Form Field When Field Title Is Translated
I have a function to fill in a user's first name, last name and email address when they are logged into our web site. But, now that we have translated our pages into dozens of languages, a bug has come up. When the field name is translated from English, it is not found and the field is not populated. Other than adding each of the foreign languages to the conditional statement, is there a way to fix this bug by using the item name instead of the title?
private void FillInUserData(Control control)
{
foreach (Control child in control.Controls)
{
if (child is BaseControl)
{
if (child is InputControl)
{
InputControl field = (InputControl)child;
if (field.Title.Equals("Email Address"))
{
field.Text = UserSession.EmailAddress;
}
}
}
}
}
| |
Instead of linking to an item with an id parameter, instead link to the full item URL with sc_mode=edit parameter set, e.g.
{cmsHost}/path/to/item-page?sc_lang={itemLanguage}&sc_version={itemVersion}&sc_mode=edit
The user will be redirected to the login page with the correct returnUrl parameter and then correctly redirected back to the item in Experience Editor mode after successfully logging in.
|
How to deep link into Experience Editor so that user is redirected after login?
We have a case where we need to notify approvers when a page is sent for approval.
In the notification email, I want to include a link so that the approvers can go directly to the page in the Sitecore Experience Editor (version 8.1-Update 1). If they are not logged in, they should naturally get the login form and then be redirect the the requested page.
We have done something similar before with the Content Editor using a URL on the format:
{cmsHost}/sitecore/shell/Applications/Content%20Editor.aspx?id={itemID}&fo={itemID}&la={itemLanguage}
If the user is not logged in, they are redirected to /sitecore/login with a returnUrl parameter that points to my link. After logging in, the user is automatically redirected to the correct page in the Content Editor.
For the Experience Editor, I tried to use the URL format:
{cmsHost}/?sc_itemid={itemID}&sc_lang={itemLanguage}&sc_version={itemVersion}&sc_mode={mode}
This works fine when the user is logged in, but when the user is not logged in, the request is simply redirected to /sitecore/login without the returnUrl parameter.
After some digging it looks like the returnUrl is added specifically in the Content Editor code (and a few other applications), but there is no such logic in the Experience Editor.
I did find a configuration setting called Authentication.SaveRawUrl that felt promising:
Specifies whether the original request URL is passed to the login page
(saved in 'url' query string parameter).
Setting this to true did indeed add a url parameter when Sitecore redirects the user to the login page. However, there are a few issues:
There is no built-in support for actually redirecting the user after logging in (like for the returnUrl parameter).
Linking to the Content Editor will redirect to the login form with both the returnUrl and the url parameters.
The url is also encoded twice for some reason (I'm guessing this is a bug?).
I can see a few different possible work-arounds, but non is very appealing:
Write another processor for redirecting after login (using the url parameter)
Patching or rewriting the SaveRawUrl functionality to set the returnUrl
Linking to a custom handler that checks if the user is logged in and redirects accordingly
Quite frankly this feels like a fairly standard feature that should work uniformly out-of-the-box?
Is there a preferred way of doing this sort of external deep links to the Experience Editor?
| |
Using the code below, you can get comments from all workflow states of any particular item version:
Sitecore.Workflows.WorkflowEvent[] workflowHistory =
Database.WorkflowProvider
.GetWorkflow(item)
.GetHistory(item);
string workflowComments = "";
foreach (Sitecore.Workflows.WorkflowEvent work in workflowHistory)
{
workflowComments += string.Join(",", work.CommentFields["Comments"]) + " ";
}
Note that I am not using work.Text, as that field is obsolete. work.CommentFields should be used instead. This new property has added so that you can extend it to add additional fields for custom comment data.
|
How to get workflow comments?
We have items which are associated with worfklow. This workflow has different states like draft, reviewed, approved. Whenever it is moved to next state, we enter the comments. We need to get all these comments whenever item is published and then we have to send it through email.
Is there some way to get all the workflow comments for item?
| |
There is a command "item:checkout".
<command name="item:checkout" type="type=Sitecore.Shell.Framework.Commands.CheckOut,Sitecore.Kernel"/>
Use patch instead to override the command.
<command name="item:checkout" type="Sitecore.Custom.Commands.MyCheckOutCommand, Sitecore.Custom" patch:instead="command[@type='type=Sitecore.Shell.Framework.Commands.CheckOut,Sitecore.Kernel']"/>
Here is a command. Try something the same.
[Serializable]
public class MyCheckOutCommand : Sitecore.Shell.Framework.Commands.CheckOut
{
public override void Execute(CommandContext context)
{
var item = context.Items[0];
Database db = item.Database;
IWorkflow workflow = db.WorkflowProvider.GetWorkflow(item);
WorkflowState state = workflow.GetState(item);
if (Sitecore.Context.User.IsInRole("[roleName]") && workflow.WorkflowID == "[WorkflowID]" && state.StateID == "[StateID]")
{
item.Versions.AddVersion();
}
base.Execute(context);
}
}
|
How to enable auto versioning on review-edit button?
I've created a custom workflow .As per workflow when it is in final state, the workflow will not kick off unless user create a new version and clicks on edit.
Question:
Is there a way to enable auto version creation on click of
Review-Edit?
Also I m looking at option to enforce auto creation
irrespective of user role. I want this auto creation should be
implied to administrator or any logged in user to cms system.
Any help. Let me know if any clarification required.
| |
Long shot.. can you try disabling access to below item in core db for the user role and verify if this solves your problem.
|
Disable database switching in sitecore backend
A customer of ours asked if it is possible to fix the account they are using in the sitecore backend (Experience Editor, Centent ediror, Media library, ...) to only the master database.
Our accounts should still be able to access the web, but theirs shouldn't
| |
Be sure to use the MVC Form rendering rather than the Web Forms version, which is just named Form. The Web Forms version of the rendering is not supported for use with FXM. See the documentation: Add an MVC form to an external website with FXM
|
WFFM form through FXM
I am trying to place a WFFM form on 3rd party(HTML) site using FXM. The form is getting rendered successfully on 3rd party site. However, the form submission is not working properly. Upon submit, it is being redirected to the beacon URL(.../sitecore/api/ssc/Beacon/Service/beacon/trackPageVisit/...), which is resulting some JSON.
Also it is posting to /sitecore modules/web/Web Forms for Marketers/Tracking.aspx (For validations and etc) on 3rd party site and is returning a 404.
Has anyone come across this issue?
| |
As Sitecore logging is just a wrapper on top of log4net, you should create an appender (and maybe logger) in your code (assuming that the "processor" you mention is some custom code). I found this solution on stackoverflow, but didn't test it myself. It is using the log4net api to create a FileAppender and set its properties. After creating the appender, you must add it to the logger you want to use for writing logs.
|
Sitecore Custom Logger where each item represents its own log file
There are many articles how to create your own logger and save a log file into a separate folder. I need something else.
My items represent the processors. It means I can click the button on the ribbon and run associated process by item id. Here is what I want to get.
When process is started, the new log file should be created where file name is \Data\logs[customfolder][itemid][timestamp].txt
Even process is finished and I run it again a new log file should be created.
Do you have an idea or solution how to implement it?
| |
Background
The thing to keep in mind is that wildcard items are just regular items. When Sitecore resolves the item to use in a page request, if the URL looks like a path, Sitecore will descend through that path in the content tree until it finds the right item. The only thing special about wildcard items is that they will match any value for the corresponding portion of the URL.
Specifying a path in the URL is not the only way to render an item. For example, in your case, instead of using this URL:
http://localhost/products/234/productName
You could access the same item like this:
http://localhost/?sc_item={product-wildcard-item-id-here}
You could also extend, or even completely override Sitecore's path resolution logic by implementing custom <getItem> and <resolvePath> pipeline processors. Then you'd be able to access the same item based on an arbitrary URL, e.g.
http://localhost/product-234-productName
For these reasons, Sitecore context is very decoupled from the algorithms of path resolution.
Answer
There are no built-in means of getting wildcard parameter values from the URL.
Luckily, it's very easy to do this manually:
int segmentCount = this.Request.Url.Segments.Count();
var productId = this.Request.Url.Segments[segmentCount-2].Replace("/", string.Empty);
var productName = this.Request.Url.Segments[segmentCount-1].Replace("/", string.Empty);
With some sanitization and error handling added, this is the way to go for you.
|
Getting Id from wildcard page urls
We are using sitecore wildcard pages of 2 level down.
Products
productId*(wildcard item)
productName*(wildcard item)
We don't have products in sitecore repository. Its coming from 3rd party API.
Now, from URL : http://localhost/products/234/productName
On Context Item is there an easier way to get "234" other than myself manipulating url string to get 234.
wondering whether sitecore has stored this information some where in context
| |
You can do this by changing the security on the application in the core database. The Role Manager located here: /sitecore/content/Applications/Security/Role Manager. The default security on it has /sitecore/content/Applications/Security/Role Manager with read permission:
You could add a new role that only has read permissions for this application and not any of the other security applications, or you could remove read access from the Sitecore Client Account Managing role.
As for only managing certain roles, that would have to be done via a custom application, there is nothing out of the box that will do that AFAIK.
|
Is it possible to limit the "sitecore\Sitecore Client Account Managing" role?
Is it possible to limit the sitecore\Sitecore Client Account Managing role?
Our client has a team that manages security accounts on their site and they are requesting a "limited" sitecore\Sitecore Client Account Managing role that would limit the user to managing roles only (i.e. not access rights), and if possible only certain roles.
If this isn't possible, we can create a custom admin tool for this. I'd just rather support the built in GUIs than my own, if possible.
| |
Because Sitecore templates can inherit from multiple base templates, layout deltas cannot be used in a sensible way as they can be between a template and a page item. So Sitecore lets a standard value come through a base template, but I'm not sure how it chooses which value to use if more than one base template standard values has their own presentation settings. If you edit the presentation settings on a template, it first copies the value that it is inheriting and breaks the association to the standard value.
This problem has been addressed in several different ways. The Sitecore Experience Accellerator has Composite Renderings, Partial Designs and Page Designs. Other accellerators have implemented Placeholder Fallback. I created a project called Base Layouts. The common theme with all of these different solutions is that presentation settings are moved away from the template standard values.
|
Inheritance between templates
My question is the same as previously asked here with no answer. We have a bunch of page templates with same header/footer, etc. The idea was to create a base template which would contain all of the renderings related to header and footer, and for all of the pages to inherit from this template dynamically, but I ran into some issues with the implementation.
I.e. I created the required base template A which contains rendering a in the presentation details of its Standard Values item. Then this template B inherits from A and includes an additional rendering b (also in the presentation details of its Standard Values item). I expect pages based on B to contain both a and b's content. However, when I edit A, i.e remove a or change its settings, there's no changes in B (unless I regenerate the presentation details of B's Standard Values item, which is something I want to avoid as it also purges b and all its configuration).
Is there a way to make this inheritance relationship more dynamic? or maybe altogether a better approach to template inheritance?
| |
The simplest way would be to separate the navigation from the content structure. So create your navigation to work from a Datasource root item that defines how your nav is built. Each item can then contain fields for the text and link.
Then build your content tree as you want your Url's to be set. So your content tree would then look something like:
sitecore
-content
--Website
// this is your datasource content
---Local Content
----Navigation
-----groceries
------fruits (this is just a folder and not a page)
-------apple
-----electronics (this is just a folder and not a page)
------radio
// these are your page items
---fruits
-----apple
---electronics (this is just a folder and not a page)
-----radio
Now your navigation hierarchy does not have to follow your page/url structure. This is a common way to build site navigation.
|
Creating seo friendly URLs
The tree structure is as below, and was built so, according to the navigation menu UI design:
sitecore
-content
--Website
---groceries
----fruits (this is just a folder and not a page)
-----apple
---electronics (this is just a folder and not a page)
----radio
The current URLs are:
www.example.com/groceries/fruits/apple
www.example.com/electronics/radio
But the recommended SEO URLs are
www.example.com/fruits/apple
www.example.com/electronics/radio
Also, when end user browses www.example.com/groceries, it should redirect to www.example.com/fruits/apple
There is no consistent pattern compared to the Menu and how the SEO URLs should be.
I would like to know the procedure/approach to achieve this kind of URL mapping.
using Sitecore 8.2 with MVC
| |
On App Center documentation I found :
The Start Date of the Commitment Period
When you sign up for a commitment period, you must pay for the remainder of the current month plus
the selected commitment period.
For example, if you sign up for 10,000 emails with a three months commitment on August 15th, you
must pay for the remaining 16 days of August plus the three months of September, October, and November.
The total number of emails available in that period is 35,161 emails — equivalent to the remaining 16
days of August — 5,161 emails, plus 10,000 emails per month for September, October, and November.
The following 3 months will be at the normal price and volume. The renewal period starts on
December 1st — this is also known as the renewal date.
Important
If you only want to pay for the commitment period, you must sign up on the last day of the previous
month. For example, if you only want to pay for September, October, and November, you must sign up on August 31.
https://sdn.sitecore.net/upload/sdn5/products/sac/getting_started_with_sitecore_app_center_20-a4.pdf
My recommendation is to contact a sale guy from your region.
|
What does 'commitment period' mean in Sitecore IP Geolocation Service?
What commitment period means in Sitecore IP Geolocation Service?
Is it auto-renew or manually need to renew?
Do they send email alerts, when the lookups are exhausted or when commitment period is over?
I tried to look about this in Sitecore documentation here but it seems not much information is available.
We are using Sitecore 7.5 update-2 if that matters.
| |
As it turns out, there is actually a Sitecore setting that controls whether or not Sitecore should check security on each node when rendering the tree. If set to false, all nodes are shown and the error message that I described in my post is displayed if/when a user tries to open an item they do not have read access to.
<!--
CONTENT EDITOR CHECK SECURITY ON TREE NODES
Determines if the content editor checks the security settings on subitems
when rendering the tree. Setting this to false may increase performance.
Default value: true.
-->
<setting name="ContentEditor.CheckSecurityOnTreeNodes" value="true"/>
While the default value of this setting is true, in my case it turns out that one of the devs disabled this setting for sake of performance on their local environment and accidentally committed the change.
|
Can I exclude items that the current user doesn't have Read access to from display in the Content Tree?
I have removed Read access to some items for certain a Role. The problem is that I can still see the items that I removed access to in the tree, when logging in as a (non-admin) user with the role that I denied Read access on.
When I click on the item that I removed Read access to, I get a "selecting item could not be found" error message.
Some of the users on this site are only allowed access to a specific sub-tree/set of pages, which makes the display of these items without read access and the popup message pretty jarring.
Is there any way for me to exclude items that the current user does not have Read access to from display in the Content Tree?
UPDATE:
Note that I did not explicitly deny Read access to the items, but rather removed the existing read access from inheritance, so that the access is denied, by default.
Version Used: Sitecore 8.1.2
Before you mark this as a duplicate, please note... I have read this similar post but the only answer does not support multiple roles, where one (with read access) should see the items in the tree and another (without read access) should not. Based on the comments on the one answer provided, I believe that the question was originally asked differently and then clarified to be similar to mine, which may have resulted in less attention and fewer answers being posted.
| |
It's added by an HttpModule. In the system.webServer/modules section of the web.config.
<add type="Sitecore.Web.XFrameOptionsHeaderModule, Sitecore.Kernel" name="SitecoreXFrameOptionsHeaderModule" />
Interestingly, this is appears to be new to 8.1 update 3, but it is not mentioned in the release notes.
|
Does Sitecore add X-Frame-Options: SAMEORIGIN?
I have a Sitecore 8.1 Update-3 solution. We have some simple ASPX files that we are trying to use as part of a Facebook application. Apparently the Facebook application displays the pages in an iFrame. And apparently somehow our pages are getting the X-Frame-Options: SAMEORIGIN header added to the response. I cannot figure out where that is coming from. And because of that header these pages cannot be displayed in a Facebook iFrame.
Does anyone know why this is happening? Is this a Sitecore issue? Or is it something deep in IIS or the machine config or something? It is driving me crazy. I have been able to go in to IIS and add a second X-Frame-Options header with the value of "ALLOW_FROM https://facebook.com". But that doesn't solve the problem. That just creates 2 headers and it still won't display the page in an iFrame.
I can't figure out if this is a Sitecore problem or an IIS problem.
| |
You can use a RollingFileAppender instead of the default Sitecore one and configure it to roll by date.
You can find samples in the log4net config examples section of the documentation.
Specifically with Sitecore, change the appender(s) to the following:
<appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender, Sitecore.Logging">
<file value="$(dataFolder)/logs/log" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<maxSizeRollBackups value="30" />
<datePattern value=".yyyyMMdd'.txt'" />
<staticLogFileName value="false" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%4t %d{ABSOLUTE} %-5p %m%n" />
</layout>
<encoding value="utf-8" />
</appender>
file : The name of the file to log to. Note that we supplement this using below settings.
rollingStyle : The format to roll each file on. This causes a new file to be generated per day.
datePattern : The suffix to add to the file each time it is rolled. Note that the file extension is included here in single quotes. See this previous answer for more details.
staticLogFileName : If set to true then the latest log file will always have the same name, but note that due to your file value there is no file suffix so the would just be called log with the above settings.
The files will now be generated in format log.yyyMMdd.txt.
|
Change the name of the output log file
I am trying to modify the output name that is defined by appender in "Sitecore.config"
<file value="$(dataFolder)/logs/log.{date}.txt"/> specifically {date}
Every time I start a new instance of Sitecore, during the same day it creates a new file with different processID.
example:
log.20161214.txt
log.20161214.123456.txt
log.20161214.484151.txt
log.20161214.789914.txt
I would like to have all the logs for that one day to be in one "log.yyyDDmm.txt".
Is there a way to modify a log4net output? Or maybe there is another solution?
I am using Sitecore 8.1
| |
Following what I found and based on my problem has been solved:
After double check the error log, I found the following error
ManagedPoolThread #19 2016:12:15 02:14:48 ERROR Cannot parse the time interval specified in the 'IntervalTokeep' option to the desired format 'hh:mm:ss' for the CleanupEventQueue agent. The value specified in the DaysToKeep option will be used instead – the specified value is '1' days. The specified value in the IntervalToKeep option is ''.
Which is according to the following, is a Sitecore bug:
https://community.sitecore.net/developers/f/8/t/1636
Also, I updated my configuration a little as mentioned in the following:
https://community.sitecore.net/developers/f/9/t/373
Now I have more than 34000 record in the mentioned table.
|
Rebuild Reporting Database with Custom Aggregation Processors
I'm rebuilding the reporting database after completing upgrade from 7.5 to 8.1 update 1 according to the following documentation:
https://doc.sitecore.net/sitecore_experience_platform/setting_up__maintaining/xdb/server_considerations/walkthrough_rebuilding_the_reporting_database
After a while of clicking on "Start" button on sitecore/admin/RebuildReportingDB.aspx the rebuild completed,
My issue that I'm using custom aggregator processors to pull data from MongoDB and add these data to custom SQL tables in the reporting database and when checking these tables they have data less than the data in the primary reporting database.
I checked the log files and there are no errors related, Is there any setting that should be added, Is there a time interval that should be set other than the time interval for clearing secondary database tables?
Following are more details:
I'm tracing page events like click on a banner rendering, this is saved to MongoDB, then I'm using the following to get these data into SQL:
public class PageEventProcessor : AggregationProcessor
{
protected override void OnProcess(AggregationPipelineArgs args)
{
Assert.ArgumentNotNull(args, "args");
try
{
var fact = args.GetFact<PageEvent>();
foreach (var page in args.Context.Visit.Pages)
{
foreach (var pEvent in page.PageEvents)
{
var eventkey = new PageEventKey
{
EventId = pEvent.PageEventDefinitionId,
Date = args.DateTimeStrategy.Translate(pEvent.DateTime),
ItemId = pEvent.ItemId,
PageId = page.Item.Id
};
var eventValue = new PageEventValue
{
Count = 1
};
fact.Emit(eventkey, eventValue);
}
}
}
catch (Exception ex)
{
Log.Error("Error in PageEventProcessor.OnProcess", ex, this);
}
Log.Info("PageEventProcessor.OnProcess - end", this);
}
Following are the table schema in SQL:
CREATE TABLE [dbo].[Fact_PageEvent](
[Date] [smalldatetime] NOT NULL,
[EventId] [uniqueidentifier] NOT NULL,
[PageId] [uniqueidentifier] NOT NULL,
[ItemId] [uniqueidentifier] NOT NULL,
[Count] [int] NOT NULL)
In addition in the secondary database table I have 181 record while in the old database I have more thank 16000 record!
| |
Ok I finally found my mistake. Since I am using DbTemplates, the DbLinkField needs to be added to the template first.
db.Add(new DbTemplate("t1", t1_TemplateId)){
new DbLinkfield("theField")
});
db.Add(new DbTemplate("T", T_TemplateId)
{
BaseIDs = new[] { t1_TemplateId}
});
db.Add(new DbItem("root")
{
new DbItem("child1")
{
new DbItem("siteRoot")
{
new DbItem("Home")
{
new DbItem("Article")
},
new DbItem("Data")
{
new DbItem("theItem", ID.NewID, T_TemplateId)
{
new DbLinkField("theField")
{
Anchor = "anchor",
Class = "class",
LinkType = "linktype",
QueryString = "querystring",
Target = "target",
TargetID = targetid,
Text = "text",
Title = "title",
Url = "url",
},
new DbLinkField("otherfield")
}
}
}
}
});
|
Problem retrieving FakeDb DbLinkField attributes
db.Add(new DbTemplate("t1", t1_TemplateId));
db.Add(new DbTemplate("T", T_TemplateId)
{
BaseIDs = new[] { t1_TemplateId}
});
db.Add(new DbItem("root")
{
new DbItem("child1")
{
new DbItem("siteRoot")
{
new DbItem("Home")
{
new DbItem("Article")
},
new DbItem("Data")
{
new DbItem("theItem", ID.NewID, T_TemplateId)
{
new DbLinkField("theField")
{
Anchor = "anchor",
Class = "class",
LinkType = "linktype",
QueryString = "querystring",
Target = "target",
TargetID = targetid,
Text = "text",
Title = "title",
Url = "url",
},
new DbLinkField("otherfield")
}
}
}
}
});
And then I try to get the values:
Item theItem = db.GetItem("/sitecore/content/root/child1/siteRoot/Data/theItem");
LinkField theField = theItem.Fields["theField"];
All attributes defined are missing...
What am I doing wrong?
| |
This error (as well as many other errors) happens because of a mismatch between the used and the targeted versions of ASP.NET MVC binaries.
Sitecore 8.2 uses version 5.2.3.0 of the following assemblies:
System.Web.Mvc
System.Web.Http
System.Web.Http.WebHost
System.Net.Http.Formatting
System.Web.Http.Cors
You need to make sure that you have the version 5.2.3.0 of these assemblies:
for corresponding DLLs residing in your bin folder
in Web.config under configuration > system.web > compilation > assemblies
in the redirects in Web.config under configuration > runtime > assemblyBinding, for example:
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" xmlns="urn:schemas-microsoft-com:asm.v1" />
<bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0" xmlns="urn:schemas-microsoft-com:asm.v1" />
</dependentAssembly>
in installed NuGet packages
in references of all of your Sitecore projects
in Web.config files (if you have any) under /Views and /Areas/*/Views, for example:
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
...
<pages
validateRequest="false"
pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<controls>
<add assembly="System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
</controls>
</pages>
You also need to ensure that the target framework in all of your projects, as well as in Web.config, is set to 4.5.2.
The error should be fixed after you perform the steps above.
|
Glass Mapper problem with solution upgraded from Sitecore 8.1 to 8.2
We have updated our base solution which just contains a few example renderings from Sitecore 8.1 to 8.2. Note: we are still using VS 2013, but I don't think this should be any problem?
I have updated the references and I think I've tried just about everything in terms of removing and re-adding references, deleting readding and updating Nuget packages.
In my Views whenever I use Glass Mapper editable e.g.
@Editable(Model.DataItemModel, x=>x.HeaderText)
I'm getting x=>x.HeaderText underlined with this error:
Error 4 Cannot convert lambda expression to type
'System.Linq.Expressions.Expression<System.Func<Project.Entities.HeaderSettings,object>>'
because it is not a delegate
type c:\Projects\SitecoreMVC\Code\SitecoreMVC\Project.Web\Views\Shared\_Header.cshtml
I can't figure out what has changed. Can anyone help?
| |
Methods like @Html.Action(), @Html.RenderAction etc. apparently requires a route with the {controller}/{action} pattern (even though it isn't actually relevant from what I can see).
The config file Sitecore.Speak.Mvc.config contains such a route. Although the route is Sitecore specific it does contain the {controller}/{route} pattern.
However, the Sitecore.Speak.Mvc.config should be disabled on CD, Processing and Reporting servers (according to Sitecore's Config Enable-Disable documents).
To solve the problem you should be able to just add a bogus route to the route table manually (like in a standard ASP.NET MVC solution) containing the {controller}/{action} pattern. Just make sure it is something that would otherwise never get matched by a real URL on your site.
Something like this (in the initialize pipeline):
RouteTable.Routes.MapRoute(
"Bogus-Required-Route",
"bogus-required-route/{controller}/{action}",
);
|
InvalidOperationException: No route in the route table matches the supplied values
I've recently deployed a SC 8.1 update 3 site to production (seperate CM and CD) and on the CD side I'm getting this error:
Server Error in '/' Application.
No route in the route table matches the supplied values.
Description: An unhandled exception occurred.
Exception Details: System.InvalidOperationException: No route in the route table matches the supplied values.
Source Error:
Line 14: <meta charset="utf-8" />
Line 15: <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />
Line 16: @Html.Action("Metadata", "Metadata")
Line 17: <meta name="viewport" content="width=device-width" />
Line 18: <!-- END: Meta Data -->
Source File: D:\Apps\Sitecore\Website\Views\Website\Layouts\Default.cshtml Line: 16
Stack Trace:
[InvalidOperationException: No route in the route table matches the supplied values.]
System.Web.Mvc.Html.ChildActionExtensions.ActionHelper(HtmlHelper htmlHelper, String actionName, String controllerName, RouteValueDictionary routeValues, TextWriter textWriter) +651
System.Web.Mvc.Html.ChildActionExtensions.Action(HtmlHelper htmlHelper, String actionName, String controllerName, RouteValueDictionary routeValues) +114
ASP._Page_Views_Website_Layouts_Default_cshtml.Execute() in D:\Apps\Sitecore\Website\Views\Website\Layouts\Default.cshtml:16
System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +253
System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +148
System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +122
System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData) +137
Sitecore.Mvc.Presentation.ViewRenderer.Render(TextWriter writer) +343
Why isn't the Sitecore MVC routing picking this up? (I'm not using any custom routings btw.)
I haven't come across this in any other environments (dev/test/qa) and I'm currently pulling my hairs out why this is happening. I've spent the last day looking into differences between the environments but I think I'm staring myself blind on this one.
| |
While you cannot avoid changing the actual web.config file that will appear in the published /website folder of your site, you can make it so that you do not actually change the OOTB web.config file provided by Sitecore in your solution, by using config XDT Transforms.
If your goal is maintainability, and upgradability then this is the option for you.
Using XDT Transforms to insert your new handler
Include a copy of the OOTB web.config file in your solution (which you could optionally make into a read-only file or just mandate that developers shouldn't change it).
Add a transform file for the web.config file, which you can optionally nest under the web.config (e.g. web.transformed.config; some versions of VS require extensions to nest files with expand/collapse, e.g. the SlowCheetah extension, but that is OOS for this post).
Set your transform files to actually transform on build (using VS build configurations, SlowCheetah, build events, or any number of other options) or on deployment to your build server (e.g. TeamCity) as a custom build step
Add the necessary configuration to your nested transform file, including your new handler, with the necessary XDT Transform(s)
Your config transform (e.g. web.transformed.config) for this change would probably look something like the below (untested):
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<system.webServer>
<handlers>
<add verb="*" path="project_sitemap.ashx" type="Project.Web.Handlers.Sitemap, Project.Web" name="project_sitemap" xdt:Transform="Insert" />
</handlers>
</system.webServer>
</configuration>
Note that in the above, I used xdt:Transform="Insert" to add the new handler into the config.
Transform Strategizing
There are multiple ways to organize and execute your config transforms, and the strategy that you choose should help you determine how to name your transform files and what to include in each.
OOTB, Visual Studio supports transforms applied on build for each build configuration. The default build configurations for each solution in VS are DEBUG and RELEASE. You can add web.DEBUG.config and web.RELEASE.config transforms to be executed on build for the corresponding build configuration (i.e. if building in DEBUG mode then the web.DEBUG.config transform will be applied, where as if building in RELEASE mode then the web.RELEASE.config transform will be applied).
In contrast, Sitecore's config-patching feature is an example of a custom transform strategy that is executed on application start up. Conceptually, you could create a similar strategy that runs on build for all build configurations, wherein all configs that are configured as transforms would execute on build, regardless of naming, and you could use the names to identify the contents of the transform file rather than the build configuration that the transform file is applied for.
The sky is the limit with XDT Transforms, so start simple and figure out which strategy is best for you.
|
Adding new sitecore handler to web.config
This question is related to this but not exactly the same.
From sitecore's recommendation its not good to modify the actual config files and always do it by patching.
I want to add a new hander which i cannot do it from patches as it should be added in web.config?
<add verb="*" path="project_sitemap.ashx" type="Project.Web.Handlers.Sitemap, Project.Web" name="project_sitemap" />
How can i add above line to <handlers> section with out modifying the default's sitecore web.config file. As this web.config file might be different in new version.
Sitecore version: 8.1 update 3
| |
An alternative would be a custom Data Mapper that replaces the standard SitecoreFieldImageMapper. You could then set a default image for every empty field.
However I think that a custom extension to GlassHtml, e.g RenderImageWithPlaceholder, would be a better solution.
|
GlassMapper Render Image with placeholder image
If image field is null or empty @RenderImage does not render the <img> attribute.
Is there a way to tell GlassMapper's @RenderImage to use default placeholder image if no image exists or comes from sitecore?
Can we set this configuration sitewide?
| |
Your idea is similar to the way that I used to perform upgrades before TDS. The below is the strategy that I used to use, which I call the "Hybrid-Clean Upgrade Strategy":
Hybrid-Clean Upgrade Strategy
Identify your upgrade path (all the versions that you will need to "pass through" as you iteratively upgrade to your target version) and set your current solution (everything but your databases) aside for later
Back up your databases with a unique name that includes the Sitecore version (don't overwrite existing backups)
Download a clean instance of the current Sitecore version in your upgrade path (the one your instance is currently on) and install it on your machine
Set the clean databases for the downloaded instance aside, back up the clean instance's configs to a zip (with a name containing the Sitecore version) and connect your existing databases to the clean instance
Install the Sitecore update package to update to the next version in your upgrade path on your newly set up instance (clean instance connecting to your existing databases). You can skip all manual steps for the file system, configuration, etc., except for those that require database schema changes, database script executions and/or other content changes that will be stored in the database
Delete the newly upgraded instance's website, keeping only the clean databases (set aside for later), the backed up clean configs (set aside for later), and your existing databases
Repeat steps 2-6 until your existing databases have been upgraded to the target version
At this point, you should have a clean copy of the databases for each instance in your upgrade path, as well as your existing databases (now upgraded to the target version), and backups of them from each step along the way. Set your existing (upgraded) databases aside for later, along with their backups (don't delete the backups until you are finished and certain that the entire upgrade was successful)
Back up the current state of your solution to a zip with the Sitecore version number in the name, and/or commit its current state to a source control repository/branch with the Sitecore version number in the commit comment (or tag name, etc. - just make sure you can identify the Sitecore version at each revision)
Now go back to your solution and connect it to the clean Sitecore databases (the ones you set aside, earlier) for the version that it is currently on
Install the update package to upgrade your solution to the next version in your upgrade path
Follow all of the manual steps, except for those that involve database schema changes, database script executions, or other content changes that will be preserved in the database
Now compare the configs in your solution to the clean configs for the new current version (I recommend either KDiff3 or WinMerge, but you can use whichever diff-viewer your heart desires). Make sure that everything matches up with what you would expect to see. If anything is awry, fix and test before continuing
Repeat steps 9-13 until your solution has been upgraded to the target version
Connect your upgraded solution to your upgraded databases, both of which should be at the targeted version
Test, test and test some more!
What you should end up with
At this point, you should have all of the following:
Upgraded solution
Upgraded databases
Backup of upgraded solution for each version in upgrade path
Backup of upgraded databases for each version in upgrade path
Copy of clean configs for each version in upgrade path
Testing
Given what you have at the end, you can now test to make sure that your solution is working in the target version and if not you can test each version that you upgraded to in the upgrade path to find out where things went wrong and fix them for each subsequent version.
If desired, you can optionally modify the strategy and run both the database and solution upgrades at the same time, reconnect them after each version upgrade and test before upgrading to the next version. I usually don't do this, unless something went wrong (which is rare), in which case I simulate this with my backups.
Pros
Speed: because either the databases or the website is always clean, each update packages installs a bit quicker than it would otherwise (though still slower than a fully-clean instance). You can start the upgrade for the databases while you set up the upgrade for the solution, so that they both run at the same time. Depending on the complexities of your databases and your solution, you may want to alternate which you do first, based on the amount of time each takes
Reduced errors: since either the databases or the website is always clean, you have less errors on each update to go through, and there are also less errors thrown by Sitecore for things that it didn't expect/doesn't recognize
Upgrade record: you have a historical record of the upgrade process and the state of your solution at each step along the way. You can stand up an instance of the historical state of your site at any version in the upgrade path that you might need, on demand with little to no effort.
Cons
At the end of the day, you are still running each update package twice
Requires more hard-drive space
Improving the Hybrid-Clean Upgrade Strategy with TDS
When performing a Sitecore upgrade using the Hybrid-Clean Upgrade Strategy TDS can cut the time and effort required for the upgrade down by almost half!
Changes to the Upgrade Strategy
If you have TDS, you can ignore the entire database side of the upgrade and simply serialize your existing (old) Sitecore databases using TDS and then deserialize them into a clean copy of the databases for your targeted version of Sitecore.
Changes to Testing Procedures
If you want to test at each step along the way, or if you need to roll back to retest at a particular version in your upgrade path, don't fret about not having copies of the databases at those versions! TDS can help with that too! All you would need to do is the same thing that you are planning to do at the end of the upgrade: attach a clean copy of the databases at the desired version, point TDS at them and deserialize your site tree into those databases. You should now be ready for testing.
Additional Considerations
If you are using Sitecore membership then you may need to come up with an upgrade/migration strategy for users, which may mean running the upgrade with clean master and web databases but your existing core database
If you are using analytics then you may need to come up with an analytics upgrade/migration strategy
|
Possible Upgrade Strategy
I'm wondering about a certain Sitecore Upgrade strategy.
It seems like i have 2 options to upgrade:
Perform all the upgrade actions manually ( at the very least time-intensive )
Create a new instance and migrate the data from one instance to an other.
I've been told that the second option can hold some unforeseen consequences because of the different designs of the db tables.
My idea: ( Take best of both worlds ? )
Copy current databases
Apply sql changes described in the upgrade manuals ( CMSxx_BeforeInstall.sql )
Create a new Sitecore instance ( with the new version ) and hook it up with the newly changed database tables.
Any comments and feedback are more than welcome.
Edit: In this case i want to upgrade from Sitecore 8.0 Update 2 to Sitecore 8.2 Update 1
| |
I was able to figure this one out, with the help of Tamás Tárnok above. The solution was to add [SitecoreType(TemplateId = "Your_Sitecore_Template_Id")] to the implemented class. More information is below.
https://stackoverflow.com/questions/18974495/glass-mapper-and-creating-sitecore-items-using-interfaces
|
Glass Mapper Item Creation issue
(I'm using Sitecore 8.1 Update 3 with Glass Mapper.Sc version 4.1.1.66)
I'm trying to get items to be created in Sitecore through Glass Mapper. We can get content items just fine right now.
But when I try to save, I get this error:
Item does not have a Template ID or Branch ID.
I have verified that object is code has a Template Id.
This is what our property map looks like for the base item (where TempalteID resides):
public override void Configure()
{
Map(config =>
{
config.AutoMap();
config.Id(m => m.Id);
config.Info(m => m.Name).InfoType(SitecoreInfoType.Name);
config.Info(m => m.DisplayName).InfoType(SitecoreInfoType.DisplayName);
config.Info(m => m.Path).InfoType(SitecoreInfoType.Path);
config.Info(m => m.Url).InfoType(SitecoreInfoType.Url);
config.Info(m => m.FullPath).InfoType(SitecoreInfoType.FullPath);
config.Info(m => m.TemplateName).InfoType(SitecoreInfoType.TemplateName);
config.Info(m => m.TemplateId).InfoType(SitecoreInfoType.TemplateId);
config.Field(f => f.Sortorder).FieldName("__Sortorder");
});
}
Here's what the call to Create looks like:
using (new SecurityDisabler())
{
resultItem = _sitecoreContext.Create(parentItem, contentItem, true, false);
}
Any ideas why I'm getting that error?
EDIT: Here's the interface with the templateid attribute.
[SitecoreType(TemplateId = "{DAF085E8-602E-43A6-8299-038FF171349F}")]
public interface IAssetUgcImageModel : IAssetUgcMediaModel
{
string Alt { get; }
}
| |
I think you should Try disabling .config file of any additional modules in your Sitecore instance. Since it's possible that some module is built by old WebEditCommand which was in Sitecore.Client.dll whereas in Sitecore 8 it's moved in Sitecore.ExperienceEditor.dll as suggested here https://sitecore.stackexchange.com/a/2464/172
|
Could not load type 'Sitecore.Shell.Applications.WebEdit.Commands.WebEditCommand'
I am working on a Sitecore 8.1 site. I was given a zipped package with the Website folder in it and I am trying to get it set-up on our Development server.
The website itself works fine and I can log into the Sitecore admin where I can view the Sitecore Experience Platform home page. The problem is that clicking on any of the following Sitecore applications results in a Server Error in '/' Application with the exception described below:
Content Editor
Experience Editor
Media Library
Workbox
Recycle Bin
Access Viewer
Domain Manager
User Manager
Security Editor
Role Manager
Desktop
Exception Details:
System.TypeLoadException: Could not load type 'Sitecore.Shell.Applications.WebEdit.Commands.WebEditCommand' from assembly 'Sitecore.Client, Version=8.1.0.0, Culture=neutral, PublicKeyToken=null'
Stack Trace:
[TypeLoadException: Could not load type 'Sitecore.Shell.Applications.WebEdit.Commands.WebEditCommand' from assembly 'Sitecore.Client, Version=8.1.0.0, Culture=neutral, PublicKeyToken=null'.]
System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type) +0
System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase) +60
Sitecore.Reflection.ReflectionUtil.CreateObject(String assembly, String className, Object[] parameters) +64
Sitecore.Shell.Framework.Commands.CommandManager.ReadCommands() +662
Sitecore.Shell.Framework.Commands.CommandManager..cctor() +68
[TypeInitializationException: The type initializer for 'Sitecore.Shell.Framework.Commands.CommandManager' threw an exception.]
Sitecore.Shell.Framework.Commands.CommandManager.GetCommand(String name) +0
Sitecore.Web.UI.WebControls.Ribbons.Ribbon.FillParamsFromCommand(CommandContext commandContext, RibbonCommandParams ribbonCommandParams) +62
Sitecore.Web.UI.WebControls.Ribbons.Ribbon.GetCommandParameters(Item controlItem, CommandContext commandContext) +79
Sitecore.Web.UI.WebControls.Ribbons.Ribbon.RenderLargeButton(HtmlTextWriter output, Item button, CommandContext commandContext) +78
Sitecore.Web.UI.WebControls.Ribbons.Ribbon.RenderButton(HtmlTextWriter output, Item button, CommandContext commandContext) +398
Sitecore.Web.UI.WebControls.Ribbons.Ribbon.RenderChunk(HtmlTextWriter output, Item chunk, CommandContext commandContext) +345
Sitecore.Web.UI.WebControls.Ribbons.Ribbon.RenderChunk(HtmlTextWriter output, Item chunk, CommandContext commandContext, Boolean isContextual, String id) +244
Sitecore.Web.UI.WebControls.Ribbons.Ribbon.RenderChunk(HtmlTextWriter output, Item chunk, CommandContext commandContext, Boolean isContextual) +161
Sitecore.Web.UI.WebControls.Ribbons.Ribbon.RenderChunks(HtmlTextWriter output, Item strip, CommandContext commandContext, Boolean isContextual) +421
Sitecore.Web.UI.WebControls.Ribbons.Ribbon.RenderStrips(HtmlTextWriter output, Item ribbon, Boolean isContextual, ListString visibleStripList) +1917
Sitecore.Web.UI.WebControls.Ribbons.Ribbon.RenderStrips(HtmlTextWriter output, Item defaultRibbon, Item contextualRibbon, ListString visibleStripList) +162
Sitecore.Web.UI.WebControls.Ribbons.Ribbon.Render(HtmlTextWriter output) +800
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +80
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +160
System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +11828405
System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +47
Sitecore.Web.FormAdapter.Render(HtmlTextWriter writer) +76
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +116
System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer) +50
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +160
System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +47
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +80
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +160
System.Web.UI.Page.Render(HtmlTextWriter writer) +39
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +80
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +8921
| |
This is a pretty common business-case in Sitecore multi-site projects, and fortunately there is pretty good support for cross-site links OOTB. If what you need isn't available OOTB or if it isn't working the way that you want then it's pretty straight-forward and low-effort to customize the solution to your needs. See below for details:
Enabling SiteResolving for your Solution
Make sure that in your config, you have the Rendering.SiteResolving setting enabled. It should look like the below:
<setting name="Rendering.SiteResolving" value="true" />
This setting tells Sitecore that it should try to resolve the correct site for the links that you enter, including in the RTE fields.
Matching and Resolving hostName and targetHostName
In addition, if you are doing any wildcard (*) or pipe (|) matches on the hostName attributes of your <site> configuration nodes, then make sure that you specify the targetHostName of each site, or else Sitecore will not be able to resolve the correct host name (without the asterisk wildcard) to add to the link.
In your case, you might have something like the following:
<site name="site1" hostName="*site1.com" targetHostName="www.site1.com" ... />
<site name="site2" hostName="www.site2.com|site2.com" targetHostName="www.site1.com" ... />
Forcing the LinkProvider to Respect Rendering.SiteResolving
Note that in some cases, Sitecore may not respect the value of the Rendering.SiteResolving setting, and may require modifications to the LinkProvider in order to get it working.
For example, the following (untested) code from Paul Martin's blog post (linked below) can be used to force the LinkProvider to respect the SiteResolving setting for all GetItemUrl calls:
public class LinkProvider : Sitecore.Links.LinkProvider
{
public override string GetItemUrl(Item item, UrlOptions options)
{
string itemUrl;
//other code
options.SiteResolving = Sitecore.Configuration.Settings.Rendering.SiteResolving;
itemUrl = base.GetItemUrl(item, options);
//other code
return itemUrl;
}
}
Additional Information
Sitecore Multisite, Part 4: Cross-Site Links by John West
Sitecore links in multisite solutions - SiteResolving by Brian Pedersen
Using cross site links.. aka dynamic links (part 1) by Paul Martin
|
Cross-site links not resolving correctly in RTE fields on multi-site environment
We have two sites www.site1.com and www.site2.com. We are having problem when trying to create cross site relative links in RTE field.
For example. In RTE field of site2 site, if we insert a relative link of an item related to site1 site, it doesn’t resolve the proper URL according to site1 URL customization. For example, item having Physical Path as Sitecore/Home/Site1/Global Content/Profiles/A/Adam, is being resolved as www.site1.com/adam. But when we use this item in site2 as a relative link it doesn’t resolve the URL.
In config, we also have configured two different sites.
Please suggest what can be possible issue?
| |
Please verify that your patch file is patching correctly. Since you do not see it in your showconfig.aspx, most likely your patch file is not configured correctly.
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<linkManager>
<providers>
<add name="sitecore">
<patch:attribute name="type">Sitemap.Custom.CustomLinkProvider,Sitemap.Custom</patch:attribute>
</add>
</providers>
</linkManager>
</sitecore>
</configuration>
|
Custom Link Provider is not overriding
We have created an item resolver to maintain Sitecore path on our way. We have inherited LinkProvider to override GetItemUrl method like the below:
public class LinkProvider : Sitecore.Links.LinkProvider
{
public override string GetItemUrl(Item item, UrlOptions options)
{
//Some Code Implementation
return base.GetItemUrl(item, options);
}
}
We have added our own config file with name custom_config.config in include folder but we are unable to use our own override method. I checked showconfig.aspx also, but this is showing me the OOTB LinkProvider type Sitecore.Providers.LinkProvider instead of the one which we have created.
| |
The problem here is that 301/302 redirects are handled by the browser (or more specifically, by the XMLHttpRequest object) transparently. This means that your success handler will be called only when the browser issues a second request and loads the page it was redirected to.
So you should not attempt to use redirect response codes in AJAX calls. Instead, I suggest that you return a custom object containing the redirect URL:
return Json(new { redirectUrl = someUrl });
And then manually redirect using JavaScript:
$.ajax({
url: "/api/sitecore/Products/RedirectPage",
type: "POST",
data: { currentItemGuid: '{100-100-100}'},
context: this,
dataType: "json", // this is important
success: function (data) {
if(data.redirectUrl) {
window.location.href = data.redirectUrl;
}
},
...
});
|
Redirecting to another item in an AJAX request
I am using Sitecore 8.2 with MVC.
I am trying to perform a page redirect, but my code isn't working.
I'm calling an MVC controller action method from JavaScript using a jQuery AJAX call.
The method is hit and the related items are also present in the content tree. But nothing happens. The current page remains and no redirection occurs. Also, there are no errors or messages in the browser console.
Controller method:
public ActionResult RedirectPage(string currentItemGuid)
{
Item pageItem = Sitecore.Context.Database.GetItem(currentItemGuid);
if (pageItem != null)
{
string pageURL = Sitecore.Links.LinkManager.GetItemUrl(pageItem);
//pageURL = /products/radio
string newURL = pageURL + "-type";
//newURL = /products/radio-type. This item is present in the content tree in the same folder structure.
return Redirect("~" + newURL);
}
else
{
return new EmptyResult();
}
}
JavaScript:
$(function () {
$(".ddlProducts").change(function () {
$.ajax({
url: "api/sitecore/Products/RedirectPage",
type: "POST",
data: { currentItemGuid: '{100-100-100}'},
context: this,
success: function (data) {
console.log("success", data);
},
error: function (data) {
console.log("error", data);
}
});
});
});
| |
In a Sitecore 8, this will:
Cleanup CyclicDependences (items that couldn't be removed by CleanupOrphans because they have a parent but are not in the item tree)
Cleanup InvalidLanguageData (remove all data from items in languages that are not defined as a valid language in the Sitecore system)
Cleanup Fields (delete data from fields -SharedFields, UnversionedFields, VersionedFields- that have no related item anymore)
Cleanup Orphans (delete items that have no parent anymore)
Cleanup Blobs (delete blob fields that have no related field)
Cleanup OrphanFields (clean the field data from the orphans removed in 4)
RebuildDescendants
Clear All Caches
Might be a few things less in older versions, although I don't think it has changed a lot.
|
How does the "Clean up databases" feature work?
In the Control Panel, there is a "Clean up databases" button. How does it work? What operations are carried out during a database cleanup?
| |
I asked a similar question a little while back, about the interop between Sitecore and Unicorn on disk files.
If you have Transparent-Sync on or have your Unicorn.DataProvider.config file configured, then there is a direct relation between Sitecore and the Unicorn serialization files on disk. If you update an item, in a part of Sitecore that is tracked, the changes will be written to disk. If you are not running Transparent Sync or have your Unicorn.DataProvider.config configured (in production scenario). When you run unicorn.aspx again, it move those items to the recycle bin, if they are new. And put them back, if they still exist on disk.
I hope that helps.
|
Does Unicorn pick up database cleanup process and reserialize?
While reading this thread, I investigated if "cleanup databases" will trigger serialization process. I checked log files and nothing related to serialization is logged?
@Dmytro suggested that Sitecore never triggers serialization process.
Does that mean someone who is using Unicorn will get those orphan trees and items back in the next sync? Is it better to reserialize in unicorn.aspx every time we did a database cleanup?
Or does Unicorn pick up the database cleanup task and reserialize automatically?
| |
Analysis and explanation
There are several scenarios that may occur in the code you have posted. Below, I will only analyze the scenario that will lead to the problem you are experiencing.
Contact A is found in the Collection database by its email address:
var contact = _repository.LoadContactReadOnly(Email);
It is returned from the method GetXdbContact and saved to the variable currentContact.
Contact B is loaded by its ID. It is then available as lockResult.Object.
lockResult = XdbContactManager.TryLoadContact(currentContact.ContactId);
As you can see, it is very possible that you can load two different contacts: one by its Email, the other by its ID. While contact A is guaranteed to have an identifier (that's how you found it), contact B may well be unidentified. Obviously, the two contacts in this scenario will be completely unrelated to each other.
Suggested solution
From your code, I can deduce that you are trying to update some contact fields without knowing whether the contact currently has a live session. I propose the following approach to this.
First, create a method that updates a given contact's fields, and does nothing else. We'll use this method to work with contacts that come from the session, from the tracker, or from the database.
public void UpdateContactData(Contact contact)
{
// set contact fields, facets, etc.
}
Then, in a more or less reliable way, you can use the following method to find the contact by its identifier, update its fields, and put it back to whatever storage we found it in:
void UpdateContact(string identifier, Action<Contact> updateMethod)
{
var contactRepository = (ContactRepositoryBase)Factory.CreateObject("contactRepository", true);
var sharedSessionManager = (SharedSessionStateManager)Factory.CreateObject("tracking/sharedSessionState/manager", true)
if (Tracker.Current.Contact != null && Tracker.Current.Contact.Identifiers.Identifier == identifier)
{
// The current contact is the one we need to update.
updateMethod(Tracker.Current.Contact);
}
else
{
// Find out if a contact with the given identifier exists in the database.
Contact databaseContact = contactRepository.LoadContactReadOnly(identifier);
if (databaseContact != null)
{
Guid contactId = databaseContact.ContactId;
// Try to load the contact from the Shared Session.
Contact sessionContact = sharedSessionManager.LockAndLoadContact(contactId);
if (sessionContact != null)
{
// Update this contact and release it back to the Shared Session.
updateMethod(sessionContact);
sharedSessionManager.SaveAndReleaseContact(sessionContact);
}
else
{
// In this branch, we know that the contact we need exists in the database, but it's not locked by our cluster.
// We'll try to lock it and update its data.
LeaseOwner leaseOwner = new LeaseOwner("SOME_UNIQUE_WORKER_NAME", LeaseOwnerType.OutOfRequestWorker);
LockAttemptResult<Contact> lockResult = contactRepository.TryLoadContact(identifier, leaseOwner, TimeSpan.FromMinutes(1));
if (lockResult.Status == LockAttemptStatus.Success)
{
// Update the contact and release it to the Collection DB.
updateMethod(lockResult.Object);
var options = new ContactSaveOptions(release: true, owner: leaseOwner);
contactRepository.SaveContact(lockResult.Object, options);
}
else
{
// Log the inability to lock the contact.
// Decide what else you want to do in that case.
}
}
}
else
{
// In this branch, we know that the contact with the provided identifier does not exist yet.
// You will have to decide what to do in that case. Below is an example where you identify the current contact.
Tracker.Current.Session.Identify(identifier);
updateMethod(Tracker.Current.Contact);
}
}
}
Here's how you can use this method:
string identifier = "[email protected]";
UpdateContact(identifier, UpdateContactData);
|
xDB lockedResult object has an empty identifier
I am having this weird issue with lockResult.object carrying null/empty value for the "identifier" property. Though the lockedResult returns with "success" status and the contact has the identifier value.
var currentContact = GetXdbContact(Email);
if (currentContact == null)
return;
var lockResult = XdbContactManager.TryLoadContact(currentContact.ContactId);
Contact updatedContact = currentContact;
switch (lockResult.Status)
{
case LockAttemptStatus.Success:
var lockedContact = lockResult.Object;
lockedContact.ContactSaveMode = ContactSaveMode.AlwaysSave;
updatedContact = UpdateContact(lockedContact); //my custom method
break;
}
private Contact GetXdbContact(string Email)
{
var contact = _repository.LoadContactReadOnly(Email);
if (contact != null) return contact;
//If null, Identify the current session contact
contact = Tracker.Current.Session.Contact;
Tracker.Current.Session.Identify(Email);
if (contact == null) return null;
contact.Identifiers.AuthenticationLevel = AuthenticationLevel.None;
contact.System.Classification = 0;
contact.ContactSaveMode = ContactSaveMode.AlwaysSave;
contact.Identifiers.IdentificationLevel = ContactIdentificationLevel.Known;
contact.Identifiers.Identifier = Email;
contact.System.OverrideClassification = 0;
contact.System.Value = 0;
contact.System.VisitCount = 0;
return contact;
}
Also, I noticed this is only happening every time I deploy binaries to website root and try to create a contact. Subsequent contacts creation is not having this issue.
Any pointers on why the identifier property is empty?
| |
I tried to find a commit when Habitat when it used to be TDS (https://github.com/Sitecore/Habitat) to no avail. But what you want to do is create a TDS project for each Feature/Foundation/Project. In the same way that their is a Unicorn serialization folder for each Feature/Foundation/Project, you would do the same TDS.
|
How to create TDS projects in Helix setup?
I am working on migrating an existing solution to Helix conventions. The existing solution has TDS projects for Master, Content and Media. How do I set up TDS projects in the newly refactored solution following Helix conventions?
| |
Since you are sure that the contact is currently in a session, you should not read or write anything directly to and from the Collection Database.
You should use the ContactManager like this:
ContactManager contactManager = Factory.CreateObject("tracking/contactManager", true) as ContactManager;
LockAttemptResult<Contact> lockAttemptResult = contactManager.TryLoadContact(contactId);
// the lock attempt will always be successful, no need to check the status
Contact contact = lockAttemptResult.Object;
// ... update the facets
contactManager.SaveAndReleaseContact(contact);
The method SaveAndReleaseContact will release the contact back to the Shared Session. It will be saved to the Collection Database at the end of the session.
Note that when you call contactManager.TryLoadContact(...), the method can only return an unsuccessful lock attempt when the contact is not in the Shared Session and it's being locked in the Collection DB. This is not the case here. Since the contact is already in the Shared Session, it will be successfully returned. If it's currently locked in the Shared Session by another thread, your current thread will just wait until it's released, and you'll be able to work with the contact.
|
How to update a user's xDB contact in a web service call?
We have a Sitecore 8.1 Update-3 instance. We have created custom xDB facets. We have a modal pop-up screen that a user can use to update their custom information. This pop-up screen uses web service calls to pass the information back to the server to be saved.
I can't figure out how to properly save the xDB data in the web service. I believe under normal conditions (like in code behind) if the current user is logged in then my code should update Tracker.Current.Contact with the information. That way all of the contact info will be saved to xDB when the user's session ends. But since this code is running in a web service it doesn't have any access to Tracker.Current.Contact.
I could save it directly to xDB using custom code. But that won't work because I believe that when the person's session ends then the system will write their Tracker.Current.Contact to xDB and it will overwrite the previously saved information.
So how would I save this info to the person's contact record properly from a web service?
| |
This is actually done by design. If you read http://helix.sitecore.net/principles/visual-studio/index.html. You will see that by having one Sitecore Rocks reference, it would create one huge reference, not allowing for the projects to be opened separately. This goes against the approach that Habitat is promoting of "your architecture should always have higher priority than any tools or technology". If we were to take the Habitat design approach and implement it into a large scale enterprise environment, with 60 modules, Visual Studio solution would become sluggish. Habitat is promoting separation of concerns into groupings of business functions.
To solve your specific need of connecting to the full Sitecore instance in a single instance Sitecore Rocks connection, you can still do that while leaving the other csproj.sitecore files in tact.
|
Why does the Habitat sample solution have a Sitecore rocks connection for each project
When browsing through the Habitat solution, I noticed that every project in the solution has a csproj.sitecore file (I assume this is for Sitecore Rocks?). So where we have Sitecore.Feature.Media.csproj we also have Sitecore.Feature.Media.csproj.sitecore this is repeated for every project in the solution as far as I can tell. This seems a bit unnecessary and is annoying when you want to change it to use a different connection as you then get prompted for every single project in the solution. Surely just one connection is enough?
| |
Global.asax is private in 8.2. You will need to move your global.asax code to an initialization pipeline. Thats why your app_start code isn't running.
namespace YourApp
{
public class Initialize
{
public void Process(PipelineArgs args)
{
// app start here
AreaRegistration.RegisterAllAreas();
BundleConfig.RegisterBundles(BundleTable.Bundles);
if (!Tracker.IsActive)
{
Tracker.StartTracking();
}
}
}
public class VersionCount : HttpRequestProcessor
{
public override void Process(HttpRequestArgs args)
{
args.Context.Items["Disable"] = new VersionCountDisabler();
}
}
}
Then your config
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<pipelines>
<initialize>
<processor type="YourApp.Pipelines.Initialize.YourAppStart, YourApp"
patch:before="processor[@type='Sitecore.Pipelines.Loader.ShowVersion, Sitecore.Kernel']" />
</initialize>
</pipelines>
</sitecore>
</configuration>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<pipelines>
<httpRequestBegin>
<processor type="YourApp.Pipelines.Initialize.VersionCount, YourApp"
patch:before="processor[@type='Sitecore.Pipelines.HttpRequest.ExecuteRequest, Sitecore.Kernel']" />
</httpRequestBegin>
</pipelines>
</sitecore>
</configuration>
Other Global.asax functions https://laubplusco.net/global-asax-sitecore-pipelines/
|
Is there something in Sitecore 8.2 that breaks bundling?
I just upgraded our Sitecore 8.1 Update 2 install to Sitecore 8.2 Update 1.
Our solution has utilized MVC bundling since we implemented it a year ago.
But now -- after the upgrade -- bundling no longer works correctly.
The following Nuget packages are installed:
Antlr 3.5.0.2
Newtonsoft.Json 9.0.2-beta1
Microsoft.Web.Infrastructure 1.0.0
Microsoft.AspNet.Web.Optimization 1.1.3
WebGrease 1.6.0
The namespaces in my Global.asax and Global.asax.cs match.
In the head of my layout I have: @Styles.Render("~/bundles/css")
In my App_Start/BundleConfig.cs I have:
bundles.Add(new StyleBundle("~/bundles/css").Include(
"~/assets/css/bootstrap.css",
"~/assets/css/bootstrap-select.css",
"~/assets/css/font-awesome.css",
"~/assets/css/slick.css",
"~/assets/css/app.css",
"~/assets/css/back-to-top.css"
));
bundles.Add(new ScriptBundle("~/bundles/js").Include(
"~/assets/js/navigation.js",
"~/assets/js/bootstrap.js",
"~/assets/js/bootstrap-select.js",
"~/assets/js/handlebars.js",
"~/assets/js/moment-with-locales.js",
"~/assets/js/lodash.js",
"~/assets/js/slick.js",
"~/assets/js/jquery.browser.js",
"~/assets/js/jquery.onmutate.js",
"~/assets/js/js.cookie.js",
"~/assets/js/main.js",
"~/assets/js/jquery.validate*",
"~/assets/js/marketo.js",
"~/assets/js/back-to-top.js"
));
If I view source I see.
There is no ?v=somerandomstring like one would normally see.
The same thing occurs on my JS bundle.
If I add BundleTable.EnableOptimizations = false; to the end BundleConfig.cs file it has zero effect. The same link gets written into the HTML.
This is driving me nuts. Did something in 8.2 break bundling?
UPDATE:
Removing the following from the Global.asax.cs file breaks the site:
protected void Application_BeginRequest()
{
Context.Items["Disable"] = new VersionCountDisabler();
}
My guess is that it is expected code and that my patch is not working / in the right place:
<httpRequestBegin>
<processor type="MySite.Presentation.Pipelines.HttpRequestBegin, MySite.Presentation" patch:before="processor[@type='Sitecore.Pipelines.HttpRequest.ExecuteRequest, Sitecore.Kernel']" />
</httpRequestBegin>
| |
It depend on modules usage. For examples:
1) if you need to set up Wildcard module:
In this way if you have for example breadcrumb feature or for example some search feature should return wildcard specified url you might be able to add your module references to the feature. So in this case the good place would be the foundation layer. Because of direction of dependencies in Helix.
2) If you need to set up WFFM module:
This is the same like we have for wildcard module. You can have some feature which contain a big form. As well as for wilcard module the best place for WFFM would be the foundation layer.
The same for the EXM module.
So as you can see if you need to extend Sitecore Module functionality or use Sitecore Module in another Helix-modules the best way to put it to foundation layer. I think it makes sense because this is something stable and do not depend on another Helix-modules.
You can check it for Habitat here: Habitat foundation layer
|
How to integrate Sitecore Modules in Helix setup?
We are developing a Sitecore application and might need to install some Sitecore shared modules as we move forward. How best I should integrate the source code of these modules if needed? Do I create a separate project for each of these modules under Feature folder?
| |
@phani was right in his comment.
In the Sitecore 8.1 + the Dependency Resolver is used instead of the controller factory.
So, basically you have to set the Default dependency resolver to be the one using castle container.
This is how you define the Castle Dependency Resolver:
public class WindsorDependencyResolver : IDependencyResolver
{
private readonly IWindsorContainer container;
public WindsorDependencyResolver(IWindsorContainer container)
{
this.container = container;
}
public object GetService(Type serviceType)
{
return container.Kernel.HasComponent(serviceType) ? container.Resolve(serviceType) : null;
}
public IEnumerable<object> GetServices(Type serviceType)
{
return container.Kernel.HasComponent(serviceType) ? container.ResolveAll(serviceType).Cast<object>() : new object[]{};
}
}
After that, you should register your dependency resolver like that:
System.Web.Http.GlobalConfiguration.Configuration.DependencyResolver =
new WindsorDependencyResolver(container);
That should work.
|
Castle Windsor on Sitecore 8.2 using Glass Mapper v4
I'm trying to setup Castle Windsor for Dependency Injection in Sitecore 8.2 Solution which is using Glass Mapper v4. As noted, Castle Windsor is no longer part of Glass Mapper, and thus not included. I added it manually, and have setup the Installer, the Windsor Controller Factory, and the Pipeline Initializer for Sitecore
The Windsor Controller Factory:
namespace Web.Plumbing
{
public class WindsorControllerFactory : DefaultControllerFactory
{
private readonly IKernel kernel;
public WindsorControllerFactory(IKernel kernel)
{
this.kernel = kernel;
}
public override void ReleaseController(IController controller)
{
kernel.ReleaseComponent(controller);
}
protected override IController GetControllerInstance(RequestContext requestContext, Type controllerType)
{
if (controllerType == null)
{
throw new HttpException(404, string.Format("The controller for path '{0}' could not be found.", requestContext.HttpContext.Request.Path));
}
return (IController)kernel.Resolve(controllerType);
}
}
}
The Installer:
namespace Web.Installers
{
public class ControllersInstaller : IWindsorInstaller
{
public void Install(IWindsorContainer container, IConfigurationStore store)
{
Sitecore.Diagnostics.Log.Info("Windsor installer got registered", this);
container.Register(Classes.FromThisAssembly().BasedOn<IController>().LifestyleTransient());
container.Register(Component.For<IService>().ImplementedBy<CommonService>());
}
}
}
The Pipeline to Initialize:
namespace Web.Pipelines
{
public class InitializeWindsorControllerFactory
{
public void Process(PipelineArgs args)
{
IWindsorContainer container = new WindsorContainer().Install(FromAssembly.This());
IControllerFactory controllerFactory = new WindsorControllerFactory(container.Kernel);
SitecoreControllerFactory sitecoreControllerFactory = new SitecoreControllerFactory(controllerFactory);
System.Web.Mvc.ControllerBuilder.Current.SetControllerFactory(sitecoreControllerFactory);
}
}
}
And finally, the config to add to pipeline (I just incidentally used glass mapper's patch file to see if it would work)
My Controller is setup as such:
namespace Web.Areas.CastleTest.Controllers
{
public class TestController : Controller
{
ISitecoreContext _context;
ISitecoreService _master;
IService _service;
public ActionResult Index()
{
return View();
}
public TestController(IService srv, ISitecoreContext context, ISitecoreService service)
{
_service = srv;
_context = context;
_master = service;
}
public ActionResult CtrlTest()
{
var model = _context.GetItem<TestTemplate>(RenderingContext.CurrentOrNull.Rendering.DataSource);
return View(model);
}
}
}
The files are definitely getting patched, and the controller factory is definitely getting initialized. The error I am getting is:
[MissingMethodException: Constructor on type 'Web.Areas.CastleTest.Controllers.TestController' not found.]
System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) +1481
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +191
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) +27
Sitecore.Mvc.Helpers.TypeHelper.CreateObject(Type type, Object[] parameters) +44
Sitecore.Mvc.Controllers.SitecoreControllerFactory.CreateControllerInstance(RequestContext requestContext, String controllerName) +213
Sitecore.Mvc.Controllers.SitecoreControllerFactory.CreateController(RequestContext requestContext, String controllerName) +96
I have the feeling that Sitecore is not using WindsorControllerFactory to resolve the controllers. I know there are other ways to replace the default DI container in 8.2, but I need to use the pipeline for now, because I am really trying to debug this for another solution.
| |
Set the useDisplayName attribute on your Link Provider to true. Then you can translate the display names for you items.
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/">
<sitecore>
<linkManager>
<providers>
<add name="sitecore" set:useDisplayName="true"/>
</providers>
</linkManager>
</sitecore>
</configuration>
This was also answered on SO by jammykam: https://stackoverflow.com/a/36941965/2911685
|
Spanish Language Text In Url
I have a client who would like to use spanish language urls. In other words they would like to have www.mydomain.com/los-miembros for the spanish version of www.mydomain.com/members.
Anyone have guidance as to how to accomplish this?
Sitecore 8.2.1
| |
Retrieved from the SDN site
What is the Links Database:
"Sitecore maintains a table named Links in the database specified in the LinkDatabase section of web.config. This table provides a logical links database for all other databases – the links tables in the other databases are empty by default. Data is exposed through the Sitecore.Links.ItemLink class.
No matter how many databases are processed to create the links database, all entries are stored in a single table in the database".
The rebuild process will essentially update those records.
|
How does the “Rebuild link database” feature work?
In the Control Panel, there is a "Rebuild link database" button. How does it work? What operations are carried out during a link database rebuild?
| |
This will be natively supported in Sitecore 9.0, according to the public roadmaps. For now a solution might be to use this module: https://github.com/BasLijten/SitecoreFederatedLogin
See my blog on how to achieve this with Sitecore 9.0: https://blog.baslijten.com/enable-federated-authentication-and-configure-auth0-as-an-identity-provider-in-sitecore-9-0/
I explained completely how this works in my blogpost on federated authentication for Sitecore 8.x: https://blog.baslijten.com/how-to-add-federated-authentication-with-sitecore-and-owin/
|
Does Sitecore support SAML?
I'm aware of and have successfully used the AD module for numerous Sitecore implementations but I have a requirement to support SAML so that a non-AD based authentication provider can be used. Does Sitecore support SAML? If not, are there modules that would allow me to connect to various SSO providers?
| |
Even I faced similar issue..The task would start and hang up with the below message
Starting '05 Sync Unicorn'..
As mentioned above , along with MicroCHAP.dll, I had to unblock other two files (Sync and Unicorn ) to resolve the issue.
|
Sitecore Habitat - GULP is not running sync unicorn task and neither giving any error
In Sitecore habitat project, I am running task '05-Sync-Unicorn' in VS task running explorer but it does nothing and just displays "Starting '05-Sync-Unicorn'" in console (even doesn't produce any error in console).
What can be the possible reasons?
Where can I see GULP tasks log in VS?
| |
Conclusion:
Unicorn data provider is responsible to read/write to file system.
If transparent sync is ON then sync (file system to Sitecore) will happen automatically.
In transparent sync, for items controlled by Unicorn it bypasses the Sitecore database completely. It means file system is treated like the master database.
Sitecore to file system (serialization) will be automatic even if transparent sync is OFF.
Difference in serialization when transparent is sync is OFF and ON is when transparent sync is OFF then we still use the Sitecore databases and unicorn additionally serialized the items to the file system and when transparent sync is ON then item will be directly written to file system as file system behaves as master db.
To stop auto sync, we can remove or disable the Unicorn.DataProvider.config file. This still allows us to use the UI to de-serialize items (Sitecore to file system).
|
Using Unicorn Transparent Sync
I am done with unicorn sync using gulp task provided in Sitecore habitat sample project. I need some clarification on below points.
As per my understating, if transparent Sync is enabled then auto sync (filesystem to sitecore) will happen but not auto serialization (Sitecore to filesystem). Is this possible to auto serialize too?
If I create a new item in Sitecore, will transparent Sync delete that item in sync process as it wont be available in file system till I serialize because the disk is considered the master at all times?
In sync process performed by gulp task in habitat sample project, it has synced the items in master and web both databases. Can I stop syncing to web automatically as I would prefer to publish in web database using Sitecore publish?
| |
This error means there is some unfinished work remaining from previous rebuilds or other data processing operations. There are two ways to fix this:
Cautious approach
The cleanest way is to investigate your logs for errors that prevent the work from being completed. If you find anything, please create a separate question, since it'll be about a concrete data processing issue in your solution.
Once you fix the issues, the work will be finished and you'll be able to run a Reporting DB rebuild.
Radical approach
If you can't find any issues with data processing, or if don't care about any unfinished data processing work -
Back up the MongoDB database corresponding to the analytics connection string in your ConnectionStrings.config.
Drop the RangeMaps collection if it exists:
If you have a standalone database instance, just call this command:
db.RangeMaps.drop()
If the RangeMaps collection is sharded, you'll need to unshard it before dropping.
Drop all Range_* collections in the same way as you dropped RangeMaps.
Drop the AutomationRanges collection.
Drop the HistoryTasks collection.
|
Error when rebuilding the Reporting database: "Cannot initialize when there is work to do"
I have upgraded my Sitecore solution from 7.5 to 8.1 update 1. When trying to rebuild the Reporting database, I am getting the following error in the log files:
7084 2016:12:18 05:26:24 ERROR Exception when executing agent aggregation/rebuildAgent
Exception: System.InvalidOperationException
Message: Cannot initialize when there is work to do
Source: Sitecore.Kernel
at Sitecore.Diagnostics.Assert.IsFalse(Boolean condition, String message)
at Sitecore.Analytics.RangeScheduler.MongoDbRangeMap.Initialize(Guid left, Guid right, Int64 count)
at Sitecore.Analytics.Automation.Aggregation.Data.Processing.AutomationHistoryAggregatorManager.Start(List`1 targetProvidersConfigPaths)
at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at Sitecore.Analytics.Aggregation.History.ReportingStorageManager.ProcessRebuild()
at Sitecore.Analytics.Core.BackgroundService.Run()
Any ideas how to solve this?
| |
Since the Pager listens to the buildingQuery event (according to this), it is probably the one overriding the query.
Try setting it in the doneBuildingQuery event instead.
Moreover, if you don't want a dynamic number of results and only want to set a result per page different from the OOTB offering, you can set it in the Coveo Search component properties with the Number of results per page property in the Paging section. It can also be set directly in the markup of the CoveoSearchInterface using data-results-per-page='10', but this approach that would require you to duplicate the search component since you are modifying the file and don't want your changes to be overridden.
Also, it might not be the case, but if you are trying to create your own ResultPerPage component, Coveo for Sitecore started bundling one OOTB with the 4.0.450 version.
Simply add this tag in your CoveoSearchInterface:
<div class="CoveoResultsPerPage"></div>
|
CoveoForSitecore how to override numberOfResults property
I am trying to override the numberOfResults property in Coveo Search UI before initializing, but doesn't seem to take affect. What could I be doing wrong?
Coveo.$('#@Model.Id').on("buildingQuery", function(e, args) {
if(overrideNumberOfResults){
args.queryBuilder.numberOfResults= 40;
console.log(args.queryBuilder); //shows correct value of 40
}
}).coveoForSitecore("init", CoveoForSitecore.componentsOptions);
Incorrect value when sent to service call. Shows 20 instead of 40.
| |
If you want to use Pagination with Page List or any other Paginable rendering:
EventList
FileList
PageList
EventCalendar
simply parse selected rendering with List Signature rendering parameter
SXA 1.1
It seems right now Pagination rendering works with Page List only so you cannot use it with different renderings (I've got errors on my instance).
|
How to set signature field in pagination & listing components of SXA?
I am trying to configure listing component for example Event list of SXA with pagination, but I am unable to understand the usage of signature field.
List Signature - Signature is used to pair list with pagination component
What is this field used for?
| |
In your project, override the behavior of the follow MSBuild task.
<Target Name="GetCullItemsFromProjectParameters">
By default, this is what TDS is doing (as seen in the .targets file)
<CullItemsFromProjectClass Condition=" '$(IncludeItemsChangedAfter)' != ''">HedgehogDevelopment.SitecoreProject.Tasks.Filters.CullItemsFromProjectByUpdateDate, HedgehogDevelopment.SitecoreProject.Tasks</CullItemsFromProjectClass>
<CullItemsFromProjectParameters>$(IncludeItemsChangedAfter)</CullItemsFromProjectParameters>
Override this with your own functionality that implements
'True' CI with Delta packages would mean extracting the list of .item files that were edited in your branch since the cutoff for the last deployment.
This would have to include all items edited before the last deployment....but were added, edited or merged into the branch since that last cutoff.
You might need to:-
pre-build a list that connects to source control and extracts the list of these files
in your item culling code, read from that list, and only include them in the delta package
An example of how I've done this for Git can be found here:-
http://www.seanholmesby.com/true-delta-deploys-with-tds-classic/
https://github.com/SaintSkeeta/TDS.BuildExtensions.GitDeltaDeploy
https://www.nuget.org/packages/Hedgehog.TDS.BuildExtensions.GitDeltaDeploy
|
Custom TDS Delta Packages
Is it possible to change how TDS decides which items should be added to a TDS Delta Package? At the moment TDS looks at the Updated date of the item but we would like to be able to supply a manifest of items to TDS based on source control check-ins or other criteria.
Has anyone customised TDS in this way?
| |
@Anton pointed me in the direction I needed to go. Long story short, as I was implementing his method and stepping through the code in the debugger, I discovered a typo in my code. After fixing it, Sitecore no longer throws an XHTML validation error.
As for the details, when following the book mentioned above, I created 4 classes.
3 rendering wrapper classes:
EditorRenderingWrapper.cs
AddEditorRenderingWrapper.cs
EndEditorRenderingWrapper.cs
And 1 marker class:
EditorComponentRenderingMarker.cs
I posted the code for the EditorComponentRenderingMarker and AddEditorRenderingWrapper classes above. The EditorRenderingWrapper is a wrapper class and just extends the base Wrapper class. It doesn't add any new code, so I didn't post it.
But the culprit was in the 4th class, the EndEditorRenderingWrapper class.
Here is the code:
using System;
using System.Linq;
using Sitecore.Mvc.Pipelines.Response.RenderRendering;
namespace BankDelen.Cadelam.Foundation.SitecoreExtensions.RenderingWrapper
{
public class EndEditorRenderingWrapper : RenderRenderingProcessor
{
public override void Process(RenderRenderingArgs args)
{
foreach (IDisposable wrapper in args.Disposables.OfType<EditorRenderingWrapper>())
{
wrapper.Dispose();
}
}
}
}
My typo was in the foreach statement. I had accidentally originally written args.Disposables.OfType<EndEditorRenderingWrapper>())
The OfType<T>() method was checking EndEditorRenderingWrapper instead of EditorRenderingWrapper and wrapper.Dispose() was never being hit.
A big thanks to @Anton for helping to improve my understanding of how Sitecore works and helping me find this problem.
|
Error Related to GetEnd() Method in a Custom Rendering Wrapper - Sitecore 8.2
I have been going through the book Professional Sitecore 8 Development by Phil Wicklund and Jason Wilkerson. The book has been very helpful to me but I've got an issue I haven't been able to figure out. In Chapter 11, I've followed the section on Customizing Rendering in the Experience Editor. The code given in the book works, in that I can see the new custom renderings. However Sitecore's JavaScript validation has been throwing XHTML errors for each of my placeholders. After researching and debugging for a while, I found that this is because the GetEnd() method that contains the closing </div> tags executes between the closing <code></code> blocks for the rendering and the placeholder.
Here is my main layout:
@using Sitecore.Mvc
<!DOCTYPE html>
<html lang="@Sitecore.Context.Language.CultureInfo.TwoLetterISOLanguageName">
<head>
<title></title>
<link rel="stylesheet" href="/Content/foundation.sitecoreextensions.css"/>
</head>
<body class="@(Sitecore.Context.PageMode.IsExperienceEditor ? "edit-mode" : string.Empty)">
<header>
@Html.Sitecore().Placeholder("header")
</header>
<main>
@Html.Sitecore().Placeholder("main")
</main>
<footer>
@Html.Sitecore().Placeholder("footer")
</footer>
</body>
</html>
And here is where the custom rendering HTML is added:
using Sitecore.Mvc.ExperienceEditor.Presentation;
namespace Foundation.SitecoreExtensions.RenderingWrapper.Markers
{
public class EditorComponentRenderingMarker : IMarker
{
private readonly string _componentName;
public EditorComponentRenderingMarker(string componentName)
{
_componentName = componentName;
}
public string GetStart()
{
const string formatString = "<div class=\"component-wrapper {0}\"><span class=\"wrapper-header\">{1}</span><div class=\"component-content clearfix\">";
return string.Format(formatString, _componentName.Replace(" ", string.Empty), _componentName);
}
public string GetEnd()
{
return "</div></div>";
}
}
}
And last of all, this is what the rendered HTML looks like, as seen from Developer Tools in FireFox: (just the header component, for brevity)
<header>
<code type="text/sitecore" chrometype="placeholder" kind="open" id="header" key="header" class="scpm" data-selectable="true">
<!-- JSON that Sitecore injected --> </code>
<code type="text/sitecore" chrometype="rendering" kind="open" hintname="Header" id="r_76115221D7FF46D7AAB859A209E1C829" class="scpm" data-selectable="true">
<!-- JSON that Sitecore injected --> </code>
<div class="component-wrapper Header scEnabledChrome" sc-part-of="placeholder rendering">
<span class="wrapper-header">Header</span>
<div class="component-content clearfix">
<div>
<!-- My Rendering -->
</div>
<code type="text/sitecore" id="scEnclosingTag_r_" chrometype="rendering" kind="close" hintkey="Header" class="scpm"></code>
</div> <!-- this div needs to come before the preceding code block -->
</div> <!-- this div as well -->
<code type="text/sitecore" id="scEnclosingTag_" chrometype="placeholder" kind="close" hintname="header" class="scpm"></code>
</header>
As you can see here, the closing </div> blocks are added between the final two <code> blocks.
I believe GetEnd() is behaving exactly as it should in that it executes right after the component is rendered, so it makes sense that it comes right after the <code> block that marks the end of the rendering. However, I don't understand why Sitecore's JavaScript validation throws an error for this. When I modify the HTML from developer tools and move the closing rendering <code> block just after the two closing </div> tags, the error no longer occurs.
I'm not sure how to fix this error. Is it an error with Sitecore's validation? Or should I put the closing </div> tags somewhere else?
Update:
Here is the method to add my rendering. It includes adding to RenderRendering's disposal list.
using Foundation.SitecoreExtensions.RenderingWrapper.Markers;
using Sitecore;
using Sitecore.Mvc.ExperienceEditor.Presentation;
using Sitecore.Mvc.Pipelines.Response.RenderRendering;
namespace Foundation.SitecoreExtensions.RenderingWrapper
{
public class AddEditorRenderingWrapper : RenderRenderingProcessor
{
public override void Process(RenderRenderingArgs args)
{
if (args.Rendered || Context.Site == null || !Context.PageMode.IsExperienceEditorEditing || args.Rendering.RenderingType == "Layout")
{
return;
}
var marker = GetMarker(args);
if (marker == null)
{
return;
}
args.Disposables.Add(new EditorRenderingWrapper(args.Writer, marker));
}
private static IMarker GetMarker(RenderRenderingArgs args)
{
IMarker marker = null;
var renderingItem = args.Rendering.RenderingItem;
if (renderingItem != null)
{
marker = new EditorComponentRenderingMarker(renderingItem.Name);
}
return marker;
}
}
}
EditorRenderingWrapper is simply a class that inherits from Sitecore.Mvc.ExperienceEditor.Presentation.Wrapper and does not add any new code.
And Disposables comes from Sitecore.Mvc.Pipelines.MvcPipelineArgs.Disposables
| |
Answer Based on Comment Thread
Based on your Stack Trace, it appears that while some content items were deleted, potentially, other items needed for the successful operation of the sitecore Powershell Extension module were also removed inadvertently.
Disabling the module, should make the error go away. If that is the case, you might try reinstalling the Powershell Module to see if any items that it needs were accidently removed.
Bulk Deleting of Items
Anytime I am in the process of deleting a bulk sum of items like this, I always make an effort to take a backup of the master and/or web database so that in the event of an issue like this, I can restore to a functional database, and reassess what I'm asking Sitecore to delete. In this case, it seems that it was just the removal of something that Powershell is expecting. However, in your mind, if you are just removing content items it's clear to me that something else was deleted. That begs the question, what else might have been deleted.
Rule of Thumb: Always have backups handy. =)
|
8.1 stopped working after content node deletion. NullReferenceException, Powershell Pipeline Issue?
8.1 won't let us log back in. While attempting to delete a node with ~16k sub-items we couldn't tell whether 8.1 was frozen or still trying to delete. We restarted site/app pool & now can't log in. We get to the login screen but get a server error after the login. Any help/recs are appreciated!
Stack trace:
[NullReferenceException: Object reference not set to an instance of an object.]
Cognifide.PowerShell.Core.Extensions.ItemExtensions.InheritsFrom(Item item, ID templateID) +89
Cognifide.PowerShell.Core.Extensions.ItemExtensions.IsPowerShellModule(Item item) +105
Cognifide.PowerShell.Core.Modules.ModuleManager.EnumerateLibraries(Item library, List`1 dbModules) +217
Cognifide.PowerShell.Core.Modules.ModuleManager.GetDbModules(String database) +305
Cognifide.PowerShell.Core.Modules.ModuleManager.get_Modules() +245
Cognifide.PowerShell.Core.Modules.ModuleManager.GetFeatureRoots(String featureName) +119
Cognifide.PowerShell.Integrations.Pipelines.PipelineProcessor`1.Process(TPipelineArgs args) +134
| |
I think it is still better to do via Javascript. You should be able to disable(hide button) on submit.
mvc form is dynamically reloaded after clicking submit, the button is
immediately reset to enabled
I was not able to find JS code (wffm.js) that immediately reset button to enabled. Form is dynamically changed only on formSubmitError and formSubmitSuccess
$scw('#' + targetId).html(res);
$scw('#' + targetId).html(xhr.responseText);
It means that button could be enabled only when you receive response from server(form actions either succeed or failed).
But there is present code
e.preventDefault()
that could block execution of your JS code that makes button disabled. If my assumption is right you should force your code to be executed before WFFM submit event.
As a last resort WFFM scripts are not uglified and minimized, so you can easily modify them. Scripts are located here: sitecore modules\Web\Web Forms for Marketers\mvc\wffm.js. But you should remember about your modification when you will update WFFM module.
|
Disable submit button on MVC form that has slow action
I have a Sitecore 8.1 WFFM form in an MVC form rendering, with a save action that takes a few seconds to complete. After submitting the form, the user just sees the form page they submitted with no message to show that it is processing, until the server finishes the save actions and redirects to the success page or shows the success message. This seems to be the same regardless of whether the Is Ajax Mvc Form checkbox is selected or not for the WFFM form.
During this wait the user might try resubmitting the form again, which I need to prevent.
Example code for a slow save action is:
using System;
using System.Configuration;
using Sitecore.Data;
using Sitecore.WFFM.Abstractions.Actions;
using Sitecore.WFFM.Actions.Base;
namespace Sitecore.Custom.Forms.SaveActions
{
public class SlowSaveAction : WffmSaveAction
{
public override void Execute(ID formId, AdaptedResultList adaptedFields, ActionCallContext actionCallContext = null, params object[] data)
{
System.Threading.Thread.Sleep(8000);
}
}
}
I have tried editing the default FormViewModel.cshtml with javascript to disable the submit button after the form is submitted (which works in pre-mvc versions of WFFM), but because the mvc form is dynamically reloaded after clicking submit, the button is immediately reset to enabled.
I have also looked in the Sitecore.Forms.Mvc.ViewModels.FormViewModel model for any value that might identify that the form is submitted and validation passed, but couldn't find anything.
Is there some way to disable the submit button whilst the form is processing? Or perhaps as an alternative, hide the button and show a 'processing' message?
| |
Please configure the following setting which by default is false. You need to set it true.
<setting name="Media.UploadAsVersionableByDefault" value="false" />
If you set it to true, item will be created only in one default language version. This media item will use a versioned template /sitecore/templates/System/Media/Versioned/File template and if it is false, then it will use /Sitecore/templates/System/Media/Unversioned/File template and create media Item in all those languages which exist under /Sitecore/system/languages.
|
Multiple media items getting created in languages
We need to apply the workflow on media items. We are having one problem is that whenever a media item is uploaded in media library, versions are created for all the languages which we have added in language section and the items also show up in workflow for each version language.
How to change this behavior?
| |
We had the exact same issue as well with Lucene indexes. Sitecore was able to provide a patch for the SitecoreItemCrawler class. It doesn't appear to be on their Github so I can't link it but ask for support DLL 108165.
The issue is fixed in Sitecore 8.2 Update 1
|
Issue with multiple crawlers on Solr custom search index
I have custom search Index(SOLR) which has two root locations defined, one points to /home node and another points to repository(videos), we also have indexing strategy(onPublishEndAsync) in place.
<locations hint="list:AddCrawler">
<crawler type="Sitecore.ContentSearch.SitecoreItemCrawler, Sitecore.ContentSearch">
<Database>web</Database>
<Root>path to home node</Root>
</crawler>
<crawler type="Sitecore.ContentSearch.SitecoreItemCrawler, Sitecore.ContentSearch">
<Database>web</Database>
<Root>path to repository items</Root>
</crawler>
</locations>
Problem which i am observing is- item from the second root location is not getting indexed(in this case repository items), if i move this to first, it index the repository items and not items under home node.
However, if i rebuild the index manually from indexing manager, everything works as expected.
Anyone have thoughts here? what is missing here to make sure indexing strategy works with multiple roots as well.
I am using Sitecore 8.1 (rev. 160302)
| |
As far I see you have 2 sites with same structure.
On your Datasource you make a small mistake, your query must be :
query:./ancestor-or-self::*[@@templatename='Site']/Data/FolderHeWantsToChose
A droptree is pointing to an item not to childs of an item.
Please see Datasource Properies of class Sitecore.Shell.Applications.ContentEditor.Tree (this is used for Droptree) :
public string Source
{
get
{
return StringUtil.GetString(new string[]
{
this._source
});
}
set
{
Assert.ArgumentNotNull(value, "value");
if (!value.StartsWith("query:", StringComparison.InvariantCulture))
{
this._source = value;
return;
}
Item item = Client.ContentDatabase.GetItem(this.ItemID);
if (item == null)
{
return;
}
Item item2 = item.Axes.SelectSingleItem(value.Substring("query:".Length));
if (item2 == null)
{
return;
}
this._source = item2.ID.ToString();
}
}
|
Droptree with multiple datasources
I have a drop tree and my client wants to be able to have the possibility to choose from two folders. We have a multi site and the structure looks like this:
Site 1
Data
FolderHeWantsToChose
Site 2
Data
FolderHeWantsToChose
I have tried something like this:
datasource=/sitecore/content/Site 1/Data/FolderHeWantsToChose&
datasource=/sitecore/content/Site 2/Data/FolderHeWantsToChose
and
/sitecore/content/Site 1/Data/FolderHeWantsToChose|/sitecore/content/Site 2/Data/FolderHeWantsToChose
and
ancestor::*[@@templatename='Site']/Data/FolderHeWantsToChose/*
but I can't find any good query to display only the folders and not the whole Sitecore tree.
| |
It sounds like you have added the component to a placeholder key called section - with dynamic placeholders there will be an extra bit of data appended to that. Depending on the version of dynamic placeholders you have installed, that data changes.
If you have installed the Fortis Dynamic Placeholders - this appends the guid of the unique rendering Id to the place holder, so your placeholder key would be something like section-21ec20203aea1069a2dd08002b30309d - the best way to use this is to add components via the Experience Editor, that way the key is automatically worked out by Sitecore.
If you have the the version from the Sitecore Market Place - this uses numbers appended to the key. So the first section would just be called section, any subsequent placeholders using he same key would be section_2, section_3 etc...
Your component is being hidden because with the dynamic placeholder, the key of section on its own does not exist.
Update: How to add via the Content Editor
For the Fortis implementation, to add renderings via the content editor requires you to go into the raw values of the __Renderings or __Final Renderings fields. In there will be the Xml that defines the layout. Find the rendering that contains your dynamic placeholder and then in the xml look for the uid of that rendering, that is the Guid that is appended.
<r id="{C4BD2E61-3025-4F88-9F7D-677086C576BA}" ph="header" uid="{8ED804CF-8F60-452C-A88B-4EEEB0145793}" />
Now when you add a rendering, append that guid to the placeholder key.
An alternative would be to add a rendering via the experience editor and then look at the placeholder key for that rendering, copy that and use it when adding more renderings.
|
How to use Dynamic Placeholders
This is my first time with Dynamic Placeholders and I am unable to find any related tutorial.
I have installed the nuget package mentioned in the Fortis Site
https://www.nuget.org/packages/DynamicPlaceholders.Mvc/
and trying to render a component as
@Html.Sitecore().DynamicPlaceholder("section")
The component does not render on page and there are no errors.
If I just say:
@Html.Sitecore().Placeholder("section")
it works fine.
Apart from installing the package, should anything else be done.
Using Sitecore 8.2 with MVC
EDIT
The Fortis way seems complex. So, I have deleted the Fortis dll references and installed the package from the Marketplace. When browsing the page in preview mode, the error is
Sitecore.Mvc.Helpers.SitecoreHelper' does not contain a definition for 'DynamicPlaceholder
and no extension method 'DynamicPlaceholder' accepting a first argument of
type 'Sitecore.Mvc.Helpers.SitecoreHelper' could be found (are you missing
a using directive or an assembly reference?)'
| |
From the error message, it sounds like the DLL for the Dynamic Placeholder isn't a known reference for your views. You'll want to add the following line to your /Views/Web.config file in your view folder:
<add namespace="SitecoreExperienced.SitecoreControls" />
To should look something like:
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="Sitecore.Globalization"/>
<add namespace="Sitecore.Mvc" />
<add namespace="Sitecore.Mvc.Presentation" />
<add namespace="System.Web.Routing" />
<add namespace="SitecoreExperienced.SitecoreControls" />
</namespaces>
</pages>
|
Dynamic Placeholders marketplace module throws method definition error
This is my first time with Dynamic Placeholders and having a hard time getting started.
I have installed the package from here
https://marketplace.sitecore.net/en/Modules/I/Integrated_Dynamic_Placeholders.aspx
and trying to render a component as
@Html.Sitecore().DynamicPlaceholder("section")
When browsing the page in preview mode, the error is
Sitecore.Mvc.Helpers.SitecoreHelper' does not contain a definition for 'DynamicPlaceholder and
no extension method 'DynamicPlaceholder' accepting a first argument of
type 'Sitecore.Mvc.Helpers.SitecoreHelper' could be found (are you missing
a using directive or an assembly reference?)
'
If I just say, @Html.Sitecore().Placeholder("section"), it works fine.
Using Sitecore 8.2 with MVC
SOLUTION:
Patrick Barron's answer worked. There are two parts to it:
In the /Views/web.config include the namespace
<add namespace="SitecoreExperienced.SitecoreControls" />
, and in the content editor, when adding the controls, append "_scexp1" to the placeholder name. eg:
1st Rendering: widgets
Placeholder key : section
2nd Rendering: banner
Placeholders : section_scexp1
3rd Rendering: banner
Placeholders : section_scexp2
| |
I've seen this error when logged in to the Sitecore backoffice and then attempting to log into the site as a front-end member in the same browser.
I don't believe Sitecore can handle this situation gracefully by default and logs this error.
Haven't looked at the core code but likely this is likely due to multiple identities on the same auth ticket and Sitecore blindly grabbing the first.
Can you confirm if this is your scenario? Or do you see this error when logging in on separate browsers too?
|
Sitecore Logs shows The current user cannot be resolved from the authentication cookie
Sitecore logs are showing lot of these messages: WARN The current user cannot be resolved from the authentication cookie. The cookie will be removed.
Ex:
Line 556: 1820 07:14:48 WARN The current user cannot be resolved from the authentication cookie. The cookie will be removed.
Line 1680: 6612 08:02:06 WARN The current user cannot be resolved from the authentication cookie. The cookie will be removed.
Line 1681: 6916 08:02:06 WARN The current user cannot be resolved from the authentication cookie. The cookie will be removed.
We are using mixed authentication : Asp net membership provider + Sitecore virtual user. We recently upgraded from Sitecore 7.2 to Sitecore.NET 8.1 (rev. 160519) and are using Mongo DB as well for gathering Analytics data.
Any suggestions to identify the issue? I verified on the server and there aren't any app pool recycles when this happened.
| |
There is a brightcove patch configuration file:
Sitecore.MediaFramework.Services.Brightcove.config
Review current configuration for <playerMarkupGenerators> You will find:
<playerMarkupGenerators>
<add name="brightcove_video" templateId="{6A5C6835-6E11-4602-A11D-B626E9255397}" type="Sitecore.MediaFramework.Brightcove.Players.BrightcovePlayerMarkupGenerator,Sitecore.MediaFramework.Brightcove">
<analyticsScriptUrl>/sitecore modules/Web/MediaFramework/js/Analytics/brightcove.js</analyticsScriptUrl>
<scriptUrl>http://admin.brightcove.com/js/BrightcoveExperiences.js</scriptUrl>
<parameters hint="raw:AddParameter">
<param name="isVid" value="true"/>
<param name="isUI" value="true"/>
<param name="dynamicStreaming" value="true"/>
<param name="includeAPI" value="true"/>
<param name="htmlFallback" value="true"/>
<param name="templateReadyHandler" value="brightcoveListener.onTemplateReady"/>
</parameters>
</add>
<add name="brightcove_playlist" templateId="{0E24292F-D7A5-4BA2-BCA0-CD5F14A89634}" type="Sitecore.MediaFramework.Brightcove.Players.BrightcovePlayerMarkupGenerator,Sitecore.MediaFramework.Brightcove">
<analyticsScriptUrl>/sitecore modules/Web/MediaFramework/js/Analytics/brightcove.js</analyticsScriptUrl>
<scriptUrl>http://admin.brightcove.com/js/BrightcoveExperiences.js</scriptUrl>
<parameters hint="raw:AddParameter">
<param name="isVid" value="true"/>
<param name="isUI" value="true"/>
<param name="dynamicStreaming" value="true"/>
<param name="includeAPI" value="true"/>
<param name="htmlFallback" value="true"/>
<param name="templateReadyHandler" value="brightcoveListener.onTemplateReady"/>
</parameters>
</add>
</playerMarkupGenerators>
As you can see you can change/remove/add some parameters to generate markup.
Try to play with some parameters. As I found here https://stackoverflow.com/questions/8229621/html5-video-with-brightcove
you just need to add
<param name="forceHTML" value="true" />
I had not chance to test it. Sorry. Maybe you also need to remove/update some default parameters.
|
MediaFramework - Brightcove HTML 5 Player
I am using Media Framework 2.0 with Sitecore 8.0. I have been able to generate a flash player with the Media Framework API. This is the code -
args.MarkupType = Sitecore.MediaFramework.Pipelines.MediaGenerateMarkup.MarkupType.Frame;
Sitecore.MediaFramework.Brightcove.Players.BrightcovePlayerMarkupGenerator generator = new Sitecore.MediaFramework.Brightcove.Players.BrightcovePlayerMarkupGenerator();
Sitecore.MediaFramework.Pipelines.MediaGenerateMarkup.MediaGenerateMarkupPipeline.Run(args);
return args.Result.Html;
But I'm not able to generate the HTML5 player using this code. This only works for Flash based players but not HTML5.
Is there a way in the MediaFramework API to accomplish this or will I have to roll my own code to do that?
| |
Thank you everyone for your help! Here's what my process ended up looking like. I hope that it will help others:
I checked the Sitecore Search log, and found that I was getting the same query running multiple times in each second.
I then checked my Sitecore (regular) log file and found out that I was getting between 2 and 4 visitors per second to my website (I had some extra logging that helped me identify that).
Next, I checked my SOLR logs and discovered that my Analytics index was getting hit pretty hard. I was getting the following warning messages:
[sitecore_analytics_index] PERFORMANCE WARNING: Overlapping onDeckSearchers=2
[sitecore_analytics_index] Error opening new searcher. exceeded limit of maxWarmingSearchers=2, try again later.
This told me that my SOLR server wasn't able to keep up with the amount of traffic that we were throwing at it.
Finally, I went and looked at my IIS logs and discovered that our on-premise Google Search Appliance was getting stuck on indexing a single page of our website.
So, after I excluded that one page from the GSA's indexing, the traffic went back down to what it should have been.
There are a couple of important take-aways for me, and I hope that this will be helpful to others:
When you see a lot of traffic on your site, check the Sitecore Search log. It may be able to provide you with some insight into what is going on.
When your SOLR server suddenly starts acting like it's under a lot more load, it probably is. Don't assume that there is something wrong with your SOLR server configuration.
If you are seeing a lot more traffic to your site, but you are not seeing any increase in your analytics numbers, that could be because there is a robot hitting your site. Sitecore filters the robots out of the numbers. However, the Analytics index still records/processes those because of how Sitecore figures out if a website user is a robot or not.
|
How to figure out why I have a sudden spike in traffic between CM and CD servers
My network guys have started asking me about a sudden spike in network traffic that they noticed. For the past 4 days I have had about 5 terabytes go between my 3 CD servers and my 1 CM server, which is significantly more than I've ever seen before. I'm on Sitecore 8.1 Original release (and have been on this release since April of this year). At the same time my SOLR disk space requirements have significantly increased, causing me to request extra disk space 2 times in that same time frame. My SOLR Server is on the same machine as my CM server, and my analytics SOLR index has grown very large as well.
I'm not sure where to start looking to troubleshoot this kind of issue. There haven't been exceptions to be logged, there is just a lot more traffic than I was expecting. Our website traffic has not went up significantly in the last week, so I don't think that this is "normal" traffic.
How do I start troubleshooting this issue?
| |
I believe the item you're looking for is here:
/sitecore/system/Settings/Security/Policies/Page Editor/Navigation bar/Can Edit in the core database.
By default, the Sitecore Limited Page Editor or Sitecore Minimal Page Editor roles seem to deny read privileges to that button.
|
Remove EDIT button in Navigation Bar
Can anyone know how I can remove "EDIT" button in Navigation Bar?
The navigation check-box fires the command "webedit:ToggleTreecrumb". Is there any way to deny "READ" access on this "EDIT" button? Any easiest way??
| |
You need to override CanShowField method of Sitecore.Shell.Applications.ContentEditor.Pipelines.GetContentEditorFields.GetFields class so that it returns false for specific fields when Content Language is English.
Here is you can create class something like follows. You can add additional criteria like checking for particular template.
public class GetFields : Sitecore.Shell.Applications.ContentEditor.Pipelines.GetContentEditorFields.GetFields
{
protected override bool CanShowField(Sitecore.Data.Fields.Field field, TemplateField templateField)
{
if (field.Name == "Title" && field.Language == Sitecore.Globalization.Language.Parse("es-Es"))
{
return false;
}
return base.CanShowField(field, templateField);
}
}
After that you should apply patch to include your custom class.
<getContentEditorFields>
<processor type="Sitecore.Shell.Applications.ContentEditor.Pipelines.GetContentEditorFields.GetFields, Sitecore.Client">
<patch:attribute name="type">YourClass, YourAssembly</patch:attribute>
</processor>
</getContentEditorFields>
|
Hiding Specific Fields for Specific Language in Content Editor
We need some specific customization to hide a specific field for a specific language. like hiding Title field for English language but not for Spanish etc. Please suggest a any way to do this.
| |
According to feedback from uCommerce forum, this seem to be a known bug which will be fixed in a release January '17
|
Sitecore/uCommerce NullReferenceException in ProductCatalogFactory
I'm trying to setup a uCommerce for Sitecore for the first time. But I'm getting a NullReferenceException - so I suspect I've done something wrong, or am missing an installation step.
What I did was:
I've installed a fresh Sitecore 8.1 installation, then installed uCommerce (7.3.1.1634) developer license as a package via Sitecore Instance Manager. (I've also tried installing the package myself)
Navigating into the administration interface --> Commerce Settings (uCommerce).
I expand the Stores node, uCommerce.dk node, and go to the uCommerce node in the default installation content
Now, if I try to fill out the display name in the English tab, and save my ProductCatalog I get:
[NullReferenceException: Object reference not set to an instance of an object.]
UCommerce.EntitiesV2.Factories.ProductCatalogFactory.AddDefaults(ProductCatalog productCatalog, ProductCatalogGroup productCatalogGroup) +131
UCommerce.Presentation.Presenters.Catalog.EditProductCatalogPresenter.View_Save(Object sender, EntityCommandEventArgs`1 e) +703
UCommerce.Web.UI.Catalog.EditProductCatalog.OnSave(Object sender, EventArgs e) +124
System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e) +143
System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument) +185
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1734
I've tried to publish the site and rebuild indexes, but it didn't fix the issue.
I've also tried to create my own ProductCatalog and my own Store in various combinations; and that goes well. But if I try to update the name of my ProductCatalog, I get the same exception.
(the uCommerce Admin interface to illustrate)
EDIT: For some reason it looks like the admin page does not get the QueryString value it requires, but it doesn't fail on the demo site, so it looks like possible the demo build does not match the developer license version.
| |
When publish:end:remote event is raised, there is an entry created in the core database EventQueue table.
All the servers (including CD servers) check that table and executes all the handlers.
In terms of performance impact, it all depends on the code which generates the files.
|
How do publish end remote events work
We have different CM and CD servers
I am generating files on publish:end and publish:end:remote events. Files will be generated in the website-Root/Dictionary Folder.
What files? - We are going through each sites dictionary folder and creating JSON files with dictionary key value pairs.
I am clear on how its generating files on the Content Management server Data folder. As the publish event happened on this server. We are not really worried about performance impact on CM server.
what i am not clear is how the content delivery network is picking up this publish event (may be some how publish:end:remote event is letting the CD server know) and generating these files?
Is there going to be any performance impact on the content delivery server?
| |
Use two browsers: when logged in as sitecore\admin and extranet\xxx might break other things as well. Use a chrome-browser and incognito window to truly have a visitor experience. This is better from a security perspective as well.
|
AntiForgery Tokens and Sitecore Development
I have set up some Sitecore extranet users (8.1.160519). I am using MVC AntiForgeryTokens for some posts. The problem is with the login form explicitly. When I am developing I am logged in as Admin and as one of my extrant users. If I log in as the Admin first, then try to login as my extranet user I get:
The provided anti-forgery token was meant for user "sitecore\admin", but the current user is "extranet\eschofer".
I am tempted to turn off the AntiForgeryToken for the login form, but would prefer to try and mitigate this.
I already tried setting:
AntiForgeryConfig.SuppressIdentityHeuristicChecks = true;
I am not sure I have this in the correct place in the Pipeline but at least right now it has no effect. Here is where it currently exists in the initialize pipeline:
<initialize>
<processor type="Sitecore.Pipelines.Loader.ShowVersion, Sitecore.Kernel">
<processor type="Sitecore.Analytics.Pipelines.Initialize.ShowXdbInfo, Sitecore.Analytics" patch:source="Sitecore.Xdb.config" />
<processor type="Sitecore.Pipelines.Loader.ShowHistory, Sitecore.Kernel" />
<processor type="Sitecore.Pipelines.Loader.SetGlobals, Sitecore.Kernel" />
<processor type="Sitecore.Eventing.Remote.RemoteEventMap, Sitecore.Kernel" method="InitializeFromPipeline" />
<processor type="Sitecore.Pipelines.Loader.LoadHooks, Sitecore.Kernel" />
<processor type="Sitecore.Pipelines.Loader.InitializeManagers, Sitecore.Kernel" />
<processor type="Sitecore.Pipelines.Loader.InitializeScheduler, Sitecore.Kernel" />
<processor type="Sitecore.Pipelines.Loader.InitializeHeartbeat, Sitecore.Kernel" />
<processor type="Sitecore.Pipelines.Loader.InitializeAgilityPack, Sitecore.Kernel" />
<processor type="Sitecore.Pipelines.Loader.EnsureAnonymousUsers, Sitecore.Kernel" />
<!-- Processor checks the WebDAV feature configuration on first start. -->
<processor type="Sitecore.Pipelines.Loader.CheckWebDAVConfiguration, Sitecore.Kernel" patch:source="Sitecore.WebDAV.config" />
###### HERE IS MY PATCH FILE ########
<processor type="DD.Framework.Pipelines.Initialize.InitializeAntiForgeryTokens, DD.Framework" patch:source="Delphic.InitializeAntiForgeryToken.config" />
#######################################
<!--
Replaces the default MediaManager.Cache implementation with one that optimizes images on the way to cache
-->
<processor type="Dianoga.Pipelines.Initialize.MediaCacheReplacer, Dianoga" patch:source="Dianoga.config" />
<processor type="DelawareNorth.App_Start.GlassMapperSc, DelawareNorth" patch:source="Glass.Mapper.Sc.Start.config" />
<processor type="Sitecore.Analytics.Pipelines.Loader.InitializeAutomation,Sitecore.Analytics.Automation" patch:source="Sitecore.Analytics.Automation.TimeoutProcessing.config" />
<processor type="Sitecore.Analytics.Outcome.Pipelines.Initialize.RegisterDataModelExtensions, Sitecore.Analytics.Outcome" patch:source="Sitecore.Analytics.Outcome.config" />
<processor type="Sitecore.Analytics.Automation.Pipelines.Initialize.RegisterDataModelExtensions, Sitecore.Analytics.Automation.MongoDB" patch:source="Sitecore.Analytics.Processing.Aggregation.ProcessingPools.config" />
<processor type="Sitecore.Analytics.Pipelines.Loader.InitializeTracking, Sitecore.Analytics" patch:source="Sitecore.Analytics.Tracking.config" />
<processor type="Sitecore.Analytics.Pipelines.Loader.InitializeAnalytics, Sitecore.Analytics" patch:source="Sitecore.Analytics.Tracking.config" />
<processor type="Sitecore.Apps.TagInjection.Loader.TagInjectionInitializer, Sitecore.Apps.TagInjection" patch:source="Sitecore.Apps.TagInjection.config" />
<processor type="Sitecore.Commerce.Pipelines.RegisterConnectTypesWithMongo, Sitecore.Commerce" patch:source="Sitecore.Commerce.config" />
<!--
DUMP CONFIGURATION FILES Dumps the specified configuration files and allows you to monitor all the changes that are made to the configuration files. Supported child nodes: DumpFolder: The path to the root folder where the config file dump is stored. Each config file dump is stored in a folder or a zip archive. The name of the folder or zip archive has the following format: {date}.{time}. Default value: $(dataFolder)/diagnostics/configuration_history Zip: Boolean value that determines whether each dump should be zipped. Default value: true files: Contains <file> nodes where the "path" attribute value is the path to the configuration file or the folder that should be dumped.
-->
<processor type="Sitecore.Pipelines.Loader.DumpConfigurationFiles, Sitecore.Kernel" patch:source="Sitecore.Diagnostics.config">
<processor type="Sitecore.Pipelines.Loader.InitializeJSNLog, Sitecore.Kernel" patch:source="Sitecore.JSNLog.config" />
<processor type="Sitecore.Mvc.Pipelines.Loader.InitializeGlobalFilters, Sitecore.Mvc" patch:source="Sitecore.Mvc.config" />
<processor type="Sitecore.Mvc.Pipelines.Loader.InitializeControllerFactory, Sitecore.Mvc" patch:source="Sitecore.Mvc.config" />
<processor type="Sitecore.Mvc.Pipelines.Initialize.InitializeCommandRoute, Sitecore.Speak.Mvc" patch:source="Sitecore.Speak.Mvc.config" />
<processor type="Sitecore.ContentTesting.Pipelines.Initialize.RegisterWebApiRoutes, Sitecore.ContentTesting" patch:source="Sitecore.ContentTesting.config" />
<!-- Processor initializes the "Social" MVC area. -->
<processor type="Sitecore.Social.Client.Mvc.Pipelines.Initialize.RegisterSocialArea, Sitecore.Social.Client.Mvc" patch:source="Sitecore.Social.config" />
<processor type="Sitecore.Mvc.Pipelines.Loader.InitializeRoutes, Sitecore.Mvc" patch:source="Sitecore.Mvc.config" />
<!--
One-time run code that synchronizes a segment if it's workflow state is 'Deployed' but non-existent in db, with DeployDate = UTC.NOW
-->
<processor type="Sitecore.ExperienceAnalytics.Client.Deployment.SyncSegmentsProcessor, Sitecore.ExperienceAnalytics.Client" patch:source="Sitecore.ExperienceAnalytics.Client.config">
<!-- Initializing Experience Analytics Web API -->
<processor type="Sitecore.ExperienceAnalytics.Api.Pipelines.Initialize.WebApiInitializer, Sitecore.ExperienceAnalytics" patch:source="Sitecore.ExperienceAnalytics.WebAPI.config">
<!-- Creates client specific http endpoints. -->
<processor type="Sitecore.Cintel.Client.Initialization.InitializeRoutes, Sitecore.Cintel.Client" patch:source="Sitecore.ExperienceProfile.Client.config" />
<!-- Creates a set of http endpoints that expose functionality of Experience Profile. -->
<processor type="Sitecore.Cintel.Endpoint.Plumbing.InitializeRoutes, Sitecore.Cintel" patch:source="Sitecore.ExperienceProfile.config" />
<!--
Maps a specific route for the Beacon Service to allow session state to be enabled as the DMS relies upon the existence of a session.
-->
<processor type="Sitecore.FXM.Service.Pipelines.EnableBeaconServiceSessionStateProcessor, Sitecore.FXM.Service" patch:source="Sitecore.FXM.config" />
<processor type="Delphic.Sitecore.Particle.Pipeline.ParticleStart, Delphic.Sitecore.Particle" patch:source="Particle.config" />
<!-- Processor maps remote events. -->
<processor type="Sitecore.Social.Client.Pipelines.Initialize.RemoteEventMap, Sitecore.Social.Client" patch:source="Sitecore.Social.config" />
</initialize>
| |
You need to extend Sitecore.Data.AliasResolver class.
You need to modify just this method in this class:
public virtual LinkField this[string alias]
{
get
{
Error.AssertString(alias, "alias", true);
if (alias.Length > 0)
{
Item item = ItemManager.GetItem(FileUtil.MakePath("/sitecore/system/aliases", alias, '/'), Language.Invariant, Version.First, this.m_database, SecurityCheck.Disable);
if (item != null)
{
return item.Fields["linked item"];
}
}
return null;
}
}
Please modify this line :
Item item = ItemManager.GetItem(FileUtil.MakePath("/sitecore/system/aliases", alias, '/'), Sitecore.Context.Language, Version.First, this.m_database, SecurityCheck.Disable);
After you need to extend Sitecore.Pipelines.HttpRequest.AliasResolver . You need to override entire class because it has ProcessItem and ProcessExternalUrl private methods. In this methods you need to use your custom alias resolver not the default Sitecore AliasResolver class.
|
Alias are not coming from language specific item version
We have created an alias item from /sitecore/templates/System/Alias. We need to use different url for different languages. To do this we have made "Linked item" item not shared. but it is picking the link from English version item only even for other languages also.
Can you please suggest what can be the possible reason and solution?
| |
if your ribbon is still not displayed with 'toggle', you have to check the 'sc_lang' querystring in the URL. it should '?sc_lang=en' by default.
|
Sitecore ribbon doesn't show up
I am running Sitecore 8.0 on my development machine but I am not seeing the ribbon in the Content Editor anymore. I haven't made any drastic changes to my environment in the last week, except minor code changes to layouts/renderings.
I'm also not seeing any Javascript errors in Fiddler or Chrome console.
The issue is not with collapsed ribbon either. The ribbon appears with full height and width but doesn't show anything.
Anyone seen this before?
| |
Currently in WFFM, this is not possible without custom JavaScript. You will need to disable validation on the fields you want to validate. Then write custom client side validation when the field is visible.
|
Disable validation in WFFM forms, if required fields are in hidden mode
I have some fields hidden [required fields] in WFFM forms based on checkbox selection. My requirement is it should allow forms to submit while those fields hidden.If it should validate required field if those field display. My jquery validation js file have default setting ignore:hidden option. But still while submit it refreshing my page and not submitting and validating those hidden field and shows error message. Can you please guide how to solve this problem. I am using sitecore 8 WFFM update 4.
| |
An easy option would be to create your own webapi controller and create an action that does the publish, using the Sitecore API: Sitecore.Publishing.PublishManager.PublishItem(...) You can pass the item id as a parameter and fetch it from the master database. Other options for the Publish function can be parameterized as well, depending on how flexible you want/need it.
Just be careful that not everyone can start publishing your items, think about security ;)
As you are using the SSC, it should be possible to add custom actions to it: https://doc.sitecore.net/sitecore_experience_platform/developing/developing_with_sitecore/sitecoreservicesclient/use_the_restful_api_for_the_entityservice
Edit: apparently Mike Robbins already blogged on how to add a custom action to your SSC: https://mikerobbins.co.uk/2015/03/20/sitecore-entity-service-ssc-custom-controller-action/ - so you can create a custom action and use the Publish method from the Sitecore API in it.
Some info from the blog:
Entity Service is very flexible allowing you to extend the service
controller with additional actions. To add an additional action it is
as simple as adding a new function to the service controller, and
decorating it with an ActionName and the action type such as HttpGet
If you like the repository pattern that Sitecore have put in place
with Entity Service using the IRepository interface
and rather keep all the logic of my controller in a single place (in
the repository): update the repository to include the extra functional
we want to add to the Entity Service.
With custom controller actions in Entity Service, the routing is
configured to respond to
{Controller-Namespace}/{Controller}/{ID}/{CustomActionName}. If you do
not include in an ID in the URL, Entity Service will not resolve to
your custom controller action. Uou can then call your controller by
using the prefixed of “/sitecore/api/ssc”.
|
publish item remotely using c#
For testing purposes we would like to create publish and remove some items in Sitecore using a remote testing- client in C#. Sitecore.Services.Client api seems the most logical way to create and delete items.
But how can I publish an item remotely?
| |
In terms of what we are supposed to do now, I'm not sure.
As for the Site Health, it's still there but it has been hidden. There is a tutorial on how to get it back.
http://blogs.benjaminvidal.net/posts/2015/enabling-engagement-analytics-in-sitecore-8/
And also, how to trigger the 404 reporting
http://blogs.benjaminvidal.net/posts/2015/sitecore8-site-health-reports-not-found-urls-report/
|
Sitecore 404 reporting in 8.2
Before, we would use the site health in the analytics area to check 404 error reports. This has been removed in 8.2, so what is the expected way to get this information?
| |
This is normal behaviour if you didn't set Datasource Template for your rendering. If you don't set the template is it normal to not enable that button because you don't know what kind of template your component support like a datasource.
Please check this link to find more information : https://varunvns.wordpress.com/2015/04/28/page-editor-experience-set-the-datasource-template-for-the-presentation-component/
|
Why is 'Create New Content' disabled
I am trying to add a new component into a sitecore page using the Experience Editor. I want my component to read from a datasource item. I want to be able to create content items (as datasource) from the experience editor, however the 'Create New Content' is disabled, why is that?
Sitecore 8.1 Update 3
| |
It is possible to use the Fortis Dyanmic Placeholders in Web Forms however you'll need to create your own method of generating the placeholder ID.
The MVC implementation is as follows:
public static HtmlString DynamicPlaceholder(this SitecoreHelper helper, string placeholderName)
{
var placeholder = PlaceholdersContext.Add(placeholderName, RenderingContext.Current.Rendering.UniqueId);
return helper.Placeholder(placeholder);
}
True Clarity wrote a blog post on how to implement a dynamic placeholder control for Web Forms. Below is an adapted version that should work with the Fortis Dynamic Placeholder library.
public class DynamicPlaceholder : WebControl, IExpandable
{
private string key = Placeholder.DefaultPlaceholderKey;
public string Key
{
get { return _key; }
set { _key = value; }
}
protected override void CreateChildControls()
{
var parentRendering = this.Parent as Sublayout;
if (parentRendering == null)
{
// Problem - parent control isn't a Sublayout (why?)
}
var renderingId = parentRendering.ID
var dynamicKey = PlaceholdersContext.Add(placeholderName, renderingId);
var placeholder = new Placeholder();
placeholder.Key = dynamicKey;
this.Controls.Add(placeholder);
placeholder.Expand();
}
protected override void DoRender(HtmlTextWriter output)
{
base.RenderChildren(output);
}
public void Expand()
{
this.EnsureChildControls();
}
}
Please note that I haven't tested the above at all and I've just written it :). It's likely it may need tweaking but I think the general approach is there. I hope this helps!
|
Form Dynamic Placeholder use
I may have been out of Web Forms for two long. I need to implement dynamic placeholders for web forms. I am trying to use Fortis' version of it, but it has very little documentation around it. The MVC side works great.
Can someone give me some information on how to implement it with web forms?
| |
I'm not sure what version of Sitecore you are using but have you checked the following steps?
All Lucene config files (Sitecore.ContentSearch.Lucene.*) have been renamed to .disabled in wwwroot\\App_Config\Include.
All Solr configs are enabled, those that follow this pattern: Sitecore.ContentSearch.Solr.* (there is a good script for this here: https://gist.github.com/patrickperrone/59b8745ee8b8ff9045b5)
You have set the value of ContentSearch.Solr.ServiceBaseAddress and ContentSearch.Provider is set to "Solr".
You have set the Solr processor to "Sitecore.ContentSearch.SolrProvider.CastleWindsorIntegration.WindsorInitializeSolrProvider" here: Sitecore.ContentSearch.Solr.DefaultIndexConfiguration.config.
Rebuild your indexes
Check your custom indexes and custom search index configuration
More info here: https://doc.sitecore.net/sitecore_experience_platform/setting_up__maintaining/search_and_indexing/walkthrough_setting_up_solr#_Configuring_Sitecore_to
This is also a bit out of date for the latest version of Sitecore but is a nice walk-through:
https://born4joy.wordpress.com/2015/09/03/installation-and-configuration-of-solr-for-sitecore-8/
One other thing worth checking is how you are configuring your IOC for Solr, it can be done like so in the Global.asax:
<%@ Application Language=’C#’ Inherits=”Sitecore.ContentSearch.SolrProvider.CastleWindsorIntegration.WindsorApplication” %>
In our 8.1 site We are doing this via WebActivatorEx instead but it does the same thing.
|
SearchConfiguration is not configured correctly. ContentSearchConfiguration was expected but System.String was returned
I am getting this error when trying to access a Sitecore website. Here's a screenshot of the complete error message.
It probably has to do with configuring Solr to work with Sitecore. Does anyone have any idea what the source of the problem might be?
| |
You are mixing a Content Search index (which indeed you have disabled) with legacy Sitecore.Search database indexes which apparently are still working.
In order to disable Sitecore Legacy indexes you should set the following setting values:
<setting name="Indexing.UpdateInterval" value="00:00:00"/>
<setting name="Indexing.Enabled" value="false" />
Also you have to remove <indexes> definitions for each <database> definition.
It can be done by removing master and core nodes from index locations under the /configuration/sitecore/search/configuration/indexes/index/locations node in the Sitecore.config
|
Master index updated even though manual strategy is set
I have changed update strategy for Master database to be "manual" rather than "sync", which to my understanding should not update "master" when data changes in master database. I can see in crawling log that strategy is initiated properly:
[Index=sitecore_master_index] Initializing ManualStrategy. Index will have to be rebuilt manually
However, I can see in the logs the following:
Starting update of index for the database 'master' (6 pending).
Update of index for the database 'master' done.
Am I missing something or that's something normal?
| |
Since you are installing this on two separate VMs you have two options.
1) If the VMs are in the same domain, you must grant the NetworkService of the computer running SIM access the VMs and run the MSSQLSERVER Service as NetworkService on the computer running SIM. I do not recommend this because you are giving a system account access across servers.
2) The better solution is to change the permissions that the website and SQL are running under. To do this, you will need to change it under Advanced Settings under SIM.
Select Advanced Settings
Under Advanced Settings, you can configure several options. Take a look at "Core/Install/WebServer/Identity"
You can read more on advanced configuration of SIM here https://github.com/sitecore/sitecore-instance-manager/wiki/Advanced
|
Trying to Install SIM 1.4 rev 160526 Update 3
I'm trying to install SIM 14. 160526 Update-3. When I run the wizard it gets to the "File System Permissions" screen and it says "Make sure the NETWORK SERVICE user account has full access to the following folder: c:\inetpub\wwwroot"
NETWORK SERVICE does have Full access to c:\inetpub\wwwroot but when I click on "Next" it says I probably don't have proper permissions set and to click on "Grant". When I click on "Grant" two popups appear. One says "Applying security changes" and has a progress bar and another says "Permissions were successfully set". It's weird that they both come up at exactly the same time. If I click OK on the "Permissions were successfully set" dialog box, the two dialogs disappear but then when I'm back where I started. I click "Next" I get the same message that I probably don't have proper permissions set etc.
Does anybody know how to resolve this? I have Sitecore 8.2 and I have a two-VM server setup. One with SQL Server 2014 on which I installed sitecore DB and another VM for the sitecore website. I am installing SIM on the sitecore website VM. I saw some posts where it said this is really a SQL Server permissions problem. The connection string the wizard is picking up is correct and I tried running SQL Server logged on as NETWORK SERVICE, Local Service and the Domain Administrator account but none made any difference.
I'd really appreciate any help with this!
| |
You could create a new template to create datasource items that bundle your "multiple items" (in separate link type fields, or with a multi-select type field - as you want). This way you are able to set one item as datasource and find all your items on that single datasource.
The benefit of keeping the datasource approach is that datasources can be personalized, unlike rendering parameters. You could also use shared fields if you want, re-use the bundles, ...
|
Can we design the View renderings with multiple data sources?
I am doing project in Sitecore MVC. For every view rendering we are giving one data source for model reference but I need to get the field values from multiple items. So can we design the view renderings with multiple data sources?
| |
When you specify the datasource in the Data Source field of the Rendering item definition, you effectively set the "default datasource" for that component.
If you do not specify the Data Source in Control Properties in Experience Editor mode (or Presentation Details in Content Editor) then the datasource you specified on the Rendering item definition will be used.
It's also worth noting that if you set the datasource on the Rendering item then the Select the Associated Content dialog will not appear when you add a component to a page.
But setting the "default datasource" this way is the same whether you dynamically or statically bind your components.
Since your static binding is pointing to a Sitecore Rendering definition item, it should use this datasource. It works as expected (and like in your example) in Sitecore 8.1 Update-3 but this looks like a bug in Sitecore 8.2, or at least a breaking change. I would raise a ticket with Sitecore Support and have them investigate/fix this.
|
Dynamic data source of the view rendering is not working in sitecore 8.2
I use sitecore 8.2 and I can't understand the purpose of the "Data source" field on the "View rendering" item.
It seems that datasource works only when I statically specify it inside the cshtml file:
@Html.Sitecore().Rendering("/sitecore/layout/renderings/jobs/footercontent", new {DataSource = "/sitecore/content/Global/Footer"})
But if I define the datasource in the "Data source" filed of the view rendering then it stops working.
@Html.Sitecore().Rendering("/sitecore/layout/renderings/jobs/footercontent")
From your experience, why could it happen?
Shouldn't it work when I dynamically bind the datasource in the "Content Editor"?
| |
The problem
You are running into one of many inherent problems with using Sitecore Query. The problem is; self is a reserved word - and therefore /Self Service/ fails.
Workarounds
Now in this instance you can (probably) work around it using some of the suggestions already given. Escape the query like .../#Self Service#/ - but this will only work if you plan to be using a static query where you know the full path in advance.
A way around this limitation would be to reconstruct the query like this:
/sitecore/content/*[@'name='Abcdef']/*[@@name='Sites']/etc etc etc/*[@@name='Self Service']/*
But it's not pretty.
Alternative Solution
Or in the case of your example query, replace the Sitecore Query call entirely, with a call to .GetItem("/sitecore/content/Abcdef/Sites/WXYZ/MNO/Application Contexts/Connect On Demand/Sections/Self Service") and .GetChildren().
References
Reserved words in Sitecore Query:
ancestor
and
child
descendant
div
false
following
mod
or
parent
preceding
self
true
xor
Links:
https://stackoverflow.com/questions/3687405/escaping-reserved-words
https://community.sitecore.net/technical_blogs/b/sitecorejohn_blog/posts/sitecore-query-cheat-sheet
|
Sitecore Query fails - "::" expected at position 92
The below query fails and throws exception.
/sitecore/content/Abcdef/Sites/WXYZ/MNO/Application Contexts/Connect On Demand/Sections/Self Service/*
returns "::" expected at position 92.
where as I am getting results if the query
/sitecore/content/Abcdef/Sites/WXYZ/MNO/Application Contexts/Connect On Demand/Sections/*
| |
This is done in accordance with helix architectural principles. It states:
Avoid statically binding renderings in sub-layouts, but rather bind
all renderings to layouts via layout definitions and placeholders.
Static binding will make the page and solution structure less flexible
and introduces multiple maintenance methodologies. Although you might
end up with longer lists of renderings in your layout definitions, the
centralised Page Type templates (see Template types) and single layout
management methodology will prove more maintainable and flexible in
the long run.
Source: http://helix.sitecore.net/principles/layout/layouts.html
|
Dynamic vs. Static Renderings in Habitat project
In Habitat sample project meta renderings and few similar sort of renderings have been used as dynamic rendering. Shouldn't such renderings be used as static rendering in layout? Is there any specific reasons/benefits to use these renderings as dynamic renderings. Thanks.
| |
They have refactored the way pipelines work in the 4.3.
Quote from the release notes:
Normally you can just override the Execute method and when you are ready to call the next task in the pipeline you simple call base.Execute
Any tasks that you have already created pre version 4.3 will need to
be updated to work with this approach.
So basically, you have to call base.Execute every time you want to continue the pipeline.
This means that in order to abort it you just don't call the base.Execute.
You can check the release notes here
http://www.glass.lu/Blog/Release4-3
|
AbortPipeline() in GlassMapper 4.3.0.280?
In Sitecore 8.1 with an older version of GlassMapper, I had implemented the following code to implement Patial Language Fallback:
https://community.sitecore.net/technical_blogs/b/elizabeth_spranzani/posts/partial-language-fallback-and-glass-mapper-v3
I am now upgrading to Sitecore 8.2 Update 1 and GlassMapper 4.3.
I am attempting to refactor the code for the changes to pipeline in GlassMapper 4.3.
Before we had some logic similar to the following:
if (scContext.Item == null)
{
args.AbortPipeline();
return;
}
It appears that AbortPipeline is no longer available.
Is it no longer needed due to the change in the way pipelines are handled or is there another method?
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.