function output_footer()
{
    global $WIZARD_BUTTONS, $ONBACK_SCRIPT, $ONNEXT_SCRIPT;
    global $HTTP_SERVER_VARS, $PHP_SELF, $CONFIG;
    ?>

<div id="content"></div>

<script language='javascript'>
function create_alb() {
        if (createAlb.newAlbName.value == ''){
                return false;
        } else {
                createAlb.submit();
        }
}

function create_alb_or_use_existing() {
        if (createAlb.newAlbName.value == ''){
                startUpload();
        } else {
                createAlb.submit();
        }
}

function startUpload() {
        var xml = window.external.Property('TransferManifest');
        var files = xml.selectNodes('transfermanifest/filelist/file');

        for (i = 0; i < files.length; i++) {
                var postTag = xml.createNode(1, 'post', '');
                postTag.setAttribute('href', '<?php 
    echo 'http://' . $HTTP_SERVER_VARS['HTTP_HOST'] . $PHP_SELF . '?cmd=add_picture';
    ?>
&album=' + selform.album.value);
                postTag.setAttribute('name', 'userpicture');

                var dataTag = xml.createNode(1, 'formdata', '');
                dataTag.setAttribute('name', 'MAX_FILE_SIZE');
                dataTag.text = '10000000';
                postTag.appendChild(dataTag);

                files.item(i).appendChild(postTag);
        }

        var uploadTag = xml.createNode(1, 'uploadinfo', '');
        uploadTag.setAttribute('friendlyname', '<?php 
    echo javascript_string($CONFIG['gallery_name']);
    ?>
');
        var htmluiTag = xml.createNode(1, 'htmlui', '');
        htmluiTag.text = '<?php 
    echo 'http://' . $HTTP_SERVER_VARS['HTTP_HOST'] . dirname($PHP_SELF) . '/';
    ?>
';
        uploadTag.appendChild(htmluiTag);

        xml.documentElement.appendChild(uploadTag);

        window.external.Property('TransferManifest')=xml;
        window.external.SetWizardButtons(true,true,true);
        content.innerHtml=xml;
        window.external.FinalNext();
}

function OnBack() {
        <?php 
    echo $ONBACK_SCRIPT;
    ?>
        window.external.SetWizardButtons(false,true,false);
}

function OnNext() {
        <?php 
    echo $ONNEXT_SCRIPT;
    ?>
}

function OnCancel() {
}

function window.onload() {
        window.external.SetHeaderText('<?php 
    echo javascript_string($CONFIG['gallery_name']);
    ?>
','<?php 
    echo javascript_string($CONFIG['gallery_description']);
    ?>
');
        window.external.SetWizardButtons(<?php 
    echo $WIZARD_BUTTONS;
    ?>
);
}
</script>
</body>
</html>
<?php 
}
Esempio n. 2
0
function output_footer()
{
    global $WIZARD_BUTTONS, $ONBACK_SCRIPT, $ONNEXT_SCRIPT;
    global $CONFIG, $CPG_PHP_SELF;
    $site_url = trim($CONFIG['site_url'], '/') . '/';
    $gallery_name_javascript = javascript_string($CONFIG['gallery_name']);
    $gallery_description_javascript = javascript_string($CONFIG['gallery_description']);
    print <<<EOT

<div id="content"></div>

<script language="javascript" type="text/javascript">
function create_alb() {
        if (createAlb.newAlbName.value == ''){
                return false;
        } else {
                createAlb.submit();
        }
}

function create_alb_or_use_existing() {
        if (createAlb.newAlbName.value == ''){
                startUpload();
        } else {
                createAlb.submit();
        }
}

function startUpload() {
        var xml = window.external.Property('TransferManifest');
        var files = xml.selectNodes('transfermanifest/filelist/file');

        for (i = 0; i < files.length; i++) {
                var postTag = xml.createNode(1, 'post', '');
                postTag.setAttribute('href', '{$site_url}{$CPG_PHP_SELF}?cmd=add_picture&album=' + selform.album.value);
                postTag.setAttribute('name', 'userpicture');

                var dataTag = xml.createNode(1, 'formdata', '');
                dataTag.setAttribute('name', 'MAX_FILE_SIZE');
                dataTag.text = '10000000';
                postTag.appendChild(dataTag);

                files.item(i).appendChild(postTag);
        }

        var uploadTag = xml.createNode(1, 'uploadinfo', '');
        uploadTag.setAttribute('friendlyname', '{$gallery_name_javascript}');
        var htmluiTag = xml.createNode(1, 'htmlui', '');
        htmluiTag.text = '{$site_url}';
        uploadTag.appendChild(htmluiTag);

        xml.documentElement.appendChild(uploadTag);

        window.external.Property('TransferManifest')=xml;
        window.external.SetWizardButtons(true,true,true);
        content.innerHtml=xml;
        window.external.FinalNext();
}

function OnBack() {
        {$ONBACK_SCRIPT}
        window.external.SetWizardButtons(false,true,false);
}

function OnNext() {
        {$ONNEXT_SCRIPT}
}

function OnCancel() {
}

function window.onload() {
        window.external.SetHeaderText('{$gallery_name_javascript}','{$gallery_description_javascript}');
        window.external.SetWizardButtons({$WIZARD_BUTTONS});
}
</script>
</body>
</html>
EOT;
}