Joomla Module with Installing Table Not Working - joomla

i am new in joomla development, i am making a form as a module in joomla, i want store data in database with this form, its basically registration type which is totally separate from joomla user. but at installation time this module doesn't create tables in database, i used both methods installing from zip and discover and installed
this is my directory structure
my xml manifest is
<?xml version="1.0" encoding="UTF-8"?>
<extension type="module" client="site" method="install" version="3.0">
<name>Registration Form</name>
<author>Arsalan</author>
<creationDate>9,OCT,2014</creationDate>
<version>1.0.0</version>
<description>This is registration form which will display on homepage </description>
<files>
<filename module="mod_registrationform">mod_registrationform.php</filename>
<filename>mod_registrationform.xml</filename>
<filename>helper.php</filename>
<folder>tmpl</folder>
<folder>sql</folder>
</files>
<install>
<sql>
<file driver="mysql" charset="utf8">sql/install.sql</file>
</sql>
</install>
<update>
<sql>
<file driver="mysql">sql/install.sql</file>
</sql>
</update>
<uninstall>
<sql>
<file driver="mysql" charset="utf8">sql/uninstall.sql</file>
</sql>
</uninstall>
<update>
<schemas>
<schemapath type="mysql">sql/updates</schemapath>
</schemas>
</update>
</extension>
this is sql code which is working fine
CREATE TABLE IF NOT EXISTS `#__helloworld` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`hello` text NOT NULL,
`lang` varchar(25) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
i am tired of searching this problem solution, please help me thanks : )

Related

Could not resolve reference to '' in property 'Database'. '' is invalid. Provide valid scoped name

I am working on a data migration project, from Visualfoxpro to Oracle...!
I have successfully created the meta data and the packages script in BIML but when i tried to generate the SSIS package in Visual Studio, it give an error "Could not resolve reference to '' in property 'Database'. '' is invalid.".
I am not sure what Database name should be used for and Oracle DB as it's schema driven(In my understanding).
I have followed the article http://bimlscript.com/Walkthrough/Details/73
Changed 1-2-Environment.biml in the following way
<Biml xmlns="http://schemas.varigence.com/biml.xsd">
<Connections>
<OleDbConnection Name="Source" ConnectionString="Provider=vfpoledb.1;Data Source=<Path to VFP database folder>;Exclusive=false;Nulls=false;" />
<OleDbConnection Name="Target" ConnectionString="Data Source=ServerName;User ID=UserName;Password=Password;Provider=OraOLEDB.Oracle.1;Persist Security Info=True;" />
</Connections>
<Databases>
<Database Name="NameForTheDatabase" ConnectionName="Target" />
</Databases>
<Schemas>
<Schema Name="OracleSchemaName" DatabaseName="" />
</Schemas>
</Biml>
Since i am new to this technical stack, I am struggling to get a solution for this issue. Any input will be very helpful.
I'd think you just need the same DatabaseName in Databases and Schemas.
<Databases>
<Database Name="NameForTheDatabase" ConnectionName="Target" />
</Databases>
<Schemas>
<Schema Name="OracleSchemaName" DatabaseName="NameForTheDatabase" />
</Schemas>

Editing #java.persitence.Table in external jaxb-Binding

I've set up a maven project to generate Java classes from a xsd-Schema. Firstly I configured the maven-hyperjaxb3-plugin (see the pom.xml snippet below), so that it can put the default JPA2 annotations in the entities. One of this annotations is #java.persitence.Table(name = "table_name"). I want to extend this annotation through an external global binding so that I can put the name of schema in it too. So that I would get #java.persitence.Table(name = "table_name", schema = "schema_name"). Is there a way to do this?
What about globally putting a prefix in the name of the table: #java.persitence.Table(name = "prefix_table_name"), any ideas how to do that?
Regards
Erzen
pom.xml snippet
<groupId>org.jvnet.hyperjaxb3</groupId>
<artifactId>maven-hyperjaxb3-plugin</artifactId>
<version>0.6.0</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<variant>jpa2</variant>
<extension>true</extension>
<roundtripTestClassName>EKMSEnvelopeRoundtripTest</roundtripTestClassName>
<args>
<arg>-Xinheritance</arg>
<arg>-XtoString</arg>
<arg>-Xannotate</arg>
</args>
<schemaExcludes>
<exclude>ekvaattributes.xsd</exclude>
</schemaExcludes>
</configuration>
bindings-xjc.xjb snippet
<jaxb:globalBindings localScoping="toplevel">
<!-- JPA-entities must be serializable -->
<xjc:serializable />
</jaxb:globalBindings>
<jaxb:bindings schemaLocation="schema.xsd"
node="/xs:schema">
<annox:annotate>
<!-- my attempt -->
<annox:annotate annox:class="javax.persistence.Table"
schema="schema_name">
</annox:annotate>
</annox:annotate>
<hj:persistence>
<hj:default-generated-id name="Hjid">
<orm:generated-value strategy="IDENTITY" />
</hj:default-generated-id>
</hj:persistence>
</jaxb:bindings>
Author of hyperjaxb3 here.
See #Stefan's answer, just add the schema="schema_name" attribute:
<orm:table name="item" schema="schema_name"/>
orm:table is actually a JPA XML element so that's documented in the JPA spec. :)
See this schema:
https://github.com/highsource/hyperjaxb3/blob/master/ejb/schemas/persistence/src/main/resources/persistence/orm/orm_1_0.xsd#L1814-L1815
I'm basically not inventing anything here.
You don't need JAXB2 Annotate Plugin for that, this works OOTB.
Here's an issue for the global prefix:
http://jira.highsource.org/browse/HJIII-87
Unresolved yet. Can be solved via custom naming now, but that's quite awkward.
https://github.com/highsource/hyperjaxb3/tree/master/ejb/tests/custom-naming
I agree, it would be nice to make it configurable.
Update How to do this globally:
<hj:default-entity>
<orm:table name="item" schema="schema_name"/>
</hj:default-entity>
But you'll also need to customize defaults for associations and so on. See he built-in defaults here:
https://github.com/highsource/hyperjaxb3/blob/master/ejb/plugin/src/main/resources/org/jvnet/hyperjaxb3/ejb/strategy/customizing/impl/DefaultCustomizations.xml
I'm not sure if this is possible, but try the element, maybe it has a 'schema' attribute, sadly it's not that well documented.
Regards,
Stefan
<jaxb:bindings schemaLocation="schema.xsd"
node="/xs:schema">
<annox:annotate>
<hj:persistence>
<hj:default-generated-id name="Hjid">
<orm:generated-value strategy="IDENTITY" />
</hj:default-generated-id>
</hj:persistence>
<!-- try this -->
<hj:entity>
<orm:table name="item"/>
</hj:entity>
</jaxb:bindings>
Source: http://confluence.highsource.org/display/HJ3/Customization+Guide
#lexicore Thnx for the help. After putting your suggestion in the right context it worked.
<hj:persistence>
<hj:default-entity>
<!-- no need to overwrite the default generated table names-->
<orm:table schema="schema_name" />
</hj:default-entity>
</hj:persistence>
You may also define a schema for all entities globally in orm file referenced from persistence.xml. There is no need to copy schema into every #Table annotation.
persistence.xml:
...
<persistence-unit name="MySchemaPU" transaction-type="JTA">
<mapping-file>META-INF/orm.xml</mapping-file>
And an orm.xml in META-INF folder:
<?xml version="1.0" encoding="UTF-8"?>
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"
version="1.0">
<persistence-unit-metadata>
<persistence-unit-defaults>
<schema>schema_name</schema>
</persistence-unit-defaults>
</persistence-unit-metadata>
</entity-mappings

Joomla Component Develpment: JInstaller: :Install: Cannot find Joomla XML setup file

I developed a joomla component. But I got this error while trying to install it.
"JInstaller: :Install: Cannot find Joomla XML setup file"
Error
Path does not have a valid package.
Below is myforms.xml file
<? xml version = "1.0"encoding = "utf-8" ?>
<extension type="component" version="3.2" method="upgrade">
<name>My Forms!</name>
<creationDate>Sept 09 2014</creationDate>
<author>Toni Ezeamaka</author>
<authorEmail>tons613#ymail.com</authorEmail>
<copyright>A-One GlobalSoft Technologies</copyright>
<version>1.0.1</version>
<description>A component for adding forms to my sites</description>
<installfile>install.php</installfile>
<uninstallfile>uninstall.php</uninstallfile>
<scriptfile>script.php</scriptfile>
<update>
<schemas>
<schemapath type="mysql">sql/updates/mysql/</schemapath>
</schemas>
</update>
<files folder="site">
<filename>index.html</filename>
<filename>myforms.php</filename>
<filename>controller/myforms.php</filename>
<folder>views</folder>
<folder>models</folder>
</files>
<administration>
<!-- Administration Menu Section -->
<menu>My Forms!</menu>
<files folder="admin">
<filename>index.html</filename>
<filename>myforms.php</filename>
<filename>controller.php</filename>
<folder>sql</folder>
<folder>tables</folder>
<folder>models</folder>
<folder>views</folder>
</files>
</administration>
</extension>
can someone help please?
The Issue was with the space in <? xml
I changed it to <?xml version = "1.0"encoding = "utf-8"?>
and it worked. Thanks to #Irfan

Joomla Install/Uninstall SQL FIles Location in a Package

I am building a Joomla package with a component, multiple modules and a plugin.
My question is, where should I place the install.sql and uninstall.sql files, relative to the package root? Right now they are at root/com_mypackage/administrator/sql/install.mysql.utf8.sql and they are defined in the component's manifest as:
<install><!-- Runs on install -->
<sql>
<file driver="mysql" charset="utf8">sql/install.mysql.utf8.sql</file>
</sql>
</install>
However, this doesn't seem right to me. Should I include administrator before the path in the <file> tag?
Of course, the component itself will be packed in its own .zip, to be included in the Package's XML install file.
No there is no need to this tag in administrator tag. you missing some in manifest.xml
for fully doc try:-
http://docs.joomla.org/Developing_a_Model-View-Controller_Component/2.5/Adding_an_install-uninstall-update_script_file
http://docs.joomla.org/Components:xml_installfile
on my end manifest.xml (my .sql in admin/install/install.mysql.utf8):-
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="2.5" method="upgrade">
<name>Social</name>
<license>Open Source License, GPL v2 based</license>
<author>me</author>
<authorEmail>developers#me.com</authorEmail>
<authorUrl>http://www.me.com</authorUrl>
<creationDate>2012-01-01</creationDate>
<copyright>2013, me</copyright>
<version>1.1</version>
<description></description>
<!-- Installation -->
<install>
<sql>
<file driver="mysql" charset="utf8">install/install.mysql.utf8.sql</file>
</sql>
</install>
<installfile>install/install.php</installfile>
<uninstall>
<sql>
<file driver="mysql" charset="utf8">install/uninstall.mysql.utf8.sql</file>
</sql>
</uninstall>
<uninstallfile>install/uninstall.php</uninstallfile>
and rest of

How to create a simple administration panel for my joomla plugin

I think the problem lies in my xml.
<?xml version="1.0" encoding="UTF-8"?>
<extension version="2.5" type="plugin" group="content">
<install>
<name>Content - eya</name>
<author>eya</author>
<creationDate>February 2013</creationDate>
<copyright>(C) 2013 Open Source Matters. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>anigag#grzeit.com</authorEmail>
<authorUrl>www.eya.com</authorUrl>
<version>2.5.0</version>
<description>Adds eya plugin ot your site</description>
<files>
<filename plugin="eya">eya.php</filename>
</files>
</install>
<administration >
<filename>admin.php</filename>
</administration>
</extension>
This is my main php file that executes the content:eya.php.
I have got another file (admin.php) that takes 2 session variables from eya.php and put them in an iframe. There are two problems. One is that I dont know if the eya.php runs everytime before admin.php (or at least once to set the session variables). The second problem is that I dont know how to display only the admin.php and nothing else.
to build an admin interface for your plugin just add the config part to your xml
<config>
<fields name="params">
<fieldset name="basic">
<field name="testfield" type="text" default="mytest" label="field_label" description="field_description" />
</fieldset>
</fields>
</config>
but I didn't get the part of your admin.php/eya.php

Resources