├── .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 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 |
ShortcutDescriptionCode
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 | 23 | 25 | 32 | 43 | 54 | 65 | 76 | 87 | 98 | 109 | 120 | 131 | 142 | 153 | 164 | 175 | 186 | 197 | 208 | 219 | 230 | 241 | 252 | 263 | 274 | 285 | 296 | 307 | 318 | 329 | 340 | 351 | 362 | 373 | 384 | 395 | 406 | 409 | 413 | 417 | 418 | 427 | 430 | 434 | 438 | 439 | 449 | 451 | 455 | 459 | 463 | 464 | 475 | 478 | 482 | 486 | 487 | 498 | 501 | 505 | 509 | 510 | 520 | 522 | 526 | 530 | 531 | 542 | 551 | 562 | 573 | 582 | 593 | 604 | 606 | 610 | 614 | 615 | 617 | 621 | 625 | 626 | 628 | 632 | 636 | 637 | 639 | 643 | 647 | 648 | 651 | 655 | 659 | 660 | 663 | 667 | 671 | 672 | 674 | 678 | 682 | 683 | 686 | 690 | 694 | 695 | 697 | 701 | 705 | 709 | 710 | 721 | 732 | 743 | 754 | 765 | 776 | 787 | 798 | 809 | 820 | 831 | 842 | 853 | 864 | 875 | 886 | 897 | 908 | 919 | 930 | 941 | 952 | 963 | 974 | 985 | 996 | 1007 | 1018 | 1029 | 1040 | 1051 | 1062 | 1073 | 1084 | 1095 | 1106 | 1113 | 1124 | 1125 | 1147 | 1149 | 1150 | 1152 | image/svg+xml 1153 | 1155 | HTML 1156 | 1157 | 1158 | web 1159 | html 1160 | www 1161 | world wide web 1162 | 1163 | 1164 | 1166 | 1167 | 1168 | Lapo Calamandrei 1169 | 1170 | 1171 | 1172 | 1173 | 1174 | Tuomas Kuosmanen 1175 | Jakub Steiner 1176 | 1177 | 1178 | 1179 | 1180 | 1181 | 1182 | 1183 | 1184 | 1185 | 1186 | 1187 | 1188 | 1189 | 1190 | 1191 | 1192 | 1193 | 1194 | 1195 | 1196 | 1197 | 1202 | 1207 | 1212 | 1214 | 1218 | 1225 | 1227 | 1232 | 1236 | 1243 | 1251 | 1258 | 1259 | 1260 | 1265 | 1269 | 1276 | 1284 | 1291 | 1292 | 1293 | 1299 | 1307 | 1313 | 1319 | 1327 | 1328 | 1329 | 1331 | 1341 | 1349 | 1357 | 1365 | 1373 | 1379 | 1385 | 1391 | 1397 | 1403 | 1409 | 1415 | 1421 | 1427 | 1428 | 1429 | 1430 | 1435 | 1436 | -------------------------------------------------------------------------------- /icons/application-x-drupal-module.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 20 | 22 | 29 | 40 | 51 | 62 | 73 | 84 | 95 | 106 | 117 | 128 | 139 | 150 | 161 | 172 | 183 | 194 | 205 | 216 | 227 | 238 | 249 | 260 | 271 | 282 | 293 | 304 | 315 | 326 | 337 | 348 | 359 | 370 | 381 | 392 | 403 | 406 | 410 | 414 | 415 | 424 | 427 | 431 | 435 | 436 | 446 | 448 | 452 | 456 | 460 | 461 | 472 | 475 | 479 | 483 | 484 | 495 | 498 | 502 | 506 | 507 | 517 | 519 | 523 | 527 | 528 | 539 | 548 | 559 | 570 | 579 | 590 | 601 | 603 | 607 | 611 | 612 | 614 | 618 | 622 | 623 | 625 | 629 | 633 | 634 | 636 | 640 | 644 | 645 | 648 | 652 | 656 | 657 | 660 | 664 | 668 | 669 | 671 | 675 | 679 | 680 | 683 | 687 | 691 | 692 | 694 | 698 | 702 | 706 | 707 | 718 | 729 | 740 | 751 | 762 | 773 | 784 | 795 | 806 | 817 | 828 | 839 | 850 | 861 | 872 | 883 | 894 | 905 | 916 | 927 | 938 | 949 | 960 | 971 | 982 | 993 | 1004 | 1015 | 1026 | 1037 | 1048 | 1059 | 1070 | 1081 | 1092 | 1103 | 1110 | 1111 | 1132 | 1134 | 1135 | 1137 | image/svg+xml 1138 | 1140 | HTML 1141 | 1142 | 1143 | web 1144 | html 1145 | www 1146 | world wide web 1147 | 1148 | 1149 | 1151 | 1152 | 1153 | Lapo Calamandrei 1154 | 1155 | 1156 | 1157 | 1158 | 1159 | Tuomas Kuosmanen 1160 | Jakub Steiner 1161 | 1162 | 1163 | 1164 | 1165 | 1166 | 1167 | 1168 | 1169 | 1170 | 1171 | 1172 | 1173 | 1174 | 1175 | 1176 | 1177 | 1178 | 1179 | 1180 | 1181 | 1182 | 1187 | 1192 | 1197 | 1199 | 1203 | 1210 | 1212 | 1217 | 1221 | 1228 | 1236 | 1243 | 1244 | 1245 | 1250 | 1254 | 1261 | 1269 | 1276 | 1277 | 1278 | 1283 | 1291 | 1296 | 1301 | 1309 | 1310 | 1311 | 1321 | 1329 | 1337 | 1345 | 1353 | 1359 | 1364 | 1365 | 1370 | 1371 | 1376 | 1377 | 1382 | 1383 | 1388 | 1389 | 1394 | 1395 | 1400 | 1401 | 1406 | 1407 | 1412 | 1413 | 1414 | 1415 | 1416 | 1421 | 1422 | -------------------------------------------------------------------------------- /icons/application-x-drupal-profile.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 23 | 25 | 32 | 43 | 54 | 65 | 76 | 87 | 98 | 109 | 120 | 131 | 142 | 153 | 164 | 175 | 186 | 197 | 208 | 219 | 230 | 241 | 252 | 263 | 274 | 285 | 296 | 307 | 318 | 329 | 340 | 351 | 362 | 373 | 384 | 395 | 406 | 409 | 413 | 417 | 418 | 427 | 430 | 434 | 438 | 439 | 449 | 451 | 455 | 459 | 463 | 464 | 475 | 478 | 482 | 486 | 487 | 498 | 501 | 505 | 509 | 510 | 520 | 522 | 526 | 530 | 531 | 542 | 551 | 562 | 573 | 582 | 593 | 604 | 606 | 610 | 614 | 615 | 617 | 621 | 625 | 626 | 628 | 632 | 636 | 637 | 639 | 643 | 647 | 648 | 651 | 655 | 659 | 660 | 663 | 667 | 671 | 672 | 674 | 678 | 682 | 683 | 686 | 690 | 694 | 695 | 697 | 701 | 705 | 709 | 710 | 721 | 732 | 743 | 754 | 765 | 776 | 787 | 798 | 809 | 820 | 831 | 842 | 853 | 864 | 875 | 886 | 897 | 908 | 919 | 930 | 941 | 952 | 963 | 974 | 985 | 996 | 1007 | 1018 | 1029 | 1040 | 1051 | 1062 | 1073 | 1084 | 1095 | 1106 | 1113 | 1114 | 1136 | 1138 | 1139 | 1141 | image/svg+xml 1142 | 1144 | HTML 1145 | 1146 | 1147 | web 1148 | html 1149 | www 1150 | world wide web 1151 | 1152 | 1153 | 1155 | 1156 | 1157 | Lapo Calamandrei 1158 | 1159 | 1160 | 1161 | 1162 | 1163 | Tuomas Kuosmanen 1164 | Jakub Steiner 1165 | 1166 | 1167 | 1168 | 1169 | 1170 | 1171 | 1172 | 1173 | 1174 | 1175 | 1176 | 1177 | 1178 | 1179 | 1180 | 1181 | 1182 | 1183 | 1184 | 1185 | 1186 | 1191 | 1196 | 1201 | 1203 | 1207 | 1214 | 1216 | 1221 | 1225 | 1232 | 1240 | 1247 | 1248 | 1249 | 1254 | 1258 | 1265 | 1273 | 1280 | 1281 | 1282 | 1288 | 1296 | 1302 | 1308 | 1316 | 1317 | 1318 | 1320 | 1330 | 1338 | 1346 | 1354 | 1362 | 1368 | 1374 | 1380 | 1386 | 1392 | 1398 | 1404 | 1410 | 1416 | 1417 | 1418 | 1419 | 1424 | 1425 | -------------------------------------------------------------------------------- /lang/drupal-info.lang: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | text/x-drupal-info;application/x-drupal-info 5 | *.info 6 | ; 7 | 8 | 9 | 10 |