Mango



Thread: Plugins disappearing?

Created on: 02/25/11 10:25 AM

New topic Reply    Page: 1  

Replies: 2
JohnDonut


JohnDonut's Gravatar
Joined: 01/26/11
Posts: 19

02/25/11 10:25 AM

Hi, me again.

Help! :)

I have just finished a new plugin that was supposed to add a few links on the Admin overview page.

However, when I add the plugin into the plugins folder, ALL of my plugins disappear from my plugins page. The only thing on the page is the "URL of plugin to download" field.

When I remove this new plugin folder, everything else re-appears.

What did I do wrong??

------------ Handler.cfc -------

<cfcomponent>
   
   <cffunction name="init" access="public" output="false" returntype="any">
      <cfargument name="mainManager" type="any" required="true" />
      <cfargument name="preferences" type="any" required="true" />   
      
      <cfset variables.manager = arguments.mainManager />
      <cfset variables.preferences = arguments.preferences />
      <cfreturn this/>
   </cffunction>

   <cffunction name="setup" hint="This is run when a plugin is activated" access="public" output="false" returntype="any">
      <cfreturn "Add Documentation plug-in activated. <br />You will now see a list of training documentation in the Admin section." />
   </cffunction>
   
   <cffunction name="unsetup" hint="This is run when a plugin is de-activated" access="public" output="false" returntype="any">
      <!--- TODO: Implement Method --->
      <cfreturn />
   </cffunction>
   
   <cffunction name="getName" access="public" output="false" returntype="string">
      <cfreturn variables.name />
   </cffunction>

   <cffunction name="setName" access="public" output="false" returntype="void">
      <cfargument name="name" type="string" required="true" />
      <cfset variables.name = arguments.name />
      <cfreturn />
   </cffunction>

   <cffunction name="getId" access="public" output="false" returntype="any">
      <cfreturn variables.id />
   </cffunction>
   
   <cffunction name="setId" access="public" output="false" returntype="void">
      <cfargument name="id" type="any" required="true" />
      <cfset variables.id = arguments.id />
      <cfreturn />
   </cffunction>

   <cffunction name="handleEvent" hint="Asynchronous event handling" access="public" output="false" returntype="any">
      <cfargument name="event" type="any" required="true" />      
      <cfreturn />
   </cffunction>

   <cffunction name="processEvent" hint="Synchronous event handling" access="public" output="false" returntype="any">
      <cfargument name="event" type="any" required="true" />

         <cfset var js = "" />
         <cfset var outputData = "" />
         <cfset var link = "" />
         <cfset var page = "" />
         <cfset var data = ""/>
         <cfset var path = "" />
         <cfset var admin = "" />
         <cfset var eventName = arguments.event.name />
         
         <cfif eventName EQ "dashboardPod" AND variables.manager.isCurrentUserLoggedIn()>      
            <cfsavecontent variable="outputData">
            <cfoutput><p>Here is a list of the User Documents available to help you update this site</p>
               <ul>
                  <li><a href="/myblog/assets/content/docs/To Add a Link to a Post.docx">To Add a Link to a Post</a></li>
                  <li><a href="/myblog/assets/content/docs/To Add a New Author.docx">To Add a New Author</a></li>
                  <li><a href="/myblog/assets/content/docs/To Add a New Post.docx">To Add a New Post</a></li>
                  <li><a href="/myblog/assets/content/docs/To Edit a Post.docx">To Edit a Post</a></li>
                  <li><a href="/myblog/assets/content/docs/To Upload an MP3.docx">To Upload an MP3</a></li>
                  <li><a href="/myblog/assets/content/docs/To Upload and Display a Video.docx">To Upload and Display a Video</a></li>
               </ul>
            </cfoutput>
            </cfsavecontent>   
            <cfset arguments.event.setOutputData(outputData) />      
         </cfif>
      
      <cfreturn arguments.event />
   </cffunction>

</cfcomponent>

--------- plugin.xml ----------

<?xml version="1.0" encoding="UTF-8"?>
<plugin id="com.asfusion.mango.plugins.adddocumentation" name="Add Documentation" version="1.0" provider-name="asfusion"
class="adddocumentation.Handler">

<description>Adds training documenation to the Admin section</description>

<requiresVersion match="greaterOrEqual">1.0</requiresVersion>

<listensAdmin>
   <event name="dashboardPod" type="synch" priority="5" />
</listensAdmin>

</plugin>
Link | Top | Bottom
Laura

Wizard
Laura's Gravatar
Joined: 01/29/05
Posts: 1538

02/28/11 9:47 AM

Hi John,

First check if there is anything in the logs. Best is to install the logViewer plugin.

Second I would extend from org.mangoblog.plugins.BasePlugin. That will ensure you have all the required methods and other things. Then only override processEvent. (see best practices http://www.mangoblog.org/docs/documentation/extending-mango/plugin-best-practices )
Lastly, in the plugin.xml, use <listens>, listensAdmin has been deprecated.
Link | Top | Bottom
JohnDonut


JohnDonut's Gravatar
Joined: 01/26/11
Posts: 19

02/28/11 10:24 AM

It was the <listens> vs. <istensAdmin> that fixed it for me. Thanks!
Link | Top | Bottom

New Post

Please login to post a response.