How to create a DNN widget? - module

If I understood correctly, DNN widget is a way to add a js to every page on the website using module or theme. Right?
My goal evantually is to add a js to every page on a portal and preferably to do that via module that has no need to be added to every page manually.
My plan B is adding module and using setting "Display Module on All Pages", but widget seems to be a better way to do that.
At first I've tried to use this instruction. I've added the YourCompany.Widgets.SampleWidget.js file to root of existing DNN module. Also in the .dnn manifest file inside components tag I've added another component like this:
<component type="Widget">
<widgetFiles>
<basePath>YourCompany</basePath>
<widgetFile>
<name>YourCompany.Widgets.SampleWidget.js</name>
</widgetFile>
<widgetFile>
<name>license.txt</name>
</widgetFile>
<widgetFile>
<name>releasenotes.txt</name>
</widgetFile>
</widgetFiles>
</component>
I've got this error on module installation:
Failure File specified in the dnn could not be found in the zip file: - D:\Projects\website.com.ua\Host\Install\Temp\vp1vioj1\YourCompany.Widgets.SampleWidget.js
vp1vioj1 part is changing every time (seems like it's some unique id that is generating on module install).
Then I tried to place this widget component inside another package tag after checking this article. Like this:
<dotnetnuke type="Package" version="5.0">
<packages>
<package name="ModuleName" type="Module" version="00.00.01">
<!-- some module content here -->
</package>
<package name="YourCompany.SampleWidget" type="Widget" version="00.00.01">
<components>
<component type="Widget">
<widgetFiles>
<basePath>YourCompany</basePath>
<widgetFile>
<name>YourCompany.Widgets.SampleWidget.js</name>
</widgetFile>
</widgetFiles>
</component>
</components>
</package>
</packages>
</dotnetnuke>
But I still got the same error on install. I didn't find any other instructions or documentations regarding widgets. When I tried to check the DNN source code - it seems to be also very time consuming and hard way.
So could you please help me to clarify this?

Support for Widgets in DNN Platformnwas dropped a number of years ago.
Your best option if you want something ok all pages would either be to look at a SkinObject, like the breadcrumb or Login for example. Or a traditional module but marking it “display on all pages”

First, you might want to take a look at the concept of DNN Extensions and how they are built and packaged.
If examples of versions DNN extensions, https://github.com/WillStrohl/dnnextensions. The examples include a widget. So check it out.
Now, what you posted looks like a .dnn file, which the the manifest file that is intended to be a part of a packaged DNN extension. Code and other bits and pieces go into the packaged extension (really a specially named zip file). The packaged extension is installed into your DNN installation via the Extensions Persona Bar page (click the Install Extension there).
From my experience with DNN (2006 to now), I believe that I can say that a DNN Widget is something that I've never had anything to do with. So, you may be barking up an old any dying tree in the project.
If you want something included on every page, it makes more sense to include it in the theme (skin). If you want a javascript file, add that to your theme project and have the .ascx files include it, probably using https://docs.dnncommunity.org/api/DotNetNuke.Web.Client.ClientResourceManagement.html (see https://docs.dnncommunity.org/api/DotNetNuke.Web.Client.ClientResourceManagement.html)
But, if you are determined to use a widget, start with https://www.kalyani.com/blog/2009/12/25/dotnetnuke-widgets-guide-part-1-of-4/

Related

Modify product labels xml in Odoo

I’m having several issues when trying to modify the default template of product labels. I need to add some new fields to the existing template that generates the document of product labels (and to design in with proper dimensions).
I am not able to find the xml template to modify it because I can’t find the file. This is a topic I have been researching deeply through the internet during the lasts days and all my attempts have been unsuccessful.
On the Internet, it is said that the product labels are generated using the product/report/product-label.xml and product_label.xsl:
https://www.odoo.com/es_ES/forum/ayuda-1/question/product-label-prints-only-one-variant-attribute-74684
The issue is that I can’t files these files in my Odoo installation folder (tested with both Windows and Ubuntu). These are my folder contents in Ubuntu usr/lib/python3/dist-packages/odoo/addons/product/report:
Should I create the xml and xsl files?
If so, how can I reference them? I have already tried to modify the xml file to try if the options for rendering the report change and nothing’s happens...
Here is the xml that I have been modifying (looks like it is an index of the different available reports but I haven’t found any official documentation regarding this) (note that I’ve added a number to each report title to see if something changes):
And the select options are still the same, as it can be seen in the following screenshot.
Am I’m missing something? It looks like these templates are located somewhere else and I’m editing these files without success (and restarting the Odoo server doesn’t work either...).
I'm using Odoo v12.
Thank you for your help!
<report> tag in odoo is actually shortcut of ir.action.report model record creation, qweb-pdf or qweb-html type of report needs a qweb template to render the report output, which is mentioned in name and file properties in the report tag.
After changing the files in a odoo module, if that module is already installed before change, you have to update the module. You can update from Apps menu of odoo web panel. For example, in this case, you are making change in product module which is named Products & Pricelists in odoo Apps. After making change, update that module and you will find the changes effective. Also, if you are adding new XML file, you have to add respective file name in __manifest.py__, or have to import in __init.py__ if you are adding new python file in the module.

Custom widget in thingworx

Could any body let me know how to create custom widget in thingworx.
I don't have any idea how to create custom widget.
Please help me.
I have to build drag drop custom widget and we can use that custom widget with other widget. e.g with tree widget,... etc.
I would recommend reading the official Extension Package Development Guide:
However, the best way to start making a new widget is to take an existing widget that does something like you want, and modify it. Built in widgets exist at
TomcatRoot\webapps\Thingworx\Common\thingworx\widgets
Here's a very brief guide to getting started with that. If you were to want to copy Textbox:
Open the metadata.xml and change the "TextBox" to "MyWidget".
There are two sections in this file. The "ExtensionPackage" section holds metadata for the pacakge (version, vendor, etc.)
The second section , "Widgets" defines the widget files. Change the name of all these files to use your name e.g. MyWidget.ide.js Don’t forget to change name in the “Widget” xml tag too.
Rename all necessary folder and files, replacing "TextBox" with "MyWidget"
Open the both .js files and change the definition in each to reflect "MyWidget"
In the ide file, change the icon path "widgetIconUrl" and the "name" property.
Select the "ui" folder and the metadata.xml file and package them both into a new zip file. This file should import into Thingworx.
I would suggest searching for or asking this question in the PTC IoT Community, which is much more active for Thingworx developers than StackExchange.
UPDATE: The latest documentation for ThingWorx 9 Extension Package Development Guide can be found here

Exporting code style settings from IntelliJ IDEA version 14.1.5

I'm using the updated version of the IntelliJ IDEA and am trying to export my code style settings so that they can be used by all developers working on a particular project. I read the tutorials at https://confluence.jetbrains.com/display/IntelliJIDEA/Code+Styles and http://forum.shakacode.com/t/sharing-your-intellij-rubymine-webstorm-codestyle-among-developers/240, which seems fairly simple.
Unfortunately that is not how my 'export settings' pane looks like, and I don't have a line that says 'code styles'. Mine looks like
The closest I can find is the line I highlighted which has CodeStyleSettingsManager in it along with a whole bunch of other stuff. However I tried using that and extracted the .jar file only to find that there was nothing much inside at all.
Does anyone know a way of exporting code styles that works with the latest version of IntelliJ?
Edit: My codeStyleSettings.xml file only contains the following:
<project version="4">
<component name="ProjectCodeStyleSettingsManager">
<option name="PER_PROJECT_SETTINGS">
<value/>
</option>
<option name="USE_PER_PROJECT_SETTINGS" value="true"/>
</component>
</project>
I don't understand, why you don't see Code Style in your list (it appears in my IDEA 14.1.5), but...
(...) export my code style settings so that they can be used by all developers working on a particular project
A better way to share the project code style across all developers is to include it in your VCS repository. Pulling such a commit will apply those code styles automatically. This is the file: project/.idea/codeStyleSettings.xml. If your VCS is set to ignore .idea/, add an exception for this file.
If you don't see this file at all, you're probably using a local formatter and your Project scheme is unchanged. In this case, go to Settings > Editor > Code Style > Scheme: Manage, select your formatter and click Copy to Project.
Update
Code style files only state the difference to the IDEA Default Code style (which is always the same). You can try this yourself: create a new project, go the the Code Style settings, select Project and change only one option. The codeStyleSettings.xml file will be created, and it will contain only this one option. If you could export your code style settings, the output would be exactly the same.

SharePoint 2010 to 2013 SharePoint Migration issues

I recently migrated custom WebPart template solution (wsp), which has custom list definition, from SP2010 to SP2013 using Visual Studio 2013. Set the Assembly Version to 15 and compiled over .Net Framework 4.5. The deploymnet was successful. But there are 2 problems:
1. When I created site using the custom template that was just deployed, the page displays cluttered icons, attached screen shots. Also when trying to add permission to the site, a whole bunch of colorful cluttered icons appear on the site's Permissions page.
2. The other issue is, some of the CSS, specifically the ms-WPxxxxxxxx (like WPTitle, WPHeader etc) are being inherited, probably from corev4.css. That’s what View Source shows. The custom CSS is defined in the main page (CustomDefault.aspx) with “!important” tag, but that didn’t seem to be of any use.
The same solution was working perfect on SP2010.
Suspect mostly (1) is related to (2), I may be wrong.
To resolve (1), as advised by SP folks from MSDN Community forum, I changed the default master page to Oslo.master ==> that cleared the cluttering icons, but CSS and Javascripts werent working. So I had to revert.
I also tried changing the "../_layouts/.." to "../_layouts/15/..", that didnt make any difference.
MSDN Community Thread:
https://social.msdn.microsoft.com/Forums/office/en-US/f9199e0c-972b-45b9-b8fb-772028bc22d9/cluttered-icons-in-sharepoint-2013-post-migration-from-sp2010?forum=sharepointdevelopmentprevious#74fb3648-9776-4f68-82ba-b212102a1492
Any help will be appreciated.
enter image description here
After a long battle, I finally fixed this problem. Found that the 'onet.xml' in the SiteDefinition module was referring to SharePoint 2010 master page, v4.master. Since this was another project, I did not have a clue that this file will have references to SP2010 resources. Many blogs suggested only to change the resources path like '/_layouts/' to '/_layouts/15/' and the '/ControlTemplate/' to '/ControlTemplate/15/' but not seen anyone mentioning about master page change. Probably may not be the case for a completely out-of-box solution. So search for 'v4.master' (SP2010), in the project solution, if found, change it to your custom master page, if you have one, or to the default master page. But if you have used any other master page or a custom master page that was exclusively meant for SP2010 or an older version of SharePoint, you would have to choose an equivalent one or customize it to make it compatible with SP2013.
So here's the code snippet that was changed and that got rid of the cluttering icons, hope it helps someone out there.
<!-- <Configuration ID="-1" Name="NewWeb" MasterUrl="_catalogs/masterpage/**v4.master**" />
<Configuration ID="0" Name="Default" MasterUrl="_catalogs/masterpage/**v4.master**">
<Configuration ID="1" Name="Blank" MasterUrl="_catalogs/masterpage/**v4.master**">
<Configuration ID="2" Name="DWS" MasterUrl="_catalogs/masterpage/**v4.master**"> -->
<Configuration ID="1" Name="NewWeb" MasterUrl="~masterurl/**default.master**" />
<Configuration ID="0" Name="Default" MasterUrl="~masterurl/*default.master*">
<Configuration ID="1" Name="Blank" MasterUrl="~masterurl/**default.master**">
<Configuration ID="2" Name="DWS" MasterUrl="~masterurl/**default.master**">

Where should I put my custom widget files in Yii framework?

From this page,
http://www.yiiframework.com/wiki/23/how-to-create-a-breadcrumb-widget/
It seems it suggests that we should put the files in the component folder. But if my widget contains javascript and css files, where should these files be placed?
By the way, is this a good idea that I create it as an extension? If I go this way, all widget files are more self-contained in a folder inside the extension folder. But since the widget I am going to work on is very customized, it's unlikely that it will be useful to other people or my other projects. Making it an extension seems a little bit strange.
I understand that it does not really matter where I put these files as long as the paths I am using in the codes are correct but I would like to know the common practice.
I think the common practice is to put the widget in extensions folder with js & css files in an folder named asset. In the php class file, you do initialization first by publishing the asset with yii asset manager.
The file structure may be like
extensions/
widget_name/
widget.class.php
assets/
plugin.js
style.css
I would join the recommendation to put the widget under /protected/extensions.
I put the assets in a slightly more detailed manner: /protected/extensions/WidgetClassName/assets/ and the widget view files in /protected/extensions/WidgetClassName/views/...
Don't forget to edit your /protected/config/main.php and add a row in the 'import' section (for autoloading of the widget): 'ext.WidgetClassName.WidgetClassName.*'