Default values for AEM dialog properties (Sightly) - aem

I need to set a default dialog value in AEM component.
For example - I have dialog with node - namelabel
and I am fetching this in my html as
${properties.namelabel}
Now I want to set the default value to this node property, ie when I am editing a dialog there is always a value set as
namelabel : Name
where in author can change this anytime he wants.
Thanks in advance.

in short - you could use property value which is presented as the default value in touch dialog.
your question is though a sort of duplicate of what's been said here: defaultValue in Touch UI dialogs - AEM/CQ

Related

Can I change "OK" button style in Select Dialog to emphasized?

anyone know if sapui5 provide solution/function to change button style in select dialog? I've checked the SAPUI5 sdk but there is none for this solution.
If you are OK with using "private" properties then you can use _oOkButton property of SelectDialog or else you can use _getOkButton function which also is kind of "private" and returns ok button instance.
Just use the instance of the Select Dialog and get all buttons using the following methods. Select Dialog is a dialog only, you can use the methods of sap.m.Dialog
Let say you have the instance of the dialog as oSlectDialog then
oSlectDialog.getButtons() - will return all the Buttons in the footer. You can use loop them and give custom class accordingly.
var oBtns = oSlectDialog.getButtons()
for(var b in oBtns) {
var oBtn = oBtns[b];//You can check for button instance, if you want to add custom class differently.
oBtn.addStyleClass("YourCustomClass");
}
You can also use the sap.m.Dialog methods like oSlectDialog.getBeginButton(), oSlectDialog.getEndButton().
Since UI5 1.62.0, the primary action OK (later renamed to Select) is automatically emphasized if the theme is sap_fiori_3.
https://openui5.hana.ondemand.com/#/entity/sap.m.SelectDialog/sample/sap.m.sample.SelectDialog
If it's not urgent, I'd suggest to avoid relying on private methods/ properties, but update to the latest UI5 version and themes.
Update: and since 1.70 (commit:1f421b0), the button is automatically emphasized in other supported themes too, such as sap_belize, sap_belize_plus
Related Github issue: https://github.com/SAP/openui5/issues/2254

Pass variable from component model to author dialog

I have a Sightly component with a (JavaScript) UseAPI model in an Adobe AEM/CQ site.
In the model, I have a variable that is calculated when the component loads and is not stored in the JCR (let's say it's a random string).
When an author opens the Granite/Touch UI dialog, there is a custom Granite UI component rendered with a JSP. The JSP has access to the scope of the component in the JCR, but as far as I can tell it does not have access to properties returned by the JavaScript model when rendering the component.
How can I pass/store this 'random string' variable from the Sightly/JavaScript UseAPI so that it can be accessed by the JSP of the dialog?
The variable is context-sensitive so I wouldn't want to store it in a permanent location such as the JCR. A good example may be a unique identifier for an external web service, that is unique for that particular rendering of the component.
I can think of a couple of approaches, with varying applicability:
Dialog field emptyText property: This just shows grayed out/hinting text and does NOT set any content that can possibly be rendered.
Dialog field defaultValue property: This looks very tempting, but I don't recall having success with it.
Dialog event handlers: (adding JavaScript inside the XML of a dialog definition). I am not a fan of this approach since it isn't obvious how/where the magic happens. But it is possible to update/populate fields on dialog load or dialog save.
Component cq:template: just like a page template, you can provide default content when dragging a component into a parsys. This doesn't work for components cq:included into the page/component. Also, it doesn't prevent the author from deleting the value altogether unless you add event handlers on the dialog.
Create a component model. The model can provide default content/values if properties are missing or not populated. The drawback is authors may not understand where magic values are coming from if dialog fields are blank. Once I worked around this by creating a tag that would use authored values, then fall back to dialog emptyText properties, then to possible template values to "fill in" the content. This takes some initial developer effort, but provided hints to the authors if the content was missing, or the component was included instead of dragged on, ...YMMV.
However, none of these may work for you if the value is "context sensitive" and has to be calculated somewhere/somehow. But if it is computed, then it probably shouldn't be authored.

Is it possible to change the title of PKAddPassesViewController ?

Every pass, when being added results in PKAddPassesViewController having its title automatically set according to pass type and respecting localization (Generic get "Card", event ticket gets "Event Ticket", store card gets "Store Card" and so on...); but is it possible to change the title?
I've tried setting title property of PKAddPassesViewController instance, but nothing happened, so maybe there is a attribute in pass.json that can control the title (I didn't find one in PassKit specs)?
No, there is no way in the current framework that this title can be customised, either by the Pass Kit framework or by a pass.json key.

How to add button to settings.bundle?

I'm developing an iPhone app, and by default user keeps logged in. If he wants to logout, he should open the Settings and click a "Logout" button which would erase his data and ask for a login the next time app is opened. How do I add a button like this? As in twitter settings
As CodaFi said it is not possible. However it could be a good workaround to use a toggle switch for "keep me logged in". And when the user turn it off you can show the login screen on next launch.
Unfortunately, this is not possible using public APIs. Bear in mind that Apple reserves many, many undocumented (and exceedingly cool) features for it and it's partner's applications. You are limited to only the following:
Text field: The text field type displays a title (optional) and an
editable text field. You can use this type for preferences that
require the user to specify a custom string value. The key for this
type is PSTextFieldSpecifier.
Title: The title type displays a
read-only string value. You can use this type to display read-only
preference values. (If the preference contains cryptic or nonintuitive
values, this type lets you map the possible values to custom strings.)
The key for this type is PSTitleValueSpecifier.
Toggle switch: The
toggle switch type displays an ON/OFF toggle button. You can use this
type to configure a preference that can have only one of two values.
Although you typically use this type to represent preferences
containing Boolean values, you can also use it with preferences
containing non-Boolean values. The key for this type is
PSToggleSwitchSpecifier.
Slider: The slider type displays a slider
control. You can use this type for a preference that represents a
range of values. The value for this type is a real number whose
minimum and maximum value you specify. The key for this type is
PSSliderSpecifier.
Multivalue: The multivalue type lets the user select
one value from a list of values. You can use this type for a
preference that supports a set of mutually exclusive values. The
values can be of any type. The key for this type is
PSMultiValueSpecifier.
Group: The group type is for organizing groups
of preferences on a single page. The group type does not represent a
configurable preference. It simply contains a title string that is
displayed immediately before one or more configurable preferences. The
key for this type is PSGroupSpecifier.
Child: pane The child pane type
lets the user navigate to a new page of preferences. You use this type
to implement hierarchical preferences. For more information on how you
configure and use this preference type, see “Hierarchical
Preferences.” The key for this type is PSChildPaneSpecifier.
If you don't mind using the 3rd-party add-on "InAppSettingsKit" for your app's Settings, then it looks they would allow you to do what you need. I'm currently studying up on this myself, but from a quick scan through their documentation it looks like they would allow you to add buttons as well as completely custom child pane views: http://www.inappsettingskit.com/
On that page, study the sections "IASKButtonSpecifier" and "Custom Viewcontrollers".
I'll post a follow up here to let you know how this worked out for me. I'm using the InAppSettingsKit already, and love it so far.
Download the code and sample app from Github: https://github.com/futuretap/InAppSettingsKit
Then open the InAppSettingsKit.xcworkspace in your XCode and study how they implemented the various different types of Settings entries. They definitely support what you are looking for. It's really quite impressive.
Erik

How to get value of checkbox added in vsfolderdialog.wiz file

I have added a checkbox in vsfolderdialog.wiz file for customizing Folder Path dialog in Setup and Deplopyment Project. But i have not an idea how i will get its value on which i have to take some decisions.
Note: I am using custom installer action for accessing its value and tried to get Installer.Context.Parameters on Install event
Please help me in this regard.
Regards,
Jhan Zaib
Checkbox Control in Windows Installer is associated with a property. Usually when checkbox is selected, its associated property will have the value you defined; when it's cleared, the property is set to null.