From c4ff97cefd48b36fe3d655346e0ee4353885e0cc Mon Sep 17 00:00:00 2001 From: shubham_meena Date: Mon, 2 Jun 2014 01:05:37 +0530 Subject: [PATCH] template for plugins in AMS --HG-- branch : Gsoc14-ryzomAppImprovements --- .../ams_lib/autoload/plugincache.php | 262 ++++++++++++++++++ .../ryzom_ams/ams_lib/translations/en.ini | 10 + .../server/ryzom_ams/www/html/inc/plugins.php | 45 +++ .../ryzom_ams/www/html/installer/libsetup.php | 15 + .../ryzom_ams/www/html/templates/plugins.tpl | 89 ++++++ 5 files changed, 421 insertions(+) create mode 100644 code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/plugincache.php create mode 100644 code/ryzom/tools/server/ryzom_ams/www/html/inc/plugins.php create mode 100644 code/ryzom/tools/server/ryzom_ams/www/html/templates/plugins.tpl diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/plugincache.php b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/plugincache.php new file mode 100644 index 000000000..df3af960c --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/autoload/plugincache.php @@ -0,0 +1,262 @@ + +setId($values['PluginId']); + + $this->setPluginName($values['PluginName']); + + $this->setPluginVersion($values['PluginVersion']); + + $this->setPluginPermission($values['PluginPermission']); + + $this->setIsActive($values['IsActive']); + + } + + + + + + /** + + * loads the object's attributes. + + */ + + public function load_With_SID( ) { + + $dbl = new DBLayer("lib"); + + $statement = $dbl->executeWithoutParams("SELECT * FROM plugins"); + + $row = $statement->fetch(); + + $this->set($row); + + } + + + + + + /** + + * updates the entry. + + */ + + public function update(){ + + $dbl = new DBLayer("lib"); + + $query = "UPDATE plugins SET PluginPermission= :t, PluginVersion = :q, IsActive = :d WHERE PluginName=:p_n"; + + $values = Array('p_n' => $this->getPluginName(), 't' => $this->getPluginPermission(), 'q' => $this->getPluginVersion(), 'd' => $this->getIsActive()); + + $statement = $dbl->execute($query, $values); + + } + + + + + + public function getId(){ + + return $this->Id; + + } + + + + /** + + * get plugin permission attribute of the object. + + */ + + public function getPluginPermission(){ + + return $this->plugin_permission; + + } + + + + /** + + * get plugin version attribute of the object. + + */ + + public function getPluginVersion(){ + + return $this->plugin_version; + + } + + + + /** + + * get plugin is active attribute of the object. + + */ + + public function getIsActive(){ + + return $this->plugin_isactive; + + } + + + + /** + + * get plugin name attribute of the object. + + */ + + public function getPluginName(){ + + return $this->plugin_name; + + } + + + + + + + + /** + + * set plugin id attribute of the object. + + * @param $s integer id + + */ + + public function setId($s){ + + $this->Id = $s; + + } + + + + /** + + * set plugin permission attribute of the object. + + * @param $t type of the query, set permission + + */ + + public function setPluginPermission($t){ + + + + $this->plugin_permission = $t; + + } + + + + /** + + * set plugin version attribute of the object. + + * @param $q string to set plugin version + + */ + + public function setPluginVersion($q){ + + $this->plugin_version= $q; + + } + + + + /** + + * set plugin is active attribute of the object. + + * @param $d tinyint to set plugin is active or not . + + */ + + public function setIsActive($d){ + + $this->plugin_isactive= $d; + + } + + + + /** + + * set plugin name attribute of the object. + + * @param $p_n string to set plugin name. + + */ + + public function setPluginName($p_n){ + + $this->plugin_name= $p_n; + + } + + + +} + + diff --git a/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/en.ini b/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/en.ini index 586d49241..0d1b9cfb6 100644 --- a/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/en.ini +++ b/code/ryzom/tools/server/ryzom_ams/ams_lib/translations/en.ini @@ -53,6 +53,16 @@ name = "Name" email = "Email" action = "Action" +[plugins] +plugin_title = "Plugin List" +plugin_info = "Here you can see the entire list of plugins . You can easily remove plugins ,activate them and add permissions" +plugins= "Plugins" +plugin_id = "ID" +plugin_name = "Name" +plugin_version= "Version" +plugin_permission= "Owner/Access Permission" +plugin_is_active= "On/Off" + [show_ticket] t_title = "Ticket" title = "Title" diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/inc/plugins.php b/code/ryzom/tools/server/ryzom_ams/www/html/inc/plugins.php new file mode 100644 index 000000000..61bdb0278 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/www/html/inc/plugins.php @@ -0,0 +1,45 @@ +init(); + print_r(plugin::$plugins);**/ + + $pagination = new Pagination("SELECT * FROM plugins","lib",5,"Plugincache"); + $pageResult['plug']= Gui_Elements::make_table($pagination->getElements() , Array ("getId","getPluginName","getPluginVersion","getPluginPermission","getIsActive"), Array("id","plugin_name","plugin_version","plugin_permission","plugin_isactive")); + $pageResult['links'] = $pagination->getLinks(5); + $pageResult['lastPage'] = $pagination->getLast(); + $pageResult['currentPage'] = $pagination->getCurrent(); + + global $INGAME_WEBPATH; + $pageResult['ingame_webpath'] = $INGAME_WEBPATH; + + //check if shard is online + try{ + $dbs = new DBLayer("shard"); + $pageResult['shard'] = "online"; + }catch(PDOException $e){ + $pageResult['shard'] = "offline"; + } + return( $pageResult); + }else{ + //ERROR: No access! + $_SESSION['error_code'] = "403"; + header("Location: index.php?page=error"); + exit; + } + +} + + diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/installer/libsetup.php b/code/ryzom/tools/server/ryzom_ams/www/html/installer/libsetup.php index 932d6d2db..5aea5c200 100644 --- a/code/ryzom/tools/server/ryzom_ams/www/html/installer/libsetup.php +++ b/code/ryzom/tools/server/ryzom_ams/www/html/installer/libsetup.php @@ -154,6 +154,21 @@ ENGINE = InnoDB; + -- ----------------------------------------------------- + -- Table `" . $cfg['db']['lib']['name'] ."`.`plugins` + -- ----------------------------------------------------- + DROP TABLE IF EXISTS `" . $cfg['db']['lib']['name'] ."`.`plugins` ; + + CREATE TABLE IF NOT EXISTS `" . $cfg['db']['lib']['name'] ."`.`plugins` ( + `PluginId` INT(10) NOT NULL AUTO_INCREMENT, + `PluginName` VARCHAR(11) NOT NULL, + `PluginPermission` VARCHAR(5) NOT NULL, + `PluginVersion` INT(11) NOT NULL, + `IsActive` TINYINT(1) NOT NULL, + PRIMARY KEY (`PluginId`) ) + ENGINE = InnoDB; + + -- ----------------------------------------------------- -- Table `" . $cfg['db']['lib']['name'] ."`.`ticket` -- ----------------------------------------------------- diff --git a/code/ryzom/tools/server/ryzom_ams/www/html/templates/plugins.tpl b/code/ryzom/tools/server/ryzom_ams/www/html/templates/plugins.tpl new file mode 100644 index 000000000..4d4703875 --- /dev/null +++ b/code/ryzom/tools/server/ryzom_ams/www/html/templates/plugins.tpl @@ -0,0 +1,89 @@ + +{block name=content} +
+
+
+

{$plugin_title}

+
+ + + +
+
+
+

{$plugin_info}

+ + + + + + + + + + + + + {foreach from=$plug item=element} + + + + + + + + {/foreach} + + +
{$plugin_id}{$plugin_permission}{$plugin_name}{$plugin_version}{$plugin_is_active}
{$element.id}{$element.plugin_permission}{$element.plugin_name}{$element.plugin_version}{$element.plugin_isactive}
+
+
    +
  • «
  • + {foreach from=$links item=link} +
  • {$link}
  • + {/foreach} +
  • »
  • +
+
+
+ +
+
+
+

Actions

+
+ + +
+
+
+
+
+ + +
+
+
+
+ +
+{/block} \ No newline at end of file