This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

Java applet to drag, drop and upload multiple files

We need a better interface for uploading multiple files - mainly images. Based on what I know and what I've read, there may be some potential in Java applets. What I'm thinking of is an applet that:

* allows you to drag and drop files (from explorer) on to the web page, showing you thumbnails (in the case of images or vids)
* will zip multiple files together for a single, optimized upload
* will upload this data using the drupal api either:
- Directly via an http call
- via AJAX, simply updating the form that posts the upload (I think this is the best solution)
* and finally, shows progress of the upload (again) either via the applet, or AJAX and Javascript

The AJAX solution would simply require the Java Applet to collect files dropped into the applet, zip them up, and send the information (on the location of the temp zip file) to an AJAX method that would update an upload form with the location of the file. Then, you'd use other existing AJAX helper methods to run a JavaScript\AJAX progress bar while uploading.

So, the question is, how possible is this? What are the limitations with using a Java Applet (assuming it is signed - for file access) with Drupal? Would the AJAX solution work?

Someone shoot me down before I get my hopes up too high!!! Obviously this solution has HUGE potential in the realms of image\photo galleries and other digital albums.

Welcome Message in OG 4.7?

Hi,

I'm upgrading my site to 4.7 and am using Organic Groups but can't find where (in the upgraded version) to change the group "welcome message".

In 4.6 it was under the group page's "edit" tab.

Also, I've heard that much has changed with OG between 4.6 and 4.7 but neither the readme nor the documentation page reflect any changes. Have I been staying up too late or are the changes documented somewhere?

Thanks,
Kevin

Form that I made didnt work

Hi everyone,

Am kinda new to drupal but have been fiddling around for a week or so.
Now I am trying to create a module that basically does the same thing as the user module, which is create some data and store it in a database.

Heres how it goes,
-the user presses the 'view data' menu item, which will list all the data in the database, just like in the user menu.
- then there will be a 'add new data' tab in it (like 'add user' in user menu).
-when i press that, i have a form, which will let the user enter the data, and the save button underneat the form will submit the data into the database.

My problem is, when I press the save button, the data never gets saved, and instead, the user is taken to the 'view data' page. :S

Here is some code...

function mine_admin(){//this is called for when the 'view data' is clicked

$edit = isset($_POST['edit']) ? $_POST['edit'] : '';
$op = isset($_POST['op']) ? $_POST['op'] : '';

if (empty($op)) {
$op = arg(2);
}
switch ($op) {
case 'create':
$output = mine_new();
break;
default:
$output = mine_asset_list();
}
return $output;
}

function mine_new(){
$form ['code'] = array (
'#type' => 'textfield',
'#title' => t('code'),
'#required' => TRUE
);
$form ['Name'] = array (
'#type' => 'textfield',
'#title' => t('Name'),
'#required' => TRUE
);

Spice menu item into LOCAL_TASK tree?

Hi all,

I am building a community website with user profile pages using a separate theme template from the main site. Here is a sample of what the user/profile page looks like:

profile page.

The menu bar at the top of the user page is the primary tab of the user menu tree. I've added the blog item menu and listing by modifying the blog.module in this manner:


function blog_menu($may_cache) {
global $user;
$items = array();

if ($may_cache) {
$items[] = array('path' => 'node/add/blog', 'title' => t('blog entry'),
'access' => user_access('edit own blog'));
$items[] = array('path' => 'blogs', 'title' => t('blogs'),
'callback' => 'blog_page',
'access' => user_access('access content'),
'type' => MENU_SUGGESTED_ITEM);
$items[] = array('path' => 'blogs/'. $user->uid, 'title' => t('my blog'),
'access' => user_access('edit own blog'), 'type' => MENU_DYNAMIC_ITEM);
}
else {
if (arg(0) == 'user' && is_numeric(arg(1))) {
$items[] = array(
'path' => 'user/'. arg(1) . '/blogs', 'title' => t('blog'),
'callback' => 'blog_page', 'access' => user_access('access content'),
'type' => MENU_LOCAL_TASK, 'callback arguments' => array(arg(1)));
$items[] = array(
'path' => 'user/'. arg(1) . '/blogs/node/' . arg(4), 'title' => t('Blog Entry'),

Strange behaviour using the forms API

I've just begun converting my home-grown modules to 4.7, and of course the first thing I worry about is the admin form. After a bit of mucking about, much helped by the very useful Quickstart guide, and the also very useful converter kindly hosted by Lullabot. I have managed to get a form to display correctly, with default values in it, and to get the "_submit" function to, err... function. After a fashion...

Here is the code for my "submit" button:

   $form['titles_press_button'] = array(
   	'#type' => 'submit',
	'#value' => t('Update'),
	);

I then handle the submit using an appropriately named function, as thuswise:
<?php
function titles_admin_form_submit($form_id, $form_values) {
$edit = $_POST['edit'];

$result = db_query('DELETE FROM {titles_settings}');
for ($i = 0; $i < $form_values['titles_count']; $i++) {
if ($edit["titles_display_name_$i"] != '') {
if ($edit["titles_weight_$i"] == '') {$edit["titles_weight_$i"] = 0;}
if ($edit["titles_days_up_$i"] == '') {$edit["titles_days_up_$i"] = 0;}
db_query("INSERT INTO {titles_settings} (uid, display_name, which_column, weight, days_up) VALUES ('%d', '%s', '%d', '%d', '%d')", $edit["titles_uid_$i"], $edit["titles_display_name_$i"],$edit["titles_which_column_$i"],$edit["titles_weight_$i"], $edit["titles_days_up_$i"]);

Can I add 'non-node' link to the create content page?

Hope I can explain this properly... I don't wish to create a new node type but I DO want to have a link to create a new type on the 'create content' page. Now I'm soooo nearly there and I just can't work out what I'm missing.

I've got set up:

hook_node_info
hook_help
hook_menu

Is there anything else I need to do? Currently the module displays all the menu links under 'create content' menu item but displays nothing on the actual page body itself. If it helps, here's the menu hook I'm using (which obviously works) it's more or less the same code for the other hooks too:

<?php
foreach (tablemanager_tables() as $no => $table) {

$items[] = array('path' => 'node/add/tablemanager-'.$no, 'title' => t($table['name']),
'callback' => 'tablemanager_add',
'access' => user_access("create '". $table['name'] ."' content") or $admin_access,
'type' => MENU_NORMAL_ITEM);
$items[] = array('path' => 'tablemanager/edit', 'title' => t("Edit Table '".$table['name']."' Entry"),
'callback' => 'tablemanager_edit',
'access' => user_access("edit own '". $table['name'] ."' content") or $admin_access,
'type' => MENU_CALLBACK);
$items[] = array('path' => 'tablemanager/delete', 'title' => t("Delete Table '".$table['name']."' Entry"),

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions