Pages

Showing posts with label Creating. Show all posts
Showing posts with label Creating. Show all posts

Sunday, April 21, 2013

Social Engine 4-Creating a widget in a module

Before creating a widget in a module we need to register the same

1. Go to your module folder and then in your module go to file

settings/content.php

This file contains all widgets which this module will provide.

As an example we will create a widget to show graph and also called it graph

This file returns an array of array's where the former contains various widgets information

 return array(  
  array(  
   'title' => 'Navigation Tabs',  
   'description' => 'Displays the Navigation tabs(menu) for Credits: Credits Home, My Credits, FAQ. Put this widget on the top of Credits Home and My Credits pages.',  
   'category' => 'Credits',  
   'active' => true,  
   'type' => 'widget',  
   'name' => 'credit.navigation-tabs',  
  ),  
  array(  
   'title' => 'Top Members',  
   'description' => 'Displays top members list with highest number of credits. Put this widget on Credits Home or on any other page.',  
   'category' => 'Credits',  
   'active' => true,  
   'type' => 'widget',  
   'name' => 'credit.browse-users',  
   'defaultParams' => array(  
    'title' => 'Top Members'  
   )  
  ),  
  array(  
   'title' => 'Graph',  
   'description' => 'Displays a widgets which displays a list of quick links to create a graph.',  
   'category' => 'Credits',  
   'type' => 'widget',  
   'name' => 'credit.graph',  
    'active' => true,  
   'defaultParams' => array(  
    'title' => 'Graph'  
   )  
  ));  

Look in the last array we have added our custom widget array in the end

Now lets move into the widget's folder of our module

Let's suppose our Module name is "Credit"

so in /widgets/graph/controller.php

We need to create these directories as per requirement

1:  Class Credit_Widget_GraphController extends Engine_Content_Widget_Abstract  
2:  {  
3:     public function indexAction()  
4:     {  
5:        $this->view->myvar="myvarvalue";  
6:       //You can also include forms (defined in forms of your module)  
7:         $this->view->form=new Filter_Form()  
8:     }  
9:  }  

Look at the name of the class see in settings file we have defined property "name" in widget array as credit.graph like wise here "Credit" is our module and "Graph" is widget...This should match with property.

Next we define template in
in /widgets/graph/index.tpl

and Access variables as

1:  <?php echo $this->filterForm ?>  


That's It Add widget from backend to the respective page

Friday, January 20, 2012

Setting up Subversion and Tortoise SVN(Code Management) on Windows Network

Note:For Windows Vista and above use Admin mode to run command Command Prompt.

To Install Subversion and Tortoise SVN you need to setup a server and a client(They both can be same computer).

#Setting up Server:-

At server runs a software called as subversion.Download latest release from

http://subversion.apache.org/download/#recommended-release


and install the same

Creating a repository:

At the command prompt(use admin mode for Vista and above) fire the following command

svnadmin create C:\MyRepo

where c:\Myrepo is the path to your repository you can change it to your taste

Modifying security and Authentication:

Navigate to your directory(c:\MyRepo in my case) you will find a bunch of folders over there.

Open "Conf" folder.
Open "svnserve.conf" and uncomment(remove # before) following lines

[general]
anon-access=read
auth-access=write
password-db=passwd

save the file and open "passwd" file in same folder.

$username=$password

In this format start entering usernames & password under [Users]

eg. John=testing

save it once you are done configuring Now its time to create a windows service as follows

Creating a windows service:

SC create svnserve binpath= "c:\Program Files\subversion\bin\svnserve.exe --service --root \"C:\MyRepo\"" displayname="Subversion" depend=tcpip start=auto.

click on start->run open services.msc find "Subversion" service and start the same

[If it fails check the path of svnserve.exe in your case also check the repository folder is same as created.Check the properties of the service it should show thw path to svnserve.exe check that path and path of that service under subversion in program files].

#At the client

At the client we need a client software to communicate with subversion service.
We will be using Tortoise SVN you can use plugin's available for your IDE's and many more available online

Download Tortise SVN from
http://tortoisesvn.net/downloads.html

And install the same once done right click on your desktop go to Tortoise-Svn->Repobrowser and enter url as follows

SVN://ip of your server

for same machine's as server and client use svn://localhost

If it connects BINGO! successfully connected if not check folder repository again