X-Git-Url: https://scm.fusionforge.org/anonscm/gitweb?p=fusionforge%2Ffusionforge.git;a=blobdiff_plain;f=src%2Fplugins%2Fdoaprdf%2Finclude%2FdoaprdfPlugin.class.php;h=86e1c086efb35f0c8f22d7b0dd1be05a7ba48560;hp=23c2cb9ccbd4eeb00071a15481b4312e269f526f;hb=10702f2b6bb1c316d2227144e68aa006430e18b2;hpb=79d3490e9fe672e8751cfdeed5adfdbdf9fe48fa;ds=inline diff --git a/src/plugins/doaprdf/include/doaprdfPlugin.class.php b/src/plugins/doaprdf/include/doaprdfPlugin.class.php index 23c2cb9ccb..86e1c086ef 100644 --- a/src/plugins/doaprdf/include/doaprdfPlugin.class.php +++ b/src/plugins/doaprdf/include/doaprdfPlugin.class.php @@ -25,110 +25,20 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ + require_once('common/include/ProjectManager.class.php'); +require_once('common/include/rdfutils.php'); class doaprdfPlugin extends Plugin { public function __construct($id=0) { $this->Plugin($id) ; $this->name = "doaprdf"; $this->text = "DoaPRDF!"; // To show in the tabs, use... - //$this->_addHook("user_personal_links");//to make a link to the user's personal part of the plugin - //$this->_addHook("usermenu"); - //$this->_addHook("groupmenu"); // To put into the project tabs - //$this->_addHook("groupisactivecheckbox"); // The "use ..." checkbox in editgroupinfo - //$this->_addHook("groupisactivecheckboxpost"); // - //$this->_addHook("userisactivecheckbox"); // The "use ..." checkbox in user account - //$this->_addHook("userisactivecheckboxpost"); // - //$this->_addHook("project_admin_plugins"); // to show up in the admin page fro group $this->_addHook("script_accepted_types"); $this->_addHook("content_negociated_project_home"); + $this->_addHook("alt_representations"); } -/* - function CallHook ($hookname, &$params) { - global $use_doaprdfplugin,$G_SESSION,$HTML; - if ($hookname == "usermenu") { - $text = $this->text; // this is what shows in the tab - if ($G_SESSION->usesPlugin("doaprdf")) { - $param = '?type=user&id=' . $G_SESSION->getId() . "&pluginname=" . $this->name; // we indicate the part we're calling is the user one - echo ' | ' . $HTML->PrintSubMenu (array ($text), - array ('/plugins/doaprdf/index.php' . $param )); - } - } elseif ($hookname == "groupmenu") { - $group_id=$params['group']; - $project = &group_get_object($group_id); - if (!$project || !is_object($project)) { - return; - } - if ($project->isError()) { - return; - } - if (!$project->isProject()) { - return; - } - if ( $project->usesPlugin ( $this->name ) ) { - $params['TITLES'][]=$this->text; - $params['DIRS'][]=util_make_url ('/plugins/doaprdf/index.php?type=group&id=' . $group_id . "&pluginname=" . $this->name) ; // we indicate the part we're calling is the project one - } else { - $params['TITLES'][]=$this->text." is [Off]"; - $params['DIRS'][]=''; - } - (($params['toptab'] == $this->name) ? $params['selected']=(count($params['TITLES'])-1) : '' ); - } elseif ($hookname == "groupisactivecheckbox") { - //Check if the group is active - // this code creates the checkbox in the project edit public info page to activate/deactivate the plugin - $group_id=$params['group']; - $group = &group_get_object($group_id); - echo "
' ; - echo util_make_link ("/plugins/doaprdf/index.php?id=$userid&type=user&pluginname=".$this->name, - _('View Personal DoaPRDF') - ); - echo '
'; - } - } elseif ($hookname == "project_admin_plugins") { - // this displays the link in the project admin options page to it's DoaPRDF administration - $group_id = $params['group_id']; - $group = &group_get_object($group_id); - if ( $group->usesPlugin ( $this->name ) ) { - echo ''.util_make_link ("/plugins/doaprdf/admin/index.php?id=".$group->getID().'&type=admin&pluginname='.$this->name, - _('DoaPRDF Admin')).'
' ; - } - } - elseif ($hookname == "blahblahblah") { - // ... - } - } - */ /** * Declares itself as accepting RDF XML on /users @@ -146,14 +56,16 @@ class doaprdfPlugin extends Plugin { * @param unknown_type $params */ function content_negociated_project_home (&$params) { - global $group_id; - $projectname = $params['groupname']; $accept = $params['accept']; + $group_id = $params['group_id']; if($accept == 'application/rdf+xml') { + + // connect to FusionForge internals $pm = ProjectManager::instance(); $project = $pm->getProject($group_id); + $project_shortdesc = $project->getPublicName(); $project_description = $project->getDescription(); $tags_list = NULL; if (forge_get_config('use_project_tags')) { @@ -161,33 +73,102 @@ class doaprdfPlugin extends Plugin { $tags_list = $group->getTags(); } + // We will return RDF+XML $params['content_type'] = 'application/rdf+xml'; - $xml = ' -