Ticket #274 (closed defect: fixed)

Opened 14 months ago

Last modified 14 months ago

Cannot view the source code of any Plugin examples

Reported by: revvi Owned by:
Priority: important Milestone: 1.1
Component: Plugin (not included in core distro) Version:
Keywords: Cc:

Description

It looks like the ViewSource?() javascript cannot get ExampleId?. It is always null at the moment.

I found that Examples::AddPluginExampleFile?() is using long relative path.

public static function AddPluginExampleFile($strPluginName, $strExampleFileName) {
			array_push(Examples::$PluginExamples, '/../../../../assets/plugins/' . $strPluginName . "/" . $strExampleFileName);
		}

Then this following code in Examples::GetExampleId?() may be wrong for any plugin examples because the length of $strScriptPath (eq. /../../../../assets/plugins/....) is always longer than the QApplication::$ScriptName? (eq. /assets/plugins/...).

if (strtolower(substr(QApplicationBase::$ScriptName, strlen(QApplicationBase::$ScriptName) - strlen($strScriptPath))) == strtolower($strScriptPath))
							return $intExampleIndex;

Sorry I did not provide the correction, perhaps you have better understanding on the underlying code :).

Change History

Changed 14 months ago by VexedPanda

I think there should a constant for the plugins/assets directory, both absolute path and web-accessible path. Especially since we want people to be able to move these around if desired.

Changed 14 months ago by alex94040

I like the idea from Vexed - constant defining this location. If someone has a moment, please create a patch.

Changed 14 months ago by alex94040

  • status changed from new to closed
  • resolution set to fixed

(In [261]) Fixes #274 (Cannot view the source code of any Plugin examples). Code by alex94040.

Changed 14 months ago by alex94040

This turned out to be much messier than I thought (hardcoded path everywhere for core files), but we're above water again. All fixed.

Note: See TracTickets for help on using tickets.