Make Fiori header fields invisible - javascript

I want to hide the Fiori app header field (which is used in several apps) in one of the apps, but SAP has not provided any extension to hide these type of fields.
How can I make Fiori header fields invisible?

Runtime Adoption (RTA) of UI5 could be used to remove/hide/rename/etc. UI elements. If you start the application with a user who is a key user (has SAP_UI_FLEX_KEY_USER) then you can switch to adoption mode via the 'Adapt UI' button & do the adjustments via hovering over individual UI elements. The result can be published and transported from dev landscape.
More at: https://help.sap.com/doc/saphelp_nw751abap/7.51.0/en-US/5c/424437bf794f809087fdce391149f2/content.htm?no_cache=true

You can do the following:
create a new library which contains a control which extends the PersinfoControl of library hcm.lib.common. In this extention overwrite the init function of this control, first call super, then replace the header with a custom fragment(copy of the original without the button).
Extend the Family Data app an replace the main View. Replace the reference to library hcm.lib.common with your newly created library.

Related

How to update DocProperty fields with Word js

I'm developing an Office 2016 Addin using Word js 1.3. The addin allows to define custom properties and save their value.
I'd like to add a button in the UI of my Addin that updates all usages of DocProperty fields (see pic 1) in the document which use custom properties that the user added. Basically the button should update the fields (see pic 2).
I mean these things here:
I can't wrap the fields in ContentControls and then update those. The documents come pre-configured with some custom properties and their content must not be changed.

Ext JS 4.2 primer

My company just bought a third party application which is based on the ext js 4.2. framework.
The software is closed source, but it is web based such that I can add a .js file to change the UI to my needs.
I want to add some controls to the rendered page. The software is showing IDs everywhere instead of text.
Example: "Issue created by: ID123". When I hover the field is get "ID123. John Doe". Ok, I am a JS ninja, so I can just add a field to the HTML DOM which will display "John Doe"in the correct spot.
I looked at the HTML code to get the correct control and see the the IDs are generated. The code I would write is prone to break with each new release of the third party software.
Now, since the is an Ext JS application I can probably solve the issue much more elegantly like adding a field not to the DOM directly but to the Ext JS container.
Question:
In Javascript I have a reference to the Ext JS app. How would I access the current view or viewmodel or model to query data and add a field?
Rough idea/Pseudo code:
var id = app.getCurrentModel.getValue("creatorID");
var name = myserver.getPersonData(id).name;
app.currentView.addLabelControl(name);
I googled a lot but all examples I found assumed that you are writing the ext js app and you are already in the controller or the view. But I only got the reference to the app.
Sorry for the newbie question :)
"App Inspector for Sencha"
For a quick glance over component hierarchy, you can use the Sencha browser plugin,
Find a certain ExtJS component programmatically
To quickly search ExtJS components or transform your findings into code, your main tool will be the browser console and the command Ext.ComponentQuery.query(xtype), e.g.
Ext.ComponentQuery.query("grid")
Ext.ComponentQuery.query("panel")
Ext.ComponentQuery.query("form")
You will then find in browser console an array of all components of that type. Select the right one, and check whether it has an id or itemId that is not auto-generated (everything like xtype-1234 is auto-generated). For form fields, the name attribute could be useful. Commands like
Ext.ComponentQuery.query("[itemId=ABC]")
Ext.ComponentQuery.query("[name=DEF]")
Ext.getCmp(id)
are far more readable and not as prone to side effects as Ext.ComponentQuery.query("panel")[12].
Most of the time, it can also be useful to think in tree structure. If you want a certain container which contains the only slider you see, trying
Ext.ComponentQuery.query("slider")
Ext.ComponentQuery.query("slider")[0].up()
could be easier than sifting through dozens or even hundreds of containers. Ways to traverse the component structure include up(xtype), down(xtype), nextSibling(xtype), previousSibling(xtype). If an xtype is provided, the next component of the corresponding xtype is selected; if it isn't provided, the next component is selected regardless of the type (e.g. direct parent, adjacent sibling).
Change anything you want.
You can extend, debug or modify any existing behaviour, including but not limited to ExtJS's own code, using a so-called override over any component, including the views or stores that make up this app. override makes a great search term for further information.
Or you can add new components to existing components, like a button to an existing form, from outside the app. For example, open sencha docs and then insert in console:
Ext.ComponentQuery.query("searchcontainer")[0].up().insert(1,{xtype:'button',text:'Test',handler:function(){Ext.Msg.alert('Test Button clicked');}});
You should then find a button on the top left, right of the Sencha logo. Click it.
Find existing controllers
For this, you have to find the name of the app namespace.
If it is e.g. MyApp, then MyApp.app.controllers.items contains the list of controllers. Controllers contain control logic, and the mapping between the components and the logic. When components are created, controllers attach their events to these new components. Many changes can and should be made in the component layer, because controller overrides are messy.
Find viewmodels
You're already done, ExtJS 4.2 does not support them.
Changing models
If you want to change models, be cautious: There is no supported function to add fields to a model. You can override the model prototype, and push more entries into the fields array. But if you have any model instances (records) already running around by that time, they are not updated and any existing warranty is voided.
That said, you find them in MyApp.model. You can e.g. get all fields of the Sencha Docs' Comment model using Docs.model.Comment.prototype.fields, or even push another field in.

Can a custom navigation link have an arbitrary ribbon showing?

I'm customizing the Quote entity, aiming to replace the stock Quote Products grid with a customized, Silverlight-powered DataGrid. It basically aims to extend the basic "related records view" functionality (mostly, it adds some calculated fields and inline editing, nothing too fancy).
Of course, the more seamlessly integrated the whole thing ends up to be, the better: I skinned it nicely, basic functionalities are there, but the Ribbon is a big issue, I would like it to show up the Quote Details SubGrid ribbon but obviously the thing has no knowledge about what my custom navigation link is showing.
I know Ribbon Rules but they don't seem to address this need; I'm not aware of any XRM function to accomplish it either. Is it even doable ? If so, how can I accomplish this ?
More about what I already have:
I added a custom link (let's name it My Awesome Grid) to the lefthand Navigation Area, pointing to an HTML Web resource (let's name it new_AwesomeGridPage). This resource merely hosts a Silverlight application (which is yet another web resource, new_AwesomeGrid) containing a DataGrid which lists the Quote Details in a customized, fancier way. The grid is being fed via the OData service and everything works smoothly (it could be pointed out that it doesn't really matter where the data comes from and what it represents, and it would be true of course), except for the Form Ribbon which doesn't "switch" like it does when one clicks a builtin navigation link for a related entity. I am thereby wondering how (if?) one can force the ribbon to show the commands for an arbitrary related entity, when a custom navigation link is used to show an HTML Web Resource ?
Hmm bit of an awkward situation, I'm afraid I don't have a detailed solution to this, just an approach.
As far as I know there is no way to just 'hook up' the standard ribbon to a custom Silverlight grid.
I think what you will have to do is; add enable/visibilty rules to all the existing buttons and then disable/hide them when someone is looking at your grid. What form this rule will take I'm not sure, possibly JavaScript.
Then create new buttons with JavaScript actions that communicate with your Silverlight application, then have your Silverlight application perform whatever logic is required.
For ribbon customisations I would suggest starting with the Ribbon Workbench, its an excellent tool for ribbon editing.

Design Pattern: Using Javascript MVC to build a toolbar

So I am building a complex web app, part of this involves the building of a tools panel.
The tools panel will be composed of buttons or subpanels.
Each button should have an action attached - it can either be clicked on or dragged somewhere to provide a function
Sometimes when a button is clicked on a panel will appear in the
toolbar with cool stuff in it :)
As the app evolves new buttons will appear
I may want to change the order of the buttons or attach an existing panel to a different button
I want to design this entire app using JQuery MX. The toolbar is the crux of the app and will be coded first and so I aim to use the development of this to learn how to wield my first MVC JQuery app.
Can anyone offer a starting point regarding how to start this kind of beast?
I understand that the controller is the starting point, and is coded as one might a JQuery function but not entirely sure how models and views will work with this in JQuery MX
I actually built a webapp with a toolbar, though not in JavaScript MVC (which I thought was unnecessarily complicated).
Build a config file like buttonName : actionName. The controller runs through the config file and assigns the action to the button's click event.
My toolbar was quite small (ten buttons or so, although they did change), so I kept all the actions in one controller, although each action was only a couple of lines, calling a separate plugin. If you have lots of buttons, you might want to separate out the actions into different controllers.
Then you have a plugin with a set of generic code which handles visual presentation of the toolbar - drop shadows, background-colors, icon management, etc. Just use addClass / removeClass, and style the different button states with CSS. For HTML, I made each button an '' tag, so it degraded gracefully.
Subpanels are just additional functions on the presentation layer.

Dynamically display Edit Control Block menu item in SharePoint

I am trying to set up dynamic per-item menus (Edit Control Block) in SharePoint 2007. My goal is to have certain features that are available based on the current user's group membership.
I know that the CustomAction tag that controls the creation of this menu item has a Rights attribute. The problem that I have with this is that the groups I am using have identical rights in the site (ViewListItems, ManageAlerts, etc). The groups that we have set up deal more with function, such as Manager, Employee, etc. We want to be able to assign a custom feature to a group, and have the menu items associated with that feature visible only to members of that group. Everyone has the same basic site permissions, but will have extra options availble based on their login credentials.
I have seen several articles on modifying the Core.js file to hide items in the context menu, but they are an all-or-nothing approach. There is an interesting post at http://blog.thekid.me.uk/archive/2008/04/29/sharepoint-custom-actions-in-a-list-view-webpart.aspx that shows how to dynamically modify the Actions menu. It is trivial to modify this example to check the users group and show or hide the menu based on membership. Unfortunately, this example does not seem to apply to context menu items as evidenced here http://forums.msdn.microsoft.com/en-US/sharepointdevelopment/thread/c2259839-24c4-4a7e-83e5-3925cdd17c44/.
Does anyone know of a way to do this without using javascript? If not, what is the best way to check the user's group from javascript?
There are two different Javascript functions that you can implement for dynamically adding menu items to list item drop downs. Core.js (C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\1033\CORE.JS) checks for the existence of these methods when generating the menu items for a selected list item. "Custom_AddDocLibMenuItems" and "Custom_AddListMenuItems" are the names of the Javascript methods.
One article that I think you can use to solve your specific problem, dynamic menu item customization based on user role membership, can be found here:
MSDN: Customizing the Context Menu of Document Library Items (note the process is exactly the same for any list type)
This article outlines how server side code can be executed to define the menu items that will be displayed:
[...] in more complex cases, you must retrieve the list of available commands from the server, because only there you can run your business logic and perhaps get the commands from a custom database. Typically, you want to do this if you are implementing a workflow solution where each document has its own process state, with commands associated to it.
The solution for this situation is to have the Custom_AddDocLibMenuItems dynamically call a custom ASP.NET page. This page takes the ID of the document library and the specific item on the query string, and returns an XML string containing all the information for the commands available for that particular document. These commands are available according to the document's process status (or some other custom business logic). [...]
Unfortunately this is not possible to accomplish without using javascript. The ECB doesn't render server controls defined as a custom action (unlike the SiteActions etc).
To learn how to accomplish this by using Javascript check out the following article:
http://www.helloitsliam.com/archive/2007/08/10/moss2007-%E2%80%93-item-level-menus-investigation.aspx

Categories