Nsaya
I hate code!
Profile
Posts: 65
Reg: Jul 15, 2013
Kabul
2,400
02/13/14 08:29 AM (10 years ago)

how to replace html doc plugin with Smugs Android HTML in project

my project has around 500 html doc screens. I could not find any other way to use Smugs Android HTML plugin unless delete all my html doc screen and create new screens (500) with Smugs Android HTML plugin. Is there any way to keep the html doc created screens while applying Smugs Android HTML plugin's behaviour on them, in other word to overwrite HTML Doc code with Smugs Android HTML. Nsaya
 
Dusko
Veteran developer
Profile
Posts: 998
Reg: Oct 13, 2012
Beograd
22,680
like
02/13/14 02:56 PM (10 years ago)
The old HTML Doc plugin has this as its JSON description: { "itemId":"343434", "itemType":"BT_screen_htmlDoc", "navBarTitleText":"HTML Doc", "dataURL":"http://www.mydomain.com/sample.html" } This example loads a document from the applications bundle (compiled in Xcode or Eclipse). Note that a localFileName is used instead of a dataURL. { "itemId":"343434", "itemType":"BT_screen_htmlDoc", "navBarTitleText":"HTML Doc", "localFileName":"sample.html" } Smug's plugin has this: (Using URL) { "itemId": "5E95CF8A66E215A0BCA69EB", "itemType": "SW_androidHTML", "navBarTitleText": "Android HTML" "dataURL":"http://www.mydomain.com/smugsample.html" } (Using Local File) { "itemId": "5E95CF8A66E215A0BCA69EB", "itemType": "SW_androidHTML", "navBarTitleText": "Android HTML" "localFileName":"smugsample.html" } The only real difference is in itemType. If you can manage to change the item type in BT databases on your self hosted server, then yes, you can do it without manually changing all 500 entries. And how to change them automatically? Create a small program in PHP or use search and replace facilities in phpMyAdmin. (You can even tell phpMyAdmin what you want to change and it can generate the PHP program for you!) Hope this helps!
 
Dusko
Veteran developer
Profile
Posts: 998
Reg: Oct 13, 2012
Beograd
22,680
like
02/13/14 03:11 PM (10 years ago)
Actually, I have just looked at those tables. Type BT_screen_htmlDoc will be found in two tables, one is bt_plugins and the other is bt_items. In the former, there should be exactly one entry and in the latter, there will be as many entries as you have screens of that type. It is exactly the latter where you can try changing from BT_screen_htmlDoc to SW_androidHTML and see what happens. If it works in one case, then you are golden -- you should be able to search and replace all cases in one go and that should be it. However: -- do create a backup of all of your BT files on the server, and -- change only the values for the app that you want to be changed. Again, hope this helps!
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
02/13/14 04:05 PM (10 years ago)
Ohhhh…. you know, I was thinking of some kind of way Chris' app copy plugin might be utilized… I never thought of the db directly… That idea is so much better! When I describe a table as 'XX_xxxxx' it is because I use a different prefix for my database; my tables are not 'BT_xxxxx'. However, you can assume that naming convention if your db is a default setup. the XX_plugins table only holds the record for the plugin… it is used when a new screen is added to a project, and then 'a record' of the 'plugin parameters' is copied into the XX_items table when it is used to build your BT_config.txt file… Make sure to create a full backup of your database, but along with Dusko's suggestion, an SQL statement 'in your XX_items' table would do the trick. Make sure you get the right App GUID when altering records. Cheers! -- Smug
 
Dusko
Veteran developer
Profile
Posts: 998
Reg: Oct 13, 2012
Beograd
22,680
like
02/13/14 04:26 PM (10 years ago)
Incidentally, here's Smug's explanation of what server files for buzztouch self hosted server do: https://www.buzztouch.com/forum/thread.php?fid=0033BC80E138ABC2D21B39F&tid=0033BC80E138ABC2D21B39F
 
Nsaya
I hate code!
Profile
Posts: 65
Reg: Jul 15, 2013
Kabul
2,400
like
02/14/14 02:07 AM (10 years ago)
Thank you so much Dusko and Smug, I will follow your instruction and let you know if it works. Nsaya
 
Ejaaz
I hate code!
Profile
Posts: 15
Reg: Aug 27, 2011
India
150
like
02/26/14 06:06 AM (10 years ago)
Hi smug U have done a great work for html doc plugin. Its working perfect for me. But I have 1 query. In earlier version when from 1 html i press back button it was coming to previous linked html doc. But now when I press back from one html to another html, it comes directly to main listview. Can u please help in this regard. Your help will be appreciated.
 
Susan Metoxen
buzztouch Evangelist
Profile
Posts: 1706
Reg: May 01, 2011
Hopkins, Minnes...
26,260
like
02/26/14 07:09 AM (10 years ago)
I like the idea to change it in the MySQL, but if you decide to go the other route then I may have some code that will help. I have done it in PHP.
 
Ejaaz
I hate code!
Profile
Posts: 15
Reg: Aug 27, 2011
India
150
like
02/26/14 07:16 AM (10 years ago)
Hi Susan Thanks for prompt reply. Pl suggest the way. Any way will do. Either some code or as u suggest. pl help. My whole project is ready only stuck up due to this issue.
 
Susan Metoxen
buzztouch Evangelist
Profile
Posts: 1706
Reg: May 01, 2011
Hopkins, Minnes...
26,260
like
02/26/14 07:34 AM (10 years ago)
I will try to dig it out today. If memory serves me correctly, it modifies the program that creates the JSON. It just says, "if the itemType is x, change it to y". The hard part will be making sure the JSON is all still formatted correctly.
 
Ejaaz
I hate code!
Profile
Posts: 15
Reg: Aug 27, 2011
India
150
like
02/26/14 07:45 AM (10 years ago)
pl let me know once it is done. and how to implement. I am zero in coding :(. Thanks a lot
 
Susan Metoxen
buzztouch Evangelist
Profile
Posts: 1706
Reg: May 01, 2011
Hopkins, Minnes...
26,260
like
02/26/14 12:12 PM (10 years ago)
Say, if you aren't comfortable with coding you should not try to make this change. You could break the ability of your server to create the JSON for your projects. If you have live projects and you do this wrong, they will call home for broken JSON. Also, this change applies to ALL projects on your server--so if you have live projects that don't have the new plugin then those screens will not work. I am providing this to help users who are comfortable working in PHP--or users with a high tolerance for risk. :) The wonderful thing about self-hosting is that you can make some modifications like this. If it was me, I think I would go the other route of changing it directly in the mySQL table. But this is an alternative. This code would go into BT-server/api/app/index.php. For me it is around line 179, but my file is heavily modified so it is likely a different line for you. I am providing the first part of this code for context. This is the part of the PHP where the server makes the screens for your app, and this code looks for the one plugin name and changes it to another as it creates the JSON for your app screens. //start screens $jsonResult .= $line2 . $tab3 . "\"BT_screens\":[\n"; $tmpScreens = ""; $strSql = " SELECT guid, loadClassOrActionName, hasChildItems, jsonVars, itemType, nickname FROM " . TBL_BT_ITEMS ; $strSql .= " WHERE appGuid = '" . $clientVars["appGuid"] . "'"; $strSql .= " AND controlPanelItemType = 'screen' "; $strSql .= " ORDER BY orderIndex ASC "; $res = fnDbGetResult($strSql, APP_DB_HOST, APP_DB_NAME, APP_DB_USER, APP_DB_PASS); $screenCnt = 0; if($res){ while($row = mysql_fetch_array($res)){ $screenCnt = ($screenCnt + 1); //screen vars... $itemType = $row["itemType"]; $loadClassOrActionName = $row["loadClassOrActionName"]; $jsonVars = $row["jsonVars"]; $hasChildItems = $row["hasChildItems"]; //////////////////////////////////////////////////////////////////////// //This is where the new code would start. You would use your own plugin names, not the ones I used for this particular app. if($row["itemType"] == 'BT_screen_images') { $row["itemType"] = "Mac_image_gallery"; } else{ //no change to itemType }
 
Ejaaz
I hate code!
Profile
Posts: 15
Reg: Aug 27, 2011
India
150
like
02/26/14 12:23 PM (10 years ago)
Hi Susan Is there any way I can get this problem solved or If I send u my project can u do it for me please. i will be very much thankful. I dont have self hosting. I m using buzztouch hosting. :(
 
Susan Metoxen
buzztouch Evangelist
Profile
Posts: 1706
Reg: May 01, 2011
Hopkins, Minnes...
26,260
like
02/26/14 04:08 PM (10 years ago)
I read your original post again, and I think you want something different from what I was writing about. I don't know how to do it offhand, but I think there is a way in the Android code to control what "back" means--is it back one page within the web view, or back to the last screen in the app before the webview screen opened. I would recommend comparing the code in the two plugins, and then modifying the code in Smug's plugin to work the way you want it.
 
Nsaya
I hate code!
Profile
Posts: 65
Reg: Jul 15, 2013
Kabul
2,400
like
02/27/14 02:55 AM (10 years ago)
I did it differently, I hope Smugs could find to see this post, I created some screens with Smugs- android HMTL plugin, downloaded the project, then copied Smugs Plugin's code into HTML Doc plugin, changed some names in the java code, and brought some changes in the layout (XML) code, now it works, Since I am not professional, I don't know how much it will be prefect.
 
Susan Metoxen
buzztouch Evangelist
Profile
Posts: 1706
Reg: May 01, 2011
Hopkins, Minnes...
26,260
like
02/27/14 06:54 AM (10 years ago)
Good idea, Nsaya!
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.