Xare-a-Link /system/application/views/core/newlink.php

Language PHP Lines 364
MD5 Hash ebf1465860dd61917e12b288465e239c
Repository https://github.com/xupisco/Xare-a-Link.git View Raw File View Project SPDX
  1
  2
  3
  4
  5
  6
  7
  8
  9
 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
<?php
$_seo['is_home'] = true;
$this->load->view("common/layout_top", $_seo);
?>

<script src="<?= base_url(); ?>js/jquery_charcounter.js" language="JavaScript"></script>
<script src="<?= base_url(); ?>js/jquery_impromptu.js" language="JavaScript"></script>
<script src="<?= base_url(); ?>js/jquery_selectboxes.js" language="JavaScript"></script>

<script type="text/javascript">
$(document).ready(function() {
    $("#link_desc").charCounter(255, {
        container: "<span style='font-size: 11px'>",
        classname: "counter",
        format: "%1 caracteres restantes!",
        pulse: false
    });

    $("#ndb").click(function() {
        tmp = "last";
        $.prompt(txt,{
            callback: mycallbackform,
            show: 'fadeIn',
            opacity: '0.8',
            overlayspeed: 'fast',
			buttons: { Incluir: 'OK', Cancelar: 'Cancel' }
        });
        //$("#dirName").focus();
    });
    parseDest(1);
});

var lvl_cnt = <?= $parents_cnt ?>;
var lvl = 0;
var tmp = 0;
var txt = "";
var cvals = "";
var cpath = "";
var validLink = true;

function removeTyped(force) {
    force = (!force) ? 0 : 1;
    if(force) {
        $("#new_dir").css("display","inline");
    } else {
        $("#new_dir").hide();
    }
    $("#new_dir_c").hide();
    $("#new_dir_txt").html("");
    parseDest(1);
}

function removeDir(n, g) {
    g = (!g) ? 0 : g;
    removed = 0;
    for(i = n; i <= lvl_cnt; i++) {
        div = "#ddir_" + i;
        $(div).remove();
        removed++;
    }
    lvl_cnt = (lvl_cnt - removed) + 1;
    if(g) {
        getDir(g, parseInt(n)-1);
    }
    removeTyped();
    parseDest(1);
}

function parseDest(w) {
    w = (!w) ? 0 : w;
    cvals = "";
    cpath = "";
    for(i=0; i< lvl_cnt; i++) {
        opt = "#dir_" + i + " option:selected";
        if($(opt).val() != "0") {
            cvals += $(opt).val() + "|||||";
            cpath += $(opt).text() + " / ";
        }
    }

    if($("#new_dir_txt").html().length > 2) {
        cvals += "new_" + $("#new_dir_txt").html() + "|||||";
    }

    cvals = cvals.substr(0, cvals.length - 5);
    cpath = cpath.substr(0, cpath.length - 3);
    ctitle = $("#link_title").val();

    if(w) {
        ct = (ctitle.length) ? " / <b style='color: #dd2222'>" + ctitle + "</b>" : "";
        typed = $("#new_dir_txt").html();
        t = (typed.length) ? " / (+) " + typed : "";
        $("#ldest").html(cpath + t + ct);
    }

    $("#h_parents").val(cvals);
    return true;
}

function getDir(id, lvl) {
    $.post("ajax/getdir/", { id: (id), lvl: (lvl)},
       function(data){
            if(data != "NONE") {
                $("#new_dir").hide();
                next = "#ddir_" + lvl;
                $(next).after(data);
                lvl_cnt++;
            } else {
                $("#new_dir").css("display","inline");
            }
            $("#loader").hide();
       }
    );
}

function cleanMe(e, txt) {
    if(e.value == txt) e.value = "";
}

function seedMe(e, txt) {
    if(e.value.length == 0) e.value = txt;
}

function getPR() {
    url = $("#link_url").val();
    if(url != "http://" && url != "0" && url != "") {
		validLink = false;
	    $.post("ajax/getpr/", { url: (url) },
	       function(data){
                $("#quick_pr").html("PageRank: " + data + " ");
	            $("#quick_pr").show();
	       }
	    );
        $.post("ajax/validateURL/", { url: (url) },
	       function(data){
                if(data == "FOUND") {
                    validLink = false;
					$("#quick_pr").hide();
                    $("#urlerror").show();
                } else {
                    validLink = true;
				}
	       }
	    );
		$("#link_title").val("Buscando tьtulo...");
		$("#link_desc").val("Buscando descriусo...");
	    $.post("ajax/getmeta/", { url: (url) },
	       function(data) {
		   		d = data.split("|||||");
		   		if(d[0] != "error") {
					$("#link_title").val(d[0]);
					$("#link_desc").focus();
				} else { $("#link_title").val(""); }
		   		if(d[1] != "error") {
					$("#link_desc").val(d[1]);
					$("#link_desc").blur();
				} else { $("#link_desc").val(""); }
	       }
	    );
	} else {
	   $("#quick_pr").hide();
	}
    $("#urlerror").hide();
}

txt += "<b>Digite o nome do novo grupo!</b>";
txt += '<br /><img src="images/common/dot.gif" width="1" height="10" /><br />';
txt += '<input type="text" id="dirName" name="dir_name" value="Nome..." style="width: 256px; padding: 4px;" onfocus="cleanMe(this, \'Nome...\');" onblur="seedMe(this, \'Nome...\');" />';

function mycallbackform(v, m){
    nn = m.children('#dirName').val();
    if(v == "OK") {
        if(nn != "Nome...") {
            if(tmp != "last") {
		        selected = "#dir_" + tmp;
		        ngo = "nd_" + tmp;
				$(selected).addOption("new_" + nn, "(+) " + nn, true);
				removeDir(parseInt(tmp) + 1);
			} else {
			    $("#new_dir").hide();
			    $("#new_dir_c").css("display","inline");
			    $("#new_dir_txt").html(nn);
			}
			parseDest(1);
	    }
    }
}

function parseDir(e) {
    lvl = e.id.replace("dir_", "");
    val = e.value.replace("nd_", "");

    if(e.value.substr(0,3) == "nd_") {
        tmp = lvl;
        $.prompt(txt,{
            callback: mycallbackform,
            show: 'fadeIn',
            opacity: '0.8',
            overlayspeed: 'fast',
            buttons: { Incluir: 'OK', Cancelar: 'Cancel' }
        });
    } else {
        if(val == "0") {
            removeDir(parseInt(lvl)+1);
            return false;
        }
        removeDir(parseInt(lvl)+1, val);
        $("#loader").css("display","inline");
    }
}

function toggleBG(i, e) {
    if(i) { $(e).css({ backgroundColor: '#F2FFE8' }); }
    else { $(e).css({ backgroundColor: '#ffffff' }); }
}

function parseForm() {
	if(!validLink) {
		alert("Problema com a URL. Digite novamente!!!");
		return false;
	}
    $("#n_parents").val(cpath);
    if(!$("#link_title").val()) {
        alert("Tьtulo do link obrigatзrio!");
        return false;
    }
    $("#urlerror").hide();
    return true;
}
</script>

<style>
@import "css/impromptu.css";
</style>

<!-- Width = 100% para pegar a largura toda. 760 = Default -->
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td align="left">

		<img src="images/common/dot.gif" width="1" height="6" />

        <div>
        <b>Buscar por:</b> <input type="text" name="q" value="" class="main_search" /> <select name="qt" class="main_select"><option value="all">Em qualquer lugar&nbsp;&nbsp;</option></select>
        </div>

        <img src="images/common/dot.gif" width="1" height="12" /><br />

		<table width="100%" cellpadding="0" cellspacing="0">
			<tr>
				<td class="str_nav">
				<img src="images/common/dot.gif" width="2" height="1" /><a href="<?= base_url(); ?>index.html"><b>x.are</b></a>
				<span class="nav_sep">&raquo;</span>
				<a href="newlink/rel=<?= $rel; ?>" id="content_name">Novo link</a>
				</td>
			</tr>
		</table>
		</td>
	</tr>
	<tr>
		<td class="default_content" valign="top" align="left">

    	<div id="content_desc" style="padding-left: 2px">Formulрrio para inclusсo de novo link. Siga as instruушes que tudo da certo.</div>

        <img src="images/common/dot.gif" width="1" height="8" /><br />

        <div id="dbar">
        <div style="float: left"><img src="images/icons/step_01.gif" /></div>
        <div style="float: right">DЩvidas? Leia nosso FAQ</div>
        <b>Informaушes bрsicas</b>
        </div>

        <form action="post" method="post" onsubmit="return parseForm();">

        <div id="content_rel">
        <table width="100%" cellpadding="4" cellspacing="2">
        <tr><td align="right" valign="top" nowrap="nowrap"><img src="images/common/dot.gif" width="1" height="3" /><br />Endereуo (URL): </td><td><input type="text" class="std_input" value="http://" name="link_url" id="link_url" onblur="getPR()" /><div id="quick_pr" style="display: none; font-size: 11px; color: #777777; padding-top: 2px">PageRank: </div><div id="urlerror" style="display: none; font-size: 11px; color: #ff0000; padding-top: 2px">Essa URL jр estр cadastrada.</div></td><td style="font-size: 11px; color: #777777; padding-left: 10px;" valign="top"><img src="images/common/dot.gif" width="1" height="5" /><br />Nсo publique links repetidos, faуa uma busca antes de incluir.</td></tr>
        <tr><td align="right" width="10%">Tьtulo do link: </td><td width="40%"><input type="text" class="std_input" name="link_title" id="link_title" onblur="parseDest(1)" /></td><td style="font-size: 11px; color: #777777; padding-left: 10px;" width="30%">Como o link serр listado nas pрginas.</td></tr>
        <tr><td align="right" valign="top"><img src="images/common/dot.gif" width="1" height="2" /><br />Descriусo: </td><td><textarea class="std_ta" name="link_desc" id="link_desc"></textarea></td><td style="font-size: 11px; color: #777777; padding-left: 10px;" valign="top"><img src="images/common/dot.gif" width="1" height="2" /><br />Observe o limite de caracteres e seja o mais objetivo possьvel.</td></tr>
        </table>
        </div>

        <div id="dbar">
        <div style="float: left"><img src="images/icons/step_02.gif" /></div>
        <div style="float: right">Selecione um diretзrio para o link</div>
        <b>Segmentaусo</b></div>
        <img src="images/common/dot.gif" width="1" height="10" /><br />

        <div id="content_rel" style="padding: 7px;">

        <div id="null" style="display: inline;"><b>x.are</b></div>
        <div id="sep" style="display: inline;"><span class="nav_sep">&raquo;</span></div>

        <? for($i = 0; $i < ($parents_cnt); $i++) { $rs = "lvl_$i"?>
        <div id="ddir_<?= $i ?>" style="display: inline;">

        <div style="display: inline;">
        <select name="dir_<?= $i ?>" id="dir_<?= $i ?>" onchange="parseDir(this)">
        <option value="0">Selecione</option>
        <option value="0" style="color: #dddddd">---------------</option>
	        <?php
	        foreach($$rs as $row) {
	        	$sel = ($row->id == $parents[$i]) ? " selected" : "";
	        	echo "<option value='".$row->id."'$sel>".$row->name."</option>";
	        }
	        ?>
        <option value="0" style="color: #dddddd">---------------</option>
        <option value="nd_<?= $i ?>" style="color: #ee2222"> + incluir grupo</option>
        </select>
        </div>

        <?php if($i != 0) { ?>
        <div style="display: inline; vertical-align: middle" id="remove_<?= $i ?>"><a href="javascript:removeDir(<?= $i ?>);"><img src="images/icons/dir_remove.gif" border="0" title="Remover este sub-grupo" /></a></div>
        <?php } ?>
        <?php if($i != ($parents_cnt - 1)) { ?>
        <div id="sep" style="display: inline;"><span class="nav_sep">&raquo;</span></div>
        <?php } ?>
        </div>
        <? } ?>

        <div style="display: none;" id="loader">
        <div style="display: inline; vertical-align: middle;" id="loader_img"><img src="images/ajax_loader-content.gif" /></div>
        <div id="sep" style="display: inline;"><span class="nav_sep">&raquo;</span></div>
        </div>

        <div id="new_dir" style="display: <?= ($showb == 0) ? "inline" : "none"; ?>">
        <input type="button" value=" + Sub-grupo " id="ndb" / ></div>
        <div id="new_dir_c" style="display: none;">
        <div id="new_dir_txt" style="display: inline; font-weight: bold"></div>
        <div style="display: inline; vertical-align: middle" id="remove_ndt"><a href="javascript:removeTyped(1);"><img src="images/icons/dir_remove.gif" border="0" title="Remover este sub-grupo" /></a></div>
        </div>

        </div>

        <img src="images/common/dot.gif" width="1" height="10" /><br />

        <div id="dbar">
        <div style="float: left"><img src="images/icons/step_03.gif" /></div>
        <div style="float: right">Confirme os dados antes de enviar</div>
        <b>Confirmaусo</b></div>

        <img src="images/common/dot.gif" width="1" height="4" /><br />
        <div style="padding: 6px; float: right">
        <input type="submit" value="Enviar link" style="background-color: #99C145; border: 1px solid #69832F; padding: 6px; color: #ffffff; font-weight: bold" />
        </div>
        <div style="padding: 10px; font-size: 18px">
        <span style="color: #888888">Destino do link:</span> <b>x.are</b> / <span id="ldest"></span>
        </div>

        <img src="images/common/dot.gif" width="1" height="10" /><br />
        <input type="hidden" name="h_parents" id="h_parents" value="" />
        <input type="hidden" name="n_parents" id="n_parents" value="" />
        </form>

        <img src="images/common/dot.gif" width="1" height="12" /><br />
        <div id="roots">
        <b>x.are</b> 2007 - Todos os direitos reservados. Leia nosso FAQ para mais informaушes sobre como utilizar a ferramenta.
        </div>

		</td>
	</tr>
</table>

<?php $this->load->view("common/layout_bottom"); ?>
Back to Top