version 1.59, 2007/07/12 19:54:43
|
version 1.62, 2008/09/15 13:22:48
|
Line 37 use GDBM_File;
|
Line 37 use GDBM_File;
|
use Apache::loncommon; |
use Apache::loncommon; |
use Apache::lonlocal; |
use Apache::lonlocal; |
use Apache::lonnet; |
use Apache::lonnet; |
use LONCAPA(); |
use LONCAPA; |
|
|
my $iconpath; # variable to be accessible to multiple subroutines |
my $iconpath; # variable to be accessible to multiple subroutines |
my %hash; # variable to tie to user specific database |
my %hash; # variable to tie to user specific database |
Line 45 my %hash; # variable to tie to user spec
|
Line 45 my %hash; # variable to tie to user spec
|
|
|
sub update_actions_hash { |
sub update_actions_hash { |
my ($hash) = @_; |
my ($hash) = @_; |
|
# be careful in here, there is also a global %hash |
my $acts=$env{'form.acts'}; |
my $acts=$env{'form.acts'}; |
my @Acts=split(/b/,$acts); |
my @Acts=split(/b/,$acts); |
my %ahash; |
my %ahash; |
my %achash; |
my %achash; |
my $ac=0; |
|
# some initial hashes for working with data |
# some initial hashes for working with data |
|
my $ac=0; |
foreach (@Acts) { |
foreach (@Acts) { |
my ($state,$ref)=split(/a/); |
my ($state,$ref)=split(/a/); |
$ahash{$ref}=$state; |
$ahash{$ref}=$state; |
$achash{$ref}=$ac; |
$achash{$ref}=$ac; |
$ac++; |
$ac++; |
Line 60 sub update_actions_hash {
|
Line 61 sub update_actions_hash {
|
# sorting through the actions and changing the global database hash |
# sorting through the actions and changing the global database hash |
foreach my $key (sort {$achash{$a}<=>$achash{$b}} (keys %ahash)) { |
foreach my $key (sort {$achash{$a}<=>$achash{$b}} (keys %ahash)) { |
if ($ahash{$key} eq '1') { |
if ($ahash{$key} eq '1') { |
$hash->{'store_'.$hash{'pre_'.$key.'_link'}}= |
$hash->{'store_'.$hash->{'pre_'.$key.'_link'}}= |
$hash->{'pre_'.$key.'_title'}; |
$hash->{'pre_'.$key.'_title'}; |
$hash->{'storectr_'.$hash{'pre_'.$key.'_link'}}= |
$hash->{'storectr_'.$hash->{'pre_'.$key.'_link'}}= |
$hash->{'storectr'}+0; |
$hash->{'storectr'}+0; |
$hash->{'storectr'}++; |
$hash->{'storectr'}++; |
} |
} |
if ($ahash{$key} eq '0') { |
if ($ahash{$key} eq '0') { |
if ($hash->{'store_'.$hash{'pre_'.$key.'_link'}}) { |
if ($hash->{'store_'.$hash->{'pre_'.$key.'_link'}}) { |
delete($hash->{'store_'.$hash{'pre_'.$key.'_link'}}); |
delete($hash->{'store_'.$hash->{'pre_'.$key.'_link'}}); |
|
delete($hash->{'storectr_'.$hash->{'pre_'.$key.'_link'}}); |
} |
} |
} |
} |
} |
} |
Line 204 sub handler {
|
Line 206 sub handler {
|
|
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
['acts','mode','readfile','recover','bookmarks']); |
['acts','mode','readfile','recover','bookmarks']); |
# color scheme |
|
my $fileclr = '#ffffe6'; |
|
my $titleclr = '#ddffff'; |
|
|
|
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
Line 227 function finish_import() {
|
Line 226 function finish_import() {
|
for (var num=0; num<document.forms.groupsort.fnum.value; num++) { |
for (var num=0; num<document.forms.groupsort.fnum.value; num++) { |
$begincondition |
$begincondition |
opener.document.forms.simpleedit.importdetail.value+='&'+ |
opener.document.forms.simpleedit.importdetail.value+='&'+ |
escape(eval("document.forms.groupsort.title"+num+".value"))+'='+ |
eval("document.forms.groupsort.title"+num+".value")+'='+ |
escape(eval("document.forms.groupsort.filelink"+num+".value"))+'='+ |
eval("document.forms.groupsort.filelink"+num+".value")+'='+ |
escape(eval("document.forms.groupsort.id"+num+".value")); |
eval("document.forms.groupsort.id"+num+".value"); |
$endcondition |
$endcondition |
} |
} |
opener.document.forms.simpleedit.submit(); |
opener.document.forms.simpleedit.submit(); |
Line 351 END
|
Line 350 END
|
my $resurl = |
my $resurl = |
&Apache::loncommon::escape_single(&Apache::loncommon::lastresurl()); |
&Apache::loncommon::escape_single(&Apache::loncommon::lastresurl()); |
$r->print(<<END); |
$r->print(<<END); |
<b><font color="#888888">$lt{'fin'}</font></b> |
<h2>$lt{'fin'}</h2> |
|
<div> |
<input type="button" name="alter" value="$lt{'ci'}" |
<input type="button" name="alter" value="$lt{'ci'}" |
onClick="window.location='$resurl?inhibitmenu=yes&catalogmode=import'" /> |
onClick="window.location='$resurl?inhibitmenu=yes&catalogmode=import'" /> |
<input type="button" name="altersearch" value="$lt{'cs'}" |
<input type="button" name="altersearch" value="$lt{'cs'}" |
Line 359 END
|
Line 359 END
|
<input type="button" name="alter" value="$lt{'fi'}" |
<input type="button" name="alter" value="$lt{'fi'}" |
onClick="finish_import()" /> |
onClick="finish_import()" /> |
<input type="button" name="alter" value="$lt{'ca'}" onClick="self.close()" /> |
<input type="button" name="alter" value="$lt{'ca'}" onClick="self.close()" /> |
|
</div> |
|
<br /> |
END |
END |
} |
} |
$r->print("<table border='0'><tr><td bgcolor='#eeeeee'>"); |
$r->print(&Apache::loncommon::start_data_table() |
$r->print("<table border=0><tr>\n"); |
.&Apache::loncommon::start_data_table_header_row()); |
if (($env{'form.readfile'}) || ($env{'form.bookmarks'})) { |
if (($env{'form.readfile'}) || ($env{'form.bookmarks'})) { |
$r->print("<td bgcolor='$titleclr'><b>$lt{'in'}</b></td>\n"); |
$r->print("<th>$lt{'in'}</th>\n"); |
} else { |
} else { |
$r->print("<td colspan='2' bgcolor='$titleclr'><b>$lt{'co'}</b></td>\n"); |
$r->print("<th colspan='2'>$lt{'co'}</th>\n"); |
} |
} |
$r->print("<td colspan='2' bgcolor='$titleclr'><b>$lt{'ti'}</b></td>\n"); |
$r->print("<th colspan='2'>$lt{'ti'}</th>\n"); |
$r->print("<td bgcolor='$titleclr'><b>$lt{'pa'}</b></td></tr>\n"); |
$r->print("<th>$lt{'pa'}</th>"); |
|
$r->print(&Apache::loncommon::end_data_table_header_row() |
|
."\n"); |
} else { |
} else { |
$r->print(&Apache::loncommon::start_page(undef,$js, |
$r->print(&Apache::loncommon::start_page(undef,$js, |
{'only_body' => 1})); |
{'only_body' => 1})); |
Line 388 END
|
Line 392 END
|
$ctr++; |
$ctr++; |
my $iconname=&Apache::loncommon::icon($resource->{'url'}); |
my $iconname=&Apache::loncommon::icon($resource->{'url'}); |
if (($clen > 1) || ($env{'form.readfile'}) || ($env{'form.bookmarks'})) { |
if (($clen > 1) || ($env{'form.readfile'}) || ($env{'form.bookmarks'})) { |
$r->print("<tr><td bgcolor='$fileclr'>"); |
$r->print(&Apache::loncommon::start_data_table_row() |
|
."<td>"); |
if (($env{'form.readfile'}) || ($env{'form.bookmarks'})) { |
if (($env{'form.readfile'}) || ($env{'form.bookmarks'})) { |
$r->print(&checkbox($ctr-1)); |
$r->print(&checkbox($ctr-1)); |
} else { |
} else { |
Line 400 END
|
Line 405 END
|
if (($clen > 1) || ($env{'form.readfile'}) || ($env{'form.bookmarks'})) { |
if (($clen > 1) || ($env{'form.readfile'}) || ($env{'form.bookmarks'})) { |
$r->print("</td>"); |
$r->print("</td>"); |
unless (($env{'form.readfile'}) || ($env{'form.bookmarks'})) { |
unless (($env{'form.readfile'}) || ($env{'form.bookmarks'})) { |
$r->print("<td bgcolor='$fileclr'>". |
$r->print("<td>". |
&select_box($clen,$ctr). |
&select_box($clen,$ctr). |
"</td>"); |
"</td>"); |
} |
} |
$r->print("<td bgcolor='$fileclr'>"); |
$r->print("<td>"); |
$r->print("<img src='$iconname' />"); |
$r->print("<img src='$iconname' />"); |
$r->print("</td><td bgcolor='$fileclr'>"); |
$r->print("</td><td>"); |
$r->print($resource->{'title'}.$resource->{'notes'}."</td><td bgcolor='$fileclr'>\n"); |
$r->print($resource->{'title'}.$resource->{'notes'}."</td><td>\n"); |
$r->print($resource->{'url'}."</td></tr>\n"); |
$r->print($resource->{'url'}."</td>" |
|
.&Apache::loncommon::end_data_table_row() |
|
."\n"); |
} |
} |
} |
} |
if (($clen > 1) || ($env{'form.readfile'}) || ($env{'form.bookmarks'})) { |
if (($clen > 1) || ($env{'form.readfile'}) || ($env{'form.bookmarks'})) { |
$r->print("</table></td></tr></table></form>"); |
$r->print(&Apache::loncommon::end_data_table() |
|
."</form>"); |
} else { |
} else { |
$r->print(<<END); |
$r->print(<<END); |
<script type="text/javascript"> |
<script type="text/javascript"> |
Line 429 END
|
Line 437 END
|
# --------------------------------------- Hidden values (returns scalar string) |
# --------------------------------------- Hidden values (returns scalar string) |
sub hidden { |
sub hidden { |
my ($sel,$title,$filelink,$id) = @_; |
my ($sel,$title,$filelink,$id) = @_; |
my $string = '<input type="hidden" name="title'.$sel.'" value="'.$title. |
my $string = '<input type="hidden" name="title'.$sel.'" value="'. |
'" />'; |
&escape($title).'" />'; |
$filelink=~s|^/ext/|http://|; |
$filelink=~s|^/ext/|http://|; |
$string .= '<input type="hidden" name="filelink'.$sel.'" value="'. |
$string .= '<input type="hidden" name="filelink'.$sel.'" value="'. |
$filelink.'" />'; |
&escape($filelink).'" />'; |
$string .= '<input type="hidden" name="id'.$sel.'" value="'.$id.'" />'; |
$string .= '<input type="hidden" name="id'.$sel.'" value="'.&escape($id).'" />'; |
return $string; |
return $string; |
} |
} |
|
|