I Love PHPMaker

... because it gets even more powerful and flexible!!

  • About
  • Terms and Conditions
  • Membership Options
  • Sitemap
  • Downloads
    • PHPMaker Extensions Download
    • PHPMaker Projects Download
    • PHP Report Maker Extensions Download
I Love PHPMaker » Customize Template » How to Hide PreviewRow Tab of the Restricted Detail Pages in Websites that Generated by PHPMaker 9.2.0
How to Make Right-Align Columns for Aggregate Functions in Websites that Generated by PHPMaker 9.2.0
How to Overcome “User X already logged in” Issue in Websites that Generated by PHPMaker 9.2.0

February 27, 2013

How to Hide PreviewRow Tab of the Restricted Detail Pages in Websites that Generated by PHPMaker 9.2.0

PreviewRow extension (only for the registered PHPMaker users) is one of the best extensions that provided by PHPMaker. It will turn your List pages which have some detail pages in it into several tabs. The tabs are hidden by default, and replaced by only plus (+) icon. When you click on the icon, then the detail pages that represented by tabs will be shown. This is very good if you have more than one detail pages. In addition it will save the space in your web application, it also makes the look and view of your web application becomes more professional.

Unfortunately, up to PHPMaker 9.2.0, it has not the ability to hide the certain tabs you want. For example, I want to hide the certain tab by using the certain Server Events for the certain user levels which do not have permission to access the detail pages. I think this ability should be provided by PHPMaker by default, especially if the current user is forbidden to display the certain detail pages. The existing condition, the tab that belong to such restricted detail pages are still being shown, and below it will be shown "You do not have permission to access the page" message. I think this is not a good condition, and also so funny. It often makes your users get confused. They must be asking by themselves: "If this detail cannot be accessed, why then the tab was being displayed?". Indeed! LoL.

Well, I have successfully customized the extension to overcome this issue. After implementing the customization below, then all of the preview row tabs that belong to the restricted/forbidden details pages will be hidden automatically. You don't need to use any Server Events anymore for this! You don't need also to customize the generated script files at all as I always avoid it all the time! All we have to do is by customizing the template, so you can use it for your future PHPMaker projects.

Updated on June 17, 2013: The customization has been handled by using MasinoPreviewRow extension. You don’t need to implement the customization below if you use my extensions together with the original PHPMaker Template and Extension files.

[hidepost]

  1. Open your \extensions\PreviewRow\renderoption.php file, and find this code:

    		$oListOpt->Body .= "var tab = new ewWidget.Tab({label: \"" . ew_JsEncode2($Language->TablePhrase("<!--##=sDetailTblVar##-->", "TblCaption"));
    	<!--## if (bDetailShowCount) { ##-->
    		$oListOpt->Body .= "&nbsp;" . ew_JsEncode2(str_replace("%c", $this-><!--##=sDetailTblVar##-->_Count, $Language->Phrase("DetailCount")));		
    	<!--## } ##-->
    		$oListOpt->Body .= "\", dataSrc: \"<!--##=sFnPreview##-->?f=" . TEAencrypt($sSqlWrk, EW_RANDOM_KEY) . "\"";
    		$oListOpt->Body .= "}); tab._links = \"" . ew_JsEncode2($links) . "\"; tab._index = <!--##=k##-->; tab.loadHandler.success = ew_TabLoadSuccess; tabview.addTab(tab);";
    

    then replace it with the following code:

    	// Begin of modification Hide Restricted Detail Preview Row Tab, by Masino Sinaga, February 27, 2013
    	if (IsLoggedIn()) {
    	 if ($Security->AllowList(CurrentProjectID() . '<!--##=sDetailTblVar##-->')) {
    		$oListOpt->Body .= "var tab = new ewWidget.Tab({label: \"" . ew_JsEncode2($Language->TablePhrase("<!--##=sDetailTblVar##-->", "TblCaption"));
    	<!--## if (bDetailShowCount) { ##-->
    		$oListOpt->Body .= "&nbsp;" . ew_JsEncode2(str_replace("%c", $this-><!--##=sDetailTblVar##-->_Count, $Language->Phrase("DetailCount")));		
    	<!--## } ##-->
    		$oListOpt->Body .= "\", dataSrc: \"<!--##=sFnPreview##-->?f=" . TEAencrypt($sSqlWrk, EW_RANDOM_KEY) . "\"";
    		$oListOpt->Body .= "}); tab._links = \"" . ew_JsEncode2($links) . "\"; tab._index = <!--##=k##-->; tab.loadHandler.success = ew_TabLoadSuccess; tabview.addTab(tab);";
    	 }
    	} else {
    		$oListOpt->Body .= "var tab = new ewWidget.Tab({label: \"" . ew_JsEncode2($Language->TablePhrase("<!--##=sDetailTblVar##-->", "TblCaption"));
    	<!--## if (bDetailShowCount) { ##-->
    		$oListOpt->Body .= "&nbsp;" . ew_JsEncode2(str_replace("%c", $this-><!--##=sDetailTblVar##-->_Count, $Language->Phrase("DetailCount")));		
    	<!--## } ##-->
    		$oListOpt->Body .= "\", dataSrc: \"<!--##=sFnPreview##-->?f=" . TEAencrypt($sSqlWrk, EW_RANDOM_KEY) . "\"";
    		$oListOpt->Body .= "}); tab._links = \"" . ew_JsEncode2($links) . "\"; tab._index = <!--##=k##-->; tab.loadHandler.success = ew_TabLoadSuccess; tabview.addTab(tab);";
    	}
    	// End of modification Hide Restricted Detail Preview Row Tab, by Masino Sinaga, February 27, 2013
    
  2. As you can see from the replacement code above, the IsLoggedIn condition will handle the logged in users, whereas the else part will handle the anonymous users.
  3. Finally, re-generate your script files using PHPMaker as always.

[/hidepost]

Article by Masino Sinaga / Customize Template / detail preview, detail table, extensions, PHPMaker 9.2.0, preview row, preview tab, previewrow 2 Comments

How to Make Right-Align Columns for Aggregate Functions in Websites that Generated by PHPMaker 9.2.0
How to Overcome “User X already logged in” Issue in Websites that Generated by PHPMaker 9.2.0

Comments

  1. keithh0427 says

    February 28, 2013 at 9:09 am

    Masino,

    Is there a way to change the “plus sign” icon to something that is a bit more descriptive? Something like “Linked Detail” or something like it?

    Log in to Reply
    • Masino Sinaga says

      February 28, 2013 at 9:38 am

      Yes. Simply customize the renderoption.php file that belongs to the previewrow extension, around line 102. There you can see the code to display the link with the “plus sign” in it. You can customize it to whatever you want.

      Log in to Reply

Leave a Reply Cancel reply

You must be logged in to post a comment.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Recent Posts

  • A New PHPMaker 2024 Project File Is Released
  • PHPMaker 2024 Demo Project File Is Released
  • Masino Extensions for PHPMaker 2024 Is Released!
  • PHPMakerProjects.com, For Those Who Need PHPMaker Project Sample
  • A New PHPMaker 2023 Project File Is Released
  • PHPMaker 2023 Demo Project File Is Released
  • Masino Extensions for PHPMaker 2023 Is Released!
  • A New PHPMaker 2022 Project File Is Released
  • PHPMaker 2022 Demo Project File Is Released
  • Masino Extensions for PHPMaker 2022 Is Released!

Search

Recent Comments

  • Masino Extensions untuk PHPMaker 2024 Sudah Dirilis, Silahkan Download! – Masino Sinaga on Membership Options
  • Masino Sinaga on Masino Extensions for PHPMaker 2022 (All-In-One)
  • Filipe Vercesi on Masino Extensions for PHPMaker 2022 (All-In-One)
  • Mandwa on Masino Extensions for PHPMaker 2023 Is Released!
  • Masino Sinaga on Masino Extensions for PHPMaker 2023 Is Released!

Demo Website

  • Demo of I Love PHPMaker 2024 (MasinoExtensions).
  • Stock Inventory Management for PHPMaker 2024.
  • Stock Inventory Management for PHPMaker 2023.
  • Stock Inventory Management for PHPMaker 2022.
  • Stock Inventory Management for PHPMaker 2021.

Another Demo

The following template are not available in this site (must be purchased separately)

  • PHPMaker v2018 Horizontal Vertical Template.
  • PHPMaker v2017 Horizontal Vertical Template.

Demo Explanation

Stock Inventory Management is the good project for your reference, since it uses the real example in the real world. Many useful features you can use from this project, such as how to add the Thousand and Decimal separator character, and also how to calculate multiple row in Grid-Add when End-Users are entering data into the Grid-Add mode.

Categories

  • Customize Template (103)
  • General (4)
  • PHP Report Maker (17)
  • PHP Report Maker Extensions (2)
  • PHPMaker Extensions (83)
  • PHPMaker Projects (5)
  • Tips and Trick (72)

Articles based on version

  • PHPMaker 2024
  • PHPMaker 2023
  • PHPMaker 2022
  • PHPMaker 2021
  • PHPMaker 2020
  • PHPMaker 2019
  • PHPMaker 2018
  • PHPMaker 2017.0.7
  • PHPMaker 12.0.7
  • PHPMaker 11.0.6
  • PHPMaker 10.0.5
  • PHPMaker 9.2.0
  • PHPMaker 8.0.3
  • PHP Report Maker 12

(c) I Love PHPMaker 2010 - 2023 by Masino Sinaga | WordPress | Log in | Back to top