NEW: Added option to enable Google Vision plugin and set API key on setup.php [q11350]
git-svn-id: http://svn.resourcespace.com/svn/rs/trunk@16770 c08608d7-6e46-0410-86ca-f2a6f1370df5
This commit is contained in:
parent
e8d573de77
commit
5565397478
|
@ -2953,3 +2953,6 @@ $lang["csv_export_filename"] = "metadata_export_%%SEARCH%%_%%TIME
|
|||
$lang["csv_export_file_ready"] = "Your CSV export is ready";
|
||||
$lang["offline_processing_disabled"] = "Offline job processing is not configured on this system. To enable this please contact your system administrator";
|
||||
$lang['csv_export_offline_only'] = "Offline processing must be used when exporting data for more than %%RESOURCE_COUNT%% resources";
|
||||
|
||||
$lang["setup_google_vision_settings"] = "Google Vision settings";
|
||||
$lang["setup_google_vision_enable"] = "Enable Google Vision plugin?";
|
224
pages/setup.php
224
pages/setup.php
|
@ -963,6 +963,18 @@ if ((isset($_REQUEST['submit'])) && (!isset($errors)) && (!isset($warnings)))
|
|||
trigger_error("Unable to copy image from '{$from_file}' to '{$to_file}' for slideshow #{$new_slideshow_image}");
|
||||
}
|
||||
}
|
||||
|
||||
$google_vision_enable=getval('google_vision_enable','') != "";
|
||||
if($google_vision_enable)
|
||||
{
|
||||
$google_vision_api_key= getvalescaped('google_vision_key','');
|
||||
|
||||
// Activate and get default config
|
||||
activate_plugin("google_vision");
|
||||
$plugin_config = get_plugin_config("google_vision");
|
||||
$plugin_config["google_vision_api_key"] = $google_vision_api_key;
|
||||
set_plugin_config("google_vision",$plugin_config);
|
||||
}
|
||||
|
||||
// Create user
|
||||
|
||||
|
@ -1155,27 +1167,49 @@ else
|
|||
include "../include/plugin_functions.php";
|
||||
$plugins_dir = dirname(__FILE__)."/../plugins/";
|
||||
# Build an array of available plugins.
|
||||
$dirh = opendir($plugins_dir);
|
||||
$plugins_avail = array();
|
||||
$dirh = opendir($plugins_dir);
|
||||
$plugins_avail = array();
|
||||
|
||||
while (false !== ($file = readdir($dirh)))
|
||||
{
|
||||
if (is_dir($plugins_dir.$file)&&$file[0]!='.')
|
||||
{
|
||||
# Look for a <pluginname>.yaml file.
|
||||
$plugin_yaml = get_plugin_yaml($plugins_dir.$file.'/'.$file.'.yaml', false);
|
||||
if(isset($plugin_yaml["category"])
|
||||
&& $plugin_yaml["category"]=="structural"
|
||||
&& isset($plugin_yaml["info_url"])
|
||||
&& isset($plugin_yaml["setup_desc"])
|
||||
&& isset($plugin_yaml["name"])
|
||||
)
|
||||
{
|
||||
foreach ($plugin_yaml as $key=>$value)
|
||||
{
|
||||
$plugins_avail[$file][$key] = $value ;
|
||||
}
|
||||
}
|
||||
while (false !== ($file = readdir($dirh)))
|
||||
{
|
||||
if (is_dir($plugins_dir.$file)&&$file[0]!='.')
|
||||
{
|
||||
# Look for a <pluginname>.yaml file.
|
||||
$plugin_yaml = get_plugin_yaml($plugins_dir.$file.'/'.$file.'.yaml', false);
|
||||
if(isset($plugin_yaml["category"])
|
||||
&& $plugin_yaml["category"]=="structural"
|
||||
&& isset($plugin_yaml["info_url"])
|
||||
&& isset($plugin_yaml["setup_desc"])
|
||||
&& isset($plugin_yaml["name"])
|
||||
)
|
||||
{
|
||||
foreach ($plugin_yaml as $key=>$value)
|
||||
{
|
||||
$plugins_avail[$file][$key] = $value ;
|
||||
}
|
||||
}
|
||||
# Include all plugin language files
|
||||
$langpath = $plugins_dir . $file . "/languages/";
|
||||
|
||||
if (file_exists($langpath . "en.php"))
|
||||
{
|
||||
include $langpath . "en.php";
|
||||
}
|
||||
|
||||
if ($lang != "en")
|
||||
{
|
||||
if (substr($lang, 2, 1) == '-' && substr($lang, 0, 2) != 'en')
|
||||
{
|
||||
if (file_exists($langpath . safe_file_name(substr($lang, 0, 2)) . ".php"))
|
||||
{
|
||||
include $langpath . safe_file_name(substr($lang, 0, 2)) . ".php";
|
||||
}
|
||||
}
|
||||
if (file_exists($langpath . safe_file_name($lang) . ".php"))
|
||||
{
|
||||
include $langpath . safe_file_name($lang) . ".php";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($dirh);
|
||||
|
@ -1425,67 +1459,103 @@ else
|
|||
</p>
|
||||
|
||||
|
||||
<h2><?php echo $lang["setup-smtp-settings"]; ?></h2>
|
||||
<div class="advsection" id="smtpsettings">
|
||||
<div class="configitem">
|
||||
<label for="use_smtp"><?php echo $lang["usesmtp"] . ":"; ?></label>
|
||||
<input id="use_smtp" name="use_smtp" type="checkbox" <?php echo $use_smtp?"checked":"";?>/>
|
||||
<a class="iflink" href="#if-usesmtp">?</a>
|
||||
<p class="iteminfo" id="if-usesmtp"><?php echo $lang["setup-if-usesmtp"];?></p>
|
||||
</div>
|
||||
<div id="use-SMTP-settings">
|
||||
<div class="configitem">
|
||||
<label for="smtp_secure"><?php echo $lang["smtpsecure"] . ":"; ?></label>
|
||||
<input id="smtp_secure" name="smtp_secure" type="text" value="<?php echo $smtp_secure;?>" />
|
||||
<a class="iflink" href="#if-smtpsecure">?</a>
|
||||
<p class="iteminfo" id="if-smtpsecure"><?php echo $lang["setup-if-smtpsecure"];?></p>
|
||||
</div>
|
||||
<div class="configitem">
|
||||
<label for="smtp_host"><?php echo $lang["smtphost"] . ":"; ?></label>
|
||||
<input id="smtp_host" name="smtp_host" type="text" value="<?php echo $smtp_host;?>"/>
|
||||
<a class="iflink" href="#if-smtphost">?</a>
|
||||
<p class="iteminfo" id="if-smtphost"><?php echo $lang["setup-if-smtphost"];?></p>
|
||||
</div>
|
||||
<div class="configitem">
|
||||
<label for="smtp_port"><?php echo $lang["smtpport"] . ":"; ?></label>
|
||||
<input id="smtp_port" name="smtp_port" type="text" value="<?php echo $smtp_port;?>"/>
|
||||
<a class="iflink" href="#if-smtpport">?</a>
|
||||
<p class="iteminfo" id="if-smtpport"><?php echo $lang["setup-if-smtpport"];?></p>
|
||||
</div>
|
||||
<div class="configitem">
|
||||
<label for="smtp_auth"><?php echo $lang["smtpauth"] . ":"; ?></label>
|
||||
<input id="smtp_auth" name="smtp_auth" type="checkbox" checked />
|
||||
<a class="iflink" href="#if-smtpauth">?</a>
|
||||
<p class="iteminfo" id="if-smtpauth"><?php echo $lang["setup-if-smtpauth"];?></p>
|
||||
</div>
|
||||
<div class="configitem">
|
||||
<label for="smtp_username"><?php echo $lang["smtpusername"] . ":"; ?></label>
|
||||
<input id="smtp_username" name="smtp_username" type="text" value="<?php echo $smtp_username;?>"/>
|
||||
<a class="iflink" href="#if-smtpusername">?</a>
|
||||
<p class="iteminfo" id="if-smtpusername"><?php echo $lang["setup-if-smtpusername"];?></p>
|
||||
</div>
|
||||
<div class="configitem">
|
||||
<label for="smtp_password"><?php echo $lang["smtppassword"] . ":"; ?></label>
|
||||
<input id="smtp_password" name="smtp_password" type="password" value="<?php echo $smtp_password;?>"/>
|
||||
<a class="iflink" href="#if-smtppassword">?</a>
|
||||
<p class="iteminfo" id="if-smtppassword"><?php echo $lang["setup-if-smtppassword"];?></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<h2><?php echo $lang["setup-smtp-settings"]; ?></h2>
|
||||
<div class="advsection" id="smtpsettings">
|
||||
<div class="configitem">
|
||||
<label for="use_smtp"><?php echo $lang["usesmtp"] . ":"; ?></label>
|
||||
<input id="use_smtp" name="use_smtp" type="checkbox" <?php echo $use_smtp?"checked":"";?>/>
|
||||
<a class="iflink" href="#if-usesmtp">?</a>
|
||||
<p class="iteminfo" id="if-usesmtp"><?php echo $lang["setup-if-usesmtp"];?></p>
|
||||
</div>
|
||||
<div id="use-SMTP-settings">
|
||||
<div class="configitem">
|
||||
<label for="smtp_secure"><?php echo $lang["smtpsecure"] . ":"; ?></label>
|
||||
<input id="smtp_secure" name="smtp_secure" type="text" value="<?php echo $smtp_secure;?>" />
|
||||
<a class="iflink" href="#if-smtpsecure">?</a>
|
||||
<p class="iteminfo" id="if-smtpsecure"><?php echo $lang["setup-if-smtpsecure"];?></p>
|
||||
</div>
|
||||
<div class="configitem">
|
||||
<label for="smtp_host"><?php echo $lang["smtphost"] . ":"; ?></label>
|
||||
<input id="smtp_host" name="smtp_host" type="text" value="<?php echo $smtp_host;?>"/>
|
||||
<a class="iflink" href="#if-smtphost">?</a>
|
||||
<p class="iteminfo" id="if-smtphost"><?php echo $lang["setup-if-smtphost"];?></p>
|
||||
</div>
|
||||
<div class="configitem">
|
||||
<label for="smtp_port"><?php echo $lang["smtpport"] . ":"; ?></label>
|
||||
<input id="smtp_port" name="smtp_port" type="text" value="<?php echo $smtp_port;?>"/>
|
||||
<a class="iflink" href="#if-smtpport">?</a>
|
||||
<p class="iteminfo" id="if-smtpport"><?php echo $lang["setup-if-smtpport"];?></p>
|
||||
</div>
|
||||
<div class="configitem">
|
||||
<label for="smtp_auth"><?php echo $lang["smtpauth"] . ":"; ?></label>
|
||||
<input id="smtp_auth" name="smtp_auth" type="checkbox" checked />
|
||||
<a class="iflink" href="#if-smtpauth">?</a>
|
||||
<p class="iteminfo" id="if-smtpauth"><?php echo $lang["setup-if-smtpauth"];?></p>
|
||||
</div>
|
||||
<div class="configitem">
|
||||
<label for="smtp_username"><?php echo $lang["smtpusername"] . ":"; ?></label>
|
||||
<input id="smtp_username" name="smtp_username" type="text" value="<?php echo $smtp_username;?>"/>
|
||||
<a class="iflink" href="#if-smtpusername">?</a>
|
||||
<p class="iteminfo" id="if-smtpusername"><?php echo $lang["setup-if-smtpusername"];?></p>
|
||||
</div>
|
||||
<div class="configitem">
|
||||
<label for="smtp_password"><?php echo $lang["smtppassword"] . ":"; ?></label>
|
||||
<input id="smtp_password" name="smtp_password" type="password" value="<?php echo $smtp_password;?>"/>
|
||||
<a class="iflink" href="#if-smtppassword">?</a>
|
||||
<p class="iteminfo" id="if-smtppassword"><?php echo $lang["setup-if-smtppassword"];?></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<h2><?php echo $lang["pluginssetup"]; ?></h2>
|
||||
<div class="advsection" id="plugin_settings">
|
||||
<div class="configitem">
|
||||
<label for="google_vision_enable"><?php echo $lang["setup_google_vision_enable"]; ?></label>
|
||||
<input id="google_vision_enable" name="google_vision_enable" type="checkbox" <?php echo $google_vision_enable ? "checked" : "";?>/>
|
||||
<a class="iflink" href="https://www.resourcespace.com/knowledge-base/plugins/google-vision" target="_blank">?</a>
|
||||
</div>
|
||||
<div id="plugin_google_vision_settings">
|
||||
<div class="configitem">
|
||||
<label for="google_vision_key"><?php echo $lang["google_vision_api_key"] . ":"; ?></label>
|
||||
<input id="google_vision_key" name="google_vision_key" type="text" value="<?php echo (isset($google_vision_key)) ? htmlspecialchars($google_vision_key) : "";?>" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="submit" id="submit" name="submit" value="<?php echo $lang["setup-begin_installation"];?>"/>
|
||||
</div>
|
||||
</form>
|
||||
<script>
|
||||
jQuery("#use_smtp").click(function(){
|
||||
if(jQuery(this).prop("checked")) {
|
||||
jQuery("#use-SMTP-settings").show(300);
|
||||
} else {
|
||||
jQuery("#use-SMTP-settings").hide(300);
|
||||
}
|
||||
});
|
||||
if(!jQuery("#use_smtp").prop("checked")) {
|
||||
jQuery("#use-SMTP-settings").hide();
|
||||
}
|
||||
jQuery("#use_smtp").click(function()
|
||||
{
|
||||
if(jQuery(this).prop("checked"))
|
||||
{
|
||||
jQuery("#use-SMTP-settings").show(300);
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery("#use-SMTP-settings").hide(300);
|
||||
}
|
||||
});
|
||||
if(!jQuery("#use_smtp").prop("checked"))
|
||||
{
|
||||
jQuery("#use-SMTP-settings").hide();
|
||||
}
|
||||
jQuery("#google_vision_enable").click(function()
|
||||
{
|
||||
if(jQuery(this).prop("checked"))
|
||||
{
|
||||
jQuery("#plugin_google_vision_settings").show(300);
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery("#plugin_google_vision_settings").hide(300);
|
||||
}
|
||||
});
|
||||
if(!jQuery("#google_vision_enable").prop("checked"))
|
||||
{
|
||||
jQuery("#plugin_google_vision_settings").hide();
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
<?php }
|
||||
if (($develmode)&& isset($config_output))
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
$google_vision_api_key="";
|
||||
$google_vision_label_field=73;
|
||||
$google_vision_landmarks_field=1;
|
||||
$google_vision_label_field=84;
|
||||
$google_vision_landmarks_field=85;
|
||||
$google_vision_text_field=18;
|
||||
$google_vision_restypes=array("1");
|
||||
$google_vision_features=array("LABEL_DETECTION","LANDMARK_DETECTION","TEXT_DETECTION");
|
||||
|
|
|
@ -9,7 +9,7 @@ $lang["google_vision_api"]="Google Vision API";
|
|||
$lang["google_vision_restypes"]="Enabled resource types";
|
||||
$lang["google_vision_features"]="Enabled feature detection";
|
||||
$lang["google_vision_autotitle"]="Automatically set the title to the highest ranking keyword";
|
||||
$lang["google_vision_help"]="<strong>IMPORTANT</strong> - It is suggested that new fields are created for the purpose of storing Google Vision data, so it is clearly distict from user-entered content.";
|
||||
$lang["google_vision_help"]="<strong>IMPORTANT</strong> - It is suggested that new fields are created for the purpose of storing Google Vision data, so it is clearly distinct from user-entered content.";
|
||||
$lang["google_vision_face_detect"] = "Facial detection";
|
||||
$lang["google_vision_face_detect_field"]="Field to store face detection data in (optional)";
|
||||
$lang["google_vision_face_detect_fullface"] = "If storing face data, detect full faces and not just skin area. See <a href='https://cloud.google.com/vision/docs/reference/rest/v1/images/annotate#FaceAnnotation' target='_blank'>this link</a> for more information";
|
||||
|
|
Loading…
Reference in New Issue