Skip to content

Commit

Permalink
First Load
Browse files Browse the repository at this point in the history
  • Loading branch information
cgillis-aras committed Sep 19, 2017
1 parent b798582 commit f2b9bce
Show file tree
Hide file tree
Showing 9 changed files with 316 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<AML>
<Item type="CommandBarButton" id="A0490E44FEED435AA64022F4EBE1A19A" action="add">
<image>../Images/RefreshFromDatabase.svg</image>
<label xml:lang="en">Refresh from DB</label>
<on_click_handler keyed_name="Refresh from Database" type="Method">058191470A844487B51B2F5F78A785CF</on_click_handler>
<on_init_handler keyed_name="cui_reinit_twt_refresh" type="Method">4E7546B00C804E5CB0AFBA81AE276B6A</on_init_handler>
<tooltip_template xml:lang="en">Refresh from DB</tooltip_template>
<name>aras_labs.twt_refresh_from_db</name>
</Item>
</AML>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<AML>
<Item type="CommandBarMenuButton" id="59FF1B073BB54D8BACC0D23D1B80C96A" action="add">
<label xml:lang="en">Refresh from Database</label>
<on_click_handler keyed_name="Refresh from Database" type="Method">058191470A844487B51B2F5F78A785CF</on_click_handler>
<parent_menu keyed_name="com.aras.innovator.cui_default.twmm_tools_menu" type="CommandBarMenu">5A9D1662308A437099AF0B67B737077A</parent_menu>
<name>aras_labs.twmm_refresh_from_db</name>
</Item>
</AML>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<AML>
<Item type="CommandBarSectionItem" id="FA9EE10174E146FBBBE9EFB23782C2E5" action="add">
<action>Add</action>
<related_id keyed_name="aras_labs.twmm_refresh_from_db" type="CommandBarItem">
<Item type="CommandBarMenuButton" id="59FF1B073BB54D8BACC0D23D1B80C96A" action="add">
<label xml:lang="en">Refresh from Database</label>
<on_click_handler keyed_name="Refresh from Database" type="Method">058191470A844487B51B2F5F78A785CF</on_click_handler>
<parent_menu keyed_name="com.aras.innovator.cui_default.twmm_tools_menu" type="CommandBarMenu">5A9D1662308A437099AF0B67B737077A</parent_menu>
<name>aras_labs.twmm_refresh_from_db</name>
</Item>
</related_id>
<role keyed_name="World" type="Identity">A73B655731924CD0B027E4F4D5FCC0A9</role>
<sort_order>1921</sort_order>
<source_id keyed_name="com.aras.innovator.cui_default.tearoff_window_main_menu" type="CommandBarSection">BDB17A0A3DF74336BBE40C81E16467F0</source_id>
</Item>
</AML>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<AML>
<Item type="CommandBarSectionItem" id="FC938C36D64840CE8926B4BF6599BAD3" action="add">
<action>Add</action>
<related_id keyed_name="aras_labs.twt_refresh_from_db" type="CommandBarItem">
<Item type="CommandBarButton" id="A0490E44FEED435AA64022F4EBE1A19A" action="add">
<image>../Images/RefreshFromDatabase.svg</image>
<label xml:lang="en">Refresh from DB</label>
<on_click_handler keyed_name="Refresh from Database" type="Method">058191470A844487B51B2F5F78A785CF</on_click_handler>
<on_init_handler keyed_name="cui_reinit_twt_refresh" type="Method">4E7546B00C804E5CB0AFBA81AE276B6A</on_init_handler>
<tooltip_template xml:lang="en">Refresh from DB</tooltip_template>
<name>aras_labs.twt_refresh_from_db</name>
</Item>
</related_id>
<role keyed_name="World" type="Identity">A73B655731924CD0B027E4F4D5FCC0A9</role>
<sort_order>161</sort_order>
<source_id keyed_name="com.aras.innovator.cui_default.twt_normal" type="CommandBarSection">8D2C120D9A65414690A0E8D001A8FBC9</source_id>
</Item>
</AML>
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<AML>
<Item type="Method" id="058191470A844487B51B2F5F78A785CF" action="add">
<execution_allowed_to keyed_name="World" type="Identity">A73B655731924CD0B027E4F4D5FCC0A9</execution_allowed_to>
<method_code><![CDATA[var inn = this.getInnovator();
var doc = parent.frames[1].document;
if (doc)
{
// Make sure that any changes will not be overwritten unintentionally
if (top.aras.isDirtyEx(doc.thisItem.node))
{
var options = {dialogWidth: 400, dialogHeight: 200, center: true},
params = {
aras: top.aras,
message: "Refreshing from the database will overwrite your changes. Do you wish to continue?",
buttons: {
btnYes: top.aras.getResource('', 'common.yes'),
btnCancel: top.aras.getResource('', 'common.cancel')
},
defaultButton: 'btnCancel'
},
returnedValue;
var wnd = top.aras.getMainWindow();
wnd = wnd === top ? wnd.main : top;
if (wnd.showModalDialog) {
returnedValue = top.aras.modalDialogHelper.show('DefaultModal', wnd, params, options, 'groupChgsDialog.html');
} else {
returnedValue = 'btnCancel';
if (window.confirm("Refreshing from the database will overwrite your changes. Do you wish to continue?")) {
returnedValue = 'btnYes;'
}
}
if (returnedValue == 'btnCancel')
{
return null;
}
}
// Get the most recent generation of the currently opened item
var itemID = doc.itemID;
var itemType = doc.thisItem.getType();
var oldPart = inn.newItem(itemType, "get");
oldPart.setID(itemID);
oldPart = oldPart.apply();
var newPart = inn.newItem(itemType, "get");
newPart.setProperty("config_id", oldPart.getProperty("config_id"));
newPart.setProperty("is_current", "1");
newPart = newPart.apply();
// Show the newest generation of this item in the same tearoff window or tab
doc.thisItem = newPart;
top.aras.uiReShowItemEx(oldPart.getID(), doc.thisItem.node);
}
]]></method_code>
<method_type>JavaScript</method_type>
<name>Refresh from Database</name>
</Item>
</AML>
3 changes: 3 additions & 0 deletions Imports/imports.mf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<imports>
<package name="aras.labs.RefreshFromDatabase" path="RefreshFromDatabase\Import" />
</imports>
94 changes: 94 additions & 0 deletions Innovator/Client/images/RefreshFromDatabase.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017 Aras Labs

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
84 changes: 83 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,83 @@
Repo
# Refresh From Database

This package adds a method and a button to the tearoff window which refreshes from the database. The default refresh button only refreshes from the dom.

## Project Details

#### Built Using:
Aras 11.0 SP10

#### Versions Tested:
Aras 11.0 SP10, Aras 11.0 SP9 (open release), Aras 11.0 SP7

#### Browsers Tested:
Internet Explorer 11, Firefox 45 ESR, Chrome

> Though built and tested using Aras 11.0 SP10, this project should function in older releases of Aras 11.0 after SP7 when CUI functionality was introduced.
## Installation

#### Important!
**Always back up your code tree and database before applying an import package or code tree patch!**

### Pre-requisites

1. Aras Innovator installed (version 11.0 SPx preferred)
2. Aras Package Import tool
3. RunClientMethod import package

### Install Steps

#### Code tree Installation
These code tree changes only contain a custom icon for the toolbar. If you wish to use your own icon, you may replace the .svg file in the `\Innovator\` folder with your own.

1. Backup your code tree and store the archive in a safe place
2. Navigate to your local `..\RefreshFromDatabase\` folder
3. Copy the `\Innovator\` folder
4. Paste this at the root of your install directory
+ By default this is `C:\Program Files\Aras\Innovator\`

#### Database Installation
1. Backup your database and store the BAK file in a safe place.
2. Open up the Aras Package Import tool.
3. Enter your login credentials and click **Login**
* _Note: You must login as root for the package import to succeed!_
4. Enter the package name in the TargetRelease field.
* Optional: Enter a description in the Description field.
5. Enter the path to your local `..\RefreshFromDatabase\Import\imports.mf` file in the Manifest File field.
6. Select **aras.labs.RefreshFromDatabase** in the Available for Import field.
7. Select Type = **Merge** and Mode = **Thorough Mode**.
8. Click **Import** in the top left corner.
9. Close the Aras Package Import tool.

####

You are now ready to login to Aras and try out the Refresh From Database button.

## Usage

1. Log in to Aras as admin.
2. Open any item.
3. Confirm there is an additional refresh button next to the default refresh button.
4. When you want to refresh an item to see content another user has edited, you may click this new button to refresh the item with information from the database.


## Contributing

1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request

For more information on contributing to this project, another Aras Labs project, or any Aras Community project, shoot us an email at araslabs@aras.com.

## Credits

Original Aras community project written by Christopher Gillis at Aras Corp.

Documented and published by Eli Donahue for Aras Labs. @cgillis-aras

## License

Aras Labs projects are published to Github under the MIT license. See the [LICENSE file](./LICENSE.md) for license rights and limitations.

0 comments on commit f2b9bce

Please sign in to comment.