├── .gitignore
├── DEBIAN
├── control
├── postinst
└── prerm
├── README
├── SNIPPET_LIST
├── build.xml
├── drupal.xml
├── drupal.xslt
├── drupalapi
├── drupalapi.gedit-plugin
├── drupalapi.png
└── drupalapi.py
├── icons
├── application-x-drupal-info.svg
├── application-x-drupal-make.svg
├── application-x-drupal-module.svg
├── application-x-drupal-profile.svg
└── application-x-drupal-tpl-php.svg
├── lang
├── drupal-info.lang
└── drupal.lang
├── mimetype
└── drupal.xml
└── mkmodule
/.gitignore:
--------------------------------------------------------------------------------
1 | *.*~
2 | *.deb
3 | *.todo
4 | *.log
5 | /debian-repo
6 |
--------------------------------------------------------------------------------
/DEBIAN/control:
--------------------------------------------------------------------------------
1 | Package: {{project.name}}
2 | Version: {{project.version}}
3 | Architecture: all
4 | Maintainer: {{project.mantainer.name}} <{{project.mantainer.email}}>
5 | Installed-Size: 828
6 | Priority: optional
7 | Depends: gedit, gedit-plugins, python-webkit
8 | Section: gnome
9 | Description: Gedit customization to Drupal developer
10 | This package contains a collection of plugins and gtksourceview improvements to
11 | make Gedit more powerfull to develop especially Drupal modules.
12 |
--------------------------------------------------------------------------------
/DEBIAN/postinst:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # Create new lang and mimetype
3 | update-mime-database /usr/share/mime
4 | # Setup icon
5 | gtk-update-icon-cache /usr/share/icons/gnome
6 | # made mkmodule executable
7 | chown root:root /usr/sbin/mkmodule
8 | chmod 555 /usr/sbin/mkmodule
9 |
10 |
--------------------------------------------------------------------------------
/DEBIAN/prerm:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | rm /usr/share/gtksourceview-2.0/language-specs/drupal.lang
3 |
--------------------------------------------------------------------------------
/README:
--------------------------------------------------------------------------------
1 | This project contains Snippet for getid to have a rapid development for Drupal devel
2 |
3 | = INSTALLATION =================================================================
4 |
5 | a) Clone repository on your machine:
6 |
7 | # git clone git://github.com/mavimo/gedit-drupal.git
8 | # cd gedit-drupal
9 |
10 | b) Copy language definition into /usr/share/gtksourceview-2.0/language-specs/
11 |
12 | # sudo cp drupal.lang /usr/share/gtksourceview-2.0/language-specs/
13 |
14 | c) Create a new mimetype into your machine
15 |
16 | # sudo cp mimetype/drupal.mime.xml /usr/share/mime/packages/drupal.mime.xml
17 | # sudo cp mimetype/drupal-theme.mime.xml /usr/share/mime/packages/drupal-theme.mime.xml
18 | # sudo cp mimetype/drupal-profile.mime.xml /usr/share/mime/packages/drupal-profile.mime.xml
19 | # sudo cp mimetype/drupal-make.mime.xml /usr/share/mime/packages/drupal-make.mime.xml
20 |
21 | d) Update mimetype database
22 |
23 | # sudo update-mime-database /usr/share/mime
24 |
25 | e) Add icon into your icons folder, first of all find your iconset name
26 | (gnome, Tangerine, ..), and copy into this folder (on scalable subfolder)
27 | icon file:
28 |
29 | # sudo cp icons/application-x-drupal-php.svg /usr/share/icons/ICONSET_NAME/scalable/mimetype/application-x-drupal-php.svg
30 | # sudo cp icons/application-x-drupal-tpl-php.svg /usr/share/icons/ICONSET_NAME/scalable/mimetype/application-x-drupal-tpl-php.svg
31 | # sudo cp icons/application-x-drupal-profile-php.svg /usr/share/icons/ICONSET_NAME/scalable/mimetype/application-x-drupal-profile-php.svg
32 | # sudo cp icons/application-x-drupal-make-php.svg /usr/share/icons/ICONSET_NAME/scalable/mimetype/application-x-drupal-make-php.svg
33 |
34 | after that regenerate iconset cache:
35 |
36 | # cd /usr/share/icons
37 | # sudo gtk-update-icon-cache ICONSET_NAME
38 |
39 | f) Enable Snippet plugin from
40 |
41 | Edit -> Preferences -> Plugins
42 |
43 | If not already aviable please install it from your distrubution system, for
44 | debian / ubuntu system you can use repostitory at deb.mavimo.org:
45 |
46 | # sudo sh -c "echo 'deb http://deb.mavimo.org/ binary/' >> /etc/apt/sources.list"
47 | # sudo apt-get update
48 | # sudo apt-get install gedit-plugins
49 |
50 | g) Add variuos snippets
51 |
52 | Tools -> Manage Snippets ...
53 |
54 | Press "Import snippets" button (second from left on bottom) and import *.xml file
55 | do you require. After that you can use drupal-snippet
56 |
57 | = USAGE ========================================================================
58 |
59 | Using Snippet is very simple, when you write a drupal module or install file
60 | please select, from View -> Highlight Mode -> Scripts -Drupal, and now you can
61 | write your code with snippet accelerator, a complete list of snippet is aviable
62 | on file SNIPPET_LIST
63 | If you create new mimetype to you machine is not required set Highlight Mode, sistem
64 | automatically detect it.
65 |
--------------------------------------------------------------------------------
/SNIPPET_LIST:
--------------------------------------------------------------------------------
1 | == PHP Function ================================================================
2 |
3 | array
4 | array
5 | case
6 | case ..
7 | do
8 | do .. while ..
9 | else
10 | else ..
11 | elseif
12 | elseif ..
13 | for
14 | for ..
15 | foreach
16 | foreach ..
17 | if
18 | if ..
19 | ifelse
20 | if .. else ..
21 | switch
22 | switch ..
23 | while
24 | while ..
25 |
26 | == Drupal Function =============================================================
27 |
28 | db
29 | db_fetch_array()
30 | db_fetch_object()
31 | db_query()
32 | db_query_range()
33 | db_set_active()
34 | drupal_write_record()
35 | db_affected_rows()
36 | drupal
37 | drupal_add_css()
38 | drupal_add_js( inline )
39 | drupal_add_js( module )
40 | drupal_add_js( settings )
41 | drupal_json()
42 | drupal_set_message()
43 | fapi
44 | FAPI button
45 | FAPI checkbox
46 | FAPI checkboxes
47 | FAPI date
48 | FAPI fieldset
49 | FAPI file
50 | FAPI hidden
51 | FAPI markup
52 | FAPI password
53 | FAPI radios
54 | FAPI select
55 | FAPI textarea
56 | FAPI textfield
57 | FAPI submit
58 | file
59 | file_copy()
60 | file_delete()
61 | file_destination()
62 | file_move()
63 | file_save_upload()
64 | check_file()
65 | function
66 | function()
67 | hook
68 | hook_access()
69 | hook_block()
70 | hook_comment
71 | hook_cron()
72 | hook_delete()
73 | hook_filter
74 | hook_form_alter()
75 | hook_form()
76 | hook_forms()
77 | hook_help()
78 | hook_insert()
79 | hook_install()
80 | hook_load()
81 | hook_link()
82 | hook_menu()
83 | hook_nodeapi()
84 | hook_node_info()
85 | hook_perm()
86 | hook_schema()
87 | hook_search()
88 | hook_taxonomy()
89 | hook_theme()
90 | hook_uninstall()
91 | hook_update()
92 | hook_update_N()
93 | hook_user()
94 | hook_validate()
95 | hook_view()
96 | l
97 | l()
98 | t
99 | t()
100 | format_plural()
101 | views
102 | field
103 | field handler
104 | hook_views_api()
105 | hook_views_data()
106 | hook_views_handler()
107 | hook_views_default_views()
108 | watchdog
109 | watchdog()
110 |
111 | == Drupal File structure =======================================================
112 |
113 | module
114 | module
115 | install
116 | install
117 | info
118 | info
119 |
--------------------------------------------------------------------------------
/build.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 | Archive: stable
122 | Component: contrib
123 | Origin: Agavee
124 | Label: Mavimo
125 | Architecture: i386
126 |
127 |
128 |
129 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
--------------------------------------------------------------------------------
/drupal.xslt:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Gedit Drupal Snippets
7 |
51 |
52 |
53 | List of Gedit-Drupal Snippet
54 |
55 |
56 |
57 | Shortcut |
58 | Description |
59 | Code |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 | |
68 | |
69 |
|
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
--------------------------------------------------------------------------------
/drupalapi/drupalapi.gedit-plugin:
--------------------------------------------------------------------------------
1 | [Gedit Plugin]
2 | Loader=python
3 | Module=drupalapi
4 | IAge=2
5 | Name=Drupal API
6 | Description=Explore Drupal API
7 | Authors=Marco Vito Moscaritolo
8 | Copyright=Copyright (C) 2006-2011 Marco Vito Moscaritolo
9 | Website=http://mavimo.org
10 |
--------------------------------------------------------------------------------
/drupalapi/drupalapi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mavimo/gedit-drupal/fced24c868b51add261679cdb9b1b850688214c6/drupalapi/drupalapi.png
--------------------------------------------------------------------------------
/drupalapi/drupalapi.py:
--------------------------------------------------------------------------------
1 | import gedit
2 | import os
3 | import re
4 | import gtk
5 | import webkit
6 | import types
7 |
8 | class DrupalApi(gedit.Plugin):
9 |
10 | def update_ui(self, window):
11 | # Start auto completion for the active view
12 | view = window.get_active_view()
13 | self.setup_dapi_autocompletion(view)
14 |
15 | # Starts auto completion for a given view
16 | def setup_dapi_autocompletion(self, view):
17 | if type(view) != types.NoneType:
18 | if getattr(view, 'completion_instance', False) == False:
19 | setattr(view, 'completion_instance', DApiCompletion())
20 | handler_id = view.connect(
21 | 'key-press-event',
22 | view.completion_instance.complete_word)
23 |
24 | class DApiCompletion():
25 | def _current_module_name(self):
26 | window = gedit.app_get_default().get_active_window()
27 | doc = window.get_active_document()
28 | uri = doc.get_uri().split('/')
29 | uri = uri[len(uri) - 1].split('.')[0].lower()
30 | return uri
31 |
32 | def _split_function(var, char, limit):
33 | if(char == ' '):
34 | return True
35 | if(char == '('):
36 | return True
37 | if(char == '='):
38 | return True
39 | if(char == '>'):
40 | return True
41 | if(char == ','):
42 | return True
43 | if(char == '.'):
44 | return True
45 |
46 | return False
47 |
48 | def complete_word(self, view, event):
49 | # Use multiple mouse click on function to open API Doc
50 | # (change 'key-press-event' to 'button-press-event')
51 | #
52 | # if (event.type == gtk.gdk._3BUTTON_PRESS):
53 | #
54 | # Set CTRL + CHAR to open API Doc
55 | if(event.state & gtk.gdk.CONTROL_MASK and gtk.gdk.keyval_name(event.keyval) == 'l'):
56 | buffer = view.get_buffer()
57 | iter_cursor = buffer.get_iter_at_mark(buffer.get_insert())
58 | iter_start = iter_cursor.copy()
59 | iter_stop = iter_cursor.copy()
60 |
61 | iter_el = iter_cursor.copy()
62 | iter_sl = iter_cursor.copy()
63 | iter_el.forward_to_line_end()
64 | iter_sl.set_line_offset(0)
65 |
66 | iter_start.backward_find_char(self._split_function, True, iter_sl)
67 | iter_stop.forward_find_char( self._split_function, True, iter_el)
68 |
69 | word = buffer.get_text(iter_start, iter_stop)
70 |
71 | function = re.sub("\s", "", word)
72 |
73 | name = self._current_module_name()
74 |
75 | # if start with same file name is a hook
76 | if(function.startswith(name + '_')):
77 | function = function.replace(name + '_', 'hook_', 1)
78 |
79 | # Load info page
80 | # Window elements
81 | main_window = gtk.Window ()
82 | scrolled_window = gtk.ScrolledWindow ()
83 | web_view = webkit.WebView ()
84 | # Add elements into window
85 | gtk.Container.add (scrolled_window, web_view)
86 | gtk.Container.add (main_window, scrolled_window)
87 | # Set URL to open
88 | webkit.WebView.load_uri (web_view, "http://api.drupal.org/api/function/" + function + '/7')
89 | # Set window size
90 | gtk.Window.set_default_size (main_window, 1024, 600)
91 | # Set window position (center)
92 | main_window.set_position(gtk.WIN_POS_CENTER)
93 | # Set window title
94 | main_window.set_title ("Drupal 7 API: " + function)
95 | # Show window
96 | gtk.Widget.show_all (main_window)
97 | return False
98 | else:
99 | return False
100 |
--------------------------------------------------------------------------------
/icons/application-x-drupal-info.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
1436 |
--------------------------------------------------------------------------------
/icons/application-x-drupal-module.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
1422 |
--------------------------------------------------------------------------------
/icons/application-x-drupal-profile.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
1425 |
--------------------------------------------------------------------------------
/lang/drupal-info.lang:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | text/x-drupal-info;application/x-drupal-info
5 | *.info
6 | ;
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
24 |
25 | ^\[
26 | \]$
27 |
28 |
29 | ^_?X\-[a-zA-Z\-]+
30 |
31 |
32 | \[[a-zA-Z_]+\]
33 |
34 |
35 | ^[a-zA-Z_][a-zA-Z0-9_.-]*
36 |
37 |
38 | true
39 | false
40 | on
41 | off
42 | yes
43 | no
44 |
45 |
46 | '
47 | '
48 |
49 |
50 | "
51 | "
52 |
53 |
54 | \b[0-9]+\b
55 |
56 |
57 | (\b[0-9]+(\.[0-9]+)?|\.[0-9]+)([Ee][\+-]?[0-9]+)?\b
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/lang/drupal.lang:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | text/x-drupal;application/x-drupal;text/x-drupal-profile;application/x-drupal-profile
5 | *.module;*.install;*.inc;*.profile
6 | #
7 | /*
8 | */
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
39 |
40 |
46 |
47 |
54 |
55 |
58 |
59 |
60 | \\((\\|"|n|t|\$|r)|[0-7]{1,3}|x[0-9a-fA-F]{1,2})
61 |
62 |
63 |
64 | [$]+[a-zA-Z_][a-zA-Z0-9_]*
65 |
66 |
67 |
68 | (\[|\])
69 |
70 |
71 |
72 |
73 |
74 |
75 | {(?=\$)
76 | }
77 |
78 |
79 |
80 |
81 |
82 | \${
83 | }
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 | "
93 | "
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 | '
103 | '
104 |
105 |
106 | \\['\\]
107 |
108 |
109 |
110 |
111 |
112 |
113 | `
114 | `
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 | (<<<)\s?([a-zA-Z_][a-zA-Z0-9_]*)
123 | ^(\%{2@start});?$
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 | [a-zA-Z_][a-zA-Z0-9_]*
135 |
136 |
137 |
138 | abstract
139 | and
140 | as
141 | break
142 | case
143 | catch
144 | class
145 | const
146 | continue
147 | default
148 | die
149 | do
150 | doubleval
151 | echo
152 | else
153 | elseif
154 | empty
155 | endfor
156 | endforeach
157 | endswitch
158 | endwhile
159 | extends
160 | final
161 | floatval
162 | for
163 | foreach
164 | function
165 | gettype
166 | global
167 | if
168 | implements
169 | import
170 | include
171 | include_once
172 | instanceof
173 | interface
174 | intval
175 | list
176 | namespace
177 | new
178 | or
179 | print
180 | print_r
181 | private
182 | protected
183 | public
184 | require
185 | require_once
186 | return
187 | serialize
188 | settype
189 | static
190 | strval
191 | switch
192 | throw
193 | try
194 | unserialize
195 | unset
196 | var
197 | var_dump
198 | var_export
199 | while
200 | xor
201 |
202 |
203 |
204 | [-.~^@,;:/%|\=\+\*\!\?&<>()]
205 |
206 |
207 |
208 | array
209 | bool
210 | boolean
211 | double
212 | float
213 | int
214 | integer
215 | object
216 | real
217 | string
218 | unset
219 |
220 |
221 |
222 | (?i)\b
223 | null
224 |
225 |
226 |
227 | (?i)\b
228 | false
229 | true
230 |
231 |
232 |
233 |
234 | (?<![\w\.])
235 | ([0-9]+[Ee][+-]?[0-9]+ |
236 | ([0-9]*\.[0-9]+ | [0-9]+\.[0-9]*)([Ee][+-]?[0-9]+)?)
237 | (?![\w\.])
238 |
239 |
240 |
241 |
242 |
243 | (?<![\w\.])
244 | [+-]?([1-9][0-9]*|0)
245 | (?![\w\.])
246 |
247 |
248 |
249 |
250 |
251 | (?<![\w\.])
252 | [+-]?0[0-7]+
253 | (?![\w\.])
254 |
255 |
256 |
257 |
258 |
259 | (?<![\w\.])
260 | [+-]?0x[0-9a-fA-F]+
261 | (?![\w\.])
262 |
263 |
264 |
265 |
266 | <([?](php)?)
267 | [?]>
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
--------------------------------------------------------------------------------
/mimetype/drupal.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Drupal module
6 | Modulo di Drupal
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | Drupal make
19 | Make file di Drupal
20 |
21 |
22 |
23 |
24 |
25 |
26 | Drupal info
27 | File info di Drupal
28 |
29 |
30 |
31 |
32 |
33 |
34 | Drupal installation profile
35 | Profilo di installazione di Drupal
36 |
37 |
38 |
39 |
40 |
41 |
42 | Drupal template file
43 | File template di Drupal
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/mkmodule:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | NO_ARG=0
3 | E_ERR_OPZ=65
4 |
5 | if [ $# -eq "$NO_ARG" ] # Chck for argument
6 | then
7 | echo "Using: `basename $0` module_name"
8 | exit $E_ERR_OPZ # Quit and report error number
9 | fi
10 |
11 | MODULENAME=$1
12 |
13 | # Create folder
14 | mkdir $MODULENAME
15 | mkdir $MODULENAME/translation
16 | mkdir $MODULENAME/tests
17 |
18 | # Create file
19 | touch $MODULENAME/README
20 | touch $MODULENAME/INSTALL
21 | echo "initinfo" > $MODULENAME/$MODULENAME.info
22 | echo "initinstall" > $MODULENAME/$MODULENAME.install
23 | echo "initmodule" > $MODULENAME/$MODULENAME.module
24 |
25 | # Open file whit gedit
26 | gedit $MODULENAME/$MODULENAME.info \
27 | $MODULENAME/$MODULENAME.install \
28 | $MODULENAME/$MODULENAME.module
29 |
--------------------------------------------------------------------------------