CKEditor 3.x add text to dialog - dialog

I disabled the advanced & target tabs from the link dialog, and only left the URL input box.
Actually what I did is exactly explained here: http://peterpetrik.com/blog/remove-tabs-and-elements-from-ckeditor-dialog-window
My question is, is it possible to add a text string to the dialog (as my supplement hints for users.) ?

Yes, you can use " add(elementDefinition, nextSiblingId) ", to add elements to the dialog.
From the code on the page in your link, I added "infoTab.add" before the "infoTab.remove" entries:
infoTab.add(
{
type : 'html',
html : '<div id="myDiv">Supplemental <b>hint</b>.</div><br />'
},
'linkType'
);
// Remove unnecessary widgets from the 'Link Info' tab.
infoTab.remove( 'linkType');
infoTab.remove( 'protocol');
The nextSiblingId is used to place the new element above an existing element.
I assigned "linkType" as nextSiblingId to place the new element above the url input box.
To place the new element between the url input box and the browse button, replace 'linkType' with 'browse' ( 'browse' is the id assigned to the browse button in the definition for the link dialog ).
To place the new element below the button, just remove ( , 'linkType' ).
Between this information and that found on the page you linked to, you should be able to accomplish your goal.
If you want to get a better understanding of your options, you can look at the following files:
The source files for the link dialog:
http://docs.cksource.com/ckeditor_api/symbols/src/plugins_link_plugin.js.html
http://docs.cksource.com/ckeditor_api/symbols/src/plugins_link_dialogs_link.js.html
http://docs.cksource.com/ckeditor_api/symbols/src/plugins_link_dialogs_anchor.js.html
The source files are also in your CKEditor directory:
ckecitor/_source/plugins/link/
The CKEditor documentation is located here:
http://docs.cksource.com/
Some relevant info from the CKEditor API:
CKEDITOR.dialog
http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.dialog.html
CKEDITOR.dialog.definition.html
http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.dialog.definition.html.html
CKEDITOR.dialog.definitionObject
http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.dialog.definitionObject.html
CKEDITOR.dialog.definition.contentObject
http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.dialog.definition.contentObject.html
Be Well,
Joe

Related

How do I get a relative URL to a media item from my codebehind?

I have a layout web part which has a "Teaser" field. The "Teaser" field uses a "media selection" form control. In this case the field is set to an image uploaded to one of the sites media libraries.
I want to render that image, so I'm trying to get the relative URL to it in the codebehind:
if (Teaser != Guid.Empty) // Teaser is {8d7fa1ab-b304-474f-9ab9-2e17e8fee84f}
{
var mediaInfo = MediaFileInfoProvider.GetMediaFileInfo(Teaser, SiteContext.CurrentSiteName);
// mediaInfo is null so the next line crashes
var libraryInfo = MediaLibraryInfoProvider.GetMediaLibraryInfo(mediaInfo.FileLibraryID);
string url = MediaFileURLProvider.GetMediaFileUrl(mediaInfo, SiteContext.CurrentSiteName, libraryInfo.LibraryFolder);
The "mediaInfo" variabe is null, so the code crashes.
How can I get a relative URL to my media file?
You cannot add the "Media selection" form control in combination with an field type Guid. Then you need to create an custom form control if you need to have only the Guid.
But an better solution is add an field with the data type "text" and in combination with the form control "media selection" then adds directly the relative URL inside the field when selecting an image from the media library.
If you also need the MediaInfo then you can get this object with the parameter "mediaFilePath", like described here : https://devnet.kentico.com/docs/8_2/api/html/M_CMS_MediaLibrary_MediaFileInfoProvider_GetMediaFileInfo_3.htm
Good luck and if you have more questions you can always ask them here on StackOverflow or on http://devnet.kentico.com/questions-answers.
If this answer helped you, please vote for my answer :-)

OpenWrt luci web interface logo picture and modify strings

I am trying to modify the web interface of bootstrap theme in OpenWrt's luci web interface and i managed to change colors and some simple things but i cannot find how to change the names of the tabs (for example instead of "status" to write "status11111"). Also i wanted to add a logo picture on the top of the page and i managed to add it for the login page and also it appears on the default main page after the login but then if I swap to any tab the picture appears like crashed or missing (see the image bellow) and the link becomes like this "/cgi-bin/luci/;stok=96c966ea63a7913b6c02fc09c7862d77/admin/status/overview".
My 2 questions are: how can I change the names of the tabs and how can I add a logo picture on the top of the page so it can appear to every tab? What files do I have to modify?
For question #1 "how to change the names of the tabs", you want to look in /usr/lib/lua/luci/controllers/admin
There will be a number of files including "index.lua", "status.lua", "network.lua", etc. If, for example, you wanted to change the name of the status tab from "Status" to "New Status Tab Name", you would go into status.lua and find the line:
entry({"admin", "status"}, alias("admin", "status", "overview"), _("Status"), 20).index = true
and replace it with:
entry({"admin", "status"}, alias("admin", "status", "overview"), _("New Status Tab Name"), 20).index = true
For question #2, what exactly did you edit when you added the image?

Orchard Navigation - how to make menu link not clickable

I have following menu navigation:
home
product
product 1
product 2
news
press releases
about us
Every menu item above links to a Content, except "product".I need to make it so when the user click "product" would not go anywhere.
I tried to use "Custom Link", and enters "#" or "javascript:void(0)" in the url, however that does not work since Orchard always prefix the url with "/".
Also, I tried to use "Html Menu Item" and enter "product" in the html body, but always rendered as
<li><span class="raw"><p>product</p></span><ul>...</ul></li>
I want either following:
<li>product<ul>....</ul></li>
or
<li>product<ul>....</ul></li>
Is there an easy way to do this?
In the Menu.cshtml file under the Core->Shapes->Views directory in the Orchard.Web project, you could do this:
$(document).ready(function () {
$("#Nav a").click(function(e) {
e.preventDefault();
});
});
The above disables clicking on all of your menu links, so if you want to prevent clicking on the second level menu items:
$('#Nav li ul li a').click(function(e){
e.preventDefault();
});
That Menu.cshtml file is the view for your navigation menu, so you can define it's behavior as you wish there. You can look at this answer of mine as well.
You may do as Mohammad says, but create an alternate Menu.cshtml in your Theme. It is bad practise to modify Orchards core code.

Getting page status history in Sharepoint

I need to get all dates and people modifications to currenlty displayed page, all changes which have been published and end user can see difference between them.
My page is aspx connected to pageLayout in which is richhtmlfield with article.
How to do that? Is it possible to do that ?
If this is for Contributors while the page is in edit mode, they can select Tools > Version History from the toolbar. Otherwise, you can add a link on the page to Versions that is available to all users:
<a href="/sites/mysite/_layouts/Versions.aspx?list=[GUID]&ID=[ID]&FileName=%2Fsites%2Fmysite%2FPages%2FcurrentPage%2Easpx>Modifications</a>
You will need to fill in the values of the list, ID, FileName parameters manually. To generate the link automatically, I would build a custom page layout that generates the URL in Page_Load as follows:
RevisionHistoryAction versions = new RevisionHistoryAction();
string url = versions.NavigateUrl;
RevisionHistoryAction is in the Microsoft.SharePoint.Publishing.WebControls.EditingMenuActions namespace.

Change Edit Control Block (ECB) Link URL in SharePoint

Is there a way to dynamically change the hyperlink associated with an ECB menu in WSS 3.0? For instance, I have a list with 2 fields. One field is hidden and is a link, the other is the title field which has the ECB menu. The title field currently links to the item's view page - but we want it to link to the link-field's url. Is that possible?
UPDATE - 5/29/09 9AM
I have this so far. See this TechNet post.
<script type="text/javascript">
var url = 'GoTo.aspx?ListTitle='+ctx.ListTitle;
url += '&ListName='+ctx.listName;
url += '&ListTemplate='+ctx.listTemplate;
url += '&listBaseType='+ctx.listBaseType;
url += '&view='+ctx.view;
url += '&';
var a = document.getElementsByTagName('a');
for(i=0;i<=a.length -1;i++)
{
a[i].href=a[i].href.replace('DispForm.aspx?',url);
}
</script>
This gives me a link like so (formatted so it's easier to see):
GoTo.aspx
?ListTitle=MyList
&ListName={082BB11C-1941-4906-AAE9-5F2EBFBF052B}
&ListTemplate=100
&listBaseType=0
&view={9ABE2B07-2B47-4390-9969-258F00E0812C}
&ID=1
My issue now is that the row in the grid gives each item the ID property above but if I change the view or do any filtering you can see that the ID is really just the row number. Can I get the actual item's GUID here?
If I can get the item's ID I can send it with the list ID to an application page that will get the right URL from field in the list and forward the user on to the right site.
I think the easiest solution and one I use regularly to modify default sharepoint functionality without having to install server side code is to inject some javascript onto the page to make the necessary modifications.
The Content Editor webpart is ideal for this if you don't want to edit the page source itself. Together with the IE Developer Toolbar or Firebug to inspect the elements you want to edit you should be able to achieve what you need with just a couple of lines of javascript.
Let me know if you need any further detail on getting this work.
The title/link to edit menu is a computed field - basically a combination of the title and item id. If you look at the definition of the field (off the top of my head I think it's in fields.xml) you should be able to create a modified version in your schema.xml that uses the url field in its RenderPattern.
Following up on Tom's answer, you can use the SharePoint Solution Generator in VseWss 1.3 to generate a Visual Studio solution that can re-create your list. You will faint when you see the huge amount of XML that the views use in the schema.xml file but you will see the render pattern that Tom referred to and you should be able to get a general idea of how to modify it to suit your needs.
Gotta love SharePoint. Where small customizations means "take what I give you or rewrite it from scratch"

Resources