Messages are not displayed properly after customizing Alfresco share - alfresco

I want to add the action "document-edit-properties" in the folder details page. So in share-config-custom.xml I have added the action id in the actionGroup(for id =folder-details) as below. Now the action is visible in the folder details page, but the title and the "All properties" are not displayed properly in the popup.
<actionGroup id="folder-details">
<action index="100" id="folder-download"/>
<action index="105" id="document-edit-metadata" icon="folder-edit-metadata" label="actions.folder.edit-metadata" />
<action index="115" id="document-edit-properties" icon="folder-edit-properties" label="actions.folder.edit-metadata" />
<action index="110" id="document-approve" icon="folder-approve" />
<action index="120" id="document-reject" icon="folder-reject" />
<action index="130" id="document-copy-to" icon="folder-copy-to" label="actions.folder.copy-to" />
<action index="140" id="document-move-to" icon="folder-move-to" label="actions.folder.move-to" />
<action index="150" id="folder-manage-rules" />
<action index="160" id="document-delete" icon="folder-delete" label="actions.folder.delete" />
<action index="170" id="document-manage-granular-permissions" icon="folder-manage-permissions" label="actions.folder.manage-permissions" />
<action index="180" id="document-manage-repo-permissions" icon="folder-manage-permissions" label="actions.folder.manage-permissions" />
<action index="190" id="document-manage-aspects" label="actions.folder.manage-aspects" />
<action index="200" id="document-change-type" label="actions.folder.change-type" />
<action index="210" id="view-in-explorer" />
<action index="220" id="document-view-in-source-repository" label="actions.folder.view-source-repository" />
<action index="350" id="document-view-googlemaps" />
<action index="360" id="document-cloud-sync" />
<action index="370" id="document-cloud-unsync" />
<action index="380" id="document-view-in-cloud" />
<action index="390" id="document-request-sync"/>
</actionGroup>
Am unable to figure out why message is not proper. In folder browse page the messages are displayed properly.
Alfresco Version : 4.2.6
Can someone please help... Thanks in advance!

Make sure that you add a bean for your message properties and that you specify the properties and labels you need in Share. See http://docs.alfresco.com/4.2/concepts/kb-preset-internationalization.html for details.
Also, see the answer (at the bottom) of a question about some of this here https://community.alfresco.com/thread/199192-content-model-localization-in-share
So, the fix is what I suggest above. Add a bean to a context file like this
<!-- Add module specific messages and labels -->
<bean id="org.alfresco.share-amp.resources"
class="org.springframework.extensions.surf.util.ResourceBundleBootstrapComponent">
<property name="resourceBundles">
<list>
<value>alfresco.web-extension.messages.share-amp</value>
</list>
</property>
</bean>
That bean references a properties file in web-extension/messages named share-amp.properties. It should have the following content.
## Edit Details Dialog
edit-details.title=Edit Properties: {0}
edit-details.label.edit-metadata=All Properties...
Why do you need to do this? If you look at onActionDetails in actions.js, you'll see that it's trying to resolve those and is not able to. I'm not sure why as I haven't done a lot of YUI/share customization, but what I suggest here will fix it for you.

Related

How can hide response Header on bad Request 400 in Asp.net

My requirement is how can hide response Header on bad Request 400 in Asp.net i was trying solve the problems.i will try add some code in web.config file as well as global.asax file but it is not working here i am attach a image for better understanding.can u figure out this problmes.
<system.webServer>
<rewrite>
<outboundRules>
<rule name="Remove RESPONSE_Server" >
<match serverVariable="RESPONSE_Server" pattern=".+" />
<action type="Rewrite" value="Company name" />
</rule>
</outboundRules>
</rewrite>
</system.webServer>
protected void Application_PreSendRequestHeaders()
{
Response.Headers.Remove("Server");
Response.Headers.Remove("Server");
Response.Headers.Remove("X-AspNet-Version");
Response.Headers.Remove("X-AspNetMvc-Version");
}

asp.net mvc hosting angular app with html5mode and routing

Alright, so I am hosting an angularjs inside asp.net mvc 5 and are using the html5mode(true) in my angular app to get rid of all hash signs in the url.
Everything works great, however, with my current setup that looks like this:
RouteConfig.cs:
routes.MapRoute(
name: "Default",
url: "app/{angular}",
defaults: new { controller = "Ng", action = "Index", angular= UrlParameter.Optional }
);
So that when I navigate to http://url/app/myangularroute my Ng/Index action returns the view which contains the ng-view container and the angular app is now active and working with the route provided
Now, my problem here is, when I navigate to http://url/app/ it returns a dir listning not allowed error which I cannot understand. Shouldn't my index action be returned as the angular parameter is set to optional?
And can I somehow avoid the "app" completely and still get my angular app to work? I have tried some rewrite rules but that gives me alot of errors because I am making use of the mvc bundling and minification functionality.
I could live with the url being the format it currently is but without the need to provide the optional parameter, like http://url/app/
Also, it's only an angular app, no other mvc view than the index.cshtml wrapper.
This guy seems to get it to work, but I can't see his mvc routes
Try adding this in your web.config sytem.webserver settings.
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<system.webServer>
EDIT:
Try changing your RouteConfig.cs, like this:
routes.MapRoute(
name: "Default",
url: "app/{*.}",
defaults: new { controller = "Ng", action = "Index" }
);
EDIT2:
I had completely forgoten about this question, but now I just realized that maybe the problem is that you haven't configured your IIS Server to work with Html5Mode, have a look at this: https://github.com/angular-ui/ui-router/wiki/Frequently-Asked-Questions#how-to-configure-your-server-to-work-with-html5mode
Concretelly this part:
Azure IIS Rewrites:
<system.webServer>
<rewrite>
<rules>
<rule name="Main Rule" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="/" />
</rule>
</rules>
</rewrite>
</system.webServer>
I hope that this helps.
This is my solution. I am using ASP.NET MVC + Web API.
ASP.NET MVC always returns the same HTML page for any URL, so AngularJS can take over in $locationProvider.html5Mode(true);
RouteConfig.cs
routes.MapRoute(
name: "Default",
url: "{*anything}",
defaults: new
{
controller = "Home",
action = "Index",
}
);
WebApiConfig.cs
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{action}/{id}/{id1}",
defaults: new
{
action = RouteParameter.Optional,
id = RouteParameter.Optional,
id1 = RouteParameter.Optional,
}
);
HomeController.cs
public ActionResult Index()
{
return File("~/index.html", "text/html");
}
Alright, I got it to work.
By doing this:
Remove the "app" route completely, and use the standard route.
Add the rewrite rule
Remove the base href from the layout
Ohh wow, I turned off the bundling and minification, that was actually what made it work in the end. When I turn it on I get an angular error.
I honestly thought I tried this like 10 times without success. It started to show signs of working when I removed the base href.
Old question but still valid, this is my solution :
<rewrite>
<rules>
<rule name="Main Rule" stopProcessing="true">
<match url=".*"/>
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<!--for local dev enviroment-->
<add input="{REQUEST_URI}" pattern="^/(__browserLink)" negate="true" />
<!--if the url does not match a valid file we don't want it to be redirected to the index page-->
<add input="{REQUEST_URI}" pattern="\.(png|jpg|gif|css|js|html)$" negate="true" />
<!--web api route-->
<add input="{REQUEST_URI}" pattern="^/api/" negate="true" />
<!--ASP.NET Web API Help Page-->
<add input="{REQUEST_URI}" pattern="^/Help" negate="true" />
<!--Swagger-->
<add input="{REQUEST_URI}" pattern="^/apimap" negate="true" />
</conditions>
<action type="Rewrite" url="/" />
</rule>
</rules>
</rewrite>
With my ASP.NET 5 RC site - has WebAPI but not MVC - the solution was to up a default rewrite rule in wwwroot\web.config's system.webserver tag:
<rewrite>
<rules>
<clear />
<rule name="API" stopProcessing="true">
<match url="^(api)(.*)$" />
<action type="None" />
</rule>
<rule name="Main Rule" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="/" />
</rule>
</rules>
</rewrite>
I am facing the same problem, i have set the base href in layout.cshtml ,put the webconfig rewrite rule, when loading the app,In bundle config i have set the all the scripts and css when launch the app ,its not get loaded . unexpected syntax error < is displayed in console.
when i remove the rule and base href and location provider is false , it working fine .
Angular Js Strange issue Ui Router Html5mode enabled page refresh issue in mvc 500 error

IIS 7 Rewrite web.config serverVariables directive not working in sub folder

I have the following code in my web.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="IP Correction">
<match url="(.*)" />
<serverVariables>
<set name="REMOTE_ADDR" value="{HTTP_X-Forwarded-For}"/>
</serverVariables>
<action type="None" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
This works perfectly on the root of my site, however, the rule isn't being triggered in any of the sub folders.
I figured this out. The problem was in this line of code
<action type="None" />
You have to specify the rewrite action
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="IP Correction">
<match url="(.*)" ignoreCase="true" />
<serverVariables>
<set name="REMOTE_ADDR" value="{HTTP_X-Forwarded-For}" replace="true"/>
</serverVariables>
<action type="Rewrite" url="{R:0}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
I faced a similar issue and created an IHttpModule to address it, which you can find here. URL Rewrite seems to have a bug where it won't execute on default document requests. The module doesn't have that issue. To implement it on your site, you'd add it to the <modules> section of your web.config, or if you want it to run server-wide, to your applicationHost.config.
The relevant bit of code is that you're hooking into HttpApplication's BeginRequest event, and running:
void OnBeginRequest(object sender, EventArgs e)
{
HttpApplication app = (HttpApplication)sender;
string headervalue = app.Context.Request.Headers["X-Forwarded-For"];
if (headervalue != null)
{
Match m = REGEX_FIRST_IP.Match(headervalue);
if (m.Success)
{
app.Context.Request.ServerVariables["REMOTE_ADDR"] = m.Groups[1].Value;
app.Context.Request.ServerVariables["REMOTE_HOST"] = m.Groups[1].Value;
}
}
}
The Regex is ^\s*(\d+\.\d+\.\d+\.\d+). Full code at the gist.
If you compiled this code into a class library called HttpModules and put it in your GAC, you could then add this to your <modules> section, something like:
<add name="ClientIP" type="YourLibrary.ClientIP, YourLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=00DEADBEEF00" />

IIS7 and rewriteMap for friendly URL's

I have an external "rewritemaps.config" file with the following entries:
<rewriteMaps>
<rewriteMap name="Cat1">
<add value="2" key="wheels-and-castors" />
<add value="3" key="agricultural" />
<add value="4" key="hydraulic-hose-and-fittings" />
<add value="5" key="engineering-plastics" />
<add value="6" key="sealing-and-jointing" />
<add value="7" key="health-and-safety" />
<add value="8" key="hose-and-ducting" />
<add value="9" key="hose-couplings-and-clamps" />
<add value="10" key="general-consumables" />
<add value="11" key="ceramics" />
<add value="12" key="rubber-and-polyurethane" />
</rewriteMap>
</rewriteMaps>
How do I rewrite URL's such as:
http://www.domain.com/wheels-and-castors/
to the following:
http://www.domain.com/category.asp?catID=2
Note, this is a rewrite, and not a redirect.
I think I'm almost there with the final rewrite line, but I'm struggling on the match and conditions. My current final rewrite line is:
<action type="Rewrite" url="category.asp?catID={Cat1:{C:1}}" appendQueryString="false" />
(where Cat1 is the name of my rewriteMap)
Thanks for any help. Cheers, Chris.
Ok, after a good week of researching and trial & error, I've got it working. Here's the complete rule I'm using, which references an external "rewritemaps.config".
<rule name="Match Category URLs" stopProcessing="true">
<match url="^(?![^/]+?\.(?:css|png|jpg|axd)$)([^/]+)/?$" />
<conditions>
<add input="{URL}" pattern="(.asp|.xml)" negate="true" />
</conditions>
<action type="Rewrite" url="category.asp?catID={CatMap:{R:1}}" appendQueryString="false" />
</rule>
Works perfectly now.
PS. I renamed the rewriteMap to "CatMap" (to avoid anyone getting confused, if following this).

How do I change the following rules to work with URL rewrite 2.0 and IIS 7.0

I have an URL like that :
/eng/myfolder/mycategory.aspx
I would like to transform it in something like:
index.aspx?FolderId=2&LanguageId=1&CategoryID=12
In a word I want to "write" that,
eng => languageId=2 and myfolder => FolderId=2 and mycategory.....
I don't know if i make myself clear but
Thanks.
with http://mywebsite.com/fr/default
Right Now i have :
<add key = "/en/default" value = "default.aspx?LanguageId=1" />
<add input = " {Rewrite:{REQUEST_URI}}" pattern = "default.aspx\?(.+)" />
<action type="rewrite" url="default.aspx?{C:1}" appendQueryString="False" />
But i want Something more global like:
<add key = "/en" value = "LanguageId=1" />
<add input = " {Rewrite:{REQUEST_URI}}" pattern = "(.+)" />
< action type="rewrite" url="default.aspx?{C:1}" appendQueryString="False" />
This is how I would do it, basically create three maps, one for languages, folders and cateogories. If they have large data sets and possibly changing frequently then I would consider using custom provider built in C#, but for now just:
<configuration>
<system.webServer>
<rewrite>
<rewriteMaps>
<rewriteMap name="Folders">
<add key="myfolder" value="2" />
<add key="anotherfolder" value="3" />
</rewriteMap>
<rewriteMap name="Languages">
<add key="eng" value="2" />
<add key="spa" value="1" />
</rewriteMap>
<rewriteMap name="Categories">
<add key="mycategory" value="12" />
<add key="anothercategory" value="10" />
</rewriteMap>
</rewriteMaps>
<rules>
<rule name="RewriteURLs" stopProcessing="true">
<match url="([^/]+)/([^/]+)/(.+?)\.aspx" />
<action type="Rewrite" url="/index.aspx?FolderId={Folders:{R:2}}&languageid={Languages:{R:1}}&CategoryID={Categories:{R:3}}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

Resources